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
Azure/azure-sdk-for-java
datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java
ServicesInner.stopAsync
public Observable<Void> stopAsync(String groupName, String serviceName) { return stopWithServiceResponseAsync(groupName, serviceName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> stopAsync(String groupName, String serviceName) { return stopWithServiceResponseAsync(groupName, serviceName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "stopAsync", "(", "String", "groupName", ",", "String", "serviceName", ")", "{", "return", "stopWithServiceResponseAsync", "(", "groupName", ",", "serviceName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse...
Stop service. The services resource is the top-level resource that represents the Data Migration Service. This action stops the service and the service cannot be used for data migration. The service owner won't be billed when the service is stopped. @param groupName Name of the resource group @param serviceName Name of the service @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Stop", "service", ".", "The", "services", "resource", "is", "the", "top", "-", "level", "resource", "that", "represents", "the", "Data", "Migration", "Service", ".", "This", "action", "stops", "the", "service", "and", "the", "service", "cannot", "be", "used...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java#L1218-L1225
apache/groovy
subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
Sql.executeInsert
public List<GroovyRowResult> executeInsert(String sql, String[] keyColumnNames, Object[] params) throws SQLException { return executeInsert(sql, Arrays.asList(params), Arrays.asList(keyColumnNames)); }
java
public List<GroovyRowResult> executeInsert(String sql, String[] keyColumnNames, Object[] params) throws SQLException { return executeInsert(sql, Arrays.asList(params), Arrays.asList(keyColumnNames)); }
[ "public", "List", "<", "GroovyRowResult", ">", "executeInsert", "(", "String", "sql", ",", "String", "[", "]", "keyColumnNames", ",", "Object", "[", "]", "params", ")", "throws", "SQLException", "{", "return", "executeInsert", "(", "sql", ",", "Arrays", ".",...
Executes the given SQL statement (typically an INSERT statement). This variant allows you to receive the values of any auto-generated columns, such as an autoincrement ID field (or fields) when you know the column name(s) of the ID field(s). <p> An array variant of {@link #executeInsert(String, List, List)}. <p> This method supports named and named ordinal parameters by supplying such parameters in the <code>params</code> array. See the class Javadoc for more details. @param sql The SQL statement to execute @param keyColumnNames an array of column names indicating the columns that should be returned from the inserted row or rows (some drivers may be case sensitive, e.g. may require uppercase names) @param params The parameter values that will be substituted into the SQL statement's parameter slots @return A list of the auto-generated row results for each inserted row (typically auto-generated keys) @throws SQLException if a database access error occurs @since 2.3.2
[ "Executes", "the", "given", "SQL", "statement", "(", "typically", "an", "INSERT", "statement", ")", ".", "This", "variant", "allows", "you", "to", "receive", "the", "values", "of", "any", "auto", "-", "generated", "columns", "such", "as", "an", "autoincremen...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L2809-L2811
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/io/IOUtils.java
IOUtils.encodedInputStreamReader
public static Reader encodedInputStreamReader(InputStream stream, String encoding) throws IOException { // InputStreamReader doesn't allow encoding to be null; if (encoding == null) { return new InputStreamReader(stream); } else { return new InputStreamReader(stream, encoding); } }
java
public static Reader encodedInputStreamReader(InputStream stream, String encoding) throws IOException { // InputStreamReader doesn't allow encoding to be null; if (encoding == null) { return new InputStreamReader(stream); } else { return new InputStreamReader(stream, encoding); } }
[ "public", "static", "Reader", "encodedInputStreamReader", "(", "InputStream", "stream", ",", "String", "encoding", ")", "throws", "IOException", "{", "// InputStreamReader doesn't allow encoding to be null;\r", "if", "(", "encoding", "==", "null", ")", "{", "return", "n...
Create a Reader with an explicit encoding around an InputStream. This static method will treat null as meaning to use the platform default, unlike the Java library methods that disallow a null encoding. @param stream An InputStream @param encoding A charset encoding @return A Reader @throws IOException If any IO problem
[ "Create", "a", "Reader", "with", "an", "explicit", "encoding", "around", "an", "InputStream", ".", "This", "static", "method", "will", "treat", "null", "as", "meaning", "to", "use", "the", "platform", "default", "unlike", "the", "Java", "library", "methods", ...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/io/IOUtils.java#L1320-L1327
davidcarboni/restolino
src/main/java/com/github/davidcarboni/restolino/api/Router.java
Router.handleNotFound
private void handleNotFound(HttpServletRequest request, HttpServletResponse response) throws IOException { // Set a default response code: response.setStatus(HttpServletResponse.SC_NOT_FOUND); // Attempt to handle the not-found: Object notFoundResponse = notFound.handle(request, response); if (notFoundResponse != null) { Serialiser.serialise(response, notFoundResponse); } }
java
private void handleNotFound(HttpServletRequest request, HttpServletResponse response) throws IOException { // Set a default response code: response.setStatus(HttpServletResponse.SC_NOT_FOUND); // Attempt to handle the not-found: Object notFoundResponse = notFound.handle(request, response); if (notFoundResponse != null) { Serialiser.serialise(response, notFoundResponse); } }
[ "private", "void", "handleNotFound", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "IOException", "{", "// Set a default response code:", "response", ".", "setStatus", "(", "HttpServletResponse", ".", "SC_NOT_FOUND", ")", ";"...
Handles a request where no API endpoint is defined. If {@link #notFound} is set, {@link NotFound#handle(HttpServletRequest, HttpServletResponse)} will be called. Otherwise a simple 404 will be returned. @param request {@link HttpServletRequest} @param response {@link HttpServletResponse} @throws IOException If an error occurs in sending the response.
[ "Handles", "a", "request", "where", "no", "API", "endpoint", "is", "defined", ".", "If", "{", "@link", "#notFound", "}", "is", "set", "{", "@link", "NotFound#handle", "(", "HttpServletRequest", "HttpServletResponse", ")", "}", "will", "be", "called", ".", "O...
train
https://github.com/davidcarboni/restolino/blob/3f84ece1bd016fbb597c624d46fcca5a2580a33d/src/main/java/com/github/davidcarboni/restolino/api/Router.java#L371-L381
dwdyer/watchmaker
framework/src/java/main/org/uncommons/util/reflection/ReflectionUtils.java
ReflectionUtils.invokeUnchecked
public static <T> T invokeUnchecked(Constructor<T> constructor, Object... arguments) { try { return constructor.newInstance(arguments); } catch (IllegalAccessException ex) { // This cannot happen if the constructor is public. throw new IllegalArgumentException("Constructor is not publicly accessible.", ex); } catch (InstantiationException ex) { // This can only happen if the constructor belongs to an // abstract class. throw new IllegalArgumentException("Constructor is part of an abstract class.", ex); } catch (InvocationTargetException ex) { // If the method is not declared to throw any checked exceptions, // the worst that can happen is a RuntimeException or an Error (we can, // and should, re-throw both). if (ex.getCause() instanceof Error) { throw (Error) ex.getCause(); } else { throw (RuntimeException) ex.getCause(); } } }
java
public static <T> T invokeUnchecked(Constructor<T> constructor, Object... arguments) { try { return constructor.newInstance(arguments); } catch (IllegalAccessException ex) { // This cannot happen if the constructor is public. throw new IllegalArgumentException("Constructor is not publicly accessible.", ex); } catch (InstantiationException ex) { // This can only happen if the constructor belongs to an // abstract class. throw new IllegalArgumentException("Constructor is part of an abstract class.", ex); } catch (InvocationTargetException ex) { // If the method is not declared to throw any checked exceptions, // the worst that can happen is a RuntimeException or an Error (we can, // and should, re-throw both). if (ex.getCause() instanceof Error) { throw (Error) ex.getCause(); } else { throw (RuntimeException) ex.getCause(); } } }
[ "public", "static", "<", "T", ">", "T", "invokeUnchecked", "(", "Constructor", "<", "T", ">", "constructor", ",", "Object", "...", "arguments", ")", "{", "try", "{", "return", "constructor", ".", "newInstance", "(", "arguments", ")", ";", "}", "catch", "...
Invokes the specified constructor without throwing any checked exceptions. This is only valid for constructors that are not declared to throw any checked exceptions. Any unchecked exceptions thrown by the specified constructor will be re-thrown (in their original form, not wrapped in an InvocationTargetException as would be the case for a normal reflective invocation). @param constructor The constructor to invoke. Both the constructor and its class must have been declared public, and the class must not be abstract, otherwise they will be inaccessible. @param arguments The method arguments. @param <T> The return type of the method. The compiler can usually infer the correct type. @return The object created by invoking the specified constructor with the specified arguments.
[ "Invokes", "the", "specified", "constructor", "without", "throwing", "any", "checked", "exceptions", ".", "This", "is", "only", "valid", "for", "constructors", "that", "are", "not", "declared", "to", "throw", "any", "checked", "exceptions", ".", "Any", "unchecke...
train
https://github.com/dwdyer/watchmaker/blob/33d942350e6bf7d9a17b9262a4f898158530247e/framework/src/java/main/org/uncommons/util/reflection/ReflectionUtils.java#L96-L127
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbLists.java
TmdbLists.modifyMovieList
private StatusCode modifyMovieList(String sessionId, String listId, int movieId, MethodSub operation) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.SESSION_ID, sessionId); parameters.add(Param.ID, listId); String jsonBody = new PostTools() .add(PostBody.MEDIA_ID, movieId) .build(); URL url = new ApiUrl(apiKey, MethodBase.LIST).subMethod(operation).buildUrl(parameters); String webpage = httpTools.postRequest(url, jsonBody); try { return MAPPER.readValue(webpage, StatusCode.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to remove item from list", url, ex); } }
java
private StatusCode modifyMovieList(String sessionId, String listId, int movieId, MethodSub operation) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.SESSION_ID, sessionId); parameters.add(Param.ID, listId); String jsonBody = new PostTools() .add(PostBody.MEDIA_ID, movieId) .build(); URL url = new ApiUrl(apiKey, MethodBase.LIST).subMethod(operation).buildUrl(parameters); String webpage = httpTools.postRequest(url, jsonBody); try { return MAPPER.readValue(webpage, StatusCode.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to remove item from list", url, ex); } }
[ "private", "StatusCode", "modifyMovieList", "(", "String", "sessionId", ",", "String", "listId", ",", "int", "movieId", ",", "MethodSub", "operation", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", "...
Modify a list This can be used to add or remove an item from the list @param sessionId @param listId @param movieId @param operation @return @throws MovieDbException
[ "Modify", "a", "list" ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbLists.java#L167-L184
liferay/com-liferay-commerce
commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPOptionWrapper.java
CPOptionWrapper.getName
@Override public String getName(String languageId, boolean useDefault) { return _cpOption.getName(languageId, useDefault); }
java
@Override public String getName(String languageId, boolean useDefault) { return _cpOption.getName(languageId, useDefault); }
[ "@", "Override", "public", "String", "getName", "(", "String", "languageId", ",", "boolean", "useDefault", ")", "{", "return", "_cpOption", ".", "getName", "(", "languageId", ",", "useDefault", ")", ";", "}" ]
Returns the localized name of this cp option in the language, optionally using the default language if no localization exists for the requested language. @param languageId the ID of the language @param useDefault whether to use the default language if no localization exists for the requested language @return the localized name of this cp option
[ "Returns", "the", "localized", "name", "of", "this", "cp", "option", "in", "the", "language", "optionally", "using", "the", "default", "language", "if", "no", "localization", "exists", "for", "the", "requested", "language", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPOptionWrapper.java#L447-L450
micronaut-projects/micronaut-core
http-server-netty/src/main/java/io/micronaut/http/server/netty/websocket/NettyServerWebSocketUpgradeHandler.java
NettyServerWebSocketUpgradeHandler.handleHandshake
protected ChannelFuture handleHandshake(ChannelHandlerContext ctx, NettyHttpRequest req, WebSocketBean<?> webSocketBean, MutableHttpResponse<?> response) { int maxFramePayloadLength = webSocketBean.messageMethod().flatMap(m -> m.getValue(OnMessage.class, "maxPayloadLength", Integer.class)).orElse(65536); WebSocketServerHandshakerFactory wsFactory = new WebSocketServerHandshakerFactory( getWebSocketURL(ctx, req), null, true, maxFramePayloadLength ); handshaker = wsFactory.newHandshaker(req.getNativeRequest()); MutableHttpHeaders headers = response.getHeaders(); io.netty.handler.codec.http.HttpHeaders nettyHeaders; if (headers instanceof NettyHttpHeaders) { nettyHeaders = ((NettyHttpHeaders) headers).getNettyHeaders(); } else { nettyHeaders = new DefaultHttpHeaders(); for (Map.Entry<String, List<String>> entry : headers) { nettyHeaders.add(entry.getKey(), entry.getValue()); } } Channel channel = ctx.channel(); if (handshaker == null) { return WebSocketServerHandshakerFactory.sendUnsupportedVersionResponse(channel); } else { return handshaker.handshake( channel, req.getNativeRequest(), nettyHeaders, channel.newPromise() ); } }
java
protected ChannelFuture handleHandshake(ChannelHandlerContext ctx, NettyHttpRequest req, WebSocketBean<?> webSocketBean, MutableHttpResponse<?> response) { int maxFramePayloadLength = webSocketBean.messageMethod().flatMap(m -> m.getValue(OnMessage.class, "maxPayloadLength", Integer.class)).orElse(65536); WebSocketServerHandshakerFactory wsFactory = new WebSocketServerHandshakerFactory( getWebSocketURL(ctx, req), null, true, maxFramePayloadLength ); handshaker = wsFactory.newHandshaker(req.getNativeRequest()); MutableHttpHeaders headers = response.getHeaders(); io.netty.handler.codec.http.HttpHeaders nettyHeaders; if (headers instanceof NettyHttpHeaders) { nettyHeaders = ((NettyHttpHeaders) headers).getNettyHeaders(); } else { nettyHeaders = new DefaultHttpHeaders(); for (Map.Entry<String, List<String>> entry : headers) { nettyHeaders.add(entry.getKey(), entry.getValue()); } } Channel channel = ctx.channel(); if (handshaker == null) { return WebSocketServerHandshakerFactory.sendUnsupportedVersionResponse(channel); } else { return handshaker.handshake( channel, req.getNativeRequest(), nettyHeaders, channel.newPromise() ); } }
[ "protected", "ChannelFuture", "handleHandshake", "(", "ChannelHandlerContext", "ctx", ",", "NettyHttpRequest", "req", ",", "WebSocketBean", "<", "?", ">", "webSocketBean", ",", "MutableHttpResponse", "<", "?", ">", "response", ")", "{", "int", "maxFramePayloadLength",...
Do the handshaking for WebSocket request. @param ctx The channel handler context @param req The request @param webSocketBean The web socket bean @param response The response @return The channel future
[ "Do", "the", "handshaking", "for", "WebSocket", "request", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/http-server-netty/src/main/java/io/micronaut/http/server/netty/websocket/NettyServerWebSocketUpgradeHandler.java#L225-L256
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/periodic/GVRPeriodicEngine.java
GVRPeriodicEngine.runEvery
public PeriodicEvent runEvery(Runnable task, float delay, float period, KeepRunning callback) { validateDelay(delay); validatePeriod(period); return new Event(task, delay, period, callback); }
java
public PeriodicEvent runEvery(Runnable task, float delay, float period, KeepRunning callback) { validateDelay(delay); validatePeriod(period); return new Event(task, delay, period, callback); }
[ "public", "PeriodicEvent", "runEvery", "(", "Runnable", "task", ",", "float", "delay", ",", "float", "period", ",", "KeepRunning", "callback", ")", "{", "validateDelay", "(", "delay", ")", ";", "validatePeriod", "(", "period", ")", ";", "return", "new", "Eve...
Run a task periodically, with a callback. @param task Task to run. @param delay The first execution will happen in {@code delay} seconds. @param period Subsequent executions will happen every {@code period} seconds after the first. @param callback Callback that lets you cancel the task. {@code null} means run indefinitely. @return An interface that lets you query the status; cancel; or reschedule the event.
[ "Run", "a", "task", "periodically", "with", "a", "callback", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/periodic/GVRPeriodicEngine.java#L186-L191
documents4j/documents4j
documents4j-util-conversion/src/main/java/com/documents4j/job/AbstractConverterBuilder.java
AbstractConverterBuilder.workerPool
@SuppressWarnings("unchecked") public T workerPool(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit) { assertNumericArgument(corePoolSize, true); assertNumericArgument(maximumPoolSize, false); assertSmallerEquals(corePoolSize, maximumPoolSize); assertNumericArgument(keepAliveTime, true); assertNumericArgument(keepAliveTime, true); this.corePoolSize = corePoolSize; this.maximumPoolSize = maximumPoolSize; this.keepAliveTime = unit.toMillis(keepAliveTime); return (T) this; }
java
@SuppressWarnings("unchecked") public T workerPool(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit) { assertNumericArgument(corePoolSize, true); assertNumericArgument(maximumPoolSize, false); assertSmallerEquals(corePoolSize, maximumPoolSize); assertNumericArgument(keepAliveTime, true); assertNumericArgument(keepAliveTime, true); this.corePoolSize = corePoolSize; this.maximumPoolSize = maximumPoolSize; this.keepAliveTime = unit.toMillis(keepAliveTime); return (T) this; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "T", "workerPool", "(", "int", "corePoolSize", ",", "int", "maximumPoolSize", ",", "long", "keepAliveTime", ",", "TimeUnit", "unit", ")", "{", "assertNumericArgument", "(", "corePoolSize", ",", "true", ...
Configures a worker pool for the converter. This worker pool implicitly sets a maximum number of conversions that are concurrently undertaken by the resulting converter. When a converter is requested to concurrently execute more conversions than {@code maximumPoolSize}, it will queue excess conversions until capacities are available again. <p>&nbsp;</p> If this number is set too low, the concurrent performance of the resulting converter will be weak compared to a higher number. If this number is set too high, the converter might <i>overheat</i> when accessing the underlying external resource (such as for example an external process or a HTTP connection). A remote converter that shares a conversion server with another converter might also starve these other remote converters. @param corePoolSize The core pool size of the worker pool. @param maximumPoolSize The maximum pool size of the worker pool. @param keepAliveTime The keep alive time of the worker pool. @param unit The time unit of the specified keep alive time. @return This builder instance.
[ "Configures", "a", "worker", "pool", "for", "the", "converter", ".", "This", "worker", "pool", "implicitly", "sets", "a", "maximum", "number", "of", "conversions", "that", "are", "concurrently", "undertaken", "by", "the", "resulting", "converter", ".", "When", ...
train
https://github.com/documents4j/documents4j/blob/eebb3ede43ffeb5fbfc85b3134f67a9c379a5594/documents4j-util-conversion/src/main/java/com/documents4j/job/AbstractConverterBuilder.java#L73-L84
apache/reef
lang/java/reef-examples-clr/src/main/java/org/apache/reef/examples/helloCLR/HelloDriver.java
HelloDriver.onNextCLR
void onNextCLR(final AllocatedEvaluator allocatedEvaluator) { try { allocatedEvaluator.setProcess(clrProcessFactory.newEvaluatorProcess()); final Configuration contextConfiguration = ContextConfiguration.CONF .set(ContextConfiguration.IDENTIFIER, "HelloREEFContext") .build(); final Configuration taskConfiguration = getCLRTaskConfiguration("Hello_From_CLR"); allocatedEvaluator.submitContextAndTask(contextConfiguration, taskConfiguration); } catch (final BindException ex) { final String message = "Unable to setup Task or Context configuration."; LOG.log(Level.SEVERE, message, ex); throw new RuntimeException(message, ex); } }
java
void onNextCLR(final AllocatedEvaluator allocatedEvaluator) { try { allocatedEvaluator.setProcess(clrProcessFactory.newEvaluatorProcess()); final Configuration contextConfiguration = ContextConfiguration.CONF .set(ContextConfiguration.IDENTIFIER, "HelloREEFContext") .build(); final Configuration taskConfiguration = getCLRTaskConfiguration("Hello_From_CLR"); allocatedEvaluator.submitContextAndTask(contextConfiguration, taskConfiguration); } catch (final BindException ex) { final String message = "Unable to setup Task or Context configuration."; LOG.log(Level.SEVERE, message, ex); throw new RuntimeException(message, ex); } }
[ "void", "onNextCLR", "(", "final", "AllocatedEvaluator", "allocatedEvaluator", ")", "{", "try", "{", "allocatedEvaluator", ".", "setProcess", "(", "clrProcessFactory", ".", "newEvaluatorProcess", "(", ")", ")", ";", "final", "Configuration", "contextConfiguration", "=...
Uses the AllocatedEvaluator to launch a CLR task. @param allocatedEvaluator
[ "Uses", "the", "AllocatedEvaluator", "to", "launch", "a", "CLR", "task", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples-clr/src/main/java/org/apache/reef/examples/helloCLR/HelloDriver.java#L116-L131
tbrooks8/Precipice
precipice-core/src/main/java/net/uncontended/precipice/GuardRail.java
GuardRail.acquirePermits
public Rejected acquirePermits(long number, long nanoTime) { for (int i = 0; i < backPressureList.size(); ++i) { BackPressure<Rejected> bp = backPressureList.get(i); Rejected rejected = bp.acquirePermit(number, nanoTime); if (rejected != null) { rejectedCounts.write(rejected, number, nanoTime); for (int j = 0; j < i; ++j) { backPressureList.get(j).releasePermit(number, nanoTime); } return rejected; } } return null; }
java
public Rejected acquirePermits(long number, long nanoTime) { for (int i = 0; i < backPressureList.size(); ++i) { BackPressure<Rejected> bp = backPressureList.get(i); Rejected rejected = bp.acquirePermit(number, nanoTime); if (rejected != null) { rejectedCounts.write(rejected, number, nanoTime); for (int j = 0; j < i; ++j) { backPressureList.get(j).releasePermit(number, nanoTime); } return rejected; } } return null; }
[ "public", "Rejected", "acquirePermits", "(", "long", "number", ",", "long", "nanoTime", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "backPressureList", ".", "size", "(", ")", ";", "++", "i", ")", "{", "BackPressure", "<", "Rejected", "...
Acquire permits for task execution. If the acquisition is rejected then a reason will be returned. If the acquisition is successful, null will be returned. @param number of permits to acquire @param nanoTime currentInterval nano time @return the rejected reason
[ "Acquire", "permits", "for", "task", "execution", ".", "If", "the", "acquisition", "is", "rejected", "then", "a", "reason", "will", "be", "returned", ".", "If", "the", "acquisition", "is", "successful", "null", "will", "be", "returned", "." ]
train
https://github.com/tbrooks8/Precipice/blob/97fae467fd676b16a96b8d88b02569d8fc1f2681/precipice-core/src/main/java/net/uncontended/precipice/GuardRail.java#L69-L83
voldemort/voldemort
src/java/voldemort/versioning/VectorClockUtils.java
VectorClockUtils.makeClockWithCurrentTime
public static VectorClock makeClockWithCurrentTime(Set<Integer> serverIds) { return makeClock(serverIds, System.currentTimeMillis(), System.currentTimeMillis()); }
java
public static VectorClock makeClockWithCurrentTime(Set<Integer> serverIds) { return makeClock(serverIds, System.currentTimeMillis(), System.currentTimeMillis()); }
[ "public", "static", "VectorClock", "makeClockWithCurrentTime", "(", "Set", "<", "Integer", ">", "serverIds", ")", "{", "return", "makeClock", "(", "serverIds", ",", "System", ".", "currentTimeMillis", "(", ")", ",", "System", ".", "currentTimeMillis", "(", ")", ...
Generates a vector clock with the provided nodes and current time stamp This clock can be used to overwrite the existing value avoiding obsolete version exceptions in most cases, except If the existing Vector Clock was generated in custom way. (i.e. existing vector clock does not use milliseconds) @param serverIds servers in the clock
[ "Generates", "a", "vector", "clock", "with", "the", "provided", "nodes", "and", "current", "time", "stamp", "This", "clock", "can", "be", "used", "to", "overwrite", "the", "existing", "value", "avoiding", "obsolete", "version", "exceptions", "in", "most", "cas...
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/versioning/VectorClockUtils.java#L154-L156
networknt/light-4j
utility/src/main/java/com/networknt/utility/StringUtils.java
StringUtils.removeStart
public static String removeStart(final String str, final String remove) { if (isEmpty(str) || isEmpty(remove)) { return str; } if (str.startsWith(remove)){ return str.substring(remove.length()); } return str; }
java
public static String removeStart(final String str, final String remove) { if (isEmpty(str) || isEmpty(remove)) { return str; } if (str.startsWith(remove)){ return str.substring(remove.length()); } return str; }
[ "public", "static", "String", "removeStart", "(", "final", "String", "str", ",", "final", "String", "remove", ")", "{", "if", "(", "isEmpty", "(", "str", ")", "||", "isEmpty", "(", "remove", ")", ")", "{", "return", "str", ";", "}", "if", "(", "str",...
<p>Removes a substring only if it is at the beginning of a source string, otherwise returns the source string.</p> <p>A {@code null} source string will return {@code null}. An empty ("") source string will return the empty string. A {@code null} search string will return the source string.</p> <pre> StringUtils.removeStart(null, *) = null StringUtils.removeStart("", *) = "" StringUtils.removeStart(*, null) = * StringUtils.removeStart("www.domain.com", "www.") = "domain.com" StringUtils.removeStart("domain.com", "www.") = "domain.com" StringUtils.removeStart("www.domain.com", "domain") = "www.domain.com" StringUtils.removeStart("abc", "") = "abc" </pre> @param str the source String to search, may be null @param remove the String to search for and remove, may be null @return the substring with the string removed if found, {@code null} if null String input @since 2.1
[ "<p", ">", "Removes", "a", "substring", "only", "if", "it", "is", "at", "the", "beginning", "of", "a", "source", "string", "otherwise", "returns", "the", "source", "string", ".", "<", "/", "p", ">" ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/StringUtils.java#L898-L906
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/referral/util/ShareSheetStyle.java
ShareSheetStyle.setMoreOptionStyle
public ShareSheetStyle setMoreOptionStyle(@DrawableRes int drawableIconID, @StringRes int stringLabelID) { moreOptionIcon_ = getDrawable(context_, drawableIconID); moreOptionText_ = context_.getResources().getString(stringLabelID); return this; }
java
public ShareSheetStyle setMoreOptionStyle(@DrawableRes int drawableIconID, @StringRes int stringLabelID) { moreOptionIcon_ = getDrawable(context_, drawableIconID); moreOptionText_ = context_.getResources().getString(stringLabelID); return this; }
[ "public", "ShareSheetStyle", "setMoreOptionStyle", "(", "@", "DrawableRes", "int", "drawableIconID", ",", "@", "StringRes", "int", "stringLabelID", ")", "{", "moreOptionIcon_", "=", "getDrawable", "(", "context_", ",", "drawableIconID", ")", ";", "moreOptionText_", ...
<p> Set the icon and label for the option to expand the application list to see more options. Default label is set to "More" </p> @param drawableIconID Resource ID for the drawable to set as the icon for more option. Default icon is system menu_more icon. @param stringLabelID Resource ID for String label for the more option. Default label is "More" @return This object to allow method chaining
[ "<p", ">", "Set", "the", "icon", "and", "label", "for", "the", "option", "to", "expand", "the", "application", "list", "to", "see", "more", "options", ".", "Default", "label", "is", "set", "to", "More", "<", "/", "p", ">" ]
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/util/ShareSheetStyle.java#L104-L109
fuinorg/srcgen4j-commons
src/main/java/org/fuin/srcgen4j/commons/Folder.java
Folder.getCanonicalDir
@Nullable public final File getCanonicalDir() { final String dir = getDirectory(); if (dir == null) { return null; } try { return new File(dir).getCanonicalFile(); } catch (final IOException ex) { throw new RuntimeException("Couldn't determine canonical file: " + dir, ex); } }
java
@Nullable public final File getCanonicalDir() { final String dir = getDirectory(); if (dir == null) { return null; } try { return new File(dir).getCanonicalFile(); } catch (final IOException ex) { throw new RuntimeException("Couldn't determine canonical file: " + dir, ex); } }
[ "@", "Nullable", "public", "final", "File", "getCanonicalDir", "(", ")", "{", "final", "String", "dir", "=", "getDirectory", "(", ")", ";", "if", "(", "dir", "==", "null", ")", "{", "return", "null", ";", "}", "try", "{", "return", "new", "File", "("...
Returns the full path from project and folder. @return Directory.
[ "Returns", "the", "full", "path", "from", "project", "and", "folder", "." ]
train
https://github.com/fuinorg/srcgen4j-commons/blob/bce26fd3167ea91fb2f3ad3fc9a1836d3d9fb14b/src/main/java/org/fuin/srcgen4j/commons/Folder.java#L408-L419
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/WeightedHighlighter.java
WeightedHighlighter.endFragment
private static void endFragment(StringBuilder sb, String text, int offset, int limit) { if (limit == text.length()) { // append all sb.append(text.substring(offset)); return; } int end = offset; for (int i = end; i < limit; i++) { if (Character.isWhitespace(text.charAt(i))) { // potential end end = i; } } sb.append(text.substring(offset, end)).append(" ..."); }
java
private static void endFragment(StringBuilder sb, String text, int offset, int limit) { if (limit == text.length()) { // append all sb.append(text.substring(offset)); return; } int end = offset; for (int i = end; i < limit; i++) { if (Character.isWhitespace(text.charAt(i))) { // potential end end = i; } } sb.append(text.substring(offset, end)).append(" ..."); }
[ "private", "static", "void", "endFragment", "(", "StringBuilder", "sb", ",", "String", "text", ",", "int", "offset", ",", "int", "limit", ")", "{", "if", "(", "limit", "==", "text", ".", "length", "(", ")", ")", "{", "// append all", "sb", ".", "append...
Writes the end of a fragment to the string buffer <code>sb</code>. The last occurrence of a matching term is indicated by the <code>offset</code> into the <code>text</code>. @param sb where to append the start of the fragment. @param text the original text. @param offset the end offset of the last matching term in the fragment. @param limit do not go further than <code>limit</code>.
[ "Writes", "the", "end", "of", "a", "fragment", "to", "the", "string", "buffer", "<code", ">", "sb<", "/", "code", ">", ".", "The", "last", "occurrence", "of", "a", "matching", "term", "is", "indicated", "by", "the", "<code", ">", "offset<", "/", "code"...
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/WeightedHighlighter.java#L266-L284
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/util/ClassesManager.java
ClassesManager.areEqual
public static boolean areEqual(Field destination,Field source){ return getGenericString(destination).equals(getGenericString(source)); }
java
public static boolean areEqual(Field destination,Field source){ return getGenericString(destination).equals(getGenericString(source)); }
[ "public", "static", "boolean", "areEqual", "(", "Field", "destination", ",", "Field", "source", ")", "{", "return", "getGenericString", "(", "destination", ")", ".", "equals", "(", "getGenericString", "(", "source", ")", ")", ";", "}" ]
Returns true if destination and source have the same structure. @param destination destination field @param source source field @return returns true if destination and source have the same structure
[ "Returns", "true", "if", "destination", "and", "source", "have", "the", "same", "structure", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/util/ClassesManager.java#L359-L361
dain/leveldb
leveldb/src/main/java/org/iq80/leveldb/util/Slice.java
Slice.copySlice
public Slice copySlice(int index, int length) { checkPositionIndexes(index, index + length, this.length); index += offset; byte[] copiedArray = new byte[length]; System.arraycopy(data, index, copiedArray, 0, length); return new Slice(copiedArray); }
java
public Slice copySlice(int index, int length) { checkPositionIndexes(index, index + length, this.length); index += offset; byte[] copiedArray = new byte[length]; System.arraycopy(data, index, copiedArray, 0, length); return new Slice(copiedArray); }
[ "public", "Slice", "copySlice", "(", "int", "index", ",", "int", "length", ")", "{", "checkPositionIndexes", "(", "index", ",", "index", "+", "length", ",", "this", ".", "length", ")", ";", "index", "+=", "offset", ";", "byte", "[", "]", "copiedArray", ...
Returns a copy of this buffer's sub-region. Modifying the content of the returned buffer or this buffer does not affect each other at all.
[ "Returns", "a", "copy", "of", "this", "buffer", "s", "sub", "-", "region", ".", "Modifying", "the", "content", "of", "the", "returned", "buffer", "or", "this", "buffer", "does", "not", "affect", "each", "other", "at", "all", "." ]
train
https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/util/Slice.java#L527-L535
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java
FailoverGroupsInner.beginFailover
public FailoverGroupInner beginFailover(String resourceGroupName, String serverName, String failoverGroupName) { return beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).toBlocking().single().body(); }
java
public FailoverGroupInner beginFailover(String resourceGroupName, String serverName, String failoverGroupName) { return beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).toBlocking().single().body(); }
[ "public", "FailoverGroupInner", "beginFailover", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "failoverGroupName", ")", "{", "return", "beginFailoverWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "failoverGrou...
Fails over from the current primary server to this server. @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 containing the failover group. @param failoverGroupName The name of the failover group. @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 FailoverGroupInner object if successful.
[ "Fails", "over", "from", "the", "current", "primary", "server", "to", "this", "server", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java#L966-L968
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/JobApi.java
JobApi.getJob
public Job getJob(Object projectIdOrPath, int jobId) throws GitLabApiException { Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId); return (response.readEntity(Job.class)); }
java
public Job getJob(Object projectIdOrPath, int jobId) throws GitLabApiException { Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId); return (response.readEntity(Job.class)); }
[ "public", "Job", "getJob", "(", "Object", "projectIdOrPath", ",", "int", "jobId", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "null", ",", "\"projects\"", ",", "getProjectIdOrPat...
Get single job in a project. <pre><code>GitLab Endpoint: GET /projects/:id/jobs/:job_id</code></pre> @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path to get the job for @param jobId the job ID to get @return a single job for the specified project ID @throws GitLabApiException if any exception occurs during execution
[ "Get", "single", "job", "in", "a", "project", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/JobApi.java#L175-L178
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/dns/dnspolicylabel_binding.java
dnspolicylabel_binding.get
public static dnspolicylabel_binding get(nitro_service service, String labelname) throws Exception{ dnspolicylabel_binding obj = new dnspolicylabel_binding(); obj.set_labelname(labelname); dnspolicylabel_binding response = (dnspolicylabel_binding) obj.get_resource(service); return response; }
java
public static dnspolicylabel_binding get(nitro_service service, String labelname) throws Exception{ dnspolicylabel_binding obj = new dnspolicylabel_binding(); obj.set_labelname(labelname); dnspolicylabel_binding response = (dnspolicylabel_binding) obj.get_resource(service); return response; }
[ "public", "static", "dnspolicylabel_binding", "get", "(", "nitro_service", "service", ",", "String", "labelname", ")", "throws", "Exception", "{", "dnspolicylabel_binding", "obj", "=", "new", "dnspolicylabel_binding", "(", ")", ";", "obj", ".", "set_labelname", "(",...
Use this API to fetch dnspolicylabel_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "dnspolicylabel_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/dns/dnspolicylabel_binding.java#L114-L119
tdomzal/junit-docker-rule
src/main/java/pl/domzal/junit/docker/rule/DockerRuleBuilder.java
DockerRuleBuilder.addLabel
public DockerRuleBuilder addLabel(String name, String value) { labels.put(name, value); return this; }
java
public DockerRuleBuilder addLabel(String name, String value) { labels.put(name, value); return this; }
[ "public", "DockerRuleBuilder", "addLabel", "(", "String", "name", ",", "String", "value", ")", "{", "labels", ".", "put", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Add container label (call multiple times to add more than one). @param name Label name. @param value Label value.
[ "Add", "container", "label", "(", "call", "multiple", "times", "to", "add", "more", "than", "one", ")", "." ]
train
https://github.com/tdomzal/junit-docker-rule/blob/5a0ba2fd095d201530d3f9e614bc5e88d0afaeb2/src/main/java/pl/domzal/junit/docker/rule/DockerRuleBuilder.java#L482-L485
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/LocalDirAllocator.java
LocalDirAllocator.getLocalPathForWrite
public Path getLocalPathForWrite(String pathStr, Configuration conf) throws IOException { return getLocalPathForWrite(pathStr, -1, conf); }
java
public Path getLocalPathForWrite(String pathStr, Configuration conf) throws IOException { return getLocalPathForWrite(pathStr, -1, conf); }
[ "public", "Path", "getLocalPathForWrite", "(", "String", "pathStr", ",", "Configuration", "conf", ")", "throws", "IOException", "{", "return", "getLocalPathForWrite", "(", "pathStr", ",", "-", "1", ",", "conf", ")", ";", "}" ]
Get a path from the local FS. This method should be used if the size of the file is not known apriori. We go round-robin over the set of disks (via the configured dirs) and return the first complete path where we could create the parent directory of the passed path. @param pathStr the requested path (this will be created on the first available disk) @param conf the Configuration object @return the complete path to the file on a local disk @throws IOException
[ "Get", "a", "path", "from", "the", "local", "FS", ".", "This", "method", "should", "be", "used", "if", "the", "size", "of", "the", "file", "is", "not", "known", "apriori", ".", "We", "go", "round", "-", "robin", "over", "the", "set", "of", "disks", ...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/LocalDirAllocator.java#L107-L110
grails/grails-core
grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/RegexUrlMapping.java
RegexUrlMapping.createRuntimeConstraintEvaluator
private Object createRuntimeConstraintEvaluator(final String name, ConstrainedProperty[] constraints) { if (constraints == null) return null; for (ConstrainedProperty constraint : constraints) { if (constraint.getPropertyName().equals(name)) { return new Closure(this) { private static final long serialVersionUID = -2404119898659287216L; @Override public Object call(Object... objects) { GrailsWebRequest webRequest = (GrailsWebRequest) RequestContextHolder.currentRequestAttributes(); return webRequest.getParams().get(name); } }; } } return null; }
java
private Object createRuntimeConstraintEvaluator(final String name, ConstrainedProperty[] constraints) { if (constraints == null) return null; for (ConstrainedProperty constraint : constraints) { if (constraint.getPropertyName().equals(name)) { return new Closure(this) { private static final long serialVersionUID = -2404119898659287216L; @Override public Object call(Object... objects) { GrailsWebRequest webRequest = (GrailsWebRequest) RequestContextHolder.currentRequestAttributes(); return webRequest.getParams().get(name); } }; } } return null; }
[ "private", "Object", "createRuntimeConstraintEvaluator", "(", "final", "String", "name", ",", "ConstrainedProperty", "[", "]", "constraints", ")", "{", "if", "(", "constraints", "==", "null", ")", "return", "null", ";", "for", "(", "ConstrainedProperty", "constrai...
This method will look for a constraint for the given name and return a closure that when executed will attempt to evaluate its value from the bound request parameters at runtime. @param name The name of the constrained property @param constraints The array of current ConstrainedProperty instances @return Either a Closure or null
[ "This", "method", "will", "look", "for", "a", "constraint", "for", "the", "given", "name", "and", "return", "a", "closure", "that", "when", "executed", "will", "attempt", "to", "evaluate", "its", "value", "from", "the", "bound", "request", "parameters", "at"...
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/RegexUrlMapping.java#L700-L717
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java
BinaryRowProtocol.getInternalDouble
public double getInternalDouble(ColumnInformation columnInfo) throws SQLException { if (lastValueWasNull()) { return 0; } switch (columnInfo.getColumnType()) { case BIT: return parseBit(); case TINYINT: return getInternalTinyInt(columnInfo); case SMALLINT: case YEAR: return getInternalSmallInt(columnInfo); case INTEGER: case MEDIUMINT: return getInternalMediumInt(columnInfo); case BIGINT: long valueLong = ((buf[pos] & 0xff) + ((long) (buf[pos + 1] & 0xff) << 8) + ((long) (buf[pos + 2] & 0xff) << 16) + ((long) (buf[pos + 3] & 0xff) << 24) + ((long) (buf[pos + 4] & 0xff) << 32) + ((long) (buf[pos + 5] & 0xff) << 40) + ((long) (buf[pos + 6] & 0xff) << 48) + ((long) (buf[pos + 7] & 0xff) << 56) ); if (columnInfo.isSigned()) { return valueLong; } else { return new BigInteger(1, new byte[]{(byte) (valueLong >> 56), (byte) (valueLong >> 48), (byte) (valueLong >> 40), (byte) (valueLong >> 32), (byte) (valueLong >> 24), (byte) (valueLong >> 16), (byte) (valueLong >> 8), (byte) valueLong}).doubleValue(); } case FLOAT: return getInternalFloat(columnInfo); case DOUBLE: long valueDouble = ((buf[pos] & 0xff) + ((long) (buf[pos + 1] & 0xff) << 8) + ((long) (buf[pos + 2] & 0xff) << 16) + ((long) (buf[pos + 3] & 0xff) << 24) + ((long) (buf[pos + 4] & 0xff) << 32) + ((long) (buf[pos + 5] & 0xff) << 40) + ((long) (buf[pos + 6] & 0xff) << 48) + ((long) (buf[pos + 7] & 0xff) << 56)); return Double.longBitsToDouble(valueDouble); case DECIMAL: case VARSTRING: case VARCHAR: case STRING: case OLDDECIMAL: try { return Double.valueOf(new String(buf, pos, length, StandardCharsets.UTF_8)); } catch (NumberFormatException nfe) { SQLException sqlException = new SQLException( "Incorrect format for getDouble for data field with type " + columnInfo.getColumnType().getJavaTypeName(), "22003", 1264); //noinspection UnnecessaryInitCause sqlException.initCause(nfe); throw sqlException; } default: throw new SQLException("getDouble not available for data field type " + columnInfo.getColumnType().getJavaTypeName()); } }
java
public double getInternalDouble(ColumnInformation columnInfo) throws SQLException { if (lastValueWasNull()) { return 0; } switch (columnInfo.getColumnType()) { case BIT: return parseBit(); case TINYINT: return getInternalTinyInt(columnInfo); case SMALLINT: case YEAR: return getInternalSmallInt(columnInfo); case INTEGER: case MEDIUMINT: return getInternalMediumInt(columnInfo); case BIGINT: long valueLong = ((buf[pos] & 0xff) + ((long) (buf[pos + 1] & 0xff) << 8) + ((long) (buf[pos + 2] & 0xff) << 16) + ((long) (buf[pos + 3] & 0xff) << 24) + ((long) (buf[pos + 4] & 0xff) << 32) + ((long) (buf[pos + 5] & 0xff) << 40) + ((long) (buf[pos + 6] & 0xff) << 48) + ((long) (buf[pos + 7] & 0xff) << 56) ); if (columnInfo.isSigned()) { return valueLong; } else { return new BigInteger(1, new byte[]{(byte) (valueLong >> 56), (byte) (valueLong >> 48), (byte) (valueLong >> 40), (byte) (valueLong >> 32), (byte) (valueLong >> 24), (byte) (valueLong >> 16), (byte) (valueLong >> 8), (byte) valueLong}).doubleValue(); } case FLOAT: return getInternalFloat(columnInfo); case DOUBLE: long valueDouble = ((buf[pos] & 0xff) + ((long) (buf[pos + 1] & 0xff) << 8) + ((long) (buf[pos + 2] & 0xff) << 16) + ((long) (buf[pos + 3] & 0xff) << 24) + ((long) (buf[pos + 4] & 0xff) << 32) + ((long) (buf[pos + 5] & 0xff) << 40) + ((long) (buf[pos + 6] & 0xff) << 48) + ((long) (buf[pos + 7] & 0xff) << 56)); return Double.longBitsToDouble(valueDouble); case DECIMAL: case VARSTRING: case VARCHAR: case STRING: case OLDDECIMAL: try { return Double.valueOf(new String(buf, pos, length, StandardCharsets.UTF_8)); } catch (NumberFormatException nfe) { SQLException sqlException = new SQLException( "Incorrect format for getDouble for data field with type " + columnInfo.getColumnType().getJavaTypeName(), "22003", 1264); //noinspection UnnecessaryInitCause sqlException.initCause(nfe); throw sqlException; } default: throw new SQLException("getDouble not available for data field type " + columnInfo.getColumnType().getJavaTypeName()); } }
[ "public", "double", "getInternalDouble", "(", "ColumnInformation", "columnInfo", ")", "throws", "SQLException", "{", "if", "(", "lastValueWasNull", "(", ")", ")", "{", "return", "0", ";", "}", "switch", "(", "columnInfo", ".", "getColumnType", "(", ")", ")", ...
Get double from raw binary format. @param columnInfo column information @return double value @throws SQLException if column is not numeric or is not in Double bounds (unsigned columns).
[ "Get", "double", "from", "raw", "binary", "format", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java#L595-L659
eclipse/hawkbit
hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/utils/DeploymentHelper.java
DeploymentHelper.runInNewTransaction
public static <T> T runInNewTransaction(@NotNull final PlatformTransactionManager txManager, final String transactionName, @NotNull final TransactionCallback<T> action) { return runInNewTransaction(txManager, transactionName, Isolation.DEFAULT.value(), action); }
java
public static <T> T runInNewTransaction(@NotNull final PlatformTransactionManager txManager, final String transactionName, @NotNull final TransactionCallback<T> action) { return runInNewTransaction(txManager, transactionName, Isolation.DEFAULT.value(), action); }
[ "public", "static", "<", "T", ">", "T", "runInNewTransaction", "(", "@", "NotNull", "final", "PlatformTransactionManager", "txManager", ",", "final", "String", "transactionName", ",", "@", "NotNull", "final", "TransactionCallback", "<", "T", ">", "action", ")", ...
Executes the modifying action in new transaction @param txManager transaction manager interface @param transactionName the name of the new transaction @param action the callback to execute in new tranaction @return the result of the action
[ "Executes", "the", "modifying", "action", "in", "new", "transaction" ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/utils/DeploymentHelper.java#L85-L88
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java
ApiOvhHostingweb.serviceName_freedom_domain_GET
public OvhFreedom serviceName_freedom_domain_GET(String serviceName, String domain) throws IOException { String qPath = "/hosting/web/{serviceName}/freedom/{domain}"; StringBuilder sb = path(qPath, serviceName, domain); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhFreedom.class); }
java
public OvhFreedom serviceName_freedom_domain_GET(String serviceName, String domain) throws IOException { String qPath = "/hosting/web/{serviceName}/freedom/{domain}"; StringBuilder sb = path(qPath, serviceName, domain); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhFreedom.class); }
[ "public", "OvhFreedom", "serviceName_freedom_domain_GET", "(", "String", "serviceName", ",", "String", "domain", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/hosting/web/{serviceName}/freedom/{domain}\"", ";", "StringBuilder", "sb", "=", "path", "(", "...
Get this object properties REST: GET /hosting/web/{serviceName}/freedom/{domain} @param serviceName [required] The internal name of your hosting @param domain [required] Freedom domain
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L599-L604
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java
HelpUtil.removeViewer
protected static void removeViewer(Page page, boolean close) { IHelpViewer viewer = (IHelpViewer) page.removeAttribute(VIEWER_ATTRIB); if (viewer != null && close) { viewer.close(); } }
java
protected static void removeViewer(Page page, boolean close) { IHelpViewer viewer = (IHelpViewer) page.removeAttribute(VIEWER_ATTRIB); if (viewer != null && close) { viewer.close(); } }
[ "protected", "static", "void", "removeViewer", "(", "Page", "page", ",", "boolean", "close", ")", "{", "IHelpViewer", "viewer", "=", "(", "IHelpViewer", ")", "page", ".", "removeAttribute", "(", "VIEWER_ATTRIB", ")", ";", "if", "(", "viewer", "!=", "null", ...
Remove and optionally close the help viewer associated with the specified page. @param page The page owning the help viewer. @param close If true, close the help viewer after removing it.
[ "Remove", "and", "optionally", "close", "the", "help", "viewer", "associated", "with", "the", "specified", "page", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java#L160-L166
cloudant/java-cloudant
cloudant-client/src/main/java/com/cloudant/client/api/Database.java
Database.getAttachment
public InputStream getAttachment(String docId, String attachmentName) { return getAttachment(docId, attachmentName, null); }
java
public InputStream getAttachment(String docId, String attachmentName) { return getAttachment(docId, attachmentName, null); }
[ "public", "InputStream", "getAttachment", "(", "String", "docId", ",", "String", "attachmentName", ")", "{", "return", "getAttachment", "(", "docId", ",", "attachmentName", ",", "null", ")", ";", "}" ]
Reads an attachment from the database. The stream must be closed after usage, otherwise http connection leaks will occur. @param docId the document id @param attachmentName the attachment name @return the attachment in the form of an {@code InputStream}.
[ "Reads", "an", "attachment", "from", "the", "database", "." ]
train
https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Database.java#L1204-L1206
denisneuling/apitrary.jar
apitrary-orm/apitrary-orm-core/src/main/java/com/apitrary/orm/core/unmarshalling/JsonResponseConsumer.java
JsonResponseConsumer.onInt
protected void onInt(Integer val, String fieldName, JsonParser jp) { log.trace(fieldName + " " + val); }
java
protected void onInt(Integer val, String fieldName, JsonParser jp) { log.trace(fieldName + " " + val); }
[ "protected", "void", "onInt", "(", "Integer", "val", ",", "String", "fieldName", ",", "JsonParser", "jp", ")", "{", "log", ".", "trace", "(", "fieldName", "+", "\" \"", "+", "val", ")", ";", "}" ]
<p> onInt. </p> @param val a {@link java.lang.Integer} object. @param fieldName a {@link java.lang.String} object. @param jp a {@link org.codehaus.jackson.JsonParser} object.
[ "<p", ">", "onInt", ".", "<", "/", "p", ">" ]
train
https://github.com/denisneuling/apitrary.jar/blob/b7f639a1e735c60ba2b1b62851926757f5de8628/apitrary-orm/apitrary-orm-core/src/main/java/com/apitrary/orm/core/unmarshalling/JsonResponseConsumer.java#L234-L236
google/closure-compiler
src/com/google/javascript/jscomp/RewritePolyfills.java
RewritePolyfills.removeUnneededPolyfills
private void removeUnneededPolyfills(Node parent, Node runtimeEnd) { Node node = parent.getFirstChild(); while (node != null && node != runtimeEnd) { Node next = node.getNext(); if (NodeUtil.isExprCall(node)) { Node call = node.getFirstChild(); Node name = call.getFirstChild(); if (name.matchesQualifiedName("$jscomp.polyfill")) { FeatureSet nativeVersion = FeatureSet.valueOf(name.getNext().getNext().getNext().getString()); if (languageOutIsAtLeast(nativeVersion)) { NodeUtil.removeChild(parent, node); } } } node = next; } }
java
private void removeUnneededPolyfills(Node parent, Node runtimeEnd) { Node node = parent.getFirstChild(); while (node != null && node != runtimeEnd) { Node next = node.getNext(); if (NodeUtil.isExprCall(node)) { Node call = node.getFirstChild(); Node name = call.getFirstChild(); if (name.matchesQualifiedName("$jscomp.polyfill")) { FeatureSet nativeVersion = FeatureSet.valueOf(name.getNext().getNext().getNext().getString()); if (languageOutIsAtLeast(nativeVersion)) { NodeUtil.removeChild(parent, node); } } } node = next; } }
[ "private", "void", "removeUnneededPolyfills", "(", "Node", "parent", ",", "Node", "runtimeEnd", ")", "{", "Node", "node", "=", "parent", ".", "getFirstChild", "(", ")", ";", "while", "(", "node", "!=", "null", "&&", "node", "!=", "runtimeEnd", ")", "{", ...
that already contains the library) is the same or lower than languageOut.
[ "that", "already", "contains", "the", "library", ")", "is", "the", "same", "or", "lower", "than", "languageOut", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/RewritePolyfills.java#L188-L205
yatechorg/jedis-utils
src/main/java/org/yatech/jedis/utils/lua/LuaScriptBuilder.java
LuaScriptBuilder.endScript
public LuaScript endScript(LuaScriptConfig config) { if (!endsWithReturnStatement()) { add(new LuaAstReturnStatement()); } String scriptText = buildScriptText(); return new BasicLuaScript(scriptText, config); }
java
public LuaScript endScript(LuaScriptConfig config) { if (!endsWithReturnStatement()) { add(new LuaAstReturnStatement()); } String scriptText = buildScriptText(); return new BasicLuaScript(scriptText, config); }
[ "public", "LuaScript", "endScript", "(", "LuaScriptConfig", "config", ")", "{", "if", "(", "!", "endsWithReturnStatement", "(", ")", ")", "{", "add", "(", "new", "LuaAstReturnStatement", "(", ")", ")", ";", "}", "String", "scriptText", "=", "buildScriptText", ...
End building the script @param config the configuration for the script to build @return the new {@link LuaScript} instance
[ "End", "building", "the", "script" ]
train
https://github.com/yatechorg/jedis-utils/blob/1951609fa6697df4f69be76e7d66b9284924bd97/src/main/java/org/yatech/jedis/utils/lua/LuaScriptBuilder.java#L78-L84
molgenis/molgenis
molgenis-api-data/src/main/java/org/molgenis/api/data/v2/AttributeFilterToFetchConverter.java
AttributeFilterToFetchConverter.createDefaultEntityFetch
public static Fetch createDefaultEntityFetch(EntityType entityType, String languageCode) { boolean hasRefAttr = false; Fetch fetch = new Fetch(); for (Attribute attr : entityType.getAtomicAttributes()) { Fetch subFetch = createDefaultAttributeFetch(attr, languageCode); if (subFetch != null) { hasRefAttr = true; } fetch.field(attr.getName(), subFetch); } return hasRefAttr ? fetch : null; }
java
public static Fetch createDefaultEntityFetch(EntityType entityType, String languageCode) { boolean hasRefAttr = false; Fetch fetch = new Fetch(); for (Attribute attr : entityType.getAtomicAttributes()) { Fetch subFetch = createDefaultAttributeFetch(attr, languageCode); if (subFetch != null) { hasRefAttr = true; } fetch.field(attr.getName(), subFetch); } return hasRefAttr ? fetch : null; }
[ "public", "static", "Fetch", "createDefaultEntityFetch", "(", "EntityType", "entityType", ",", "String", "languageCode", ")", "{", "boolean", "hasRefAttr", "=", "false", ";", "Fetch", "fetch", "=", "new", "Fetch", "(", ")", ";", "for", "(", "Attribute", "attr"...
Create default entity fetch that fetches all attributes. @return default entity fetch or null
[ "Create", "default", "entity", "fetch", "that", "fetches", "all", "attributes", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-api-data/src/main/java/org/molgenis/api/data/v2/AttributeFilterToFetchConverter.java#L157-L168
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/Repositories.java
Repositories.getRepositoryDef
public static JSONObject getRepositoryDef(final String repositoryName) { if (StringUtils.isBlank(repositoryName)) { return null; } if (null == repositoriesDescription) { return null; } final JSONArray repositories = repositoriesDescription.optJSONArray("repositories"); for (int i = 0; i < repositories.length(); i++) { final JSONObject repository = repositories.optJSONObject(i); if (repositoryName.equals(repository.optString("name"))) { return repository; } } throw new RuntimeException("Not found the repository [name=" + repositoryName + "] definition, please define it in repositories.json"); }
java
public static JSONObject getRepositoryDef(final String repositoryName) { if (StringUtils.isBlank(repositoryName)) { return null; } if (null == repositoriesDescription) { return null; } final JSONArray repositories = repositoriesDescription.optJSONArray("repositories"); for (int i = 0; i < repositories.length(); i++) { final JSONObject repository = repositories.optJSONObject(i); if (repositoryName.equals(repository.optString("name"))) { return repository; } } throw new RuntimeException("Not found the repository [name=" + repositoryName + "] definition, please define it in repositories.json"); }
[ "public", "static", "JSONObject", "getRepositoryDef", "(", "final", "String", "repositoryName", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "repositoryName", ")", ")", "{", "return", "null", ";", "}", "if", "(", "null", "==", "repositoriesDescript...
Gets the repository definition of an repository specified by the given repository name. @param repositoryName the given repository name (maybe with table name prefix) @return repository definition, returns {@code null} if not found
[ "Gets", "the", "repository", "definition", "of", "an", "repository", "specified", "by", "the", "given", "repository", "name", "." ]
train
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/Repositories.java#L230-L248
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java
Calendar.validateField
protected final void validateField(int field, int min, int max) { int value = fields[field]; if (value < min || value > max) { throw new IllegalArgumentException(fieldName(field) + '=' + value + ", valid range=" + min + ".." + max); } }
java
protected final void validateField(int field, int min, int max) { int value = fields[field]; if (value < min || value > max) { throw new IllegalArgumentException(fieldName(field) + '=' + value + ", valid range=" + min + ".." + max); } }
[ "protected", "final", "void", "validateField", "(", "int", "field", ",", "int", "min", ",", "int", "max", ")", "{", "int", "value", "=", "fields", "[", "field", "]", ";", "if", "(", "value", "<", "min", "||", "value", ">", "max", ")", "{", "throw",...
Validate a single field of this calendar given its minimum and maximum allowed value. If the field is out of range, throw a descriptive <code>IllegalArgumentException</code>. Subclasses may use this method in their implementation of {@link #validateField(int)}.
[ "Validate", "a", "single", "field", "of", "this", "calendar", "given", "its", "minimum", "and", "maximum", "allowed", "value", ".", "If", "the", "field", "is", "out", "of", "range", "throw", "a", "descriptive", "<code", ">", "IllegalArgumentException<", "/", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L5257-L5264
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/ItemListBox.java
ItemListBox.addItem
public void addItem (T item, String label) { addItem(label == null ? toLabel(item) : label); _items.add(item); }
java
public void addItem (T item, String label) { addItem(label == null ? toLabel(item) : label); _items.add(item); }
[ "public", "void", "addItem", "(", "T", "item", ",", "String", "label", ")", "{", "addItem", "(", "label", "==", "null", "?", "toLabel", "(", "item", ")", ":", "label", ")", ";", "_items", ".", "add", "(", "item", ")", ";", "}" ]
Adds the supplied item to this list box at the end of the list, using the supplied label if not null. If no label is given, {@link #toLabel(Object)} is used to calculate it.
[ "Adds", "the", "supplied", "item", "to", "this", "list", "box", "at", "the", "end", "of", "the", "list", "using", "the", "supplied", "label", "if", "not", "null", ".", "If", "no", "label", "is", "given", "{" ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/ItemListBox.java#L122-L126
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/AssetFiltersInner.java
AssetFiltersInner.getAsync
public Observable<AssetFilterInner> getAsync(String resourceGroupName, String accountName, String assetName, String filterName) { return getWithServiceResponseAsync(resourceGroupName, accountName, assetName, filterName).map(new Func1<ServiceResponse<AssetFilterInner>, AssetFilterInner>() { @Override public AssetFilterInner call(ServiceResponse<AssetFilterInner> response) { return response.body(); } }); }
java
public Observable<AssetFilterInner> getAsync(String resourceGroupName, String accountName, String assetName, String filterName) { return getWithServiceResponseAsync(resourceGroupName, accountName, assetName, filterName).map(new Func1<ServiceResponse<AssetFilterInner>, AssetFilterInner>() { @Override public AssetFilterInner call(ServiceResponse<AssetFilterInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AssetFilterInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "assetName", ",", "String", "filterName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",...
Get an Asset Filter. Get the details of an Asset Filter associated with the specified Asset. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param assetName The Asset name. @param filterName The Asset Filter name @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AssetFilterInner object
[ "Get", "an", "Asset", "Filter", ".", "Get", "the", "details", "of", "an", "Asset", "Filter", "associated", "with", "the", "specified", "Asset", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/AssetFiltersInner.java#L271-L278
pebble/pebble-android-sdk
PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/PebbleKit.java
PebbleKit.requestDataLogsForApp
public static void requestDataLogsForApp(final Context context, final UUID appUuid) { final Intent requestIntent = new Intent(INTENT_DL_REQUEST_DATA); requestIntent.putExtra(APP_UUID, appUuid); context.sendBroadcast(requestIntent); }
java
public static void requestDataLogsForApp(final Context context, final UUID appUuid) { final Intent requestIntent = new Intent(INTENT_DL_REQUEST_DATA); requestIntent.putExtra(APP_UUID, appUuid); context.sendBroadcast(requestIntent); }
[ "public", "static", "void", "requestDataLogsForApp", "(", "final", "Context", "context", ",", "final", "UUID", "appUuid", ")", "{", "final", "Intent", "requestIntent", "=", "new", "Intent", "(", "INTENT_DL_REQUEST_DATA", ")", ";", "requestIntent", ".", "putExtra",...
A convenience function to emit an intent to pebble.apk to request the data logs for a particular app. If data is available, pebble.apk will advertise the data via 'INTENT_DL_RECEIVE_DATA' intents. To avoid leaking memory, activities registering BroadcastReceivers <em>must</em> unregister them in the Activity's {@link android.app.Activity#onPause()} method. @param context The context in which to register the BroadcastReceiver. @param appUuid The app for which to request data logs. @see Constants#INTENT_DL_RECEIVE_DATA @see Constants#INTENT_DL_REQUEST_DATA
[ "A", "convenience", "function", "to", "emit", "an", "intent", "to", "pebble", ".", "apk", "to", "request", "the", "data", "logs", "for", "a", "particular", "app", ".", "If", "data", "is", "available", "pebble", ".", "apk", "will", "advertise", "the", "da...
train
https://github.com/pebble/pebble-android-sdk/blob/ddfc53ecf3950deebb62a1f205aa21fbe9bce45d/PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/PebbleKit.java#L891-L895
diffplug/durian
src/com/diffplug/common/base/TreeQuery.java
TreeQuery.copyLeavesIn
public static <T, CopyType> CopyType copyLeavesIn(TreeDef<T> def, T root, BiFunction<T, List<CopyType>, CopyType> nodeMapper) { List<CopyType> childrenMapped = def.childrenOf(root).stream().map(child -> { return copyLeavesIn(def, child, nodeMapper); }).collect(Collectors.toList()); return nodeMapper.apply(root, childrenMapped); }
java
public static <T, CopyType> CopyType copyLeavesIn(TreeDef<T> def, T root, BiFunction<T, List<CopyType>, CopyType> nodeMapper) { List<CopyType> childrenMapped = def.childrenOf(root).stream().map(child -> { return copyLeavesIn(def, child, nodeMapper); }).collect(Collectors.toList()); return nodeMapper.apply(root, childrenMapped); }
[ "public", "static", "<", "T", ",", "CopyType", ">", "CopyType", "copyLeavesIn", "(", "TreeDef", "<", "T", ">", "def", ",", "T", "root", ",", "BiFunction", "<", "T", ",", "List", "<", "CopyType", ">", ",", "CopyType", ">", "nodeMapper", ")", "{", "Lis...
Copies the given tree of T to CopyType, starting at the leaf nodes of the tree and moving in to the root node, which allows CopyType to be immutable (but does not require it). @param def defines the structure of the tree @param root root of the tree @param nodeMapper given an unmapped node, and a list of CopyType nodes which have already been mapped, return a mapped node. @return a CopyType with the same contents as the source tree
[ "Copies", "the", "given", "tree", "of", "T", "to", "CopyType", "starting", "at", "the", "leaf", "nodes", "of", "the", "tree", "and", "moving", "in", "to", "the", "root", "node", "which", "allows", "CopyType", "to", "be", "immutable", "(", "but", "does", ...
train
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/TreeQuery.java#L87-L92
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hash/MurmurHash3.java
MurmurHash3.getLong
private static long getLong(final byte[] bArr, final int index, final int rem) { long out = 0L; for (int i = rem; i-- > 0;) { //i= 7,6,5,4,3,2,1,0 final byte b = bArr[index + i]; out ^= (b & 0xFFL) << (i * 8); //equivalent to |= } return out; }
java
private static long getLong(final byte[] bArr, final int index, final int rem) { long out = 0L; for (int i = rem; i-- > 0;) { //i= 7,6,5,4,3,2,1,0 final byte b = bArr[index + i]; out ^= (b & 0xFFL) << (i * 8); //equivalent to |= } return out; }
[ "private", "static", "long", "getLong", "(", "final", "byte", "[", "]", "bArr", ",", "final", "int", "index", ",", "final", "int", "rem", ")", "{", "long", "out", "=", "0L", ";", "for", "(", "int", "i", "=", "rem", ";", "i", "--", ">", "0", ";"...
Gets a long from the given byte array starting at the given byte array index and continuing for remainder (rem) bytes. The bytes are extracted in little-endian order. There is no limit checking. @param bArr The given input byte array. @param index Zero-based index from the start of the byte array. @param rem Remainder bytes. An integer in the range [1,8]. @return long
[ "Gets", "a", "long", "from", "the", "given", "byte", "array", "starting", "at", "the", "given", "byte", "array", "index", "and", "continuing", "for", "remainder", "(", "rem", ")", "bytes", ".", "The", "bytes", "are", "extracted", "in", "little", "-", "en...
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hash/MurmurHash3.java#L308-L315
auth0/java-jwt
lib/src/main/java/com/auth0/jwt/algorithms/CryptoHelper.java
CryptoHelper.verifySignatureFor
@Deprecated boolean verifySignatureFor(String algorithm, PublicKey publicKey, byte[] contentBytes, byte[] signatureBytes) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException { final Signature s = Signature.getInstance(algorithm); s.initVerify(publicKey); s.update(contentBytes); return s.verify(signatureBytes); }
java
@Deprecated boolean verifySignatureFor(String algorithm, PublicKey publicKey, byte[] contentBytes, byte[] signatureBytes) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException { final Signature s = Signature.getInstance(algorithm); s.initVerify(publicKey); s.update(contentBytes); return s.verify(signatureBytes); }
[ "@", "Deprecated", "boolean", "verifySignatureFor", "(", "String", "algorithm", ",", "PublicKey", "publicKey", ",", "byte", "[", "]", "contentBytes", ",", "byte", "[", "]", "signatureBytes", ")", "throws", "NoSuchAlgorithmException", ",", "InvalidKeyException", ",",...
Verify signature using a public key. @param algorithm algorithm name. @param publicKey algorithm public key. @param contentBytes the content to which the signature applies. @param signatureBytes JWT signature. @return the signature bytes. @throws NoSuchAlgorithmException if the algorithm is not supported. @throws InvalidKeyException if the given key is inappropriate for initializing the specified algorithm. @throws SignatureException if this signature object is not initialized properly or if this signature algorithm is unable to process the input data provided. @deprecated rather use corresponding method which takes header and payload as separate inputs
[ "Verify", "signature", "using", "a", "public", "key", "." ]
train
https://github.com/auth0/java-jwt/blob/890538970a9699b7251a4bfe4f26e8d7605ad530/lib/src/main/java/com/auth0/jwt/algorithms/CryptoHelper.java#L179-L185
JoeKerouac/utils
src/main/java/com/joe/utils/common/JMail.java
JMail.sendEmail
public Future<Boolean> sendEmail(EmailBody body, String to, String title, FilePart[] fileParts, JMailCallback callback) { if (StringUtils.isEmpty(to) || (body == null && fileParts == null)) { logger.debug("邮件没有设置接收人或者没有正文"); execCallback(false, body, to, title, fileParts, null, this, callback); return ERROR; } EmailTask task = new EmailTask(body, to, title, fileParts, callback); return executor.submit(task); }
java
public Future<Boolean> sendEmail(EmailBody body, String to, String title, FilePart[] fileParts, JMailCallback callback) { if (StringUtils.isEmpty(to) || (body == null && fileParts == null)) { logger.debug("邮件没有设置接收人或者没有正文"); execCallback(false, body, to, title, fileParts, null, this, callback); return ERROR; } EmailTask task = new EmailTask(body, to, title, fileParts, callback); return executor.submit(task); }
[ "public", "Future", "<", "Boolean", ">", "sendEmail", "(", "EmailBody", "body", ",", "String", "to", ",", "String", "title", ",", "FilePart", "[", "]", "fileParts", ",", "JMailCallback", "callback", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", ...
发送带附件的邮件 @param body 邮件正文 @param to 邮件接收人 @param title 邮件标题 @param fileParts 邮件附件 @param callback 回调函数,邮件发送完毕后会执行 @return 如果发送成功则返回<code>true</code>
[ "发送带附件的邮件" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/common/JMail.java#L152-L162
facebookarchive/hadoop-20
src/core/org/apache/hadoop/ipc/RPC.java
RPC.getProtocolProxy
@SuppressWarnings("unchecked") public static <T extends VersionedProtocol> ProtocolProxy<T> getProtocolProxy( Class<T> protocol, long clientVersion, InetSocketAddress addr, UserGroupInformation ticket, Configuration conf, SocketFactory factory, int rpcTimeout) throws IOException { T proxy = (T) Proxy.newProxyInstance( protocol.getClassLoader(), new Class[] { protocol }, new Invoker(addr, ticket, conf, factory, rpcTimeout, protocol)); String protocolName = protocol.getName(); try { ProtocolSignature serverInfo = proxy .getProtocolSignature(protocolName, clientVersion, ProtocolSignature.getFingerprint(protocol.getMethods())); return new ProtocolProxy<T>(protocol, proxy, serverInfo.getMethods()); } catch (RemoteException re) { IOException ioe = re.unwrapRemoteException(IOException.class); if (ioe.getMessage().startsWith(IOException.class.getName() + ": " + NoSuchMethodException.class.getName())) { // Method getProtocolSignature not supported long serverVersion = proxy.getProtocolVersion(protocol.getName(), clientVersion); if (serverVersion == clientVersion) { return new ProtocolProxy<T>(protocol, proxy, null); } throw new VersionMismatch(protocolName, clientVersion, serverVersion, proxy); } throw re; } }
java
@SuppressWarnings("unchecked") public static <T extends VersionedProtocol> ProtocolProxy<T> getProtocolProxy( Class<T> protocol, long clientVersion, InetSocketAddress addr, UserGroupInformation ticket, Configuration conf, SocketFactory factory, int rpcTimeout) throws IOException { T proxy = (T) Proxy.newProxyInstance( protocol.getClassLoader(), new Class[] { protocol }, new Invoker(addr, ticket, conf, factory, rpcTimeout, protocol)); String protocolName = protocol.getName(); try { ProtocolSignature serverInfo = proxy .getProtocolSignature(protocolName, clientVersion, ProtocolSignature.getFingerprint(protocol.getMethods())); return new ProtocolProxy<T>(protocol, proxy, serverInfo.getMethods()); } catch (RemoteException re) { IOException ioe = re.unwrapRemoteException(IOException.class); if (ioe.getMessage().startsWith(IOException.class.getName() + ": " + NoSuchMethodException.class.getName())) { // Method getProtocolSignature not supported long serverVersion = proxy.getProtocolVersion(protocol.getName(), clientVersion); if (serverVersion == clientVersion) { return new ProtocolProxy<T>(protocol, proxy, null); } throw new VersionMismatch(protocolName, clientVersion, serverVersion, proxy); } throw re; } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", "extends", "VersionedProtocol", ">", "ProtocolProxy", "<", "T", ">", "getProtocolProxy", "(", "Class", "<", "T", ">", "protocol", ",", "long", "clientVersion", ",", "InetSocketAddr...
Construct a client-side proxy that implements the named protocol, talking to a server at the named address. @param protocol protocol @param clientVersion client's version @param addr server address @param ticket security ticket @param conf configuration @param factory socket factory @param rpcTimeout max time for each rpc; 0 means no timeout @return the proxy @throws IOException if any error occurs
[ "Construct", "a", "client", "-", "side", "proxy", "that", "implements", "the", "named", "protocol", "talking", "to", "a", "server", "at", "the", "named", "address", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/ipc/RPC.java#L587-L621
threerings/nenya
core/src/main/java/com/threerings/media/tile/TrimmedObjectTileSet.java
TrimmedObjectTileSet.trimObjectTileSet
public static TrimmedObjectTileSet trimObjectTileSet ( ObjectTileSet source, OutputStream destImage) throws IOException { return trimObjectTileSet(source, destImage, FastImageIO.FILE_SUFFIX); }
java
public static TrimmedObjectTileSet trimObjectTileSet ( ObjectTileSet source, OutputStream destImage) throws IOException { return trimObjectTileSet(source, destImage, FastImageIO.FILE_SUFFIX); }
[ "public", "static", "TrimmedObjectTileSet", "trimObjectTileSet", "(", "ObjectTileSet", "source", ",", "OutputStream", "destImage", ")", "throws", "IOException", "{", "return", "trimObjectTileSet", "(", "source", ",", "destImage", ",", "FastImageIO", ".", "FILE_SUFFIX", ...
Convenience function to trim the tile set to a file using FastImageIO.
[ "Convenience", "function", "to", "trim", "the", "tile", "set", "to", "a", "file", "using", "FastImageIO", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/TrimmedObjectTileSet.java#L174-L179
google/flatbuffers
java/com/google/flatbuffers/Table.java
Table.__vector_in_bytebuffer
protected ByteBuffer __vector_in_bytebuffer(ByteBuffer bb, int vector_offset, int elem_size) { int o = this.__offset(vector_offset); if (o == 0) return null; int vectorstart = __vector(o); bb.rewind(); bb.limit(vectorstart + __vector_len(o) * elem_size); bb.position(vectorstart); return bb; }
java
protected ByteBuffer __vector_in_bytebuffer(ByteBuffer bb, int vector_offset, int elem_size) { int o = this.__offset(vector_offset); if (o == 0) return null; int vectorstart = __vector(o); bb.rewind(); bb.limit(vectorstart + __vector_len(o) * elem_size); bb.position(vectorstart); return bb; }
[ "protected", "ByteBuffer", "__vector_in_bytebuffer", "(", "ByteBuffer", "bb", ",", "int", "vector_offset", ",", "int", "elem_size", ")", "{", "int", "o", "=", "this", ".", "__offset", "(", "vector_offset", ")", ";", "if", "(", "o", "==", "0", ")", "return"...
Initialize vector as a ByteBuffer. This is more efficient than using duplicate, since it doesn't copy the data nor allocattes a new {@link ByteBuffer}, creating no garbage to be collected. @param bb The {@link ByteBuffer} for the array @param vector_offset The position of the vector in the byte buffer @param elem_size The size of each element in the array @return The {@link ByteBuffer} for the array
[ "Initialize", "vector", "as", "a", "ByteBuffer", "." ]
train
https://github.com/google/flatbuffers/blob/6cc30b3272d79c85db7d4871ac0aa69541dc89de/java/com/google/flatbuffers/Table.java#L154-L162
alkacon/opencms-core
src-modules/org/opencms/workplace/commons/CmsPublishScheduled.java
CmsPublishScheduled.actionUpdate
public void actionUpdate() throws JspException { // save initialized instance of this class in request attribute for included sub-elements getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this); try { // prepare the publish scheduled resource performDialogOperation(); // close the dialog actionCloseDialog(); } catch (Throwable e) { // show the error page includeErrorpage(this, e); } }
java
public void actionUpdate() throws JspException { // save initialized instance of this class in request attribute for included sub-elements getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this); try { // prepare the publish scheduled resource performDialogOperation(); // close the dialog actionCloseDialog(); } catch (Throwable e) { // show the error page includeErrorpage(this, e); } }
[ "public", "void", "actionUpdate", "(", ")", "throws", "JspException", "{", "// save initialized instance of this class in request attribute for included sub-elements", "getJsp", "(", ")", ".", "getRequest", "(", ")", ".", "setAttribute", "(", "SESSION_WORKPLACE_CLASS", ",", ...
Performs the resource operation, will be called by the JSP page.<p> @throws JspException if problems including sub-elements occur
[ "Performs", "the", "resource", "operation", "will", "be", "called", "by", "the", "JSP", "page", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsPublishScheduled.java#L131-L145
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/JobState.java
JobState.toJson
public void toJson(JsonWriter jsonWriter, boolean keepConfig) throws IOException { jsonWriter.beginObject(); writeStateSummary(jsonWriter); jsonWriter.name("task states"); jsonWriter.beginArray(); for (TaskState taskState : this.taskStates.values()) { taskState.toJson(jsonWriter, keepConfig); } for (TaskState taskState : this.skippedTaskStates.values()) { taskState.toJson(jsonWriter, keepConfig); } jsonWriter.endArray(); if (keepConfig) { jsonWriter.name("properties"); propsToJson(jsonWriter); } jsonWriter.endObject(); }
java
public void toJson(JsonWriter jsonWriter, boolean keepConfig) throws IOException { jsonWriter.beginObject(); writeStateSummary(jsonWriter); jsonWriter.name("task states"); jsonWriter.beginArray(); for (TaskState taskState : this.taskStates.values()) { taskState.toJson(jsonWriter, keepConfig); } for (TaskState taskState : this.skippedTaskStates.values()) { taskState.toJson(jsonWriter, keepConfig); } jsonWriter.endArray(); if (keepConfig) { jsonWriter.name("properties"); propsToJson(jsonWriter); } jsonWriter.endObject(); }
[ "public", "void", "toJson", "(", "JsonWriter", "jsonWriter", ",", "boolean", "keepConfig", ")", "throws", "IOException", "{", "jsonWriter", ".", "beginObject", "(", ")", ";", "writeStateSummary", "(", "jsonWriter", ")", ";", "jsonWriter", ".", "name", "(", "\"...
Convert this {@link JobState} to a json document. @param jsonWriter a {@link com.google.gson.stream.JsonWriter} used to write the json document @param keepConfig whether to keep all configuration properties @throws IOException
[ "Convert", "this", "{", "@link", "JobState", "}", "to", "a", "json", "document", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/JobState.java#L585-L606
vznet/mongo-jackson-mapper
src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java
JacksonDBCollection.updateMulti
public WriteResult<T, K> updateMulti(T query, T object) throws MongoException { return update(query, object, false, true); }
java
public WriteResult<T, K> updateMulti(T query, T object) throws MongoException { return update(query, object, false, true); }
[ "public", "WriteResult", "<", "T", ",", "K", ">", "updateMulti", "(", "T", "query", ",", "T", "object", ")", "throws", "MongoException", "{", "return", "update", "(", "query", ",", "object", ",", "false", ",", "true", ")", ";", "}" ]
calls {@link DBCollection#update(com.mongodb.DBObject, com.mongodb.DBObject, boolean, boolean)} with upsert=false and multi=true @param query search query for old object to update @param object object with which to update <tt>query</tt> @return The result @throws MongoException If an error occurred
[ "calls", "{", "@link", "DBCollection#update", "(", "com", ".", "mongodb", ".", "DBObject", "com", ".", "mongodb", ".", "DBObject", "boolean", "boolean", ")", "}", "with", "upsert", "=", "false", "and", "multi", "=", "true" ]
train
https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java#L507-L509
palatable/lambda
src/main/java/com/jnape/palatable/lambda/optics/lenses/MapLens.java
MapLens.mappingValues
public static <K, V, V2> Lens.Simple<Map<K, V>, Map<K, V2>> mappingValues(Iso<V, V, V2, V2> iso) { return simpleLens(m -> toMap(HashMap::new, map(t -> t.biMapR(view(iso)), map(Tuple2::fromEntry, m.entrySet()))), (s, b) -> view(mappingValues(iso.mirror()), b)); }
java
public static <K, V, V2> Lens.Simple<Map<K, V>, Map<K, V2>> mappingValues(Iso<V, V, V2, V2> iso) { return simpleLens(m -> toMap(HashMap::new, map(t -> t.biMapR(view(iso)), map(Tuple2::fromEntry, m.entrySet()))), (s, b) -> view(mappingValues(iso.mirror()), b)); }
[ "public", "static", "<", "K", ",", "V", ",", "V2", ">", "Lens", ".", "Simple", "<", "Map", "<", "K", ",", "V", ">", ",", "Map", "<", "K", ",", "V2", ">", ">", "mappingValues", "(", "Iso", "<", "V", ",", "V", ",", "V2", ",", "V2", ">", "is...
A lens that focuses on a map while mapping its values with the mapping {@link Iso}. <p> Note that for this lens to be lawful, <code>iso</code> must be lawful. @param iso the mapping {@link Iso} @param <K> the key type @param <V> the unfocused map value type @param <V2> the focused map value type @return a lens that focuses on a map while mapping its values
[ "A", "lens", "that", "focuses", "on", "a", "map", "while", "mapping", "its", "values", "with", "the", "mapping", "{", "@link", "Iso", "}", ".", "<p", ">", "Note", "that", "for", "this", "lens", "to", "be", "lawful", "<code", ">", "iso<", "/", "code",...
train
https://github.com/palatable/lambda/blob/b643ba836c5916d1d8193822e5efb4e7b40c489a/src/main/java/com/jnape/palatable/lambda/optics/lenses/MapLens.java#L191-L194
elki-project/elki
elki-logging/src/main/java/de/lmu/ifi/dbs/elki/logging/Logging.java
Logging.debugFinest
public void debugFinest(CharSequence message, Throwable e) { log(Level.FINEST, message, e); }
java
public void debugFinest(CharSequence message, Throwable e) { log(Level.FINEST, message, e); }
[ "public", "void", "debugFinest", "(", "CharSequence", "message", ",", "Throwable", "e", ")", "{", "log", "(", "Level", ".", "FINEST", ",", "message", ",", "e", ")", ";", "}" ]
Log a message at the 'finest' debugging level. You should check isDebugging() before building the message. @param message Informational log message. @param e Exception
[ "Log", "a", "message", "at", "the", "finest", "debugging", "level", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-logging/src/main/java/de/lmu/ifi/dbs/elki/logging/Logging.java#L537-L539
apptik/JustJson
json-core/src/main/java/io/apptik/json/JsonObject.java
JsonObject.get
public JsonElement get(String name) throws JsonException { JsonElement result = nameValuePairs.get(name); if (result == null) { throw new JsonException("No value for " + name + ", in: " + this.toString()); } return result; }
java
public JsonElement get(String name) throws JsonException { JsonElement result = nameValuePairs.get(name); if (result == null) { throw new JsonException("No value for " + name + ", in: " + this.toString()); } return result; }
[ "public", "JsonElement", "get", "(", "String", "name", ")", "throws", "JsonException", "{", "JsonElement", "result", "=", "nameValuePairs", ".", "get", "(", "name", ")", ";", "if", "(", "result", "==", "null", ")", "{", "throw", "new", "JsonException", "("...
Returns the value mapped by {@code name}, or throws if no such mapping exists. @throws JsonException if no such mapping exists.
[ "Returns", "the", "value", "mapped", "by", "{", "@code", "name", "}", "or", "throws", "if", "no", "such", "mapping", "exists", "." ]
train
https://github.com/apptik/JustJson/blob/c90f0dd7f84df26da4749be8cd9b026fff499a79/json-core/src/main/java/io/apptik/json/JsonObject.java#L332-L338
aws/aws-sdk-java
aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/IntegrationResponse.java
IntegrationResponse.withResponseParameters
public IntegrationResponse withResponseParameters(java.util.Map<String, String> responseParameters) { setResponseParameters(responseParameters); return this; }
java
public IntegrationResponse withResponseParameters(java.util.Map<String, String> responseParameters) { setResponseParameters(responseParameters); return this; }
[ "public", "IntegrationResponse", "withResponseParameters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "responseParameters", ")", "{", "setResponseParameters", "(", "responseParameters", ")", ";", "return", "this", ";", "}" ]
<p> A key-value map specifying response parameters that are passed to the method response from the backend. The key is a method response header parameter name and the mapped value is an integration response header value, a static value enclosed within a pair of single quotes, or a JSON expression from the integration response body. The mapping key must match the pattern of method.response.header.{name}, where name is a valid and unique header name. The mapped non-static value must match the pattern of integration.response.header.{name} or integration.response.body.{JSON-expression}, where name is a valid and unique response header name and JSON-expression is a valid JSON expression without the $ prefix. </p> @param responseParameters A key-value map specifying response parameters that are passed to the method response from the backend. The key is a method response header parameter name and the mapped value is an integration response header value, a static value enclosed within a pair of single quotes, or a JSON expression from the integration response body. The mapping key must match the pattern of method.response.header.{name}, where name is a valid and unique header name. The mapped non-static value must match the pattern of integration.response.header.{name} or integration.response.body.{JSON-expression}, where name is a valid and unique response header name and JSON-expression is a valid JSON expression without the $ prefix. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "key", "-", "value", "map", "specifying", "response", "parameters", "that", "are", "passed", "to", "the", "method", "response", "from", "the", "backend", ".", "The", "key", "is", "a", "method", "response", "header", "parameter", "name", "an...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/IntegrationResponse.java#L382-L385
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderItemPersistenceImpl.java
CommerceOrderItemPersistenceImpl.findAll
@Override public List<CommerceOrderItem> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CommerceOrderItem> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CommerceOrderItem", ">", "findAll", "(", ")", "{", "return", "findAll", "(", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the commerce order items. @return the commerce order items
[ "Returns", "all", "the", "commerce", "order", "items", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderItemPersistenceImpl.java#L3667-L3670
square/flow
flow/src/main/java/flow/Flow.java
Flow.replaceHistory
public void replaceHistory(@NonNull final Object key, @NonNull final Direction direction) { setHistory(getHistory().buildUpon().clear().push(key).build(), direction); }
java
public void replaceHistory(@NonNull final Object key, @NonNull final Direction direction) { setHistory(getHistory().buildUpon().clear().push(key).build(), direction); }
[ "public", "void", "replaceHistory", "(", "@", "NonNull", "final", "Object", "key", ",", "@", "NonNull", "final", "Direction", "direction", ")", "{", "setHistory", "(", "getHistory", "(", ")", ".", "buildUpon", "(", ")", ".", "clear", "(", ")", ".", "push...
Replaces the history with the given key and dispatches in the given direction.
[ "Replaces", "the", "history", "with", "the", "given", "key", "and", "dispatches", "in", "the", "given", "direction", "." ]
train
https://github.com/square/flow/blob/1656288d1cb4a92dfbcff8276f4d7f9e3390419b/flow/src/main/java/flow/Flow.java#L208-L210
bazaarvoice/emodb
mapreduce/sor-hadoop/src/main/java/com/bazaarvoice/emodb/hadoop/io/LocationUtil.java
LocationUtil.getHostDiscoveryForLocation
public static HostDiscovery getHostDiscoveryForLocation(URI location, Optional<CuratorFramework> curator, String serviceName, MetricRegistry metricRegistry) { checkArgument(getLocationType(location) == LocationType.EMO_HOST_DISCOVERY, "Location does not use host discovery"); Optional<List<String>> hosts = getHostOverride(location); if (hosts.isPresent()) { return createFixedHostDiscovery(serviceName, hosts.get().toArray(new String[hosts.get().size()])); } else { checkState(curator.isPresent(), "curator required"); return createZooKeeperHostDiscovery(curator.get(), serviceName, metricRegistry); } }
java
public static HostDiscovery getHostDiscoveryForLocation(URI location, Optional<CuratorFramework> curator, String serviceName, MetricRegistry metricRegistry) { checkArgument(getLocationType(location) == LocationType.EMO_HOST_DISCOVERY, "Location does not use host discovery"); Optional<List<String>> hosts = getHostOverride(location); if (hosts.isPresent()) { return createFixedHostDiscovery(serviceName, hosts.get().toArray(new String[hosts.get().size()])); } else { checkState(curator.isPresent(), "curator required"); return createZooKeeperHostDiscovery(curator.get(), serviceName, metricRegistry); } }
[ "public", "static", "HostDiscovery", "getHostDiscoveryForLocation", "(", "URI", "location", ",", "Optional", "<", "CuratorFramework", ">", "curator", ",", "String", "serviceName", ",", "MetricRegistry", "metricRegistry", ")", "{", "checkArgument", "(", "getLocationType"...
Returns the HostDiscovery for a given location. The curator should come from a previous call to {@link #getCuratorForLocation(java.net.URI)} to the same location.
[ "Returns", "the", "HostDiscovery", "for", "a", "given", "location", ".", "The", "curator", "should", "come", "from", "a", "previous", "call", "to", "{" ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/mapreduce/sor-hadoop/src/main/java/com/bazaarvoice/emodb/hadoop/io/LocationUtil.java#L264-L273
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/openal/AudioLoader.java
AudioLoader.getStreamingAudio
public static Audio getStreamingAudio(String format, URL url) throws IOException { init(); if (format.equals(OGG)) { return SoundStore.get().getOggStream(url); } if (format.equals(MOD)) { return SoundStore.get().getMOD(url.openStream()); } if (format.equals(XM)) { return SoundStore.get().getMOD(url.openStream()); } throw new IOException("Unsupported format for streaming Audio: "+format); }
java
public static Audio getStreamingAudio(String format, URL url) throws IOException { init(); if (format.equals(OGG)) { return SoundStore.get().getOggStream(url); } if (format.equals(MOD)) { return SoundStore.get().getMOD(url.openStream()); } if (format.equals(XM)) { return SoundStore.get().getMOD(url.openStream()); } throw new IOException("Unsupported format for streaming Audio: "+format); }
[ "public", "static", "Audio", "getStreamingAudio", "(", "String", "format", ",", "URL", "url", ")", "throws", "IOException", "{", "init", "(", ")", ";", "if", "(", "format", ".", "equals", "(", "OGG", ")", ")", "{", "return", "SoundStore", ".", "get", "...
Get audio data in a playable state by setting up a stream that can be piped into OpenAL - i.e. streaming audio @param format The format of the audio to be loaded (something like "XM" or "OGG") @param url The location of the data that should be streamed @return An object representing the audio data @throws IOException Indicates a failure to access the audio data
[ "Get", "audio", "data", "in", "a", "playable", "state", "by", "setting", "up", "a", "stream", "that", "can", "be", "piped", "into", "OpenAL", "-", "i", ".", "e", ".", "streaming", "audio" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/openal/AudioLoader.java#L72-L86
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.pauseSession
public PauseSessionResponse pauseSession(PauseSessionRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getSessionId(), "The parameter sessionId should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_SESSION, request.getSessionId()); internalRequest.addParameter(PAUSE, null); return invokeHttpClient(internalRequest, PauseSessionResponse.class); }
java
public PauseSessionResponse pauseSession(PauseSessionRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getSessionId(), "The parameter sessionId should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_SESSION, request.getSessionId()); internalRequest.addParameter(PAUSE, null); return invokeHttpClient(internalRequest, PauseSessionResponse.class); }
[ "public", "PauseSessionResponse", "pauseSession", "(", "PauseSessionRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getSessionId", "(", ")", ",", ...
Pause your live session by live session id. @param request The request object containing all parameters for pausing live session. @return the response
[ "Pause", "your", "live", "session", "by", "live", "session", "id", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L771-L778
bazaarvoice/emodb
common/stash/src/main/java/com/bazaarvoice/emodb/common/stash/StashReader.java
StashReader.getTableMetadata
public StashTableMetadata getTableMetadata(String table) throws StashNotAvailableException, TableNotStashedException { ImmutableList.Builder<StashFileMetadata> filesBuilder = ImmutableList.builder(); Iterator<S3ObjectSummary> objectSummaries = getS3ObjectSummariesForTable(table); while (objectSummaries.hasNext()) { S3ObjectSummary objectSummary = objectSummaries.next(); filesBuilder.add(new StashFileMetadata(_bucket, objectSummary.getKey(), objectSummary.getSize())); } List<StashFileMetadata> files = filesBuilder.build(); // Get the prefix arbitrarily from the first file. String prefix = files.get(0).getKey(); prefix = prefix.substring(0, prefix.lastIndexOf('/') + 1); return new StashTableMetadata(_bucket, prefix, table, files); }
java
public StashTableMetadata getTableMetadata(String table) throws StashNotAvailableException, TableNotStashedException { ImmutableList.Builder<StashFileMetadata> filesBuilder = ImmutableList.builder(); Iterator<S3ObjectSummary> objectSummaries = getS3ObjectSummariesForTable(table); while (objectSummaries.hasNext()) { S3ObjectSummary objectSummary = objectSummaries.next(); filesBuilder.add(new StashFileMetadata(_bucket, objectSummary.getKey(), objectSummary.getSize())); } List<StashFileMetadata> files = filesBuilder.build(); // Get the prefix arbitrarily from the first file. String prefix = files.get(0).getKey(); prefix = prefix.substring(0, prefix.lastIndexOf('/') + 1); return new StashTableMetadata(_bucket, prefix, table, files); }
[ "public", "StashTableMetadata", "getTableMetadata", "(", "String", "table", ")", "throws", "StashNotAvailableException", ",", "TableNotStashedException", "{", "ImmutableList", ".", "Builder", "<", "StashFileMetadata", ">", "filesBuilder", "=", "ImmutableList", ".", "build...
Gets the metadata for a single table in this stash. This is similar to getting the splits for the table except that it exposes lower level information about the underlying S3 files. For clients who will use their own system for reading the files from S3, such as source files for a map-reduce job, this method provides the necessary information. For simply iterating over the stash contents using either {@link #scan(String)} or {@link #getSplits(String)} in conjunction with {@link #getSplit(StashSplit)} is preferred.
[ "Gets", "the", "metadata", "for", "a", "single", "table", "in", "this", "stash", ".", "This", "is", "similar", "to", "getting", "the", "splits", "for", "the", "table", "except", "that", "it", "exposes", "lower", "level", "information", "about", "the", "und...
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/stash/src/main/java/com/bazaarvoice/emodb/common/stash/StashReader.java#L280-L297
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java
BaseApplet.makeRemoteSession
public RemoteSession makeRemoteSession(RemoteSession parentSessionObject, String strSessionClass) { RemoteTask server = (RemoteTask)this.getRemoteTask(); try { synchronized (server) { // In case this is called from another task if (parentSessionObject == null) return (RemoteSession)server.makeRemoteSession(strSessionClass); else return (RemoteSession)parentSessionObject.makeRemoteSession(strSessionClass); } } catch (RemoteException ex) { ex.printStackTrace(); } catch (Exception ex) { ex.printStackTrace(); } return null; }
java
public RemoteSession makeRemoteSession(RemoteSession parentSessionObject, String strSessionClass) { RemoteTask server = (RemoteTask)this.getRemoteTask(); try { synchronized (server) { // In case this is called from another task if (parentSessionObject == null) return (RemoteSession)server.makeRemoteSession(strSessionClass); else return (RemoteSession)parentSessionObject.makeRemoteSession(strSessionClass); } } catch (RemoteException ex) { ex.printStackTrace(); } catch (Exception ex) { ex.printStackTrace(); } return null; }
[ "public", "RemoteSession", "makeRemoteSession", "(", "RemoteSession", "parentSessionObject", ",", "String", "strSessionClass", ")", "{", "RemoteTask", "server", "=", "(", "RemoteTask", ")", "this", ".", "getRemoteTask", "(", ")", ";", "try", "{", "synchronized", "...
Create this session with this class name at the remote server. @param parentSessionObject The (optional) parent session. @param strSessionClass The class name of the remote session to create. @return The new remote session (or null if not found).
[ "Create", "this", "session", "with", "this", "class", "name", "at", "the", "remote", "server", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java#L1166-L1183
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/service/RunService.java
RunService.createPortMapping
public PortMapping createPortMapping(RunImageConfiguration runConfig, Properties properties) { try { return new PortMapping(runConfig.getPorts(), properties); } catch (IllegalArgumentException exp) { throw new IllegalArgumentException("Cannot parse port mapping", exp); } }
java
public PortMapping createPortMapping(RunImageConfiguration runConfig, Properties properties) { try { return new PortMapping(runConfig.getPorts(), properties); } catch (IllegalArgumentException exp) { throw new IllegalArgumentException("Cannot parse port mapping", exp); } }
[ "public", "PortMapping", "createPortMapping", "(", "RunImageConfiguration", "runConfig", ",", "Properties", "properties", ")", "{", "try", "{", "return", "new", "PortMapping", "(", "runConfig", ".", "getPorts", "(", ")", ",", "properties", ")", ";", "}", "catch"...
Create port mapping for a specific configuration as it can be used when creating containers @param runConfig the cun configuration @param properties properties to lookup variables @return the portmapping
[ "Create", "port", "mapping", "for", "a", "specific", "configuration", "as", "it", "can", "be", "used", "when", "creating", "containers" ]
train
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/service/RunService.java#L250-L256
SvenEwald/xmlbeam
src/main/java/org/xmlbeam/DefaultXPathBinder.java
DefaultXPathBinder.asDate
@Override public CloseableValue<Date> asDate() { final Class<?> callerClass = ReflectionHelper.getDirectCallerClass(); return bindSingeValue(Date.class, callerClass); }
java
@Override public CloseableValue<Date> asDate() { final Class<?> callerClass = ReflectionHelper.getDirectCallerClass(); return bindSingeValue(Date.class, callerClass); }
[ "@", "Override", "public", "CloseableValue", "<", "Date", ">", "asDate", "(", ")", "{", "final", "Class", "<", "?", ">", "callerClass", "=", "ReflectionHelper", ".", "getDirectCallerClass", "(", ")", ";", "return", "bindSingeValue", "(", "Date", ".", "class"...
Evaluates the XPath as a Date value. This method is just a shortcut for as(Date.class); You probably want to specify ' using ' followed by some formatting pattern consecutive to the XPAth. @return Date value of evaluation result.
[ "Evaluates", "the", "XPath", "as", "a", "Date", "value", ".", "This", "method", "is", "just", "a", "shortcut", "for", "as", "(", "Date", ".", "class", ")", ";", "You", "probably", "want", "to", "specify", "using", "followed", "by", "some", "formatting", ...
train
https://github.com/SvenEwald/xmlbeam/blob/acaac1b8fa28d246f17187f5e3c6696458a0b447/src/main/java/org/xmlbeam/DefaultXPathBinder.java#L111-L115
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Clicker.java
Clicker.clickOnScreen
public void clickOnScreen(float x, float y, View view) { boolean successfull = false; int retry = 0; SecurityException ex = null; while(!successfull && retry < 20) { long downTime = SystemClock.uptimeMillis(); long eventTime = SystemClock.uptimeMillis(); MotionEvent event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, x, y, 0); MotionEvent event2 = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_UP, x, y, 0); try{ inst.sendPointerSync(event); inst.sendPointerSync(event2); successfull = true; }catch(SecurityException e){ ex = e; dialogUtils.hideSoftKeyboard(null, false, true); sleeper.sleep(MINI_WAIT); retry++; View identicalView = viewFetcher.getIdenticalView(view); if(identicalView != null){ float[] xyToClick = getClickCoordinates(identicalView); x = xyToClick[0]; y = xyToClick[1]; } } } if(!successfull) { Assert.fail("Click at ("+x+", "+y+") can not be completed! ("+(ex != null ? ex.getClass().getName()+": "+ex.getMessage() : "null")+")"); } }
java
public void clickOnScreen(float x, float y, View view) { boolean successfull = false; int retry = 0; SecurityException ex = null; while(!successfull && retry < 20) { long downTime = SystemClock.uptimeMillis(); long eventTime = SystemClock.uptimeMillis(); MotionEvent event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, x, y, 0); MotionEvent event2 = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_UP, x, y, 0); try{ inst.sendPointerSync(event); inst.sendPointerSync(event2); successfull = true; }catch(SecurityException e){ ex = e; dialogUtils.hideSoftKeyboard(null, false, true); sleeper.sleep(MINI_WAIT); retry++; View identicalView = viewFetcher.getIdenticalView(view); if(identicalView != null){ float[] xyToClick = getClickCoordinates(identicalView); x = xyToClick[0]; y = xyToClick[1]; } } } if(!successfull) { Assert.fail("Click at ("+x+", "+y+") can not be completed! ("+(ex != null ? ex.getClass().getName()+": "+ex.getMessage() : "null")+")"); } }
[ "public", "void", "clickOnScreen", "(", "float", "x", ",", "float", "y", ",", "View", "view", ")", "{", "boolean", "successfull", "=", "false", ";", "int", "retry", "=", "0", ";", "SecurityException", "ex", "=", "null", ";", "while", "(", "!", "success...
Clicks on a given coordinate on the screen. @param x the x coordinate @param y the y coordinate
[ "Clicks", "on", "a", "given", "coordinate", "on", "the", "screen", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Clicker.java#L79-L111
js-lib-com/commons
src/main/java/js/util/Params.java
Params.GTE
public static void GTE(long parameter, long value, String name) throws IllegalArgumentException { if (parameter < value) { throw new IllegalArgumentException(String.format("%s is not greater than or equal %d.", name, value)); } }
java
public static void GTE(long parameter, long value, String name) throws IllegalArgumentException { if (parameter < value) { throw new IllegalArgumentException(String.format("%s is not greater than or equal %d.", name, value)); } }
[ "public", "static", "void", "GTE", "(", "long", "parameter", ",", "long", "value", ",", "String", "name", ")", "throws", "IllegalArgumentException", "{", "if", "(", "parameter", "<", "value", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String",...
Test if numeric parameter is greater than or equal to given threshold value. @param parameter invocation numeric parameter, @param value threshold value, @param name the name of invocation parameter. @throws IllegalArgumentException if <code>parameter</code> is not greater than or equal to threshold value.
[ "Test", "if", "numeric", "parameter", "is", "greater", "than", "or", "equal", "to", "given", "threshold", "value", "." ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L387-L391
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/Popups.java
Popups.centerOn
public static <T extends PopupPanel> T centerOn (T popup, Widget centerOn) { return centerOn(popup, centerOn.getAbsoluteTop() + centerOn.getOffsetHeight()/2); }
java
public static <T extends PopupPanel> T centerOn (T popup, Widget centerOn) { return centerOn(popup, centerOn.getAbsoluteTop() + centerOn.getOffsetHeight()/2); }
[ "public", "static", "<", "T", "extends", "PopupPanel", ">", "T", "centerOn", "(", "T", "popup", ",", "Widget", "centerOn", ")", "{", "return", "centerOn", "(", "popup", ",", "centerOn", ".", "getAbsoluteTop", "(", ")", "+", "centerOn", ".", "getOffsetHeigh...
Centers the supplied vertically on the supplied trigger widget. The popup's showing state will be preserved.
[ "Centers", "the", "supplied", "vertically", "on", "the", "supplied", "trigger", "widget", ".", "The", "popup", "s", "showing", "state", "will", "be", "preserved", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Popups.java#L229-L232
Netflix/conductor
client/src/main/java/com/netflix/conductor/client/http/TaskClient.java
TaskClient.requeuePendingTasksByTaskType
public String requeuePendingTasksByTaskType(String taskType) { Preconditions.checkArgument(StringUtils.isNotBlank(taskType), "Task type cannot be blank"); return postForEntity("tasks/queue/requeue/{taskType}", null, null, String.class, taskType); }
java
public String requeuePendingTasksByTaskType(String taskType) { Preconditions.checkArgument(StringUtils.isNotBlank(taskType), "Task type cannot be blank"); return postForEntity("tasks/queue/requeue/{taskType}", null, null, String.class, taskType); }
[ "public", "String", "requeuePendingTasksByTaskType", "(", "String", "taskType", ")", "{", "Preconditions", ".", "checkArgument", "(", "StringUtils", ".", "isNotBlank", "(", "taskType", ")", ",", "\"Task type cannot be blank\"", ")", ";", "return", "postForEntity", "("...
Requeue pending tasks of a specific task type @return returns the number of tasks that have been requeued
[ "Requeue", "pending", "tasks", "of", "a", "specific", "task", "type" ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/client/src/main/java/com/netflix/conductor/client/http/TaskClient.java#L373-L376
finmath/finmath-lib
src/main/java/net/finmath/montecarlo/process/EulerSchemeFromProcessModel.java
EulerSchemeFromProcessModel.getProcessValue
@Override public RandomVariable getProcessValue(int timeIndex, int componentIndex) { // Thread safe lazy initialization synchronized(this) { if (discreteProcess == null || discreteProcess.length == 0) { doPrecalculateProcess(); } } if(discreteProcess[timeIndex][componentIndex] == null) { throw new NullPointerException("Generation of process component " + componentIndex + " at time index " + timeIndex + " failed. Likely due to out of memory"); } // Return value of process return discreteProcess[timeIndex][componentIndex]; }
java
@Override public RandomVariable getProcessValue(int timeIndex, int componentIndex) { // Thread safe lazy initialization synchronized(this) { if (discreteProcess == null || discreteProcess.length == 0) { doPrecalculateProcess(); } } if(discreteProcess[timeIndex][componentIndex] == null) { throw new NullPointerException("Generation of process component " + componentIndex + " at time index " + timeIndex + " failed. Likely due to out of memory"); } // Return value of process return discreteProcess[timeIndex][componentIndex]; }
[ "@", "Override", "public", "RandomVariable", "getProcessValue", "(", "int", "timeIndex", ",", "int", "componentIndex", ")", "{", "// Thread safe lazy initialization", "synchronized", "(", "this", ")", "{", "if", "(", "discreteProcess", "==", "null", "||", "discreteP...
This method returns the realization of the process at a certain time index. @param timeIndex Time index at which the process should be observed @return A vector of process realizations (on path)
[ "This", "method", "returns", "the", "realization", "of", "the", "process", "at", "a", "certain", "time", "index", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/process/EulerSchemeFromProcessModel.java#L97-L112
FXMisc/WellBehavedFX
src/main/java/org/fxmisc/wellbehaved/event/Nodes.java
Nodes.setInputMapUnsafe
private static void setInputMapUnsafe(Node node, InputMap<?> im) { getProperties(node).put(P_INPUTMAP, im); }
java
private static void setInputMapUnsafe(Node node, InputMap<?> im) { getProperties(node).put(P_INPUTMAP, im); }
[ "private", "static", "void", "setInputMapUnsafe", "(", "Node", "node", ",", "InputMap", "<", "?", ">", "im", ")", "{", "getProperties", "(", "node", ")", ".", "put", "(", "P_INPUTMAP", ",", "im", ")", ";", "}" ]
Expects a {@link #init(Node)} call with the given node before this one is called
[ "Expects", "a", "{" ]
train
https://github.com/FXMisc/WellBehavedFX/blob/ca889734481f5439655ca8deb6f742964b5654b0/src/main/java/org/fxmisc/wellbehaved/event/Nodes.java#L151-L153
reinert/requestor
requestor/core/requestor-api/src/main/java/io/reinert/requestor/WebTarget.java
WebTarget.getUri
public Uri getUri() { if (uri == null) { try { uri = uriBuilder.build(); } catch (Exception e) { throw new IllegalStateException("Could not build the URI.", e); } } return uri; }
java
public Uri getUri() { if (uri == null) { try { uri = uriBuilder.build(); } catch (Exception e) { throw new IllegalStateException("Could not build the URI.", e); } } return uri; }
[ "public", "Uri", "getUri", "(", ")", "{", "if", "(", "uri", "==", "null", ")", "{", "try", "{", "uri", "=", "uriBuilder", ".", "build", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"C...
Get the URI identifying the resource. @return the resource URI. @throws IllegalStateException if the URI could not be built from the current state of the resource target.
[ "Get", "the", "URI", "identifying", "the", "resource", "." ]
train
https://github.com/reinert/requestor/blob/40163a75cd17815d5089935d0dd97b8d652ad6d4/requestor/core/requestor-api/src/main/java/io/reinert/requestor/WebTarget.java#L112-L121
igniterealtime/Smack
smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java
OmemoService.isStale
static boolean isStale(OmemoDevice userDevice, OmemoDevice subject, Date lastReceipt, int maxAgeHours) { if (userDevice.equals(subject)) { return false; } if (lastReceipt == null) { return false; } long maxAgeMillis = MILLIS_PER_HOUR * maxAgeHours; Date now = new Date(); return now.getTime() - lastReceipt.getTime() > maxAgeMillis; }
java
static boolean isStale(OmemoDevice userDevice, OmemoDevice subject, Date lastReceipt, int maxAgeHours) { if (userDevice.equals(subject)) { return false; } if (lastReceipt == null) { return false; } long maxAgeMillis = MILLIS_PER_HOUR * maxAgeHours; Date now = new Date(); return now.getTime() - lastReceipt.getTime() > maxAgeMillis; }
[ "static", "boolean", "isStale", "(", "OmemoDevice", "userDevice", ",", "OmemoDevice", "subject", ",", "Date", "lastReceipt", ",", "int", "maxAgeHours", ")", "{", "if", "(", "userDevice", ".", "equals", "(", "subject", ")", ")", "{", "return", "false", ";", ...
Determine, whether another one of *our* devices is stale or not. @param userDevice our omemoDevice @param subject another one of our devices @param lastReceipt date of last received message from that device @param maxAgeHours threshold @return staleness
[ "Determine", "whether", "another", "one", "of", "*", "our", "*", "devices", "is", "stale", "or", "not", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java#L993-L1006
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/Setup.java
Setup.getConfigClass
@SuppressWarnings("unchecked") public final <T> Class<T> getConfigClass(ClassLoader classLoader) { if (clazz == null) { final FeaturableConfig config = FeaturableConfig.imports(this); try { clazz = classLoader.loadClass(config.getClassName()); } catch (final ClassNotFoundException exception) { throw new LionEngineException(exception, Setup.ERROR_CLASS + getMedia().getPath()); } } return (Class<T>) clazz; }
java
@SuppressWarnings("unchecked") public final <T> Class<T> getConfigClass(ClassLoader classLoader) { if (clazz == null) { final FeaturableConfig config = FeaturableConfig.imports(this); try { clazz = classLoader.loadClass(config.getClassName()); } catch (final ClassNotFoundException exception) { throw new LionEngineException(exception, Setup.ERROR_CLASS + getMedia().getPath()); } } return (Class<T>) clazz; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "final", "<", "T", ">", "Class", "<", "T", ">", "getConfigClass", "(", "ClassLoader", "classLoader", ")", "{", "if", "(", "clazz", "==", "null", ")", "{", "final", "FeaturableConfig", "config", ...
Get the class mapped to the setup. Lazy call (load class only first time, and keep its reference after). @param <T> The element type. @param classLoader The class loader used. @return The class mapped to the setup. @throws LionEngineException If the class was not found by the class loader.
[ "Get", "the", "class", "mapped", "to", "the", "setup", ".", "Lazy", "call", "(", "load", "class", "only", "first", "time", "and", "keep", "its", "reference", "after", ")", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/Setup.java#L96-L112
landawn/AbacusUtil
src/com/landawn/abacus/util/stream/Stream.java
Stream.parallelZip
public static <A, B, C, R> Stream<R> parallelZip(final Stream<A> a, final Stream<B> b, final Stream<C> c, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC, final TriFunction<? super A, ? super B, ? super C, R> zipFunction) { return parallelZip(a, b, c, valueForNoneA, valueForNoneB, valueForNoneC, zipFunction, DEFAULT_QUEUE_SIZE_PER_ITERATOR); }
java
public static <A, B, C, R> Stream<R> parallelZip(final Stream<A> a, final Stream<B> b, final Stream<C> c, final A valueForNoneA, final B valueForNoneB, final C valueForNoneC, final TriFunction<? super A, ? super B, ? super C, R> zipFunction) { return parallelZip(a, b, c, valueForNoneA, valueForNoneB, valueForNoneC, zipFunction, DEFAULT_QUEUE_SIZE_PER_ITERATOR); }
[ "public", "static", "<", "A", ",", "B", ",", "C", ",", "R", ">", "Stream", "<", "R", ">", "parallelZip", "(", "final", "Stream", "<", "A", ">", "a", ",", "final", "Stream", "<", "B", ">", "b", ",", "final", "Stream", "<", "C", ">", "c", ",", ...
Put the stream in try-catch to stop the back-end reading thread if error happens <br /> <code> try (Stream<Integer> stream = Stream.parallelZip(a, b, zipFunction)) { stream.forEach(N::println); } </code> @param a @param b @param c @param valueForNoneA @param valueForNoneB @param valueForNoneC @param zipFunction @return
[ "Put", "the", "stream", "in", "try", "-", "catch", "to", "stop", "the", "back", "-", "end", "reading", "thread", "if", "error", "happens", "<br", "/", ">", "<code", ">", "try", "(", "Stream<Integer", ">", "stream", "=", "Stream", ".", "parallelZip", "(...
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/stream/Stream.java#L8491-L8494
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/dependency/Vulnerability.java
Vulnerability.addReference
public void addReference(String referenceSource, String referenceName, String referenceUrl) { final Reference ref = new Reference(); ref.setSource(referenceSource); ref.setName(referenceName); ref.setUrl(referenceUrl); this.references.add(ref); }
java
public void addReference(String referenceSource, String referenceName, String referenceUrl) { final Reference ref = new Reference(); ref.setSource(referenceSource); ref.setName(referenceName); ref.setUrl(referenceUrl); this.references.add(ref); }
[ "public", "void", "addReference", "(", "String", "referenceSource", ",", "String", "referenceName", ",", "String", "referenceUrl", ")", "{", "final", "Reference", "ref", "=", "new", "Reference", "(", ")", ";", "ref", ".", "setSource", "(", "referenceSource", "...
Adds a reference. @param referenceSource the source of the reference @param referenceName the referenceName of the reference @param referenceUrl the url of the reference
[ "Adds", "a", "reference", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/dependency/Vulnerability.java#L215-L221
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/MethodUtils.java
MethodUtils.invokeMethod
public static Object invokeMethod(Object object, String methodName, Object[] args, Class<?>[] paramTypes) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { if (args == null) { args = EMPTY_OBJECT_ARRAY; } if (paramTypes == null) { paramTypes = EMPTY_CLASS_PARAMETERS; } Method method = getMatchingAccessibleMethod(object.getClass(), methodName, args, paramTypes); if (method == null) { throw new NoSuchMethodException("No such accessible method: " + methodName + "() on object: " + object.getClass().getName()); } return invokeMethod(object, method, args, paramTypes); }
java
public static Object invokeMethod(Object object, String methodName, Object[] args, Class<?>[] paramTypes) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { if (args == null) { args = EMPTY_OBJECT_ARRAY; } if (paramTypes == null) { paramTypes = EMPTY_CLASS_PARAMETERS; } Method method = getMatchingAccessibleMethod(object.getClass(), methodName, args, paramTypes); if (method == null) { throw new NoSuchMethodException("No such accessible method: " + methodName + "() on object: " + object.getClass().getName()); } return invokeMethod(object, method, args, paramTypes); }
[ "public", "static", "Object", "invokeMethod", "(", "Object", "object", ",", "String", "methodName", ",", "Object", "[", "]", "args", ",", "Class", "<", "?", ">", "[", "]", "paramTypes", ")", "throws", "NoSuchMethodException", ",", "IllegalAccessException", ","...
<p>Invoke a named method whose parameter type matches the object type.</p> <p>The behaviour of this method is less deterministic than {@link #invokeExactMethod(Object object,String methodName,Object[] args,Class[] paramTypes)}. It loops through all methods with names that match and then executes the first it finds with compatible parameters.</p> <p>This method supports calls to methods taking primitive parameters via passing in wrapping classes. So, for example, a {@code Boolean} class would match a {@code boolean} primitive.</p> @param object invoke method on this object @param methodName get method with this name @param args use these arguments - treat null as empty array @param paramTypes match these parameters - treat null as empty array @return the value returned by the invoked method @throws NoSuchMethodException if there is no such accessible method @throws InvocationTargetException wraps an exception thrown by the method invoked @throws IllegalAccessException if the requested method is not accessible via reflection
[ "<p", ">", "Invoke", "a", "named", "method", "whose", "parameter", "type", "matches", "the", "object", "type", ".", "<", "/", "p", ">" ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/MethodUtils.java#L257-L270
molgenis/molgenis
molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java
RestController.retrieveEntity
@GetMapping(value = "/{entityTypeId}/{id}", produces = APPLICATION_JSON_VALUE) public Map<String, Object> retrieveEntity( @PathVariable("entityTypeId") String entityTypeId, @PathVariable("id") String untypedId, @RequestParam(value = "attributes", required = false) String[] attributes, @RequestParam(value = "expand", required = false) String[] attributeExpands) { Set<String> attributesSet = toAttributeSet(attributes); Map<String, Set<String>> attributeExpandSet = toExpandMap(attributeExpands); EntityType meta = dataService.getEntityType(entityTypeId); Object id = getTypedValue(untypedId, meta.getIdAttribute()); Entity entity = dataService.findOneById(entityTypeId, id); if (entity == null) { throw new UnknownEntityException(meta, id); } return getEntityAsMap(entity, meta, attributesSet, attributeExpandSet); }
java
@GetMapping(value = "/{entityTypeId}/{id}", produces = APPLICATION_JSON_VALUE) public Map<String, Object> retrieveEntity( @PathVariable("entityTypeId") String entityTypeId, @PathVariable("id") String untypedId, @RequestParam(value = "attributes", required = false) String[] attributes, @RequestParam(value = "expand", required = false) String[] attributeExpands) { Set<String> attributesSet = toAttributeSet(attributes); Map<String, Set<String>> attributeExpandSet = toExpandMap(attributeExpands); EntityType meta = dataService.getEntityType(entityTypeId); Object id = getTypedValue(untypedId, meta.getIdAttribute()); Entity entity = dataService.findOneById(entityTypeId, id); if (entity == null) { throw new UnknownEntityException(meta, id); } return getEntityAsMap(entity, meta, attributesSet, attributeExpandSet); }
[ "@", "GetMapping", "(", "value", "=", "\"/{entityTypeId}/{id}\"", ",", "produces", "=", "APPLICATION_JSON_VALUE", ")", "public", "Map", "<", "String", ",", "Object", ">", "retrieveEntity", "(", "@", "PathVariable", "(", "\"entityTypeId\"", ")", "String", "entityTy...
Get's an entity by it's id <p>Examples: <p>/api/v1/person/99 Retrieves a person with id 99
[ "Get", "s", "an", "entity", "by", "it", "s", "id" ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java#L256-L273
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java
JobsImpl.listNextAsync
public ServiceFuture<List<CloudJob>> listNextAsync(final String nextPageLink, final JobListNextOptions jobListNextOptions, final ServiceFuture<List<CloudJob>> serviceFuture, final ListOperationCallback<CloudJob> serviceCallback) { return AzureServiceFuture.fromHeaderPageResponse( listNextSinglePageAsync(nextPageLink, jobListNextOptions), new Func1<String, Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListHeaders>> call(String nextPageLink) { return listNextSinglePageAsync(nextPageLink, jobListNextOptions); } }, serviceCallback); }
java
public ServiceFuture<List<CloudJob>> listNextAsync(final String nextPageLink, final JobListNextOptions jobListNextOptions, final ServiceFuture<List<CloudJob>> serviceFuture, final ListOperationCallback<CloudJob> serviceCallback) { return AzureServiceFuture.fromHeaderPageResponse( listNextSinglePageAsync(nextPageLink, jobListNextOptions), new Func1<String, Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListHeaders>> call(String nextPageLink) { return listNextSinglePageAsync(nextPageLink, jobListNextOptions); } }, serviceCallback); }
[ "public", "ServiceFuture", "<", "List", "<", "CloudJob", ">", ">", "listNextAsync", "(", "final", "String", "nextPageLink", ",", "final", "JobListNextOptions", "jobListNextOptions", ",", "final", "ServiceFuture", "<", "List", "<", "CloudJob", ">", ">", "serviceFut...
Lists all of the jobs in the specified account. @param nextPageLink The NextLink from the previous successful call to List operation. @param jobListNextOptions Additional parameters for the operation @param serviceFuture the ServiceFuture object tracking the Retrofit calls @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Lists", "all", "of", "the", "jobs", "in", "the", "specified", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L3447-L3457
lessthanoptimal/BoofCV
integration/boofcv-android/src/main/java/boofcv/android/VisualizeImageData.java
VisualizeImageData.grayMagnitude
public static void grayMagnitude(GrayS32 input , int maxAbsValue , Bitmap output , byte[] storage) { shapeShape(input, output); if( storage == null ) storage = declareStorage(output,null); if( maxAbsValue < 0 ) maxAbsValue = ImageStatistics.maxAbs(input); int indexDst = 0; for( int y = 0; y < input.height; y++ ) { int indexSrc = input.startIndex + y*input.stride; for( int x = 0; x < input.width; x++ ) { byte gray = (byte)(255*Math.abs(input.data[ indexSrc++ ])/maxAbsValue); storage[indexDst++] = gray; storage[indexDst++] = gray; storage[indexDst++] = gray; storage[indexDst++] = (byte) 0xFF; } } output.copyPixelsFromBuffer(ByteBuffer.wrap(storage)); }
java
public static void grayMagnitude(GrayS32 input , int maxAbsValue , Bitmap output , byte[] storage) { shapeShape(input, output); if( storage == null ) storage = declareStorage(output,null); if( maxAbsValue < 0 ) maxAbsValue = ImageStatistics.maxAbs(input); int indexDst = 0; for( int y = 0; y < input.height; y++ ) { int indexSrc = input.startIndex + y*input.stride; for( int x = 0; x < input.width; x++ ) { byte gray = (byte)(255*Math.abs(input.data[ indexSrc++ ])/maxAbsValue); storage[indexDst++] = gray; storage[indexDst++] = gray; storage[indexDst++] = gray; storage[indexDst++] = (byte) 0xFF; } } output.copyPixelsFromBuffer(ByteBuffer.wrap(storage)); }
[ "public", "static", "void", "grayMagnitude", "(", "GrayS32", "input", ",", "int", "maxAbsValue", ",", "Bitmap", "output", ",", "byte", "[", "]", "storage", ")", "{", "shapeShape", "(", "input", ",", "output", ")", ";", "if", "(", "storage", "==", "null",...
Renders the image using its gray magnitude @param input (Input) Image image @param maxAbsValue (Input) Largest absolute value of a pixel in the image @param output (Output) Bitmap ARGB_8888 image. @param storage Optional working buffer for Bitmap image.
[ "Renders", "the", "image", "using", "its", "gray", "magnitude" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/src/main/java/boofcv/android/VisualizeImageData.java#L176-L199
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecNodeWithRelationships.java
SpecNodeWithRelationships.addRelationshipToTarget
public void addRelationshipToTarget(final SpecTopic topic, final RelationshipType type) { final TargetRelationship relationship = new TargetRelationship(this, topic, type); topicTargetRelationships.add(relationship); relationships.add(relationship); }
java
public void addRelationshipToTarget(final SpecTopic topic, final RelationshipType type) { final TargetRelationship relationship = new TargetRelationship(this, topic, type); topicTargetRelationships.add(relationship); relationships.add(relationship); }
[ "public", "void", "addRelationshipToTarget", "(", "final", "SpecTopic", "topic", ",", "final", "RelationshipType", "type", ")", "{", "final", "TargetRelationship", "relationship", "=", "new", "TargetRelationship", "(", "this", ",", "topic", ",", "type", ")", ";", ...
Add a relationship to the topic. @param topic The topic that is to be related to. @param type The type of the relationship.
[ "Add", "a", "relationship", "to", "the", "topic", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecNodeWithRelationships.java#L82-L86
cogroo/cogroo4
cogroo-eval/GramEval/src/main/java/cogroo/uima/XmiWriterCasConsumer.java
XmiWriterCasConsumer.writeXmi
private void writeXmi(CAS aCas, File name, String modelFileName) throws IOException, SAXException { FileOutputStream out = null; try { // write XMI out = new FileOutputStream(name); XmiCasSerializer ser = new XmiCasSerializer(aCas.getTypeSystem()); XMLSerializer xmlSer = new XMLSerializer(out, false); ser.serialize(aCas, xmlSer.getContentHandler()); } finally { if (out != null) { out.close(); } } }
java
private void writeXmi(CAS aCas, File name, String modelFileName) throws IOException, SAXException { FileOutputStream out = null; try { // write XMI out = new FileOutputStream(name); XmiCasSerializer ser = new XmiCasSerializer(aCas.getTypeSystem()); XMLSerializer xmlSer = new XMLSerializer(out, false); ser.serialize(aCas, xmlSer.getContentHandler()); } finally { if (out != null) { out.close(); } } }
[ "private", "void", "writeXmi", "(", "CAS", "aCas", ",", "File", "name", ",", "String", "modelFileName", ")", "throws", "IOException", ",", "SAXException", "{", "FileOutputStream", "out", "=", "null", ";", "try", "{", "// write XMI", "out", "=", "new", "FileO...
Serialize a CAS to a file in XMI format @param aCas CAS to serialize @param name output file @throws SAXException @throws Exception @throws ResourceProcessException
[ "Serialize", "a", "CAS", "to", "a", "file", "in", "XMI", "format" ]
train
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-eval/GramEval/src/main/java/cogroo/uima/XmiWriterCasConsumer.java#L147-L162
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ImageClient.java
ImageClient.deprecateImage
@BetaApi public final Operation deprecateImage(String image, DeprecationStatus deprecationStatusResource) { DeprecateImageHttpRequest request = DeprecateImageHttpRequest.newBuilder() .setImage(image) .setDeprecationStatusResource(deprecationStatusResource) .build(); return deprecateImage(request); }
java
@BetaApi public final Operation deprecateImage(String image, DeprecationStatus deprecationStatusResource) { DeprecateImageHttpRequest request = DeprecateImageHttpRequest.newBuilder() .setImage(image) .setDeprecationStatusResource(deprecationStatusResource) .build(); return deprecateImage(request); }
[ "@", "BetaApi", "public", "final", "Operation", "deprecateImage", "(", "String", "image", ",", "DeprecationStatus", "deprecationStatusResource", ")", "{", "DeprecateImageHttpRequest", "request", "=", "DeprecateImageHttpRequest", ".", "newBuilder", "(", ")", ".", "setIma...
Sets the deprecation status of an image. <p>If an empty request body is given, clears the deprecation status instead. <p>Sample code: <pre><code> try (ImageClient imageClient = ImageClient.create()) { ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]"); DeprecationStatus deprecationStatusResource = DeprecationStatus.newBuilder().build(); Operation response = imageClient.deprecateImage(image.toString(), deprecationStatusResource); } </code></pre> @param image Image name. @param deprecationStatusResource Deprecation status for a public resource. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Sets", "the", "deprecation", "status", "of", "an", "image", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ImageClient.java#L302-L311
BlueBrain/bluima
utils/pdf_glyph_mapping/src/main/java/org/xmlcml/pdf2svg/GlyphCorrector.java
GlyphCorrector.codePointConversion
public int codePointConversion(String fontName, int codePoint) { NonStandardFontFamily nonStandardFontFamily = get(fontName); if (nonStandardFontFamily == null) return codePoint; CodePointSet codePointSet = nonStandardFontFamily.getCodePointSet(); if (codePointSet == null) return codePoint; CodePoint decimalCodePoint = codePointSet.getByDecimal(codePoint); if (decimalCodePoint != null) // Fetches the correct unicode point return decimalCodePoint.getUnicodeDecimal(); CodePoint nameCodePoint = codePointSet.getByName(charNameByCodePoint .get(codePoint)); if (nameCodePoint != null) return nameCodePoint.getUnicodeDecimal(); return codePoint; }
java
public int codePointConversion(String fontName, int codePoint) { NonStandardFontFamily nonStandardFontFamily = get(fontName); if (nonStandardFontFamily == null) return codePoint; CodePointSet codePointSet = nonStandardFontFamily.getCodePointSet(); if (codePointSet == null) return codePoint; CodePoint decimalCodePoint = codePointSet.getByDecimal(codePoint); if (decimalCodePoint != null) // Fetches the correct unicode point return decimalCodePoint.getUnicodeDecimal(); CodePoint nameCodePoint = codePointSet.getByName(charNameByCodePoint .get(codePoint)); if (nameCodePoint != null) return nameCodePoint.getUnicodeDecimal(); return codePoint; }
[ "public", "int", "codePointConversion", "(", "String", "fontName", ",", "int", "codePoint", ")", "{", "NonStandardFontFamily", "nonStandardFontFamily", "=", "get", "(", "fontName", ")", ";", "if", "(", "nonStandardFontFamily", "==", "null", ")", "return", "codePoi...
Takes in argument a codepoint. If for the given police the codepoint doesn't correspond to what the font actually displays, the conversion is made. Otherwise, the old codepoint is return. @param fontName name of the font of the character in the pdf @param oldCodePoint unicode point in the original pdf @return
[ "Takes", "in", "argument", "a", "codepoint", ".", "If", "for", "the", "given", "police", "the", "codepoint", "doesn", "t", "correspond", "to", "what", "the", "font", "actually", "displays", "the", "conversion", "is", "made", ".", "Otherwise", "the", "old", ...
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/utils/pdf_glyph_mapping/src/main/java/org/xmlcml/pdf2svg/GlyphCorrector.java#L75-L96
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java
ApiOvhDedicatedCloud.serviceName_allowedNetwork_networkAccessId_PUT
public void serviceName_allowedNetwork_networkAccessId_PUT(String serviceName, Long networkAccessId, OvhAllowedNetwork body) throws IOException { String qPath = "/dedicatedCloud/{serviceName}/allowedNetwork/{networkAccessId}"; StringBuilder sb = path(qPath, serviceName, networkAccessId); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_allowedNetwork_networkAccessId_PUT(String serviceName, Long networkAccessId, OvhAllowedNetwork body) throws IOException { String qPath = "/dedicatedCloud/{serviceName}/allowedNetwork/{networkAccessId}"; StringBuilder sb = path(qPath, serviceName, networkAccessId); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_allowedNetwork_networkAccessId_PUT", "(", "String", "serviceName", ",", "Long", "networkAccessId", ",", "OvhAllowedNetwork", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicatedCloud/{serviceName}/allowedNetwork/{networ...
Alter this object properties REST: PUT /dedicatedCloud/{serviceName}/allowedNetwork/{networkAccessId} @param body [required] New object properties @param serviceName [required] Domain of the service @param networkAccessId [required]
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L322-L326
jnidzwetzki/bitfinex-v2-wss-api-java
src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexSymbols.java
BitfinexSymbols.orderBook
public static BitfinexOrderBookSymbol orderBook(final String currency, final String profitCurrency, final BitfinexOrderBookSymbol.Precision precision, final BitfinexOrderBookSymbol.Frequency frequency, final int pricePoints) { final String currencyNonNull = Objects.requireNonNull(currency).toUpperCase(); final String profitCurrencyNonNull = Objects.requireNonNull(profitCurrency).toUpperCase(); return orderBook(BitfinexCurrencyPair.of(currencyNonNull, profitCurrencyNonNull), precision, frequency, pricePoints); }
java
public static BitfinexOrderBookSymbol orderBook(final String currency, final String profitCurrency, final BitfinexOrderBookSymbol.Precision precision, final BitfinexOrderBookSymbol.Frequency frequency, final int pricePoints) { final String currencyNonNull = Objects.requireNonNull(currency).toUpperCase(); final String profitCurrencyNonNull = Objects.requireNonNull(profitCurrency).toUpperCase(); return orderBook(BitfinexCurrencyPair.of(currencyNonNull, profitCurrencyNonNull), precision, frequency, pricePoints); }
[ "public", "static", "BitfinexOrderBookSymbol", "orderBook", "(", "final", "String", "currency", ",", "final", "String", "profitCurrency", ",", "final", "BitfinexOrderBookSymbol", ".", "Precision", "precision", ",", "final", "BitfinexOrderBookSymbol", ".", "Frequency", "...
Returns symbol for candlestick channel @param currency of order book @param profitCurrency of order book @param precision of order book @param frequency of order book @param pricePoints in initial snapshot @return symbol
[ "Returns", "symbol", "for", "candlestick", "channel" ]
train
https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexSymbols.java#L155-L163
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.doUnpackEntry
private static boolean doUnpackEntry(ZipFile zf, String name, File file) throws IOException { if (log.isTraceEnabled()) { log.trace("Extracting '" + zf.getName() + "' entry '" + name + "' into '" + file + "'."); } ZipEntry ze = zf.getEntry(name); if (ze == null) { return false; // entry not found } if (ze.isDirectory() || zf.getInputStream(ze) == null) { if (file.isDirectory()) { return true; } if (file.exists()) { FileUtils.forceDelete(file); } return file.mkdirs(); } InputStream in = new BufferedInputStream(zf.getInputStream(ze)); try { FileUtils.copy(in, file); } finally { IOUtils.closeQuietly(in); } return true; }
java
private static boolean doUnpackEntry(ZipFile zf, String name, File file) throws IOException { if (log.isTraceEnabled()) { log.trace("Extracting '" + zf.getName() + "' entry '" + name + "' into '" + file + "'."); } ZipEntry ze = zf.getEntry(name); if (ze == null) { return false; // entry not found } if (ze.isDirectory() || zf.getInputStream(ze) == null) { if (file.isDirectory()) { return true; } if (file.exists()) { FileUtils.forceDelete(file); } return file.mkdirs(); } InputStream in = new BufferedInputStream(zf.getInputStream(ze)); try { FileUtils.copy(in, file); } finally { IOUtils.closeQuietly(in); } return true; }
[ "private", "static", "boolean", "doUnpackEntry", "(", "ZipFile", "zf", ",", "String", "name", ",", "File", "file", ")", "throws", "IOException", "{", "if", "(", "log", ".", "isTraceEnabled", "(", ")", ")", "{", "log", ".", "trace", "(", "\"Extracting '\"",...
Unpacks a single file from a ZIP archive to a file. @param zf ZIP file. @param name entry name. @param file target file to be created or overwritten. @return <code>true</code> if the entry was found and unpacked, <code>false</code> if the entry was not found.
[ "Unpacks", "a", "single", "file", "from", "a", "ZIP", "archive", "to", "a", "file", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L389-L417
opencb/biodata
biodata-tools/src/main/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataManager.java
VariantMetadataManager.removeFile
public void removeFile(VariantFileMetadata file, String studyId) { // Sanity check if (file == null) { logger.error("Variant file metadata is null."); return; } removeFile(file.getId(), studyId); }
java
public void removeFile(VariantFileMetadata file, String studyId) { // Sanity check if (file == null) { logger.error("Variant file metadata is null."); return; } removeFile(file.getId(), studyId); }
[ "public", "void", "removeFile", "(", "VariantFileMetadata", "file", ",", "String", "studyId", ")", "{", "// Sanity check", "if", "(", "file", "==", "null", ")", "{", "logger", ".", "error", "(", "\"Variant file metadata is null.\"", ")", ";", "return", ";", "}...
Remove a variant file metadata of a given variant study metadata (from study ID). @param file File @param studyId Study ID
[ "Remove", "a", "variant", "file", "metadata", "of", "a", "given", "variant", "study", "metadata", "(", "from", "study", "ID", ")", "." ]
train
https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataManager.java#L283-L290
menacher/java-game-server
jetclient/src/main/java/org/menacheri/jetclient/util/NettyUtils.java
NettyUtils.readString
public static String readString(ChannelBuffer buffer, Charset charset) { String readString = null; if (null != buffer && buffer.readableBytes() > 2) { int length = buffer.readUnsignedShort(); readString = readString(buffer, length, charset); } return readString; }
java
public static String readString(ChannelBuffer buffer, Charset charset) { String readString = null; if (null != buffer && buffer.readableBytes() > 2) { int length = buffer.readUnsignedShort(); readString = readString(buffer, length, charset); } return readString; }
[ "public", "static", "String", "readString", "(", "ChannelBuffer", "buffer", ",", "Charset", "charset", ")", "{", "String", "readString", "=", "null", ";", "if", "(", "null", "!=", "buffer", "&&", "buffer", ".", "readableBytes", "(", ")", ">", "2", ")", "...
This method will first read an unsigned short to find the length of the string and then read the actual string based on the length. This method will also reset the reader index to end of the string @param buffer The Netty buffer containing at least one unsigned short followed by a string of similar length. @param charset The Charset say 'UTF-8' in which the decoding needs to be done. @return Returns the String or throws {@link IndexOutOfBoundsException} if the length is greater than expected.
[ "This", "method", "will", "first", "read", "an", "unsigned", "short", "to", "find", "the", "length", "of", "the", "string", "and", "then", "read", "the", "actual", "string", "based", "on", "the", "length", ".", "This", "method", "will", "also", "reset", ...
train
https://github.com/menacher/java-game-server/blob/668ca49e8bd1dac43add62378cf6c22a93125d48/jetclient/src/main/java/org/menacheri/jetclient/util/NettyUtils.java#L130-L139
casmi/casmi
src/main/java/casmi/graphics/Graphics.java
Graphics.setDirectionalLight
public void setDirectionalLight(int i, Color color, boolean enableColor, float x, float y, float z) { float directionalColor[] = { (float)color.getRed(), (float)color.getGreen(), (float)color.getBlue(), (float)color.getAlpha() }; float pos[] = { x, y, z, 0 }; gl.glEnable(GL2.GL_LIGHTING); gl.glEnable(GL2.GL_LIGHT0 + i); gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_POSITION, pos, 0); if(enableColor) gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_DIFFUSE, directionalColor, 0); }
java
public void setDirectionalLight(int i, Color color, boolean enableColor, float x, float y, float z) { float directionalColor[] = { (float)color.getRed(), (float)color.getGreen(), (float)color.getBlue(), (float)color.getAlpha() }; float pos[] = { x, y, z, 0 }; gl.glEnable(GL2.GL_LIGHTING); gl.glEnable(GL2.GL_LIGHT0 + i); gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_POSITION, pos, 0); if(enableColor) gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_DIFFUSE, directionalColor, 0); }
[ "public", "void", "setDirectionalLight", "(", "int", "i", ",", "Color", "color", ",", "boolean", "enableColor", ",", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "float", "directionalColor", "[", "]", "=", "{", "(", "float", ")", "colo...
Sets the color value and the position of the No.i directionalLight
[ "Sets", "the", "color", "value", "and", "the", "position", "of", "the", "No", ".", "i", "directionalLight" ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/Graphics.java#L510-L523
unbescape/unbescape
src/main/java/org/unbescape/properties/PropertiesEscape.java
PropertiesEscape.escapePropertiesKey
public static void escapePropertiesKey(final char[] text, final int offset, final int len, final Writer writer) throws IOException { escapePropertiesKey(text, offset, len, writer, PropertiesKeyEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET); }
java
public static void escapePropertiesKey(final char[] text, final int offset, final int len, final Writer writer) throws IOException { escapePropertiesKey(text, offset, len, writer, PropertiesKeyEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET); }
[ "public", "static", "void", "escapePropertiesKey", "(", "final", "char", "[", "]", "text", ",", "final", "int", "offset", ",", "final", "int", "len", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapePropertiesKey", "(", "text", ","...
<p> Perform a Java Properties Key level 2 (basic set and all non-ASCII chars) <strong>escape</strong> operation on a <tt>char[]</tt> input. </p> <p> <em>Level 2</em> means this method will escape: </p> <ul> <li>The Java Properties Key basic escape set: <ul> <li>The <em>Single Escape Characters</em>: <tt>&#92;t</tt> (<tt>U+0009</tt>), <tt>&#92;n</tt> (<tt>U+000A</tt>), <tt>&#92;f</tt> (<tt>U+000C</tt>), <tt>&#92;r</tt> (<tt>U+000D</tt>), <tt>&#92;&nbsp;</tt> (<tt>U+0020</tt>), <tt>&#92;:</tt> (<tt>U+003A</tt>), <tt>&#92;=</tt> (<tt>U+003D</tt>) and <tt>&#92;&#92;</tt> (<tt>U+005C</tt>). </li> <li> Two ranges of non-displayable, control characters (some of which are already part of the <em>single escape characters</em> list): <tt>U+0000</tt> to <tt>U+001F</tt> and <tt>U+007F</tt> to <tt>U+009F</tt>. </li> </ul> </li> <li>All non ASCII characters.</li> </ul> <p> This escape will be performed by using the Single Escape Chars whenever possible. For escaped characters that do not have an associated SEC, default to <tt>&#92;uFFFF</tt> Hexadecimal Escapes. </p> <p> This method calls {@link #escapePropertiesKey(char[], int, int, java.io.Writer, PropertiesKeyEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>level</tt>: {@link PropertiesKeyEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>char[]</tt> to be escaped. @param offset the position in <tt>text</tt> at which the escape operation should start. @param len the number of characters in <tt>text</tt> that should 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
[ "<p", ">", "Perform", "a", "Java", "Properties", "Key", "level", "2", "(", "basic", "set", "and", "all", "non", "-", "ASCII", "chars", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "char", "[]", "<", "/", "...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/properties/PropertiesEscape.java#L1290-L1293
jnidzwetzki/bitfinex-v2-wss-api-java
src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexApiCallbackListeners.java
BitfinexApiCallbackListeners.onExecutedTradeEvent
public Closeable onExecutedTradeEvent(final BiConsumer<BitfinexExecutedTradeSymbol, Collection<BitfinexExecutedTrade>> listener) { executedTradesConsumers.offer(listener); return () -> executedTradesConsumers.remove(listener); }
java
public Closeable onExecutedTradeEvent(final BiConsumer<BitfinexExecutedTradeSymbol, Collection<BitfinexExecutedTrade>> listener) { executedTradesConsumers.offer(listener); return () -> executedTradesConsumers.remove(listener); }
[ "public", "Closeable", "onExecutedTradeEvent", "(", "final", "BiConsumer", "<", "BitfinexExecutedTradeSymbol", ",", "Collection", "<", "BitfinexExecutedTrade", ">", ">", "listener", ")", "{", "executedTradesConsumers", ".", "offer", "(", "listener", ")", ";", "return"...
registers listener for general trades executed within scope of exchange instrument (ie. tBTCUSD) @param listener of event @return hook of this listener
[ "registers", "listener", "for", "general", "trades", "executed", "within", "scope", "of", "exchange", "instrument", "(", "ie", ".", "tBTCUSD", ")" ]
train
https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexApiCallbackListeners.java#L158-L161
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/IOUtils.java
IOUtils.copy
public static void copy(Reader reader, Writer writer, boolean closeStreams) throws IOException { char[] buf = new char[BUFFER_SIZE]; int num = 0; try { while ((num = reader.read(buf, 0, buf.length)) != -1) { writer.write(buf, 0, num); } } finally { if (closeStreams) { close(reader); close(writer); } } }
java
public static void copy(Reader reader, Writer writer, boolean closeStreams) throws IOException { char[] buf = new char[BUFFER_SIZE]; int num = 0; try { while ((num = reader.read(buf, 0, buf.length)) != -1) { writer.write(buf, 0, num); } } finally { if (closeStreams) { close(reader); close(writer); } } }
[ "public", "static", "void", "copy", "(", "Reader", "reader", ",", "Writer", "writer", ",", "boolean", "closeStreams", ")", "throws", "IOException", "{", "char", "[", "]", "buf", "=", "new", "char", "[", "BUFFER_SIZE", "]", ";", "int", "num", "=", "0", ...
Writes all the contents of a Reader to a Writer. @param reader the reader to read from @param writer the writer to write to @param closeStreams the flag indicating if the stream must be close at the end, even if an exception occurs @throws java.io.IOException if an IOExcption occurs
[ "Writes", "all", "the", "contents", "of", "a", "Reader", "to", "a", "Writer", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/IOUtils.java#L59-L73
trellis-ldp-archive/trellis-io-jena
src/main/java/org/trellisldp/io/impl/HtmlData.java
HtmlData.getCss
public List<String> getCss() { return stream(properties.getOrDefault("css", "").split(",")) .map(String::trim).filter(x -> x.length() > 0).collect(toList()); }
java
public List<String> getCss() { return stream(properties.getOrDefault("css", "").split(",")) .map(String::trim).filter(x -> x.length() > 0).collect(toList()); }
[ "public", "List", "<", "String", ">", "getCss", "(", ")", "{", "return", "stream", "(", "properties", ".", "getOrDefault", "(", "\"css\"", ",", "\"\"", ")", ".", "split", "(", "\",\"", ")", ")", ".", "map", "(", "String", "::", "trim", ")", ".", "f...
Get any CSS document URLs @return a list of any CSS documents
[ "Get", "any", "CSS", "document", "URLs" ]
train
https://github.com/trellis-ldp-archive/trellis-io-jena/blob/3a06f8f8e7b6fc83fb659cb61217810f813967e8/src/main/java/org/trellisldp/io/impl/HtmlData.java#L80-L83
EdwardRaff/JSAT
JSAT/src/jsat/math/optimization/WolfeNWLineSearch.java
WolfeNWLineSearch.setC1
public void setC1(double c1) { if(c1 <= 0) throw new IllegalArgumentException("c1 must be greater than 0, not " + c1); else if(c1 >= c2) throw new IllegalArgumentException("c1 must be less than c2"); this.c1 = c1; }
java
public void setC1(double c1) { if(c1 <= 0) throw new IllegalArgumentException("c1 must be greater than 0, not " + c1); else if(c1 >= c2) throw new IllegalArgumentException("c1 must be less than c2"); this.c1 = c1; }
[ "public", "void", "setC1", "(", "double", "c1", ")", "{", "if", "(", "c1", "<=", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"c1 must be greater than 0, not \"", "+", "c1", ")", ";", "else", "if", "(", "c1", ">=", "c2", ")", "throw", "ne...
Sets the constant used for the <i>sufficient decrease condition</i> f(x+&alpha; p) &le; f(x) + c<sub>1</sub> &alpha; p<sup>T</sup>&nabla;f(x) <br> <br> This value must always be less than {@link #setC2(double) } @param c1 the <i>sufficient decrease condition</i>
[ "Sets", "the", "constant", "used", "for", "the", "<i", ">", "sufficient", "decrease", "condition<", "/", "i", ">", "f", "(", "x", "+", "&alpha", ";", "p", ")", "&le", ";", "f", "(", "x", ")", "+", "c<sub", ">", "1<", "/", "sub", ">", "&alpha", ...
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/optimization/WolfeNWLineSearch.java#L66-L73
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/kml/KMLGeometry.java
KMLGeometry.toKMLPoint
public static void toKMLPoint(Point point, ExtrudeMode extrude, int altitudeModeEnum, StringBuilder sb) { sb.append("<Point>"); appendExtrude(extrude, sb); appendAltitudeMode(altitudeModeEnum, sb); sb.append("<coordinates>"); Coordinate coord = point.getCoordinate(); sb.append(coord.x).append(",").append(coord.y); if (!Double.isNaN(coord.z)) { sb.append(",").append(coord.z); } sb.append("</coordinates>").append("</Point>"); }
java
public static void toKMLPoint(Point point, ExtrudeMode extrude, int altitudeModeEnum, StringBuilder sb) { sb.append("<Point>"); appendExtrude(extrude, sb); appendAltitudeMode(altitudeModeEnum, sb); sb.append("<coordinates>"); Coordinate coord = point.getCoordinate(); sb.append(coord.x).append(",").append(coord.y); if (!Double.isNaN(coord.z)) { sb.append(",").append(coord.z); } sb.append("</coordinates>").append("</Point>"); }
[ "public", "static", "void", "toKMLPoint", "(", "Point", "point", ",", "ExtrudeMode", "extrude", ",", "int", "altitudeModeEnum", ",", "StringBuilder", "sb", ")", "{", "sb", ".", "append", "(", "\"<Point>\"", ")", ";", "appendExtrude", "(", "extrude", ",", "sb...
A geographic location defined by longitude, latitude, and (optional) altitude. Syntax : <Point id="ID"> <!-- specific to Point --> <extrude>0</extrude> <!-- boolean --> <altitudeMode>clampToGround</altitudeMode> <!-- kml:altitudeModeEnum: clampToGround, relativeToGround, or absolute --> <!-- or, substitute gx:altitudeMode: clampToSeaFloor, relativeToSeaFloor --> <coordinates>...</coordinates> <!-- lon,lat[,alt] --> </Point> Supported syntax : <Point> <extrude>0</extrude> <altitudeMode>clampToGround</altitudeMode> <coordinates>...</coordinates> <!-- lon,lat[,alt] --> </Point> @param point @param extrude @param altitudeModeEnum
[ "A", "geographic", "location", "defined", "by", "longitude", "latitude", "and", "(", "optional", ")", "altitude", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/kml/KMLGeometry.java#L98-L109
alkacon/opencms-core
src/org/opencms/ui/apps/git/CmsGitCheckin.java
CmsGitCheckin.zipRfsFolder
public static void zipRfsFolder(final File root, final OutputStream zipOutput) throws Exception { final ZipOutputStream zip = new ZipOutputStream(zipOutput); try { CmsFileUtil.walkFileSystem(root, new Closure() { @SuppressWarnings("resource") public void execute(Object stateObj) { try { FileWalkState state = (FileWalkState)stateObj; for (File file : state.getFiles()) { String relativePath = Paths.get(root.getAbsolutePath()).relativize( Paths.get(file.getAbsolutePath())).toString(); ZipEntry entry = new ZipEntry(relativePath); entry.setTime(file.lastModified()); zip.putNextEntry(entry); zip.write(CmsFileUtil.readFully(new FileInputStream(file))); zip.closeEntry(); } } catch (Exception e) { throw new RuntimeException(e); } } }); } catch (RuntimeException e) { if (e.getCause() instanceof Exception) { throw (Exception)(e.getCause()); } else { throw e; } } zip.flush(); zip.close(); }
java
public static void zipRfsFolder(final File root, final OutputStream zipOutput) throws Exception { final ZipOutputStream zip = new ZipOutputStream(zipOutput); try { CmsFileUtil.walkFileSystem(root, new Closure() { @SuppressWarnings("resource") public void execute(Object stateObj) { try { FileWalkState state = (FileWalkState)stateObj; for (File file : state.getFiles()) { String relativePath = Paths.get(root.getAbsolutePath()).relativize( Paths.get(file.getAbsolutePath())).toString(); ZipEntry entry = new ZipEntry(relativePath); entry.setTime(file.lastModified()); zip.putNextEntry(entry); zip.write(CmsFileUtil.readFully(new FileInputStream(file))); zip.closeEntry(); } } catch (Exception e) { throw new RuntimeException(e); } } }); } catch (RuntimeException e) { if (e.getCause() instanceof Exception) { throw (Exception)(e.getCause()); } else { throw e; } } zip.flush(); zip.close(); }
[ "public", "static", "void", "zipRfsFolder", "(", "final", "File", "root", ",", "final", "OutputStream", "zipOutput", ")", "throws", "Exception", "{", "final", "ZipOutputStream", "zip", "=", "new", "ZipOutputStream", "(", "zipOutput", ")", ";", "try", "{", "Cms...
Creates ZIP file data from the files / subfolders of the given root folder, and sends it to the given stream.<p> The stream passed as an argument is closed after the data is written. @param root the folder to zip @param zipOutput the output stream which the zip file data should be written to @throws Exception if something goes wrong
[ "Creates", "ZIP", "file", "data", "from", "the", "files", "/", "subfolders", "of", "the", "given", "root", "folder", "and", "sends", "it", "to", "the", "given", "stream", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/git/CmsGitCheckin.java#L175-L212
dain/leveldb
leveldb/src/main/java/org/iq80/leveldb/impl/LogReader.java
LogReader.reportCorruption
private void reportCorruption(long bytes, String reason) { if (monitor != null) { monitor.corruption(bytes, reason); } }
java
private void reportCorruption(long bytes, String reason) { if (monitor != null) { monitor.corruption(bytes, reason); } }
[ "private", "void", "reportCorruption", "(", "long", "bytes", ",", "String", "reason", ")", "{", "if", "(", "monitor", "!=", "null", ")", "{", "monitor", ".", "corruption", "(", "bytes", ",", "reason", ")", ";", "}", "}" ]
Reports corruption to the monitor. The buffer must be updated to remove the dropped bytes prior to invocation.
[ "Reports", "corruption", "to", "the", "monitor", ".", "The", "buffer", "must", "be", "updated", "to", "remove", "the", "dropped", "bytes", "prior", "to", "invocation", "." ]
train
https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/impl/LogReader.java#L337-L342
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/reflect/ReflectionUtils.java
ReflectionUtils.getValue
public static <T> T getValue(Object target, Field field, Class<T> type) { try { boolean currentAccessible = field.isAccessible(); field.setAccessible(true); Object value = field.get(target); field.setAccessible(currentAccessible); return type.cast(value); } catch (NullPointerException e) { throw e; } catch (Exception e) { throw new FieldAccessException(String.format("Failed to get value of field (%1$s) from %2$s type (%3$s)!", field.getName(), BooleanUtils.toString(target == null, "class", "object of"), getClassName(target)), e); } }
java
public static <T> T getValue(Object target, Field field, Class<T> type) { try { boolean currentAccessible = field.isAccessible(); field.setAccessible(true); Object value = field.get(target); field.setAccessible(currentAccessible); return type.cast(value); } catch (NullPointerException e) { throw e; } catch (Exception e) { throw new FieldAccessException(String.format("Failed to get value of field (%1$s) from %2$s type (%3$s)!", field.getName(), BooleanUtils.toString(target == null, "class", "object of"), getClassName(target)), e); } }
[ "public", "static", "<", "T", ">", "T", "getValue", "(", "Object", "target", ",", "Field", "field", ",", "Class", "<", "T", ">", "type", ")", "{", "try", "{", "boolean", "currentAccessible", "=", "field", ".", "isAccessible", "(", ")", ";", "field", ...
Gets the value of the field on the given object cast to the desired class type. If the "target" object is null, then this method assumes the field is a static (class) member field; otherwise the field is considered an instance (object) member field. This method is not null-safe! @param <T> the desired return type in which the field's value will be cast; should be compatible with the field's declared type. @param target the Object on which the field is defined. @param field the specified Field from which to get the value. @param type the desired return type of the field's value; should be compatible with the field's declared type. @return the value of the given field on the given object cast to the desired type. @throws FieldAccessException if the value for the specified field could not be retrieved. @throws NullPointerException if the field or type parameter arguments are null.
[ "Gets", "the", "value", "of", "the", "field", "on", "the", "given", "object", "cast", "to", "the", "desired", "class", "type", ".", "If", "the", "target", "object", "is", "null", "then", "this", "method", "assumes", "the", "field", "is", "a", "static", ...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/reflect/ReflectionUtils.java#L151-L166
apache/spark
common/network-common/src/main/java/org/apache/spark/network/client/TransportClient.java
TransportClient.sendRpc
public long sendRpc(ByteBuffer message, RpcResponseCallback callback) { if (logger.isTraceEnabled()) { logger.trace("Sending RPC to {}", getRemoteAddress(channel)); } long requestId = requestId(); handler.addRpcRequest(requestId, callback); RpcChannelListener listener = new RpcChannelListener(requestId, callback); channel.writeAndFlush(new RpcRequest(requestId, new NioManagedBuffer(message))) .addListener(listener); return requestId; }
java
public long sendRpc(ByteBuffer message, RpcResponseCallback callback) { if (logger.isTraceEnabled()) { logger.trace("Sending RPC to {}", getRemoteAddress(channel)); } long requestId = requestId(); handler.addRpcRequest(requestId, callback); RpcChannelListener listener = new RpcChannelListener(requestId, callback); channel.writeAndFlush(new RpcRequest(requestId, new NioManagedBuffer(message))) .addListener(listener); return requestId; }
[ "public", "long", "sendRpc", "(", "ByteBuffer", "message", ",", "RpcResponseCallback", "callback", ")", "{", "if", "(", "logger", ".", "isTraceEnabled", "(", ")", ")", "{", "logger", ".", "trace", "(", "\"Sending RPC to {}\"", ",", "getRemoteAddress", "(", "ch...
Sends an opaque message to the RpcHandler on the server-side. The callback will be invoked with the server's response or upon any failure. @param message The message to send. @param callback Callback to handle the RPC's reply. @return The RPC's id.
[ "Sends", "an", "opaque", "message", "to", "the", "RpcHandler", "on", "the", "server", "-", "side", ".", "The", "callback", "will", "be", "invoked", "with", "the", "server", "s", "response", "or", "upon", "any", "failure", "." ]
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/client/TransportClient.java#L187-L200
ist-dresden/composum
sling/core/commons/src/main/java/com/composum/sling/clientlibs/handle/ClientlibResourceFolder.java
ClientlibResourceFolder.getChildren
public List<ClientlibElement> getChildren() { List<ClientlibElement> children = new ArrayList<>(); for (Resource child : resource.getChildren()) { if (isFile(child)) children.add(new ClientlibFile(null, type, child, getAdditionalProperties())); else children.add(new ClientlibResourceFolder(type, child, this)); } return children; }
java
public List<ClientlibElement> getChildren() { List<ClientlibElement> children = new ArrayList<>(); for (Resource child : resource.getChildren()) { if (isFile(child)) children.add(new ClientlibFile(null, type, child, getAdditionalProperties())); else children.add(new ClientlibResourceFolder(type, child, this)); } return children; }
[ "public", "List", "<", "ClientlibElement", ">", "getChildren", "(", ")", "{", "List", "<", "ClientlibElement", ">", "children", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Resource", "child", ":", "resource", ".", "getChildren", "(", ")", ...
Returns all children - either {@link ClientlibResourceFolder} as well, or {@link ClientlibFile} .
[ "Returns", "all", "children", "-", "either", "{" ]
train
https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/clientlibs/handle/ClientlibResourceFolder.java#L104-L111
bechte/junit-hierarchicalcontextrunner
src/main/java/de/bechte/junit/runners/context/statements/StatementExecutor.java
StatementExecutor.whenInitializationErrorIsRaised
protected void whenInitializationErrorIsRaised(final EachTestNotifier notifier, final InitializationError e) { notifier.addFailure(new MultipleFailureException(e.getCauses())); }
java
protected void whenInitializationErrorIsRaised(final EachTestNotifier notifier, final InitializationError e) { notifier.addFailure(new MultipleFailureException(e.getCauses())); }
[ "protected", "void", "whenInitializationErrorIsRaised", "(", "final", "EachTestNotifier", "notifier", ",", "final", "InitializationError", "e", ")", "{", "notifier", ".", "addFailure", "(", "new", "MultipleFailureException", "(", "e", ".", "getCauses", "(", ")", ")"...
Clients may override this method to add additional behavior when a {@link InitializationError} is raised. The call of this method is guaranteed. @param notifier the notifier @param e the error
[ "Clients", "may", "override", "this", "method", "to", "add", "additional", "behavior", "when", "a", "{", "@link", "InitializationError", "}", "is", "raised", ".", "The", "call", "of", "this", "method", "is", "guaranteed", "." ]
train
https://github.com/bechte/junit-hierarchicalcontextrunner/blob/c11bb846613a3db730ec2dd812e16cd2aaefc924/src/main/java/de/bechte/junit/runners/context/statements/StatementExecutor.java#L56-L58
lucee/Lucee
core/src/main/java/lucee/commons/io/FileUtil.java
FileUtil.toFile
public static File toFile(String parent, String path) { return new File(parent.replace(FILE_ANTI_SEPERATOR, FILE_SEPERATOR), path.replace(FILE_ANTI_SEPERATOR, FILE_SEPERATOR)); }
java
public static File toFile(String parent, String path) { return new File(parent.replace(FILE_ANTI_SEPERATOR, FILE_SEPERATOR), path.replace(FILE_ANTI_SEPERATOR, FILE_SEPERATOR)); }
[ "public", "static", "File", "toFile", "(", "String", "parent", ",", "String", "path", ")", "{", "return", "new", "File", "(", "parent", ".", "replace", "(", "FILE_ANTI_SEPERATOR", ",", "FILE_SEPERATOR", ")", ",", "path", ".", "replace", "(", "FILE_ANTI_SEPER...
create a File from parent file and string @param parent @param path @return new File Object
[ "create", "a", "File", "from", "parent", "file", "and", "string" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/FileUtil.java#L89-L91