repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
Azure/azure-sdk-for-java
eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java
EventSubscriptionsInner.beginCreateOrUpdate
public EventSubscriptionInner beginCreateOrUpdate(String scope, String eventSubscriptionName, EventSubscriptionInner eventSubscriptionInfo) { """ Create or update an event subscription. Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope. @param scope The identifier of the resource to which the event subscription needs to be created or updated. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param eventSubscriptionName Name of the event subscription. Event subscription names must be between 3 and 64 characters in length and should use alphanumeric letters only. @param eventSubscriptionInfo Event subscription properties containing the destination and filter information @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 EventSubscriptionInner object if successful. """ return beginCreateOrUpdateWithServiceResponseAsync(scope, eventSubscriptionName, eventSubscriptionInfo).toBlocking().single().body(); }
java
public EventSubscriptionInner beginCreateOrUpdate(String scope, String eventSubscriptionName, EventSubscriptionInner eventSubscriptionInfo) { return beginCreateOrUpdateWithServiceResponseAsync(scope, eventSubscriptionName, eventSubscriptionInfo).toBlocking().single().body(); }
[ "public", "EventSubscriptionInner", "beginCreateOrUpdate", "(", "String", "scope", ",", "String", "eventSubscriptionName", ",", "EventSubscriptionInner", "eventSubscriptionInfo", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "scope", ",", "eventSubscriptionName", ",", "eventSubscriptionInfo", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Create or update an event subscription. Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope. @param scope The identifier of the resource to which the event subscription needs to be created or updated. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param eventSubscriptionName Name of the event subscription. Event subscription names must be between 3 and 64 characters in length and should use alphanumeric letters only. @param eventSubscriptionInfo Event subscription properties containing the destination and filter information @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 EventSubscriptionInner object if successful.
[ "Create", "or", "update", "an", "event", "subscription", ".", "Asynchronously", "creates", "a", "new", "event", "subscription", "or", "updates", "an", "existing", "event", "subscription", "based", "on", "the", "specified", "scope", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java#L313-L315
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.listMultiRoleUsagesAsync
public Observable<Page<UsageInner>> listMultiRoleUsagesAsync(final String resourceGroupName, final String name) { """ Get usage metrics for a multi-role pool of an App Service Environment. Get usage metrics for a multi-role pool of an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;UsageInner&gt; object """ return listMultiRoleUsagesWithServiceResponseAsync(resourceGroupName, name) .map(new Func1<ServiceResponse<Page<UsageInner>>, Page<UsageInner>>() { @Override public Page<UsageInner> call(ServiceResponse<Page<UsageInner>> response) { return response.body(); } }); }
java
public Observable<Page<UsageInner>> listMultiRoleUsagesAsync(final String resourceGroupName, final String name) { return listMultiRoleUsagesWithServiceResponseAsync(resourceGroupName, name) .map(new Func1<ServiceResponse<Page<UsageInner>>, Page<UsageInner>>() { @Override public Page<UsageInner> call(ServiceResponse<Page<UsageInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "UsageInner", ">", ">", "listMultiRoleUsagesAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ")", "{", "return", "listMultiRoleUsagesWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "UsageInner", ">", ">", ",", "Page", "<", "UsageInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "UsageInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "UsageInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Get usage metrics for a multi-role pool of an App Service Environment. Get usage metrics for a multi-role pool of an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;UsageInner&gt; object
[ "Get", "usage", "metrics", "for", "a", "multi", "-", "role", "pool", "of", "an", "App", "Service", "Environment", ".", "Get", "usage", "metrics", "for", "a", "multi", "-", "role", "pool", "of", "an", "App", "Service", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L3540-L3548
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/jetty/servlet/WebApplicationHandler.java
WebApplicationHandler.addFilterPathMapping
public FilterHolder addFilterPathMapping(String pathSpec, String filterName, int dispatches) { """ Add a mapping from a pathSpec to a Filter. @param pathSpec The path specification @param filterName The name of the filter (must already be added or defined) @param dispatches An integer formed by the logical OR of FilterHolder.__REQUEST, FilterHolder.__FORWARD,FilterHolder.__INCLUDE and/or FilterHolder.__ERROR. @return The holder of the filter instance. """ FilterHolder holder = (FilterHolder)_filterMap.get(filterName); if (holder==null) throw new IllegalArgumentException("unknown filter: "+filterName); FilterMapping mapping = new FilterMapping(pathSpec,holder,dispatches); _pathFilters.add(mapping); return holder; }
java
public FilterHolder addFilterPathMapping(String pathSpec, String filterName, int dispatches) { FilterHolder holder = (FilterHolder)_filterMap.get(filterName); if (holder==null) throw new IllegalArgumentException("unknown filter: "+filterName); FilterMapping mapping = new FilterMapping(pathSpec,holder,dispatches); _pathFilters.add(mapping); return holder; }
[ "public", "FilterHolder", "addFilterPathMapping", "(", "String", "pathSpec", ",", "String", "filterName", ",", "int", "dispatches", ")", "{", "FilterHolder", "holder", "=", "(", "FilterHolder", ")", "_filterMap", ".", "get", "(", "filterName", ")", ";", "if", "(", "holder", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"unknown filter: \"", "+", "filterName", ")", ";", "FilterMapping", "mapping", "=", "new", "FilterMapping", "(", "pathSpec", ",", "holder", ",", "dispatches", ")", ";", "_pathFilters", ".", "add", "(", "mapping", ")", ";", "return", "holder", ";", "}" ]
Add a mapping from a pathSpec to a Filter. @param pathSpec The path specification @param filterName The name of the filter (must already be added or defined) @param dispatches An integer formed by the logical OR of FilterHolder.__REQUEST, FilterHolder.__FORWARD,FilterHolder.__INCLUDE and/or FilterHolder.__ERROR. @return The holder of the filter instance.
[ "Add", "a", "mapping", "from", "a", "pathSpec", "to", "a", "Filter", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/jetty/servlet/WebApplicationHandler.java#L123-L132
nmorel/gwt-jackson
gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/CreatorUtils.java
CreatorUtils.findFirstEncounteredAnnotationsOnAllHierarchy
public static <T extends Annotation> Optional<T> findFirstEncounteredAnnotationsOnAllHierarchy( RebindConfiguration configuration, JClassType type, Class<T> annotation ) { """ Browse all the hierarchy of the type and return the first corresponding annotation it found @param type type @param annotation annotation to find @return the annotation if found, null otherwise @param configuration a {@link com.github.nmorel.gwtjackson.rebind.RebindConfiguration} object. @param <T> a T object. """ return findFirstEncounteredAnnotationsOnAllHierarchy( configuration, type, annotation, Optional.<JClassType>absent() ); }
java
public static <T extends Annotation> Optional<T> findFirstEncounteredAnnotationsOnAllHierarchy( RebindConfiguration configuration, JClassType type, Class<T> annotation ) { return findFirstEncounteredAnnotationsOnAllHierarchy( configuration, type, annotation, Optional.<JClassType>absent() ); }
[ "public", "static", "<", "T", "extends", "Annotation", ">", "Optional", "<", "T", ">", "findFirstEncounteredAnnotationsOnAllHierarchy", "(", "RebindConfiguration", "configuration", ",", "JClassType", "type", ",", "Class", "<", "T", ">", "annotation", ")", "{", "return", "findFirstEncounteredAnnotationsOnAllHierarchy", "(", "configuration", ",", "type", ",", "annotation", ",", "Optional", ".", "<", "JClassType", ">", "absent", "(", ")", ")", ";", "}" ]
Browse all the hierarchy of the type and return the first corresponding annotation it found @param type type @param annotation annotation to find @return the annotation if found, null otherwise @param configuration a {@link com.github.nmorel.gwtjackson.rebind.RebindConfiguration} object. @param <T> a T object.
[ "Browse", "all", "the", "hierarchy", "of", "the", "type", "and", "return", "the", "first", "corresponding", "annotation", "it", "found" ]
train
https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/CreatorUtils.java#L55-L58
theHilikus/JRoboCom
jrobocom-core/src/main/java/com/github/thehilikus/jrobocom/World.java
World.getBotsCount
public int getBotsCount(int teamId, boolean invert) { """ Get the total number of living robots from or not from a team @param teamId the team to search for @param invert if true, find robots NOT in teamId @return number of robots in the specified group """ int total = 0; for (Robot bot : robotsPosition.keySet()) { if (bot.getData().getTeamId() == teamId) { if (!invert) { total++; } } else { if (invert) { total++; } } } return total; }
java
public int getBotsCount(int teamId, boolean invert) { int total = 0; for (Robot bot : robotsPosition.keySet()) { if (bot.getData().getTeamId() == teamId) { if (!invert) { total++; } } else { if (invert) { total++; } } } return total; }
[ "public", "int", "getBotsCount", "(", "int", "teamId", ",", "boolean", "invert", ")", "{", "int", "total", "=", "0", ";", "for", "(", "Robot", "bot", ":", "robotsPosition", ".", "keySet", "(", ")", ")", "{", "if", "(", "bot", ".", "getData", "(", ")", ".", "getTeamId", "(", ")", "==", "teamId", ")", "{", "if", "(", "!", "invert", ")", "{", "total", "++", ";", "}", "}", "else", "{", "if", "(", "invert", ")", "{", "total", "++", ";", "}", "}", "}", "return", "total", ";", "}" ]
Get the total number of living robots from or not from a team @param teamId the team to search for @param invert if true, find robots NOT in teamId @return number of robots in the specified group
[ "Get", "the", "total", "number", "of", "living", "robots", "from", "or", "not", "from", "a", "team" ]
train
https://github.com/theHilikus/JRoboCom/blob/0e31c1ecf1006e35f68c229ff66c37640effffac/jrobocom-core/src/main/java/com/github/thehilikus/jrobocom/World.java#L301-L316
haraldk/TwelveMonkeys
servlet/src/main/java/com/twelvemonkeys/servlet/image/ContentNegotiationFilter.java
ContentNegotiationFilter.adjustQualityFromImage
private static void adjustQualityFromImage(Map<String, Float> pFormatQuality, BufferedImage pImage) { """ Adjusts source quality settings from image properties. @param pFormatQuality the format to quality mapping @param pImage the image """ // NOTE: The values are all made-up. May need tuning. // If pImage.getColorModel() instanceof IndexColorModel // JPEG qs*=0.6 // If NOT binary or 2 color index // WBMP qs*=0.5 // Else // GIF qs*=0.02 // PNG qs*=0.9 // JPEG is smaller/faster if (pImage.getColorModel() instanceof IndexColorModel) { adjustQuality(pFormatQuality, FORMAT_JPEG, 0.6f); if (pImage.getType() != BufferedImage.TYPE_BYTE_BINARY || ((IndexColorModel) pImage.getColorModel()).getMapSize() != 2) { adjustQuality(pFormatQuality, FORMAT_WBMP, 0.5f); } } else { adjustQuality(pFormatQuality, FORMAT_GIF, 0.01f); adjustQuality(pFormatQuality, FORMAT_PNG, 0.99f); // JPEG is smaller/faster } // If pImage.getColorModel().hasTransparentPixels() // JPEG qs*=0.05 // WBMP qs*=0.05 // If NOT transparency == BITMASK // GIF qs*=0.8 if (ImageUtil.hasTransparentPixels(pImage, true)) { adjustQuality(pFormatQuality, FORMAT_JPEG, 0.009f); adjustQuality(pFormatQuality, FORMAT_WBMP, 0.009f); if (pImage.getColorModel().getTransparency() != Transparency.BITMASK) { adjustQuality(pFormatQuality, FORMAT_GIF, 0.8f); } } }
java
private static void adjustQualityFromImage(Map<String, Float> pFormatQuality, BufferedImage pImage) { // NOTE: The values are all made-up. May need tuning. // If pImage.getColorModel() instanceof IndexColorModel // JPEG qs*=0.6 // If NOT binary or 2 color index // WBMP qs*=0.5 // Else // GIF qs*=0.02 // PNG qs*=0.9 // JPEG is smaller/faster if (pImage.getColorModel() instanceof IndexColorModel) { adjustQuality(pFormatQuality, FORMAT_JPEG, 0.6f); if (pImage.getType() != BufferedImage.TYPE_BYTE_BINARY || ((IndexColorModel) pImage.getColorModel()).getMapSize() != 2) { adjustQuality(pFormatQuality, FORMAT_WBMP, 0.5f); } } else { adjustQuality(pFormatQuality, FORMAT_GIF, 0.01f); adjustQuality(pFormatQuality, FORMAT_PNG, 0.99f); // JPEG is smaller/faster } // If pImage.getColorModel().hasTransparentPixels() // JPEG qs*=0.05 // WBMP qs*=0.05 // If NOT transparency == BITMASK // GIF qs*=0.8 if (ImageUtil.hasTransparentPixels(pImage, true)) { adjustQuality(pFormatQuality, FORMAT_JPEG, 0.009f); adjustQuality(pFormatQuality, FORMAT_WBMP, 0.009f); if (pImage.getColorModel().getTransparency() != Transparency.BITMASK) { adjustQuality(pFormatQuality, FORMAT_GIF, 0.8f); } } }
[ "private", "static", "void", "adjustQualityFromImage", "(", "Map", "<", "String", ",", "Float", ">", "pFormatQuality", ",", "BufferedImage", "pImage", ")", "{", "// NOTE: The values are all made-up. May need tuning.\r", "// If pImage.getColorModel() instanceof IndexColorModel\r", "// JPEG qs*=0.6\r", "// If NOT binary or 2 color index\r", "// WBMP qs*=0.5\r", "// Else\r", "// GIF qs*=0.02\r", "// PNG qs*=0.9 // JPEG is smaller/faster\r", "if", "(", "pImage", ".", "getColorModel", "(", ")", "instanceof", "IndexColorModel", ")", "{", "adjustQuality", "(", "pFormatQuality", ",", "FORMAT_JPEG", ",", "0.6f", ")", ";", "if", "(", "pImage", ".", "getType", "(", ")", "!=", "BufferedImage", ".", "TYPE_BYTE_BINARY", "||", "(", "(", "IndexColorModel", ")", "pImage", ".", "getColorModel", "(", ")", ")", ".", "getMapSize", "(", ")", "!=", "2", ")", "{", "adjustQuality", "(", "pFormatQuality", ",", "FORMAT_WBMP", ",", "0.5f", ")", ";", "}", "}", "else", "{", "adjustQuality", "(", "pFormatQuality", ",", "FORMAT_GIF", ",", "0.01f", ")", ";", "adjustQuality", "(", "pFormatQuality", ",", "FORMAT_PNG", ",", "0.99f", ")", ";", "// JPEG is smaller/faster\r", "}", "// If pImage.getColorModel().hasTransparentPixels()\r", "// JPEG qs*=0.05\r", "// WBMP qs*=0.05\r", "// If NOT transparency == BITMASK\r", "// GIF qs*=0.8\r", "if", "(", "ImageUtil", ".", "hasTransparentPixels", "(", "pImage", ",", "true", ")", ")", "{", "adjustQuality", "(", "pFormatQuality", ",", "FORMAT_JPEG", ",", "0.009f", ")", ";", "adjustQuality", "(", "pFormatQuality", ",", "FORMAT_WBMP", ",", "0.009f", ")", ";", "if", "(", "pImage", ".", "getColorModel", "(", ")", ".", "getTransparency", "(", ")", "!=", "Transparency", ".", "BITMASK", ")", "{", "adjustQuality", "(", "pFormatQuality", ",", "FORMAT_GIF", ",", "0.8f", ")", ";", "}", "}", "}" ]
Adjusts source quality settings from image properties. @param pFormatQuality the format to quality mapping @param pImage the image
[ "Adjusts", "source", "quality", "settings", "from", "image", "properties", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/image/ContentNegotiationFilter.java#L375-L410
molgenis/molgenis
molgenis-core-ui/src/main/java/org/molgenis/core/ui/MolgenisMenuController.java
MolgenisMenuController.forwardMenuPlugin
@SuppressWarnings("squid:S3752") // multiple methods required @RequestMapping( method = { """ Forwards to the specified plugin in the specified menu. This may be a submenu. Only the last two levels of the possibly very deep menu tree are used to construct the URL. @param menuId ID of the menu parent of the pluginID @param pluginId ID of the plugin """RequestMethod.GET, RequestMethod.POST}, value = "/{menuId}/{pluginId}/**") public String forwardMenuPlugin( HttpServletRequest request, @Valid @NotNull @PathVariable String menuId, @Valid @NotNull @PathVariable String pluginId, Model model) { String contextUri = URI + '/' + menuId + '/' + pluginId; String mappingUri = (String) (request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE)); String remainder = mappingUri.substring(contextUri.length()); model.addAttribute(KEY_MENU_ID, menuId); addModelAttributes(model, contextUri); return getForwardPluginUri(pluginId, remainder); }
java
@SuppressWarnings("squid:S3752") // multiple methods required @RequestMapping( method = {RequestMethod.GET, RequestMethod.POST}, value = "/{menuId}/{pluginId}/**") public String forwardMenuPlugin( HttpServletRequest request, @Valid @NotNull @PathVariable String menuId, @Valid @NotNull @PathVariable String pluginId, Model model) { String contextUri = URI + '/' + menuId + '/' + pluginId; String mappingUri = (String) (request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE)); String remainder = mappingUri.substring(contextUri.length()); model.addAttribute(KEY_MENU_ID, menuId); addModelAttributes(model, contextUri); return getForwardPluginUri(pluginId, remainder); }
[ "@", "SuppressWarnings", "(", "\"squid:S3752\"", ")", "// multiple methods required", "@", "RequestMapping", "(", "method", "=", "{", "RequestMethod", ".", "GET", ",", "RequestMethod", ".", "POST", "}", ",", "value", "=", "\"/{menuId}/{pluginId}/**\"", ")", "public", "String", "forwardMenuPlugin", "(", "HttpServletRequest", "request", ",", "@", "Valid", "@", "NotNull", "@", "PathVariable", "String", "menuId", ",", "@", "Valid", "@", "NotNull", "@", "PathVariable", "String", "pluginId", ",", "Model", "model", ")", "{", "String", "contextUri", "=", "URI", "+", "'", "'", "+", "menuId", "+", "'", "'", "+", "pluginId", ";", "String", "mappingUri", "=", "(", "String", ")", "(", "request", ".", "getAttribute", "(", "HandlerMapping", ".", "PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE", ")", ")", ";", "String", "remainder", "=", "mappingUri", ".", "substring", "(", "contextUri", ".", "length", "(", ")", ")", ";", "model", ".", "addAttribute", "(", "KEY_MENU_ID", ",", "menuId", ")", ";", "addModelAttributes", "(", "model", ",", "contextUri", ")", ";", "return", "getForwardPluginUri", "(", "pluginId", ",", "remainder", ")", ";", "}" ]
Forwards to the specified plugin in the specified menu. This may be a submenu. Only the last two levels of the possibly very deep menu tree are used to construct the URL. @param menuId ID of the menu parent of the pluginID @param pluginId ID of the plugin
[ "Forwards", "to", "the", "specified", "plugin", "in", "the", "specified", "menu", ".", "This", "may", "be", "a", "submenu", ".", "Only", "the", "last", "two", "levels", "of", "the", "possibly", "very", "deep", "menu", "tree", "are", "used", "to", "construct", "the", "URL", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-core-ui/src/main/java/org/molgenis/core/ui/MolgenisMenuController.java#L153-L170
FedericoPecora/meta-csp-framework
src/main/java/org/metacsp/multi/spatial/blockAlgebra/BlockConstraintSolver.java
BlockConstraintSolver.extractBoundingBoxesFromSTPs
public BoundingBox extractBoundingBoxesFromSTPs(RectangularCuboidRegion rect) { """ Extracts a specific {@link BoundingBox} from the domain of a {@link RectangularRegion}. @param rect The {@link RectangularRegion} from to extract the {@link BoundingBox}. @return A specific {@link BoundingBox} from the domain of a {@link RectangularRegion}. """ Bounds xLB, xUB, yLB, yUB, zLB, zUB; xLB = new Bounds(((AllenInterval)rect.getInternalVariables()[0]).getEST(),((AllenInterval)rect.getInternalVariables()[0]).getLST()); xUB = new Bounds(((AllenInterval)rect.getInternalVariables()[0]).getEET(),((AllenInterval)rect.getInternalVariables()[0]).getLET()); yLB = new Bounds(((AllenInterval)rect.getInternalVariables()[1]).getEST(),((AllenInterval)rect.getInternalVariables()[1]).getLST()); yUB = new Bounds(((AllenInterval)rect.getInternalVariables()[1]).getEET(),((AllenInterval)rect.getInternalVariables()[1]).getLET()); zLB = new Bounds(((AllenInterval)rect.getInternalVariables()[2]).getEST(),((AllenInterval)rect.getInternalVariables()[2]).getLST()); zUB = new Bounds(((AllenInterval)rect.getInternalVariables()[2]).getEET(),((AllenInterval)rect.getInternalVariables()[2]).getLET()); return new BoundingBox(xLB, xUB, yLB, yUB, zLB, zUB); }
java
public BoundingBox extractBoundingBoxesFromSTPs(RectangularCuboidRegion rect){ Bounds xLB, xUB, yLB, yUB, zLB, zUB; xLB = new Bounds(((AllenInterval)rect.getInternalVariables()[0]).getEST(),((AllenInterval)rect.getInternalVariables()[0]).getLST()); xUB = new Bounds(((AllenInterval)rect.getInternalVariables()[0]).getEET(),((AllenInterval)rect.getInternalVariables()[0]).getLET()); yLB = new Bounds(((AllenInterval)rect.getInternalVariables()[1]).getEST(),((AllenInterval)rect.getInternalVariables()[1]).getLST()); yUB = new Bounds(((AllenInterval)rect.getInternalVariables()[1]).getEET(),((AllenInterval)rect.getInternalVariables()[1]).getLET()); zLB = new Bounds(((AllenInterval)rect.getInternalVariables()[2]).getEST(),((AllenInterval)rect.getInternalVariables()[2]).getLST()); zUB = new Bounds(((AllenInterval)rect.getInternalVariables()[2]).getEET(),((AllenInterval)rect.getInternalVariables()[2]).getLET()); return new BoundingBox(xLB, xUB, yLB, yUB, zLB, zUB); }
[ "public", "BoundingBox", "extractBoundingBoxesFromSTPs", "(", "RectangularCuboidRegion", "rect", ")", "{", "Bounds", "xLB", ",", "xUB", ",", "yLB", ",", "yUB", ",", "zLB", ",", "zUB", ";", "xLB", "=", "new", "Bounds", "(", "(", "(", "AllenInterval", ")", "rect", ".", "getInternalVariables", "(", ")", "[", "0", "]", ")", ".", "getEST", "(", ")", ",", "(", "(", "AllenInterval", ")", "rect", ".", "getInternalVariables", "(", ")", "[", "0", "]", ")", ".", "getLST", "(", ")", ")", ";", "xUB", "=", "new", "Bounds", "(", "(", "(", "AllenInterval", ")", "rect", ".", "getInternalVariables", "(", ")", "[", "0", "]", ")", ".", "getEET", "(", ")", ",", "(", "(", "AllenInterval", ")", "rect", ".", "getInternalVariables", "(", ")", "[", "0", "]", ")", ".", "getLET", "(", ")", ")", ";", "yLB", "=", "new", "Bounds", "(", "(", "(", "AllenInterval", ")", "rect", ".", "getInternalVariables", "(", ")", "[", "1", "]", ")", ".", "getEST", "(", ")", ",", "(", "(", "AllenInterval", ")", "rect", ".", "getInternalVariables", "(", ")", "[", "1", "]", ")", ".", "getLST", "(", ")", ")", ";", "yUB", "=", "new", "Bounds", "(", "(", "(", "AllenInterval", ")", "rect", ".", "getInternalVariables", "(", ")", "[", "1", "]", ")", ".", "getEET", "(", ")", ",", "(", "(", "AllenInterval", ")", "rect", ".", "getInternalVariables", "(", ")", "[", "1", "]", ")", ".", "getLET", "(", ")", ")", ";", "zLB", "=", "new", "Bounds", "(", "(", "(", "AllenInterval", ")", "rect", ".", "getInternalVariables", "(", ")", "[", "2", "]", ")", ".", "getEST", "(", ")", ",", "(", "(", "AllenInterval", ")", "rect", ".", "getInternalVariables", "(", ")", "[", "2", "]", ")", ".", "getLST", "(", ")", ")", ";", "zUB", "=", "new", "Bounds", "(", "(", "(", "AllenInterval", ")", "rect", ".", "getInternalVariables", "(", ")", "[", "2", "]", ")", ".", "getEET", "(", ")", ",", "(", "(", "AllenInterval", ")", "rect", ".", "getInternalVariables", "(", ")", "[", "2", "]", ")", ".", "getLET", "(", ")", ")", ";", "return", "new", "BoundingBox", "(", "xLB", ",", "xUB", ",", "yLB", ",", "yUB", ",", "zLB", ",", "zUB", ")", ";", "}" ]
Extracts a specific {@link BoundingBox} from the domain of a {@link RectangularRegion}. @param rect The {@link RectangularRegion} from to extract the {@link BoundingBox}. @return A specific {@link BoundingBox} from the domain of a {@link RectangularRegion}.
[ "Extracts", "a", "specific", "{" ]
train
https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/multi/spatial/blockAlgebra/BlockConstraintSolver.java#L72-L81
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.beginCreate
public TaskInner beginCreate(String resourceGroupName, String registryName, String taskName, TaskInner taskCreateParameters) { """ Creates a task for a container registry with the specified parameters. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param taskName The name of the container registry task. @param taskCreateParameters The parameters for creating a task. @throws IllegalArgumentException thrown if parameters fail the validation @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. """ return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, taskName, taskCreateParameters).toBlocking().single().body(); }
java
public TaskInner beginCreate(String resourceGroupName, String registryName, String taskName, TaskInner taskCreateParameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, taskName, taskCreateParameters).toBlocking().single().body(); }
[ "public", "TaskInner", "beginCreate", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "taskName", ",", "TaskInner", "taskCreateParameters", ")", "{", "return", "beginCreateWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ",", "taskName", ",", "taskCreateParameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Creates a task for a container registry with the specified parameters. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param taskName The name of the container registry task. @param taskCreateParameters The parameters for creating a task. @throws IllegalArgumentException thrown if parameters fail the validation @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.
[ "Creates", "a", "task", "for", "a", "container", "registry", "with", "the", "specified", "parameters", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/TasksInner.java#L415-L417
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/dml/AbstractSQLInsertClause.java
AbstractSQLInsertClause.addBatch
@WithBridgeMethods(value = SQLInsertClause.class, castRequired = true) public C addBatch() { """ Add the current state of bindings as a batch item @return the current object """ if (subQueryBuilder != null) { subQuery = subQueryBuilder.select(values.toArray(new Expression[values.size()])).clone(); values.clear(); } batches.add(new SQLInsertBatch(columns, values, subQuery)); columns.clear(); values.clear(); subQuery = null; return (C) this; }
java
@WithBridgeMethods(value = SQLInsertClause.class, castRequired = true) public C addBatch() { if (subQueryBuilder != null) { subQuery = subQueryBuilder.select(values.toArray(new Expression[values.size()])).clone(); values.clear(); } batches.add(new SQLInsertBatch(columns, values, subQuery)); columns.clear(); values.clear(); subQuery = null; return (C) this; }
[ "@", "WithBridgeMethods", "(", "value", "=", "SQLInsertClause", ".", "class", ",", "castRequired", "=", "true", ")", "public", "C", "addBatch", "(", ")", "{", "if", "(", "subQueryBuilder", "!=", "null", ")", "{", "subQuery", "=", "subQueryBuilder", ".", "select", "(", "values", ".", "toArray", "(", "new", "Expression", "[", "values", ".", "size", "(", ")", "]", ")", ")", ".", "clone", "(", ")", ";", "values", ".", "clear", "(", ")", ";", "}", "batches", ".", "add", "(", "new", "SQLInsertBatch", "(", "columns", ",", "values", ",", "subQuery", ")", ")", ";", "columns", ".", "clear", "(", ")", ";", "values", ".", "clear", "(", ")", ";", "subQuery", "=", "null", ";", "return", "(", "C", ")", "this", ";", "}" ]
Add the current state of bindings as a batch item @return the current object
[ "Add", "the", "current", "state", "of", "bindings", "as", "a", "batch", "item" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/dml/AbstractSQLInsertClause.java#L125-L136
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
DTMDefaultBase.getExpandedTypeID
public int getExpandedTypeID(String namespace, String localName, int type) { """ Given an expanded name, return an ID. If the expanded-name does not exist in the internal tables, the entry will be created, and the ID will be returned. Any additional nodes that are created that have this expanded name will use this ID. @param type The simple type, i.e. one of ELEMENT, ATTRIBUTE, etc. @param namespace The namespace URI, which may be null, may be an empty string (which will be the same as null), or may be a namespace URI. @param localName The local name string, which must be a valid <a href="http://www.w3.org/TR/REC-xml-names/">NCName</a>. @return the expanded-name id of the node. """ ExpandedNameTable ent = m_expandedNameTable; return ent.getExpandedTypeID(namespace, localName, type); }
java
public int getExpandedTypeID(String namespace, String localName, int type) { ExpandedNameTable ent = m_expandedNameTable; return ent.getExpandedTypeID(namespace, localName, type); }
[ "public", "int", "getExpandedTypeID", "(", "String", "namespace", ",", "String", "localName", ",", "int", "type", ")", "{", "ExpandedNameTable", "ent", "=", "m_expandedNameTable", ";", "return", "ent", ".", "getExpandedTypeID", "(", "namespace", ",", "localName", ",", "type", ")", ";", "}" ]
Given an expanded name, return an ID. If the expanded-name does not exist in the internal tables, the entry will be created, and the ID will be returned. Any additional nodes that are created that have this expanded name will use this ID. @param type The simple type, i.e. one of ELEMENT, ATTRIBUTE, etc. @param namespace The namespace URI, which may be null, may be an empty string (which will be the same as null), or may be a namespace URI. @param localName The local name string, which must be a valid <a href="http://www.w3.org/TR/REC-xml-names/">NCName</a>. @return the expanded-name id of the node.
[ "Given", "an", "expanded", "name", "return", "an", "ID", ".", "If", "the", "expanded", "-", "name", "does", "not", "exist", "in", "the", "internal", "tables", "the", "entry", "will", "be", "created", "and", "the", "ID", "will", "be", "returned", ".", "Any", "additional", "nodes", "that", "are", "created", "that", "have", "this", "expanded", "name", "will", "use", "this", "ID", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L1704-L1710
marklogic/java-client-api
marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java
StructuredQueryBuilder.geoJSONProperty
public GeospatialIndex geoJSONProperty(JSONProperty parent, JSONProperty jsonProperty) { """ Identifies a parent json property with a child json property whose text has the latitude and longitude coordinates to match with a geospatial query. @param parent the parent of the json property with the coordinates @param jsonProperty the json property containing the geospatial coordinates @return the specification for the index on the geospatial coordinates """ if ( parent == null ) throw new IllegalArgumentException("parent cannot be null"); if ( jsonProperty == null ) throw new IllegalArgumentException("jsonProperty cannot be null"); return new GeoJSONPropertyImpl(parent, jsonProperty); }
java
public GeospatialIndex geoJSONProperty(JSONProperty parent, JSONProperty jsonProperty) { if ( parent == null ) throw new IllegalArgumentException("parent cannot be null"); if ( jsonProperty == null ) throw new IllegalArgumentException("jsonProperty cannot be null"); return new GeoJSONPropertyImpl(parent, jsonProperty); }
[ "public", "GeospatialIndex", "geoJSONProperty", "(", "JSONProperty", "parent", ",", "JSONProperty", "jsonProperty", ")", "{", "if", "(", "parent", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"parent cannot be null\"", ")", ";", "if", "(", "jsonProperty", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"jsonProperty cannot be null\"", ")", ";", "return", "new", "GeoJSONPropertyImpl", "(", "parent", ",", "jsonProperty", ")", ";", "}" ]
Identifies a parent json property with a child json property whose text has the latitude and longitude coordinates to match with a geospatial query. @param parent the parent of the json property with the coordinates @param jsonProperty the json property containing the geospatial coordinates @return the specification for the index on the geospatial coordinates
[ "Identifies", "a", "parent", "json", "property", "with", "a", "child", "json", "property", "whose", "text", "has", "the", "latitude", "and", "longitude", "coordinates", "to", "match", "with", "a", "geospatial", "query", "." ]
train
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java#L844-L848
Blazebit/blaze-utils
blaze-ee-utils/src/main/java/com/blazebit/cdi/CdiUtils.java
CdiUtils.getBean
public static <T> T getBean(BeanManager bm, Class<T> clazz) { """ Retrieves the bean for the given class from the given bean manager qualified with #{@link Default}. @param <T> The type of the bean to look for @param bm The bean manager which should be used for the lookup @param clazz The class of the bean to look for @return The bean instance if found, otherwise null """ return getBean(bm, clazz, (Annotation[]) null); }
java
public static <T> T getBean(BeanManager bm, Class<T> clazz) { return getBean(bm, clazz, (Annotation[]) null); }
[ "public", "static", "<", "T", ">", "T", "getBean", "(", "BeanManager", "bm", ",", "Class", "<", "T", ">", "clazz", ")", "{", "return", "getBean", "(", "bm", ",", "clazz", ",", "(", "Annotation", "[", "]", ")", "null", ")", ";", "}" ]
Retrieves the bean for the given class from the given bean manager qualified with #{@link Default}. @param <T> The type of the bean to look for @param bm The bean manager which should be used for the lookup @param clazz The class of the bean to look for @return The bean instance if found, otherwise null
[ "Retrieves", "the", "bean", "for", "the", "given", "class", "from", "the", "given", "bean", "manager", "qualified", "with", "#", "{", "@link", "Default", "}", "." ]
train
https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-ee-utils/src/main/java/com/blazebit/cdi/CdiUtils.java#L80-L82
jcuda/jcuda
JCudaJava/src/main/java/jcuda/runtime/JCuda.java
JCuda.cudaMemcpy
public static int cudaMemcpy(Pointer dst, Pointer src, long count, int cudaMemcpyKind_kind) { """ Copies data between host and device. <pre> cudaError_t cudaMemcpy ( void* dst, const void* src, size_t count, cudaMemcpyKind kind ) </pre> <div> <p>Copies data between host and device. Copies <tt>count</tt> bytes from the memory area pointed to by <tt>src</tt> to the memory area pointed to by <tt>dst</tt>, where <tt>kind</tt> is one of cudaMemcpyHostToHost, cudaMemcpyHostToDevice, cudaMemcpyDeviceToHost, or cudaMemcpyDeviceToDevice, and specifies the direction of the copy. The memory areas may not overlap. Calling cudaMemcpy() with <tt>dst</tt> and <tt>src</tt> pointers that do not match the direction of the copy results in an undefined behavior. </p> <div> <span>Note:</span> <ul> <li> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </li> <li> <p>This function exhibits synchronous behavior for most use cases. </p> </li> </ul> </div> </p> </div> @param dst Destination memory address @param src Source memory address @param count Size in bytes to copy @param kind Type of transfer @return cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDevicePointer, cudaErrorInvalidMemcpyDirection @see JCuda#cudaMemcpy2D @see JCuda#cudaMemcpyToArray @see JCuda#cudaMemcpy2DToArray @see JCuda#cudaMemcpyFromArray @see JCuda#cudaMemcpy2DFromArray @see JCuda#cudaMemcpyArrayToArray @see JCuda#cudaMemcpy2DArrayToArray @see JCuda#cudaMemcpyToSymbol @see JCuda#cudaMemcpyFromSymbol @see JCuda#cudaMemcpyAsync @see JCuda#cudaMemcpy2DAsync @see JCuda#cudaMemcpyToArrayAsync @see JCuda#cudaMemcpy2DToArrayAsync @see JCuda#cudaMemcpyFromArrayAsync @see JCuda#cudaMemcpy2DFromArrayAsync @see JCuda#cudaMemcpyToSymbolAsync @see JCuda#cudaMemcpyFromSymbolAsync """ return checkResult(cudaMemcpyNative(dst, src, count, cudaMemcpyKind_kind)); }
java
public static int cudaMemcpy(Pointer dst, Pointer src, long count, int cudaMemcpyKind_kind) { return checkResult(cudaMemcpyNative(dst, src, count, cudaMemcpyKind_kind)); }
[ "public", "static", "int", "cudaMemcpy", "(", "Pointer", "dst", ",", "Pointer", "src", ",", "long", "count", ",", "int", "cudaMemcpyKind_kind", ")", "{", "return", "checkResult", "(", "cudaMemcpyNative", "(", "dst", ",", "src", ",", "count", ",", "cudaMemcpyKind_kind", ")", ")", ";", "}" ]
Copies data between host and device. <pre> cudaError_t cudaMemcpy ( void* dst, const void* src, size_t count, cudaMemcpyKind kind ) </pre> <div> <p>Copies data between host and device. Copies <tt>count</tt> bytes from the memory area pointed to by <tt>src</tt> to the memory area pointed to by <tt>dst</tt>, where <tt>kind</tt> is one of cudaMemcpyHostToHost, cudaMemcpyHostToDevice, cudaMemcpyDeviceToHost, or cudaMemcpyDeviceToDevice, and specifies the direction of the copy. The memory areas may not overlap. Calling cudaMemcpy() with <tt>dst</tt> and <tt>src</tt> pointers that do not match the direction of the copy results in an undefined behavior. </p> <div> <span>Note:</span> <ul> <li> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </li> <li> <p>This function exhibits synchronous behavior for most use cases. </p> </li> </ul> </div> </p> </div> @param dst Destination memory address @param src Source memory address @param count Size in bytes to copy @param kind Type of transfer @return cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDevicePointer, cudaErrorInvalidMemcpyDirection @see JCuda#cudaMemcpy2D @see JCuda#cudaMemcpyToArray @see JCuda#cudaMemcpy2DToArray @see JCuda#cudaMemcpyFromArray @see JCuda#cudaMemcpy2DFromArray @see JCuda#cudaMemcpyArrayToArray @see JCuda#cudaMemcpy2DArrayToArray @see JCuda#cudaMemcpyToSymbol @see JCuda#cudaMemcpyFromSymbol @see JCuda#cudaMemcpyAsync @see JCuda#cudaMemcpy2DAsync @see JCuda#cudaMemcpyToArrayAsync @see JCuda#cudaMemcpy2DToArrayAsync @see JCuda#cudaMemcpyFromArrayAsync @see JCuda#cudaMemcpy2DFromArrayAsync @see JCuda#cudaMemcpyToSymbolAsync @see JCuda#cudaMemcpyFromSymbolAsync
[ "Copies", "data", "between", "host", "and", "device", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L4611-L4614
logic-ng/LogicNG
src/main/java/org/logicng/cardinalityconstraints/CCEncoder.java
CCEncoder.encodeIncremental
public Pair<ImmutableFormulaList, CCIncrementalData> encodeIncremental(final PBConstraint cc) { """ Encodes an incremental cardinality constraint and returns its encoding. @param cc the cardinality constraint @return the encoding of the constraint and the incremental data """ final EncodingResult result = EncodingResult.resultForFormula(f); final CCIncrementalData incData = this.encodeIncremental(cc, result); return new Pair<>(new ImmutableFormulaList(FType.AND, result.result()), incData); }
java
public Pair<ImmutableFormulaList, CCIncrementalData> encodeIncremental(final PBConstraint cc) { final EncodingResult result = EncodingResult.resultForFormula(f); final CCIncrementalData incData = this.encodeIncremental(cc, result); return new Pair<>(new ImmutableFormulaList(FType.AND, result.result()), incData); }
[ "public", "Pair", "<", "ImmutableFormulaList", ",", "CCIncrementalData", ">", "encodeIncremental", "(", "final", "PBConstraint", "cc", ")", "{", "final", "EncodingResult", "result", "=", "EncodingResult", ".", "resultForFormula", "(", "f", ")", ";", "final", "CCIncrementalData", "incData", "=", "this", ".", "encodeIncremental", "(", "cc", ",", "result", ")", ";", "return", "new", "Pair", "<>", "(", "new", "ImmutableFormulaList", "(", "FType", ".", "AND", ",", "result", ".", "result", "(", ")", ")", ",", "incData", ")", ";", "}" ]
Encodes an incremental cardinality constraint and returns its encoding. @param cc the cardinality constraint @return the encoding of the constraint and the incremental data
[ "Encodes", "an", "incremental", "cardinality", "constraint", "and", "returns", "its", "encoding", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/cardinalityconstraints/CCEncoder.java#L140-L144
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java
JDBC4DatabaseMetaData.getAttributes
@Override public ResultSet getAttributes(String catalog, String schemaPattern, String typeNamePattern, String attributeNamePattern) throws SQLException { """ Retrieves a description of the given attribute of the given type for a user-defined type (UDT) that is available in the given schema and catalog. """ checkClosed(); throw SQLError.noSupport(); }
java
@Override public ResultSet getAttributes(String catalog, String schemaPattern, String typeNamePattern, String attributeNamePattern) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
[ "@", "Override", "public", "ResultSet", "getAttributes", "(", "String", "catalog", ",", "String", "schemaPattern", ",", "String", "typeNamePattern", ",", "String", "attributeNamePattern", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "throw", "SQLError", ".", "noSupport", "(", ")", ";", "}" ]
Retrieves a description of the given attribute of the given type for a user-defined type (UDT) that is available in the given schema and catalog.
[ "Retrieves", "a", "description", "of", "the", "given", "attribute", "of", "the", "given", "type", "for", "a", "user", "-", "defined", "type", "(", "UDT", ")", "that", "is", "available", "in", "the", "given", "schema", "and", "catalog", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L139-L144
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java
Shape.getOffsetUnsafe
public static long getOffsetUnsafe(DataBuffer shapeInformation, int row, int col) { """ Identical to {@link Shape#getOffset(DataBuffer, int, int)} but without input validation on array rank """ long offset = 0; int size_0 = sizeUnsafe(shapeInformation, 0); int size_1 = sizeUnsafe(shapeInformation, 1); if (row >= size_0 || col >= size_1) throw new IllegalArgumentException("Invalid indices: cannot get [" + row + "," + col + "] from a " + Arrays.toString(shape(shapeInformation)) + " NDArray"); if (size_0 != 1) offset += row * strideUnsafe(shapeInformation, 0, 2); if (size_1 != 1) offset += col * strideUnsafe(shapeInformation, 1, 2); return offset; }
java
public static long getOffsetUnsafe(DataBuffer shapeInformation, int row, int col) { long offset = 0; int size_0 = sizeUnsafe(shapeInformation, 0); int size_1 = sizeUnsafe(shapeInformation, 1); if (row >= size_0 || col >= size_1) throw new IllegalArgumentException("Invalid indices: cannot get [" + row + "," + col + "] from a " + Arrays.toString(shape(shapeInformation)) + " NDArray"); if (size_0 != 1) offset += row * strideUnsafe(shapeInformation, 0, 2); if (size_1 != 1) offset += col * strideUnsafe(shapeInformation, 1, 2); return offset; }
[ "public", "static", "long", "getOffsetUnsafe", "(", "DataBuffer", "shapeInformation", ",", "int", "row", ",", "int", "col", ")", "{", "long", "offset", "=", "0", ";", "int", "size_0", "=", "sizeUnsafe", "(", "shapeInformation", ",", "0", ")", ";", "int", "size_1", "=", "sizeUnsafe", "(", "shapeInformation", ",", "1", ")", ";", "if", "(", "row", ">=", "size_0", "||", "col", ">=", "size_1", ")", "throw", "new", "IllegalArgumentException", "(", "\"Invalid indices: cannot get [\"", "+", "row", "+", "\",\"", "+", "col", "+", "\"] from a \"", "+", "Arrays", ".", "toString", "(", "shape", "(", "shapeInformation", ")", ")", "+", "\" NDArray\"", ")", ";", "if", "(", "size_0", "!=", "1", ")", "offset", "+=", "row", "*", "strideUnsafe", "(", "shapeInformation", ",", "0", ",", "2", ")", ";", "if", "(", "size_1", "!=", "1", ")", "offset", "+=", "col", "*", "strideUnsafe", "(", "shapeInformation", ",", "1", ",", "2", ")", ";", "return", "offset", ";", "}" ]
Identical to {@link Shape#getOffset(DataBuffer, int, int)} but without input validation on array rank
[ "Identical", "to", "{" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L1002-L1016
graylog-labs/syslog4j-graylog2
src/main/java/org/graylog2/syslog4j/Syslog.java
Syslog.getInstance
public static final SyslogIF getInstance(String protocol) throws SyslogRuntimeException { """ Use getInstance(protocol) as the starting point for Syslog4j. @param protocol - the Syslog protocol to use, e.g. "udp", "tcp", "unix_syslog", "unix_socket", or a custom protocol @return Returns an instance of SyslogIF. @throws SyslogRuntimeException """ String _protocol = protocol.toLowerCase(); if (instances.containsKey(_protocol)) { return (SyslogIF) instances.get(_protocol); } else { StringBuffer message = new StringBuffer("Syslog protocol \"" + protocol + "\" not defined; call Syslogger.createSyslogInstance(protocol,config) first"); if (instances.size() > 0) { message.append(" or use one of the following instances: "); Iterator i = instances.keySet().iterator(); while (i.hasNext()) { String k = (String) i.next(); message.append(k); if (i.hasNext()) { message.append(' '); } } } throwRuntimeException(message.toString()); return null; } }
java
public static final SyslogIF getInstance(String protocol) throws SyslogRuntimeException { String _protocol = protocol.toLowerCase(); if (instances.containsKey(_protocol)) { return (SyslogIF) instances.get(_protocol); } else { StringBuffer message = new StringBuffer("Syslog protocol \"" + protocol + "\" not defined; call Syslogger.createSyslogInstance(protocol,config) first"); if (instances.size() > 0) { message.append(" or use one of the following instances: "); Iterator i = instances.keySet().iterator(); while (i.hasNext()) { String k = (String) i.next(); message.append(k); if (i.hasNext()) { message.append(' '); } } } throwRuntimeException(message.toString()); return null; } }
[ "public", "static", "final", "SyslogIF", "getInstance", "(", "String", "protocol", ")", "throws", "SyslogRuntimeException", "{", "String", "_protocol", "=", "protocol", ".", "toLowerCase", "(", ")", ";", "if", "(", "instances", ".", "containsKey", "(", "_protocol", ")", ")", "{", "return", "(", "SyslogIF", ")", "instances", ".", "get", "(", "_protocol", ")", ";", "}", "else", "{", "StringBuffer", "message", "=", "new", "StringBuffer", "(", "\"Syslog protocol \\\"\"", "+", "protocol", "+", "\"\\\" not defined; call Syslogger.createSyslogInstance(protocol,config) first\"", ")", ";", "if", "(", "instances", ".", "size", "(", ")", ">", "0", ")", "{", "message", ".", "append", "(", "\" or use one of the following instances: \"", ")", ";", "Iterator", "i", "=", "instances", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "i", ".", "hasNext", "(", ")", ")", "{", "String", "k", "=", "(", "String", ")", "i", ".", "next", "(", ")", ";", "message", ".", "append", "(", "k", ")", ";", "if", "(", "i", ".", "hasNext", "(", ")", ")", "{", "message", ".", "append", "(", "'", "'", ")", ";", "}", "}", "}", "throwRuntimeException", "(", "message", ".", "toString", "(", ")", ")", ";", "return", "null", ";", "}", "}" ]
Use getInstance(protocol) as the starting point for Syslog4j. @param protocol - the Syslog protocol to use, e.g. "udp", "tcp", "unix_syslog", "unix_socket", or a custom protocol @return Returns an instance of SyslogIF. @throws SyslogRuntimeException
[ "Use", "getInstance", "(", "protocol", ")", "as", "the", "starting", "point", "for", "Syslog4j", "." ]
train
https://github.com/graylog-labs/syslog4j-graylog2/blob/374bc20d77c3aaa36a68bec5125dd82ce0a88aab/src/main/java/org/graylog2/syslog4j/Syslog.java#L99-L125
jenkinsci/jenkins
core/src/main/java/hudson/model/queue/AbstractQueueSorterImpl.java
AbstractQueueSorterImpl.compare
public int compare(BuildableItem lhs, BuildableItem rhs) { """ Override this method to provide the ordering of the sort. <p> if lhs should be build before rhs, return a negative value. Or put another way, think of the comparison as a process of converting a {@link BuildableItem} into a number, then doing num(lhs)-num(rhs). <p> The default implementation does FIFO. """ return compare(lhs.buildableStartMilliseconds,rhs.buildableStartMilliseconds); }
java
public int compare(BuildableItem lhs, BuildableItem rhs) { return compare(lhs.buildableStartMilliseconds,rhs.buildableStartMilliseconds); }
[ "public", "int", "compare", "(", "BuildableItem", "lhs", ",", "BuildableItem", "rhs", ")", "{", "return", "compare", "(", "lhs", ".", "buildableStartMilliseconds", ",", "rhs", ".", "buildableStartMilliseconds", ")", ";", "}" ]
Override this method to provide the ordering of the sort. <p> if lhs should be build before rhs, return a negative value. Or put another way, think of the comparison as a process of converting a {@link BuildableItem} into a number, then doing num(lhs)-num(rhs). <p> The default implementation does FIFO.
[ "Override", "this", "method", "to", "provide", "the", "ordering", "of", "the", "sort", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/queue/AbstractQueueSorterImpl.java#L31-L33
jenkinsci/jenkins
core/src/main/java/jenkins/util/SystemProperties.java
SystemProperties.getBoolean
public static boolean getBoolean(String name, boolean def) { """ Returns {@code true} if the system property named by the argument exists and is equal to the string {@code "true"}, or a default value. If the system property does not exist, return {@code "true"} if a property by this name exists in the {@link ServletContext} and is equal to the string {@code "true"}. If that property does not exist either, return the default value. This behaves just like {@link Boolean#getBoolean(java.lang.String)} with a default value, except that it also consults the {@link ServletContext}'s "init" parameters. @param name the system property name. @param def a default value. @return the {@code boolean} value of the system property. """ String v = getString(name); if (v != null) { return Boolean.parseBoolean(v); } return def; }
java
public static boolean getBoolean(String name, boolean def) { String v = getString(name); if (v != null) { return Boolean.parseBoolean(v); } return def; }
[ "public", "static", "boolean", "getBoolean", "(", "String", "name", ",", "boolean", "def", ")", "{", "String", "v", "=", "getString", "(", "name", ")", ";", "if", "(", "v", "!=", "null", ")", "{", "return", "Boolean", ".", "parseBoolean", "(", "v", ")", ";", "}", "return", "def", ";", "}" ]
Returns {@code true} if the system property named by the argument exists and is equal to the string {@code "true"}, or a default value. If the system property does not exist, return {@code "true"} if a property by this name exists in the {@link ServletContext} and is equal to the string {@code "true"}. If that property does not exist either, return the default value. This behaves just like {@link Boolean#getBoolean(java.lang.String)} with a default value, except that it also consults the {@link ServletContext}'s "init" parameters. @param name the system property name. @param def a default value. @return the {@code boolean} value of the system property.
[ "Returns", "{", "@code", "true", "}", "if", "the", "system", "property", "named", "by", "the", "argument", "exists", "and", "is", "equal", "to", "the", "string", "{", "@code", "true", "}", "or", "a", "default", "value", ".", "If", "the", "system", "property", "does", "not", "exist", "return", "{", "@code", "true", "}", "if", "a", "property", "by", "this", "name", "exists", "in", "the", "{", "@link", "ServletContext", "}", "and", "is", "equal", "to", "the", "string", "{", "@code", "true", "}", ".", "If", "that", "property", "does", "not", "exist", "either", "return", "the", "default", "value", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/util/SystemProperties.java#L294-L301
pebble/pebble-android-sdk
PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/PebbleKit.java
PebbleKit.registerReceivedAckHandler
public static BroadcastReceiver registerReceivedAckHandler(final Context context, final PebbleAckReceiver receiver) { """ A convenience function to assist in programatically registering a broadcast receiver for the 'RECEIVE_ACK' intent. To avoid leaking memory, activities registering BroadcastReceivers <em>must</em> unregister them in the Activity's {@link android.app.Activity#onPause()} method. @param context The context in which to register the BroadcastReceiver. @param receiver The receiver to be registered. @return The registered receiver. @see Constants#INTENT_APP_RECEIVE_ACK """ return registerBroadcastReceiverInternal(context, INTENT_APP_RECEIVE_ACK, receiver); }
java
public static BroadcastReceiver registerReceivedAckHandler(final Context context, final PebbleAckReceiver receiver) { return registerBroadcastReceiverInternal(context, INTENT_APP_RECEIVE_ACK, receiver); }
[ "public", "static", "BroadcastReceiver", "registerReceivedAckHandler", "(", "final", "Context", "context", ",", "final", "PebbleAckReceiver", "receiver", ")", "{", "return", "registerBroadcastReceiverInternal", "(", "context", ",", "INTENT_APP_RECEIVE_ACK", ",", "receiver", ")", ";", "}" ]
A convenience function to assist in programatically registering a broadcast receiver for the 'RECEIVE_ACK' intent. To avoid leaking memory, activities registering BroadcastReceivers <em>must</em> unregister them in the Activity's {@link android.app.Activity#onPause()} method. @param context The context in which to register the BroadcastReceiver. @param receiver The receiver to be registered. @return The registered receiver. @see Constants#INTENT_APP_RECEIVE_ACK
[ "A", "convenience", "function", "to", "assist", "in", "programatically", "registering", "a", "broadcast", "receiver", "for", "the", "RECEIVE_ACK", "intent", "." ]
train
https://github.com/pebble/pebble-android-sdk/blob/ddfc53ecf3950deebb62a1f205aa21fbe9bce45d/PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/PebbleKit.java#L448-L451
apache/flink
flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgramUtils.java
PackagedProgramUtils.createJobGraph
public static JobGraph createJobGraph( PackagedProgram packagedProgram, Configuration configuration, int defaultParallelism) throws ProgramInvocationException { """ Creates a {@link JobGraph} with a random {@link JobID} from the given {@link PackagedProgram}. @param packagedProgram to extract the JobGraph from @param configuration to use for the optimizer and job graph generator @param defaultParallelism for the JobGraph @return JobGraph extracted from the PackagedProgram @throws ProgramInvocationException if the JobGraph generation failed """ return createJobGraph(packagedProgram, configuration, defaultParallelism, null); }
java
public static JobGraph createJobGraph( PackagedProgram packagedProgram, Configuration configuration, int defaultParallelism) throws ProgramInvocationException { return createJobGraph(packagedProgram, configuration, defaultParallelism, null); }
[ "public", "static", "JobGraph", "createJobGraph", "(", "PackagedProgram", "packagedProgram", ",", "Configuration", "configuration", ",", "int", "defaultParallelism", ")", "throws", "ProgramInvocationException", "{", "return", "createJobGraph", "(", "packagedProgram", ",", "configuration", ",", "defaultParallelism", ",", "null", ")", ";", "}" ]
Creates a {@link JobGraph} with a random {@link JobID} from the given {@link PackagedProgram}. @param packagedProgram to extract the JobGraph from @param configuration to use for the optimizer and job graph generator @param defaultParallelism for the JobGraph @return JobGraph extracted from the PackagedProgram @throws ProgramInvocationException if the JobGraph generation failed
[ "Creates", "a", "{", "@link", "JobGraph", "}", "with", "a", "random", "{", "@link", "JobID", "}", "from", "the", "given", "{", "@link", "PackagedProgram", "}", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgramUtils.java#L118-L123
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_ovhPabx_serviceName_menu_menuId_entry_entryId_GET
public OvhOvhPabxMenuEntry billingAccount_ovhPabx_serviceName_menu_menuId_entry_entryId_GET(String billingAccount, String serviceName, Long menuId, Long entryId) throws IOException { """ Get this object properties REST: GET /telephony/{billingAccount}/ovhPabx/{serviceName}/menu/{menuId}/entry/{entryId} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param menuId [required] @param entryId [required] """ String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/menu/{menuId}/entry/{entryId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, menuId, entryId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhPabxMenuEntry.class); }
java
public OvhOvhPabxMenuEntry billingAccount_ovhPabx_serviceName_menu_menuId_entry_entryId_GET(String billingAccount, String serviceName, Long menuId, Long entryId) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/menu/{menuId}/entry/{entryId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, menuId, entryId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhPabxMenuEntry.class); }
[ "public", "OvhOvhPabxMenuEntry", "billingAccount_ovhPabx_serviceName_menu_menuId_entry_entryId_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "menuId", ",", "Long", "entryId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/ovhPabx/{serviceName}/menu/{menuId}/entry/{entryId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ",", "menuId", ",", "entryId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOvhPabxMenuEntry", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /telephony/{billingAccount}/ovhPabx/{serviceName}/menu/{menuId}/entry/{entryId} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param menuId [required] @param entryId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7492-L7497
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToHTMLStream.java
ToHTMLStream.addUniqueAttribute
public void addUniqueAttribute(String name, String value, int flags) throws SAXException { """ This method is used to add an attribute to the currently open element. The caller has guaranted that this attribute is unique, which means that it not been seen before and will not be seen again. @param name the qualified name of the attribute @param value the value of the attribute which can contain only ASCII printable characters characters in the range 32 to 127 inclusive. @param flags the bit values of this integer give optimization information. """ try { final java.io.Writer writer = m_writer; if ((flags & NO_BAD_CHARS) > 0 && m_htmlcharInfo.onlyQuotAmpLtGt) { // "flags" has indicated that the characters // '>' '<' '&' and '"' are not in the value and // m_htmlcharInfo has recorded that there are no other // entities in the range 0 to 127 so we write out the // value directly writer.write(' '); writer.write(name); writer.write("=\""); writer.write(value); writer.write('"'); } else if ( (flags & HTML_ATTREMPTY) > 0 && (value.length() == 0 || value.equalsIgnoreCase(name))) { writer.write(' '); writer.write(name); } else { writer.write(' '); writer.write(name); writer.write("=\""); if ((flags & HTML_ATTRURL) > 0) { writeAttrURI(writer, value, m_specialEscapeURLs); } else { writeAttrString(writer, value, this.getEncoding()); } writer.write('"'); } } catch (IOException e) { throw new SAXException(e); } }
java
public void addUniqueAttribute(String name, String value, int flags) throws SAXException { try { final java.io.Writer writer = m_writer; if ((flags & NO_BAD_CHARS) > 0 && m_htmlcharInfo.onlyQuotAmpLtGt) { // "flags" has indicated that the characters // '>' '<' '&' and '"' are not in the value and // m_htmlcharInfo has recorded that there are no other // entities in the range 0 to 127 so we write out the // value directly writer.write(' '); writer.write(name); writer.write("=\""); writer.write(value); writer.write('"'); } else if ( (flags & HTML_ATTREMPTY) > 0 && (value.length() == 0 || value.equalsIgnoreCase(name))) { writer.write(' '); writer.write(name); } else { writer.write(' '); writer.write(name); writer.write("=\""); if ((flags & HTML_ATTRURL) > 0) { writeAttrURI(writer, value, m_specialEscapeURLs); } else { writeAttrString(writer, value, this.getEncoding()); } writer.write('"'); } } catch (IOException e) { throw new SAXException(e); } }
[ "public", "void", "addUniqueAttribute", "(", "String", "name", ",", "String", "value", ",", "int", "flags", ")", "throws", "SAXException", "{", "try", "{", "final", "java", ".", "io", ".", "Writer", "writer", "=", "m_writer", ";", "if", "(", "(", "flags", "&", "NO_BAD_CHARS", ")", ">", "0", "&&", "m_htmlcharInfo", ".", "onlyQuotAmpLtGt", ")", "{", "// \"flags\" has indicated that the characters", "// '>' '<' '&' and '\"' are not in the value and", "// m_htmlcharInfo has recorded that there are no other", "// entities in the range 0 to 127 so we write out the", "// value directly", "writer", ".", "write", "(", "'", "'", ")", ";", "writer", ".", "write", "(", "name", ")", ";", "writer", ".", "write", "(", "\"=\\\"\"", ")", ";", "writer", ".", "write", "(", "value", ")", ";", "writer", ".", "write", "(", "'", "'", ")", ";", "}", "else", "if", "(", "(", "flags", "&", "HTML_ATTREMPTY", ")", ">", "0", "&&", "(", "value", ".", "length", "(", ")", "==", "0", "||", "value", ".", "equalsIgnoreCase", "(", "name", ")", ")", ")", "{", "writer", ".", "write", "(", "'", "'", ")", ";", "writer", ".", "write", "(", "name", ")", ";", "}", "else", "{", "writer", ".", "write", "(", "'", "'", ")", ";", "writer", ".", "write", "(", "name", ")", ";", "writer", ".", "write", "(", "\"=\\\"\"", ")", ";", "if", "(", "(", "flags", "&", "HTML_ATTRURL", ")", ">", "0", ")", "{", "writeAttrURI", "(", "writer", ",", "value", ",", "m_specialEscapeURLs", ")", ";", "}", "else", "{", "writeAttrString", "(", "writer", ",", "value", ",", "this", ".", "getEncoding", "(", ")", ")", ";", "}", "writer", ".", "write", "(", "'", "'", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "SAXException", "(", "e", ")", ";", "}", "}" ]
This method is used to add an attribute to the currently open element. The caller has guaranted that this attribute is unique, which means that it not been seen before and will not be seen again. @param name the qualified name of the attribute @param value the value of the attribute which can contain only ASCII printable characters characters in the range 32 to 127 inclusive. @param flags the bit values of this integer give optimization information.
[ "This", "method", "is", "used", "to", "add", "an", "attribute", "to", "the", "currently", "open", "element", ".", "The", "caller", "has", "guaranted", "that", "this", "attribute", "is", "unique", "which", "means", "that", "it", "not", "been", "seen", "before", "and", "will", "not", "be", "seen", "again", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToHTMLStream.java#L1930-L1974
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/ConstantUTFInfo.java
ConstantUTFInfo.make
static ConstantUTFInfo make(ConstantPool cp, String str) { """ Will return either a new ConstantUTFInfo object or one already in the constant pool. If it is a new ConstantUTFInfo, it will be inserted into the pool. """ ConstantInfo ci = new ConstantUTFInfo(str); return (ConstantUTFInfo)cp.addConstant(ci); }
java
static ConstantUTFInfo make(ConstantPool cp, String str) { ConstantInfo ci = new ConstantUTFInfo(str); return (ConstantUTFInfo)cp.addConstant(ci); }
[ "static", "ConstantUTFInfo", "make", "(", "ConstantPool", "cp", ",", "String", "str", ")", "{", "ConstantInfo", "ci", "=", "new", "ConstantUTFInfo", "(", "str", ")", ";", "return", "(", "ConstantUTFInfo", ")", "cp", ".", "addConstant", "(", "ci", ")", ";", "}" ]
Will return either a new ConstantUTFInfo object or one already in the constant pool. If it is a new ConstantUTFInfo, it will be inserted into the pool.
[ "Will", "return", "either", "a", "new", "ConstantUTFInfo", "object", "or", "one", "already", "in", "the", "constant", "pool", ".", "If", "it", "is", "a", "new", "ConstantUTFInfo", "it", "will", "be", "inserted", "into", "the", "pool", "." ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/ConstantUTFInfo.java#L35-L38
zandero/http
src/main/java/com/zandero/http/HttpUtils.java
HttpUtils.executeAsync
public static void executeAsync(Executor executor, HttpRequestBase request, FutureCallback<HttpResponse> callback) { """ Step 2. execute request asynchronously @param executor thread executor to be used @param request to be executed @param callback to be invoked when request is completed or failes """ try { executor.execute(new AsyncHttpCall(request, callback)); } catch (Exception e) { log.error("Failed to execute asynchronously: " + request.getMethod() + " " + request.getURI().toString()); } }
java
public static void executeAsync(Executor executor, HttpRequestBase request, FutureCallback<HttpResponse> callback) { try { executor.execute(new AsyncHttpCall(request, callback)); } catch (Exception e) { log.error("Failed to execute asynchronously: " + request.getMethod() + " " + request.getURI().toString()); } }
[ "public", "static", "void", "executeAsync", "(", "Executor", "executor", ",", "HttpRequestBase", "request", ",", "FutureCallback", "<", "HttpResponse", ">", "callback", ")", "{", "try", "{", "executor", ".", "execute", "(", "new", "AsyncHttpCall", "(", "request", ",", "callback", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "error", "(", "\"Failed to execute asynchronously: \"", "+", "request", ".", "getMethod", "(", ")", "+", "\" \"", "+", "request", ".", "getURI", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "}" ]
Step 2. execute request asynchronously @param executor thread executor to be used @param request to be executed @param callback to be invoked when request is completed or failes
[ "Step", "2", ".", "execute", "request", "asynchronously" ]
train
https://github.com/zandero/http/blob/909eb879f1193adf24545360c3b76bd813865f65/src/main/java/com/zandero/http/HttpUtils.java#L304-L312
dkmfbk/knowledgestore
ks-server-hbase/src/main/java/eu/fbk/knowledgestore/datastore/hbase/utils/HBaseUtils.java
HBaseUtils.count
@Override public long count(String tableName, String familyName, XPath condition) throws IOException { """ Gets a number of record of tableName matching condition @param tableName the table name @param familyName the family @param condition to match @throws IOException """ logger.debug("NATIVE Begin count"); // clone the current conf org.apache.hadoop.conf.Configuration customConf = new org.apache.hadoop.conf.Configuration(super.getHbcfg()); // Increase RPC timeout, in case of a slow computation customConf.setLong("hbase.rpc.timeout", 600000); // Default is 1, set to a higher value for faster scanner.next(..) customConf.setLong("hbase.client.scanner.caching", 1000); /* System.out.println("HBaseUtils begin of |customConf|"); Configuration.dumpConfiguration(customConf, new PrintWriter(System.out)); System.out.println("\nHBaseUtils end of |customConf|"); */ AggregationClient agClient = new AggregationClient(customConf); long rowCount = 0; byte[] tName = Bytes.toBytes(tableName); try { Scan scan = getScan(tableName, familyName); rowCount = agClient.rowCount(tName, null, scan); } catch (Throwable e) { throw new IOException(e.toString()); } return rowCount; }
java
@Override public long count(String tableName, String familyName, XPath condition) throws IOException { logger.debug("NATIVE Begin count"); // clone the current conf org.apache.hadoop.conf.Configuration customConf = new org.apache.hadoop.conf.Configuration(super.getHbcfg()); // Increase RPC timeout, in case of a slow computation customConf.setLong("hbase.rpc.timeout", 600000); // Default is 1, set to a higher value for faster scanner.next(..) customConf.setLong("hbase.client.scanner.caching", 1000); /* System.out.println("HBaseUtils begin of |customConf|"); Configuration.dumpConfiguration(customConf, new PrintWriter(System.out)); System.out.println("\nHBaseUtils end of |customConf|"); */ AggregationClient agClient = new AggregationClient(customConf); long rowCount = 0; byte[] tName = Bytes.toBytes(tableName); try { Scan scan = getScan(tableName, familyName); rowCount = agClient.rowCount(tName, null, scan); } catch (Throwable e) { throw new IOException(e.toString()); } return rowCount; }
[ "@", "Override", "public", "long", "count", "(", "String", "tableName", ",", "String", "familyName", ",", "XPath", "condition", ")", "throws", "IOException", "{", "logger", ".", "debug", "(", "\"NATIVE Begin count\"", ")", ";", "// clone the current conf", "org", ".", "apache", ".", "hadoop", ".", "conf", ".", "Configuration", "customConf", "=", "new", "org", ".", "apache", ".", "hadoop", ".", "conf", ".", "Configuration", "(", "super", ".", "getHbcfg", "(", ")", ")", ";", "// Increase RPC timeout, in case of a slow computation", "customConf", ".", "setLong", "(", "\"hbase.rpc.timeout\"", ",", "600000", ")", ";", "// Default is 1, set to a higher value for faster scanner.next(..)", "customConf", ".", "setLong", "(", "\"hbase.client.scanner.caching\"", ",", "1000", ")", ";", "/*\n System.out.println(\"HBaseUtils begin of |customConf|\");\n\tConfiguration.dumpConfiguration(customConf, new PrintWriter(System.out));\n\tSystem.out.println(\"\\nHBaseUtils end of |customConf|\");\n\t*/", "AggregationClient", "agClient", "=", "new", "AggregationClient", "(", "customConf", ")", ";", "long", "rowCount", "=", "0", ";", "byte", "[", "]", "tName", "=", "Bytes", ".", "toBytes", "(", "tableName", ")", ";", "try", "{", "Scan", "scan", "=", "getScan", "(", "tableName", ",", "familyName", ")", ";", "rowCount", "=", "agClient", ".", "rowCount", "(", "tName", ",", "null", ",", "scan", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "throw", "new", "IOException", "(", "e", ".", "toString", "(", ")", ")", ";", "}", "return", "rowCount", ";", "}" ]
Gets a number of record of tableName matching condition @param tableName the table name @param familyName the family @param condition to match @throws IOException
[ "Gets", "a", "number", "of", "record", "of", "tableName", "matching", "condition" ]
train
https://github.com/dkmfbk/knowledgestore/blob/a548101b1dd67fcf72a1ec6f838ea7539bdbbe7a/ks-server-hbase/src/main/java/eu/fbk/knowledgestore/datastore/hbase/utils/HBaseUtils.java#L246-L272
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/dependence/AbstractDependenceMeasure.java
AbstractDependenceMeasure.size
protected static <A> int size(NumberArrayAdapter<?, A> adapter, Collection<? extends A> data) { """ Validate the length of the two data sets (must be the same, and non-zero) @param adapter Data adapter @param data Data sets @param <A> First array type """ if(data.size() < 2) { throw new IllegalArgumentException("Need at least two axes to compute dependence measures."); } Iterator<? extends A> iter = data.iterator(); final int len = adapter.size(iter.next()); while(iter.hasNext()) { if(len != adapter.size(iter.next())) { throw new IllegalArgumentException("Array sizes do not match!"); } } if(len == 0) { throw new IllegalArgumentException("Empty array!"); } return len; }
java
protected static <A> int size(NumberArrayAdapter<?, A> adapter, Collection<? extends A> data) { if(data.size() < 2) { throw new IllegalArgumentException("Need at least two axes to compute dependence measures."); } Iterator<? extends A> iter = data.iterator(); final int len = adapter.size(iter.next()); while(iter.hasNext()) { if(len != adapter.size(iter.next())) { throw new IllegalArgumentException("Array sizes do not match!"); } } if(len == 0) { throw new IllegalArgumentException("Empty array!"); } return len; }
[ "protected", "static", "<", "A", ">", "int", "size", "(", "NumberArrayAdapter", "<", "?", ",", "A", ">", "adapter", ",", "Collection", "<", "?", "extends", "A", ">", "data", ")", "{", "if", "(", "data", ".", "size", "(", ")", "<", "2", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Need at least two axes to compute dependence measures.\"", ")", ";", "}", "Iterator", "<", "?", "extends", "A", ">", "iter", "=", "data", ".", "iterator", "(", ")", ";", "final", "int", "len", "=", "adapter", ".", "size", "(", "iter", ".", "next", "(", ")", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "if", "(", "len", "!=", "adapter", ".", "size", "(", "iter", ".", "next", "(", ")", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Array sizes do not match!\"", ")", ";", "}", "}", "if", "(", "len", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Empty array!\"", ")", ";", "}", "return", "len", ";", "}" ]
Validate the length of the two data sets (must be the same, and non-zero) @param adapter Data adapter @param data Data sets @param <A> First array type
[ "Validate", "the", "length", "of", "the", "two", "data", "sets", "(", "must", "be", "the", "same", "and", "non", "-", "zero", ")" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/dependence/AbstractDependenceMeasure.java#L203-L218
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_http_route_GET
public ArrayList<Long> serviceName_http_route_GET(String serviceName, Long frontendId) throws IOException { """ HTTP routes for this iplb REST: GET /ipLoadbalancing/{serviceName}/http/route @param frontendId [required] Filter the value of frontendId property (=) @param serviceName [required] The internal name of your IP load balancing """ String qPath = "/ipLoadbalancing/{serviceName}/http/route"; StringBuilder sb = path(qPath, serviceName); query(sb, "frontendId", frontendId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<Long> serviceName_http_route_GET(String serviceName, Long frontendId) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/http/route"; StringBuilder sb = path(qPath, serviceName); query(sb, "frontendId", frontendId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "Long", ">", "serviceName_http_route_GET", "(", "String", "serviceName", ",", "Long", "frontendId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ipLoadbalancing/{serviceName}/http/route\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "query", "(", "sb", ",", "\"frontendId\"", ",", "frontendId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t2", ")", ";", "}" ]
HTTP routes for this iplb REST: GET /ipLoadbalancing/{serviceName}/http/route @param frontendId [required] Filter the value of frontendId property (=) @param serviceName [required] The internal name of your IP load balancing
[ "HTTP", "routes", "for", "this", "iplb" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L102-L108
apiman/apiman
gateway/platforms/servlet/src/main/java/io/apiman/gateway/platforms/servlet/GatewayServlet.java
GatewayServlet.getApiKey
protected String getApiKey(HttpServletRequest request, QueryMap queryParams) { """ Gets the API Key from the request. The API key can be passed either via a custom http request header called X-API-Key or else by a query parameter in the URL called apikey. @param request the inbound request @param queryParams the inbound request query params @return the api key or null if not found """ String apiKey = request.getHeader("X-API-Key"); //$NON-NLS-1$ if (apiKey == null || apiKey.trim().length() == 0) { apiKey = queryParams.get("apikey"); //$NON-NLS-1$ } return apiKey; }
java
protected String getApiKey(HttpServletRequest request, QueryMap queryParams) { String apiKey = request.getHeader("X-API-Key"); //$NON-NLS-1$ if (apiKey == null || apiKey.trim().length() == 0) { apiKey = queryParams.get("apikey"); //$NON-NLS-1$ } return apiKey; }
[ "protected", "String", "getApiKey", "(", "HttpServletRequest", "request", ",", "QueryMap", "queryParams", ")", "{", "String", "apiKey", "=", "request", ".", "getHeader", "(", "\"X-API-Key\"", ")", ";", "//$NON-NLS-1$", "if", "(", "apiKey", "==", "null", "||", "apiKey", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", "{", "apiKey", "=", "queryParams", ".", "get", "(", "\"apikey\"", ")", ";", "//$NON-NLS-1$", "}", "return", "apiKey", ";", "}" ]
Gets the API Key from the request. The API key can be passed either via a custom http request header called X-API-Key or else by a query parameter in the URL called apikey. @param request the inbound request @param queryParams the inbound request query params @return the api key or null if not found
[ "Gets", "the", "API", "Key", "from", "the", "request", ".", "The", "API", "key", "can", "be", "passed", "either", "via", "a", "custom", "http", "request", "header", "called", "X", "-", "API", "-", "Key", "or", "else", "by", "a", "query", "parameter", "in", "the", "URL", "called", "apikey", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/platforms/servlet/src/main/java/io/apiman/gateway/platforms/servlet/GatewayServlet.java#L250-L256
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/MariaDbPooledConnection.java
MariaDbPooledConnection.fireConnectionErrorOccured
public void fireConnectionErrorOccured(SQLException ex) { """ Fire connection error to listening listeners. @param ex exception """ ConnectionEvent event = new ConnectionEvent(this, ex); for (ConnectionEventListener listener : connectionEventListeners) { listener.connectionErrorOccurred(event); } }
java
public void fireConnectionErrorOccured(SQLException ex) { ConnectionEvent event = new ConnectionEvent(this, ex); for (ConnectionEventListener listener : connectionEventListeners) { listener.connectionErrorOccurred(event); } }
[ "public", "void", "fireConnectionErrorOccured", "(", "SQLException", "ex", ")", "{", "ConnectionEvent", "event", "=", "new", "ConnectionEvent", "(", "this", ",", "ex", ")", ";", "for", "(", "ConnectionEventListener", "listener", ":", "connectionEventListeners", ")", "{", "listener", ".", "connectionErrorOccurred", "(", "event", ")", ";", "}", "}" ]
Fire connection error to listening listeners. @param ex exception
[ "Fire", "connection", "error", "to", "listening", "listeners", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbPooledConnection.java#L228-L233
micrometer-metrics/micrometer
micrometer-core/src/main/java/io/micrometer/core/instrument/binder/kafka/KafkaConsumerMetrics.java
KafkaConsumerMetrics.registerNotificationListener
private void registerNotificationListener(String type, BiConsumer<ObjectName, Tags> perObject) { """ This notification listener should remain indefinitely since new Kafka consumers can be added at any time. @param type The Kafka JMX type to listen for. @param perObject Metric registration handler when a new MBean is created. """ NotificationListener notificationListener = (notification, handback) -> { MBeanServerNotification mbs = (MBeanServerNotification) notification; ObjectName o = mbs.getMBeanName(); perObject.accept(o, Tags.concat(tags, nameTag(o))); }; NotificationFilter filter = (NotificationFilter) notification -> { if (!MBeanServerNotification.REGISTRATION_NOTIFICATION.equals(notification.getType())) return false; ObjectName obj = ((MBeanServerNotification) notification).getMBeanName(); return obj.getDomain().equals(JMX_DOMAIN) && obj.getKeyProperty("type").equals(type); }; try { mBeanServer.addNotificationListener(MBeanServerDelegate.DELEGATE_NAME, notificationListener, filter, null); notificationListenerCleanUpRunnables.add(() -> { try { mBeanServer.removeNotificationListener(MBeanServerDelegate.DELEGATE_NAME, notificationListener); } catch (InstanceNotFoundException | ListenerNotFoundException ignored) { } }); } catch (InstanceNotFoundException e) { throw new RuntimeException("Error registering Kafka MBean listener", e); } }
java
private void registerNotificationListener(String type, BiConsumer<ObjectName, Tags> perObject) { NotificationListener notificationListener = (notification, handback) -> { MBeanServerNotification mbs = (MBeanServerNotification) notification; ObjectName o = mbs.getMBeanName(); perObject.accept(o, Tags.concat(tags, nameTag(o))); }; NotificationFilter filter = (NotificationFilter) notification -> { if (!MBeanServerNotification.REGISTRATION_NOTIFICATION.equals(notification.getType())) return false; ObjectName obj = ((MBeanServerNotification) notification).getMBeanName(); return obj.getDomain().equals(JMX_DOMAIN) && obj.getKeyProperty("type").equals(type); }; try { mBeanServer.addNotificationListener(MBeanServerDelegate.DELEGATE_NAME, notificationListener, filter, null); notificationListenerCleanUpRunnables.add(() -> { try { mBeanServer.removeNotificationListener(MBeanServerDelegate.DELEGATE_NAME, notificationListener); } catch (InstanceNotFoundException | ListenerNotFoundException ignored) { } }); } catch (InstanceNotFoundException e) { throw new RuntimeException("Error registering Kafka MBean listener", e); } }
[ "private", "void", "registerNotificationListener", "(", "String", "type", ",", "BiConsumer", "<", "ObjectName", ",", "Tags", ">", "perObject", ")", "{", "NotificationListener", "notificationListener", "=", "(", "notification", ",", "handback", ")", "->", "{", "MBeanServerNotification", "mbs", "=", "(", "MBeanServerNotification", ")", "notification", ";", "ObjectName", "o", "=", "mbs", ".", "getMBeanName", "(", ")", ";", "perObject", ".", "accept", "(", "o", ",", "Tags", ".", "concat", "(", "tags", ",", "nameTag", "(", "o", ")", ")", ")", ";", "}", ";", "NotificationFilter", "filter", "=", "(", "NotificationFilter", ")", "notification", "->", "{", "if", "(", "!", "MBeanServerNotification", ".", "REGISTRATION_NOTIFICATION", ".", "equals", "(", "notification", ".", "getType", "(", ")", ")", ")", "return", "false", ";", "ObjectName", "obj", "=", "(", "(", "MBeanServerNotification", ")", "notification", ")", ".", "getMBeanName", "(", ")", ";", "return", "obj", ".", "getDomain", "(", ")", ".", "equals", "(", "JMX_DOMAIN", ")", "&&", "obj", ".", "getKeyProperty", "(", "\"type\"", ")", ".", "equals", "(", "type", ")", ";", "}", ";", "try", "{", "mBeanServer", ".", "addNotificationListener", "(", "MBeanServerDelegate", ".", "DELEGATE_NAME", ",", "notificationListener", ",", "filter", ",", "null", ")", ";", "notificationListenerCleanUpRunnables", ".", "add", "(", "(", ")", "->", "{", "try", "{", "mBeanServer", ".", "removeNotificationListener", "(", "MBeanServerDelegate", ".", "DELEGATE_NAME", ",", "notificationListener", ")", ";", "}", "catch", "(", "InstanceNotFoundException", "|", "ListenerNotFoundException", "ignored", ")", "{", "}", "}", ")", ";", "}", "catch", "(", "InstanceNotFoundException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Error registering Kafka MBean listener\"", ",", "e", ")", ";", "}", "}" ]
This notification listener should remain indefinitely since new Kafka consumers can be added at any time. @param type The Kafka JMX type to listen for. @param perObject Metric registration handler when a new MBean is created.
[ "This", "notification", "listener", "should", "remain", "indefinitely", "since", "new", "Kafka", "consumers", "can", "be", "added", "at", "any", "time", "." ]
train
https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/kafka/KafkaConsumerMetrics.java#L253-L278
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/ngmf/util/cosu/luca/ParameterData.java
ParameterData.setStat
public void setStat(double[] dataValue, int calibrationType, boolean[] calibrate) { """ /* Sets the parameter values, the type of calibration, and the calibration flag. Also, the mean of the parameter values is calculated, and the max and min value of the parameter values are determined. """ this.data = dataValue; this.calibrationType = calibrationType; this.calibrationFlag = calibrate; calibrationDataSize = 0; for (int i = 0; i < this.calibrationFlag.length; i++) { if (calibrate[i]) { calibrationDataSize++; } } calculateMean(); findMin(); findMax(); // setDeviation(); }
java
public void setStat(double[] dataValue, int calibrationType, boolean[] calibrate) { this.data = dataValue; this.calibrationType = calibrationType; this.calibrationFlag = calibrate; calibrationDataSize = 0; for (int i = 0; i < this.calibrationFlag.length; i++) { if (calibrate[i]) { calibrationDataSize++; } } calculateMean(); findMin(); findMax(); // setDeviation(); }
[ "public", "void", "setStat", "(", "double", "[", "]", "dataValue", ",", "int", "calibrationType", ",", "boolean", "[", "]", "calibrate", ")", "{", "this", ".", "data", "=", "dataValue", ";", "this", ".", "calibrationType", "=", "calibrationType", ";", "this", ".", "calibrationFlag", "=", "calibrate", ";", "calibrationDataSize", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "calibrationFlag", ".", "length", ";", "i", "++", ")", "{", "if", "(", "calibrate", "[", "i", "]", ")", "{", "calibrationDataSize", "++", ";", "}", "}", "calculateMean", "(", ")", ";", "findMin", "(", ")", ";", "findMax", "(", ")", ";", "// setDeviation();", "}" ]
/* Sets the parameter values, the type of calibration, and the calibration flag. Also, the mean of the parameter values is calculated, and the max and min value of the parameter values are determined.
[ "/", "*", "Sets", "the", "parameter", "values", "the", "type", "of", "calibration", "and", "the", "calibration", "flag", ".", "Also", "the", "mean", "of", "the", "parameter", "values", "is", "calculated", "and", "the", "max", "and", "min", "value", "of", "the", "parameter", "values", "are", "determined", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/ngmf/util/cosu/luca/ParameterData.java#L202-L218
codelibs/jcifs
src/main/java/jcifs/smb1/Config.java
Config.getBoolean
public static boolean getBoolean( String key, boolean def ) { """ Retrieve a boolean value. If the property is not found, the value of <code>def</code> is returned. """ String b = getProperty( key ); if( b != null ) { def = b.toLowerCase().equals( "true" ); } return def; }
java
public static boolean getBoolean( String key, boolean def ) { String b = getProperty( key ); if( b != null ) { def = b.toLowerCase().equals( "true" ); } return def; }
[ "public", "static", "boolean", "getBoolean", "(", "String", "key", ",", "boolean", "def", ")", "{", "String", "b", "=", "getProperty", "(", "key", ")", ";", "if", "(", "b", "!=", "null", ")", "{", "def", "=", "b", ".", "toLowerCase", "(", ")", ".", "equals", "(", "\"true\"", ")", ";", "}", "return", "def", ";", "}" ]
Retrieve a boolean value. If the property is not found, the value of <code>def</code> is returned.
[ "Retrieve", "a", "boolean", "value", ".", "If", "the", "property", "is", "not", "found", "the", "value", "of", "<code", ">", "def<", "/", "code", ">", "is", "returned", "." ]
train
https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/Config.java#L313-L319
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/common/service/ServiceRegistry.java
ServiceRegistry.addDynamicService
public void addDynamicService(String serviceInterface, String className) { """ Add Dynamic Java Registered Service class names for each service @param serviceInterface @param className """ if (dynamicServices.containsKey(serviceInterface)) { dynamicServices.get(serviceInterface).add(className); } else { Set<String> classNamesSet = new HashSet<String>(); classNamesSet.add(className); dynamicServices.put(serviceInterface, classNamesSet); } }
java
public void addDynamicService(String serviceInterface, String className) { if (dynamicServices.containsKey(serviceInterface)) { dynamicServices.get(serviceInterface).add(className); } else { Set<String> classNamesSet = new HashSet<String>(); classNamesSet.add(className); dynamicServices.put(serviceInterface, classNamesSet); } }
[ "public", "void", "addDynamicService", "(", "String", "serviceInterface", ",", "String", "className", ")", "{", "if", "(", "dynamicServices", ".", "containsKey", "(", "serviceInterface", ")", ")", "{", "dynamicServices", ".", "get", "(", "serviceInterface", ")", ".", "add", "(", "className", ")", ";", "}", "else", "{", "Set", "<", "String", ">", "classNamesSet", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "classNamesSet", ".", "add", "(", "className", ")", ";", "dynamicServices", ".", "put", "(", "serviceInterface", ",", "classNamesSet", ")", ";", "}", "}" ]
Add Dynamic Java Registered Service class names for each service @param serviceInterface @param className
[ "Add", "Dynamic", "Java", "Registered", "Service", "class", "names", "for", "each", "service" ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/common/service/ServiceRegistry.java#L140-L149
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.runAfter
public static TimerTask runAfter(Timer timer, int delay, final Closure closure) { """ Allows a simple syntax for using timers. This timer will execute the given closure after the given delay. @param timer a timer object @param delay the delay in milliseconds before running the closure code @param closure the closure to invoke @return The timer task which has been scheduled. @since 1.5.0 """ TimerTask timerTask = new TimerTask() { public void run() { closure.call(); } }; timer.schedule(timerTask, delay); return timerTask; }
java
public static TimerTask runAfter(Timer timer, int delay, final Closure closure) { TimerTask timerTask = new TimerTask() { public void run() { closure.call(); } }; timer.schedule(timerTask, delay); return timerTask; }
[ "public", "static", "TimerTask", "runAfter", "(", "Timer", "timer", ",", "int", "delay", ",", "final", "Closure", "closure", ")", "{", "TimerTask", "timerTask", "=", "new", "TimerTask", "(", ")", "{", "public", "void", "run", "(", ")", "{", "closure", ".", "call", "(", ")", ";", "}", "}", ";", "timer", ".", "schedule", "(", "timerTask", ",", "delay", ")", ";", "return", "timerTask", ";", "}" ]
Allows a simple syntax for using timers. This timer will execute the given closure after the given delay. @param timer a timer object @param delay the delay in milliseconds before running the closure code @param closure the closure to invoke @return The timer task which has been scheduled. @since 1.5.0
[ "Allows", "a", "simple", "syntax", "for", "using", "timers", ".", "This", "timer", "will", "execute", "the", "given", "closure", "after", "the", "given", "delay", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16651-L16659
samskivert/pythagoras
src/main/java/pythagoras/d/Box.java
Box.intersectionX
protected double intersectionX (IRay3 ray, double x) { """ Helper method for {@link #intersection}. Finds the <code>t</code> value where the ray intersects the box at the plane where x equals the value specified, or returns {@link Float#MAX_VALUE} if there is no such intersection. """ IVector3 origin = ray.origin(), dir = ray.direction(); double t = (x - origin.x()) / dir.x(); if (t < 0f) { return Float.MAX_VALUE; } double iy = origin.y() + t*dir.y(), iz = origin.z() + t*dir.z(); return (iy >= _minExtent.y && iy <= _maxExtent.y && iz >= _minExtent.z && iz <= _maxExtent.z) ? t : Float.MAX_VALUE; }
java
protected double intersectionX (IRay3 ray, double x) { IVector3 origin = ray.origin(), dir = ray.direction(); double t = (x - origin.x()) / dir.x(); if (t < 0f) { return Float.MAX_VALUE; } double iy = origin.y() + t*dir.y(), iz = origin.z() + t*dir.z(); return (iy >= _minExtent.y && iy <= _maxExtent.y && iz >= _minExtent.z && iz <= _maxExtent.z) ? t : Float.MAX_VALUE; }
[ "protected", "double", "intersectionX", "(", "IRay3", "ray", ",", "double", "x", ")", "{", "IVector3", "origin", "=", "ray", ".", "origin", "(", ")", ",", "dir", "=", "ray", ".", "direction", "(", ")", ";", "double", "t", "=", "(", "x", "-", "origin", ".", "x", "(", ")", ")", "/", "dir", ".", "x", "(", ")", ";", "if", "(", "t", "<", "0f", ")", "{", "return", "Float", ".", "MAX_VALUE", ";", "}", "double", "iy", "=", "origin", ".", "y", "(", ")", "+", "t", "*", "dir", ".", "y", "(", ")", ",", "iz", "=", "origin", ".", "z", "(", ")", "+", "t", "*", "dir", ".", "z", "(", ")", ";", "return", "(", "iy", ">=", "_minExtent", ".", "y", "&&", "iy", "<=", "_maxExtent", ".", "y", "&&", "iz", ">=", "_minExtent", ".", "z", "&&", "iz", "<=", "_maxExtent", ".", "z", ")", "?", "t", ":", "Float", ".", "MAX_VALUE", ";", "}" ]
Helper method for {@link #intersection}. Finds the <code>t</code> value where the ray intersects the box at the plane where x equals the value specified, or returns {@link Float#MAX_VALUE} if there is no such intersection.
[ "Helper", "method", "for", "{" ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Box.java#L480-L489
structurizr/java
structurizr-core/src/com/structurizr/view/ViewSet.java
ViewSet.createSystemLandscapeView
public SystemLandscapeView createSystemLandscapeView(String key, String description) { """ Creates a system landscape view. @param key the key for the view (must be unique) @param description a description of the view @return an SystemLandscapeView object @throws IllegalArgumentException if the key is not unique """ assertThatTheViewKeyIsSpecifiedAndUnique(key); SystemLandscapeView view = new SystemLandscapeView(model, key, description); view.setViewSet(this); systemLandscapeViews.add(view); return view; }
java
public SystemLandscapeView createSystemLandscapeView(String key, String description) { assertThatTheViewKeyIsSpecifiedAndUnique(key); SystemLandscapeView view = new SystemLandscapeView(model, key, description); view.setViewSet(this); systemLandscapeViews.add(view); return view; }
[ "public", "SystemLandscapeView", "createSystemLandscapeView", "(", "String", "key", ",", "String", "description", ")", "{", "assertThatTheViewKeyIsSpecifiedAndUnique", "(", "key", ")", ";", "SystemLandscapeView", "view", "=", "new", "SystemLandscapeView", "(", "model", ",", "key", ",", "description", ")", ";", "view", ".", "setViewSet", "(", "this", ")", ";", "systemLandscapeViews", ".", "add", "(", "view", ")", ";", "return", "view", ";", "}" ]
Creates a system landscape view. @param key the key for the view (must be unique) @param description a description of the view @return an SystemLandscapeView object @throws IllegalArgumentException if the key is not unique
[ "Creates", "a", "system", "landscape", "view", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/ViewSet.java#L53-L60
cache2k/cache2k
cache2k-api/src/main/java/org/cache2k/spi/SingleProviderResolver.java
SingleProviderResolver.resolve
@SuppressWarnings("unchecked") public synchronized static <T> T resolve(Class<T> c, Class<? extends T> defaultImpl) { """ Return a provider for this interface. @param c the provider interface that is implemented @param defaultImpl if no provider is found, instantiate the default implementation @param <T> type of provider interface @return instance of the provider or {@code null} if not found @throws java.lang.LinkageError if there is a problem instantiating the provider """ if (providers.containsKey(c)) { return (T) providers.get(c); } try { String _className = readFile("org/cache2k/services/" + c.getName()); T obj = null; if (_className == null) { ServiceLoader<T> sl = ServiceLoader.load(c); Iterator<T> it = sl.iterator(); if (it.hasNext()) { obj = it.next(); } } else { obj = (T) SingleProviderResolver.class.getClassLoader().loadClass(_className).newInstance(); } if (obj == null && defaultImpl != null) { obj = defaultImpl.newInstance(); } providers.put(c, obj); return obj; } catch (Exception ex) { Error err = new LinkageError("Error instantiating " + c.getName(), ex); err.printStackTrace(); throw err; } }
java
@SuppressWarnings("unchecked") public synchronized static <T> T resolve(Class<T> c, Class<? extends T> defaultImpl) { if (providers.containsKey(c)) { return (T) providers.get(c); } try { String _className = readFile("org/cache2k/services/" + c.getName()); T obj = null; if (_className == null) { ServiceLoader<T> sl = ServiceLoader.load(c); Iterator<T> it = sl.iterator(); if (it.hasNext()) { obj = it.next(); } } else { obj = (T) SingleProviderResolver.class.getClassLoader().loadClass(_className).newInstance(); } if (obj == null && defaultImpl != null) { obj = defaultImpl.newInstance(); } providers.put(c, obj); return obj; } catch (Exception ex) { Error err = new LinkageError("Error instantiating " + c.getName(), ex); err.printStackTrace(); throw err; } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "synchronized", "static", "<", "T", ">", "T", "resolve", "(", "Class", "<", "T", ">", "c", ",", "Class", "<", "?", "extends", "T", ">", "defaultImpl", ")", "{", "if", "(", "providers", ".", "containsKey", "(", "c", ")", ")", "{", "return", "(", "T", ")", "providers", ".", "get", "(", "c", ")", ";", "}", "try", "{", "String", "_className", "=", "readFile", "(", "\"org/cache2k/services/\"", "+", "c", ".", "getName", "(", ")", ")", ";", "T", "obj", "=", "null", ";", "if", "(", "_className", "==", "null", ")", "{", "ServiceLoader", "<", "T", ">", "sl", "=", "ServiceLoader", ".", "load", "(", "c", ")", ";", "Iterator", "<", "T", ">", "it", "=", "sl", ".", "iterator", "(", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "obj", "=", "it", ".", "next", "(", ")", ";", "}", "}", "else", "{", "obj", "=", "(", "T", ")", "SingleProviderResolver", ".", "class", ".", "getClassLoader", "(", ")", ".", "loadClass", "(", "_className", ")", ".", "newInstance", "(", ")", ";", "}", "if", "(", "obj", "==", "null", "&&", "defaultImpl", "!=", "null", ")", "{", "obj", "=", "defaultImpl", ".", "newInstance", "(", ")", ";", "}", "providers", ".", "put", "(", "c", ",", "obj", ")", ";", "return", "obj", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "Error", "err", "=", "new", "LinkageError", "(", "\"Error instantiating \"", "+", "c", ".", "getName", "(", ")", ",", "ex", ")", ";", "err", ".", "printStackTrace", "(", ")", ";", "throw", "err", ";", "}", "}" ]
Return a provider for this interface. @param c the provider interface that is implemented @param defaultImpl if no provider is found, instantiate the default implementation @param <T> type of provider interface @return instance of the provider or {@code null} if not found @throws java.lang.LinkageError if there is a problem instantiating the provider
[ "Return", "a", "provider", "for", "this", "interface", "." ]
train
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-api/src/main/java/org/cache2k/spi/SingleProviderResolver.java#L95-L122
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/Broadcast.java
Broadcast.gte
public static INDArray gte(INDArray x, INDArray y, INDArray z, int... dimensions) { """ Broadcast greater than or equal to op. See: {@link BroadcastGreaterThanOrEqual} """ if(dimensions == null || dimensions.length == 0) { validateShapesNoDimCase(x,y,z); return Nd4j.getExecutioner().exec(new OldGreaterThanOrEqual(x,y,z)); } return Nd4j.getExecutioner().exec(new BroadcastGreaterThanOrEqual(x,y,z,dimensions)); }
java
public static INDArray gte(INDArray x, INDArray y, INDArray z, int... dimensions) { if(dimensions == null || dimensions.length == 0) { validateShapesNoDimCase(x,y,z); return Nd4j.getExecutioner().exec(new OldGreaterThanOrEqual(x,y,z)); } return Nd4j.getExecutioner().exec(new BroadcastGreaterThanOrEqual(x,y,z,dimensions)); }
[ "public", "static", "INDArray", "gte", "(", "INDArray", "x", ",", "INDArray", "y", ",", "INDArray", "z", ",", "int", "...", "dimensions", ")", "{", "if", "(", "dimensions", "==", "null", "||", "dimensions", ".", "length", "==", "0", ")", "{", "validateShapesNoDimCase", "(", "x", ",", "y", ",", "z", ")", ";", "return", "Nd4j", ".", "getExecutioner", "(", ")", ".", "exec", "(", "new", "OldGreaterThanOrEqual", "(", "x", ",", "y", ",", "z", ")", ")", ";", "}", "return", "Nd4j", ".", "getExecutioner", "(", ")", ".", "exec", "(", "new", "BroadcastGreaterThanOrEqual", "(", "x", ",", "y", ",", "z", ",", "dimensions", ")", ")", ";", "}" ]
Broadcast greater than or equal to op. See: {@link BroadcastGreaterThanOrEqual}
[ "Broadcast", "greater", "than", "or", "equal", "to", "op", ".", "See", ":", "{" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/Broadcast.java#L101-L108
cybazeitalia/emaze-dysfunctional
src/main/java/net/emaze/dysfunctional/Spies.java
Spies.spyRes
public static <T1, T2, R> BiFunction<T1, T2, R> spyRes(BiFunction<T1, T2, R> function, Box<R> result) { """ Proxies a binary function spying for result. @param <T1> the function first parameter type @param <T2> the function second parameter type @param <R> the function result type @param function the function that will be spied @param result a box that will be containing spied result @return the proxied function """ return spy(function, result, Box.<T1>empty(), Box.<T2>empty()); }
java
public static <T1, T2, R> BiFunction<T1, T2, R> spyRes(BiFunction<T1, T2, R> function, Box<R> result) { return spy(function, result, Box.<T1>empty(), Box.<T2>empty()); }
[ "public", "static", "<", "T1", ",", "T2", ",", "R", ">", "BiFunction", "<", "T1", ",", "T2", ",", "R", ">", "spyRes", "(", "BiFunction", "<", "T1", ",", "T2", ",", "R", ">", "function", ",", "Box", "<", "R", ">", "result", ")", "{", "return", "spy", "(", "function", ",", "result", ",", "Box", ".", "<", "T1", ">", "empty", "(", ")", ",", "Box", ".", "<", "T2", ">", "empty", "(", ")", ")", ";", "}" ]
Proxies a binary function spying for result. @param <T1> the function first parameter type @param <T2> the function second parameter type @param <R> the function result type @param function the function that will be spied @param result a box that will be containing spied result @return the proxied function
[ "Proxies", "a", "binary", "function", "spying", "for", "result", "." ]
train
https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Spies.java#L253-L255
sarl/sarl
products/sarlc/src/main/java/io/sarl/lang/sarlc/modules/commands/CompilerCommandModule.java
CompilerCommandModule.getProgressBarConfig
@SuppressWarnings("static-method") @Provides @Singleton public ProgressBarConfig getProgressBarConfig(ConfigurationFactory configFactory, Injector injector) { """ Replies the instance of the compiler command configuration. @param configFactory accessor to the bootique factory. @param injector the current injector. @return the compiler command configuration accessor. """ final ProgressBarConfig config = ProgressBarConfig.getConfiguration(configFactory); injector.injectMembers(config); return config; }
java
@SuppressWarnings("static-method") @Provides @Singleton public ProgressBarConfig getProgressBarConfig(ConfigurationFactory configFactory, Injector injector) { final ProgressBarConfig config = ProgressBarConfig.getConfiguration(configFactory); injector.injectMembers(config); return config; }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "@", "Provides", "@", "Singleton", "public", "ProgressBarConfig", "getProgressBarConfig", "(", "ConfigurationFactory", "configFactory", ",", "Injector", "injector", ")", "{", "final", "ProgressBarConfig", "config", "=", "ProgressBarConfig", ".", "getConfiguration", "(", "configFactory", ")", ";", "injector", ".", "injectMembers", "(", "config", ")", ";", "return", "config", ";", "}" ]
Replies the instance of the compiler command configuration. @param configFactory accessor to the bootique factory. @param injector the current injector. @return the compiler command configuration accessor.
[ "Replies", "the", "instance", "of", "the", "compiler", "command", "configuration", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/products/sarlc/src/main/java/io/sarl/lang/sarlc/modules/commands/CompilerCommandModule.java#L92-L99
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java
SimpleDocTreeVisitor.visitSince
@Override public R visitSince(SinceTree node, P p) { """ {@inheritDoc} This implementation calls {@code defaultAction}. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of {@code defaultAction} """ return defaultAction(node, p); }
java
@Override public R visitSince(SinceTree node, P p) { return defaultAction(node, p); }
[ "@", "Override", "public", "R", "visitSince", "(", "SinceTree", "node", ",", "P", "p", ")", "{", "return", "defaultAction", "(", "node", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation calls {@code defaultAction}. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of {@code defaultAction}
[ "{", "@inheritDoc", "}", "This", "implementation", "calls", "{", "@code", "defaultAction", "}", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L381-L384
aalmiray/Json-lib
src/main/java/net/sf/json/JsonConfig.java
JsonConfig.registerPropertyExclusions
public void registerPropertyExclusions( Class target, String[] properties ) { """ Registers exclusions for a target class.<br> [Java -&gt; JSON] @param target the class to use as key @param properties the properties to be excluded """ if( target != null && properties != null && properties.length > 0 ) { Set set = (Set) exclusionMap.get( target ); if( set == null ) { set = new HashSet(); exclusionMap.put( target, set ); } for( int i = 0; i < properties.length; i++ ) { if( !set.contains( properties[i] ) ) { set.add( properties[i] ); } } } }
java
public void registerPropertyExclusions( Class target, String[] properties ) { if( target != null && properties != null && properties.length > 0 ) { Set set = (Set) exclusionMap.get( target ); if( set == null ) { set = new HashSet(); exclusionMap.put( target, set ); } for( int i = 0; i < properties.length; i++ ) { if( !set.contains( properties[i] ) ) { set.add( properties[i] ); } } } }
[ "public", "void", "registerPropertyExclusions", "(", "Class", "target", ",", "String", "[", "]", "properties", ")", "{", "if", "(", "target", "!=", "null", "&&", "properties", "!=", "null", "&&", "properties", ".", "length", ">", "0", ")", "{", "Set", "set", "=", "(", "Set", ")", "exclusionMap", ".", "get", "(", "target", ")", ";", "if", "(", "set", "==", "null", ")", "{", "set", "=", "new", "HashSet", "(", ")", ";", "exclusionMap", ".", "put", "(", "target", ",", "set", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "properties", ".", "length", ";", "i", "++", ")", "{", "if", "(", "!", "set", ".", "contains", "(", "properties", "[", "i", "]", ")", ")", "{", "set", ".", "add", "(", "properties", "[", "i", "]", ")", ";", "}", "}", "}", "}" ]
Registers exclusions for a target class.<br> [Java -&gt; JSON] @param target the class to use as key @param properties the properties to be excluded
[ "Registers", "exclusions", "for", "a", "target", "class", ".", "<br", ">", "[", "Java", "-", "&gt", ";", "JSON", "]" ]
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JsonConfig.java#L886-L899
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/GenericLogicDiscoverer.java
GenericLogicDiscoverer.findOperationsConsumingSome
@Override public Map<URI, MatchResult> findOperationsConsumingSome(Set<URI> inputTypes) { """ Discover registered operations that consume some (i.e., at least one) of the types of input provided. That is, all those that have as input the types provided. @param inputTypes the types of input to be consumed @return a Set containing all the matching operations. If there are no solutions, the Set should be empty, not null. """ return findServicesClassifiedBySome(inputTypes, LogicConceptMatchType.Plugin); }
java
@Override public Map<URI, MatchResult> findOperationsConsumingSome(Set<URI> inputTypes) { return findServicesClassifiedBySome(inputTypes, LogicConceptMatchType.Plugin); }
[ "@", "Override", "public", "Map", "<", "URI", ",", "MatchResult", ">", "findOperationsConsumingSome", "(", "Set", "<", "URI", ">", "inputTypes", ")", "{", "return", "findServicesClassifiedBySome", "(", "inputTypes", ",", "LogicConceptMatchType", ".", "Plugin", ")", ";", "}" ]
Discover registered operations that consume some (i.e., at least one) of the types of input provided. That is, all those that have as input the types provided. @param inputTypes the types of input to be consumed @return a Set containing all the matching operations. If there are no solutions, the Set should be empty, not null.
[ "Discover", "registered", "operations", "that", "consume", "some", "(", "i", ".", "e", ".", "at", "least", "one", ")", "of", "the", "types", "of", "input", "provided", ".", "That", "is", "all", "those", "that", "have", "as", "input", "the", "types", "provided", "." ]
train
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/GenericLogicDiscoverer.java#L265-L268
alkacon/opencms-core
src/org/opencms/ade/configuration/CmsConfigurationReader.java
CmsConfigurationReader.parseDetailPage
protected void parseDetailPage(I_CmsXmlContentLocation node) throws CmsException { """ Parses the detail pages from an XML content node.<p> @param node the XML content node @throws CmsException if something goes wrong """ I_CmsXmlContentValueLocation pageLoc = node.getSubValue(N_PAGE); String typeName = getString(node.getSubValue(N_TYPE)); try { String page = pageLoc.asString(m_cms); CmsResource detailPageRes = m_cms.readResource(page); CmsUUID id = detailPageRes.getStructureId(); String iconClasses; if (typeName.startsWith(CmsDetailPageInfo.FUNCTION_PREFIX)) { iconClasses = CmsIconUtil.getIconClasses(CmsXmlDynamicFunctionHandler.TYPE_FUNCTION, null, false); } else { iconClasses = CmsIconUtil.getIconClasses(typeName, null, false); } CmsDetailPageInfo detailPage = new CmsDetailPageInfo(id, page, typeName, iconClasses); m_detailPageConfigs.add(detailPage); } catch (CmsVfsResourceNotFoundException e) { CmsUUID structureId = pageLoc.asId(m_cms); CmsResource detailPageRes = m_cms.readResource(structureId); CmsDetailPageInfo detailPage = new CmsDetailPageInfo( structureId, m_cms.getSitePath(detailPageRes), typeName, CmsIconUtil.getIconClasses(typeName, null, false)); m_detailPageConfigs.add(detailPage); } }
java
protected void parseDetailPage(I_CmsXmlContentLocation node) throws CmsException { I_CmsXmlContentValueLocation pageLoc = node.getSubValue(N_PAGE); String typeName = getString(node.getSubValue(N_TYPE)); try { String page = pageLoc.asString(m_cms); CmsResource detailPageRes = m_cms.readResource(page); CmsUUID id = detailPageRes.getStructureId(); String iconClasses; if (typeName.startsWith(CmsDetailPageInfo.FUNCTION_PREFIX)) { iconClasses = CmsIconUtil.getIconClasses(CmsXmlDynamicFunctionHandler.TYPE_FUNCTION, null, false); } else { iconClasses = CmsIconUtil.getIconClasses(typeName, null, false); } CmsDetailPageInfo detailPage = new CmsDetailPageInfo(id, page, typeName, iconClasses); m_detailPageConfigs.add(detailPage); } catch (CmsVfsResourceNotFoundException e) { CmsUUID structureId = pageLoc.asId(m_cms); CmsResource detailPageRes = m_cms.readResource(structureId); CmsDetailPageInfo detailPage = new CmsDetailPageInfo( structureId, m_cms.getSitePath(detailPageRes), typeName, CmsIconUtil.getIconClasses(typeName, null, false)); m_detailPageConfigs.add(detailPage); } }
[ "protected", "void", "parseDetailPage", "(", "I_CmsXmlContentLocation", "node", ")", "throws", "CmsException", "{", "I_CmsXmlContentValueLocation", "pageLoc", "=", "node", ".", "getSubValue", "(", "N_PAGE", ")", ";", "String", "typeName", "=", "getString", "(", "node", ".", "getSubValue", "(", "N_TYPE", ")", ")", ";", "try", "{", "String", "page", "=", "pageLoc", ".", "asString", "(", "m_cms", ")", ";", "CmsResource", "detailPageRes", "=", "m_cms", ".", "readResource", "(", "page", ")", ";", "CmsUUID", "id", "=", "detailPageRes", ".", "getStructureId", "(", ")", ";", "String", "iconClasses", ";", "if", "(", "typeName", ".", "startsWith", "(", "CmsDetailPageInfo", ".", "FUNCTION_PREFIX", ")", ")", "{", "iconClasses", "=", "CmsIconUtil", ".", "getIconClasses", "(", "CmsXmlDynamicFunctionHandler", ".", "TYPE_FUNCTION", ",", "null", ",", "false", ")", ";", "}", "else", "{", "iconClasses", "=", "CmsIconUtil", ".", "getIconClasses", "(", "typeName", ",", "null", ",", "false", ")", ";", "}", "CmsDetailPageInfo", "detailPage", "=", "new", "CmsDetailPageInfo", "(", "id", ",", "page", ",", "typeName", ",", "iconClasses", ")", ";", "m_detailPageConfigs", ".", "add", "(", "detailPage", ")", ";", "}", "catch", "(", "CmsVfsResourceNotFoundException", "e", ")", "{", "CmsUUID", "structureId", "=", "pageLoc", ".", "asId", "(", "m_cms", ")", ";", "CmsResource", "detailPageRes", "=", "m_cms", ".", "readResource", "(", "structureId", ")", ";", "CmsDetailPageInfo", "detailPage", "=", "new", "CmsDetailPageInfo", "(", "structureId", ",", "m_cms", ".", "getSitePath", "(", "detailPageRes", ")", ",", "typeName", ",", "CmsIconUtil", ".", "getIconClasses", "(", "typeName", ",", "null", ",", "false", ")", ")", ";", "m_detailPageConfigs", ".", "add", "(", "detailPage", ")", ";", "}", "}" ]
Parses the detail pages from an XML content node.<p> @param node the XML content node @throws CmsException if something goes wrong
[ "Parses", "the", "detail", "pages", "from", "an", "XML", "content", "node", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsConfigurationReader.java#L817-L844
js-lib-com/commons
src/main/java/js/util/Classes.java
Classes.getResourceAsFile
public static File getResourceAsFile(String name) { """ Get file resource, that is, resource with <em>file</em> protocol. Try to load resource throwing exception if not found. If resource protocol is <em>file</em> returns it as {@link java.io.File} otherwise throws unsupported operation. @param name resource name. @return resource file. @throws NoSuchBeingException if named resource can't be loaded. @throws UnsupportedOperationException if named resource protocol is not <em>file</em>. """ URL resourceURL = getResource(name); if(resourceURL == null) { throw new NoSuchBeingException("Resource |%s| not found.", name); } String protocol = resourceURL.getProtocol(); if("file".equals(protocol)) try { return new File(resourceURL.toURI()); } catch(URISyntaxException e) { throw new BugError("Invalid syntax on URL returned by getResource."); } throw new UnsupportedOperationException("Can't get a file for a resource using protocol" + protocol); }
java
public static File getResourceAsFile(String name) { URL resourceURL = getResource(name); if(resourceURL == null) { throw new NoSuchBeingException("Resource |%s| not found.", name); } String protocol = resourceURL.getProtocol(); if("file".equals(protocol)) try { return new File(resourceURL.toURI()); } catch(URISyntaxException e) { throw new BugError("Invalid syntax on URL returned by getResource."); } throw new UnsupportedOperationException("Can't get a file for a resource using protocol" + protocol); }
[ "public", "static", "File", "getResourceAsFile", "(", "String", "name", ")", "{", "URL", "resourceURL", "=", "getResource", "(", "name", ")", ";", "if", "(", "resourceURL", "==", "null", ")", "{", "throw", "new", "NoSuchBeingException", "(", "\"Resource |%s| not found.\"", ",", "name", ")", ";", "}", "String", "protocol", "=", "resourceURL", ".", "getProtocol", "(", ")", ";", "if", "(", "\"file\"", ".", "equals", "(", "protocol", ")", ")", "try", "{", "return", "new", "File", "(", "resourceURL", ".", "toURI", "(", ")", ")", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "throw", "new", "BugError", "(", "\"Invalid syntax on URL returned by getResource.\"", ")", ";", "}", "throw", "new", "UnsupportedOperationException", "(", "\"Can't get a file for a resource using protocol\"", "+", "protocol", ")", ";", "}" ]
Get file resource, that is, resource with <em>file</em> protocol. Try to load resource throwing exception if not found. If resource protocol is <em>file</em> returns it as {@link java.io.File} otherwise throws unsupported operation. @param name resource name. @return resource file. @throws NoSuchBeingException if named resource can't be loaded. @throws UnsupportedOperationException if named resource protocol is not <em>file</em>.
[ "Get", "file", "resource", "that", "is", "resource", "with", "<em", ">", "file<", "/", "em", ">", "protocol", ".", "Try", "to", "load", "resource", "throwing", "exception", "if", "not", "found", ".", "If", "resource", "protocol", "is", "<em", ">", "file<", "/", "em", ">", "returns", "it", "as", "{", "@link", "java", ".", "io", ".", "File", "}", "otherwise", "throws", "unsupported", "operation", "." ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L1090-L1104
jlinn/quartz-redis-jobstore
src/main/java/net/joelinn/quartz/jobstore/RedisClusterStorage.java
RedisClusterStorage.storeCalendar
@Override public void storeCalendar(String name, Calendar calendar, boolean replaceExisting, boolean updateTriggers, JedisCluster jedis) throws JobPersistenceException { """ Store a {@link Calendar} @param name the name of the calendar @param calendar the calendar object to be stored @param replaceExisting if true, any existing calendar with the same name will be overwritten @param updateTriggers if true, any existing triggers associated with the calendar will be updated @param jedis a thread-safe Redis connection @throws JobPersistenceException """ final String calendarHashKey = redisSchema.calendarHashKey(name); if (!replaceExisting && jedis.exists(calendarHashKey)) { throw new ObjectAlreadyExistsException(String.format("Calendar with key %s already exists.", calendarHashKey)); } Map<String, String> calendarMap = new HashMap<>(); calendarMap.put(CALENDAR_CLASS, calendar.getClass().getName()); try { calendarMap.put(CALENDAR_JSON, mapper.writeValueAsString(calendar)); } catch (JsonProcessingException e) { throw new JobPersistenceException("Unable to serialize calendar.", e); } jedis.hmset(calendarHashKey, calendarMap); jedis.sadd(redisSchema.calendarsSet(), calendarHashKey); if (updateTriggers) { final String calendarTriggersSetKey = redisSchema.calendarTriggersSetKey(name); Set<String> triggerHashKeys = jedis.smembers(calendarTriggersSetKey); for (String triggerHashKey : triggerHashKeys) { OperableTrigger trigger = retrieveTrigger(redisSchema.triggerKey(triggerHashKey), jedis); long removed = jedis.zrem(redisSchema.triggerStateKey(RedisTriggerState.WAITING), triggerHashKey); trigger.updateWithNewCalendar(calendar, misfireThreshold); if (removed == 1) { setTriggerState(RedisTriggerState.WAITING, (double) trigger.getNextFireTime().getTime(), triggerHashKey, jedis); } } } }
java
@Override public void storeCalendar(String name, Calendar calendar, boolean replaceExisting, boolean updateTriggers, JedisCluster jedis) throws JobPersistenceException { final String calendarHashKey = redisSchema.calendarHashKey(name); if (!replaceExisting && jedis.exists(calendarHashKey)) { throw new ObjectAlreadyExistsException(String.format("Calendar with key %s already exists.", calendarHashKey)); } Map<String, String> calendarMap = new HashMap<>(); calendarMap.put(CALENDAR_CLASS, calendar.getClass().getName()); try { calendarMap.put(CALENDAR_JSON, mapper.writeValueAsString(calendar)); } catch (JsonProcessingException e) { throw new JobPersistenceException("Unable to serialize calendar.", e); } jedis.hmset(calendarHashKey, calendarMap); jedis.sadd(redisSchema.calendarsSet(), calendarHashKey); if (updateTriggers) { final String calendarTriggersSetKey = redisSchema.calendarTriggersSetKey(name); Set<String> triggerHashKeys = jedis.smembers(calendarTriggersSetKey); for (String triggerHashKey : triggerHashKeys) { OperableTrigger trigger = retrieveTrigger(redisSchema.triggerKey(triggerHashKey), jedis); long removed = jedis.zrem(redisSchema.triggerStateKey(RedisTriggerState.WAITING), triggerHashKey); trigger.updateWithNewCalendar(calendar, misfireThreshold); if (removed == 1) { setTriggerState(RedisTriggerState.WAITING, (double) trigger.getNextFireTime().getTime(), triggerHashKey, jedis); } } } }
[ "@", "Override", "public", "void", "storeCalendar", "(", "String", "name", ",", "Calendar", "calendar", ",", "boolean", "replaceExisting", ",", "boolean", "updateTriggers", ",", "JedisCluster", "jedis", ")", "throws", "JobPersistenceException", "{", "final", "String", "calendarHashKey", "=", "redisSchema", ".", "calendarHashKey", "(", "name", ")", ";", "if", "(", "!", "replaceExisting", "&&", "jedis", ".", "exists", "(", "calendarHashKey", ")", ")", "{", "throw", "new", "ObjectAlreadyExistsException", "(", "String", ".", "format", "(", "\"Calendar with key %s already exists.\"", ",", "calendarHashKey", ")", ")", ";", "}", "Map", "<", "String", ",", "String", ">", "calendarMap", "=", "new", "HashMap", "<>", "(", ")", ";", "calendarMap", ".", "put", "(", "CALENDAR_CLASS", ",", "calendar", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "try", "{", "calendarMap", ".", "put", "(", "CALENDAR_JSON", ",", "mapper", ".", "writeValueAsString", "(", "calendar", ")", ")", ";", "}", "catch", "(", "JsonProcessingException", "e", ")", "{", "throw", "new", "JobPersistenceException", "(", "\"Unable to serialize calendar.\"", ",", "e", ")", ";", "}", "jedis", ".", "hmset", "(", "calendarHashKey", ",", "calendarMap", ")", ";", "jedis", ".", "sadd", "(", "redisSchema", ".", "calendarsSet", "(", ")", ",", "calendarHashKey", ")", ";", "if", "(", "updateTriggers", ")", "{", "final", "String", "calendarTriggersSetKey", "=", "redisSchema", ".", "calendarTriggersSetKey", "(", "name", ")", ";", "Set", "<", "String", ">", "triggerHashKeys", "=", "jedis", ".", "smembers", "(", "calendarTriggersSetKey", ")", ";", "for", "(", "String", "triggerHashKey", ":", "triggerHashKeys", ")", "{", "OperableTrigger", "trigger", "=", "retrieveTrigger", "(", "redisSchema", ".", "triggerKey", "(", "triggerHashKey", ")", ",", "jedis", ")", ";", "long", "removed", "=", "jedis", ".", "zrem", "(", "redisSchema", ".", "triggerStateKey", "(", "RedisTriggerState", ".", "WAITING", ")", ",", "triggerHashKey", ")", ";", "trigger", ".", "updateWithNewCalendar", "(", "calendar", ",", "misfireThreshold", ")", ";", "if", "(", "removed", "==", "1", ")", "{", "setTriggerState", "(", "RedisTriggerState", ".", "WAITING", ",", "(", "double", ")", "trigger", ".", "getNextFireTime", "(", ")", ".", "getTime", "(", ")", ",", "triggerHashKey", ",", "jedis", ")", ";", "}", "}", "}", "}" ]
Store a {@link Calendar} @param name the name of the calendar @param calendar the calendar object to be stored @param replaceExisting if true, any existing calendar with the same name will be overwritten @param updateTriggers if true, any existing triggers associated with the calendar will be updated @param jedis a thread-safe Redis connection @throws JobPersistenceException
[ "Store", "a", "{", "@link", "Calendar", "}" ]
train
https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/RedisClusterStorage.java#L268-L297
apache/flink
flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java
Configuration.getBoolean
public boolean getBoolean(String name, boolean defaultValue) { """ Get the value of the <code>name</code> property as a <code>boolean</code>. If no such property is specified, or if the specified value is not a valid <code>boolean</code>, then <code>defaultValue</code> is returned. @param name property name. @param defaultValue default value. @return property value as a <code>boolean</code>, or <code>defaultValue</code>. """ String valueString = getTrimmed(name); if (null == valueString || valueString.isEmpty()) { return defaultValue; } if (StringUtils.equalsIgnoreCase("true", valueString)) return true; else if (StringUtils.equalsIgnoreCase("false", valueString)) return false; else return defaultValue; }
java
public boolean getBoolean(String name, boolean defaultValue) { String valueString = getTrimmed(name); if (null == valueString || valueString.isEmpty()) { return defaultValue; } if (StringUtils.equalsIgnoreCase("true", valueString)) return true; else if (StringUtils.equalsIgnoreCase("false", valueString)) return false; else return defaultValue; }
[ "public", "boolean", "getBoolean", "(", "String", "name", ",", "boolean", "defaultValue", ")", "{", "String", "valueString", "=", "getTrimmed", "(", "name", ")", ";", "if", "(", "null", "==", "valueString", "||", "valueString", ".", "isEmpty", "(", ")", ")", "{", "return", "defaultValue", ";", "}", "if", "(", "StringUtils", ".", "equalsIgnoreCase", "(", "\"true\"", ",", "valueString", ")", ")", "return", "true", ";", "else", "if", "(", "StringUtils", ".", "equalsIgnoreCase", "(", "\"false\"", ",", "valueString", ")", ")", "return", "false", ";", "else", "return", "defaultValue", ";", "}" ]
Get the value of the <code>name</code> property as a <code>boolean</code>. If no such property is specified, or if the specified value is not a valid <code>boolean</code>, then <code>defaultValue</code> is returned. @param name property name. @param defaultValue default value. @return property value as a <code>boolean</code>, or <code>defaultValue</code>.
[ "Get", "the", "value", "of", "the", "<code", ">", "name<", "/", "code", ">", "property", "as", "a", "<code", ">", "boolean<", "/", "code", ">", ".", "If", "no", "such", "property", "is", "specified", "or", "if", "the", "specified", "value", "is", "not", "a", "valid", "<code", ">", "boolean<", "/", "code", ">", "then", "<code", ">", "defaultValue<", "/", "code", ">", "is", "returned", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L1534-L1545
graknlabs/grakn
server/src/graql/executor/ComputeExecutor.java
ComputeExecutor.runComputePath
private Stream<ConceptList> runComputePath(GraqlCompute.Path query) { """ The Graql compute path query run method @return a Answer containing the list of shortest paths """ ConceptId fromID = ConceptId.of(query.from()); ConceptId toID = ConceptId.of(query.to()); if (!scopeContainsInstances(query, fromID, toID)) throw GraqlQueryException.instanceDoesNotExist(); if (fromID.equals(toID)) return Stream.of(new ConceptList(ImmutableList.of(fromID))); Set<LabelId> scopedLabelIds = convertLabelsToIds(scopeTypeLabels(query)); ComputerResult result = compute(new ShortestPathVertexProgram(fromID, toID), null, scopedLabelIds); Multimap<ConceptId, ConceptId> pathsAsEdgeList = HashMultimap.create(); Map<String, Set<String>> resultFromMemory = result.memory().get(ShortestPathVertexProgram.SHORTEST_PATH); resultFromMemory.forEach((id, idSet) -> idSet.forEach(id2 -> { pathsAsEdgeList.put(Schema.conceptIdFromVertexId(id), Schema.conceptIdFromVertexId(id2)); })); List<List<ConceptId>> paths; if (!resultFromMemory.isEmpty()) { paths = getComputePathResultList(pathsAsEdgeList, fromID); if (scopeIncludesAttributes(query)) { paths = getComputePathResultListIncludingImplicitRelations(paths); } } else { paths = Collections.emptyList(); } return paths.stream().map(ConceptList::new); }
java
private Stream<ConceptList> runComputePath(GraqlCompute.Path query) { ConceptId fromID = ConceptId.of(query.from()); ConceptId toID = ConceptId.of(query.to()); if (!scopeContainsInstances(query, fromID, toID)) throw GraqlQueryException.instanceDoesNotExist(); if (fromID.equals(toID)) return Stream.of(new ConceptList(ImmutableList.of(fromID))); Set<LabelId> scopedLabelIds = convertLabelsToIds(scopeTypeLabels(query)); ComputerResult result = compute(new ShortestPathVertexProgram(fromID, toID), null, scopedLabelIds); Multimap<ConceptId, ConceptId> pathsAsEdgeList = HashMultimap.create(); Map<String, Set<String>> resultFromMemory = result.memory().get(ShortestPathVertexProgram.SHORTEST_PATH); resultFromMemory.forEach((id, idSet) -> idSet.forEach(id2 -> { pathsAsEdgeList.put(Schema.conceptIdFromVertexId(id), Schema.conceptIdFromVertexId(id2)); })); List<List<ConceptId>> paths; if (!resultFromMemory.isEmpty()) { paths = getComputePathResultList(pathsAsEdgeList, fromID); if (scopeIncludesAttributes(query)) { paths = getComputePathResultListIncludingImplicitRelations(paths); } } else { paths = Collections.emptyList(); } return paths.stream().map(ConceptList::new); }
[ "private", "Stream", "<", "ConceptList", ">", "runComputePath", "(", "GraqlCompute", ".", "Path", "query", ")", "{", "ConceptId", "fromID", "=", "ConceptId", ".", "of", "(", "query", ".", "from", "(", ")", ")", ";", "ConceptId", "toID", "=", "ConceptId", ".", "of", "(", "query", ".", "to", "(", ")", ")", ";", "if", "(", "!", "scopeContainsInstances", "(", "query", ",", "fromID", ",", "toID", ")", ")", "throw", "GraqlQueryException", ".", "instanceDoesNotExist", "(", ")", ";", "if", "(", "fromID", ".", "equals", "(", "toID", ")", ")", "return", "Stream", ".", "of", "(", "new", "ConceptList", "(", "ImmutableList", ".", "of", "(", "fromID", ")", ")", ")", ";", "Set", "<", "LabelId", ">", "scopedLabelIds", "=", "convertLabelsToIds", "(", "scopeTypeLabels", "(", "query", ")", ")", ";", "ComputerResult", "result", "=", "compute", "(", "new", "ShortestPathVertexProgram", "(", "fromID", ",", "toID", ")", ",", "null", ",", "scopedLabelIds", ")", ";", "Multimap", "<", "ConceptId", ",", "ConceptId", ">", "pathsAsEdgeList", "=", "HashMultimap", ".", "create", "(", ")", ";", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", "resultFromMemory", "=", "result", ".", "memory", "(", ")", ".", "get", "(", "ShortestPathVertexProgram", ".", "SHORTEST_PATH", ")", ";", "resultFromMemory", ".", "forEach", "(", "(", "id", ",", "idSet", ")", "->", "idSet", ".", "forEach", "(", "id2", "->", "{", "pathsAsEdgeList", ".", "put", "(", "Schema", ".", "conceptIdFromVertexId", "(", "id", ")", ",", "Schema", ".", "conceptIdFromVertexId", "(", "id2", ")", ")", ";", "}", ")", ")", ";", "List", "<", "List", "<", "ConceptId", ">", ">", "paths", ";", "if", "(", "!", "resultFromMemory", ".", "isEmpty", "(", ")", ")", "{", "paths", "=", "getComputePathResultList", "(", "pathsAsEdgeList", ",", "fromID", ")", ";", "if", "(", "scopeIncludesAttributes", "(", "query", ")", ")", "{", "paths", "=", "getComputePathResultListIncludingImplicitRelations", "(", "paths", ")", ";", "}", "}", "else", "{", "paths", "=", "Collections", ".", "emptyList", "(", ")", ";", "}", "return", "paths", ".", "stream", "(", ")", ".", "map", "(", "ConceptList", "::", "new", ")", ";", "}" ]
The Graql compute path query run method @return a Answer containing the list of shortest paths
[ "The", "Graql", "compute", "path", "query", "run", "method" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/executor/ComputeExecutor.java#L333-L362
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java
SecureUtil.generateKeyPair
public static KeyPair generateKeyPair(String algorithm, int keySize, byte[] seed) { """ 生成用于非对称加密的公钥和私钥<br> 密钥对生成算法见:https://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#KeyPairGenerator @param algorithm 非对称加密算法 @param keySize 密钥模(modulus )长度 @param seed 种子 @return {@link KeyPair} """ return KeyUtil.generateKeyPair(algorithm, keySize, seed); }
java
public static KeyPair generateKeyPair(String algorithm, int keySize, byte[] seed) { return KeyUtil.generateKeyPair(algorithm, keySize, seed); }
[ "public", "static", "KeyPair", "generateKeyPair", "(", "String", "algorithm", ",", "int", "keySize", ",", "byte", "[", "]", "seed", ")", "{", "return", "KeyUtil", ".", "generateKeyPair", "(", "algorithm", ",", "keySize", ",", "seed", ")", ";", "}" ]
生成用于非对称加密的公钥和私钥<br> 密钥对生成算法见:https://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#KeyPairGenerator @param algorithm 非对称加密算法 @param keySize 密钥模(modulus )长度 @param seed 种子 @return {@link KeyPair}
[ "生成用于非对称加密的公钥和私钥<br", ">", "密钥对生成算法见:https", ":", "//", "docs", ".", "oracle", ".", "com", "/", "javase", "/", "7", "/", "docs", "/", "technotes", "/", "guides", "/", "security", "/", "StandardNames", ".", "html#KeyPairGenerator" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L227-L229
Axway/Grapes
commons/src/main/java/org/axway/grapes/commons/utils/FileUtils.java
FileUtils.touch
public static void touch(final File folder , final String fileName) throws IOException { """ Creates a file @param folder File @param fileName String @throws IOException """ if(!folder.exists()){ folder.mkdirs(); } final File touchedFile = new File(folder, fileName); // The JVM will only 'touch' the file if you instantiate a // FileOutputStream instance for the file in question. // You don't actually write any data to the file through // the FileOutputStream. Just instantiate it and close it. try ( FileOutputStream doneFOS = new FileOutputStream(touchedFile); ) { // Touching the file } catch (FileNotFoundException e) { throw new FileNotFoundException("Failed to the find file." + e); } }
java
public static void touch(final File folder , final String fileName) throws IOException { if(!folder.exists()){ folder.mkdirs(); } final File touchedFile = new File(folder, fileName); // The JVM will only 'touch' the file if you instantiate a // FileOutputStream instance for the file in question. // You don't actually write any data to the file through // the FileOutputStream. Just instantiate it and close it. try ( FileOutputStream doneFOS = new FileOutputStream(touchedFile); ) { // Touching the file } catch (FileNotFoundException e) { throw new FileNotFoundException("Failed to the find file." + e); } }
[ "public", "static", "void", "touch", "(", "final", "File", "folder", ",", "final", "String", "fileName", ")", "throws", "IOException", "{", "if", "(", "!", "folder", ".", "exists", "(", ")", ")", "{", "folder", ".", "mkdirs", "(", ")", ";", "}", "final", "File", "touchedFile", "=", "new", "File", "(", "folder", ",", "fileName", ")", ";", "// The JVM will only 'touch' the file if you instantiate a", "// FileOutputStream instance for the file in question.", "// You don't actually write any data to the file through", "// the FileOutputStream. Just instantiate it and close it.", "try", "(", "FileOutputStream", "doneFOS", "=", "new", "FileOutputStream", "(", "touchedFile", ")", ";", ")", "{", "// Touching the file", "}", "catch", "(", "FileNotFoundException", "e", ")", "{", "throw", "new", "FileNotFoundException", "(", "\"Failed to the find file.\"", "+", "e", ")", ";", "}", "}" ]
Creates a file @param folder File @param fileName String @throws IOException
[ "Creates", "a", "file" ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/commons/src/main/java/org/axway/grapes/commons/utils/FileUtils.java#L87-L107
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPCalculator.java
AFPCalculator.getEnd2EndDistance
private static final double getEnd2EndDistance(Atom[] ca1, Atom[] ca2, int p1b, int p1e, int p2b, int p2e) { """ filter 1 for AFP extration: the distance of end-to-end @param p1b @param p1e @param p2b @param p2e @return """ double min = 99; double dist1 = Calc.getDistance(ca1[p1b], ca1[p1e]); double dist2 = Calc.getDistance(ca2[p2b], ca2[p2e]); min = dist1 - dist2; return Math.abs(min); }
java
private static final double getEnd2EndDistance(Atom[] ca1, Atom[] ca2, int p1b, int p1e, int p2b, int p2e) { double min = 99; double dist1 = Calc.getDistance(ca1[p1b], ca1[p1e]); double dist2 = Calc.getDistance(ca2[p2b], ca2[p2e]); min = dist1 - dist2; return Math.abs(min); }
[ "private", "static", "final", "double", "getEnd2EndDistance", "(", "Atom", "[", "]", "ca1", ",", "Atom", "[", "]", "ca2", ",", "int", "p1b", ",", "int", "p1e", ",", "int", "p2b", ",", "int", "p2e", ")", "{", "double", "min", "=", "99", ";", "double", "dist1", "=", "Calc", ".", "getDistance", "(", "ca1", "[", "p1b", "]", ",", "ca1", "[", "p1e", "]", ")", ";", "double", "dist2", "=", "Calc", ".", "getDistance", "(", "ca2", "[", "p2b", "]", ",", "ca2", "[", "p2e", "]", ")", ";", "min", "=", "dist1", "-", "dist2", ";", "return", "Math", ".", "abs", "(", "min", ")", ";", "}" ]
filter 1 for AFP extration: the distance of end-to-end @param p1b @param p1e @param p2b @param p2e @return
[ "filter", "1", "for", "AFP", "extration", ":", "the", "distance", "of", "end", "-", "to", "-", "end" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPCalculator.java#L150-L159
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/SAXProcessor.java
SAXProcessor.charDistance
public int charDistance(char a, char b) { """ Compute the distance between the two chars based on the ASCII symbol codes. @param a The first char. @param b The second char. @return The distance. """ return Math.abs(Character.getNumericValue(a) - Character.getNumericValue(b)); }
java
public int charDistance(char a, char b) { return Math.abs(Character.getNumericValue(a) - Character.getNumericValue(b)); }
[ "public", "int", "charDistance", "(", "char", "a", ",", "char", "b", ")", "{", "return", "Math", ".", "abs", "(", "Character", ".", "getNumericValue", "(", "a", ")", "-", "Character", ".", "getNumericValue", "(", "b", ")", ")", ";", "}" ]
Compute the distance between the two chars based on the ASCII symbol codes. @param a The first char. @param b The second char. @return The distance.
[ "Compute", "the", "distance", "between", "the", "two", "chars", "based", "on", "the", "ASCII", "symbol", "codes", "." ]
train
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/SAXProcessor.java#L316-L318
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/Utils.java
Utils.getExecutorName
public static String getExecutorName(String name, String versionstamp) { """ Generate the name for the executor class. Must use '$' so that it is considered by some code (eclipse debugger for example) to be an inner type of the original class (thus able to consider itself as being from the same source file). @param name the name prefix for the executor class @param versionstamp the suffix string for the executor class name @return an executor class name """ StringBuilder s = new StringBuilder(name); s.append("$$E"); s.append(versionstamp); return s.toString(); }
java
public static String getExecutorName(String name, String versionstamp) { StringBuilder s = new StringBuilder(name); s.append("$$E"); s.append(versionstamp); return s.toString(); }
[ "public", "static", "String", "getExecutorName", "(", "String", "name", ",", "String", "versionstamp", ")", "{", "StringBuilder", "s", "=", "new", "StringBuilder", "(", "name", ")", ";", "s", ".", "append", "(", "\"$$E\"", ")", ";", "s", ".", "append", "(", "versionstamp", ")", ";", "return", "s", ".", "toString", "(", ")", ";", "}" ]
Generate the name for the executor class. Must use '$' so that it is considered by some code (eclipse debugger for example) to be an inner type of the original class (thus able to consider itself as being from the same source file). @param name the name prefix for the executor class @param versionstamp the suffix string for the executor class name @return an executor class name
[ "Generate", "the", "name", "for", "the", "executor", "class", ".", "Must", "use", "$", "so", "that", "it", "is", "considered", "by", "some", "code", "(", "eclipse", "debugger", "for", "example", ")", "to", "be", "an", "inner", "type", "of", "the", "original", "class", "(", "thus", "able", "to", "consider", "itself", "as", "being", "from", "the", "same", "source", "file", ")", "." ]
train
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/Utils.java#L885-L890
apache/incubator-gobblin
gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanClient.java
AzkabanClient.executeFlow
public AzkabanExecuteFlowStatus executeFlow(String projectName, String flowName, Map<String, String> flowParameters) throws AzkabanClientException { """ Execute a flow with flow parameters. The project and flow should be created first. @param projectName project name @param flowName flow name @param flowParameters flow parameters @return The status object which contains success status and execution id. """ return executeFlowWithOptions(projectName, flowName, null, flowParameters); }
java
public AzkabanExecuteFlowStatus executeFlow(String projectName, String flowName, Map<String, String> flowParameters) throws AzkabanClientException { return executeFlowWithOptions(projectName, flowName, null, flowParameters); }
[ "public", "AzkabanExecuteFlowStatus", "executeFlow", "(", "String", "projectName", ",", "String", "flowName", ",", "Map", "<", "String", ",", "String", ">", "flowParameters", ")", "throws", "AzkabanClientException", "{", "return", "executeFlowWithOptions", "(", "projectName", ",", "flowName", ",", "null", ",", "flowParameters", ")", ";", "}" ]
Execute a flow with flow parameters. The project and flow should be created first. @param projectName project name @param flowName flow name @param flowParameters flow parameters @return The status object which contains success status and execution id.
[ "Execute", "a", "flow", "with", "flow", "parameters", ".", "The", "project", "and", "flow", "should", "be", "created", "first", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanClient.java#L366-L370
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java
SARLOperationHelper._hasSideEffects
protected Boolean _hasSideEffects(XConstructorCall expression, ISideEffectContext context) { """ Test if the given expression has side effects. @param expression the expression. @param context the list of context expressions. @return {@code true} if the expression has side effects. """ for (final XExpression ex : expression.getArguments()) { if (hasSideEffects(ex, context)) { return true; } } return false; }
java
protected Boolean _hasSideEffects(XConstructorCall expression, ISideEffectContext context) { for (final XExpression ex : expression.getArguments()) { if (hasSideEffects(ex, context)) { return true; } } return false; }
[ "protected", "Boolean", "_hasSideEffects", "(", "XConstructorCall", "expression", ",", "ISideEffectContext", "context", ")", "{", "for", "(", "final", "XExpression", "ex", ":", "expression", ".", "getArguments", "(", ")", ")", "{", "if", "(", "hasSideEffects", "(", "ex", ",", "context", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Test if the given expression has side effects. @param expression the expression. @param context the list of context expressions. @return {@code true} if the expression has side effects.
[ "Test", "if", "the", "given", "expression", "has", "side", "effects", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L481-L488
aws/aws-sdk-java
aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/model/CreatePlatformEndpointRequest.java
CreatePlatformEndpointRequest.withAttributes
public CreatePlatformEndpointRequest withAttributes(java.util.Map<String, String> attributes) { """ <p> For a list of attributes, see <a href="https://docs.aws.amazon.com/sns/latest/api/API_SetEndpointAttributes.html">SetEndpointAttributes</a>. </p> @param attributes For a list of attributes, see <a href="https://docs.aws.amazon.com/sns/latest/api/API_SetEndpointAttributes.html" >SetEndpointAttributes</a>. @return Returns a reference to this object so that method calls can be chained together. """ setAttributes(attributes); return this; }
java
public CreatePlatformEndpointRequest withAttributes(java.util.Map<String, String> attributes) { setAttributes(attributes); return this; }
[ "public", "CreatePlatformEndpointRequest", "withAttributes", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "attributes", ")", "{", "setAttributes", "(", "attributes", ")", ";", "return", "this", ";", "}" ]
<p> For a list of attributes, see <a href="https://docs.aws.amazon.com/sns/latest/api/API_SetEndpointAttributes.html">SetEndpointAttributes</a>. </p> @param attributes For a list of attributes, see <a href="https://docs.aws.amazon.com/sns/latest/api/API_SetEndpointAttributes.html" >SetEndpointAttributes</a>. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "For", "a", "list", "of", "attributes", "see", "<a", "href", "=", "https", ":", "//", "docs", ".", "aws", ".", "amazon", ".", "com", "/", "sns", "/", "latest", "/", "api", "/", "API_SetEndpointAttributes", ".", "html", ">", "SetEndpointAttributes<", "/", "a", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/model/CreatePlatformEndpointRequest.java#L252-L255
patka/cassandra-migration
cassandra-migration/src/main/java/org/cognitor/cassandra/migration/scanner/FileSystemLocationScanner.java
FileSystemLocationScanner.toResourceNameOnClasspath
private String toResourceNameOnClasspath(String classPathRootOnDisk, File file) { """ Converts this file into a resource name on the classpath by cutting of the file path to the classpath root. @param classPathRootOnDisk The location of the classpath root on disk, with a trailing slash. @param file The file. @return The resource name on the classpath. """ String fileName = file.getAbsolutePath().replace("\\", "/"); return fileName.substring(classPathRootOnDisk.length()); }
java
private String toResourceNameOnClasspath(String classPathRootOnDisk, File file) { String fileName = file.getAbsolutePath().replace("\\", "/"); return fileName.substring(classPathRootOnDisk.length()); }
[ "private", "String", "toResourceNameOnClasspath", "(", "String", "classPathRootOnDisk", ",", "File", "file", ")", "{", "String", "fileName", "=", "file", ".", "getAbsolutePath", "(", ")", ".", "replace", "(", "\"\\\\\"", ",", "\"/\"", ")", ";", "return", "fileName", ".", "substring", "(", "classPathRootOnDisk", ".", "length", "(", ")", ")", ";", "}" ]
Converts this file into a resource name on the classpath by cutting of the file path to the classpath root. @param classPathRootOnDisk The location of the classpath root on disk, with a trailing slash. @param file The file. @return The resource name on the classpath.
[ "Converts", "this", "file", "into", "a", "resource", "name", "on", "the", "classpath", "by", "cutting", "of", "the", "file", "path", "to", "the", "classpath", "root", "." ]
train
https://github.com/patka/cassandra-migration/blob/c61840c23b17a18df704d136909c26ff46bd5c77/cassandra-migration/src/main/java/org/cognitor/cassandra/migration/scanner/FileSystemLocationScanner.java#L89-L92
mabe02/lanterna
src/main/java/com/googlecode/lanterna/TextCharacter.java
TextCharacter.withBackgroundColor
public TextCharacter withBackgroundColor(TextColor backgroundColor) { """ Returns a copy of this TextCharacter with a specified background color @param backgroundColor Background color the copy should have @return Copy of the TextCharacter with a different background color """ if(this.backgroundColor == backgroundColor || this.backgroundColor.equals(backgroundColor)) { return this; } return new TextCharacter(character, foregroundColor, backgroundColor, modifiers); }
java
public TextCharacter withBackgroundColor(TextColor backgroundColor) { if(this.backgroundColor == backgroundColor || this.backgroundColor.equals(backgroundColor)) { return this; } return new TextCharacter(character, foregroundColor, backgroundColor, modifiers); }
[ "public", "TextCharacter", "withBackgroundColor", "(", "TextColor", "backgroundColor", ")", "{", "if", "(", "this", ".", "backgroundColor", "==", "backgroundColor", "||", "this", ".", "backgroundColor", ".", "equals", "(", "backgroundColor", ")", ")", "{", "return", "this", ";", "}", "return", "new", "TextCharacter", "(", "character", ",", "foregroundColor", ",", "backgroundColor", ",", "modifiers", ")", ";", "}" ]
Returns a copy of this TextCharacter with a specified background color @param backgroundColor Background color the copy should have @return Copy of the TextCharacter with a different background color
[ "Returns", "a", "copy", "of", "this", "TextCharacter", "with", "a", "specified", "background", "color" ]
train
https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/TextCharacter.java#L237-L242
JodaOrg/joda-time
src/main/java/org/joda/time/format/DateTimeFormatter.java
DateTimeFormatter.printTo
public void printTo(Writer out, ReadableInstant instant) throws IOException { """ Prints a ReadableInstant, using the chronology supplied by the instant. @param out the destination to format to, not null @param instant instant to format, null means now """ printTo((Appendable) out, instant); }
java
public void printTo(Writer out, ReadableInstant instant) throws IOException { printTo((Appendable) out, instant); }
[ "public", "void", "printTo", "(", "Writer", "out", ",", "ReadableInstant", "instant", ")", "throws", "IOException", "{", "printTo", "(", "(", "Appendable", ")", "out", ",", "instant", ")", ";", "}" ]
Prints a ReadableInstant, using the chronology supplied by the instant. @param out the destination to format to, not null @param instant instant to format, null means now
[ "Prints", "a", "ReadableInstant", "using", "the", "chronology", "supplied", "by", "the", "instant", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/DateTimeFormatter.java#L521-L523
aboutsip/pkts
pkts-sip/src/main/java/io/pkts/packet/sip/impl/SipParser.java
SipParser.isNext
public static boolean isNext(final Buffer buffer, final byte b) throws IOException { """ Will check whether the next readable byte in the buffer is a certain byte @param buffer the buffer to peek into @param b the byte we are checking is the next byte in the buffer to be read @return true if the next byte to read indeed is what we hope it is """ if (buffer.hasReadableBytes()) { final byte actual = buffer.peekByte(); return actual == b; } return false; }
java
public static boolean isNext(final Buffer buffer, final byte b) throws IOException { if (buffer.hasReadableBytes()) { final byte actual = buffer.peekByte(); return actual == b; } return false; }
[ "public", "static", "boolean", "isNext", "(", "final", "Buffer", "buffer", ",", "final", "byte", "b", ")", "throws", "IOException", "{", "if", "(", "buffer", ".", "hasReadableBytes", "(", ")", ")", "{", "final", "byte", "actual", "=", "buffer", ".", "peekByte", "(", ")", ";", "return", "actual", "==", "b", ";", "}", "return", "false", ";", "}" ]
Will check whether the next readable byte in the buffer is a certain byte @param buffer the buffer to peek into @param b the byte we are checking is the next byte in the buffer to be read @return true if the next byte to read indeed is what we hope it is
[ "Will", "check", "whether", "the", "next", "readable", "byte", "in", "the", "buffer", "is", "a", "certain", "byte" ]
train
https://github.com/aboutsip/pkts/blob/0f06bb0dac76c812187829f580a8d476ca99a1a1/pkts-sip/src/main/java/io/pkts/packet/sip/impl/SipParser.java#L513-L520
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.getKeyVersionsWithServiceResponseAsync
public Observable<ServiceResponse<Page<KeyItem>>> getKeyVersionsWithServiceResponseAsync(final String vaultBaseUrl, final String keyName) { """ Retrieves a list of individual key versions with the same key name. The full key identifier, attributes, and tags are provided in the response. This operation requires the keys/list permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName The name of the key. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;KeyItem&gt; object """ return getKeyVersionsSinglePageAsync(vaultBaseUrl, keyName) .concatMap(new Func1<ServiceResponse<Page<KeyItem>>, Observable<ServiceResponse<Page<KeyItem>>>>() { @Override public Observable<ServiceResponse<Page<KeyItem>>> call(ServiceResponse<Page<KeyItem>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(getKeyVersionsNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<KeyItem>>> getKeyVersionsWithServiceResponseAsync(final String vaultBaseUrl, final String keyName) { return getKeyVersionsSinglePageAsync(vaultBaseUrl, keyName) .concatMap(new Func1<ServiceResponse<Page<KeyItem>>, Observable<ServiceResponse<Page<KeyItem>>>>() { @Override public Observable<ServiceResponse<Page<KeyItem>>> call(ServiceResponse<Page<KeyItem>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(getKeyVersionsNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "KeyItem", ">", ">", ">", "getKeyVersionsWithServiceResponseAsync", "(", "final", "String", "vaultBaseUrl", ",", "final", "String", "keyName", ")", "{", "return", "getKeyVersionsSinglePageAsync", "(", "vaultBaseUrl", ",", "keyName", ")", ".", "concatMap", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "KeyItem", ">", ">", ",", "Observable", "<", "ServiceResponse", "<", "Page", "<", "KeyItem", ">", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "KeyItem", ">", ">", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "KeyItem", ">", ">", "page", ")", "{", "String", "nextPageLink", "=", "page", ".", "body", "(", ")", ".", "nextPageLink", "(", ")", ";", "if", "(", "nextPageLink", "==", "null", ")", "{", "return", "Observable", ".", "just", "(", "page", ")", ";", "}", "return", "Observable", ".", "just", "(", "page", ")", ".", "concatWith", "(", "getKeyVersionsNextWithServiceResponseAsync", "(", "nextPageLink", ")", ")", ";", "}", "}", ")", ";", "}" ]
Retrieves a list of individual key versions with the same key name. The full key identifier, attributes, and tags are provided in the response. This operation requires the keys/list permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName The name of the key. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;KeyItem&gt; object
[ "Retrieves", "a", "list", "of", "individual", "key", "versions", "with", "the", "same", "key", "name", ".", "The", "full", "key", "identifier", "attributes", "and", "tags", "are", "provided", "in", "the", "response", ".", "This", "operation", "requires", "the", "keys", "/", "list", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L1539-L1551
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/validation/ProxyAwareUIStrings.java
ProxyAwareUIStrings.appendTypeSignature
public StringBuilder appendTypeSignature(JvmType type, StringBuilder result) { """ Returns the signature of the given type. If the type declares type parameters, the type parameters are included but their bounds are omitted. That is, the type {@code X<T extends CharSequence>} will be returned as {@code X<T>} """ result.append(type.getSimpleName()); if(type instanceof JvmTypeParameterDeclarator) { List<JvmTypeParameter> typeParameters = ((JvmTypeParameterDeclarator) type).getTypeParameters(); if (!typeParameters.isEmpty()) { result.append("<"); for(int i = 0, size = typeParameters.size(); i < size; i++) { if (i != 0) { result.append(", "); } result.append(typeParameters.get(i).getName()); } result.append(">"); } } return result; }
java
public StringBuilder appendTypeSignature(JvmType type, StringBuilder result) { result.append(type.getSimpleName()); if(type instanceof JvmTypeParameterDeclarator) { List<JvmTypeParameter> typeParameters = ((JvmTypeParameterDeclarator) type).getTypeParameters(); if (!typeParameters.isEmpty()) { result.append("<"); for(int i = 0, size = typeParameters.size(); i < size; i++) { if (i != 0) { result.append(", "); } result.append(typeParameters.get(i).getName()); } result.append(">"); } } return result; }
[ "public", "StringBuilder", "appendTypeSignature", "(", "JvmType", "type", ",", "StringBuilder", "result", ")", "{", "result", ".", "append", "(", "type", ".", "getSimpleName", "(", ")", ")", ";", "if", "(", "type", "instanceof", "JvmTypeParameterDeclarator", ")", "{", "List", "<", "JvmTypeParameter", ">", "typeParameters", "=", "(", "(", "JvmTypeParameterDeclarator", ")", "type", ")", ".", "getTypeParameters", "(", ")", ";", "if", "(", "!", "typeParameters", ".", "isEmpty", "(", ")", ")", "{", "result", ".", "append", "(", "\"<\"", ")", ";", "for", "(", "int", "i", "=", "0", ",", "size", "=", "typeParameters", ".", "size", "(", ")", ";", "i", "<", "size", ";", "i", "++", ")", "{", "if", "(", "i", "!=", "0", ")", "{", "result", ".", "append", "(", "\", \"", ")", ";", "}", "result", ".", "append", "(", "typeParameters", ".", "get", "(", "i", ")", ".", "getName", "(", ")", ")", ";", "}", "result", ".", "append", "(", "\">\"", ")", ";", "}", "}", "return", "result", ";", "}" ]
Returns the signature of the given type. If the type declares type parameters, the type parameters are included but their bounds are omitted. That is, the type {@code X<T extends CharSequence>} will be returned as {@code X<T>}
[ "Returns", "the", "signature", "of", "the", "given", "type", ".", "If", "the", "type", "declares", "type", "parameters", "the", "type", "parameters", "are", "included", "but", "their", "bounds", "are", "omitted", ".", "That", "is", "the", "type", "{", "@code", "X<T", "extends", "CharSequence", ">", "}", "will", "be", "returned", "as", "{", "@code", "X<T", ">", "}" ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/validation/ProxyAwareUIStrings.java#L60-L76
liferay/com-liferay-commerce
commerce-notification-api/src/main/java/com/liferay/commerce/notification/service/persistence/CommerceNotificationTemplateUtil.java
CommerceNotificationTemplateUtil.removeByG_T_E
public static void removeByG_T_E(long groupId, String type, boolean enabled) { """ Removes all the commerce notification templates where groupId = &#63; and type = &#63; and enabled = &#63; from the database. @param groupId the group ID @param type the type @param enabled the enabled """ getPersistence().removeByG_T_E(groupId, type, enabled); }
java
public static void removeByG_T_E(long groupId, String type, boolean enabled) { getPersistence().removeByG_T_E(groupId, type, enabled); }
[ "public", "static", "void", "removeByG_T_E", "(", "long", "groupId", ",", "String", "type", ",", "boolean", "enabled", ")", "{", "getPersistence", "(", ")", ".", "removeByG_T_E", "(", "groupId", ",", "type", ",", "enabled", ")", ";", "}" ]
Removes all the commerce notification templates where groupId = &#63; and type = &#63; and enabled = &#63; from the database. @param groupId the group ID @param type the type @param enabled the enabled
[ "Removes", "all", "the", "commerce", "notification", "templates", "where", "groupId", "=", "&#63", ";", "and", "type", "=", "&#63", ";", "and", "enabled", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-api/src/main/java/com/liferay/commerce/notification/service/persistence/CommerceNotificationTemplateUtil.java#L1272-L1274
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/RSAUtils.java
RSAUtils.signMessage
public static byte[] signMessage(RSAPrivateKey key, byte[] message) throws InvalidKeyException, NoSuchAlgorithmException, SignatureException { """ Sign a message with RSA private key, using {@link #DEFAULT_SIGNATURE_ALGORITHM}. @param key @param message @return the signature @throws InvalidKeyException @throws NoSuchAlgorithmException @throws SignatureException """ return signMessage(key, message, DEFAULT_SIGNATURE_ALGORITHM); }
java
public static byte[] signMessage(RSAPrivateKey key, byte[] message) throws InvalidKeyException, NoSuchAlgorithmException, SignatureException { return signMessage(key, message, DEFAULT_SIGNATURE_ALGORITHM); }
[ "public", "static", "byte", "[", "]", "signMessage", "(", "RSAPrivateKey", "key", ",", "byte", "[", "]", "message", ")", "throws", "InvalidKeyException", ",", "NoSuchAlgorithmException", ",", "SignatureException", "{", "return", "signMessage", "(", "key", ",", "message", ",", "DEFAULT_SIGNATURE_ALGORITHM", ")", ";", "}" ]
Sign a message with RSA private key, using {@link #DEFAULT_SIGNATURE_ALGORITHM}. @param key @param message @return the signature @throws InvalidKeyException @throws NoSuchAlgorithmException @throws SignatureException
[ "Sign", "a", "message", "with", "RSA", "private", "key", "using", "{", "@link", "#DEFAULT_SIGNATURE_ALGORITHM", "}", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/RSAUtils.java#L183-L186
VoltDB/voltdb
src/frontend/org/voltdb/NonVoltDBBackend.java
NonVoltDBBackend.isBigintColumn
private boolean isBigintColumn(String columnName, List<String> tableNames, boolean debugPrint) { """ Returns true if the <i>columnName</i> is of column type BIGINT, or equivalents in a comparison, non-VoltDB database; false otherwise. """ List<String> bigintColumnTypes = Arrays.asList("BIGINT"); return isColumnType(bigintColumnTypes, columnName, tableNames, debugPrint); }
java
private boolean isBigintColumn(String columnName, List<String> tableNames, boolean debugPrint) { List<String> bigintColumnTypes = Arrays.asList("BIGINT"); return isColumnType(bigintColumnTypes, columnName, tableNames, debugPrint); }
[ "private", "boolean", "isBigintColumn", "(", "String", "columnName", ",", "List", "<", "String", ">", "tableNames", ",", "boolean", "debugPrint", ")", "{", "List", "<", "String", ">", "bigintColumnTypes", "=", "Arrays", ".", "asList", "(", "\"BIGINT\"", ")", ";", "return", "isColumnType", "(", "bigintColumnTypes", ",", "columnName", ",", "tableNames", ",", "debugPrint", ")", ";", "}" ]
Returns true if the <i>columnName</i> is of column type BIGINT, or equivalents in a comparison, non-VoltDB database; false otherwise.
[ "Returns", "true", "if", "the", "<i", ">", "columnName<", "/", "i", ">", "is", "of", "column", "type", "BIGINT", "or", "equivalents", "in", "a", "comparison", "non", "-", "VoltDB", "database", ";", "false", "otherwise", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/NonVoltDBBackend.java#L570-L573
apache/flink
flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaConsumerBase.java
FlinkKafkaConsumerBase.assignTimestampsAndWatermarks
public FlinkKafkaConsumerBase<T> assignTimestampsAndWatermarks(AssignerWithPunctuatedWatermarks<T> assigner) { """ Specifies an {@link AssignerWithPunctuatedWatermarks} to emit watermarks in a punctuated manner. The watermark extractor will run per Kafka partition, watermarks will be merged across partitions in the same way as in the Flink runtime, when streams are merged. <p>When a subtask of a FlinkKafkaConsumer source reads multiple Kafka partitions, the streams from the partitions are unioned in a "first come first serve" fashion. Per-partition characteristics are usually lost that way. For example, if the timestamps are strictly ascending per Kafka partition, they will not be strictly ascending in the resulting Flink DataStream, if the parallel source subtask reads more that one partition. <p>Running timestamp extractors / watermark generators directly inside the Kafka source, per Kafka partition, allows users to let them exploit the per-partition characteristics. <p>Note: One can use either an {@link AssignerWithPunctuatedWatermarks} or an {@link AssignerWithPeriodicWatermarks}, not both at the same time. @param assigner The timestamp assigner / watermark generator to use. @return The consumer object, to allow function chaining. """ checkNotNull(assigner); if (this.periodicWatermarkAssigner != null) { throw new IllegalStateException("A periodic watermark emitter has already been set."); } try { ClosureCleaner.clean(assigner, true); this.punctuatedWatermarkAssigner = new SerializedValue<>(assigner); return this; } catch (Exception e) { throw new IllegalArgumentException("The given assigner is not serializable", e); } }
java
public FlinkKafkaConsumerBase<T> assignTimestampsAndWatermarks(AssignerWithPunctuatedWatermarks<T> assigner) { checkNotNull(assigner); if (this.periodicWatermarkAssigner != null) { throw new IllegalStateException("A periodic watermark emitter has already been set."); } try { ClosureCleaner.clean(assigner, true); this.punctuatedWatermarkAssigner = new SerializedValue<>(assigner); return this; } catch (Exception e) { throw new IllegalArgumentException("The given assigner is not serializable", e); } }
[ "public", "FlinkKafkaConsumerBase", "<", "T", ">", "assignTimestampsAndWatermarks", "(", "AssignerWithPunctuatedWatermarks", "<", "T", ">", "assigner", ")", "{", "checkNotNull", "(", "assigner", ")", ";", "if", "(", "this", ".", "periodicWatermarkAssigner", "!=", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"A periodic watermark emitter has already been set.\"", ")", ";", "}", "try", "{", "ClosureCleaner", ".", "clean", "(", "assigner", ",", "true", ")", ";", "this", ".", "punctuatedWatermarkAssigner", "=", "new", "SerializedValue", "<>", "(", "assigner", ")", ";", "return", "this", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The given assigner is not serializable\"", ",", "e", ")", ";", "}", "}" ]
Specifies an {@link AssignerWithPunctuatedWatermarks} to emit watermarks in a punctuated manner. The watermark extractor will run per Kafka partition, watermarks will be merged across partitions in the same way as in the Flink runtime, when streams are merged. <p>When a subtask of a FlinkKafkaConsumer source reads multiple Kafka partitions, the streams from the partitions are unioned in a "first come first serve" fashion. Per-partition characteristics are usually lost that way. For example, if the timestamps are strictly ascending per Kafka partition, they will not be strictly ascending in the resulting Flink DataStream, if the parallel source subtask reads more that one partition. <p>Running timestamp extractors / watermark generators directly inside the Kafka source, per Kafka partition, allows users to let them exploit the per-partition characteristics. <p>Note: One can use either an {@link AssignerWithPunctuatedWatermarks} or an {@link AssignerWithPeriodicWatermarks}, not both at the same time. @param assigner The timestamp assigner / watermark generator to use. @return The consumer object, to allow function chaining.
[ "Specifies", "an", "{", "@link", "AssignerWithPunctuatedWatermarks", "}", "to", "emit", "watermarks", "in", "a", "punctuated", "manner", ".", "The", "watermark", "extractor", "will", "run", "per", "Kafka", "partition", "watermarks", "will", "be", "merged", "across", "partitions", "in", "the", "same", "way", "as", "in", "the", "Flink", "runtime", "when", "streams", "are", "merged", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaConsumerBase.java#L292-L305
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/DiscreteDistributions.java
DiscreteDistributions.geometricCdf
public static double geometricCdf(int k, double p) { """ Returns the cumulative probability of geometric @param k @param p @return """ if(k<=0 || p<0) { throw new IllegalArgumentException("All the parameters must be positive."); } double probabilitySum = 0.0; for(int i=1;i<=k;++i) { probabilitySum += geometric(i, p); } return probabilitySum; }
java
public static double geometricCdf(int k, double p) { if(k<=0 || p<0) { throw new IllegalArgumentException("All the parameters must be positive."); } double probabilitySum = 0.0; for(int i=1;i<=k;++i) { probabilitySum += geometric(i, p); } return probabilitySum; }
[ "public", "static", "double", "geometricCdf", "(", "int", "k", ",", "double", "p", ")", "{", "if", "(", "k", "<=", "0", "||", "p", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"All the parameters must be positive.\"", ")", ";", "}", "double", "probabilitySum", "=", "0.0", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "k", ";", "++", "i", ")", "{", "probabilitySum", "+=", "geometric", "(", "i", ",", "p", ")", ";", "}", "return", "probabilitySum", ";", "}" ]
Returns the cumulative probability of geometric @param k @param p @return
[ "Returns", "the", "cumulative", "probability", "of", "geometric" ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/DiscreteDistributions.java#L170-L181
duracloud/snapshot
snapshot-service-impl/src/main/java/org/duracloud/snapshot/service/impl/RestoreJobExecutionListener.java
RestoreJobExecutionListener.getExpirationDate
protected Date getExpirationDate(Date endDate, int daysToExpire) { """ Calculates the restore expiration date based on the restoration end date and the number of days before retirement @param endDate date on which the restoration completed @param daysToExpire number of days the restored content should stay in place before it is retired @return expiration date of restored content """ Calendar calendar = Calendar.getInstance(); calendar.setTime(endDate); calendar.add(Calendar.DATE, daysToExpire); return calendar.getTime(); }
java
protected Date getExpirationDate(Date endDate, int daysToExpire) { Calendar calendar = Calendar.getInstance(); calendar.setTime(endDate); calendar.add(Calendar.DATE, daysToExpire); return calendar.getTime(); }
[ "protected", "Date", "getExpirationDate", "(", "Date", "endDate", ",", "int", "daysToExpire", ")", "{", "Calendar", "calendar", "=", "Calendar", ".", "getInstance", "(", ")", ";", "calendar", ".", "setTime", "(", "endDate", ")", ";", "calendar", ".", "add", "(", "Calendar", ".", "DATE", ",", "daysToExpire", ")", ";", "return", "calendar", ".", "getTime", "(", ")", ";", "}" ]
Calculates the restore expiration date based on the restoration end date and the number of days before retirement @param endDate date on which the restoration completed @param daysToExpire number of days the restored content should stay in place before it is retired @return expiration date of restored content
[ "Calculates", "the", "restore", "expiration", "date", "based", "on", "the", "restoration", "end", "date", "and", "the", "number", "of", "days", "before", "retirement" ]
train
https://github.com/duracloud/snapshot/blob/7cb387b22fd4a9425087f654276138727c2c0b73/snapshot-service-impl/src/main/java/org/duracloud/snapshot/service/impl/RestoreJobExecutionListener.java#L264-L269
allengeorge/libraft
libraft-agent/src/main/java/io/libraft/agent/RaftAgent.java
RaftAgent.setupCustomCommandSerializationAndDeserialization
public synchronized void setupCustomCommandSerializationAndDeserialization(CommandSerializer commandSerializer, CommandDeserializer commandDeserializer) { """ Setup custom serialization and deserialization for POJO {@link Command} objects. This method should <strong>only</strong> be called once. @param commandSerializer {@code CommandSerializer} that can serialize a POJO {@code Command} into binary @param commandDeserializer {@code CommandDeserializer} that can deserialize binary into a {@code Command} POJO @throws IllegalStateException if this method is called multiple times @see RaftRPC#setupCustomCommandSerializationAndDeserialization(ObjectMapper, CommandSerializer, CommandDeserializer) """ checkState(!running); checkState(!initialized); checkState(!setupConversion); jdbcLog.setupCustomCommandSerializerAndDeserializer(commandSerializer, commandDeserializer); RaftRPC.setupCustomCommandSerializationAndDeserialization(mapper, commandSerializer, commandDeserializer); setupConversion = true; }
java
public synchronized void setupCustomCommandSerializationAndDeserialization(CommandSerializer commandSerializer, CommandDeserializer commandDeserializer) { checkState(!running); checkState(!initialized); checkState(!setupConversion); jdbcLog.setupCustomCommandSerializerAndDeserializer(commandSerializer, commandDeserializer); RaftRPC.setupCustomCommandSerializationAndDeserialization(mapper, commandSerializer, commandDeserializer); setupConversion = true; }
[ "public", "synchronized", "void", "setupCustomCommandSerializationAndDeserialization", "(", "CommandSerializer", "commandSerializer", ",", "CommandDeserializer", "commandDeserializer", ")", "{", "checkState", "(", "!", "running", ")", ";", "checkState", "(", "!", "initialized", ")", ";", "checkState", "(", "!", "setupConversion", ")", ";", "jdbcLog", ".", "setupCustomCommandSerializerAndDeserializer", "(", "commandSerializer", ",", "commandDeserializer", ")", ";", "RaftRPC", ".", "setupCustomCommandSerializationAndDeserialization", "(", "mapper", ",", "commandSerializer", ",", "commandDeserializer", ")", ";", "setupConversion", "=", "true", ";", "}" ]
Setup custom serialization and deserialization for POJO {@link Command} objects. This method should <strong>only</strong> be called once. @param commandSerializer {@code CommandSerializer} that can serialize a POJO {@code Command} into binary @param commandDeserializer {@code CommandDeserializer} that can deserialize binary into a {@code Command} POJO @throws IllegalStateException if this method is called multiple times @see RaftRPC#setupCustomCommandSerializationAndDeserialization(ObjectMapper, CommandSerializer, CommandDeserializer)
[ "Setup", "custom", "serialization", "and", "deserialization", "for", "POJO", "{", "@link", "Command", "}", "objects", ".", "This", "method", "should", "<strong", ">", "only<", "/", "strong", ">", "be", "called", "once", "." ]
train
https://github.com/allengeorge/libraft/blob/00d68bb5e68d4020af59df3c8a9a14380108ac89/libraft-agent/src/main/java/io/libraft/agent/RaftAgent.java#L315-L324
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/Drawable.java
Drawable.loadSpriteAnimated
public static SpriteAnimated loadSpriteAnimated(ImageBuffer surface, int horizontalFrames, int verticalFrames) { """ Load an animated sprite, giving horizontal and vertical frames (sharing the same surface). It may be useful in case of multiple animated sprites. <p> {@link SpriteAnimated#load()} must not be called as surface has already been loaded. </p> @param surface The surface reference (must not be <code>null</code>). @param horizontalFrames The number of horizontal frames (must be strictly positive). @param verticalFrames The number of vertical frames (must be strictly positive). @return The loaded animated sprite. @throws LionEngineException If arguments are invalid. """ return new SpriteAnimatedImpl(surface, horizontalFrames, verticalFrames); }
java
public static SpriteAnimated loadSpriteAnimated(ImageBuffer surface, int horizontalFrames, int verticalFrames) { return new SpriteAnimatedImpl(surface, horizontalFrames, verticalFrames); }
[ "public", "static", "SpriteAnimated", "loadSpriteAnimated", "(", "ImageBuffer", "surface", ",", "int", "horizontalFrames", ",", "int", "verticalFrames", ")", "{", "return", "new", "SpriteAnimatedImpl", "(", "surface", ",", "horizontalFrames", ",", "verticalFrames", ")", ";", "}" ]
Load an animated sprite, giving horizontal and vertical frames (sharing the same surface). It may be useful in case of multiple animated sprites. <p> {@link SpriteAnimated#load()} must not be called as surface has already been loaded. </p> @param surface The surface reference (must not be <code>null</code>). @param horizontalFrames The number of horizontal frames (must be strictly positive). @param verticalFrames The number of vertical frames (must be strictly positive). @return The loaded animated sprite. @throws LionEngineException If arguments are invalid.
[ "Load", "an", "animated", "sprite", "giving", "horizontal", "and", "vertical", "frames", "(", "sharing", "the", "same", "surface", ")", ".", "It", "may", "be", "useful", "in", "case", "of", "multiple", "animated", "sprites", ".", "<p", ">", "{", "@link", "SpriteAnimated#load", "()", "}", "must", "not", "be", "called", "as", "surface", "has", "already", "been", "loaded", ".", "<", "/", "p", ">" ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/Drawable.java#L197-L200
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/toolbar/CmsSitemapToolbar.java
CmsSitemapToolbar.setNewGalleryEnabled
public void setNewGalleryEnabled(boolean enabled, String disabledReason) { """ Enables/disables the new menu button.<p> @param enabled <code>true</code> to enable the button @param disabledReason the reason, why the button is disabled """ if (enabled) { m_newGalleryMenuButton.enable(); } else { m_newGalleryMenuButton.disable(disabledReason); } }
java
public void setNewGalleryEnabled(boolean enabled, String disabledReason) { if (enabled) { m_newGalleryMenuButton.enable(); } else { m_newGalleryMenuButton.disable(disabledReason); } }
[ "public", "void", "setNewGalleryEnabled", "(", "boolean", "enabled", ",", "String", "disabledReason", ")", "{", "if", "(", "enabled", ")", "{", "m_newGalleryMenuButton", ".", "enable", "(", ")", ";", "}", "else", "{", "m_newGalleryMenuButton", ".", "disable", "(", "disabledReason", ")", ";", "}", "}" ]
Enables/disables the new menu button.<p> @param enabled <code>true</code> to enable the button @param disabledReason the reason, why the button is disabled
[ "Enables", "/", "disables", "the", "new", "menu", "button", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/toolbar/CmsSitemapToolbar.java#L258-L265
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java
DocTreeScanner.visitSee
@Override public R visitSee(SeeTree node, P p) { """ {@inheritDoc} This implementation scans the children in left to right order. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of scanning """ return scan(node.getReference(), p); }
java
@Override public R visitSee(SeeTree node, P p) { return scan(node.getReference(), p); }
[ "@", "Override", "public", "R", "visitSee", "(", "SeeTree", "node", ",", "P", "p", ")", "{", "return", "scan", "(", "node", ".", "getReference", "(", ")", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation scans the children in left to right order. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of scanning
[ "{", "@inheritDoc", "}", "This", "implementation", "scans", "the", "children", "in", "left", "to", "right", "order", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java#L372-L375
mapsforge/mapsforge
sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java
DatabaseUtils.queryNumEntries
public static long queryNumEntries(SQLiteDatabase db, String table, String selection, String[] selectionArgs) { """ Query the table for the number of rows in the table. @param db the database the table is in @param table the name of the table to query @param selection A filter declaring which rows to return, formatted as an SQL WHERE clause (excluding the WHERE itself). Passing null will count all rows for the given table @param selectionArgs You may include ?s in selection, which will be replaced by the values from selectionArgs, in order that they appear in the selection. The values will be bound as Strings. @return the number of rows in the table filtered by the selection """ String s = (!TextUtils.isEmpty(selection)) ? " where " + selection : ""; return longForQuery(db, "select count(*) from " + table + s, selectionArgs); }
java
public static long queryNumEntries(SQLiteDatabase db, String table, String selection, String[] selectionArgs) { String s = (!TextUtils.isEmpty(selection)) ? " where " + selection : ""; return longForQuery(db, "select count(*) from " + table + s, selectionArgs); }
[ "public", "static", "long", "queryNumEntries", "(", "SQLiteDatabase", "db", ",", "String", "table", ",", "String", "selection", ",", "String", "[", "]", "selectionArgs", ")", "{", "String", "s", "=", "(", "!", "TextUtils", ".", "isEmpty", "(", "selection", ")", ")", "?", "\" where \"", "+", "selection", ":", "\"\"", ";", "return", "longForQuery", "(", "db", ",", "\"select count(*) from \"", "+", "table", "+", "s", ",", "selectionArgs", ")", ";", "}" ]
Query the table for the number of rows in the table. @param db the database the table is in @param table the name of the table to query @param selection A filter declaring which rows to return, formatted as an SQL WHERE clause (excluding the WHERE itself). Passing null will count all rows for the given table @param selectionArgs You may include ?s in selection, which will be replaced by the values from selectionArgs, in order that they appear in the selection. The values will be bound as Strings. @return the number of rows in the table filtered by the selection
[ "Query", "the", "table", "for", "the", "number", "of", "rows", "in", "the", "table", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java#L809-L814
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/MasterCatalogUrl.java
MasterCatalogUrl.getMasterCatalogUrl
public static MozuUrl getMasterCatalogUrl(Integer masterCatalogId, String responseFields) { """ Get Resource Url for GetMasterCatalog @param masterCatalogId Unique identifier for the master catalog. The master catalog contains all products accessible per catalogs and the site/tenant. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/mastercatalogs/{masterCatalogId}?responseFields={responseFields}"); formatter.formatUrl("masterCatalogId", masterCatalogId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getMasterCatalogUrl(Integer masterCatalogId, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/mastercatalogs/{masterCatalogId}?responseFields={responseFields}"); formatter.formatUrl("masterCatalogId", masterCatalogId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getMasterCatalogUrl", "(", "Integer", "masterCatalogId", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/mastercatalogs/{masterCatalogId}?responseFields={responseFields}\"", ")", ";", "formatter", ".", "formatUrl", "(", "\"masterCatalogId\"", ",", "masterCatalogId", ")", ";", "formatter", ".", "formatUrl", "(", "\"responseFields\"", ",", "responseFields", ")", ";", "return", "new", "MozuUrl", "(", "formatter", ".", "getResourceUrl", "(", ")", ",", "MozuUrl", ".", "UrlLocation", ".", "TENANT_POD", ")", ";", "}" ]
Get Resource Url for GetMasterCatalog @param masterCatalogId Unique identifier for the master catalog. The master catalog contains all products accessible per catalogs and the site/tenant. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetMasterCatalog" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/MasterCatalogUrl.java#L34-L40
mozilla/rhino
src/org/mozilla/javascript/ScriptRuntime.java
ScriptRuntime.getObjectIndex
@Deprecated public static Object getObjectIndex(Object obj, double dblIndex, Context cx) { """ A cheaper and less general version of the above for well-known argument types. @deprecated Use {@link #getObjectIndex(Object, double, Context, Scriptable)} instead """ return getObjectIndex(obj, dblIndex, cx, getTopCallScope(cx)); }
java
@Deprecated public static Object getObjectIndex(Object obj, double dblIndex, Context cx) { return getObjectIndex(obj, dblIndex, cx, getTopCallScope(cx)); }
[ "@", "Deprecated", "public", "static", "Object", "getObjectIndex", "(", "Object", "obj", ",", "double", "dblIndex", ",", "Context", "cx", ")", "{", "return", "getObjectIndex", "(", "obj", ",", "dblIndex", ",", "cx", ",", "getTopCallScope", "(", "cx", ")", ")", ";", "}" ]
A cheaper and less general version of the above for well-known argument types. @deprecated Use {@link #getObjectIndex(Object, double, Context, Scriptable)} instead
[ "A", "cheaper", "and", "less", "general", "version", "of", "the", "above", "for", "well", "-", "known", "argument", "types", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptRuntime.java#L1631-L1636
bazaarvoice/jolt
jolt-core/src/main/java/com/bazaarvoice/jolt/defaultr/Key.java
Key.processSpec
private static Set<Key> processSpec( boolean parentIsArray, Map<String, Object> spec ) { """ Recursively walk the spec input tree. Handle arrays by telling DefaultrKeys if they need to be ArrayKeys, and to find the max default array length. """ // TODO switch to List<Key> and sort before returning Set<Key> result = new HashSet<>(); for ( String key : spec.keySet() ) { Object subSpec = spec.get( key ); if ( parentIsArray ) { result.add( new ArrayKey( key, subSpec ) ); // this will recursively call processSpec if needed } else { result.add( new MapKey( key, subSpec ) ); // this will recursively call processSpec if needed } } return result; }
java
private static Set<Key> processSpec( boolean parentIsArray, Map<String, Object> spec ) { // TODO switch to List<Key> and sort before returning Set<Key> result = new HashSet<>(); for ( String key : spec.keySet() ) { Object subSpec = spec.get( key ); if ( parentIsArray ) { result.add( new ArrayKey( key, subSpec ) ); // this will recursively call processSpec if needed } else { result.add( new MapKey( key, subSpec ) ); // this will recursively call processSpec if needed } } return result; }
[ "private", "static", "Set", "<", "Key", ">", "processSpec", "(", "boolean", "parentIsArray", ",", "Map", "<", "String", ",", "Object", ">", "spec", ")", "{", "// TODO switch to List<Key> and sort before returning", "Set", "<", "Key", ">", "result", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "String", "key", ":", "spec", ".", "keySet", "(", ")", ")", "{", "Object", "subSpec", "=", "spec", ".", "get", "(", "key", ")", ";", "if", "(", "parentIsArray", ")", "{", "result", ".", "add", "(", "new", "ArrayKey", "(", "key", ",", "subSpec", ")", ")", ";", "// this will recursively call processSpec if needed", "}", "else", "{", "result", ".", "add", "(", "new", "MapKey", "(", "key", ",", "subSpec", ")", ")", ";", "// this will recursively call processSpec if needed", "}", "}", "return", "result", ";", "}" ]
Recursively walk the spec input tree. Handle arrays by telling DefaultrKeys if they need to be ArrayKeys, and to find the max default array length.
[ "Recursively", "walk", "the", "spec", "input", "tree", ".", "Handle", "arrays", "by", "telling", "DefaultrKeys", "if", "they", "need", "to", "be", "ArrayKeys", "and", "to", "find", "the", "max", "default", "array", "length", "." ]
train
https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/defaultr/Key.java#L49-L66
alkacon/opencms-core
src/org/opencms/site/CmsSiteManagerImpl.java
CmsSiteManagerImpl.getSite
public CmsSite getSite(String rootPath, String fallbackSiteRoot) { """ Returns the site for the given resource path, using the fall back site root in case the resource path is no root path.<p> In case neither the given resource path, nor the given fall back site root matches any configured site, the default site is returned.<p> Usually the fall back site root should be taken from {@link org.opencms.file.CmsRequestContext#getSiteRoot()}, in which case a site for the site root should always exist.<p> This is the same as first calling {@link #getSiteForRootPath(String)} with the <code>resourcePath</code> parameter, and if this fails calling {@link #getSiteForSiteRoot(String)} with the <code>fallbackSiteRoot</code> parameter, and if this fails calling {@link #getDefaultSite()}.<p> @param rootPath the resource root path to get the site for @param fallbackSiteRoot site root to use in case the resource path is no root path @return the site for the given resource path, using the fall back site root in case the resource path is no root path @see #getSiteForRootPath(String) """ CmsSite result = getSiteForRootPath(rootPath); if (result == null) { result = getSiteForSiteRoot(fallbackSiteRoot); if (result == null) { result = getDefaultSite(); } } return result; }
java
public CmsSite getSite(String rootPath, String fallbackSiteRoot) { CmsSite result = getSiteForRootPath(rootPath); if (result == null) { result = getSiteForSiteRoot(fallbackSiteRoot); if (result == null) { result = getDefaultSite(); } } return result; }
[ "public", "CmsSite", "getSite", "(", "String", "rootPath", ",", "String", "fallbackSiteRoot", ")", "{", "CmsSite", "result", "=", "getSiteForRootPath", "(", "rootPath", ")", ";", "if", "(", "result", "==", "null", ")", "{", "result", "=", "getSiteForSiteRoot", "(", "fallbackSiteRoot", ")", ";", "if", "(", "result", "==", "null", ")", "{", "result", "=", "getDefaultSite", "(", ")", ";", "}", "}", "return", "result", ";", "}" ]
Returns the site for the given resource path, using the fall back site root in case the resource path is no root path.<p> In case neither the given resource path, nor the given fall back site root matches any configured site, the default site is returned.<p> Usually the fall back site root should be taken from {@link org.opencms.file.CmsRequestContext#getSiteRoot()}, in which case a site for the site root should always exist.<p> This is the same as first calling {@link #getSiteForRootPath(String)} with the <code>resourcePath</code> parameter, and if this fails calling {@link #getSiteForSiteRoot(String)} with the <code>fallbackSiteRoot</code> parameter, and if this fails calling {@link #getDefaultSite()}.<p> @param rootPath the resource root path to get the site for @param fallbackSiteRoot site root to use in case the resource path is no root path @return the site for the given resource path, using the fall back site root in case the resource path is no root path @see #getSiteForRootPath(String)
[ "Returns", "the", "site", "for", "the", "given", "resource", "path", "using", "the", "fall", "back", "site", "root", "in", "case", "the", "resource", "path", "is", "no", "root", "path", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/CmsSiteManagerImpl.java#L859-L869
EdwardRaff/JSAT
JSAT/src/jsat/math/optimization/NelderMead.java
NelderMead.setExpansion
public void setExpansion(double expansion) { """ Sets the expansion constant, which must be greater than 1 and the reflection constant @param expansion """ if(expansion <= 1 || Double.isNaN(expansion) || Double.isInfinite(expansion) ) throw new ArithmeticException("Expansion constant must be > 1, not " + expansion); else if(expansion <= reflection) throw new ArithmeticException("Expansion constant must be less than the reflection constant"); this.expansion = expansion; }
java
public void setExpansion(double expansion) { if(expansion <= 1 || Double.isNaN(expansion) || Double.isInfinite(expansion) ) throw new ArithmeticException("Expansion constant must be > 1, not " + expansion); else if(expansion <= reflection) throw new ArithmeticException("Expansion constant must be less than the reflection constant"); this.expansion = expansion; }
[ "public", "void", "setExpansion", "(", "double", "expansion", ")", "{", "if", "(", "expansion", "<=", "1", "||", "Double", ".", "isNaN", "(", "expansion", ")", "||", "Double", ".", "isInfinite", "(", "expansion", ")", ")", "throw", "new", "ArithmeticException", "(", "\"Expansion constant must be > 1, not \"", "+", "expansion", ")", ";", "else", "if", "(", "expansion", "<=", "reflection", ")", "throw", "new", "ArithmeticException", "(", "\"Expansion constant must be less than the reflection constant\"", ")", ";", "this", ".", "expansion", "=", "expansion", ";", "}" ]
Sets the expansion constant, which must be greater than 1 and the reflection constant @param expansion
[ "Sets", "the", "expansion", "constant", "which", "must", "be", "greater", "than", "1", "and", "the", "reflection", "constant" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/optimization/NelderMead.java#L72-L79
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.perspectiveLH
public Matrix4d perspectiveLH(double fovy, double aspect, double zNear, double zFar, boolean zZeroToOne) { """ Apply a symmetric perspective projection frustum transformation for a left-handed coordinate system using the given NDC z range to this matrix. <p> If <code>M</code> is <code>this</code> matrix and <code>P</code> the perspective projection matrix, then the new matrix will be <code>M * P</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * P * v</code>, the perspective projection will be applied first! <p> In order to set the matrix to a perspective frustum transformation without post-multiplying, use {@link #setPerspectiveLH(double, double, double, double, boolean) setPerspectiveLH}. @see #setPerspectiveLH(double, double, double, double, boolean) @param fovy the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI}) @param aspect the aspect ratio (i.e. width / height; must be greater than zero) @param zNear near clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity. In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zFar far clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity. In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return this """ return perspectiveLH(fovy, aspect, zNear, zFar, zZeroToOne, this); }
java
public Matrix4d perspectiveLH(double fovy, double aspect, double zNear, double zFar, boolean zZeroToOne) { return perspectiveLH(fovy, aspect, zNear, zFar, zZeroToOne, this); }
[ "public", "Matrix4d", "perspectiveLH", "(", "double", "fovy", ",", "double", "aspect", ",", "double", "zNear", ",", "double", "zFar", ",", "boolean", "zZeroToOne", ")", "{", "return", "perspectiveLH", "(", "fovy", ",", "aspect", ",", "zNear", ",", "zFar", ",", "zZeroToOne", ",", "this", ")", ";", "}" ]
Apply a symmetric perspective projection frustum transformation for a left-handed coordinate system using the given NDC z range to this matrix. <p> If <code>M</code> is <code>this</code> matrix and <code>P</code> the perspective projection matrix, then the new matrix will be <code>M * P</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * P * v</code>, the perspective projection will be applied first! <p> In order to set the matrix to a perspective frustum transformation without post-multiplying, use {@link #setPerspectiveLH(double, double, double, double, boolean) setPerspectiveLH}. @see #setPerspectiveLH(double, double, double, double, boolean) @param fovy the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI}) @param aspect the aspect ratio (i.e. width / height; must be greater than zero) @param zNear near clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity. In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zFar far clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity. In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return this
[ "Apply", "a", "symmetric", "perspective", "projection", "frustum", "transformation", "for", "a", "left", "-", "handed", "coordinate", "system", "using", "the", "given", "NDC", "z", "range", "to", "this", "matrix", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is", "<code", ">", "this<", "/", "code", ">", "matrix", "and", "<code", ">", "P<", "/", "code", ">", "the", "perspective", "projection", "matrix", "then", "the", "new", "matrix", "will", "be", "<code", ">", "M", "*", "P<", "/", "code", ">", ".", "So", "when", "transforming", "a", "vector", "<code", ">", "v<", "/", "code", ">", "with", "the", "new", "matrix", "by", "using", "<code", ">", "M", "*", "P", "*", "v<", "/", "code", ">", "the", "perspective", "projection", "will", "be", "applied", "first!", "<p", ">", "In", "order", "to", "set", "the", "matrix", "to", "a", "perspective", "frustum", "transformation", "without", "post", "-", "multiplying", "use", "{", "@link", "#setPerspectiveLH", "(", "double", "double", "double", "double", "boolean", ")", "setPerspectiveLH", "}", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L12917-L12919
lessthanoptimal/ejml
main/ejml-core/src/org/ejml/ops/ComplexMath_F64.java
ComplexMath_F64.sqrt
public static void sqrt(Complex_F64 input, Complex_F64 root) { """ Computes the square root of the complex number. @param input Input complex number. @param root Output. The square root of the input """ double r = input.getMagnitude(); double a = input.real; root.real = Math.sqrt((r+a)/2.0); root.imaginary = Math.sqrt((r-a)/2.0); if( input.imaginary < 0 ) root.imaginary = -root.imaginary; }
java
public static void sqrt(Complex_F64 input, Complex_F64 root) { double r = input.getMagnitude(); double a = input.real; root.real = Math.sqrt((r+a)/2.0); root.imaginary = Math.sqrt((r-a)/2.0); if( input.imaginary < 0 ) root.imaginary = -root.imaginary; }
[ "public", "static", "void", "sqrt", "(", "Complex_F64", "input", ",", "Complex_F64", "root", ")", "{", "double", "r", "=", "input", ".", "getMagnitude", "(", ")", ";", "double", "a", "=", "input", ".", "real", ";", "root", ".", "real", "=", "Math", ".", "sqrt", "(", "(", "r", "+", "a", ")", "/", "2.0", ")", ";", "root", ".", "imaginary", "=", "Math", ".", "sqrt", "(", "(", "r", "-", "a", ")", "/", "2.0", ")", ";", "if", "(", "input", ".", "imaginary", "<", "0", ")", "root", ".", "imaginary", "=", "-", "root", ".", "imaginary", ";", "}" ]
Computes the square root of the complex number. @param input Input complex number. @param root Output. The square root of the input
[ "Computes", "the", "square", "root", "of", "the", "complex", "number", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/ops/ComplexMath_F64.java#L207-L216
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/github/lgooddatepicker/zinternaltools/CalculateMinimumDateFieldSize.java
CalculateMinimumDateFieldSize.getLongestTextMonthInLocale
static private Month getLongestTextMonthInLocale(Locale locale, FontMetrics fontMetrics) { """ getLongestTextMonthInLocale, For the supplied locale, this returns the month that has the longest translated, "formatting version", "long text version" month name. The version of the month name string that is used for comparison is further defined below. Note that this does not return the longest month for numeric month date formats. The longest month in entirely numeric formats is always December. (Month number 12). The compared month names are the "formatting version" of the translated month names (not the standalone version). In some locales such as Russian and Czech, the formatting version can be different from the standalone version. The "formatting version" is the name of the month that would be used in a formatted date. The standalone version is only used when the month is displayed by itself. The month names that are used for comparison are also the "long version" of the month names, not the short (abbreviated) version. The translated month names are compared using the supplied font metrics. This returns the longest month, as defined by the above criteria. If two or more months are "tied" as the "longest month", then the longest month that is closest to the end of the year will be the one that is returned. """ // Get the "formatting names" of all the months for this locale. // Request the capitalized long version of the translated month names. String[] formattingMonthNames = ExtraDateStrings.getFormattingMonthNamesArray( locale, true, false); // Find out which month is longest, using the supplied font metrics. int longestMonthWidth = 0; Month longestMonth = Month.JANUARY; for (int i = 0; i < formattingMonthNames.length; ++i) { int currentMonthWidth = fontMetrics.stringWidth(formattingMonthNames[i]); if (currentMonthWidth >= longestMonthWidth) { int oneBasedMonthIndex = (i + 1); longestMonth = Month.of(oneBasedMonthIndex); longestMonthWidth = currentMonthWidth; } } return longestMonth; }
java
static private Month getLongestTextMonthInLocale(Locale locale, FontMetrics fontMetrics) { // Get the "formatting names" of all the months for this locale. // Request the capitalized long version of the translated month names. String[] formattingMonthNames = ExtraDateStrings.getFormattingMonthNamesArray( locale, true, false); // Find out which month is longest, using the supplied font metrics. int longestMonthWidth = 0; Month longestMonth = Month.JANUARY; for (int i = 0; i < formattingMonthNames.length; ++i) { int currentMonthWidth = fontMetrics.stringWidth(formattingMonthNames[i]); if (currentMonthWidth >= longestMonthWidth) { int oneBasedMonthIndex = (i + 1); longestMonth = Month.of(oneBasedMonthIndex); longestMonthWidth = currentMonthWidth; } } return longestMonth; }
[ "static", "private", "Month", "getLongestTextMonthInLocale", "(", "Locale", "locale", ",", "FontMetrics", "fontMetrics", ")", "{", "// Get the \"formatting names\" of all the months for this locale.", "// Request the capitalized long version of the translated month names.", "String", "[", "]", "formattingMonthNames", "=", "ExtraDateStrings", ".", "getFormattingMonthNamesArray", "(", "locale", ",", "true", ",", "false", ")", ";", "// Find out which month is longest, using the supplied font metrics.", "int", "longestMonthWidth", "=", "0", ";", "Month", "longestMonth", "=", "Month", ".", "JANUARY", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "formattingMonthNames", ".", "length", ";", "++", "i", ")", "{", "int", "currentMonthWidth", "=", "fontMetrics", ".", "stringWidth", "(", "formattingMonthNames", "[", "i", "]", ")", ";", "if", "(", "currentMonthWidth", ">=", "longestMonthWidth", ")", "{", "int", "oneBasedMonthIndex", "=", "(", "i", "+", "1", ")", ";", "longestMonth", "=", "Month", ".", "of", "(", "oneBasedMonthIndex", ")", ";", "longestMonthWidth", "=", "currentMonthWidth", ";", "}", "}", "return", "longestMonth", ";", "}" ]
getLongestTextMonthInLocale, For the supplied locale, this returns the month that has the longest translated, "formatting version", "long text version" month name. The version of the month name string that is used for comparison is further defined below. Note that this does not return the longest month for numeric month date formats. The longest month in entirely numeric formats is always December. (Month number 12). The compared month names are the "formatting version" of the translated month names (not the standalone version). In some locales such as Russian and Czech, the formatting version can be different from the standalone version. The "formatting version" is the name of the month that would be used in a formatted date. The standalone version is only used when the month is displayed by itself. The month names that are used for comparison are also the "long version" of the month names, not the short (abbreviated) version. The translated month names are compared using the supplied font metrics. This returns the longest month, as defined by the above criteria. If two or more months are "tied" as the "longest month", then the longest month that is closest to the end of the year will be the one that is returned.
[ "getLongestTextMonthInLocale" ]
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/zinternaltools/CalculateMinimumDateFieldSize.java#L106-L123
Impetus/Kundera
src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBClient.java
CouchDBClient.onDelete
private void onDelete(String schemaName, Object pKey, HttpResponse response, JsonObject jsonObject) throws URISyntaxException, IOException, ClientProtocolException { """ On delete. @param schemaName the schema name @param pKey the key @param response the response @param jsonObject the json object @throws URISyntaxException the URI syntax exception @throws IOException Signals that an I/O exception has occurred. @throws ClientProtocolException the client protocol exception """ URI uri; String q; JsonElement rev = jsonObject.get("_rev"); StringBuilder builder = new StringBuilder(); builder.append("rev="); builder.append(rev.getAsString()); q = builder.toString(); uri = new URI(CouchDBConstants.PROTOCOL, null, httpHost.getHostName(), httpHost.getPort(), CouchDBConstants.URL_SEPARATOR + schemaName.toLowerCase() + CouchDBConstants.URL_SEPARATOR + pKey, q, null); HttpDelete delete = new HttpDelete(uri); response = httpClient.execute(delete); closeContent(response); }
java
private void onDelete(String schemaName, Object pKey, HttpResponse response, JsonObject jsonObject) throws URISyntaxException, IOException, ClientProtocolException { URI uri; String q; JsonElement rev = jsonObject.get("_rev"); StringBuilder builder = new StringBuilder(); builder.append("rev="); builder.append(rev.getAsString()); q = builder.toString(); uri = new URI(CouchDBConstants.PROTOCOL, null, httpHost.getHostName(), httpHost.getPort(), CouchDBConstants.URL_SEPARATOR + schemaName.toLowerCase() + CouchDBConstants.URL_SEPARATOR + pKey, q, null); HttpDelete delete = new HttpDelete(uri); response = httpClient.execute(delete); closeContent(response); }
[ "private", "void", "onDelete", "(", "String", "schemaName", ",", "Object", "pKey", ",", "HttpResponse", "response", ",", "JsonObject", "jsonObject", ")", "throws", "URISyntaxException", ",", "IOException", ",", "ClientProtocolException", "{", "URI", "uri", ";", "String", "q", ";", "JsonElement", "rev", "=", "jsonObject", ".", "get", "(", "\"_rev\"", ")", ";", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "builder", ".", "append", "(", "\"rev=\"", ")", ";", "builder", ".", "append", "(", "rev", ".", "getAsString", "(", ")", ")", ";", "q", "=", "builder", ".", "toString", "(", ")", ";", "uri", "=", "new", "URI", "(", "CouchDBConstants", ".", "PROTOCOL", ",", "null", ",", "httpHost", ".", "getHostName", "(", ")", ",", "httpHost", ".", "getPort", "(", ")", ",", "CouchDBConstants", ".", "URL_SEPARATOR", "+", "schemaName", ".", "toLowerCase", "(", ")", "+", "CouchDBConstants", ".", "URL_SEPARATOR", "+", "pKey", ",", "q", ",", "null", ")", ";", "HttpDelete", "delete", "=", "new", "HttpDelete", "(", "uri", ")", ";", "response", "=", "httpClient", ".", "execute", "(", "delete", ")", ";", "closeContent", "(", "response", ")", ";", "}" ]
On delete. @param schemaName the schema name @param pKey the key @param response the response @param jsonObject the json object @throws URISyntaxException the URI syntax exception @throws IOException Signals that an I/O exception has occurred. @throws ClientProtocolException the client protocol exception
[ "On", "delete", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBClient.java#L544-L564
geomajas/geomajas-project-client-gwt2
plugin/corewidget/example-jar/src/main/java/org/geomajas/gwt2/plugin/corewidget/example/client/sample/feature/controller/FeatureClickedListener.java
FeatureClickedListener.calculateBufferFromPixelTolerance
private double calculateBufferFromPixelTolerance() { """ Calculate a buffer in which the listener may include the features from the map. @return double buffer """ Coordinate c1 = mapPresenter.getViewPort().getTransformationService() .transform(new Coordinate(0, 0), RenderSpace.SCREEN, RenderSpace.WORLD); Coordinate c2 = mapPresenter.getViewPort().getTransformationService() .transform(new Coordinate(pixelBuffer, 0), RenderSpace.SCREEN, RenderSpace.WORLD); return c1.distance(c2); }
java
private double calculateBufferFromPixelTolerance() { Coordinate c1 = mapPresenter.getViewPort().getTransformationService() .transform(new Coordinate(0, 0), RenderSpace.SCREEN, RenderSpace.WORLD); Coordinate c2 = mapPresenter.getViewPort().getTransformationService() .transform(new Coordinate(pixelBuffer, 0), RenderSpace.SCREEN, RenderSpace.WORLD); return c1.distance(c2); }
[ "private", "double", "calculateBufferFromPixelTolerance", "(", ")", "{", "Coordinate", "c1", "=", "mapPresenter", ".", "getViewPort", "(", ")", ".", "getTransformationService", "(", ")", ".", "transform", "(", "new", "Coordinate", "(", "0", ",", "0", ")", ",", "RenderSpace", ".", "SCREEN", ",", "RenderSpace", ".", "WORLD", ")", ";", "Coordinate", "c2", "=", "mapPresenter", ".", "getViewPort", "(", ")", ".", "getTransformationService", "(", ")", ".", "transform", "(", "new", "Coordinate", "(", "pixelBuffer", ",", "0", ")", ",", "RenderSpace", ".", "SCREEN", ",", "RenderSpace", ".", "WORLD", ")", ";", "return", "c1", ".", "distance", "(", "c2", ")", ";", "}" ]
Calculate a buffer in which the listener may include the features from the map. @return double buffer
[ "Calculate", "a", "buffer", "in", "which", "the", "listener", "may", "include", "the", "features", "from", "the", "map", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/corewidget/example-jar/src/main/java/org/geomajas/gwt2/plugin/corewidget/example/client/sample/feature/controller/FeatureClickedListener.java#L149-L157
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/BoundsOnRatiosInSampledSets.java
BoundsOnRatiosInSampledSets.getLowerBoundForBoverA
public static double getLowerBoundForBoverA(final long a, final long b, final double f) { """ Return the approximate lower bound based on a 95% confidence interval @param a See class javadoc @param b See class javadoc @param f the inclusion probability used to produce the set with size <i>a</i> and should generally be less than 0.5. Above this value, the results not be reliable. When <i>f</i> = 1.0 this returns the estimate. @return the approximate upper bound """ checkInputs(a, b, f); if (a == 0) { return 0.0; } if (f == 1.0) { return (double) b / a; } return approximateLowerBoundOnP(a, b, NUM_STD_DEVS * hackyAdjuster(f)); }
java
public static double getLowerBoundForBoverA(final long a, final long b, final double f) { checkInputs(a, b, f); if (a == 0) { return 0.0; } if (f == 1.0) { return (double) b / a; } return approximateLowerBoundOnP(a, b, NUM_STD_DEVS * hackyAdjuster(f)); }
[ "public", "static", "double", "getLowerBoundForBoverA", "(", "final", "long", "a", ",", "final", "long", "b", ",", "final", "double", "f", ")", "{", "checkInputs", "(", "a", ",", "b", ",", "f", ")", ";", "if", "(", "a", "==", "0", ")", "{", "return", "0.0", ";", "}", "if", "(", "f", "==", "1.0", ")", "{", "return", "(", "double", ")", "b", "/", "a", ";", "}", "return", "approximateLowerBoundOnP", "(", "a", ",", "b", ",", "NUM_STD_DEVS", "*", "hackyAdjuster", "(", "f", ")", ")", ";", "}" ]
Return the approximate lower bound based on a 95% confidence interval @param a See class javadoc @param b See class javadoc @param f the inclusion probability used to produce the set with size <i>a</i> and should generally be less than 0.5. Above this value, the results not be reliable. When <i>f</i> = 1.0 this returns the estimate. @return the approximate upper bound
[ "Return", "the", "approximate", "lower", "bound", "based", "on", "a", "95%", "confidence", "interval" ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/BoundsOnRatiosInSampledSets.java#L38-L43
twilio/authy-java
src/main/java/com/authy/api/Users.java
Users.requestSms
public Hash requestSms(int userId, Map<String, String> options) throws AuthyException { """ Send token via sms to a user with some options defined. @param userId @param options @return Hash instance with API's response. """ MapToResponse opt = new MapToResponse(options); final Response response = this.get(SMS_PATH + Integer.toString(userId), opt); return instanceFromJson(response.getStatus(), response.getBody()); }
java
public Hash requestSms(int userId, Map<String, String> options) throws AuthyException { MapToResponse opt = new MapToResponse(options); final Response response = this.get(SMS_PATH + Integer.toString(userId), opt); return instanceFromJson(response.getStatus(), response.getBody()); }
[ "public", "Hash", "requestSms", "(", "int", "userId", ",", "Map", "<", "String", ",", "String", ">", "options", ")", "throws", "AuthyException", "{", "MapToResponse", "opt", "=", "new", "MapToResponse", "(", "options", ")", ";", "final", "Response", "response", "=", "this", ".", "get", "(", "SMS_PATH", "+", "Integer", ".", "toString", "(", "userId", ")", ",", "opt", ")", ";", "return", "instanceFromJson", "(", "response", ".", "getStatus", "(", ")", ",", "response", ".", "getBody", "(", ")", ")", ";", "}" ]
Send token via sms to a user with some options defined. @param userId @param options @return Hash instance with API's response.
[ "Send", "token", "via", "sms", "to", "a", "user", "with", "some", "options", "defined", "." ]
train
https://github.com/twilio/authy-java/blob/55e3a5ff57a93b3eb36f5b59e8824e60af2b8b91/src/main/java/com/authy/api/Users.java#L80-L84
googleapis/google-cloud-java
google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystemProvider.java
CloudStorageFileSystemProvider.newByteChannel
@Override public SeekableByteChannel newByteChannel( Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException { """ Open a file for reading or writing. To read receiver-pays buckets, specify the BlobSourceOption.userProject option. @param path: the path to the file to open or create @param options: options specifying how the file is opened, e.g. StandardOpenOption.WRITE or BlobSourceOption.userProject @param attrs: (not supported, values will be ignored) @return @throws IOException """ checkNotNull(path); initStorage(); CloudStorageUtil.checkNotNullArray(attrs); if (options.contains(StandardOpenOption.WRITE)) { // TODO: Make our OpenOptions implement FileAttribute. Also remove buffer option. return newWriteChannel(path, options); } else { return newReadChannel(path, options); } }
java
@Override public SeekableByteChannel newByteChannel( Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException { checkNotNull(path); initStorage(); CloudStorageUtil.checkNotNullArray(attrs); if (options.contains(StandardOpenOption.WRITE)) { // TODO: Make our OpenOptions implement FileAttribute. Also remove buffer option. return newWriteChannel(path, options); } else { return newReadChannel(path, options); } }
[ "@", "Override", "public", "SeekableByteChannel", "newByteChannel", "(", "Path", "path", ",", "Set", "<", "?", "extends", "OpenOption", ">", "options", ",", "FileAttribute", "<", "?", ">", "...", "attrs", ")", "throws", "IOException", "{", "checkNotNull", "(", "path", ")", ";", "initStorage", "(", ")", ";", "CloudStorageUtil", ".", "checkNotNullArray", "(", "attrs", ")", ";", "if", "(", "options", ".", "contains", "(", "StandardOpenOption", ".", "WRITE", ")", ")", "{", "// TODO: Make our OpenOptions implement FileAttribute. Also remove buffer option.", "return", "newWriteChannel", "(", "path", ",", "options", ")", ";", "}", "else", "{", "return", "newReadChannel", "(", "path", ",", "options", ")", ";", "}", "}" ]
Open a file for reading or writing. To read receiver-pays buckets, specify the BlobSourceOption.userProject option. @param path: the path to the file to open or create @param options: options specifying how the file is opened, e.g. StandardOpenOption.WRITE or BlobSourceOption.userProject @param attrs: (not supported, values will be ignored) @return @throws IOException
[ "Open", "a", "file", "for", "reading", "or", "writing", ".", "To", "read", "receiver", "-", "pays", "buckets", "specify", "the", "BlobSourceOption", ".", "userProject", "option", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystemProvider.java#L295-L307
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/multilayer/MultiLayerNetwork.java
MultiLayerNetwork.rnnActivateUsingStoredState
public List<INDArray> rnnActivateUsingStoredState(INDArray input, boolean training, boolean storeLastForTBPTT) { """ Similar to rnnTimeStep and feedForward() methods. Difference here is that this method:<br> (a) like rnnTimeStep does forward pass using stored state for RNN layers, and<br> (b) unlike rnnTimeStep does not modify the RNN layer state<br> Therefore multiple calls to this method with the same input should have the same output.<br> Typically used during training only. Use rnnTimeStep for prediction/forward pass at test time. @param input Input to network @param training Whether training or not @param storeLastForTBPTT set to true if used as part of truncated BPTT training @return Activations for each layer (including input, as per feedforward() etc) """ return ffToLayerActivationsDetached(training, FwdPassType.RNN_ACTIVATE_WITH_STORED_STATE, storeLastForTBPTT, layers.length-1, input, mask, null, false); }
java
public List<INDArray> rnnActivateUsingStoredState(INDArray input, boolean training, boolean storeLastForTBPTT) { return ffToLayerActivationsDetached(training, FwdPassType.RNN_ACTIVATE_WITH_STORED_STATE, storeLastForTBPTT, layers.length-1, input, mask, null, false); }
[ "public", "List", "<", "INDArray", ">", "rnnActivateUsingStoredState", "(", "INDArray", "input", ",", "boolean", "training", ",", "boolean", "storeLastForTBPTT", ")", "{", "return", "ffToLayerActivationsDetached", "(", "training", ",", "FwdPassType", ".", "RNN_ACTIVATE_WITH_STORED_STATE", ",", "storeLastForTBPTT", ",", "layers", ".", "length", "-", "1", ",", "input", ",", "mask", ",", "null", ",", "false", ")", ";", "}" ]
Similar to rnnTimeStep and feedForward() methods. Difference here is that this method:<br> (a) like rnnTimeStep does forward pass using stored state for RNN layers, and<br> (b) unlike rnnTimeStep does not modify the RNN layer state<br> Therefore multiple calls to this method with the same input should have the same output.<br> Typically used during training only. Use rnnTimeStep for prediction/forward pass at test time. @param input Input to network @param training Whether training or not @param storeLastForTBPTT set to true if used as part of truncated BPTT training @return Activations for each layer (including input, as per feedforward() etc)
[ "Similar", "to", "rnnTimeStep", "and", "feedForward", "()", "methods", ".", "Difference", "here", "is", "that", "this", "method", ":", "<br", ">", "(", "a", ")", "like", "rnnTimeStep", "does", "forward", "pass", "using", "stored", "state", "for", "RNN", "layers", "and<br", ">", "(", "b", ")", "unlike", "rnnTimeStep", "does", "not", "modify", "the", "RNN", "layer", "state<br", ">", "Therefore", "multiple", "calls", "to", "this", "method", "with", "the", "same", "input", "should", "have", "the", "same", "output", ".", "<br", ">", "Typically", "used", "during", "training", "only", ".", "Use", "rnnTimeStep", "for", "prediction", "/", "forward", "pass", "at", "test", "time", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/multilayer/MultiLayerNetwork.java#L3137-L3139
apache/incubator-atlas
client/src/main/java/org/apache/atlas/AtlasClient.java
AtlasClient.listTypes
public List<String> listTypes(final DataTypes.TypeCategory category) throws AtlasServiceException { """ Returns all type names with the given category @param category @return list of type names @throws AtlasServiceException """ JSONObject response = callAPIWithRetries(API.LIST_TYPES, null, new ResourceCreator() { @Override public WebResource createResource() { WebResource resource = getResource(API.LIST_TYPES.getPath()); resource = resource.queryParam(TYPE, category.name()); return resource; } }); return extractResults(response, AtlasClient.RESULTS, new ExtractOperation<String, String>()); }
java
public List<String> listTypes(final DataTypes.TypeCategory category) throws AtlasServiceException { JSONObject response = callAPIWithRetries(API.LIST_TYPES, null, new ResourceCreator() { @Override public WebResource createResource() { WebResource resource = getResource(API.LIST_TYPES.getPath()); resource = resource.queryParam(TYPE, category.name()); return resource; } }); return extractResults(response, AtlasClient.RESULTS, new ExtractOperation<String, String>()); }
[ "public", "List", "<", "String", ">", "listTypes", "(", "final", "DataTypes", ".", "TypeCategory", "category", ")", "throws", "AtlasServiceException", "{", "JSONObject", "response", "=", "callAPIWithRetries", "(", "API", ".", "LIST_TYPES", ",", "null", ",", "new", "ResourceCreator", "(", ")", "{", "@", "Override", "public", "WebResource", "createResource", "(", ")", "{", "WebResource", "resource", "=", "getResource", "(", "API", ".", "LIST_TYPES", ".", "getPath", "(", ")", ")", ";", "resource", "=", "resource", ".", "queryParam", "(", "TYPE", ",", "category", ".", "name", "(", ")", ")", ";", "return", "resource", ";", "}", "}", ")", ";", "return", "extractResults", "(", "response", ",", "AtlasClient", ".", "RESULTS", ",", "new", "ExtractOperation", "<", "String", ",", "String", ">", "(", ")", ")", ";", "}" ]
Returns all type names with the given category @param category @return list of type names @throws AtlasServiceException
[ "Returns", "all", "type", "names", "with", "the", "given", "category" ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/client/src/main/java/org/apache/atlas/AtlasClient.java#L371-L381
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/xpath/XPathQueryBuilder.java
XPathQueryBuilder.createLocationStep
private LocationStepQueryNode createLocationStep(SimpleNode node, NAryQueryNode parent) { """ Creates a <code>LocationStepQueryNode</code> at the current position in parent. @param node the current node in the xpath syntax tree. @param parent the parent <code>PathQueryNode</code>. @return the created <code>LocationStepQueryNode</code>. """ LocationStepQueryNode queryNode = null; boolean descendant = false; Node p = node.jjtGetParent(); for (int i = 0; i < p.jjtGetNumChildren(); i++) { SimpleNode c = (SimpleNode) p.jjtGetChild(i); if (c == node) { // NOSONAR queryNode = factory.createLocationStepQueryNode(parent); queryNode.setNameTest(null); queryNode.setIncludeDescendants(descendant); parent.addOperand(queryNode); break; } descendant = (c.getId() == JJTSLASHSLASH || c.getId() == JJTROOTDESCENDANTS); } node.childrenAccept(this, queryNode); return queryNode; }
java
private LocationStepQueryNode createLocationStep(SimpleNode node, NAryQueryNode parent) { LocationStepQueryNode queryNode = null; boolean descendant = false; Node p = node.jjtGetParent(); for (int i = 0; i < p.jjtGetNumChildren(); i++) { SimpleNode c = (SimpleNode) p.jjtGetChild(i); if (c == node) { // NOSONAR queryNode = factory.createLocationStepQueryNode(parent); queryNode.setNameTest(null); queryNode.setIncludeDescendants(descendant); parent.addOperand(queryNode); break; } descendant = (c.getId() == JJTSLASHSLASH || c.getId() == JJTROOTDESCENDANTS); } node.childrenAccept(this, queryNode); return queryNode; }
[ "private", "LocationStepQueryNode", "createLocationStep", "(", "SimpleNode", "node", ",", "NAryQueryNode", "parent", ")", "{", "LocationStepQueryNode", "queryNode", "=", "null", ";", "boolean", "descendant", "=", "false", ";", "Node", "p", "=", "node", ".", "jjtGetParent", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "p", ".", "jjtGetNumChildren", "(", ")", ";", "i", "++", ")", "{", "SimpleNode", "c", "=", "(", "SimpleNode", ")", "p", ".", "jjtGetChild", "(", "i", ")", ";", "if", "(", "c", "==", "node", ")", "{", "// NOSONAR", "queryNode", "=", "factory", ".", "createLocationStepQueryNode", "(", "parent", ")", ";", "queryNode", ".", "setNameTest", "(", "null", ")", ";", "queryNode", ".", "setIncludeDescendants", "(", "descendant", ")", ";", "parent", ".", "addOperand", "(", "queryNode", ")", ";", "break", ";", "}", "descendant", "=", "(", "c", ".", "getId", "(", ")", "==", "JJTSLASHSLASH", "||", "c", ".", "getId", "(", ")", "==", "JJTROOTDESCENDANTS", ")", ";", "}", "node", ".", "childrenAccept", "(", "this", ",", "queryNode", ")", ";", "return", "queryNode", ";", "}" ]
Creates a <code>LocationStepQueryNode</code> at the current position in parent. @param node the current node in the xpath syntax tree. @param parent the parent <code>PathQueryNode</code>. @return the created <code>LocationStepQueryNode</code>.
[ "Creates", "a", "<code", ">", "LocationStepQueryNode<", "/", "code", ">", "at", "the", "current", "position", "in", "parent", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/xpath/XPathQueryBuilder.java#L603-L623
openengsb/openengsb
components/util/src/main/java/org/openengsb/core/util/CipherUtils.java
CipherUtils.generateKeyPair
public static KeyPair generateKeyPair(String algorithm, int keySize) { """ Generate a {@link KeyPair} for the given assymmetric algorithm and keysize Example: CipherUtils.generateKeyPair("RSA", 2048) """ KeyPairGenerator keyPairGenerator; try { keyPairGenerator = KeyPairGenerator.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException(e); } keyPairGenerator.initialize(keySize); return keyPairGenerator.generateKeyPair(); }
java
public static KeyPair generateKeyPair(String algorithm, int keySize) { KeyPairGenerator keyPairGenerator; try { keyPairGenerator = KeyPairGenerator.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException(e); } keyPairGenerator.initialize(keySize); return keyPairGenerator.generateKeyPair(); }
[ "public", "static", "KeyPair", "generateKeyPair", "(", "String", "algorithm", ",", "int", "keySize", ")", "{", "KeyPairGenerator", "keyPairGenerator", ";", "try", "{", "keyPairGenerator", "=", "KeyPairGenerator", ".", "getInstance", "(", "algorithm", ")", ";", "}", "catch", "(", "NoSuchAlgorithmException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "e", ")", ";", "}", "keyPairGenerator", ".", "initialize", "(", "keySize", ")", ";", "return", "keyPairGenerator", ".", "generateKeyPair", "(", ")", ";", "}" ]
Generate a {@link KeyPair} for the given assymmetric algorithm and keysize Example: CipherUtils.generateKeyPair("RSA", 2048)
[ "Generate", "a", "{", "@link", "KeyPair", "}", "for", "the", "given", "assymmetric", "algorithm", "and", "keysize" ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/util/src/main/java/org/openengsb/core/util/CipherUtils.java#L173-L182
hal/core
gui/src/main/java/org/jboss/as/console/client/tools/ChildView.java
ChildView.showAddDialog
public void showAddDialog(final ModelNode address, boolean isSingleton, SecurityContext securityContext, ModelNode description) { """ Callback for creation of add dialogs. Will be invoked once the presenter has loaded the resource description. @param address @param isSingleton @param securityContext @param description """ String resourceAddress = AddressUtils.asKey(address, isSingleton); if(securityContext.getOperationPriviledge(resourceAddress, "add").isGranted()) { _showAddDialog(address, isSingleton, securityContext, description); } else { Feedback.alert(Console.CONSTANTS.unauthorized(), Console.CONSTANTS.unauthorizedAdd()); } }
java
public void showAddDialog(final ModelNode address, boolean isSingleton, SecurityContext securityContext, ModelNode description) { String resourceAddress = AddressUtils.asKey(address, isSingleton); if(securityContext.getOperationPriviledge(resourceAddress, "add").isGranted()) { _showAddDialog(address, isSingleton, securityContext, description); } else { Feedback.alert(Console.CONSTANTS.unauthorized(), Console.CONSTANTS.unauthorizedAdd()); } }
[ "public", "void", "showAddDialog", "(", "final", "ModelNode", "address", ",", "boolean", "isSingleton", ",", "SecurityContext", "securityContext", ",", "ModelNode", "description", ")", "{", "String", "resourceAddress", "=", "AddressUtils", ".", "asKey", "(", "address", ",", "isSingleton", ")", ";", "if", "(", "securityContext", ".", "getOperationPriviledge", "(", "resourceAddress", ",", "\"add\"", ")", ".", "isGranted", "(", ")", ")", "{", "_showAddDialog", "(", "address", ",", "isSingleton", ",", "securityContext", ",", "description", ")", ";", "}", "else", "{", "Feedback", ".", "alert", "(", "Console", ".", "CONSTANTS", ".", "unauthorized", "(", ")", ",", "Console", ".", "CONSTANTS", ".", "unauthorizedAdd", "(", ")", ")", ";", "}", "}" ]
Callback for creation of add dialogs. Will be invoked once the presenter has loaded the resource description. @param address @param isSingleton @param securityContext @param description
[ "Callback", "for", "creation", "of", "add", "dialogs", ".", "Will", "be", "invoked", "once", "the", "presenter", "has", "loaded", "the", "resource", "description", "." ]
train
https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/tools/ChildView.java#L231-L244
zaproxy/zaproxy
src/org/parosproxy/paros/network/HttpSender.java
HttpSender.followRedirections
private void followRedirections(HttpMessage message, HttpRequestConfig requestConfig) throws IOException { """ Follows redirections using the response of the given {@code message}. The {@code validator} in the given request configuration will be called for each redirection received. After the call to this method the given {@code message} will have the contents of the last response received (possibly the response of a redirection). <p> The validator is notified of each message sent and received (first message and redirections followed, if any). @param message the message that will be sent, must not be {@code null} @param requestConfig the request configuration that contains the validator responsible for validation of redirections, must not be {@code null}. @throws IOException if an error occurred while sending the message or following the redirections @see #isRedirectionNeeded(int) """ HttpRedirectionValidator validator = requestConfig.getRedirectionValidator(); validator.notifyMessageReceived(message); User requestingUser = getUser(message); HttpMessage redirectMessage = message; int maxRedirections = client.getParams().getIntParameter(HttpClientParams.MAX_REDIRECTS, 100); for (int i = 0; i < maxRedirections && isRedirectionNeeded(redirectMessage.getResponseHeader().getStatusCode()); i++) { URI newLocation = extractRedirectLocation(redirectMessage); if (newLocation == null || !validator.isValid(newLocation)) { return; } redirectMessage = redirectMessage.cloneAll(); redirectMessage.setRequestingUser(requestingUser); redirectMessage.getRequestHeader().setURI(newLocation); if (isRequestRewriteNeeded(redirectMessage)) { redirectMessage.getRequestHeader().setMethod(HttpRequestHeader.GET); redirectMessage.getRequestHeader().setHeader(HttpHeader.CONTENT_TYPE, null); redirectMessage.getRequestHeader().setHeader(HttpHeader.CONTENT_LENGTH, null); redirectMessage.setRequestBody(""); } sendAndReceiveImpl(redirectMessage, requestConfig); validator.notifyMessageReceived(redirectMessage); // Update the response of the (original) message message.setResponseHeader(redirectMessage.getResponseHeader()); message.setResponseBody(redirectMessage.getResponseBody()); } }
java
private void followRedirections(HttpMessage message, HttpRequestConfig requestConfig) throws IOException { HttpRedirectionValidator validator = requestConfig.getRedirectionValidator(); validator.notifyMessageReceived(message); User requestingUser = getUser(message); HttpMessage redirectMessage = message; int maxRedirections = client.getParams().getIntParameter(HttpClientParams.MAX_REDIRECTS, 100); for (int i = 0; i < maxRedirections && isRedirectionNeeded(redirectMessage.getResponseHeader().getStatusCode()); i++) { URI newLocation = extractRedirectLocation(redirectMessage); if (newLocation == null || !validator.isValid(newLocation)) { return; } redirectMessage = redirectMessage.cloneAll(); redirectMessage.setRequestingUser(requestingUser); redirectMessage.getRequestHeader().setURI(newLocation); if (isRequestRewriteNeeded(redirectMessage)) { redirectMessage.getRequestHeader().setMethod(HttpRequestHeader.GET); redirectMessage.getRequestHeader().setHeader(HttpHeader.CONTENT_TYPE, null); redirectMessage.getRequestHeader().setHeader(HttpHeader.CONTENT_LENGTH, null); redirectMessage.setRequestBody(""); } sendAndReceiveImpl(redirectMessage, requestConfig); validator.notifyMessageReceived(redirectMessage); // Update the response of the (original) message message.setResponseHeader(redirectMessage.getResponseHeader()); message.setResponseBody(redirectMessage.getResponseBody()); } }
[ "private", "void", "followRedirections", "(", "HttpMessage", "message", ",", "HttpRequestConfig", "requestConfig", ")", "throws", "IOException", "{", "HttpRedirectionValidator", "validator", "=", "requestConfig", ".", "getRedirectionValidator", "(", ")", ";", "validator", ".", "notifyMessageReceived", "(", "message", ")", ";", "User", "requestingUser", "=", "getUser", "(", "message", ")", ";", "HttpMessage", "redirectMessage", "=", "message", ";", "int", "maxRedirections", "=", "client", ".", "getParams", "(", ")", ".", "getIntParameter", "(", "HttpClientParams", ".", "MAX_REDIRECTS", ",", "100", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "maxRedirections", "&&", "isRedirectionNeeded", "(", "redirectMessage", ".", "getResponseHeader", "(", ")", ".", "getStatusCode", "(", ")", ")", ";", "i", "++", ")", "{", "URI", "newLocation", "=", "extractRedirectLocation", "(", "redirectMessage", ")", ";", "if", "(", "newLocation", "==", "null", "||", "!", "validator", ".", "isValid", "(", "newLocation", ")", ")", "{", "return", ";", "}", "redirectMessage", "=", "redirectMessage", ".", "cloneAll", "(", ")", ";", "redirectMessage", ".", "setRequestingUser", "(", "requestingUser", ")", ";", "redirectMessage", ".", "getRequestHeader", "(", ")", ".", "setURI", "(", "newLocation", ")", ";", "if", "(", "isRequestRewriteNeeded", "(", "redirectMessage", ")", ")", "{", "redirectMessage", ".", "getRequestHeader", "(", ")", ".", "setMethod", "(", "HttpRequestHeader", ".", "GET", ")", ";", "redirectMessage", ".", "getRequestHeader", "(", ")", ".", "setHeader", "(", "HttpHeader", ".", "CONTENT_TYPE", ",", "null", ")", ";", "redirectMessage", ".", "getRequestHeader", "(", ")", ".", "setHeader", "(", "HttpHeader", ".", "CONTENT_LENGTH", ",", "null", ")", ";", "redirectMessage", ".", "setRequestBody", "(", "\"\"", ")", ";", "}", "sendAndReceiveImpl", "(", "redirectMessage", ",", "requestConfig", ")", ";", "validator", ".", "notifyMessageReceived", "(", "redirectMessage", ")", ";", "// Update the response of the (original) message\r", "message", ".", "setResponseHeader", "(", "redirectMessage", ".", "getResponseHeader", "(", ")", ")", ";", "message", ".", "setResponseBody", "(", "redirectMessage", ".", "getResponseBody", "(", ")", ")", ";", "}", "}" ]
Follows redirections using the response of the given {@code message}. The {@code validator} in the given request configuration will be called for each redirection received. After the call to this method the given {@code message} will have the contents of the last response received (possibly the response of a redirection). <p> The validator is notified of each message sent and received (first message and redirections followed, if any). @param message the message that will be sent, must not be {@code null} @param requestConfig the request configuration that contains the validator responsible for validation of redirections, must not be {@code null}. @throws IOException if an error occurred while sending the message or following the redirections @see #isRedirectionNeeded(int)
[ "Follows", "redirections", "using", "the", "response", "of", "the", "given", "{", "@code", "message", "}", ".", "The", "{", "@code", "validator", "}", "in", "the", "given", "request", "configuration", "will", "be", "called", "for", "each", "redirection", "received", ".", "After", "the", "call", "to", "this", "method", "the", "given", "{", "@code", "message", "}", "will", "have", "the", "contents", "of", "the", "last", "response", "received", "(", "possibly", "the", "response", "of", "a", "redirection", ")", ".", "<p", ">", "The", "validator", "is", "notified", "of", "each", "message", "sent", "and", "received", "(", "first", "message", "and", "redirections", "followed", "if", "any", ")", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/network/HttpSender.java#L947-L978
Metatavu/edelphi
edelphi/src/main/java/fi/metatavu/edelphi/utils/GoogleDriveUtils.java
GoogleDriveUtils.exportFile
public static DownloadResponse exportFile(Drive drive, String fileId, String format) throws IOException { """ Exports file in requested format @param drive drive client @param fileId id of file to be exported @param format target format @return exported data @throws IOException thrown when exporting fails unexpectedly """ try (InputStream inputStream = drive.files().export(fileId, format).executeAsInputStream()) { return new DownloadResponse(format, IOUtils.toByteArray(inputStream)); } }
java
public static DownloadResponse exportFile(Drive drive, String fileId, String format) throws IOException { try (InputStream inputStream = drive.files().export(fileId, format).executeAsInputStream()) { return new DownloadResponse(format, IOUtils.toByteArray(inputStream)); } }
[ "public", "static", "DownloadResponse", "exportFile", "(", "Drive", "drive", ",", "String", "fileId", ",", "String", "format", ")", "throws", "IOException", "{", "try", "(", "InputStream", "inputStream", "=", "drive", ".", "files", "(", ")", ".", "export", "(", "fileId", ",", "format", ")", ".", "executeAsInputStream", "(", ")", ")", "{", "return", "new", "DownloadResponse", "(", "format", ",", "IOUtils", ".", "toByteArray", "(", "inputStream", ")", ")", ";", "}", "}" ]
Exports file in requested format @param drive drive client @param fileId id of file to be exported @param format target format @return exported data @throws IOException thrown when exporting fails unexpectedly
[ "Exports", "file", "in", "requested", "format" ]
train
https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/utils/GoogleDriveUtils.java#L258-L262
aalmiray/Json-lib
src/main/java/net/sf/json/JSONObject.java
JSONObject.element
public JSONObject element( String key, double value ) { """ Put a key/double pair in the JSONObject. @param key A key string. @param value A double which is the value. @return this. @throws JSONException If the key is null or if the number is invalid. """ verifyIsNull(); Double d = new Double( value ); JSONUtils.testValidity( d ); return element( key, d ); }
java
public JSONObject element( String key, double value ) { verifyIsNull(); Double d = new Double( value ); JSONUtils.testValidity( d ); return element( key, d ); }
[ "public", "JSONObject", "element", "(", "String", "key", ",", "double", "value", ")", "{", "verifyIsNull", "(", ")", ";", "Double", "d", "=", "new", "Double", "(", "value", ")", ";", "JSONUtils", ".", "testValidity", "(", "d", ")", ";", "return", "element", "(", "key", ",", "d", ")", ";", "}" ]
Put a key/double pair in the JSONObject. @param key A key string. @param value A double which is the value. @return this. @throws JSONException If the key is null or if the number is invalid.
[ "Put", "a", "key", "/", "double", "pair", "in", "the", "JSONObject", "." ]
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONObject.java#L1612-L1617
op4j/op4j
src/main/java/org/op4j/functions/Call.java
Call.setOf
public static <R> Function<Object,Set<R>> setOf(final Type<R> resultType, final String methodName, final Object... optionalParameters) { """ <p> Abbreviation for {{@link #methodForSetOf(Type, String, Object...)}. </p> @since 1.1 @param methodName the name of the method @param optionalParameters the (optional) parameters of the method. @return the result of the method execution """ return methodForSetOf(resultType, methodName, optionalParameters); }
java
public static <R> Function<Object,Set<R>> setOf(final Type<R> resultType, final String methodName, final Object... optionalParameters) { return methodForSetOf(resultType, methodName, optionalParameters); }
[ "public", "static", "<", "R", ">", "Function", "<", "Object", ",", "Set", "<", "R", ">", ">", "setOf", "(", "final", "Type", "<", "R", ">", "resultType", ",", "final", "String", "methodName", ",", "final", "Object", "...", "optionalParameters", ")", "{", "return", "methodForSetOf", "(", "resultType", ",", "methodName", ",", "optionalParameters", ")", ";", "}" ]
<p> Abbreviation for {{@link #methodForSetOf(Type, String, Object...)}. </p> @since 1.1 @param methodName the name of the method @param optionalParameters the (optional) parameters of the method. @return the result of the method execution
[ "<p", ">", "Abbreviation", "for", "{{", "@link", "#methodForSetOf", "(", "Type", "String", "Object", "...", ")", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/Call.java#L676-L678
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/oracle/AbstractOracleQuery.java
AbstractOracleQuery.orderSiblingsBy
@WithBridgeMethods(value = OracleQuery.class, castRequired = true) public C orderSiblingsBy(Expression<?> path) { """ ORDER SIBLINGS BY preserves any ordering specified in the hierarchical query clause and then applies the order_by_clause to the siblings of the hierarchy. @param path path @return the current object """ return addFlag(Position.BEFORE_ORDER, ORDER_SIBLINGS_BY, path); }
java
@WithBridgeMethods(value = OracleQuery.class, castRequired = true) public C orderSiblingsBy(Expression<?> path) { return addFlag(Position.BEFORE_ORDER, ORDER_SIBLINGS_BY, path); }
[ "@", "WithBridgeMethods", "(", "value", "=", "OracleQuery", ".", "class", ",", "castRequired", "=", "true", ")", "public", "C", "orderSiblingsBy", "(", "Expression", "<", "?", ">", "path", ")", "{", "return", "addFlag", "(", "Position", ".", "BEFORE_ORDER", ",", "ORDER_SIBLINGS_BY", ",", "path", ")", ";", "}" ]
ORDER SIBLINGS BY preserves any ordering specified in the hierarchical query clause and then applies the order_by_clause to the siblings of the hierarchy. @param path path @return the current object
[ "ORDER", "SIBLINGS", "BY", "preserves", "any", "ordering", "specified", "in", "the", "hierarchical", "query", "clause", "and", "then", "applies", "the", "order_by_clause", "to", "the", "siblings", "of", "the", "hierarchy", "." ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/oracle/AbstractOracleQuery.java#L106-L109
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/SSOCookieHelperImpl.java
SSOCookieHelperImpl.createLogoutCookies
@Override public void createLogoutCookies(HttpServletRequest req, HttpServletResponse res) { """ /* 1) If we have the custom cookie name, then delete just the custom cookie name 2) If we have the custom cookie name but no cookie found, then will delete the default cookie name LTPAToken2 3) If jwtsso is active, clean up those cookies too. """ createLogoutCookies(req, res, true); }
java
@Override public void createLogoutCookies(HttpServletRequest req, HttpServletResponse res) { createLogoutCookies(req, res, true); }
[ "@", "Override", "public", "void", "createLogoutCookies", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ")", "{", "createLogoutCookies", "(", "req", ",", "res", ",", "true", ")", ";", "}" ]
/* 1) If we have the custom cookie name, then delete just the custom cookie name 2) If we have the custom cookie name but no cookie found, then will delete the default cookie name LTPAToken2 3) If jwtsso is active, clean up those cookies too.
[ "/", "*", "1", ")", "If", "we", "have", "the", "custom", "cookie", "name", "then", "delete", "just", "the", "custom", "cookie", "name", "2", ")", "If", "we", "have", "the", "custom", "cookie", "name", "but", "no", "cookie", "found", "then", "will", "delete", "the", "default", "cookie", "name", "LTPAToken2", "3", ")", "If", "jwtsso", "is", "active", "clean", "up", "those", "cookies", "too", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/SSOCookieHelperImpl.java#L265-L268
osmdroid/osmdroid
osmdroid-android/src/main/java/org/osmdroid/views/overlay/Polygon.java
Polygon.onSingleTapConfirmed
@Override public boolean onSingleTapConfirmed(final MotionEvent event, final MapView mapView) { """ Default listener for a single tap event on a Polygon: set the infowindow at the tapped position, and open the infowindow (if any). @param event @param mapView @return true if tapped """ Projection pj = mapView.getProjection(); GeoPoint eventPos = (GeoPoint)pj.fromPixels((int)event.getX(), (int)event.getY()); boolean tapped = contains(event); if (tapped) { if (mOnClickListener == null) { return onClickDefault(this, mapView, eventPos); } else { return mOnClickListener.onClick(this, mapView, eventPos); } } else return tapped; }
java
@Override public boolean onSingleTapConfirmed(final MotionEvent event, final MapView mapView){ Projection pj = mapView.getProjection(); GeoPoint eventPos = (GeoPoint)pj.fromPixels((int)event.getX(), (int)event.getY()); boolean tapped = contains(event); if (tapped) { if (mOnClickListener == null) { return onClickDefault(this, mapView, eventPos); } else { return mOnClickListener.onClick(this, mapView, eventPos); } } else return tapped; }
[ "@", "Override", "public", "boolean", "onSingleTapConfirmed", "(", "final", "MotionEvent", "event", ",", "final", "MapView", "mapView", ")", "{", "Projection", "pj", "=", "mapView", ".", "getProjection", "(", ")", ";", "GeoPoint", "eventPos", "=", "(", "GeoPoint", ")", "pj", ".", "fromPixels", "(", "(", "int", ")", "event", ".", "getX", "(", ")", ",", "(", "int", ")", "event", ".", "getY", "(", ")", ")", ";", "boolean", "tapped", "=", "contains", "(", "event", ")", ";", "if", "(", "tapped", ")", "{", "if", "(", "mOnClickListener", "==", "null", ")", "{", "return", "onClickDefault", "(", "this", ",", "mapView", ",", "eventPos", ")", ";", "}", "else", "{", "return", "mOnClickListener", ".", "onClick", "(", "this", ",", "mapView", ",", "eventPos", ")", ";", "}", "}", "else", "return", "tapped", ";", "}" ]
Default listener for a single tap event on a Polygon: set the infowindow at the tapped position, and open the infowindow (if any). @param event @param mapView @return true if tapped
[ "Default", "listener", "for", "a", "single", "tap", "event", "on", "a", "Polygon", ":", "set", "the", "infowindow", "at", "the", "tapped", "position", "and", "open", "the", "infowindow", "(", "if", "any", ")", "." ]
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/overlay/Polygon.java#L308-L320