repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
messagebird/java-rest-api
api/src/main/java/com/messagebird/MessageBirdClient.java
MessageBirdClient.listConversations
public ConversationList listConversations(final int offset, final int limit) throws UnauthorizedException, GeneralException { String url = CONVERSATIONS_BASE_URL + CONVERSATION_PATH; return messageBirdService.requestList(url, offset, limit, ConversationList.class); }
java
public ConversationList listConversations(final int offset, final int limit) throws UnauthorizedException, GeneralException { String url = CONVERSATIONS_BASE_URL + CONVERSATION_PATH; return messageBirdService.requestList(url, offset, limit, ConversationList.class); }
[ "public", "ConversationList", "listConversations", "(", "final", "int", "offset", ",", "final", "int", "limit", ")", "throws", "UnauthorizedException", ",", "GeneralException", "{", "String", "url", "=", "CONVERSATIONS_BASE_URL", "+", "CONVERSATION_PATH", ";", "return...
Gets a Conversation listing with specified pagination options. @param offset Number of objects to skip. @param limit Number of objects to take. @return List of conversations.
[ "Gets", "a", "Conversation", "listing", "with", "specified", "pagination", "options", "." ]
train
https://github.com/messagebird/java-rest-api/blob/f92cd93afff413e6dc12aa6e41e69f26cbae8941/api/src/main/java/com/messagebird/MessageBirdClient.java#L740-L744
roboconf/roboconf-platform
miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/autocompletion/CompletionUtils.java
CompletionUtils.findGraphFilesToImport
public static Set<String> findGraphFilesToImport( File appDirectory, File editedFile, String fileContent ) { File graphDir = new File( appDirectory, Constants.PROJECT_DIR_GRAPH ); return findFilesToImport( graphDir, Constants.FILE_EXT_GRAPH, editedFile, fileContent ); }
java
public static Set<String> findGraphFilesToImport( File appDirectory, File editedFile, String fileContent ) { File graphDir = new File( appDirectory, Constants.PROJECT_DIR_GRAPH ); return findFilesToImport( graphDir, Constants.FILE_EXT_GRAPH, editedFile, fileContent ); }
[ "public", "static", "Set", "<", "String", ">", "findGraphFilesToImport", "(", "File", "appDirectory", ",", "File", "editedFile", ",", "String", "fileContent", ")", "{", "File", "graphDir", "=", "new", "File", "(", "appDirectory", ",", "Constants", ".", "PROJEC...
Finds all the graph files that can be imported. @param appDirectory the application's directory @param editedFile the graph file that is being edited @param fileContent the file content (not null) @return a non-null set of (relative) file paths
[ "Finds", "all", "the", "graph", "files", "that", "can", "be", "imported", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/autocompletion/CompletionUtils.java#L76-L80
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java
MapUtils.buildClickLatLngBoundingBox
public static LatLngBoundingBox buildClickLatLngBoundingBox(LatLng latLng, View view, GoogleMap map, float screenClickPercentage) { // Get the screen width and height a click occurs from a feature int width = (int) Math.round(view.getWidth() * screenClickPercentage); int height = (int) Math.round(view.getHeight() * screenClickPercentage); // Get the screen click location Projection projection = map.getProjection(); android.graphics.Point clickLocation = projection.toScreenLocation(latLng); // Get the screen click locations in each width or height direction android.graphics.Point left = new android.graphics.Point(clickLocation); android.graphics.Point up = new android.graphics.Point(clickLocation); android.graphics.Point right = new android.graphics.Point(clickLocation); android.graphics.Point down = new android.graphics.Point(clickLocation); left.offset(-width, 0); up.offset(0, -height); right.offset(width, 0); down.offset(0, height); // Get the coordinates of the bounding box points LatLng leftCoordinate = projection.fromScreenLocation(left); LatLng upCoordinate = projection.fromScreenLocation(up); LatLng rightCoordinate = projection.fromScreenLocation(right); LatLng downCoordinate = projection.fromScreenLocation(down); LatLngBoundingBox latLngBoundingBox = new LatLngBoundingBox(leftCoordinate, upCoordinate, rightCoordinate, downCoordinate); return latLngBoundingBox; }
java
public static LatLngBoundingBox buildClickLatLngBoundingBox(LatLng latLng, View view, GoogleMap map, float screenClickPercentage) { // Get the screen width and height a click occurs from a feature int width = (int) Math.round(view.getWidth() * screenClickPercentage); int height = (int) Math.round(view.getHeight() * screenClickPercentage); // Get the screen click location Projection projection = map.getProjection(); android.graphics.Point clickLocation = projection.toScreenLocation(latLng); // Get the screen click locations in each width or height direction android.graphics.Point left = new android.graphics.Point(clickLocation); android.graphics.Point up = new android.graphics.Point(clickLocation); android.graphics.Point right = new android.graphics.Point(clickLocation); android.graphics.Point down = new android.graphics.Point(clickLocation); left.offset(-width, 0); up.offset(0, -height); right.offset(width, 0); down.offset(0, height); // Get the coordinates of the bounding box points LatLng leftCoordinate = projection.fromScreenLocation(left); LatLng upCoordinate = projection.fromScreenLocation(up); LatLng rightCoordinate = projection.fromScreenLocation(right); LatLng downCoordinate = projection.fromScreenLocation(down); LatLngBoundingBox latLngBoundingBox = new LatLngBoundingBox(leftCoordinate, upCoordinate, rightCoordinate, downCoordinate); return latLngBoundingBox; }
[ "public", "static", "LatLngBoundingBox", "buildClickLatLngBoundingBox", "(", "LatLng", "latLng", ",", "View", "view", ",", "GoogleMap", "map", ",", "float", "screenClickPercentage", ")", "{", "// Get the screen width and height a click occurs from a feature", "int", "width", ...
Build a lat lng bounding box using the click location, map view, map, and screen percentage tolerance. The bounding box can be used to query for features that were clicked @param latLng click location @param view map view @param map map @param screenClickPercentage screen click percentage between 0.0 and 1.0 for how close a feature on the screen must be to be included in a click query @return lat lng bounding box
[ "Build", "a", "lat", "lng", "bounding", "box", "using", "the", "click", "location", "map", "view", "map", "and", "screen", "percentage", "tolerance", ".", "The", "bounding", "box", "can", "be", "used", "to", "query", "for", "features", "that", "were", "cli...
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java#L185-L214
googleads/googleads-java-lib
examples/admanager_axis/src/main/java/admanager/axis/v201808/workflowrequestservice/GetWorkflowApprovalRequests.java
GetWorkflowApprovalRequests.runExample
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { WorkflowRequestServiceInterface workflowRequestService = adManagerServices.get(session, WorkflowRequestServiceInterface.class); // Create a statement to select workflow requests. StatementBuilder statementBuilder = new StatementBuilder() .where("type = :type") .orderBy("id ASC") .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT) .withBindVariableValue("type", WorkflowRequestType.WORKFLOW_APPROVAL_REQUEST.toString()); // Retrieve a small amount of workflow requests at a time, paging through // until all workflow requests have been retrieved. int totalResultSetSize = 0; do { WorkflowRequestPage page = workflowRequestService.getWorkflowRequestsByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { // Print out some information for each workflow request. totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (WorkflowRequest workflowRequest : page.getResults()) { System.out.printf( "%d) Workflow request with ID %d, entity type '%s', and entity ID %d was found.%n", i++, workflowRequest.getId(), workflowRequest.getEntityType(), workflowRequest.getEntityId() ); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); }
java
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { WorkflowRequestServiceInterface workflowRequestService = adManagerServices.get(session, WorkflowRequestServiceInterface.class); // Create a statement to select workflow requests. StatementBuilder statementBuilder = new StatementBuilder() .where("type = :type") .orderBy("id ASC") .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT) .withBindVariableValue("type", WorkflowRequestType.WORKFLOW_APPROVAL_REQUEST.toString()); // Retrieve a small amount of workflow requests at a time, paging through // until all workflow requests have been retrieved. int totalResultSetSize = 0; do { WorkflowRequestPage page = workflowRequestService.getWorkflowRequestsByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { // Print out some information for each workflow request. totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (WorkflowRequest workflowRequest : page.getResults()) { System.out.printf( "%d) Workflow request with ID %d, entity type '%s', and entity ID %d was found.%n", i++, workflowRequest.getId(), workflowRequest.getEntityType(), workflowRequest.getEntityId() ); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); }
[ "public", "static", "void", "runExample", "(", "AdManagerServices", "adManagerServices", ",", "AdManagerSession", "session", ")", "throws", "RemoteException", "{", "WorkflowRequestServiceInterface", "workflowRequestService", "=", "adManagerServices", ".", "get", "(", "sessi...
Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors.
[ "Runs", "the", "example", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201808/workflowrequestservice/GetWorkflowApprovalRequests.java#L53-L91
netty/netty
common/src/main/java/io/netty/util/internal/ThreadExecutorMap.java
ThreadExecutorMap.apply
public static Runnable apply(final Runnable command, final EventExecutor eventExecutor) { ObjectUtil.checkNotNull(command, "command"); ObjectUtil.checkNotNull(eventExecutor, "eventExecutor"); return new Runnable() { @Override public void run() { setCurrentEventExecutor(eventExecutor); try { command.run(); } finally { setCurrentEventExecutor(null); } } }; }
java
public static Runnable apply(final Runnable command, final EventExecutor eventExecutor) { ObjectUtil.checkNotNull(command, "command"); ObjectUtil.checkNotNull(eventExecutor, "eventExecutor"); return new Runnable() { @Override public void run() { setCurrentEventExecutor(eventExecutor); try { command.run(); } finally { setCurrentEventExecutor(null); } } }; }
[ "public", "static", "Runnable", "apply", "(", "final", "Runnable", "command", ",", "final", "EventExecutor", "eventExecutor", ")", "{", "ObjectUtil", ".", "checkNotNull", "(", "command", ",", "\"command\"", ")", ";", "ObjectUtil", ".", "checkNotNull", "(", "even...
Decorate the given {@link Runnable} and ensure {@link #currentExecutor()} will return {@code eventExecutor} when called from within the {@link Runnable} during execution.
[ "Decorate", "the", "given", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/ThreadExecutorMap.java#L66-L80
threerings/narya
core/src/main/java/com/threerings/crowd/chat/server/ChatChannelManager.java
ChatChannelManager.collectChatHistory
@AnyThread public void collectChatHistory (final Name user, final ResultListener<ChatHistoryResult> lner) { _peerMan.invokeNodeRequest(new NodeRequest() { public boolean isApplicable (NodeObject nodeobj) { return true; // poll all nodes } @Override protected void execute (InvocationService.ResultListener listener) { // find all the UserMessages for the given user and send them back listener.requestProcessed(Lists.newArrayList(Iterables.filter( _chatHistory.get(user), IS_USER_MESSAGE))); } @Inject protected transient ChatHistory _chatHistory; }, new NodeRequestsListener<List<ChatHistory.Entry>>() { public void requestsProcessed (NodeRequestsResult<List<ChatHistory.Entry>> rRes) { ChatHistoryResult chRes = new ChatHistoryResult(); chRes.failedNodes = rRes.getNodeErrors().keySet(); chRes.history = Lists.newArrayList( Iterables.concat(rRes.getNodeResults().values())); Collections.sort(chRes.history, SORT_BY_TIMESTAMP); lner.requestCompleted(chRes); } public void requestFailed (String cause) { lner.requestFailed(new InvocationException(cause)); } }); }
java
@AnyThread public void collectChatHistory (final Name user, final ResultListener<ChatHistoryResult> lner) { _peerMan.invokeNodeRequest(new NodeRequest() { public boolean isApplicable (NodeObject nodeobj) { return true; // poll all nodes } @Override protected void execute (InvocationService.ResultListener listener) { // find all the UserMessages for the given user and send them back listener.requestProcessed(Lists.newArrayList(Iterables.filter( _chatHistory.get(user), IS_USER_MESSAGE))); } @Inject protected transient ChatHistory _chatHistory; }, new NodeRequestsListener<List<ChatHistory.Entry>>() { public void requestsProcessed (NodeRequestsResult<List<ChatHistory.Entry>> rRes) { ChatHistoryResult chRes = new ChatHistoryResult(); chRes.failedNodes = rRes.getNodeErrors().keySet(); chRes.history = Lists.newArrayList( Iterables.concat(rRes.getNodeResults().values())); Collections.sort(chRes.history, SORT_BY_TIMESTAMP); lner.requestCompleted(chRes); } public void requestFailed (String cause) { lner.requestFailed(new InvocationException(cause)); } }); }
[ "@", "AnyThread", "public", "void", "collectChatHistory", "(", "final", "Name", "user", ",", "final", "ResultListener", "<", "ChatHistoryResult", ">", "lner", ")", "{", "_peerMan", ".", "invokeNodeRequest", "(", "new", "NodeRequest", "(", ")", "{", "public", "...
Collects all chat messages heard by the given user on all peers.
[ "Collects", "all", "chat", "messages", "heard", "by", "the", "given", "user", "on", "all", "peers", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/chat/server/ChatChannelManager.java#L133-L159
openbase/jul
exception/src/main/java/org/openbase/jul/exception/StackTracePrinter.java
StackTracePrinter.printStackTrace
public static void printStackTrace(final StackTraceElement[] stackTraces, final Logger logger, final LogLevel logLevel) { printStackTrace(null, stackTraces, logger, logLevel); }
java
public static void printStackTrace(final StackTraceElement[] stackTraces, final Logger logger, final LogLevel logLevel) { printStackTrace(null, stackTraces, logger, logLevel); }
[ "public", "static", "void", "printStackTrace", "(", "final", "StackTraceElement", "[", "]", "stackTraces", ",", "final", "Logger", "logger", ",", "final", "LogLevel", "logLevel", ")", "{", "printStackTrace", "(", "null", ",", "stackTraces", ",", "logger", ",", ...
Method prints the given stack trace in a human readable way. @param stackTraces the stack trace to print. @param logger the logger used for printing. @param logLevel the log level used for logging the stack trace.
[ "Method", "prints", "the", "given", "stack", "trace", "in", "a", "human", "readable", "way", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/exception/src/main/java/org/openbase/jul/exception/StackTracePrinter.java#L77-L79
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithPath.java
PactDslRequestWithPath.matchQuery
public PactDslRequestWithPath matchQuery(String parameter, String regex, List<String> example) { requestMatchers.addCategory("query").addRule(parameter, new RegexMatcher(regex)); query.put(parameter, example); return this; }
java
public PactDslRequestWithPath matchQuery(String parameter, String regex, List<String> example) { requestMatchers.addCategory("query").addRule(parameter, new RegexMatcher(regex)); query.put(parameter, example); return this; }
[ "public", "PactDslRequestWithPath", "matchQuery", "(", "String", "parameter", ",", "String", "regex", ",", "List", "<", "String", ">", "example", ")", "{", "requestMatchers", ".", "addCategory", "(", "\"query\"", ")", ".", "addRule", "(", "parameter", ",", "ne...
Match a repeating query parameter with a regex. @param parameter Query parameter @param regex Regular expression to match with each element @param example Example value list to use for the query parameter (unencoded)
[ "Match", "a", "repeating", "query", "parameter", "with", "a", "regex", "." ]
train
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithPath.java#L389-L393
Azure/azure-sdk-for-java
containerinstance/resource-manager/v2017_12_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2017_12_01_preview/implementation/ContainerLogsInner.java
ContainerLogsInner.list
public LogsInner list(String resourceGroupName, String containerGroupName, String containerName) { return listWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName).toBlocking().single().body(); }
java
public LogsInner list(String resourceGroupName, String containerGroupName, String containerName) { return listWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName).toBlocking().single().body(); }
[ "public", "LogsInner", "list", "(", "String", "resourceGroupName", ",", "String", "containerGroupName", ",", "String", "containerName", ")", "{", "return", "listWithServiceResponseAsync", "(", "resourceGroupName", ",", "containerGroupName", ",", "containerName", ")", "....
Get the logs for a specified container instance. Get the logs for a specified container instance in a specified resource group and container group. @param resourceGroupName The name of the resource group. @param containerGroupName The name of the container group. @param containerName The name of the container instance. @throws IllegalArgumentException thrown if parameters fail the validation @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 LogsInner object if successful.
[ "Get", "the", "logs", "for", "a", "specified", "container", "instance", ".", "Get", "the", "logs", "for", "a", "specified", "container", "instance", "in", "a", "specified", "resource", "group", "and", "container", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerinstance/resource-manager/v2017_12_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2017_12_01_preview/implementation/ContainerLogsInner.java#L72-L74
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/io/IOUtils.java
IOUtils.writeStringToTempFile
public static File writeStringToTempFile(String contents, String path, String encoding) throws IOException { OutputStream writer = null; File tmp = File.createTempFile(path,".tmp"); if (path.endsWith(".gz")) { writer = new GZIPOutputStream(new FileOutputStream(tmp)); } else { writer = new BufferedOutputStream(new FileOutputStream(tmp)); } writer.write(contents.getBytes(encoding)); writer.close(); return tmp; }
java
public static File writeStringToTempFile(String contents, String path, String encoding) throws IOException { OutputStream writer = null; File tmp = File.createTempFile(path,".tmp"); if (path.endsWith(".gz")) { writer = new GZIPOutputStream(new FileOutputStream(tmp)); } else { writer = new BufferedOutputStream(new FileOutputStream(tmp)); } writer.write(contents.getBytes(encoding)); writer.close(); return tmp; }
[ "public", "static", "File", "writeStringToTempFile", "(", "String", "contents", ",", "String", "path", ",", "String", "encoding", ")", "throws", "IOException", "{", "OutputStream", "writer", "=", "null", ";", "File", "tmp", "=", "File", ".", "createTempFile", ...
Writes a string to a temporary file @param contents The string to write @param path The file path @param encoding The encoding to encode in @throws IOException In case of failure
[ "Writes", "a", "string", "to", "a", "temporary", "file" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/io/IOUtils.java#L224-L235
leadware/jpersistence-tools
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/impl/JPAGenericDAORulesBasedImpl.java
JPAGenericDAORulesBasedImpl.addQueryParameters
protected void addQueryParameters(Query query, Map<String, Object> parameters) { // Si la MAP est nulle if(parameters == null || parameters.size() == 0) return; // Parcours for(Entry<String, Object> entry : parameters.entrySet()) { // Ajout query.setParameter(entry.getKey(), entry.getValue()); } }
java
protected void addQueryParameters(Query query, Map<String, Object> parameters) { // Si la MAP est nulle if(parameters == null || parameters.size() == 0) return; // Parcours for(Entry<String, Object> entry : parameters.entrySet()) { // Ajout query.setParameter(entry.getKey(), entry.getValue()); } }
[ "protected", "void", "addQueryParameters", "(", "Query", "query", ",", "Map", "<", "String", ",", "Object", ">", "parameters", ")", "{", "// Si la MAP est nulle\r", "if", "(", "parameters", "==", "null", "||", "parameters", ".", "size", "(", ")", "==", "0", ...
Méthode d'ajout de parametres à la requete @param query Requete @param parameters Map des parametres
[ "Méthode", "d", "ajout", "de", "parametres", "à", "la", "requete" ]
train
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/impl/JPAGenericDAORulesBasedImpl.java#L655-L666
apereo/cas
core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/actions/AuthenticationExceptionHandlerAction.java
AuthenticationExceptionHandlerAction.handleAbstractTicketException
protected String handleAbstractTicketException(final AbstractTicketException e, final RequestContext requestContext) { val messageContext = requestContext.getMessageContext(); val match = this.errors.stream() .filter(c -> c.isInstance(e)).map(Class::getSimpleName) .findFirst(); match.ifPresent(s -> messageContext.addMessage(new MessageBuilder().error().code(e.getCode()).build())); return match.orElse(UNKNOWN); }
java
protected String handleAbstractTicketException(final AbstractTicketException e, final RequestContext requestContext) { val messageContext = requestContext.getMessageContext(); val match = this.errors.stream() .filter(c -> c.isInstance(e)).map(Class::getSimpleName) .findFirst(); match.ifPresent(s -> messageContext.addMessage(new MessageBuilder().error().code(e.getCode()).build())); return match.orElse(UNKNOWN); }
[ "protected", "String", "handleAbstractTicketException", "(", "final", "AbstractTicketException", "e", ",", "final", "RequestContext", "requestContext", ")", "{", "val", "messageContext", "=", "requestContext", ".", "getMessageContext", "(", ")", ";", "val", "match", "...
Maps an {@link AbstractTicketException} onto a state name equal to the simple class name of the exception with highest precedence. Also sets an ERROR severity message in the message context with the error code found in {@link AbstractTicketException#getCode()}. If no match is found, {@value #UNKNOWN} is returned. @param e Ticket exception to handle. @param requestContext the spring context @return Name of next flow state to transition to or {@value #UNKNOWN}
[ "Maps", "an", "{", "@link", "AbstractTicketException", "}", "onto", "a", "state", "name", "equal", "to", "the", "simple", "class", "name", "of", "the", "exception", "with", "highest", "precedence", ".", "Also", "sets", "an", "ERROR", "severity", "message", "...
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/actions/AuthenticationExceptionHandlerAction.java#L137-L145
google/closure-compiler
src/com/google/javascript/jscomp/graph/FixedPointGraphTraversal.java
FixedPointGraphTraversal.computeFixedPoint
public void computeFixedPoint(DiGraph<N, E> graph, N entry) { Set<N> entrySet = new LinkedHashSet<>(); entrySet.add(entry); computeFixedPoint(graph, entrySet); }
java
public void computeFixedPoint(DiGraph<N, E> graph, N entry) { Set<N> entrySet = new LinkedHashSet<>(); entrySet.add(entry); computeFixedPoint(graph, entrySet); }
[ "public", "void", "computeFixedPoint", "(", "DiGraph", "<", "N", ",", "E", ">", "graph", ",", "N", "entry", ")", "{", "Set", "<", "N", ">", "entrySet", "=", "new", "LinkedHashSet", "<>", "(", ")", ";", "entrySet", ".", "add", "(", "entry", ")", ";"...
Compute a fixed point for the given graph, entering from the given node. @param graph The graph to traverse. @param entry The node to begin traversing from.
[ "Compute", "a", "fixed", "point", "for", "the", "given", "graph", "entering", "from", "the", "given", "node", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/graph/FixedPointGraphTraversal.java#L80-L84
undertow-io/undertow
core/src/main/java/io/undertow/util/ETagUtils.java
ETagUtils.handleIfMatch
public static boolean handleIfMatch(final HttpServerExchange exchange, final ETag etag, boolean allowWeak) { return handleIfMatch(exchange, Collections.singletonList(etag), allowWeak); }
java
public static boolean handleIfMatch(final HttpServerExchange exchange, final ETag etag, boolean allowWeak) { return handleIfMatch(exchange, Collections.singletonList(etag), allowWeak); }
[ "public", "static", "boolean", "handleIfMatch", "(", "final", "HttpServerExchange", "exchange", ",", "final", "ETag", "etag", ",", "boolean", "allowWeak", ")", "{", "return", "handleIfMatch", "(", "exchange", ",", "Collections", ".", "singletonList", "(", "etag", ...
Handles the if-match header. returns true if the request should proceed, false otherwise @param exchange the exchange @param etag The etags @return
[ "Handles", "the", "if", "-", "match", "header", ".", "returns", "true", "if", "the", "request", "should", "proceed", "false", "otherwise" ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/ETagUtils.java#L44-L46
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedinstallationTemplate/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedinstallationTemplate.java
ApiOvhDedicatedinstallationTemplate.templateName_partitionScheme_schemeName_hardwareRaid_name_GET
public OvhHardwareRaid templateName_partitionScheme_schemeName_hardwareRaid_name_GET(String templateName, String schemeName, String name) throws IOException { String qPath = "/dedicated/installationTemplate/{templateName}/partitionScheme/{schemeName}/hardwareRaid/{name}"; StringBuilder sb = path(qPath, templateName, schemeName, name); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhHardwareRaid.class); }
java
public OvhHardwareRaid templateName_partitionScheme_schemeName_hardwareRaid_name_GET(String templateName, String schemeName, String name) throws IOException { String qPath = "/dedicated/installationTemplate/{templateName}/partitionScheme/{schemeName}/hardwareRaid/{name}"; StringBuilder sb = path(qPath, templateName, schemeName, name); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhHardwareRaid.class); }
[ "public", "OvhHardwareRaid", "templateName_partitionScheme_schemeName_hardwareRaid_name_GET", "(", "String", "templateName", ",", "String", "schemeName", ",", "String", "name", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/installationTemplate/{templa...
Get this object properties REST: GET /dedicated/installationTemplate/{templateName}/partitionScheme/{schemeName}/hardwareRaid/{name} @param templateName [required] This template name @param schemeName [required] name of this partitioning scheme @param name [required] Hardware RAID name
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedinstallationTemplate/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedinstallationTemplate.java#L44-L49
marklogic/java-client-api
marklogic-client-api/src/main/java/com/marklogic/client/datamovement/ProgressListener.java
ProgressListener.newProgressUpdate
protected ProgressUpdate newProgressUpdate(QueryBatch batch, long startTime, long totalForThisUpdate, double timeSoFar) { return new SimpleProgressUpdate(batch, startTime, totalForThisUpdate, timeSoFar); }
java
protected ProgressUpdate newProgressUpdate(QueryBatch batch, long startTime, long totalForThisUpdate, double timeSoFar) { return new SimpleProgressUpdate(batch, startTime, totalForThisUpdate, timeSoFar); }
[ "protected", "ProgressUpdate", "newProgressUpdate", "(", "QueryBatch", "batch", ",", "long", "startTime", ",", "long", "totalForThisUpdate", ",", "double", "timeSoFar", ")", "{", "return", "new", "SimpleProgressUpdate", "(", "batch", ",", "startTime", ",", "totalFor...
A subclass can override this to provide a different implementation of ProgressUpdate. @param batch @param startTime @param totalForThisUpdate @param timeSoFar @return
[ "A", "subclass", "can", "override", "this", "to", "provide", "a", "different", "implementation", "of", "ProgressUpdate", "." ]
train
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/datamovement/ProgressListener.java#L154-L156
alkacon/opencms-core
src/org/opencms/gwt/CmsGwtActionElement.java
CmsGwtActionElement.exportDictionary
public static String exportDictionary(String name, Method method, Object data) throws SerializationException { return exportDictionary(name, serialize(method, data)); }
java
public static String exportDictionary(String name, Method method, Object data) throws SerializationException { return exportDictionary(name, serialize(method, data)); }
[ "public", "static", "String", "exportDictionary", "(", "String", "name", ",", "Method", "method", ",", "Object", "data", ")", "throws", "SerializationException", "{", "return", "exportDictionary", "(", "name", ",", "serialize", "(", "method", ",", "data", ")", ...
Serializes the result of the given method for RPC-prefetching.<p> @param name the dictionary name @param method the method @param data the result to serialize @return the serialized data @throws SerializationException if something goes wrong
[ "Serializes", "the", "result", "of", "the", "given", "method", "for", "RPC", "-", "prefetching", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsGwtActionElement.java#L180-L183
relayrides/pushy
pushy/src/main/java/com/turo/pushy/apns/server/AcceptAllPushNotificationHandlerFactory.java
AcceptAllPushNotificationHandlerFactory.buildHandler
@Override public PushNotificationHandler buildHandler(final SSLSession sslSession) { return new PushNotificationHandler() { @Override public void handlePushNotification(final Http2Headers headers, final ByteBuf payload) { // Accept everything unconditionally! } }; }
java
@Override public PushNotificationHandler buildHandler(final SSLSession sslSession) { return new PushNotificationHandler() { @Override public void handlePushNotification(final Http2Headers headers, final ByteBuf payload) { // Accept everything unconditionally! } }; }
[ "@", "Override", "public", "PushNotificationHandler", "buildHandler", "(", "final", "SSLSession", "sslSession", ")", "{", "return", "new", "PushNotificationHandler", "(", ")", "{", "@", "Override", "public", "void", "handlePushNotification", "(", "final", "Http2Header...
Constructs a new push notification handler that unconditionally accepts all push notifications. @param sslSession the SSL session associated with the channel for which this handler will handle notifications @return a new "accept everything" push notification handler
[ "Constructs", "a", "new", "push", "notification", "handler", "that", "unconditionally", "accepts", "all", "push", "notifications", "." ]
train
https://github.com/relayrides/pushy/blob/1f6f9a0e07d785c815d74c2320a8d87c80231d36/pushy/src/main/java/com/turo/pushy/apns/server/AcceptAllPushNotificationHandlerFactory.java#L48-L57
redbox-mint/redbox
plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/CurationManager.java
CurationManager.saveObjectData
private void saveObjectData(JsonSimple data, String oid) throws TransactionException { // Get from storage DigitalObject object = null; try { object = storage.getObject(oid); getDataPayload(object); } catch (StorageException ex) { log.error("Error accessing object '{}' in storage: ", oid, ex); throw new TransactionException(ex); } // Store modifications String jsonString = data.toString(true); try { updateDataPayload(object, jsonString); } catch (Exception ex) { log.error("Unable to store data '{}': ", oid, ex); throw new TransactionException(ex); } }
java
private void saveObjectData(JsonSimple data, String oid) throws TransactionException { // Get from storage DigitalObject object = null; try { object = storage.getObject(oid); getDataPayload(object); } catch (StorageException ex) { log.error("Error accessing object '{}' in storage: ", oid, ex); throw new TransactionException(ex); } // Store modifications String jsonString = data.toString(true); try { updateDataPayload(object, jsonString); } catch (Exception ex) { log.error("Unable to store data '{}': ", oid, ex); throw new TransactionException(ex); } }
[ "private", "void", "saveObjectData", "(", "JsonSimple", "data", ",", "String", "oid", ")", "throws", "TransactionException", "{", "// Get from storage", "DigitalObject", "object", "=", "null", ";", "try", "{", "object", "=", "storage", ".", "getObject", "(", "oi...
Save the provided object data back into storage @param data The data to save @param oid The object we want it saved in
[ "Save", "the", "provided", "object", "data", "back", "into", "storage" ]
train
https://github.com/redbox-mint/redbox/blob/1db230f218031b85c48c8603cbb04fce7ac6de0c/plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/CurationManager.java#L1922-L1942
mfornos/humanize
humanize-icu/src/main/java/humanize/ICUHumanize.java
ICUHumanize.formatCurrency
public static String formatCurrency(final Number value, final Locale locale) { return withinLocale(new Callable<String>() { public String call() { return formatCurrency(value); } }, locale); }
java
public static String formatCurrency(final Number value, final Locale locale) { return withinLocale(new Callable<String>() { public String call() { return formatCurrency(value); } }, locale); }
[ "public", "static", "String", "formatCurrency", "(", "final", "Number", "value", ",", "final", "Locale", "locale", ")", "{", "return", "withinLocale", "(", "new", "Callable", "<", "String", ">", "(", ")", "{", "public", "String", "call", "(", ")", "{", "...
<p> Same as {@link #formatCurrency(Number) formatCurrency} for the specified locale. </p> @param value Number to be formatted @param locale Target locale @return String representing the monetary amount
[ "<p", ">", "Same", "as", "{", "@link", "#formatCurrency", "(", "Number", ")", "formatCurrency", "}", "for", "the", "specified", "locale", ".", "<", "/", "p", ">" ]
train
https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-icu/src/main/java/humanize/ICUHumanize.java#L648-L657
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java
NetworkWatchersInner.beginVerifyIPFlowAsync
public Observable<VerificationIPFlowResultInner> beginVerifyIPFlowAsync(String resourceGroupName, String networkWatcherName, VerificationIPFlowParameters parameters) { return beginVerifyIPFlowWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<VerificationIPFlowResultInner>, VerificationIPFlowResultInner>() { @Override public VerificationIPFlowResultInner call(ServiceResponse<VerificationIPFlowResultInner> response) { return response.body(); } }); }
java
public Observable<VerificationIPFlowResultInner> beginVerifyIPFlowAsync(String resourceGroupName, String networkWatcherName, VerificationIPFlowParameters parameters) { return beginVerifyIPFlowWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<VerificationIPFlowResultInner>, VerificationIPFlowResultInner>() { @Override public VerificationIPFlowResultInner call(ServiceResponse<VerificationIPFlowResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VerificationIPFlowResultInner", ">", "beginVerifyIPFlowAsync", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "VerificationIPFlowParameters", "parameters", ")", "{", "return", "beginVerifyIPFlowWithServiceResponseAsync"...
Verify IP flow from the specified VM to a location given the currently configured NSG rules. @param resourceGroupName The name of the resource group. @param networkWatcherName The name of the network watcher. @param parameters Parameters that define the IP flow to be verified. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VerificationIPFlowResultInner object
[ "Verify", "IP", "flow", "from", "the", "specified", "VM", "to", "a", "location", "given", "the", "currently", "configured", "NSG", "rules", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L1060-L1067
derari/cthul
strings/src/main/java/org/cthul/strings/AlphaIndex.java
AlphaIndex.toAlpha
public static String toAlpha(long i, boolean uppercase) { final int A = (uppercase ? 'A' : 'a') - 1; if (i < 0) throw new IllegalArgumentException( "Argument must be non-negative, was " + i); if (i == Long.MAX_VALUE) throw new IllegalArgumentException( "Argument must be smaller than Long.MAX_VALUE"); i++; StringBuilder sb = new StringBuilder(); while (i > 0) { long d = i%26; if (d == 0) d = 26; sb.append((char)(A + d)); i = (i-d)/26; } return sb.reverse().toString(); }
java
public static String toAlpha(long i, boolean uppercase) { final int A = (uppercase ? 'A' : 'a') - 1; if (i < 0) throw new IllegalArgumentException( "Argument must be non-negative, was " + i); if (i == Long.MAX_VALUE) throw new IllegalArgumentException( "Argument must be smaller than Long.MAX_VALUE"); i++; StringBuilder sb = new StringBuilder(); while (i > 0) { long d = i%26; if (d == 0) d = 26; sb.append((char)(A + d)); i = (i-d)/26; } return sb.reverse().toString(); }
[ "public", "static", "String", "toAlpha", "(", "long", "i", ",", "boolean", "uppercase", ")", "{", "final", "int", "A", "=", "(", "uppercase", "?", "'", "'", ":", "'", "'", ")", "-", "1", ";", "if", "(", "i", "<", "0", ")", "throw", "new", "Ille...
Like {@link #toAlpha(long)}, but allows to choose lower case. @param i number to convert @param uppercase whether output will be in upper case @return aplha-index of {@code i}
[ "Like", "{" ]
train
https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/strings/src/main/java/org/cthul/strings/AlphaIndex.java#L44-L61
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/ReflectionUtils.java
ReflectionUtils.toComponentTypeArray
public static Object toComponentTypeArray(Object val, Class<?> componentType) { if (val != null) { int len = Array.getLength(val); Object arr = Array.newInstance(componentType, len); for (int i = 0; i < len; i++) { Array.set(arr, i, Array.get(val, i)); } return arr; } else { return null; } }
java
public static Object toComponentTypeArray(Object val, Class<?> componentType) { if (val != null) { int len = Array.getLength(val); Object arr = Array.newInstance(componentType, len); for (int i = 0; i < len; i++) { Array.set(arr, i, Array.get(val, i)); } return arr; } else { return null; } }
[ "public", "static", "Object", "toComponentTypeArray", "(", "Object", "val", ",", "Class", "<", "?", ">", "componentType", ")", "{", "if", "(", "val", "!=", "null", ")", "{", "int", "len", "=", "Array", ".", "getLength", "(", "val", ")", ";", "Object", ...
Converts an array of objects to an array of the specified component type. @param val an array of objects to be converted @param componentType the {@code Class} object representing the component type of the new array @return an array of the objects with the specified component type
[ "Converts", "an", "array", "of", "objects", "to", "an", "array", "of", "the", "specified", "component", "type", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/ReflectionUtils.java#L275-L286
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/proxy/transport/ProxyTask.java
ProxyTask.getNewRemoteTask
public RemoteTask getNewRemoteTask(Application app, Map<String,Object> properties) { try { // Map<String,Object> propApp = this.getApplicationProperties(properties); // Map<String,Object> propInitial = ProxyTask.getInitialProperties(this.getBasicServlet(), SERVLET_TYPE.PROXY); // if (propInitial != null) // propApp.putAll(propInitial); if (app == null) app = new MainApplication(((BaseApplication)m_application).getEnvironment(), properties, null); // propApp, null); RemoteTask remoteServer = new TaskSession(app); ((TaskSession)remoteServer).setProperties(properties); return remoteServer; } catch (Exception ex) { ex.printStackTrace(); return null; } }
java
public RemoteTask getNewRemoteTask(Application app, Map<String,Object> properties) { try { // Map<String,Object> propApp = this.getApplicationProperties(properties); // Map<String,Object> propInitial = ProxyTask.getInitialProperties(this.getBasicServlet(), SERVLET_TYPE.PROXY); // if (propInitial != null) // propApp.putAll(propInitial); if (app == null) app = new MainApplication(((BaseApplication)m_application).getEnvironment(), properties, null); // propApp, null); RemoteTask remoteServer = new TaskSession(app); ((TaskSession)remoteServer).setProperties(properties); return remoteServer; } catch (Exception ex) { ex.printStackTrace(); return null; } }
[ "public", "RemoteTask", "getNewRemoteTask", "(", "Application", "app", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "try", "{", "// Map<String,Object> propApp = this.getApplicationProperties(properties);", "// Map<String,Object> propInitial = ProxyTask...
Get a remote session from the pool and initialize it. If the pool is empty, create a new remote session. @param strUserID The user name/ID of the user, or null if unknown. @return The remote Task.
[ "Get", "a", "remote", "session", "from", "the", "pool", "and", "initialize", "it", ".", "If", "the", "pool", "is", "empty", "create", "a", "new", "remote", "session", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/proxy/transport/ProxyTask.java#L306-L324
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/TasksInner.java
TasksInner.getDetails
public TaskInner getDetails(String resourceGroupName, String registryName, String taskName) { return getDetailsWithServiceResponseAsync(resourceGroupName, registryName, taskName).toBlocking().single().body(); }
java
public TaskInner getDetails(String resourceGroupName, String registryName, String taskName) { return getDetailsWithServiceResponseAsync(resourceGroupName, registryName, taskName).toBlocking().single().body(); }
[ "public", "TaskInner", "getDetails", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "taskName", ")", "{", "return", "getDetailsWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ",", "taskName", ")", ".", "toBl...
Returns a task with extended information that includes all secrets. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param taskName The name of the container registry task. @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 TaskInner object if successful.
[ "Returns", "a", "task", "with", "extended", "information", "that", "includes", "all", "secrets", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/TasksInner.java#L861-L863
spring-projects/spring-session-data-mongodb
src/main/java/org/springframework/session/data/mongo/AbstractMongoSessionConverter.java
AbstractMongoSessionConverter.ensureIndexes
protected void ensureIndexes(IndexOperations sessionCollectionIndexes) { for (IndexInfo info : sessionCollectionIndexes.getIndexInfo()) { if (EXPIRE_AT_FIELD_NAME.equals(info.getName())) { LOG.debug("TTL index on field " + EXPIRE_AT_FIELD_NAME + " already exists"); return; } } LOG.info("Creating TTL index on field " + EXPIRE_AT_FIELD_NAME); sessionCollectionIndexes .ensureIndex(new Index(EXPIRE_AT_FIELD_NAME, Sort.Direction.ASC).named(EXPIRE_AT_FIELD_NAME).expire(0)); }
java
protected void ensureIndexes(IndexOperations sessionCollectionIndexes) { for (IndexInfo info : sessionCollectionIndexes.getIndexInfo()) { if (EXPIRE_AT_FIELD_NAME.equals(info.getName())) { LOG.debug("TTL index on field " + EXPIRE_AT_FIELD_NAME + " already exists"); return; } } LOG.info("Creating TTL index on field " + EXPIRE_AT_FIELD_NAME); sessionCollectionIndexes .ensureIndex(new Index(EXPIRE_AT_FIELD_NAME, Sort.Direction.ASC).named(EXPIRE_AT_FIELD_NAME).expire(0)); }
[ "protected", "void", "ensureIndexes", "(", "IndexOperations", "sessionCollectionIndexes", ")", "{", "for", "(", "IndexInfo", "info", ":", "sessionCollectionIndexes", ".", "getIndexInfo", "(", ")", ")", "{", "if", "(", "EXPIRE_AT_FIELD_NAME", ".", "equals", "(", "i...
Method ensures that there is a TTL index on {@literal expireAt} field. It's has {@literal expireAfterSeconds} set to zero seconds, so the expiration time is controlled by the application. It can be extended in custom converters when there is a need for creating additional custom indexes. @param sessionCollectionIndexes {@link IndexOperations} to use
[ "Method", "ensures", "that", "there", "is", "a", "TTL", "index", "on", "{", "@literal", "expireAt", "}", "field", ".", "It", "s", "has", "{", "@literal", "expireAfterSeconds", "}", "set", "to", "zero", "seconds", "so", "the", "expiration", "time", "is", ...
train
https://github.com/spring-projects/spring-session-data-mongodb/blob/c507bb2d2a9b52ea9846ffaf1ac7c71cb0e6690e/src/main/java/org/springframework/session/data/mongo/AbstractMongoSessionConverter.java#L69-L81
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueFactoryImpl.java
ValueFactoryImpl.createValue
public Value createValue(JCRPath value) throws RepositoryException { if (value == null) return null; try { return new PathValue(value.getInternalPath(), locationFactory); } catch (IOException e) { throw new RepositoryException("Cannot create PATH Value from JCRPath", e); } }
java
public Value createValue(JCRPath value) throws RepositoryException { if (value == null) return null; try { return new PathValue(value.getInternalPath(), locationFactory); } catch (IOException e) { throw new RepositoryException("Cannot create PATH Value from JCRPath", e); } }
[ "public", "Value", "createValue", "(", "JCRPath", "value", ")", "throws", "RepositoryException", "{", "if", "(", "value", "==", "null", ")", "return", "null", ";", "try", "{", "return", "new", "PathValue", "(", "value", ".", "getInternalPath", "(", ")", ",...
Create Value from JCRPath. @param value JCRPath @return Value @throws RepositoryException if error
[ "Create", "Value", "from", "JCRPath", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueFactoryImpl.java#L327-L339
centic9/commons-dost
src/main/java/org/dstadler/commons/graphviz/DotUtils.java
DotUtils.checkDot
public static boolean checkDot() throws IOException { // call graphviz-dot via commons-exec CommandLine cmdLine = new CommandLine(DOT_EXE); cmdLine.addArgument("-V"); DefaultExecutor executor = new DefaultExecutor(); executor.setExitValue(0); ExecuteWatchdog watchdog = new ExecuteWatchdog(60000); executor.setWatchdog(watchdog); executor.setStreamHandler(new PumpStreamHandler(System.out, System.err)); int exitValue = executor.execute(cmdLine); if(exitValue != 0) { System.err.println("Could not run '" + DOT_EXE + "', had exit value: " + exitValue + "!"); return false; } return true; }
java
public static boolean checkDot() throws IOException { // call graphviz-dot via commons-exec CommandLine cmdLine = new CommandLine(DOT_EXE); cmdLine.addArgument("-V"); DefaultExecutor executor = new DefaultExecutor(); executor.setExitValue(0); ExecuteWatchdog watchdog = new ExecuteWatchdog(60000); executor.setWatchdog(watchdog); executor.setStreamHandler(new PumpStreamHandler(System.out, System.err)); int exitValue = executor.execute(cmdLine); if(exitValue != 0) { System.err.println("Could not run '" + DOT_EXE + "', had exit value: " + exitValue + "!"); return false; } return true; }
[ "public", "static", "boolean", "checkDot", "(", ")", "throws", "IOException", "{", "// call graphviz-dot via commons-exec", "CommandLine", "cmdLine", "=", "new", "CommandLine", "(", "DOT_EXE", ")", ";", "cmdLine", ".", "addArgument", "(", "\"-V\"", ")", ";", "Defa...
Verify if dot can be started and print out the version to stdout. @return True if "dot -V" ran successfully, false otherwise @throws IOException If running dot fails.
[ "Verify", "if", "dot", "can", "be", "started", "and", "print", "out", "the", "version", "to", "stdout", "." ]
train
https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/graphviz/DotUtils.java#L143-L159
Impetus/Kundera
src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java
MongoDBClient.parseAndScroll
private DBCursor parseAndScroll(String jsonClause, String collectionName) throws JSONParseException { BasicDBObject clause = (BasicDBObject) JSON.parse(jsonClause); DBCursor cursor = mongoDb.getCollection(collectionName).find(clause); return cursor; }
java
private DBCursor parseAndScroll(String jsonClause, String collectionName) throws JSONParseException { BasicDBObject clause = (BasicDBObject) JSON.parse(jsonClause); DBCursor cursor = mongoDb.getCollection(collectionName).find(clause); return cursor; }
[ "private", "DBCursor", "parseAndScroll", "(", "String", "jsonClause", ",", "String", "collectionName", ")", "throws", "JSONParseException", "{", "BasicDBObject", "clause", "=", "(", "BasicDBObject", ")", "JSON", ".", "parse", "(", "jsonClause", ")", ";", "DBCursor...
Parses the and scroll. @param jsonClause the json clause @param collectionName the collection name @return the DB cursor @throws JSONParseException the JSON parse exception
[ "Parses", "the", "and", "scroll", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java#L1846-L1851
landawn/AbacusUtil
src/com/landawn/abacus/util/stream/Stream.java
Stream.parallelZipp
public static <T, R> Stream<R> parallelZipp(final Collection<? extends Iterator<? extends T>> c, final Function<? super List<? extends T>, R> zipFunction) { return parallelZipp(c, zipFunction, DEFAULT_QUEUE_SIZE_PER_ITERATOR); }
java
public static <T, R> Stream<R> parallelZipp(final Collection<? extends Iterator<? extends T>> c, final Function<? super List<? extends T>, R> zipFunction) { return parallelZipp(c, zipFunction, DEFAULT_QUEUE_SIZE_PER_ITERATOR); }
[ "public", "static", "<", "T", ",", "R", ">", "Stream", "<", "R", ">", "parallelZipp", "(", "final", "Collection", "<", "?", "extends", "Iterator", "<", "?", "extends", "T", ">", ">", "c", ",", "final", "Function", "<", "?", "super", "List", "<", "?...
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 c @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#L7902-L7904
primefaces-extensions/core
src/main/java/org/primefaces/extensions/component/sheet/Sheet.java
Sheet.setRowVar
public void setRowVar(final FacesContext context, final String rowKey) { if (context == null) { return; } if (rowKey == null) { context.getExternalContext().getRequestMap().remove(getVar()); } else { final Object value = getRowMap().get(rowKey); context.getExternalContext().getRequestMap().put(getVar(), value); } }
java
public void setRowVar(final FacesContext context, final String rowKey) { if (context == null) { return; } if (rowKey == null) { context.getExternalContext().getRequestMap().remove(getVar()); } else { final Object value = getRowMap().get(rowKey); context.getExternalContext().getRequestMap().put(getVar(), value); } }
[ "public", "void", "setRowVar", "(", "final", "FacesContext", "context", ",", "final", "String", "rowKey", ")", "{", "if", "(", "context", "==", "null", ")", "{", "return", ";", "}", "if", "(", "rowKey", "==", "null", ")", "{", "context", ".", "getExter...
Updates the row var for iterations over the list. The var value will be updated to the value for the specified rowKey. @param context the FacesContext against which to the row var is set. Passed for performance @param rowKey the rowKey string
[ "Updates", "the", "row", "var", "for", "iterations", "over", "the", "list", ".", "The", "var", "value", "will", "be", "updated", "to", "the", "value", "for", "the", "specified", "rowKey", "." ]
train
https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L312-L325
apiman/apiman
gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/LocalClientFactory.java
LocalClientFactory.createClient
public JestClient createClient(Map<String, String> config, String defaultIndexName) { JestClient client; String indexName = config.get("client.index"); //$NON-NLS-1$ if (indexName == null) { indexName = defaultIndexName; } client = createLocalClient(config, indexName, defaultIndexName); return client; }
java
public JestClient createClient(Map<String, String> config, String defaultIndexName) { JestClient client; String indexName = config.get("client.index"); //$NON-NLS-1$ if (indexName == null) { indexName = defaultIndexName; } client = createLocalClient(config, indexName, defaultIndexName); return client; }
[ "public", "JestClient", "createClient", "(", "Map", "<", "String", ",", "String", ">", "config", ",", "String", "defaultIndexName", ")", "{", "JestClient", "client", ";", "String", "indexName", "=", "config", ".", "get", "(", "\"client.index\"", ")", ";", "/...
Creates a client from information in the config map. @param config the configuration @param defaultIndexName the default index to use if not specified in the config @return the ES client
[ "Creates", "a", "client", "from", "information", "in", "the", "config", "map", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/LocalClientFactory.java#L42-L50
google/closure-templates
java/src/com/google/template/soy/pysrc/internal/TranslateToPyExprVisitor.java
TranslateToPyExprVisitor.genPyExprUsingSoySyntax
private PyExpr genPyExprUsingSoySyntax(OperatorNode opNode) { List<PyExpr> operandPyExprs = visitChildren(opNode); String newExpr = PyExprUtils.genExprWithNewToken(opNode.getOperator(), operandPyExprs, null); return new PyExpr(newExpr, PyExprUtils.pyPrecedenceForOperator(opNode.getOperator())); }
java
private PyExpr genPyExprUsingSoySyntax(OperatorNode opNode) { List<PyExpr> operandPyExprs = visitChildren(opNode); String newExpr = PyExprUtils.genExprWithNewToken(opNode.getOperator(), operandPyExprs, null); return new PyExpr(newExpr, PyExprUtils.pyPrecedenceForOperator(opNode.getOperator())); }
[ "private", "PyExpr", "genPyExprUsingSoySyntax", "(", "OperatorNode", "opNode", ")", "{", "List", "<", "PyExpr", ">", "operandPyExprs", "=", "visitChildren", "(", "opNode", ")", ";", "String", "newExpr", "=", "PyExprUtils", ".", "genExprWithNewToken", "(", "opNode"...
Generates a Python expression for the given OperatorNode's subtree assuming that the Python expression for the operator uses the same syntax format as the Soy operator. @param opNode the OperatorNode whose subtree to generate a Python expression for @return the generated Python expression
[ "Generates", "a", "Python", "expression", "for", "the", "given", "OperatorNode", "s", "subtree", "assuming", "that", "the", "Python", "expression", "for", "the", "operator", "uses", "the", "same", "syntax", "format", "as", "the", "Soy", "operator", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/pysrc/internal/TranslateToPyExprVisitor.java#L641-L646
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/RouteProcessorThreadListener.java
RouteProcessorThreadListener.onMilestoneTrigger
@Override public void onMilestoneTrigger(List<Milestone> triggeredMilestones, RouteProgress routeProgress) { for (Milestone milestone : triggeredMilestones) { String instruction = buildInstructionString(routeProgress, milestone); eventDispatcher.onMilestoneEvent(routeProgress, instruction, milestone); } }
java
@Override public void onMilestoneTrigger(List<Milestone> triggeredMilestones, RouteProgress routeProgress) { for (Milestone milestone : triggeredMilestones) { String instruction = buildInstructionString(routeProgress, milestone); eventDispatcher.onMilestoneEvent(routeProgress, instruction, milestone); } }
[ "@", "Override", "public", "void", "onMilestoneTrigger", "(", "List", "<", "Milestone", ">", "triggeredMilestones", ",", "RouteProgress", "routeProgress", ")", "{", "for", "(", "Milestone", "milestone", ":", "triggeredMilestones", ")", "{", "String", "instruction", ...
With each valid and successful rawLocation update, this will get called once the work on the navigation engine thread has finished. Depending on whether or not a milestone gets triggered or not, the navigation event dispatcher will be called to notify the developer.
[ "With", "each", "valid", "and", "successful", "rawLocation", "update", "this", "will", "get", "called", "once", "the", "work", "on", "the", "navigation", "engine", "thread", "has", "finished", ".", "Depending", "on", "whether", "or", "not", "a", "milestone", ...
train
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/RouteProcessorThreadListener.java#L42-L48
gsi-upm/Shanks
shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/ScenarioPortrayal.java
ScenarioPortrayal.addDataSerieToScatterPlot
public void addDataSerieToScatterPlot(String scatterID, double[][] dataSerie){ if (this.scatterPlots.containsKey(scatterID)) { this.scatterPlotsData.put(scatterID, dataSerie); this.scatterPlots.get(scatterID).addSeries((double[][])this.scatterPlotsData.get(scatterID), scatterID, null); } }
java
public void addDataSerieToScatterPlot(String scatterID, double[][] dataSerie){ if (this.scatterPlots.containsKey(scatterID)) { this.scatterPlotsData.put(scatterID, dataSerie); this.scatterPlots.get(scatterID).addSeries((double[][])this.scatterPlotsData.get(scatterID), scatterID, null); } }
[ "public", "void", "addDataSerieToScatterPlot", "(", "String", "scatterID", ",", "double", "[", "]", "[", "]", "dataSerie", ")", "{", "if", "(", "this", ".", "scatterPlots", ".", "containsKey", "(", "scatterID", ")", ")", "{", "this", ".", "scatterPlotsData",...
Sets the data for the scatterPlot. Should be used only the first time. Use updateDataSerieOnScaterPlot to change the data @param scatterID @param dataSerie the data. The first dimension MUST BE 2 (double[2][whatever_int])
[ "Sets", "the", "data", "for", "the", "scatterPlot", ".", "Should", "be", "used", "only", "the", "first", "time", ".", "Use", "updateDataSerieOnScaterPlot", "to", "change", "the", "data" ]
train
https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/ScenarioPortrayal.java#L308-L313
jOOQ/jOOR
jOOR/src/main/java/org/joor/Reflect.java
Reflect.exactMethod
private Method exactMethod(String name, Class<?>[] types) throws NoSuchMethodException { Class<?> t = type(); // first priority: find a public method with exact signature match in class hierarchy try { return t.getMethod(name, types); } // second priority: find a private method with exact signature match on declaring class catch (NoSuchMethodException e) { do { try { return t.getDeclaredMethod(name, types); } catch (NoSuchMethodException ignore) {} t = t.getSuperclass(); } while (t != null); throw new NoSuchMethodException(); } }
java
private Method exactMethod(String name, Class<?>[] types) throws NoSuchMethodException { Class<?> t = type(); // first priority: find a public method with exact signature match in class hierarchy try { return t.getMethod(name, types); } // second priority: find a private method with exact signature match on declaring class catch (NoSuchMethodException e) { do { try { return t.getDeclaredMethod(name, types); } catch (NoSuchMethodException ignore) {} t = t.getSuperclass(); } while (t != null); throw new NoSuchMethodException(); } }
[ "private", "Method", "exactMethod", "(", "String", "name", ",", "Class", "<", "?", ">", "[", "]", "types", ")", "throws", "NoSuchMethodException", "{", "Class", "<", "?", ">", "t", "=", "type", "(", ")", ";", "// first priority: find a public method with exact...
Searches a method with the exact same signature as desired. <p> If a public method is found in the class hierarchy, this method is returned. Otherwise a private method with the exact same signature is returned. If no exact match could be found, we let the {@code NoSuchMethodException} pass through.
[ "Searches", "a", "method", "with", "the", "exact", "same", "signature", "as", "desired", ".", "<p", ">", "If", "a", "public", "method", "is", "found", "in", "the", "class", "hierarchy", "this", "method", "is", "returned", ".", "Otherwise", "a", "private", ...
train
https://github.com/jOOQ/jOOR/blob/40b42be12ecc9939560ff86921bbc57c99a21b85/jOOR/src/main/java/org/joor/Reflect.java#L585-L607
mongodb/stitch-android-sdk
core/sdk/src/main/java/com/mongodb/stitch/core/internal/common/Assertions.java
Assertions.notNull
public static <T> void notNull(final String name, final T value) { if (value == null) { throw new IllegalArgumentException(name + " can not be null"); } }
java
public static <T> void notNull(final String name, final T value) { if (value == null) { throw new IllegalArgumentException(name + " can not be null"); } }
[ "public", "static", "<", "T", ">", "void", "notNull", "(", "final", "String", "name", ",", "final", "T", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "name", "+", "\" can not be null\"", ...
Throw IllegalArgumentException if the value is null. @param name the parameter name. @param value the value that should not be null. @param <T> the value type. @throws IllegalArgumentException if value is null.
[ "Throw", "IllegalArgumentException", "if", "the", "value", "is", "null", "." ]
train
https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/sdk/src/main/java/com/mongodb/stitch/core/internal/common/Assertions.java#L30-L34
eurekaclinical/protempa
protempa-framework/src/main/java/org/protempa/ProtempaUtil.java
ProtempaUtil.checkArrayForDuplicates
static void checkArrayForDuplicates(Object[] array, String arrayName) { if (array.length > 1) { if (array.length == 2) { if (array[0] == array[1] || (array[0] != null && array[0].equals(array[1]))) { throw new IllegalArgumentException(arrayName + " cannot contain duplicate elements: " + Arrays.toString(array) + "; " + array[0]); } } else { Set<Object> set = new HashSet<>(); for (Object obj : array) { if (!set.add(obj)) { throw new IllegalArgumentException(arrayName + " cannot contain duplicate elements: " + Arrays.toString(array) + "; " + obj); } } } } }
java
static void checkArrayForDuplicates(Object[] array, String arrayName) { if (array.length > 1) { if (array.length == 2) { if (array[0] == array[1] || (array[0] != null && array[0].equals(array[1]))) { throw new IllegalArgumentException(arrayName + " cannot contain duplicate elements: " + Arrays.toString(array) + "; " + array[0]); } } else { Set<Object> set = new HashSet<>(); for (Object obj : array) { if (!set.add(obj)) { throw new IllegalArgumentException(arrayName + " cannot contain duplicate elements: " + Arrays.toString(array) + "; " + obj); } } } } }
[ "static", "void", "checkArrayForDuplicates", "(", "Object", "[", "]", "array", ",", "String", "arrayName", ")", "{", "if", "(", "array", ".", "length", ">", "1", ")", "{", "if", "(", "array", ".", "length", "==", "2", ")", "{", "if", "(", "array", ...
Checks an array for duplicates as checked with the <code>equals</code> method. @param array an {@link Object[]}. Cannot be <code>null</code>. @param arrayName the name {@link String} of the array to use in the error message if a duplicate is found. @throws IllegalArgumentException if a duplicate is found.
[ "Checks", "an", "array", "for", "duplicates", "as", "checked", "with", "the", "<code", ">", "equals<", "/", "code", ">", "method", "." ]
train
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/ProtempaUtil.java#L154-L174
RestComm/sip-servlets
sip-servlets-examples/click-to-call-servlet3/src/main/java/org/mobicents/servlet/sip/example/StatusServlet.java
StatusServlet.init
@Override public void init(final ServletConfig config) throws ServletException { data = new StatusServletNotifier(queue, config); data.eventsQueue = new LinkedBlockingQueue<String>(); if (data.eventsQueue == null) data.eventsQueue = new LinkedBlockingQueue<String>(); config.getServletContext().setAttribute("eventsQueue", data.eventsQueue); notifierThread = new Thread(data); notifierThread.start(); logger.info("the StatusServlet has been started"); }
java
@Override public void init(final ServletConfig config) throws ServletException { data = new StatusServletNotifier(queue, config); data.eventsQueue = new LinkedBlockingQueue<String>(); if (data.eventsQueue == null) data.eventsQueue = new LinkedBlockingQueue<String>(); config.getServletContext().setAttribute("eventsQueue", data.eventsQueue); notifierThread = new Thread(data); notifierThread.start(); logger.info("the StatusServlet has been started"); }
[ "@", "Override", "public", "void", "init", "(", "final", "ServletConfig", "config", ")", "throws", "ServletException", "{", "data", "=", "new", "StatusServletNotifier", "(", "queue", ",", "config", ")", ";", "data", ".", "eventsQueue", "=", "new", "LinkedBlock...
/* Start a new thread that using the LinkedBlockingQueue, every time there is a new element in the collection will retrieve the last updated users HashMap and calls container and will use them to produce and dispatch a new repsonse to the clients in the queue. Important here is the fact that we never close the stream and we just flush the response so it can be used later when needed.
[ "/", "*", "Start", "a", "new", "thread", "that", "using", "the", "LinkedBlockingQueue", "every", "time", "there", "is", "a", "new", "element", "in", "the", "collection", "will", "retrieve", "the", "last", "updated", "users", "HashMap", "and", "calls", "conta...
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/click-to-call-servlet3/src/main/java/org/mobicents/servlet/sip/example/StatusServlet.java#L39-L50
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/PortableUtils.java
PortableUtils.validateFactoryAndClass
static void validateFactoryAndClass(FieldDefinition fd, int factoryId, int classId, String fullPath) { if (factoryId != fd.getFactoryId()) { throw new IllegalArgumentException("Invalid factoryId! Expected: " + fd.getFactoryId() + ", Current: " + factoryId + " in path " + fullPath); } if (classId != fd.getClassId()) { throw new IllegalArgumentException("Invalid classId! Expected: " + fd.getClassId() + ", Current: " + classId + " in path " + fullPath); } }
java
static void validateFactoryAndClass(FieldDefinition fd, int factoryId, int classId, String fullPath) { if (factoryId != fd.getFactoryId()) { throw new IllegalArgumentException("Invalid factoryId! Expected: " + fd.getFactoryId() + ", Current: " + factoryId + " in path " + fullPath); } if (classId != fd.getClassId()) { throw new IllegalArgumentException("Invalid classId! Expected: " + fd.getClassId() + ", Current: " + classId + " in path " + fullPath); } }
[ "static", "void", "validateFactoryAndClass", "(", "FieldDefinition", "fd", ",", "int", "factoryId", ",", "int", "classId", ",", "String", "fullPath", ")", "{", "if", "(", "factoryId", "!=", "fd", ".", "getFactoryId", "(", ")", ")", "{", "throw", "new", "Il...
Validates if the given factoryId and classId match the ones from the fieldDefinition @param fd given fieldDefinition to validate against @param factoryId given factoryId to validate @param classId given factoryId to validate @param fullPath full path - just for output
[ "Validates", "if", "the", "given", "factoryId", "and", "classId", "match", "the", "ones", "from", "the", "fieldDefinition" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/PortableUtils.java#L168-L177
pmwmedia/tinylog
tinylog-impl/src/main/java/org/tinylog/writers/LogcatWriter.java
LogcatWriter.reuseOrCreate
private static StringBuilder reuseOrCreate(final StringBuilder builder, final int capacity) { if (builder == null) { return new StringBuilder(capacity); } else { builder.setLength(0); return builder; } }
java
private static StringBuilder reuseOrCreate(final StringBuilder builder, final int capacity) { if (builder == null) { return new StringBuilder(capacity); } else { builder.setLength(0); return builder; } }
[ "private", "static", "StringBuilder", "reuseOrCreate", "(", "final", "StringBuilder", "builder", ",", "final", "int", "capacity", ")", "{", "if", "(", "builder", "==", "null", ")", "{", "return", "new", "StringBuilder", "(", "capacity", ")", ";", "}", "else"...
Clears an existing string builder or creates a new one if given string builder is {@code null}. @param builder String builder instance or {@code null} @param capacity Initial capacity for new string builder if created @return Empty string builder
[ "Clears", "an", "existing", "string", "builder", "or", "creates", "a", "new", "one", "if", "given", "string", "builder", "is", "{", "@code", "null", "}", "." ]
train
https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/tinylog-impl/src/main/java/org/tinylog/writers/LogcatWriter.java#L159-L166
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/message/app/ThickMessageManager.java
ThickMessageManager.init
public void init(App application, String strParams, Map<String, Object> properties) { super.init(application, strParams, properties); }
java
public void init(App application, String strParams, Map<String, Object> properties) { super.init(application, strParams, properties); }
[ "public", "void", "init", "(", "App", "application", ",", "String", "strParams", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "super", ".", "init", "(", "application", ",", "strParams", ",", "properties", ")", ";", "}" ]
Constructor. @param application The parent application. @param strParams The task properties.
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/message/app/ThickMessageManager.java#L45-L48
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.rotateZYX
public Matrix4f rotateZYX(float angleZ, float angleY, float angleX) { return rotateZYX(angleZ, angleY, angleX, thisOrNew()); }
java
public Matrix4f rotateZYX(float angleZ, float angleY, float angleX) { return rotateZYX(angleZ, angleY, angleX, thisOrNew()); }
[ "public", "Matrix4f", "rotateZYX", "(", "float", "angleZ", ",", "float", "angleY", ",", "float", "angleX", ")", "{", "return", "rotateZYX", "(", "angleZ", ",", "angleY", ",", "angleX", ",", "thisOrNew", "(", ")", ")", ";", "}" ]
Apply rotation of <code>angleZ</code> radians about the Z axis, followed by a rotation of <code>angleY</code> radians about the Y axis and followed by a rotation of <code>angleX</code> radians about the X axis. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>M * R</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the rotation will be applied first! <p> This method is equivalent to calling: <code>rotateZ(angleZ).rotateY(angleY).rotateX(angleX)</code> @param angleZ the angle to rotate about Z @param angleY the angle to rotate about Y @param angleX the angle to rotate about X @return a matrix holding the result
[ "Apply", "rotation", "of", "<code", ">", "angleZ<", "/", "code", ">", "radians", "about", "the", "Z", "axis", "followed", "by", "a", "rotation", "of", "<code", ">", "angleY<", "/", "code", ">", "radians", "about", "the", "Y", "axis", "and", "followed", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L5496-L5498
upwork/java-upwork
src/com/Upwork/api/Routers/Reports/Finance/Billings.java
Billings.getByBuyersCompany
public JSONObject getByBuyersCompany(String buyerCompanyReference, HashMap<String, String> params) throws JSONException { return oClient.get("/finreports/v2/buyer_companies/" + buyerCompanyReference + "/billings", params); }
java
public JSONObject getByBuyersCompany(String buyerCompanyReference, HashMap<String, String> params) throws JSONException { return oClient.get("/finreports/v2/buyer_companies/" + buyerCompanyReference + "/billings", params); }
[ "public", "JSONObject", "getByBuyersCompany", "(", "String", "buyerCompanyReference", ",", "HashMap", "<", "String", ",", "String", ">", "params", ")", "throws", "JSONException", "{", "return", "oClient", ".", "get", "(", "\"/finreports/v2/buyer_companies/\"", "+", ...
Generate Billing Reports for a Specific Buyer's Company @param buyerCompanyReference Buyer company reference @param params Parameters @throws JSONException If error occurred @return {@link JSONObject}
[ "Generate", "Billing", "Reports", "for", "a", "Specific", "Buyer", "s", "Company" ]
train
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Reports/Finance/Billings.java#L102-L104
openbase/jul
extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/MetaConfigProcessor.java
MetaConfigProcessor.getValue
public static String getValue(final MetaConfig metaConfig, final String key) throws NotAvailableException { for (EntryType.Entry entry : metaConfig.getEntryList()) { if (entry.getKey().equals(key)) { if (!entry.getValue().isEmpty()) { return entry.getValue(); } } } throw new NotAvailableException("value for Key[" + key + "]"); }
java
public static String getValue(final MetaConfig metaConfig, final String key) throws NotAvailableException { for (EntryType.Entry entry : metaConfig.getEntryList()) { if (entry.getKey().equals(key)) { if (!entry.getValue().isEmpty()) { return entry.getValue(); } } } throw new NotAvailableException("value for Key[" + key + "]"); }
[ "public", "static", "String", "getValue", "(", "final", "MetaConfig", "metaConfig", ",", "final", "String", "key", ")", "throws", "NotAvailableException", "{", "for", "(", "EntryType", ".", "Entry", "entry", ":", "metaConfig", ".", "getEntryList", "(", ")", ")...
Resolves the key to the value entry of the given meta config. @param metaConfig key value set @param key the key to resolve @return the related value of the given key. @throws org.openbase.jul.exception.NotAvailableException si thrown if not value for the given key could be resolved.
[ "Resolves", "the", "key", "to", "the", "value", "entry", "of", "the", "given", "meta", "config", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/MetaConfigProcessor.java#L46-L55
h2oai/h2o-3
h2o-genmodel/src/main/java/hex/genmodel/utils/GenmodelBitSet.java
GenmodelBitSet.fill_1
public void fill_1(byte[] v, int byteoff, int nbits, int bitoff) { if (nbits < 0) throw new NegativeArraySizeException("nbits < 0: " + nbits); if (byteoff < 0) throw new IndexOutOfBoundsException("byteoff < 0: "+ byteoff); if (bitoff < 0) throw new IndexOutOfBoundsException("bitoff < 0: " + bitoff); assert v == null || byteoff + ((nbits-1) >> 3) + 1 <= v.length; _val = v; _nbits = nbits; _bitoff = bitoff; _byteoff = byteoff; }
java
public void fill_1(byte[] v, int byteoff, int nbits, int bitoff) { if (nbits < 0) throw new NegativeArraySizeException("nbits < 0: " + nbits); if (byteoff < 0) throw new IndexOutOfBoundsException("byteoff < 0: "+ byteoff); if (bitoff < 0) throw new IndexOutOfBoundsException("bitoff < 0: " + bitoff); assert v == null || byteoff + ((nbits-1) >> 3) + 1 <= v.length; _val = v; _nbits = nbits; _bitoff = bitoff; _byteoff = byteoff; }
[ "public", "void", "fill_1", "(", "byte", "[", "]", "v", ",", "int", "byteoff", ",", "int", "nbits", ",", "int", "bitoff", ")", "{", "if", "(", "nbits", "<", "0", ")", "throw", "new", "NegativeArraySizeException", "(", "\"nbits < 0: \"", "+", "nbits", "...
/* SET IN STONE FOR MOJO VERSION "1.10" AND OLDER - DO NOT CHANGE
[ "/", "*", "SET", "IN", "STONE", "FOR", "MOJO", "VERSION", "1", ".", "10", "AND", "OLDER", "-", "DO", "NOT", "CHANGE" ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/utils/GenmodelBitSet.java#L86-L95
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/stats/IntCounter.java
IntCounter.incrementCount
public int incrementCount(E key, int count) { if (tempMInteger == null) { tempMInteger = new MutableInteger(); } MutableInteger oldMInteger = map.put(key, tempMInteger); totalCount += count; if (oldMInteger != null) { count += oldMInteger.intValue(); } tempMInteger.set(count); tempMInteger = oldMInteger; return count; }
java
public int incrementCount(E key, int count) { if (tempMInteger == null) { tempMInteger = new MutableInteger(); } MutableInteger oldMInteger = map.put(key, tempMInteger); totalCount += count; if (oldMInteger != null) { count += oldMInteger.intValue(); } tempMInteger.set(count); tempMInteger = oldMInteger; return count; }
[ "public", "int", "incrementCount", "(", "E", "key", ",", "int", "count", ")", "{", "if", "(", "tempMInteger", "==", "null", ")", "{", "tempMInteger", "=", "new", "MutableInteger", "(", ")", ";", "}", "MutableInteger", "oldMInteger", "=", "map", ".", "put...
Adds the given count to the current count for the given key. If the key hasn't been seen before, it is assumed to have count 0, and thus this method will set its count to the given amount. Negative increments are equivalent to calling <tt>decrementCount</tt>. <p/> To more conveniently increment the count by 1, use {@link #incrementCount(Object)}. <p/> To set a count to a specific value instead of incrementing it, use {@link #setCount(Object,int)}.
[ "Adds", "the", "given", "count", "to", "the", "current", "count", "for", "the", "given", "key", ".", "If", "the", "key", "hasn", "t", "been", "seen", "before", "it", "is", "assumed", "to", "have", "count", "0", "and", "thus", "this", "method", "will", ...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/IntCounter.java#L236-L250
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/search/aggregate/DBEntitySequenceFactory.java
DBEntitySequenceFactory.collectUninitializedEntities
private List<DBEntity> collectUninitializedEntities(DBEntity entity, final String category, final TableDefinition tableDef, final List<String> fields, final String link, final Map<ObjectID, LinkList> cache, final Set<ObjectID> keys, final DBEntitySequenceOptions options) { DBEntityCollector collector = new DBEntityCollector(entity) { @Override protected boolean visit(DBEntity entity, List<DBEntity> list){ if (entity.findIterator(category) == null) { ObjectID id = entity.id(); LinkList columns = cache.get(id); if (columns == null) { keys.add(id); list.add(entity); return (keys.size() < options.initialLinkBufferDimension); } DBLinkIterator linkIterator = new DBLinkIterator(entity, link, columns, m_options.linkBuffer, DBEntitySequenceFactory.this, category); entity.addIterator(category, new DBEntityIterator(tableDef, entity, linkIterator, fields, DBEntitySequenceFactory.this, category, m_options)); } return true; } }; return collector.collect(); }
java
private List<DBEntity> collectUninitializedEntities(DBEntity entity, final String category, final TableDefinition tableDef, final List<String> fields, final String link, final Map<ObjectID, LinkList> cache, final Set<ObjectID> keys, final DBEntitySequenceOptions options) { DBEntityCollector collector = new DBEntityCollector(entity) { @Override protected boolean visit(DBEntity entity, List<DBEntity> list){ if (entity.findIterator(category) == null) { ObjectID id = entity.id(); LinkList columns = cache.get(id); if (columns == null) { keys.add(id); list.add(entity); return (keys.size() < options.initialLinkBufferDimension); } DBLinkIterator linkIterator = new DBLinkIterator(entity, link, columns, m_options.linkBuffer, DBEntitySequenceFactory.this, category); entity.addIterator(category, new DBEntityIterator(tableDef, entity, linkIterator, fields, DBEntitySequenceFactory.this, category, m_options)); } return true; } }; return collector.collect(); }
[ "private", "List", "<", "DBEntity", ">", "collectUninitializedEntities", "(", "DBEntity", "entity", ",", "final", "String", "category", ",", "final", "TableDefinition", "tableDef", ",", "final", "List", "<", "String", ">", "fields", ",", "final", "String", "link...
Collects the entities to be initialized with the initial list of links using the link list bulk fetch. Visits all the entities buffered by the iterators of the same category. @param entity next entity to be returned by the iterator (must be initialized first) @param category the iterator category that will return the linked entities @param tableDef type of the linked entities @param fields scalar fields to be fetched by the linked entities iterators @param link link name @param cache link list cache. If the cache contains the requested link list, the visited entity is initialized with the cached list and skipped @param keys set of 'rows' to be fetched. The set will be filled by this method @param options limits the number of rows to be fetched @return list of entities to be initialized. The set of physical rows to be fetched is returned in the 'keys' set. The set size can less than the list size if the list contains duplicates
[ "Collects", "the", "entities", "to", "be", "initialized", "with", "the", "initial", "list", "of", "links", "using", "the", "link", "list", "bulk", "fetch", ".", "Visits", "all", "the", "entities", "buffered", "by", "the", "iterators", "of", "the", "same", ...
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/search/aggregate/DBEntitySequenceFactory.java#L315-L338
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/AbstractMultiDataSetNormalizer.java
AbstractMultiDataSetNormalizer.revertFeatures
public void revertFeatures(@NonNull INDArray features, INDArray mask, int input) { strategy.revert(features, mask, getFeatureStats(input)); }
java
public void revertFeatures(@NonNull INDArray features, INDArray mask, int input) { strategy.revert(features, mask, getFeatureStats(input)); }
[ "public", "void", "revertFeatures", "(", "@", "NonNull", "INDArray", "features", ",", "INDArray", "mask", ",", "int", "input", ")", "{", "strategy", ".", "revert", "(", "features", ",", "mask", ",", "getFeatureStats", "(", "input", ")", ")", ";", "}" ]
Undo (revert) the normalization applied by this normalizer to a specific features array. If labels normalization is disabled (i.e., {@link #isFitLabel()} == false) then this is a no-op. Can also be used to undo normalization for network output arrays, in the case of regression. @param features features arrays to revert the normalization on @param input the index of the array to revert
[ "Undo", "(", "revert", ")", "the", "normalization", "applied", "by", "this", "normalizer", "to", "a", "specific", "features", "array", ".", "If", "labels", "normalization", "is", "disabled", "(", "i", ".", "e", ".", "{", "@link", "#isFitLabel", "()", "}", ...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/AbstractMultiDataSetNormalizer.java#L235-L237
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java
ReminderDatePicker.setSelectedDate
public void setSelectedDate(int year, int month, int day) { dateSpinner.setSelectedDate(new GregorianCalendar(year, month, day)); // a custom selection has been set, don't select the default date: shouldSelectDefault = false; }
java
public void setSelectedDate(int year, int month, int day) { dateSpinner.setSelectedDate(new GregorianCalendar(year, month, day)); // a custom selection has been set, don't select the default date: shouldSelectDefault = false; }
[ "public", "void", "setSelectedDate", "(", "int", "year", ",", "int", "month", ",", "int", "day", ")", "{", "dateSpinner", ".", "setSelectedDate", "(", "new", "GregorianCalendar", "(", "year", ",", "month", ",", "day", ")", ")", ";", "// a custom selection ha...
Sets the Spinners' date selection as integers considering only day.
[ "Sets", "the", "Spinners", "date", "selection", "as", "integers", "considering", "only", "day", "." ]
train
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java#L259-L263
windup/windup
reporting/api/src/main/java/org/jboss/windup/reporting/config/classification/Classification.java
Classification.resolvePayload
@Override public FileModel resolvePayload(GraphRewrite event, EvaluationContext context, WindupVertexFrame payload) { checkVariableName(event, context); if (payload instanceof FileReferenceModel) { return ((FileReferenceModel) payload).getFile(); } if (payload instanceof FileModel) { return (FileModel) payload; } return null; }
java
@Override public FileModel resolvePayload(GraphRewrite event, EvaluationContext context, WindupVertexFrame payload) { checkVariableName(event, context); if (payload instanceof FileReferenceModel) { return ((FileReferenceModel) payload).getFile(); } if (payload instanceof FileModel) { return (FileModel) payload; } return null; }
[ "@", "Override", "public", "FileModel", "resolvePayload", "(", "GraphRewrite", "event", ",", "EvaluationContext", "context", ",", "WindupVertexFrame", "payload", ")", "{", "checkVariableName", "(", "event", ",", "context", ")", ";", "if", "(", "payload", "instance...
Set the payload to the fileModel of the given instance even though the variable is not directly referencing it. This is mainly to simplify the creation of the rule, when the FileModel itself is not being iterated but just a model referencing it.
[ "Set", "the", "payload", "to", "the", "fileModel", "of", "the", "given", "instance", "even", "though", "the", "variable", "is", "not", "directly", "referencing", "it", ".", "This", "is", "mainly", "to", "simplify", "the", "creation", "of", "the", "rule", "...
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/reporting/api/src/main/java/org/jboss/windup/reporting/config/classification/Classification.java#L102-L115
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/util/PathPattern.java
PathPattern.matches
public static boolean matches(Collection<PathPattern> patterns, List<String> path) { for (PathPattern pattern : patterns) if (pattern.matches(path)) return true; return false; }
java
public static boolean matches(Collection<PathPattern> patterns, List<String> path) { for (PathPattern pattern : patterns) if (pattern.matches(path)) return true; return false; }
[ "public", "static", "boolean", "matches", "(", "Collection", "<", "PathPattern", ">", "patterns", ",", "List", "<", "String", ">", "path", ")", "{", "for", "(", "PathPattern", "pattern", ":", "patterns", ")", "if", "(", "pattern", ".", "matches", "(", "p...
Return true if the given path elements match at least one of the given pattern.
[ "Return", "true", "if", "the", "given", "path", "elements", "match", "at", "least", "one", "of", "the", "given", "pattern", "." ]
train
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/util/PathPattern.java#L103-L108
phax/ph-css
ph-css/src/main/java/com/helger/css/handler/CSSHandler.java
CSSHandler.readDeclarationListFromNode
@Nonnull @Deprecated public static CSSDeclarationList readDeclarationListFromNode (@Nonnull final ECSSVersion eVersion, @Nonnull final CSSNode aNode) { return readDeclarationListFromNode (eVersion, aNode, CSSReader.getDefaultInterpretErrorHandler ()); }
java
@Nonnull @Deprecated public static CSSDeclarationList readDeclarationListFromNode (@Nonnull final ECSSVersion eVersion, @Nonnull final CSSNode aNode) { return readDeclarationListFromNode (eVersion, aNode, CSSReader.getDefaultInterpretErrorHandler ()); }
[ "@", "Nonnull", "@", "Deprecated", "public", "static", "CSSDeclarationList", "readDeclarationListFromNode", "(", "@", "Nonnull", "final", "ECSSVersion", "eVersion", ",", "@", "Nonnull", "final", "CSSNode", "aNode", ")", "{", "return", "readDeclarationListFromNode", "(...
Create a {@link CSSDeclarationList} object from a parsed object. @param eVersion The CSS version to use. May not be <code>null</code>. @param aNode The parsed CSS object to read. May not be <code>null</code>. @return Never <code>null</code>.
[ "Create", "a", "{", "@link", "CSSDeclarationList", "}", "object", "from", "a", "parsed", "object", "." ]
train
https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/handler/CSSHandler.java#L98-L104
apereo/cas
support/cas-server-support-mongo-core/src/main/java/org/apereo/cas/mongo/MongoDbConnectionFactory.java
MongoDbConnectionFactory.buildMongoDbClient
public static MongoClient buildMongoDbClient(final BaseMongoDbProperties mongo) { if (StringUtils.isNotBlank(mongo.getClientUri())) { LOGGER.debug("Using MongoDb client URI [{}] to connect to MongoDb instance", mongo.getClientUri()); return buildMongoDbClient(mongo.getClientUri(), buildMongoDbClientOptions(mongo)); } val serverAddresses = mongo.getHost().split(","); if (serverAddresses.length == 0) { throw new BeanCreationException("Unable to build a MongoDb client without any hosts/servers defined"); } List<ServerAddress> servers = new ArrayList<>(); if (serverAddresses.length > 1) { LOGGER.debug("Multiple MongoDb server addresses are defined. Ignoring port [{}], " + "assuming ports are defined as part of the address", mongo.getPort()); servers = Arrays.stream(serverAddresses) .filter(StringUtils::isNotBlank) .map(ServerAddress::new) .collect(Collectors.toList()); } else { val port = mongo.getPort() > 0 ? mongo.getPort() : DEFAULT_PORT; LOGGER.debug("Found single MongoDb server address [{}] using port [{}]", mongo.getHost(), port); val addr = new ServerAddress(mongo.getHost(), port); servers.add(addr); } val credential = buildMongoCredential(mongo); return new MongoClient(servers, CollectionUtils.wrap(credential), buildMongoDbClientOptions(mongo)); }
java
public static MongoClient buildMongoDbClient(final BaseMongoDbProperties mongo) { if (StringUtils.isNotBlank(mongo.getClientUri())) { LOGGER.debug("Using MongoDb client URI [{}] to connect to MongoDb instance", mongo.getClientUri()); return buildMongoDbClient(mongo.getClientUri(), buildMongoDbClientOptions(mongo)); } val serverAddresses = mongo.getHost().split(","); if (serverAddresses.length == 0) { throw new BeanCreationException("Unable to build a MongoDb client without any hosts/servers defined"); } List<ServerAddress> servers = new ArrayList<>(); if (serverAddresses.length > 1) { LOGGER.debug("Multiple MongoDb server addresses are defined. Ignoring port [{}], " + "assuming ports are defined as part of the address", mongo.getPort()); servers = Arrays.stream(serverAddresses) .filter(StringUtils::isNotBlank) .map(ServerAddress::new) .collect(Collectors.toList()); } else { val port = mongo.getPort() > 0 ? mongo.getPort() : DEFAULT_PORT; LOGGER.debug("Found single MongoDb server address [{}] using port [{}]", mongo.getHost(), port); val addr = new ServerAddress(mongo.getHost(), port); servers.add(addr); } val credential = buildMongoCredential(mongo); return new MongoClient(servers, CollectionUtils.wrap(credential), buildMongoDbClientOptions(mongo)); }
[ "public", "static", "MongoClient", "buildMongoDbClient", "(", "final", "BaseMongoDbProperties", "mongo", ")", "{", "if", "(", "StringUtils", ".", "isNotBlank", "(", "mongo", ".", "getClientUri", "(", ")", ")", ")", "{", "LOGGER", ".", "debug", "(", "\"Using Mo...
Build mongo db client. @param mongo the mongo @return the mongo client
[ "Build", "mongo", "db", "client", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-mongo-core/src/main/java/org/apereo/cas/mongo/MongoDbConnectionFactory.java#L276-L305
ReactiveX/RxApacheHttp
src/main/java/rx/apache/http/ObservableHttp.java
ObservableHttp.createRequest
public static ObservableHttp<ObservableHttpResponse> createRequest(final HttpAsyncRequestProducer requestProducer, final HttpAsyncClient client, final HttpContext context) { return ObservableHttp.create(new OnSubscribe<ObservableHttpResponse>() { @Override public void call(final Subscriber<? super ObservableHttpResponse> observer) { final CompositeSubscription parentSubscription = new CompositeSubscription(); observer.add(parentSubscription); // return a Subscription that wraps the Future so it can be cancelled parentSubscription.add(Subscriptions.from(client.execute(requestProducer, new ResponseConsumerDelegate(observer, parentSubscription), context, new FutureCallback<HttpResponse>() { @Override public void completed(HttpResponse result) { observer.onCompleted(); } @Override public void failed(Exception ex) { observer.onError(ex); } @Override public void cancelled() { observer.onCompleted(); } }))); } }); }
java
public static ObservableHttp<ObservableHttpResponse> createRequest(final HttpAsyncRequestProducer requestProducer, final HttpAsyncClient client, final HttpContext context) { return ObservableHttp.create(new OnSubscribe<ObservableHttpResponse>() { @Override public void call(final Subscriber<? super ObservableHttpResponse> observer) { final CompositeSubscription parentSubscription = new CompositeSubscription(); observer.add(parentSubscription); // return a Subscription that wraps the Future so it can be cancelled parentSubscription.add(Subscriptions.from(client.execute(requestProducer, new ResponseConsumerDelegate(observer, parentSubscription), context, new FutureCallback<HttpResponse>() { @Override public void completed(HttpResponse result) { observer.onCompleted(); } @Override public void failed(Exception ex) { observer.onError(ex); } @Override public void cancelled() { observer.onCompleted(); } }))); } }); }
[ "public", "static", "ObservableHttp", "<", "ObservableHttpResponse", ">", "createRequest", "(", "final", "HttpAsyncRequestProducer", "requestProducer", ",", "final", "HttpAsyncClient", "client", ",", "final", "HttpContext", "context", ")", "{", "return", "ObservableHttp",...
Execute request using {@link HttpAsyncRequestProducer} to define HTTP Method, URI and payload (if applicable). <p> If the response is chunked (or flushed progressively such as with <i>text/event-stream</i> <a href="http://www.w3.org/TR/2009/WD-eventsource-20091029/">Server-Sent Events</a>) this will call {@link Observer#onNext} multiple times. <p> Use {@code HttpAsyncMethods.create* } factory methods to create {@link HttpAsyncRequestProducer} instances. <p> A client can be retrieved like this: <p> <pre> {@code CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault(); } </pre> <p> A client with custom configurations can be created like this: </p> <pre> {@code final RequestConfig requestConfig = RequestConfig.custom() .setSocketTimeout(3000) .setConnectTimeout(3000).build(); final CloseableHttpAsyncClient httpclient = HttpAsyncClients.custom() .setDefaultRequestConfig(requestConfig) .setMaxConnPerRoute(20) .setMaxConnTotal(50) .build(); httpclient.start(); }</pre> @param requestProducer @param client @param context The HttpContext @return the observable HTTP response stream
[ "Execute", "request", "using", "{", "@link", "HttpAsyncRequestProducer", "}", "to", "define", "HTTP", "Method", "URI", "and", "payload", "(", "if", "applicable", ")", ".", "<p", ">", "If", "the", "response", "is", "chunked", "(", "or", "flushed", "progressiv...
train
https://github.com/ReactiveX/RxApacheHttp/blob/7494169cdc1199f11ca9744f18c28e6fcb694a6e/src/main/java/rx/apache/http/ObservableHttp.java#L174-L206
authlete/authlete-java-common
src/main/java/com/authlete/common/api/AuthleteApiImpl.java
AuthleteApiImpl.createBaseUrl
private static String createBaseUrl(AuthleteConfiguration configuration) { String baseUrl = configuration.getBaseUrl(); // If the configuration does not contain a base URL. if (baseUrl == null) { throw new IllegalArgumentException("The configuration does not have information about the base URL."); } try { // Check whether the format of the given URL is valid. new URL(baseUrl); } catch (MalformedURLException e) { // The format of the base URL is wrong. throw new IllegalArgumentException("The base URL is malformed.", e); } if (baseUrl.endsWith("/")) { // Drop the '/' at the end of the URL. return baseUrl.substring(0, baseUrl.length() - 1); } else { // Use the value of the base URL without modification. return baseUrl; } }
java
private static String createBaseUrl(AuthleteConfiguration configuration) { String baseUrl = configuration.getBaseUrl(); // If the configuration does not contain a base URL. if (baseUrl == null) { throw new IllegalArgumentException("The configuration does not have information about the base URL."); } try { // Check whether the format of the given URL is valid. new URL(baseUrl); } catch (MalformedURLException e) { // The format of the base URL is wrong. throw new IllegalArgumentException("The base URL is malformed.", e); } if (baseUrl.endsWith("/")) { // Drop the '/' at the end of the URL. return baseUrl.substring(0, baseUrl.length() - 1); } else { // Use the value of the base URL without modification. return baseUrl; } }
[ "private", "static", "String", "createBaseUrl", "(", "AuthleteConfiguration", "configuration", ")", "{", "String", "baseUrl", "=", "configuration", ".", "getBaseUrl", "(", ")", ";", "// If the configuration does not contain a base URL.", "if", "(", "baseUrl", "==", "nul...
Get 'Base URL' from the configuration. If the base URL ends with '/', it is dropped.
[ "Get", "Base", "URL", "from", "the", "configuration", ".", "If", "the", "base", "URL", "ends", "with", "/", "it", "is", "dropped", "." ]
train
https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/api/AuthleteApiImpl.java#L215-L246
looly/hutool
hutool-db/src/main/java/cn/hutool/db/nosql/mongo/MongoDS.java
MongoDS.initCloud
synchronized public void initCloud() { if (groups == null || groups.length == 0) { throw new DbRuntimeException("Please give replication set groups!"); } if (setting == null) { // 若未指定配置文件,则使用默认配置文件 setting = new Setting(MONGO_CONFIG_PATH, true); } final List<ServerAddress> addrList = new ArrayList<ServerAddress>(); for (String group : groups) { addrList.add(createServerAddress(group)); } final MongoCredential credentail = createCredentail(StrUtil.EMPTY); try { if (null == credentail) { mongo = new MongoClient(addrList, buildMongoClientOptions(StrUtil.EMPTY)); } else { mongo = new MongoClient(addrList, credentail, buildMongoClientOptions(StrUtil.EMPTY)); } } catch (Exception e) { log.error(e, "Init MongoDB connection error!"); return; } log.info("Init MongoDB cloud Set pool with connection to {}", addrList); }
java
synchronized public void initCloud() { if (groups == null || groups.length == 0) { throw new DbRuntimeException("Please give replication set groups!"); } if (setting == null) { // 若未指定配置文件,则使用默认配置文件 setting = new Setting(MONGO_CONFIG_PATH, true); } final List<ServerAddress> addrList = new ArrayList<ServerAddress>(); for (String group : groups) { addrList.add(createServerAddress(group)); } final MongoCredential credentail = createCredentail(StrUtil.EMPTY); try { if (null == credentail) { mongo = new MongoClient(addrList, buildMongoClientOptions(StrUtil.EMPTY)); } else { mongo = new MongoClient(addrList, credentail, buildMongoClientOptions(StrUtil.EMPTY)); } } catch (Exception e) { log.error(e, "Init MongoDB connection error!"); return; } log.info("Init MongoDB cloud Set pool with connection to {}", addrList); }
[ "synchronized", "public", "void", "initCloud", "(", ")", "{", "if", "(", "groups", "==", "null", "||", "groups", ".", "length", "==", "0", ")", "{", "throw", "new", "DbRuntimeException", "(", "\"Please give replication set groups!\"", ")", ";", "}", "if", "(...
初始化集群<br> 集群的其它客户端设定参数使用全局设定<br> 集群中每一个实例成员用一个group表示,例如: <pre> user = test1 pass = 123456 database = test [db0] host = 192.168.1.1:27117 [db1] host = 192.168.1.1:27118 [db2] host = 192.168.1.1:27119 </pre>
[ "初始化集群<br", ">", "集群的其它客户端设定参数使用全局设定<br", ">", "集群中每一个实例成员用一个group表示,例如:" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/nosql/mongo/MongoDS.java#L181-L209
motown-io/motown
ocpp/view-model/src/main/java/io/motown/ocpp/viewmodel/domain/DomainService.java
DomainService.changeConfiguration
public void changeConfiguration(ChargingStationId chargingStationId, ConfigurationItem configurationItem, CorrelationToken correlationToken, AddOnIdentity addOnIdentity) { IdentityContext identityContext = new IdentityContext(addOnIdentity, new NullUserIdentity()); commandGateway.send(new ChangeConfigurationItemCommand(chargingStationId, configurationItem, identityContext), correlationToken); }
java
public void changeConfiguration(ChargingStationId chargingStationId, ConfigurationItem configurationItem, CorrelationToken correlationToken, AddOnIdentity addOnIdentity) { IdentityContext identityContext = new IdentityContext(addOnIdentity, new NullUserIdentity()); commandGateway.send(new ChangeConfigurationItemCommand(chargingStationId, configurationItem, identityContext), correlationToken); }
[ "public", "void", "changeConfiguration", "(", "ChargingStationId", "chargingStationId", ",", "ConfigurationItem", "configurationItem", ",", "CorrelationToken", "correlationToken", ",", "AddOnIdentity", "addOnIdentity", ")", "{", "IdentityContext", "identityContext", "=", "new...
Change the configuration in the charging station. It has already happened on the physical charging station, but the Domain has not been updated yet. @param chargingStationId the charging station id. @param configurationItem the configuration item which has changed. @param correlationToken the token to correlate commands and events that belong together. @param addOnIdentity the identity of the add-on.
[ "Change", "the", "configuration", "in", "the", "charging", "station", ".", "It", "has", "already", "happened", "on", "the", "physical", "charging", "station", "but", "the", "Domain", "has", "not", "been", "updated", "yet", "." ]
train
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/ocpp/view-model/src/main/java/io/motown/ocpp/viewmodel/domain/DomainService.java#L353-L357
alkacon/opencms-core
src/org/opencms/jsp/util/CmsJspStandardContextBean.java
CmsJspStandardContextBean.getFunctionFormatFromContent
public Map<CmsJspContentAccessBean, CmsDynamicFunctionFormatWrapper> getFunctionFormatFromContent() { Transformer transformer = new Transformer() { @Override public Object transform(Object contentAccess) { CmsXmlContent content = (CmsXmlContent)(((CmsJspContentAccessBean)contentAccess).getRawContent()); CmsDynamicFunctionParser parser = new CmsDynamicFunctionParser(); CmsDynamicFunctionBean functionBean = null; try { functionBean = parser.parseFunctionBean(m_cms, content); } catch (CmsException e) { LOG.debug(e.getLocalizedMessage(), e); return new CmsDynamicFunctionFormatWrapper(m_cms, null); } String type = getContainer().getType(); String width = getContainer().getWidth(); int widthNum = -1; try { widthNum = Integer.parseInt(width); } catch (NumberFormatException e) { LOG.debug(e.getLocalizedMessage(), e); } CmsDynamicFunctionBean.Format format = functionBean.getFormatForContainer(m_cms, type, widthNum); CmsDynamicFunctionFormatWrapper wrapper = new CmsDynamicFunctionFormatWrapper(m_cms, format); return wrapper; } }; return CmsCollectionsGenericWrapper.createLazyMap(transformer); }
java
public Map<CmsJspContentAccessBean, CmsDynamicFunctionFormatWrapper> getFunctionFormatFromContent() { Transformer transformer = new Transformer() { @Override public Object transform(Object contentAccess) { CmsXmlContent content = (CmsXmlContent)(((CmsJspContentAccessBean)contentAccess).getRawContent()); CmsDynamicFunctionParser parser = new CmsDynamicFunctionParser(); CmsDynamicFunctionBean functionBean = null; try { functionBean = parser.parseFunctionBean(m_cms, content); } catch (CmsException e) { LOG.debug(e.getLocalizedMessage(), e); return new CmsDynamicFunctionFormatWrapper(m_cms, null); } String type = getContainer().getType(); String width = getContainer().getWidth(); int widthNum = -1; try { widthNum = Integer.parseInt(width); } catch (NumberFormatException e) { LOG.debug(e.getLocalizedMessage(), e); } CmsDynamicFunctionBean.Format format = functionBean.getFormatForContainer(m_cms, type, widthNum); CmsDynamicFunctionFormatWrapper wrapper = new CmsDynamicFunctionFormatWrapper(m_cms, format); return wrapper; } }; return CmsCollectionsGenericWrapper.createLazyMap(transformer); }
[ "public", "Map", "<", "CmsJspContentAccessBean", ",", "CmsDynamicFunctionFormatWrapper", ">", "getFunctionFormatFromContent", "(", ")", "{", "Transformer", "transformer", "=", "new", "Transformer", "(", ")", "{", "@", "Override", "public", "Object", "transform", "(", ...
Returns a lazy map which creates a wrapper object for a dynamic function format when given an XML content as a key.<p> @return a lazy map for accessing function formats for a content
[ "Returns", "a", "lazy", "map", "which", "creates", "a", "wrapper", "object", "for", "a", "dynamic", "function", "format", "when", "given", "an", "XML", "content", "as", "a", "key", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspStandardContextBean.java#L1123-L1153
sniggle/simple-pgp
simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java
BasePGPCommon.findPrivateKey
protected PGPPrivateKey findPrivateKey(InputStream secretKey, final String userId, String password) throws PGPException, IOException { LOGGER.trace("findPrivateKey(InputStream, String, String)"); LOGGER.trace("Secret Key: {}, User ID: {}, Password: {}", secretKey == null ? "not set" : "set", userId, password == null ? "not set" : "********"); return findPrivateKey(secretKey, password, new KeyFilter<PGPSecretKey>() { @Override public boolean accept(PGPSecretKey secretKey) { boolean result = false; Iterator<String> userIdIterator = secretKey.getUserIDs(); while (!result && userIdIterator.hasNext()) { result = userId.equals(userIdIterator.next()); } return result; } }); }
java
protected PGPPrivateKey findPrivateKey(InputStream secretKey, final String userId, String password) throws PGPException, IOException { LOGGER.trace("findPrivateKey(InputStream, String, String)"); LOGGER.trace("Secret Key: {}, User ID: {}, Password: {}", secretKey == null ? "not set" : "set", userId, password == null ? "not set" : "********"); return findPrivateKey(secretKey, password, new KeyFilter<PGPSecretKey>() { @Override public boolean accept(PGPSecretKey secretKey) { boolean result = false; Iterator<String> userIdIterator = secretKey.getUserIDs(); while (!result && userIdIterator.hasNext()) { result = userId.equals(userIdIterator.next()); } return result; } }); }
[ "protected", "PGPPrivateKey", "findPrivateKey", "(", "InputStream", "secretKey", ",", "final", "String", "userId", ",", "String", "password", ")", "throws", "PGPException", ",", "IOException", "{", "LOGGER", ".", "trace", "(", "\"findPrivateKey(InputStream, String, Stri...
read a private key and unlock it with the given password @param secretKey the secret key stream @param userId the required user id @param password the password to unlock the private key @return the applicable private key or null if none is found @throws PGPException @throws IOException
[ "read", "a", "private", "key", "and", "unlock", "it", "with", "the", "given", "password" ]
train
https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java#L190-L206
motown-io/motown
vas/view-model/src/main/java/io/motown/vas/viewmodel/VasEventHandler.java
VasEventHandler.updateLocationForChargingStation
private void updateLocationForChargingStation(ChargingStationId chargingStationId, Coordinates coordinates, Address address, Accessibility accessibility) { ChargingStation chargingStation = getChargingStation(chargingStationId); if (chargingStation != null) { if (coordinates != null) { chargingStation.setLatitude(coordinates.getLatitude()); chargingStation.setLongitude(coordinates.getLongitude()); } if (address != null) { chargingStation.setAddress(address.getAddressLine1()); chargingStation.setCity(address.getCity()); chargingStation.setCountry(address.getCountry()); chargingStation.setPostalCode(address.getPostalCode()); chargingStation.setRegion(address.getRegion()); } chargingStation.setAccessibility(accessibility.name()); chargingStationRepository.createOrUpdate(chargingStation); } }
java
private void updateLocationForChargingStation(ChargingStationId chargingStationId, Coordinates coordinates, Address address, Accessibility accessibility) { ChargingStation chargingStation = getChargingStation(chargingStationId); if (chargingStation != null) { if (coordinates != null) { chargingStation.setLatitude(coordinates.getLatitude()); chargingStation.setLongitude(coordinates.getLongitude()); } if (address != null) { chargingStation.setAddress(address.getAddressLine1()); chargingStation.setCity(address.getCity()); chargingStation.setCountry(address.getCountry()); chargingStation.setPostalCode(address.getPostalCode()); chargingStation.setRegion(address.getRegion()); } chargingStation.setAccessibility(accessibility.name()); chargingStationRepository.createOrUpdate(chargingStation); } }
[ "private", "void", "updateLocationForChargingStation", "(", "ChargingStationId", "chargingStationId", ",", "Coordinates", "coordinates", ",", "Address", "address", ",", "Accessibility", "accessibility", ")", "{", "ChargingStation", "chargingStation", "=", "getChargingStation"...
Updates the location of the charging station to either new lat/long coordinates or a geographical address (or both). If the charging station cannot be found in the repository an error is logged. @param chargingStationId charging station identifier. @param coordinates the lat/long coordinates of the charging station. @param address the geographical address of the charging station. @param accessibility the accessibility of the charging station.
[ "Updates", "the", "location", "of", "the", "charging", "station", "to", "either", "new", "lat", "/", "long", "coordinates", "or", "a", "geographical", "address", "(", "or", "both", ")", ".", "If", "the", "charging", "station", "cannot", "be", "found", "in"...
train
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/vas/view-model/src/main/java/io/motown/vas/viewmodel/VasEventHandler.java#L269-L291
sporniket/p3
src/main/java/com/sporniket/libre/p3/P3.java
P3.executeProgram
@SuppressWarnings("PMD.UnusedFormalParameter") private void executeProgram(String name, String source) throws Exception { List<Statement> _directives = executeProgram__compile(source); boolean _canProceed = !isAllowedOverrideRequired() || isAllowingOverride(); if (_canProceed && !_directives.isEmpty()) { executeProgram__parseDirectives(_directives); setAllowedOverrideRequired(true); } }
java
@SuppressWarnings("PMD.UnusedFormalParameter") private void executeProgram(String name, String source) throws Exception { List<Statement> _directives = executeProgram__compile(source); boolean _canProceed = !isAllowedOverrideRequired() || isAllowingOverride(); if (_canProceed && !_directives.isEmpty()) { executeProgram__parseDirectives(_directives); setAllowedOverrideRequired(true); } }
[ "@", "SuppressWarnings", "(", "\"PMD.UnusedFormalParameter\"", ")", "private", "void", "executeProgram", "(", "String", "name", ",", "String", "source", ")", "throws", "Exception", "{", "List", "<", "Statement", ">", "_directives", "=", "executeProgram__compile", "(...
The processor for extracting directives. @param name property name, unused. @param source the directives. @throws Exception when there is a problem.
[ "The", "processor", "for", "extracting", "directives", "." ]
train
https://github.com/sporniket/p3/blob/fc20b3066dc4a9cd759090adae0a6b02508df135/src/main/java/com/sporniket/libre/p3/P3.java#L536-L546
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java
SynchronousRequest.getWvWMatchInfo
public WvWMatch getWvWMatchInfo(int worldID, WvWMatch.Endpoint type) throws GuildWars2Exception { if (type == null) return getWvWMatchInfoUsingWorld(worldID); try { switch (type) { case All: return getWvWMatchInfoUsingWorld(worldID); case Overview: Response<WvWMatchOverview> overview = gw2API.getWvWMatchOverviewUsingWorld(Integer.toString(worldID)).execute(); if (!overview.isSuccessful()) throwError(overview.code(), overview.errorBody()); return overview.body(); case Stat: Response<WvWMatchStat> stat = gw2API.getWvWMatchStatUsingWorld(Integer.toString(worldID)).execute(); if (!stat.isSuccessful()) throwError(stat.code(), stat.errorBody()); return stat.body(); case Score: Response<WvWMatchScore> score = gw2API.getWvWMatchScoreUsingWorld(Integer.toString(worldID)).execute(); if (!score.isSuccessful()) throwError(score.code(), score.errorBody()); return score.body(); default: return getWvWMatchInfoUsingWorld(worldID); } } catch (IOException e) { throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); } }
java
public WvWMatch getWvWMatchInfo(int worldID, WvWMatch.Endpoint type) throws GuildWars2Exception { if (type == null) return getWvWMatchInfoUsingWorld(worldID); try { switch (type) { case All: return getWvWMatchInfoUsingWorld(worldID); case Overview: Response<WvWMatchOverview> overview = gw2API.getWvWMatchOverviewUsingWorld(Integer.toString(worldID)).execute(); if (!overview.isSuccessful()) throwError(overview.code(), overview.errorBody()); return overview.body(); case Stat: Response<WvWMatchStat> stat = gw2API.getWvWMatchStatUsingWorld(Integer.toString(worldID)).execute(); if (!stat.isSuccessful()) throwError(stat.code(), stat.errorBody()); return stat.body(); case Score: Response<WvWMatchScore> score = gw2API.getWvWMatchScoreUsingWorld(Integer.toString(worldID)).execute(); if (!score.isSuccessful()) throwError(score.code(), score.errorBody()); return score.body(); default: return getWvWMatchInfoUsingWorld(worldID); } } catch (IOException e) { throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); } }
[ "public", "WvWMatch", "getWvWMatchInfo", "(", "int", "worldID", ",", "WvWMatch", ".", "Endpoint", "type", ")", "throws", "GuildWars2Exception", "{", "if", "(", "type", "==", "null", ")", "return", "getWvWMatchInfoUsingWorld", "(", "worldID", ")", ";", "try", "...
For more info on WvW matches API go <a href="https://wiki.guildwars2.com/wiki/API:2/wvw/matches">here</a><br/> Get wvw match info using world id @param worldID {@link World#id} @param type endpoint type @return wvw match info, exact class depend on endpoint type @throws GuildWars2Exception see {@link ErrorCode} for detail @see WvWMatch wvw match info
[ "For", "more", "info", "on", "WvW", "matches", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "wvw", "/", "matches", ">", "here<", "/", "a", ">", "<br", "/", ">...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java#L3536-L3560
OpenLiberty/open-liberty
dev/com.ibm.ws.jca.cm/src/com/ibm/ws/jca/cm/ConnectorService.java
ConnectorService.logMessage
public static final void logMessage(Level level, String key, Object... args) { if (WsLevel.AUDIT.equals(level)) Tr.audit(tc, key, args); else if (WsLevel.ERROR.equals(level)) Tr.error(tc, key, args); else if (Level.INFO.equals(level)) Tr.info(tc, key, args); else if (Level.WARNING.equals(level)) Tr.warning(tc, key, args); else throw new UnsupportedOperationException(level.toString()); }
java
public static final void logMessage(Level level, String key, Object... args) { if (WsLevel.AUDIT.equals(level)) Tr.audit(tc, key, args); else if (WsLevel.ERROR.equals(level)) Tr.error(tc, key, args); else if (Level.INFO.equals(level)) Tr.info(tc, key, args); else if (Level.WARNING.equals(level)) Tr.warning(tc, key, args); else throw new UnsupportedOperationException(level.toString()); }
[ "public", "static", "final", "void", "logMessage", "(", "Level", "level", ",", "String", "key", ",", "Object", "...", "args", ")", "{", "if", "(", "WsLevel", ".", "AUDIT", ".", "equals", "(", "level", ")", ")", "Tr", ".", "audit", "(", "tc", ",", "...
Logs a message from the J2CAMessages file. @param key message key. @param args message parameters
[ "Logs", "a", "message", "from", "the", "J2CAMessages", "file", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ws/jca/cm/ConnectorService.java#L118-L129
Azure/azure-sdk-for-java
redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java
RedisInner.listUpgradeNotifications
public NotificationListResponseInner listUpgradeNotifications(String resourceGroupName, String name, double history) { return listUpgradeNotificationsWithServiceResponseAsync(resourceGroupName, name, history).toBlocking().single().body(); }
java
public NotificationListResponseInner listUpgradeNotifications(String resourceGroupName, String name, double history) { return listUpgradeNotificationsWithServiceResponseAsync(resourceGroupName, name, history).toBlocking().single().body(); }
[ "public", "NotificationListResponseInner", "listUpgradeNotifications", "(", "String", "resourceGroupName", ",", "String", "name", ",", "double", "history", ")", "{", "return", "listUpgradeNotificationsWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ",", "h...
Gets any upgrade notifications for a Redis cache. @param resourceGroupName The name of the resource group. @param name The name of the Redis cache. @param history how many minutes in past to look for upgrade notifications @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 NotificationListResponseInner object if successful.
[ "Gets", "any", "upgrade", "notifications", "for", "a", "Redis", "cache", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java#L245-L247
scireum/s3ninja
src/main/java/ninja/S3Dispatcher.java
S3Dispatcher.listObjects
private void listObjects(WebContext ctx, Bucket bucket) { int maxKeys = ctx.get("max-keys").asInt(1000); String marker = ctx.get("marker").asString(); String prefix = ctx.get("prefix").asString(); Response response = ctx.respondWith(); response.setHeader(HTTP_HEADER_NAME_CONTENT_TYPE, CONTENT_TYPE_XML); bucket.outputObjects(response.xml(), maxKeys, marker, prefix); }
java
private void listObjects(WebContext ctx, Bucket bucket) { int maxKeys = ctx.get("max-keys").asInt(1000); String marker = ctx.get("marker").asString(); String prefix = ctx.get("prefix").asString(); Response response = ctx.respondWith(); response.setHeader(HTTP_HEADER_NAME_CONTENT_TYPE, CONTENT_TYPE_XML); bucket.outputObjects(response.xml(), maxKeys, marker, prefix); }
[ "private", "void", "listObjects", "(", "WebContext", "ctx", ",", "Bucket", "bucket", ")", "{", "int", "maxKeys", "=", "ctx", ".", "get", "(", "\"max-keys\"", ")", ".", "asInt", "(", "1000", ")", ";", "String", "marker", "=", "ctx", ".", "get", "(", "...
Handles GET /bucket @param ctx the context describing the current request @param bucket the bucket of which the contents should be listed
[ "Handles", "GET", "/", "bucket" ]
train
https://github.com/scireum/s3ninja/blob/445eec55c91780267a7f987818b3fedecae009c5/src/main/java/ninja/S3Dispatcher.java#L459-L468
eclipse/xtext-core
org.eclipse.xtext/src-gen/org/eclipse/xtext/serializer/XtextSemanticSequencer.java
XtextSemanticSequencer.sequence_Disjunction
protected void sequence_Disjunction(ISerializationContext context, Disjunction semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, XtextPackage.Literals.COMPOSITE_CONDITION__LEFT) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XtextPackage.Literals.COMPOSITE_CONDITION__LEFT)); if (transientValues.isValueTransient(semanticObject, XtextPackage.Literals.COMPOSITE_CONDITION__RIGHT) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XtextPackage.Literals.COMPOSITE_CONDITION__RIGHT)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getDisjunctionAccess().getDisjunctionLeftAction_1_0(), semanticObject.getLeft()); feeder.accept(grammarAccess.getDisjunctionAccess().getRightConjunctionParserRuleCall_1_2_0(), semanticObject.getRight()); feeder.finish(); }
java
protected void sequence_Disjunction(ISerializationContext context, Disjunction semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, XtextPackage.Literals.COMPOSITE_CONDITION__LEFT) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XtextPackage.Literals.COMPOSITE_CONDITION__LEFT)); if (transientValues.isValueTransient(semanticObject, XtextPackage.Literals.COMPOSITE_CONDITION__RIGHT) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XtextPackage.Literals.COMPOSITE_CONDITION__RIGHT)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getDisjunctionAccess().getDisjunctionLeftAction_1_0(), semanticObject.getLeft()); feeder.accept(grammarAccess.getDisjunctionAccess().getRightConjunctionParserRuleCall_1_2_0(), semanticObject.getRight()); feeder.finish(); }
[ "protected", "void", "sequence_Disjunction", "(", "ISerializationContext", "context", ",", "Disjunction", "semanticObject", ")", "{", "if", "(", "errorAcceptor", "!=", "null", ")", "{", "if", "(", "transientValues", ".", "isValueTransient", "(", "semanticObject", ",...
Contexts: Disjunction returns Disjunction Disjunction.Disjunction_1_0 returns Disjunction Conjunction returns Disjunction Conjunction.Conjunction_1_0 returns Disjunction Negation returns Disjunction Atom returns Disjunction ParenthesizedCondition returns Disjunction Constraint: (left=Disjunction_Disjunction_1_0 right=Conjunction)
[ "Contexts", ":", "Disjunction", "returns", "Disjunction", "Disjunction", ".", "Disjunction_1_0", "returns", "Disjunction", "Conjunction", "returns", "Disjunction", "Conjunction", ".", "Conjunction_1_0", "returns", "Disjunction", "Negation", "returns", "Disjunction", "Atom",...
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src-gen/org/eclipse/xtext/serializer/XtextSemanticSequencer.java#L716-L727
lazy-koala/java-toolkit
fast-toolkit3d/src/main/java/com/thankjava/toolkit3d/core/fastjson/FastJson.java
FastJson.appendObject
public static <T> T appendObject(String json, T t) { @SuppressWarnings("unchecked") Class<T> clazz = (Class<T>) t.getClass(); T tNew = toObject(json, clazz); BeanCopierUtil.append(tNew, t); return tNew; }
java
public static <T> T appendObject(String json, T t) { @SuppressWarnings("unchecked") Class<T> clazz = (Class<T>) t.getClass(); T tNew = toObject(json, clazz); BeanCopierUtil.append(tNew, t); return tNew; }
[ "public", "static", "<", "T", ">", "T", "appendObject", "(", "String", "json", ",", "T", "t", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Class", "<", "T", ">", "clazz", "=", "(", "Class", "<", "T", ">", ")", "t", ".", "getClass"...
将会解析json字符串,并将json中解析的数据 append到对象t中,原对象t中的属性不会丢失 <p>Function: appendObject</p> <p>Description: </p> @param json @param t @return @author acexy@thankjava.com @date 2017年3月10日 下午3:01:58 @version 1.0
[ "将会解析json字符串,并将json中解析的数据", "append到对象t中,原对象t中的属性不会丢失", "<p", ">", "Function", ":", "appendObject<", "/", "p", ">", "<p", ">", "Description", ":", "<", "/", "p", ">" ]
train
https://github.com/lazy-koala/java-toolkit/blob/f46055fae0cc73049597a3708e515f5c6582d27a/fast-toolkit3d/src/main/java/com/thankjava/toolkit3d/core/fastjson/FastJson.java#L76-L82
jOOQ/jOOL
jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java
Unchecked.intSupplier
public static IntSupplier intSupplier(CheckedIntSupplier supplier, Consumer<Throwable> handler) { return () -> { try { return supplier.getAsInt(); } catch (Throwable e) { handler.accept(e); throw new IllegalStateException("Exception handler must throw a RuntimeException", e); } }; }
java
public static IntSupplier intSupplier(CheckedIntSupplier supplier, Consumer<Throwable> handler) { return () -> { try { return supplier.getAsInt(); } catch (Throwable e) { handler.accept(e); throw new IllegalStateException("Exception handler must throw a RuntimeException", e); } }; }
[ "public", "static", "IntSupplier", "intSupplier", "(", "CheckedIntSupplier", "supplier", ",", "Consumer", "<", "Throwable", ">", "handler", ")", "{", "return", "(", ")", "->", "{", "try", "{", "return", "supplier", ".", "getAsInt", "(", ")", ";", "}", "cat...
Wrap a {@link CheckedIntSupplier} in a {@link IntSupplier} with a custom handler for checked exceptions. <p> Example: <code><pre> ResultSet rs = statement.executeQuery(); Stream.generate(Unchecked.intSupplier( () -> rs.getInt(1), e -> { throw new IllegalStateException(e); } )); </pre></code>
[ "Wrap", "a", "{", "@link", "CheckedIntSupplier", "}", "in", "a", "{", "@link", "IntSupplier", "}", "with", "a", "custom", "handler", "for", "checked", "exceptions", ".", "<p", ">", "Example", ":", "<code", ">", "<pre", ">", "ResultSet", "rs", "=", "state...
train
https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L1733-L1744
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/AsCodeGen.java
AsCodeGen.writeResourceAdapter
private void writeResourceAdapter(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Get the resource adapter\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @return The handle\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public ResourceAdapter getResourceAdapter()"); writeLeftCurlyBracket(out, indent); writeLogging(def, out, indent + 1, "trace", "getResourceAdapter"); writeIndent(out, indent + 1); out.write("return ra;"); writeRightCurlyBracket(out, indent); writeEol(out); writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Set the resource adapter\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @param ra The handle\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public void setResourceAdapter(ResourceAdapter ra)"); writeLeftCurlyBracket(out, indent); writeLogging(def, out, indent + 1, "trace", "setResourceAdapter", "ra"); writeIndent(out, indent + 1); out.write("this.ra = ra;"); writeRightCurlyBracket(out, indent); writeEol(out); }
java
private void writeResourceAdapter(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Get the resource adapter\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @return The handle\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public ResourceAdapter getResourceAdapter()"); writeLeftCurlyBracket(out, indent); writeLogging(def, out, indent + 1, "trace", "getResourceAdapter"); writeIndent(out, indent + 1); out.write("return ra;"); writeRightCurlyBracket(out, indent); writeEol(out); writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Set the resource adapter\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @param ra The handle\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public void setResourceAdapter(ResourceAdapter ra)"); writeLeftCurlyBracket(out, indent); writeLogging(def, out, indent + 1, "trace", "setResourceAdapter", "ra"); writeIndent(out, indent + 1); out.write("this.ra = ra;"); writeRightCurlyBracket(out, indent); writeEol(out); }
[ "private", "void", "writeResourceAdapter", "(", "Definition", "def", ",", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/**\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", ...
Output ResourceAdapter method @param def definition @param out Writer @param indent space number @throws IOException ioException
[ "Output", "ResourceAdapter", "method" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/AsCodeGen.java#L237-L270
selenide/selenide
src/main/java/com/codeborne/selenide/SelenideTargetLocator.java
SelenideTargetLocator.windowByTitle
protected static WebDriver windowByTitle(WebDriver driver, String title) { Set<String> windowHandles = driver.getWindowHandles(); for (String windowHandle : windowHandles) { driver.switchTo().window(windowHandle); if (title.equals(driver.getTitle())) { return driver; } } throw new NoSuchWindowException("Window with title not found: " + title); }
java
protected static WebDriver windowByTitle(WebDriver driver, String title) { Set<String> windowHandles = driver.getWindowHandles(); for (String windowHandle : windowHandles) { driver.switchTo().window(windowHandle); if (title.equals(driver.getTitle())) { return driver; } } throw new NoSuchWindowException("Window with title not found: " + title); }
[ "protected", "static", "WebDriver", "windowByTitle", "(", "WebDriver", "driver", ",", "String", "title", ")", "{", "Set", "<", "String", ">", "windowHandles", "=", "driver", ".", "getWindowHandles", "(", ")", ";", "for", "(", "String", "windowHandle", ":", "...
Switch to window/tab by name/handle/title except some windows handles @param title title of window/tab
[ "Switch", "to", "window", "/", "tab", "by", "name", "/", "handle", "/", "title", "except", "some", "windows", "handles" ]
train
https://github.com/selenide/selenide/blob/b867baf171942cf07725d83a985237428569883f/src/main/java/com/codeborne/selenide/SelenideTargetLocator.java#L207-L217
box/box-java-sdk
src/main/java/com/box/sdk/EventLog.java
EventLog.getEnterpriseEvents
public static EventLog getEnterpriseEvents(BoxAPIConnection api, Date after, Date before, BoxEvent.Type... types) { return getEnterpriseEvents(api, null, after, before, ENTERPRISE_LIMIT, types); }
java
public static EventLog getEnterpriseEvents(BoxAPIConnection api, Date after, Date before, BoxEvent.Type... types) { return getEnterpriseEvents(api, null, after, before, ENTERPRISE_LIMIT, types); }
[ "public", "static", "EventLog", "getEnterpriseEvents", "(", "BoxAPIConnection", "api", ",", "Date", "after", ",", "Date", "before", ",", "BoxEvent", ".", "Type", "...", "types", ")", "{", "return", "getEnterpriseEvents", "(", "api", ",", "null", ",", "after", ...
Gets all the enterprise events that occurred within a specified date range. @param api the API connection to use. @param after the lower bound on the timestamp of the events returned. @param before the upper bound on the timestamp of the events returned. @param types an optional list of event types to filter by. @return a log of all the events that met the given criteria.
[ "Gets", "all", "the", "enterprise", "events", "that", "occurred", "within", "a", "specified", "date", "range", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/EventLog.java#L74-L76
jblas-project/jblas
src/main/java/org/jblas/ComplexDouble.java
ComplexDouble.muli
public ComplexDouble muli(ComplexDouble c, ComplexDouble result) { double newR = r * c.r - i * c.i; double newI = r * c.i + i * c.r; result.r = newR; result.i = newI; return result; }
java
public ComplexDouble muli(ComplexDouble c, ComplexDouble result) { double newR = r * c.r - i * c.i; double newI = r * c.i + i * c.r; result.r = newR; result.i = newI; return result; }
[ "public", "ComplexDouble", "muli", "(", "ComplexDouble", "c", ",", "ComplexDouble", "result", ")", "{", "double", "newR", "=", "r", "*", "c", ".", "r", "-", "i", "*", "c", ".", "i", ";", "double", "newI", "=", "r", "*", "c", ".", "i", "+", "i", ...
Multiply two complex numbers, in-place @param c other complex number @param result complex number where product is stored @return same as result
[ "Multiply", "two", "complex", "numbers", "in", "-", "place" ]
train
https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/ComplexDouble.java#L226-L232
bmelnychuk/AndroidTreeView
library/src/main/java/com/unnamed/b/atv/view/TwoDScrollView.java
TwoDScrollView.scrollAndFocus
private boolean scrollAndFocus(int directionY, int top, int bottom, int directionX, int left, int right) { boolean handled = true; int height = getHeight(); int containerTop = getScrollY(); int containerBottom = containerTop + height; boolean up = directionY == View.FOCUS_UP; int width = getWidth(); int containerLeft = getScrollX(); int containerRight = containerLeft + width; boolean leftwards = directionX == View.FOCUS_UP; View newFocused = findFocusableViewInBounds(up, top, bottom, leftwards, left, right); if (newFocused == null) { newFocused = this; } if ((top >= containerTop && bottom <= containerBottom) || (left >= containerLeft && right <= containerRight)) { handled = false; } else { int deltaY = up ? (top - containerTop) : (bottom - containerBottom); int deltaX = leftwards ? (left - containerLeft) : (right - containerRight); doScroll(deltaX, deltaY); } if (newFocused != findFocus() && newFocused.requestFocus(directionY)) { mTwoDScrollViewMovedFocus = true; mTwoDScrollViewMovedFocus = false; } return handled; }
java
private boolean scrollAndFocus(int directionY, int top, int bottom, int directionX, int left, int right) { boolean handled = true; int height = getHeight(); int containerTop = getScrollY(); int containerBottom = containerTop + height; boolean up = directionY == View.FOCUS_UP; int width = getWidth(); int containerLeft = getScrollX(); int containerRight = containerLeft + width; boolean leftwards = directionX == View.FOCUS_UP; View newFocused = findFocusableViewInBounds(up, top, bottom, leftwards, left, right); if (newFocused == null) { newFocused = this; } if ((top >= containerTop && bottom <= containerBottom) || (left >= containerLeft && right <= containerRight)) { handled = false; } else { int deltaY = up ? (top - containerTop) : (bottom - containerBottom); int deltaX = leftwards ? (left - containerLeft) : (right - containerRight); doScroll(deltaX, deltaY); } if (newFocused != findFocus() && newFocused.requestFocus(directionY)) { mTwoDScrollViewMovedFocus = true; mTwoDScrollViewMovedFocus = false; } return handled; }
[ "private", "boolean", "scrollAndFocus", "(", "int", "directionY", ",", "int", "top", ",", "int", "bottom", ",", "int", "directionX", ",", "int", "left", ",", "int", "right", ")", "{", "boolean", "handled", "=", "true", ";", "int", "height", "=", "getHeig...
<p>Scrolls the view to make the area defined by <code>top</code> and <code>bottom</code> visible. This method attempts to give the focus to a component visible in this area. If no component can be focused in the new visible area, the focus is reclaimed by this scrollview.</p> @param direction the scroll direction: {@link android.view.View#FOCUS_UP} to go upward {@link android.view.View#FOCUS_DOWN} to downward @param top the top offset of the new area to be made visible @param bottom the bottom offset of the new area to be made visible @return true if the key event is consumed by this method, false otherwise
[ "<p", ">", "Scrolls", "the", "view", "to", "make", "the", "area", "defined", "by", "<code", ">", "top<", "/", "code", ">", "and", "<code", ">", "bottom<", "/", "code", ">", "visible", ".", "This", "method", "attempts", "to", "give", "the", "focus", "...
train
https://github.com/bmelnychuk/AndroidTreeView/blob/d051ce75f5c9bd5206481808f6133b51f581c8f1/library/src/main/java/com/unnamed/b/atv/view/TwoDScrollView.java#L620-L646
facebookarchive/hadoop-20
src/core/org/apache/hadoop/filecache/DistributedCache.java
DistributedCache.getTimestamp
public static long getTimestamp(Configuration conf, URI cache) throws IOException { FileSystem fileSystem = FileSystem.get(cache, conf); Path filePath = new Path(cache.getPath()); return fileSystem.getFileStatus(filePath).getModificationTime(); }
java
public static long getTimestamp(Configuration conf, URI cache) throws IOException { FileSystem fileSystem = FileSystem.get(cache, conf); Path filePath = new Path(cache.getPath()); return fileSystem.getFileStatus(filePath).getModificationTime(); }
[ "public", "static", "long", "getTimestamp", "(", "Configuration", "conf", ",", "URI", "cache", ")", "throws", "IOException", "{", "FileSystem", "fileSystem", "=", "FileSystem", ".", "get", "(", "cache", ",", "conf", ")", ";", "Path", "filePath", "=", "new", ...
Returns mtime of a given cache file on hdfs. @param conf configuration @param cache cache file @return mtime of a given cache file on hdfs @throws IOException
[ "Returns", "mtime", "of", "a", "given", "cache", "file", "on", "hdfs", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L643-L649
alkacon/opencms-core
src/org/opencms/main/CmsSessionManager.java
CmsSessionManager.sendBroadcast
public void sendBroadcast(CmsObject cms, String message, boolean repeat) { if (CmsStringUtil.isEmptyOrWhitespaceOnly(message)) { // don't broadcast empty messages return; } // create the broadcast CmsBroadcast broadcast = new CmsBroadcast(cms.getRequestContext().getCurrentUser(), message, repeat); // send the broadcast to all authenticated sessions Iterator<CmsSessionInfo> i = m_sessionStorageProvider.getAll().iterator(); while (i.hasNext()) { CmsSessionInfo sessionInfo = i.next(); if (m_sessionStorageProvider.get(sessionInfo.getSessionId()) != null) { // double check for concurrent modification sessionInfo.getBroadcastQueue().add(broadcast); } } }
java
public void sendBroadcast(CmsObject cms, String message, boolean repeat) { if (CmsStringUtil.isEmptyOrWhitespaceOnly(message)) { // don't broadcast empty messages return; } // create the broadcast CmsBroadcast broadcast = new CmsBroadcast(cms.getRequestContext().getCurrentUser(), message, repeat); // send the broadcast to all authenticated sessions Iterator<CmsSessionInfo> i = m_sessionStorageProvider.getAll().iterator(); while (i.hasNext()) { CmsSessionInfo sessionInfo = i.next(); if (m_sessionStorageProvider.get(sessionInfo.getSessionId()) != null) { // double check for concurrent modification sessionInfo.getBroadcastQueue().add(broadcast); } } }
[ "public", "void", "sendBroadcast", "(", "CmsObject", "cms", ",", "String", "message", ",", "boolean", "repeat", ")", "{", "if", "(", "CmsStringUtil", ".", "isEmptyOrWhitespaceOnly", "(", "message", ")", ")", "{", "// don't broadcast empty messages", "return", ";",...
Sends a broadcast to all sessions of all currently authenticated users.<p> @param cms the OpenCms user context of the user sending the broadcast @param message the message to broadcast @param repeat repeat this message
[ "Sends", "a", "broadcast", "to", "all", "sessions", "of", "all", "currently", "authenticated", "users", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsSessionManager.java#L349-L367
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/ExpGammaDistribution.java
ExpGammaDistribution.quantile
public static double quantile(double p, double k, double theta, double shift) { return FastMath.log(GammaDistribution.quantile(p, k, 1)) / theta + shift; }
java
public static double quantile(double p, double k, double theta, double shift) { return FastMath.log(GammaDistribution.quantile(p, k, 1)) / theta + shift; }
[ "public", "static", "double", "quantile", "(", "double", "p", ",", "double", "k", ",", "double", "theta", ",", "double", "shift", ")", "{", "return", "FastMath", ".", "log", "(", "GammaDistribution", ".", "quantile", "(", "p", ",", "k", ",", "1", ")", ...
Compute probit (inverse cdf) for ExpGamma distributions. @param p Probability @param k k, alpha aka. "shape" parameter @param theta Theta = 1.0/Beta aka. "scaling" parameter @param shift Shift parameter @return Probit for ExpGamma distribution
[ "Compute", "probit", "(", "inverse", "cdf", ")", "for", "ExpGamma", "distributions", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/ExpGammaDistribution.java#L244-L246
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/SequenceMixin.java
SequenceMixin.sequenceEqualityIgnoreCase
public static <C extends Compound> boolean sequenceEqualityIgnoreCase(Sequence<C> source, Sequence<C> target) { return baseSequenceEquality(source, target, true); }
java
public static <C extends Compound> boolean sequenceEqualityIgnoreCase(Sequence<C> source, Sequence<C> target) { return baseSequenceEquality(source, target, true); }
[ "public", "static", "<", "C", "extends", "Compound", ">", "boolean", "sequenceEqualityIgnoreCase", "(", "Sequence", "<", "C", ">", "source", ",", "Sequence", "<", "C", ">", "target", ")", "{", "return", "baseSequenceEquality", "(", "source", ",", "target", "...
A case-insensitive manner of comparing two sequence objects together. We will throw out any compounds which fail to match on their sequence length & compound sets used. The code will also bail out the moment we find something is wrong with a Sequence. Cost to run is linear to the length of the Sequence. @param <C> The type of compound @param source Source sequence to assess @param target Target sequence to assess @return Boolean indicating if the sequences matched ignoring case
[ "A", "case", "-", "insensitive", "manner", "of", "comparing", "two", "sequence", "objects", "together", ".", "We", "will", "throw", "out", "any", "compounds", "which", "fail", "to", "match", "on", "their", "sequence", "length", "&", "compound", "sets", "used...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/SequenceMixin.java#L355-L357
spring-projects/spring-data-solr
src/main/java/org/springframework/data/solr/core/query/DefaultValueFunction.java
DefaultValueFunction.defaultValue
public static DefaultValueFunction defaultValue(Field field, Object defaultValue) { Assert.notNull(field, "Field must not be 'null' for default value operation."); return new DefaultValueFunction(field, defaultValue); }
java
public static DefaultValueFunction defaultValue(Field field, Object defaultValue) { Assert.notNull(field, "Field must not be 'null' for default value operation."); return new DefaultValueFunction(field, defaultValue); }
[ "public", "static", "DefaultValueFunction", "defaultValue", "(", "Field", "field", ",", "Object", "defaultValue", ")", "{", "Assert", ".", "notNull", "(", "field", ",", "\"Field must not be 'null' for default value operation.\"", ")", ";", "return", "new", "DefaultValue...
Creates new {@link DefaultValueFunction} representing {@code def(field.getName(), defaultValue))} @param field must not be null @param defaultValue must not be null @return
[ "Creates", "new", "{", "@link", "DefaultValueFunction", "}", "representing", "{", "@code", "def", "(", "field", ".", "getName", "()", "defaultValue", "))", "}" ]
train
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/query/DefaultValueFunction.java#L58-L63
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/types/TimecodeRange.java
TimecodeRange.add
public TimecodeRange add(SampleCount samples) { final Timecode newStart = start.add(samples); final Timecode newEnd = end.add(samples); return new TimecodeRange(newStart, newEnd); }
java
public TimecodeRange add(SampleCount samples) { final Timecode newStart = start.add(samples); final Timecode newEnd = end.add(samples); return new TimecodeRange(newStart, newEnd); }
[ "public", "TimecodeRange", "add", "(", "SampleCount", "samples", ")", "{", "final", "Timecode", "newStart", "=", "start", ".", "add", "(", "samples", ")", ";", "final", "Timecode", "newEnd", "=", "end", ".", "add", "(", "samples", ")", ";", "return", "ne...
Move the range right by the specified number of samples @param samples @return
[ "Move", "the", "range", "right", "by", "the", "specified", "number", "of", "samples" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/types/TimecodeRange.java#L100-L106
jboss/jboss-jsf-api_spec
src/main/java/javax/faces/webapp/UIComponentTag.java
UIComponentTag.createComponent
protected UIComponent createComponent(FacesContext context, String newId) { UIComponent component; Application application = context.getApplication(); if (binding != null) { ValueBinding vb = application.createValueBinding(binding); component = application.createComponent(vb, context, getComponentType()); component.setValueBinding("binding", vb); } else { component = application.createComponent(getComponentType()); } component.setId(newId); setProperties(component); return component; }
java
protected UIComponent createComponent(FacesContext context, String newId) { UIComponent component; Application application = context.getApplication(); if (binding != null) { ValueBinding vb = application.createValueBinding(binding); component = application.createComponent(vb, context, getComponentType()); component.setValueBinding("binding", vb); } else { component = application.createComponent(getComponentType()); } component.setId(newId); setProperties(component); return component; }
[ "protected", "UIComponent", "createComponent", "(", "FacesContext", "context", ",", "String", "newId", ")", "{", "UIComponent", "component", ";", "Application", "application", "=", "context", ".", "getApplication", "(", ")", ";", "if", "(", "binding", "!=", "nul...
<p>Implement <code>createComponent</code> using Faces 1.1 EL API.</p> @param context {@inheritDoc} @param newId {@inheritDoc}
[ "<p", ">", "Implement", "<code", ">", "createComponent<", "/", "code", ">", "using", "Faces", "1", ".", "1", "EL", "API", ".", "<", "/", "p", ">" ]
train
https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/webapp/UIComponentTag.java#L207-L223
httl/httl
httl/src/main/java/httl/spi/codecs/json/JSONArray.java
JSONArray.getInt
public int getInt(int index, int def) { Object tmp = mArray.get(index); return tmp != null && tmp instanceof Number ? ((Number) tmp).intValue() : def; }
java
public int getInt(int index, int def) { Object tmp = mArray.get(index); return tmp != null && tmp instanceof Number ? ((Number) tmp).intValue() : def; }
[ "public", "int", "getInt", "(", "int", "index", ",", "int", "def", ")", "{", "Object", "tmp", "=", "mArray", ".", "get", "(", "index", ")", ";", "return", "tmp", "!=", "null", "&&", "tmp", "instanceof", "Number", "?", "(", "(", "Number", ")", "tmp"...
get int value. @param index index. @param def default value. @return value or default value.
[ "get", "int", "value", "." ]
train
https://github.com/httl/httl/blob/e13e00f4ab41252a8f53d6dafd4a6610be9dcaad/httl/src/main/java/httl/spi/codecs/json/JSONArray.java#L62-L66
windup/windup
rules-xml/api/src/main/java/org/jboss/windup/rules/apps/xml/service/XmlFileService.java
XmlFileService.loadDocumentQuiet
public Document loadDocumentQuiet(GraphRewrite event, EvaluationContext context, XmlFileModel model) { try { return loadDocument(event, context, model); } catch(Exception ex) { return null; } }
java
public Document loadDocumentQuiet(GraphRewrite event, EvaluationContext context, XmlFileModel model) { try { return loadDocument(event, context, model); } catch(Exception ex) { return null; } }
[ "public", "Document", "loadDocumentQuiet", "(", "GraphRewrite", "event", ",", "EvaluationContext", "context", ",", "XmlFileModel", "model", ")", "{", "try", "{", "return", "loadDocument", "(", "event", ",", "context", ",", "model", ")", ";", "}", "catch", "(",...
Loads and parses the provided XML file. This will quietly fail (not throwing an {@link Exception}) and return null if it is unable to parse the provided {@link XmlFileModel}. A {@link ClassificationModel} will be created to indicate that this file failed to parse. @return Returns either the parsed {@link Document} or null if the {@link Document} could not be parsed
[ "Loads", "and", "parses", "the", "provided", "XML", "file", ".", "This", "will", "quietly", "fail", "(", "not", "throwing", "an", "{", "@link", "Exception", "}", ")", "and", "return", "null", "if", "it", "is", "unable", "to", "parse", "the", "provided", ...
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-xml/api/src/main/java/org/jboss/windup/rules/apps/xml/service/XmlFileService.java#L47-L57
FasterXML/woodstox
src/main/java/com/ctc/wstx/sr/InputElementStack.java
InputElementStack.createNonTransientNsContext
public BaseNsContext createNonTransientNsContext(Location loc) { // Have an instance we can reuse? Great! if (mLastNsContext != null) { return mLastNsContext; } // No namespaces declared at this point? Easy, as well: int totalNsSize = mNamespaces.size(); if (totalNsSize < 1) { return (mLastNsContext = EmptyNamespaceContext.getInstance()); } // Otherwise, we need to create a new non-empty context: int localCount = getCurrentNsCount() << 1; BaseNsContext nsCtxt = new CompactNsContext (loc, /*getDefaultNsURI(),*/ mNamespaces.asArray(), totalNsSize, totalNsSize - localCount); /* And it can be shared if there are no new ('local', ie. included * within this start element) bindings -- if there are, underlying * array might be shareable, but offsets wouldn't be) */ if (localCount == 0) { mLastNsContext = nsCtxt; } return nsCtxt; }
java
public BaseNsContext createNonTransientNsContext(Location loc) { // Have an instance we can reuse? Great! if (mLastNsContext != null) { return mLastNsContext; } // No namespaces declared at this point? Easy, as well: int totalNsSize = mNamespaces.size(); if (totalNsSize < 1) { return (mLastNsContext = EmptyNamespaceContext.getInstance()); } // Otherwise, we need to create a new non-empty context: int localCount = getCurrentNsCount() << 1; BaseNsContext nsCtxt = new CompactNsContext (loc, /*getDefaultNsURI(),*/ mNamespaces.asArray(), totalNsSize, totalNsSize - localCount); /* And it can be shared if there are no new ('local', ie. included * within this start element) bindings -- if there are, underlying * array might be shareable, but offsets wouldn't be) */ if (localCount == 0) { mLastNsContext = nsCtxt; } return nsCtxt; }
[ "public", "BaseNsContext", "createNonTransientNsContext", "(", "Location", "loc", ")", "{", "// Have an instance we can reuse? Great!", "if", "(", "mLastNsContext", "!=", "null", ")", "{", "return", "mLastNsContext", ";", "}", "// No namespaces declared at this point? Easy, a...
Method called to construct a non-transient NamespaceContext instance; generally needed when creating events to return from event-based iterators.
[ "Method", "called", "to", "construct", "a", "non", "-", "transient", "NamespaceContext", "instance", ";", "generally", "needed", "when", "creating", "events", "to", "return", "from", "event", "-", "based", "iterators", "." ]
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/InputElementStack.java#L289-L316
apache/groovy
src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java
IOGroovyMethods.setBytes
public static void setBytes(OutputStream os, byte[] bytes) throws IOException { try { os.write(bytes); } finally { closeWithWarning(os); } }
java
public static void setBytes(OutputStream os, byte[] bytes) throws IOException { try { os.write(bytes); } finally { closeWithWarning(os); } }
[ "public", "static", "void", "setBytes", "(", "OutputStream", "os", ",", "byte", "[", "]", "bytes", ")", "throws", "IOException", "{", "try", "{", "os", ".", "write", "(", "bytes", ")", ";", "}", "finally", "{", "closeWithWarning", "(", "os", ")", ";", ...
Write the byte[] to the output stream. The stream is closed before this method returns. @param os an output stream @param bytes the byte[] to write to the output stream @throws IOException if an IOException occurs. @since 1.7.1
[ "Write", "the", "byte", "[]", "to", "the", "output", "stream", ".", "The", "stream", "is", "closed", "before", "this", "method", "returns", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L909-L915
httl/httl
httl/src/main/java/httl/util/ConcurrentLinkedHashMap.java
ConcurrentLinkedHashMap.updateDrainedOrder
void updateDrainedOrder(Task[] tasks, int maxTaskIndex) { if (maxTaskIndex >= 0) { Task task = tasks[maxTaskIndex]; drainedOrder = task.getOrder() + 1; } }
java
void updateDrainedOrder(Task[] tasks, int maxTaskIndex) { if (maxTaskIndex >= 0) { Task task = tasks[maxTaskIndex]; drainedOrder = task.getOrder() + 1; } }
[ "void", "updateDrainedOrder", "(", "Task", "[", "]", "tasks", ",", "int", "maxTaskIndex", ")", "{", "if", "(", "maxTaskIndex", ">=", "0", ")", "{", "Task", "task", "=", "tasks", "[", "maxTaskIndex", "]", ";", "drainedOrder", "=", "task", ".", "getOrder",...
Updates the order to start the next drain from. @param tasks the ordered array of operations @param maxTaskIndex the maximum index of the array
[ "Updates", "the", "order", "to", "start", "the", "next", "drain", "from", "." ]
train
https://github.com/httl/httl/blob/e13e00f4ab41252a8f53d6dafd4a6610be9dcaad/httl/src/main/java/httl/util/ConcurrentLinkedHashMap.java#L549-L554
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/attribute/DefaultFeatureForm.java
DefaultFeatureForm.getValue
@Api public void getValue(String name, IntegerAttribute attribute) { attribute.setValue(toInteger(formWidget.getValue(name))); }
java
@Api public void getValue(String name, IntegerAttribute attribute) { attribute.setValue(toInteger(formWidget.getValue(name))); }
[ "@", "Api", "public", "void", "getValue", "(", "String", "name", ",", "IntegerAttribute", "attribute", ")", "{", "attribute", ".", "setValue", "(", "toInteger", "(", "formWidget", ".", "getValue", "(", "name", ")", ")", ")", ";", "}" ]
Get a integer value from the form, and place it in <code>attribute</code>. @param name attribute name @param attribute attribute to put value @since 1.11.1
[ "Get", "a", "integer", "value", "from", "the", "form", "and", "place", "it", "in", "<code", ">", "attribute<", "/", "code", ">", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/attribute/DefaultFeatureForm.java#L671-L674
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/ContextAwareTreeAppendable.java
ContextAwareTreeAppendable.defineContextualValue
@SuppressWarnings("unchecked") public <T> T defineContextualValue(String key, Object value) { return (T) this.values.put(key, value); }
java
@SuppressWarnings("unchecked") public <T> T defineContextualValue(String key, Object value) { return (T) this.values.put(key, value); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "defineContextualValue", "(", "String", "key", ",", "Object", "value", ")", "{", "return", "(", "T", ")", "this", ".", "values", ".", "put", "(", "key", ",", "value", ")"...
Define a contextual value. @param <T> the type of the value. @param key the name of the value. @param value the value itself. @return the previous value associated to the key, or {@code null} if none.
[ "Define", "a", "contextual", "value", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/ContextAwareTreeAppendable.java#L73-L76
pac4j/pac4j
pac4j-oauth/src/main/java/org/pac4j/oauth/profile/creator/OAuthProfileCreator.java
OAuthProfileCreator.sendRequestForData
protected String sendRequestForData(final S service, final T accessToken, final String dataUrl, Verb verb) { logger.debug("accessToken: {} / dataUrl: {}", accessToken, dataUrl); final long t0 = System.currentTimeMillis(); final OAuthRequest request = createOAuthRequest(dataUrl, verb); signRequest(service, accessToken, request); final String body; final int code; try { Response response = service.execute(request); code = response.getCode(); body = response.getBody(); } catch (final IOException | InterruptedException | ExecutionException e) { throw new HttpCommunicationException("Error getting body: " + e.getMessage()); } final long t1 = System.currentTimeMillis(); logger.debug("Request took: " + (t1 - t0) + " ms for: " + dataUrl); logger.debug("response code: {} / response body: {}", code, body); if (code != 200) { throw new HttpCommunicationException(code, body); } return body; }
java
protected String sendRequestForData(final S service, final T accessToken, final String dataUrl, Verb verb) { logger.debug("accessToken: {} / dataUrl: {}", accessToken, dataUrl); final long t0 = System.currentTimeMillis(); final OAuthRequest request = createOAuthRequest(dataUrl, verb); signRequest(service, accessToken, request); final String body; final int code; try { Response response = service.execute(request); code = response.getCode(); body = response.getBody(); } catch (final IOException | InterruptedException | ExecutionException e) { throw new HttpCommunicationException("Error getting body: " + e.getMessage()); } final long t1 = System.currentTimeMillis(); logger.debug("Request took: " + (t1 - t0) + " ms for: " + dataUrl); logger.debug("response code: {} / response body: {}", code, body); if (code != 200) { throw new HttpCommunicationException(code, body); } return body; }
[ "protected", "String", "sendRequestForData", "(", "final", "S", "service", ",", "final", "T", "accessToken", ",", "final", "String", "dataUrl", ",", "Verb", "verb", ")", "{", "logger", ".", "debug", "(", "\"accessToken: {} / dataUrl: {}\"", ",", "accessToken", "...
Make a request to get the data of the authenticated user for the provider. @param service the OAuth service @param accessToken the access token @param dataUrl url of the data @param verb method used to request data @return the user data response
[ "Make", "a", "request", "to", "get", "the", "data", "of", "the", "authenticated", "user", "for", "the", "provider", "." ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-oauth/src/main/java/org/pac4j/oauth/profile/creator/OAuthProfileCreator.java#L106-L127
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.listPrebuiltsAsync
public Observable<List<PrebuiltEntityExtractor>> listPrebuiltsAsync(UUID appId, String versionId, ListPrebuiltsOptionalParameter listPrebuiltsOptionalParameter) { return listPrebuiltsWithServiceResponseAsync(appId, versionId, listPrebuiltsOptionalParameter).map(new Func1<ServiceResponse<List<PrebuiltEntityExtractor>>, List<PrebuiltEntityExtractor>>() { @Override public List<PrebuiltEntityExtractor> call(ServiceResponse<List<PrebuiltEntityExtractor>> response) { return response.body(); } }); }
java
public Observable<List<PrebuiltEntityExtractor>> listPrebuiltsAsync(UUID appId, String versionId, ListPrebuiltsOptionalParameter listPrebuiltsOptionalParameter) { return listPrebuiltsWithServiceResponseAsync(appId, versionId, listPrebuiltsOptionalParameter).map(new Func1<ServiceResponse<List<PrebuiltEntityExtractor>>, List<PrebuiltEntityExtractor>>() { @Override public List<PrebuiltEntityExtractor> call(ServiceResponse<List<PrebuiltEntityExtractor>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "PrebuiltEntityExtractor", ">", ">", "listPrebuiltsAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "ListPrebuiltsOptionalParameter", "listPrebuiltsOptionalParameter", ")", "{", "return", "listPrebuiltsWithServiceRespo...
Gets information about the prebuilt entity models. @param appId The application ID. @param versionId The version ID. @param listPrebuiltsOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;PrebuiltEntityExtractor&gt; object
[ "Gets", "information", "about", "the", "prebuilt", "entity", "models", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L2210-L2217
michael-rapp/AndroidMaterialValidation
library/src/main/java/de/mrapp/android/validation/Validators.java
Validators.emailAddress
public static Validator<CharSequence> emailAddress(@NonNull final Context context) { return new EmailAddressValidator(context, R.string.default_error_message); }
java
public static Validator<CharSequence> emailAddress(@NonNull final Context context) { return new EmailAddressValidator(context, R.string.default_error_message); }
[ "public", "static", "Validator", "<", "CharSequence", ">", "emailAddress", "(", "@", "NonNull", "final", "Context", "context", ")", "{", "return", "new", "EmailAddressValidator", "(", "context", ",", "R", ".", "string", ".", "default_error_message", ")", ";", ...
Creates and returns a validator, which allows to validate texts to ensure, that they represent valid email addresses. Empty texts are also accepted. @param context The context, which should be used to retrieve the error message, as an instance of the class {@link Context}. The context may not be null @return The validator, which has been created, as an instance of the type {@link Validator}
[ "Creates", "and", "returns", "a", "validator", "which", "allows", "to", "validate", "texts", "to", "ensure", "that", "they", "represent", "valid", "email", "addresses", ".", "Empty", "texts", "are", "also", "accepted", "." ]
train
https://github.com/michael-rapp/AndroidMaterialValidation/blob/ac8693baeac7abddf2e38a47da4c1849d4661a8b/library/src/main/java/de/mrapp/android/validation/Validators.java#L1056-L1058
nightcode/yaranga
core/src/org/nightcode/common/net/http/MacAuthUtils.java
MacAuthUtils.getSignatureBaseString
public static String getSignatureBaseString(String nonce, String requestMethod, String headerHost, String requestUrl, @Nullable String payloadBodyHash, @Nullable String ext) throws AuthException { return nonce + '\n' + requestMethod.toUpperCase() + '\n' + normalizeUrl(headerHost, requestUrl) + '\n' + (payloadBodyHash != null ? payloadBodyHash : "") + '\n' + (ext != null ? ext : "") + '\n'; }
java
public static String getSignatureBaseString(String nonce, String requestMethod, String headerHost, String requestUrl, @Nullable String payloadBodyHash, @Nullable String ext) throws AuthException { return nonce + '\n' + requestMethod.toUpperCase() + '\n' + normalizeUrl(headerHost, requestUrl) + '\n' + (payloadBodyHash != null ? payloadBodyHash : "") + '\n' + (ext != null ? ext : "") + '\n'; }
[ "public", "static", "String", "getSignatureBaseString", "(", "String", "nonce", ",", "String", "requestMethod", ",", "String", "headerHost", ",", "String", "requestUrl", ",", "@", "Nullable", "String", "payloadBodyHash", ",", "@", "Nullable", "String", "ext", ")",...
Returns a signature base string. The signature base string is constructed by concatenating together, in order, the following HTTP request elements, each followed by a new line character (%x0A): 1. The nonce value generated for the request. 2. The HTTP request method in upper case. For example: "HEAD", "GET", "POST", etc. 3. The HTTP request-URI as defined by [RFC2616] section 5.1.2. 4. The hostname included in the HTTP request using the "Host" request header field in lower case. 5. The port as included in the HTTP request using the "Host" request header field. If the header field does not include a port, the default value for the scheme MUST be used (e.g. 80 for HTTP and 443 for HTTPS). 6. The request payload body hash as described in Section 3.2 if one was calculated and included in the request, otherwise, an empty string. Note that the body hash of an empty payload body is not an empty string. 7. The value of the "ext" "Authorization" request header field attribute if one was included in the request, otherwise, an empty string. Each element is followed by a new line character (%x0A) including the last element and even when an element value is an empty string. @see <a href="https://tools.ietf.org/html/draft-hammer-oauth-v2-mac-token-05#section-3.3.1">3.3.1. Normalized Request String</a> @param nonce the nonce value @param requestMethod the request method @param headerHost the "Host" request header field value @param requestUrl request url @param payloadBodyHash the request payload body hash @param ext the "ext" "Authorization" request header field attribute @return signature base string @throws AuthException if some of parameters has unacceptable value
[ "Returns", "a", "signature", "base", "string", "." ]
train
https://github.com/nightcode/yaranga/blob/f02cf8d8bcd365b6b1d55638938631a00e9ee808/core/src/org/nightcode/common/net/http/MacAuthUtils.java#L82-L89
sdl/odata
odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java
EntityDataModelUtil.getEntitySetByEntityTypeName
public static EntitySet getEntitySetByEntityTypeName(EntityDataModel entityDataModel, String entityTypeName) throws ODataEdmException { for (EntitySet entitySet : entityDataModel.getEntityContainer().getEntitySets()) { if (entitySet.getTypeName().equals(entityTypeName)) { return entitySet; } } throw new ODataSystemException("Entity set not found in the entity data model for type: " + entityTypeName); }
java
public static EntitySet getEntitySetByEntityTypeName(EntityDataModel entityDataModel, String entityTypeName) throws ODataEdmException { for (EntitySet entitySet : entityDataModel.getEntityContainer().getEntitySets()) { if (entitySet.getTypeName().equals(entityTypeName)) { return entitySet; } } throw new ODataSystemException("Entity set not found in the entity data model for type: " + entityTypeName); }
[ "public", "static", "EntitySet", "getEntitySetByEntityTypeName", "(", "EntityDataModel", "entityDataModel", ",", "String", "entityTypeName", ")", "throws", "ODataEdmException", "{", "for", "(", "EntitySet", "entitySet", ":", "entityDataModel", ".", "getEntityContainer", "...
Get the Entity Set for a given Entity Type name through the Entity Data Model. @param entityDataModel The Entity Data Model. @param entityTypeName The Entity Type name. @return The Entity Set. @throws ODataEdmException if unable to get entity set in entity data model
[ "Get", "the", "Entity", "Set", "for", "a", "given", "Entity", "Type", "name", "through", "the", "Entity", "Data", "Model", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java#L463-L471
OpenTSDB/opentsdb
src/meta/Annotation.java
Annotation.getAnnotation
public static Deferred<Annotation> getAnnotation(final TSDB tsdb, final String tsuid, final long start_time) { if (tsuid != null && !tsuid.isEmpty()) { return getAnnotation(tsdb, UniqueId.stringToUid(tsuid), start_time); } return getAnnotation(tsdb, (byte[])null, start_time); }
java
public static Deferred<Annotation> getAnnotation(final TSDB tsdb, final String tsuid, final long start_time) { if (tsuid != null && !tsuid.isEmpty()) { return getAnnotation(tsdb, UniqueId.stringToUid(tsuid), start_time); } return getAnnotation(tsdb, (byte[])null, start_time); }
[ "public", "static", "Deferred", "<", "Annotation", ">", "getAnnotation", "(", "final", "TSDB", "tsdb", ",", "final", "String", "tsuid", ",", "final", "long", "start_time", ")", "{", "if", "(", "tsuid", "!=", "null", "&&", "!", "tsuid", ".", "isEmpty", "(...
Attempts to fetch a global or local annotation from storage @param tsdb The TSDB to use for storage access @param tsuid The TSUID as a string. May be empty if retrieving a global annotation @param start_time The start time as a Unix epoch timestamp @return A valid annotation object if found, null if not
[ "Attempts", "to", "fetch", "a", "global", "or", "local", "annotation", "from", "storage" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/meta/Annotation.java#L244-L250
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java
ListWidget.setupHost
private void setupHost(ListItemHostWidget host, Widget view, final int dataIndex) { boolean selected = setupView(view, dataIndex); host.setGuest(view, dataIndex); host.setSelected(selected); host.requestLayout(); if (mContent.getChildren().contains(host)) { Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "setupItem(%s): added item(%s) at dataIndex [%d]", getName(), view.getName(), dataIndex); } else { Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "setupItem(%s): reuse item(%s) at dataIndex [%d]", getName(), view.getName(), dataIndex); } }
java
private void setupHost(ListItemHostWidget host, Widget view, final int dataIndex) { boolean selected = setupView(view, dataIndex); host.setGuest(view, dataIndex); host.setSelected(selected); host.requestLayout(); if (mContent.getChildren().contains(host)) { Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "setupItem(%s): added item(%s) at dataIndex [%d]", getName(), view.getName(), dataIndex); } else { Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "setupItem(%s): reuse item(%s) at dataIndex [%d]", getName(), view.getName(), dataIndex); } }
[ "private", "void", "setupHost", "(", "ListItemHostWidget", "host", ",", "Widget", "view", ",", "final", "int", "dataIndex", ")", "{", "boolean", "selected", "=", "setupView", "(", "view", ",", "dataIndex", ")", ";", "host", ".", "setGuest", "(", "view", ",...
Set up the view at specified position in {@link Adapter} @param dataIndex position in {@link Adapter} associated with this layout. @return host view
[ "Set", "up", "the", "view", "at", "specified", "position", "in", "{" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java#L930-L943
roboconf/roboconf-platform
core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/AgentUtils.java
AgentUtils.injectConfigurations
public static void injectConfigurations( String karafEtc, String applicationName, String scopedInstancePath, String domain, String ipAddress ) { File injectionDir = new File( karafEtc, INJECTED_CONFIGS_DIR ); if( injectionDir.isDirectory()) { for( File source : Utils.listAllFiles( injectionDir, ".cfg.tpl" )) { try { File target = new File( karafEtc, source.getName().replaceFirst( "\\.tpl$", "" )); // Do not overwrite the agent's configuration file (infinite configuration loop) if( Constants.KARAF_CFG_FILE_AGENT.equalsIgnoreCase( target.getName())) continue; String content = Utils.readFileContent( source ); content = content.replace( "<domain>", domain ); content = content.replace( "<application-name>", applicationName ); content = content.replace( "<scoped-instance-path>", scopedInstancePath ); content = content.replace( "<ip-address>", ipAddress ); Utils.writeStringInto( content, target ); } catch( IOException e ) { Logger logger = Logger.getLogger( AgentUtils.class.getName()); logger.severe( "A configuration file could not be injected from " + source.getName()); Utils.logException( logger, e ); } } } }
java
public static void injectConfigurations( String karafEtc, String applicationName, String scopedInstancePath, String domain, String ipAddress ) { File injectionDir = new File( karafEtc, INJECTED_CONFIGS_DIR ); if( injectionDir.isDirectory()) { for( File source : Utils.listAllFiles( injectionDir, ".cfg.tpl" )) { try { File target = new File( karafEtc, source.getName().replaceFirst( "\\.tpl$", "" )); // Do not overwrite the agent's configuration file (infinite configuration loop) if( Constants.KARAF_CFG_FILE_AGENT.equalsIgnoreCase( target.getName())) continue; String content = Utils.readFileContent( source ); content = content.replace( "<domain>", domain ); content = content.replace( "<application-name>", applicationName ); content = content.replace( "<scoped-instance-path>", scopedInstancePath ); content = content.replace( "<ip-address>", ipAddress ); Utils.writeStringInto( content, target ); } catch( IOException e ) { Logger logger = Logger.getLogger( AgentUtils.class.getName()); logger.severe( "A configuration file could not be injected from " + source.getName()); Utils.logException( logger, e ); } } } }
[ "public", "static", "void", "injectConfigurations", "(", "String", "karafEtc", ",", "String", "applicationName", ",", "String", "scopedInstancePath", ",", "String", "domain", ",", "String", "ipAddress", ")", "{", "File", "injectionDir", "=", "new", "File", "(", ...
Generates configuration files from templates. @param karafEtc Karaf's etc directory @param applicationName the application name @param scopedInstancePath the scoped instance path @param domain the domain @param ipAddress the IP address
[ "Generates", "configuration", "files", "from", "templates", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/AgentUtils.java#L272-L303
acromusashi/acromusashi-stream
src/main/java/acromusashi/stream/entity/StreamMessage.java
StreamMessage.addField
@SuppressWarnings({"unchecked", "rawtypes"}) public void addField(String key, Object value) { if (this.body == null || Map.class.isAssignableFrom(this.body.getClass()) == false) { this.body = Maps.newLinkedHashMap(); } ((Map) this.body).put(key, value); }
java
@SuppressWarnings({"unchecked", "rawtypes"}) public void addField(String key, Object value) { if (this.body == null || Map.class.isAssignableFrom(this.body.getClass()) == false) { this.body = Maps.newLinkedHashMap(); } ((Map) this.body).put(key, value); }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "public", "void", "addField", "(", "String", "key", ",", "Object", "value", ")", "{", "if", "(", "this", ".", "body", "==", "null", "||", "Map", ".", "class", ".", "isAs...
Add field to message body. @param key key @param value value
[ "Add", "field", "to", "message", "body", "." ]
train
https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/entity/StreamMessage.java#L94-L103
kiegroup/drools
drools-decisiontables/src/main/java/org/drools/decisiontable/parser/RuleSheetParserUtil.java
RuleSheetParserUtil.getVariableList
public static List<Global> getVariableList( final List<String> variableCells ){ final List<Global> variableList = new ArrayList<Global>(); if ( variableCells == null ) return variableList; for( String variableCell: variableCells ){ final StringTokenizer tokens = new StringTokenizer( variableCell, "," ); while ( tokens.hasMoreTokens() ) { final String token = tokens.nextToken(); final Global vars = new Global(); final StringTokenizer paramTokens = new StringTokenizer( token, " " ); vars.setClassName( paramTokens.nextToken() ); if ( !paramTokens.hasMoreTokens() ) { throw new DecisionTableParseException( "The format for global variables is incorrect. " + "It should be: [Class name, Class otherName]. But it was: [" + variableCell + "]" ); } vars.setIdentifier( paramTokens.nextToken() ); variableList.add( vars ); } } return variableList; }
java
public static List<Global> getVariableList( final List<String> variableCells ){ final List<Global> variableList = new ArrayList<Global>(); if ( variableCells == null ) return variableList; for( String variableCell: variableCells ){ final StringTokenizer tokens = new StringTokenizer( variableCell, "," ); while ( tokens.hasMoreTokens() ) { final String token = tokens.nextToken(); final Global vars = new Global(); final StringTokenizer paramTokens = new StringTokenizer( token, " " ); vars.setClassName( paramTokens.nextToken() ); if ( !paramTokens.hasMoreTokens() ) { throw new DecisionTableParseException( "The format for global variables is incorrect. " + "It should be: [Class name, Class otherName]. But it was: [" + variableCell + "]" ); } vars.setIdentifier( paramTokens.nextToken() ); variableList.add( vars ); } } return variableList; }
[ "public", "static", "List", "<", "Global", ">", "getVariableList", "(", "final", "List", "<", "String", ">", "variableCells", ")", "{", "final", "List", "<", "Global", ">", "variableList", "=", "new", "ArrayList", "<", "Global", ">", "(", ")", ";", "if",...
Create a list of Global model objects from cell contents. @param variableCella The cells containing text for all the global variables to set. @return A list of Variable classes, which can be added to the ruleset.
[ "Create", "a", "list", "of", "Global", "model", "objects", "from", "cell", "contents", "." ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-decisiontables/src/main/java/org/drools/decisiontable/parser/RuleSheetParserUtil.java#L72-L91
mygreen/excel-cellformatter
src/main/java/com/github/mygreen/cellformatter/LocaleSwitchFormatter.java
LocaleSwitchFormatter.register
public LocaleSwitchFormatter register(final CellFormatter cellFormatter, final Locale... locales) { ArgUtils.notNull(cellFormatter, "cellFormatter"); ArgUtils.notEmpty(locales, "locales"); for(Locale locale : locales) { formatterMap.put(locale, cellFormatter); } return this; }
java
public LocaleSwitchFormatter register(final CellFormatter cellFormatter, final Locale... locales) { ArgUtils.notNull(cellFormatter, "cellFormatter"); ArgUtils.notEmpty(locales, "locales"); for(Locale locale : locales) { formatterMap.put(locale, cellFormatter); } return this; }
[ "public", "LocaleSwitchFormatter", "register", "(", "final", "CellFormatter", "cellFormatter", ",", "final", "Locale", "...", "locales", ")", "{", "ArgUtils", ".", "notNull", "(", "cellFormatter", ",", "\"cellFormatter\"", ")", ";", "ArgUtils", ".", "notEmpty", "(...
ローケールとフォーマッタを登録する。 @param cellFormatter 登録対象のフォーマッタ。 @param locales 登録対象のロケール。複数指定可能。 @return 現在の自身のインスタンス。 @throws IllegalArgumentException {@literal cellFormatter == null.} @throws IllegalArgumentException {@literal locales == null || locales.length == 0.}
[ "ローケールとフォーマッタを登録する。" ]
train
https://github.com/mygreen/excel-cellformatter/blob/e802af273d49889500591e03799c9262cbf29185/src/main/java/com/github/mygreen/cellformatter/LocaleSwitchFormatter.java#L66-L75
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java
WSConnectionRequestInfoImpl.matchTypeMap
private final boolean matchTypeMap(WSConnectionRequestInfoImpl cri) { // At least one of the CRIs should know the default value. Map<String, Class<?>> defaultValue = defaultTypeMap == null ? cri.defaultTypeMap : defaultTypeMap; return matchTypeMap(ivTypeMap, cri.ivTypeMap) || ivTypeMap == null && matchTypeMap(defaultValue, cri.ivTypeMap) || cri.ivTypeMap == null && matchTypeMap(ivTypeMap, defaultValue); }
java
private final boolean matchTypeMap(WSConnectionRequestInfoImpl cri) { // At least one of the CRIs should know the default value. Map<String, Class<?>> defaultValue = defaultTypeMap == null ? cri.defaultTypeMap : defaultTypeMap; return matchTypeMap(ivTypeMap, cri.ivTypeMap) || ivTypeMap == null && matchTypeMap(defaultValue, cri.ivTypeMap) || cri.ivTypeMap == null && matchTypeMap(ivTypeMap, defaultValue); }
[ "private", "final", "boolean", "matchTypeMap", "(", "WSConnectionRequestInfoImpl", "cri", ")", "{", "// At least one of the CRIs should know the default value.", "Map", "<", "String", ",", "Class", "<", "?", ">", ">", "defaultValue", "=", "defaultTypeMap", "==", "null",...
Determine if the type map property matches. It is considered to match if - Both type map values are unspecified. - Both type map values are the same value. - One of the type map values is unspecified and the other CRI requested the default value. @return true if the type map values match, otherwise false.
[ "Determine", "if", "the", "type", "map", "property", "matches", ".", "It", "is", "considered", "to", "match", "if", "-", "Both", "type", "map", "values", "are", "unspecified", ".", "-", "Both", "type", "map", "values", "are", "the", "same", "value", ".",...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L659-L666