repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/images/ImageUtilities.java
ImageUtilities.scaleImage
public static BufferedImage scaleImage( BufferedImage image, int newSize ) throws Exception { int imageWidth = image.getWidth(); int imageHeight = image.getHeight(); int width; int height; if (imageWidth > imageHeight) { width = newSize; height = imageHeight * width / imageWidth; } else { height = newSize; width = height * imageWidth / imageHeight; } BufferedImage resizedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics2D g = resizedImage.createGraphics(); g.drawImage(image, 0, 0, width, height, null); g.dispose(); return resizedImage; }
java
public static BufferedImage scaleImage( BufferedImage image, int newSize ) throws Exception { int imageWidth = image.getWidth(); int imageHeight = image.getHeight(); int width; int height; if (imageWidth > imageHeight) { width = newSize; height = imageHeight * width / imageWidth; } else { height = newSize; width = height * imageWidth / imageHeight; } BufferedImage resizedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics2D g = resizedImage.createGraphics(); g.drawImage(image, 0, 0, width, height, null); g.dispose(); return resizedImage; }
[ "public", "static", "BufferedImage", "scaleImage", "(", "BufferedImage", "image", ",", "int", "newSize", ")", "throws", "Exception", "{", "int", "imageWidth", "=", "image", ".", "getWidth", "(", ")", ";", "int", "imageHeight", "=", "image", ".", "getHeight", ...
Scale an image to a given size maintaining the ratio. @param image the image to scale. @param newSize the size of the new image (it will be used for the longer side). @return the scaled image. @throws Exception
[ "Scale", "an", "image", "to", "a", "given", "size", "maintaining", "the", "ratio", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/images/ImageUtilities.java#L65-L85
hankcs/HanLP
src/main/java/com/hankcs/hanlp/model/perceptron/cli/Args.java
Args.parseOrExit
public static List<String> parseOrExit(Object target, String[] args) { try { return parse(target, args); } catch (IllegalArgumentException e) { System.err.println(e.getMessage()); Args.usage(target); System.exit(1); throw e; } }
java
public static List<String> parseOrExit(Object target, String[] args) { try { return parse(target, args); } catch (IllegalArgumentException e) { System.err.println(e.getMessage()); Args.usage(target); System.exit(1); throw e; } }
[ "public", "static", "List", "<", "String", ">", "parseOrExit", "(", "Object", "target", ",", "String", "[", "]", "args", ")", "{", "try", "{", "return", "parse", "(", "target", ",", "args", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ...
A convenience method for parsing and automatically producing error messages. @param target Either an instance or a class @param args The arguments you want to parse and populate @return The list of arguments that were not consumed
[ "A", "convenience", "method", "for", "parsing", "and", "automatically", "producing", "error", "messages", "." ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/cli/Args.java#L30-L43
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/api/DataGridResourceProvider.java
DataGridResourceProvider.internalFormatMessage
protected String internalFormatMessage(String pattern, Object[] args) { /* todo: perf -- could the MessageFormat objects be cached? */ MessageFormat format = new MessageFormat(pattern); String msg = format.format(args).toString(); return msg; }
java
protected String internalFormatMessage(String pattern, Object[] args) { /* todo: perf -- could the MessageFormat objects be cached? */ MessageFormat format = new MessageFormat(pattern); String msg = format.format(args).toString(); return msg; }
[ "protected", "String", "internalFormatMessage", "(", "String", "pattern", ",", "Object", "[", "]", "args", ")", "{", "/* todo: perf -- could the MessageFormat objects be cached? */", "MessageFormat", "format", "=", "new", "MessageFormat", "(", "pattern", ")", ";", "Stri...
Internal convenience method that is used to format a message given a pattern and a set of arguments. @param pattern the pattern to format @param args the arguments to use when formatting @return the formatted string
[ "Internal", "convenience", "method", "that", "is", "used", "to", "format", "a", "message", "given", "a", "pattern", "and", "a", "set", "of", "arguments", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/api/DataGridResourceProvider.java#L127-L132
riversun/string-grabber
src/main/java/org/riversun/string_grabber/StringGrabber.java
StringGrabber.getStringEnclosedIn
public StringGrabberList getStringEnclosedIn(String startToken, String endToken) { return new StringGrabberList(getCropper().getStringEnclosedIn(sb.toString(), startToken, endToken)); }
java
public StringGrabberList getStringEnclosedIn(String startToken, String endToken) { return new StringGrabberList(getCropper().getStringEnclosedIn(sb.toString(), startToken, endToken)); }
[ "public", "StringGrabberList", "getStringEnclosedIn", "(", "String", "startToken", ",", "String", "endToken", ")", "{", "return", "new", "StringGrabberList", "(", "getCropper", "(", ")", ".", "getStringEnclosedIn", "(", "sb", ".", "toString", "(", ")", ",", "sta...
returns all of discovery that enclosed in specific tokens found in the source string @param startToken @param endToken @return
[ "returns", "all", "of", "discovery", "that", "enclosed", "in", "specific", "tokens", "found", "in", "the", "source", "string" ]
train
https://github.com/riversun/string-grabber/blob/b5aadc21fe15f50d35392188dec6ab81dcf8d464/src/main/java/org/riversun/string_grabber/StringGrabber.java#L659-L661
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/route/RouteFetcher.java
RouteFetcher.buildRequestFrom
@Nullable public NavigationRoute.Builder buildRequestFrom(Location location, RouteProgress routeProgress) { Context context = contextWeakReference.get(); if (invalid(context, location, routeProgress)) { return null; } Point origin = Point.fromLngLat(location.getLongitude(), location.getLatitude()); Double bearing = location.hasBearing() ? Float.valueOf(location.getBearing()).doubleValue() : null; RouteOptions options = routeProgress.directionsRoute().routeOptions(); NavigationRoute.Builder builder = NavigationRoute.builder(context) .accessToken(accessToken) .origin(origin, bearing, BEARING_TOLERANCE) .routeOptions(options); List<Point> remainingWaypoints = routeUtils.calculateRemainingWaypoints(routeProgress); if (remainingWaypoints == null) { Timber.e("An error occurred fetching a new route"); return null; } addDestination(remainingWaypoints, builder); addWaypoints(remainingWaypoints, builder); addWaypointNames(routeProgress, builder); addApproaches(routeProgress, builder); return builder; }
java
@Nullable public NavigationRoute.Builder buildRequestFrom(Location location, RouteProgress routeProgress) { Context context = contextWeakReference.get(); if (invalid(context, location, routeProgress)) { return null; } Point origin = Point.fromLngLat(location.getLongitude(), location.getLatitude()); Double bearing = location.hasBearing() ? Float.valueOf(location.getBearing()).doubleValue() : null; RouteOptions options = routeProgress.directionsRoute().routeOptions(); NavigationRoute.Builder builder = NavigationRoute.builder(context) .accessToken(accessToken) .origin(origin, bearing, BEARING_TOLERANCE) .routeOptions(options); List<Point> remainingWaypoints = routeUtils.calculateRemainingWaypoints(routeProgress); if (remainingWaypoints == null) { Timber.e("An error occurred fetching a new route"); return null; } addDestination(remainingWaypoints, builder); addWaypoints(remainingWaypoints, builder); addWaypointNames(routeProgress, builder); addApproaches(routeProgress, builder); return builder; }
[ "@", "Nullable", "public", "NavigationRoute", ".", "Builder", "buildRequestFrom", "(", "Location", "location", ",", "RouteProgress", "routeProgress", ")", "{", "Context", "context", "=", "contextWeakReference", ".", "get", "(", ")", ";", "if", "(", "invalid", "(...
Build a route request given the passed {@link Location} and {@link RouteProgress}. <p> Uses {@link RouteOptions#coordinates()} and {@link RouteProgress#remainingWaypoints()} to determine the amount of remaining waypoints there are along the given route. @param location current location of the device @param routeProgress for remaining waypoints along the route @return request reflecting the current progress
[ "Build", "a", "route", "request", "given", "the", "passed", "{", "@link", "Location", "}", "and", "{", "@link", "RouteProgress", "}", ".", "<p", ">", "Uses", "{", "@link", "RouteOptions#coordinates", "()", "}", "and", "{", "@link", "RouteProgress#remainingWayp...
train
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/route/RouteFetcher.java#L114-L138
alrocar/POIProxy
es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/proxy/POIProxy.java
POIProxy.getPOIs
public String getPOIs(String id, int z, int x, int y, List<Param> optionalParams) throws Exception { DescribeService describeService = getDescribeServiceByID(id); Extent e1 = TileConversor.tileOSMMercatorBounds(x, y, z); double[] minXY = ConversionCoords.reproject(e1.getMinX(), e1.getMinY(), CRSFactory.getCRS(MERCATOR_SRS), CRSFactory.getCRS(GEODETIC_SRS)); double[] maxXY = ConversionCoords.reproject(e1.getMaxX(), e1.getMaxY(), CRSFactory.getCRS(MERCATOR_SRS), CRSFactory.getCRS(GEODETIC_SRS)); POIProxyEvent beforeEvent = new POIProxyEvent(POIProxyEventEnum.BeforeBrowseZXY, describeService, e1, z, y, x, null, null, null, null, null, null); notifyListenersBeforeRequest(beforeEvent); String geoJSON = getCacheData(beforeEvent); boolean fromCache = true; if (geoJSON == null) { fromCache = false; geoJSON = getResponseAsGeoJSON(id, optionalParams, describeService, minXY[0], minXY[1], maxXY[0], maxXY[1], 0, 0, beforeEvent); } POIProxyEvent afterEvent = new POIProxyEvent(POIProxyEventEnum.AfterBrowseZXY, describeService, e1, z, y, x, null, null, null, null, geoJSON, null); if (!fromCache) { storeData(afterEvent); } notifyListenersAfterParse(afterEvent); return geoJSON; }
java
public String getPOIs(String id, int z, int x, int y, List<Param> optionalParams) throws Exception { DescribeService describeService = getDescribeServiceByID(id); Extent e1 = TileConversor.tileOSMMercatorBounds(x, y, z); double[] minXY = ConversionCoords.reproject(e1.getMinX(), e1.getMinY(), CRSFactory.getCRS(MERCATOR_SRS), CRSFactory.getCRS(GEODETIC_SRS)); double[] maxXY = ConversionCoords.reproject(e1.getMaxX(), e1.getMaxY(), CRSFactory.getCRS(MERCATOR_SRS), CRSFactory.getCRS(GEODETIC_SRS)); POIProxyEvent beforeEvent = new POIProxyEvent(POIProxyEventEnum.BeforeBrowseZXY, describeService, e1, z, y, x, null, null, null, null, null, null); notifyListenersBeforeRequest(beforeEvent); String geoJSON = getCacheData(beforeEvent); boolean fromCache = true; if (geoJSON == null) { fromCache = false; geoJSON = getResponseAsGeoJSON(id, optionalParams, describeService, minXY[0], minXY[1], maxXY[0], maxXY[1], 0, 0, beforeEvent); } POIProxyEvent afterEvent = new POIProxyEvent(POIProxyEventEnum.AfterBrowseZXY, describeService, e1, z, y, x, null, null, null, null, geoJSON, null); if (!fromCache) { storeData(afterEvent); } notifyListenersAfterParse(afterEvent); return geoJSON; }
[ "public", "String", "getPOIs", "(", "String", "id", ",", "int", "z", ",", "int", "x", ",", "int", "y", ",", "List", "<", "Param", ">", "optionalParams", ")", "throws", "Exception", "{", "DescribeService", "describeService", "=", "getDescribeServiceByID", "("...
This method is used to get the pois from a service and return a GeoJSON document with the data retrieved given a Z/X/Y tile. @param id The id of the service @param z The zoom level @param x The x tile @param y The y tile @return The GeoJSON response from the original service response
[ "This", "method", "is", "used", "to", "get", "the", "pois", "from", "a", "service", "and", "return", "a", "GeoJSON", "document", "with", "the", "data", "retrieved", "given", "a", "Z", "/", "X", "/", "Y", "tile", "." ]
train
https://github.com/alrocar/POIProxy/blob/e1dabe738a862478b2580e90d5fc4209a2997868/es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/proxy/POIProxy.java#L191-L224
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.domain_mailingList_name_PUT
public void domain_mailingList_name_PUT(String domain, String name, OvhMailingList body) throws IOException { String qPath = "/email/domain/{domain}/mailingList/{name}"; StringBuilder sb = path(qPath, domain, name); exec(qPath, "PUT", sb.toString(), body); }
java
public void domain_mailingList_name_PUT(String domain, String name, OvhMailingList body) throws IOException { String qPath = "/email/domain/{domain}/mailingList/{name}"; StringBuilder sb = path(qPath, domain, name); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "domain_mailingList_name_PUT", "(", "String", "domain", ",", "String", "name", ",", "OvhMailingList", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/{domain}/mailingList/{name}\"", ";", "StringBuilder", "sb", "=", ...
Alter this object properties REST: PUT /email/domain/{domain}/mailingList/{name} @param body [required] New object properties @param domain [required] Name of your domain name @param name [required] Name of mailing list
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L1541-L1545
roboconf/roboconf-platform
miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/autocompletion/CompletionUtils.java
CompletionUtils.findInstancesFilesToImport
public static Set<String> findInstancesFilesToImport( File appDirectory, File editedFile, String fileContent ) { File instancesDir = new File( appDirectory, Constants.PROJECT_DIR_INSTANCES ); return findFilesToImport( instancesDir, Constants.FILE_EXT_INSTANCES, editedFile, fileContent ); }
java
public static Set<String> findInstancesFilesToImport( File appDirectory, File editedFile, String fileContent ) { File instancesDir = new File( appDirectory, Constants.PROJECT_DIR_INSTANCES ); return findFilesToImport( instancesDir, Constants.FILE_EXT_INSTANCES, editedFile, fileContent ); }
[ "public", "static", "Set", "<", "String", ">", "findInstancesFilesToImport", "(", "File", "appDirectory", ",", "File", "editedFile", ",", "String", "fileContent", ")", "{", "File", "instancesDir", "=", "new", "File", "(", "appDirectory", ",", "Constants", ".", ...
Finds all the instances files that can be imported. @param appDirectory the application's directory @param editedFile the graph file that is being edited @param fileContent the file content (not null) @return a non-null set of (relative) file paths
[ "Finds", "all", "the", "instances", "files", "that", "can", "be", "imported", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/autocompletion/CompletionUtils.java#L90-L94
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/GanttChartView14.java
GanttChartView14.getFieldType
private FieldType getFieldType(byte[] data, int offset) { int fieldIndex = MPPUtility.getInt(data, offset); return FieldTypeHelper.mapTextFields(FieldTypeHelper.getInstance14(fieldIndex)); }
java
private FieldType getFieldType(byte[] data, int offset) { int fieldIndex = MPPUtility.getInt(data, offset); return FieldTypeHelper.mapTextFields(FieldTypeHelper.getInstance14(fieldIndex)); }
[ "private", "FieldType", "getFieldType", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "int", "fieldIndex", "=", "MPPUtility", ".", "getInt", "(", "data", ",", "offset", ")", ";", "return", "FieldTypeHelper", ".", "mapTextFields", "(", "Fie...
Retrieves a field type from a location in a data block. @param data data block @param offset offset into data block @return field type
[ "Retrieves", "a", "field", "type", "from", "a", "location", "in", "a", "data", "block", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/GanttChartView14.java#L127-L131
Red5/red5-io
src/main/java/org/red5/io/flv/impl/FLVWriter.java
FLVWriter.updateInfoFile
private void updateInfoFile() { try (RandomAccessFile infoFile = new RandomAccessFile(filePath + ".info", "rw")) { infoFile.writeInt(audioCodecId); infoFile.writeInt(videoCodecId); infoFile.writeInt(duration); // additional props infoFile.writeInt(audioDataSize); infoFile.writeInt(soundRate); infoFile.writeInt(soundSize); infoFile.writeInt(soundType ? 1 : 0); infoFile.writeInt(videoDataSize); } catch (Exception e) { log.warn("Exception writing flv file information data", e); } }
java
private void updateInfoFile() { try (RandomAccessFile infoFile = new RandomAccessFile(filePath + ".info", "rw")) { infoFile.writeInt(audioCodecId); infoFile.writeInt(videoCodecId); infoFile.writeInt(duration); // additional props infoFile.writeInt(audioDataSize); infoFile.writeInt(soundRate); infoFile.writeInt(soundSize); infoFile.writeInt(soundType ? 1 : 0); infoFile.writeInt(videoDataSize); } catch (Exception e) { log.warn("Exception writing flv file information data", e); } }
[ "private", "void", "updateInfoFile", "(", ")", "{", "try", "(", "RandomAccessFile", "infoFile", "=", "new", "RandomAccessFile", "(", "filePath", "+", "\".info\"", ",", "\"rw\"", ")", ")", "{", "infoFile", ".", "writeInt", "(", "audioCodecId", ")", ";", "info...
Write or update flv file information into the pre-finalization file.
[ "Write", "or", "update", "flv", "file", "information", "into", "the", "pre", "-", "finalization", "file", "." ]
train
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/flv/impl/FLVWriter.java#L1033-L1047
JM-Lab/utils-java8
src/main/java/kr/jm/utils/stats/JMStats.java
JMStats.calStats
public static Number calStats(String statsString, LongStream numberStream) { return StatsField.valueOfAlias(statsString).calStats(numberStream); }
java
public static Number calStats(String statsString, LongStream numberStream) { return StatsField.valueOfAlias(statsString).calStats(numberStream); }
[ "public", "static", "Number", "calStats", "(", "String", "statsString", ",", "LongStream", "numberStream", ")", "{", "return", "StatsField", ".", "valueOfAlias", "(", "statsString", ")", ".", "calStats", "(", "numberStream", ")", ";", "}" ]
Cal stats number. @param statsString the stats string @param numberStream the number stream @return the number
[ "Cal", "stats", "number", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/stats/JMStats.java#L75-L77
lessthanoptimal/BoofCV
examples/src/main/java/boofcv/examples/sfm/ExampleMultiviewSceneReconstruction.java
ExampleMultiviewSceneReconstruction.visualizeResults
private void visualizeResults( SceneStructureMetric structure, List<BufferedImage> colorImages ) { List<Point3D_F64> cloudXyz = new ArrayList<>(); GrowQueue_I32 cloudRgb = new GrowQueue_I32(); Point3D_F64 world = new Point3D_F64(); Point3D_F64 camera = new Point3D_F64(); Point2D_F64 pixel = new Point2D_F64(); for( int i = 0; i < structure.points.length; i++ ) { // Get 3D location SceneStructureMetric.Point p = structure.points[i]; p.get(world); // Project point into an arbitrary view for (int j = 0; j < p.views.size; j++) { int viewIdx = p.views.get(j); SePointOps_F64.transform(structure.views[viewIdx].worldToView,world,camera); int cameraIdx = structure.views[viewIdx].camera; structure.cameras[cameraIdx].model.project(camera.x,camera.y,camera.z,pixel); // Get the points color BufferedImage image = colorImages.get(viewIdx); int x = (int)pixel.x; int y = (int)pixel.y; // After optimization it might have been moved out of the camera's original FOV. // hopefully this isn't too common if( x < 0 || y < 0 || x >= image.getWidth() || y >= image.getHeight() ) continue; cloudXyz.add( world.copy() ); cloudRgb.add(image.getRGB((int)pixel.x,(int)pixel.y)); break; } } PointCloudViewer viewer = VisualizeData.createPointCloudViewer(); viewer.setTranslationStep(0.05); viewer.addCloud(cloudXyz,cloudRgb.data); viewer.setCameraHFov(UtilAngle.radian(60)); SwingUtilities.invokeLater(()->{ viewer.getComponent().setPreferredSize(new Dimension(500,500)); ShowImages.showWindow(viewer.getComponent(), "Reconstruction Points", true); }); }
java
private void visualizeResults( SceneStructureMetric structure, List<BufferedImage> colorImages ) { List<Point3D_F64> cloudXyz = new ArrayList<>(); GrowQueue_I32 cloudRgb = new GrowQueue_I32(); Point3D_F64 world = new Point3D_F64(); Point3D_F64 camera = new Point3D_F64(); Point2D_F64 pixel = new Point2D_F64(); for( int i = 0; i < structure.points.length; i++ ) { // Get 3D location SceneStructureMetric.Point p = structure.points[i]; p.get(world); // Project point into an arbitrary view for (int j = 0; j < p.views.size; j++) { int viewIdx = p.views.get(j); SePointOps_F64.transform(structure.views[viewIdx].worldToView,world,camera); int cameraIdx = structure.views[viewIdx].camera; structure.cameras[cameraIdx].model.project(camera.x,camera.y,camera.z,pixel); // Get the points color BufferedImage image = colorImages.get(viewIdx); int x = (int)pixel.x; int y = (int)pixel.y; // After optimization it might have been moved out of the camera's original FOV. // hopefully this isn't too common if( x < 0 || y < 0 || x >= image.getWidth() || y >= image.getHeight() ) continue; cloudXyz.add( world.copy() ); cloudRgb.add(image.getRGB((int)pixel.x,(int)pixel.y)); break; } } PointCloudViewer viewer = VisualizeData.createPointCloudViewer(); viewer.setTranslationStep(0.05); viewer.addCloud(cloudXyz,cloudRgb.data); viewer.setCameraHFov(UtilAngle.radian(60)); SwingUtilities.invokeLater(()->{ viewer.getComponent().setPreferredSize(new Dimension(500,500)); ShowImages.showWindow(viewer.getComponent(), "Reconstruction Points", true); }); }
[ "private", "void", "visualizeResults", "(", "SceneStructureMetric", "structure", ",", "List", "<", "BufferedImage", ">", "colorImages", ")", "{", "List", "<", "Point3D_F64", ">", "cloudXyz", "=", "new", "ArrayList", "<>", "(", ")", ";", "GrowQueue_I32", "cloudRg...
Opens a window showing the found point cloud. Points are colorized using the pixel value inside one of the input images
[ "Opens", "a", "window", "showing", "the", "found", "point", "cloud", ".", "Points", "are", "colorized", "using", "the", "pixel", "value", "inside", "one", "of", "the", "input", "images" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/sfm/ExampleMultiviewSceneReconstruction.java#L153-L198
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java
ResourcesInner.beginDeleteById
public void beginDeleteById(String resourceId, String apiVersion) { beginDeleteByIdWithServiceResponseAsync(resourceId, apiVersion).toBlocking().single().body(); }
java
public void beginDeleteById(String resourceId, String apiVersion) { beginDeleteByIdWithServiceResponseAsync(resourceId, apiVersion).toBlocking().single().body(); }
[ "public", "void", "beginDeleteById", "(", "String", "resourceId", ",", "String", "apiVersion", ")", "{", "beginDeleteByIdWithServiceResponseAsync", "(", "resourceId", ",", "apiVersion", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(",...
Deletes a resource by ID. @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} @param apiVersion The API version to use for the operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Deletes", "a", "resource", "by", "ID", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L1987-L1989
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/WidgetUtil.java
WidgetUtil.createApplet
public static HTML createApplet (String ident, String archive, String clazz, int width, int height, boolean mayScript, String[] params) { return createApplet(ident, archive, clazz, ""+width, ""+height, mayScript, params); }
java
public static HTML createApplet (String ident, String archive, String clazz, int width, int height, boolean mayScript, String[] params) { return createApplet(ident, archive, clazz, ""+width, ""+height, mayScript, params); }
[ "public", "static", "HTML", "createApplet", "(", "String", "ident", ",", "String", "archive", ",", "String", "clazz", ",", "int", "width", ",", "int", "height", ",", "boolean", "mayScript", ",", "String", "[", "]", "params", ")", "{", "return", "createAppl...
Creates the HTML to display a Java applet for the browser on which we're running.
[ "Creates", "the", "HTML", "to", "display", "a", "Java", "applet", "for", "the", "browser", "on", "which", "we", "re", "running", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/WidgetUtil.java#L219-L223
jakenjarvis/Android-OrmLiteContentProvider
ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java
MatcherController.setDefaultContentUri
public MatcherController setDefaultContentUri(String authority, String path) { if (this.lastAddTableInfo == null) { throw new IllegalStateException("There is a problem with the order of function call."); } this.lastAddTableInfo.setDefaultContentUriInfo(new ContentUriInfo(authority, path)); return this; }
java
public MatcherController setDefaultContentUri(String authority, String path) { if (this.lastAddTableInfo == null) { throw new IllegalStateException("There is a problem with the order of function call."); } this.lastAddTableInfo.setDefaultContentUriInfo(new ContentUriInfo(authority, path)); return this; }
[ "public", "MatcherController", "setDefaultContentUri", "(", "String", "authority", ",", "String", "path", ")", "{", "if", "(", "this", ".", "lastAddTableInfo", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"There is a problem with the order o...
Set the DefaultContentUri. If you did not use the DefaultContentUri annotation, you must call this method. @see com.tojc.ormlite.android.annotation.AdditionalAnnotation.DefaultContentUri @param authority @param path @return Instance of the MatcherController class.
[ "Set", "the", "DefaultContentUri", ".", "If", "you", "did", "not", "use", "the", "DefaultContentUri", "annotation", "you", "must", "call", "this", "method", "." ]
train
https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java#L144-L150
albfernandez/itext2
src/main/java/com/lowagie/text/Image.java
Image.getInstance
public static Image getInstance(PdfContentByte cb, java.awt.Image awtImage, float quality) throws BadElementException, IOException { java.awt.image.PixelGrabber pg = new java.awt.image.PixelGrabber(awtImage, 0, 0, -1, -1, true); try { pg.grabPixels(); } catch (InterruptedException e) { throw new IOException( "java.awt.Image Interrupted waiting for pixels!"); } if ((pg.getStatus() & java.awt.image.ImageObserver.ABORT) != 0) { throw new IOException("java.awt.Image fetch aborted or errored"); } int w = pg.getWidth(); int h = pg.getHeight(); PdfTemplate tp = cb.createTemplate(w, h); Graphics2D g2d = tp.createGraphics(w, h, true, quality); g2d.drawImage(awtImage, 0, 0, null); g2d.dispose(); return getInstance(tp); }
java
public static Image getInstance(PdfContentByte cb, java.awt.Image awtImage, float quality) throws BadElementException, IOException { java.awt.image.PixelGrabber pg = new java.awt.image.PixelGrabber(awtImage, 0, 0, -1, -1, true); try { pg.grabPixels(); } catch (InterruptedException e) { throw new IOException( "java.awt.Image Interrupted waiting for pixels!"); } if ((pg.getStatus() & java.awt.image.ImageObserver.ABORT) != 0) { throw new IOException("java.awt.Image fetch aborted or errored"); } int w = pg.getWidth(); int h = pg.getHeight(); PdfTemplate tp = cb.createTemplate(w, h); Graphics2D g2d = tp.createGraphics(w, h, true, quality); g2d.drawImage(awtImage, 0, 0, null); g2d.dispose(); return getInstance(tp); }
[ "public", "static", "Image", "getInstance", "(", "PdfContentByte", "cb", ",", "java", ".", "awt", ".", "Image", "awtImage", ",", "float", "quality", ")", "throws", "BadElementException", ",", "IOException", "{", "java", ".", "awt", ".", "image", ".", "PixelG...
Gets an instance of a Image from a java.awt.Image. The image is added as a JPEG with a user defined quality. @param cb the <CODE>PdfContentByte</CODE> object to which the image will be added @param awtImage the <CODE>java.awt.Image</CODE> to convert @param quality a float value between 0 and 1 @return an object of type <CODE>PdfTemplate</CODE> @throws BadElementException on error @throws IOException
[ "Gets", "an", "instance", "of", "a", "Image", "from", "a", "java", ".", "awt", ".", "Image", ".", "The", "image", "is", "added", "as", "a", "JPEG", "with", "a", "user", "defined", "quality", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Image.java#L830-L849
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java
ResourcesInner.createOrUpdate
public GenericResourceInner createOrUpdate(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).toBlocking().last().body(); }
java
public GenericResourceInner createOrUpdate(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).toBlocking().last().body(); }
[ "public", "GenericResourceInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "resourceProviderNamespace", ",", "String", "parentResourcePath", ",", "String", "resourceType", ",", "String", "resourceName", ",", "String", "apiVersion", ",", "Generi...
Creates a resource. @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. @param resourceProviderNamespace The namespace of the resource provider. @param parentResourcePath The parent resource identity. @param resourceType The resource type of the resource to create. @param resourceName The name of the resource to create. @param apiVersion The API version to use for the operation. @param parameters Parameters for creating or updating the resource. @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 GenericResourceInner object if successful.
[ "Creates", "a", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L1294-L1296
sahan/ZombieLink
zombielink/src/main/java/com/lonepulse/zombielink/response/ResponseProcessorChain.java
ResponseProcessorChain.onInitiate
@Override protected Object onInitiate(ProcessorChainLink<Object, ResponseProcessorException> root, Object... args) { return root.getProcessor().run(args); //allow any exceptions to elevate to a chain-wide failure }
java
@Override protected Object onInitiate(ProcessorChainLink<Object, ResponseProcessorException> root, Object... args) { return root.getProcessor().run(args); //allow any exceptions to elevate to a chain-wide failure }
[ "@", "Override", "protected", "Object", "onInitiate", "(", "ProcessorChainLink", "<", "Object", ",", "ResponseProcessorException", ">", "root", ",", "Object", "...", "args", ")", "{", "return", "root", ".", "getProcessor", "(", ")", ".", "run", "(", "args", ...
<p>Executed for the root link which runs the {@link HeaderProcessor}. Takes the argument array which was provided in {@link #run(Object...)} and invokes the root link, i.e. the {@link HeaderProcessor} and returns the deserialized response content passed down from the successive processor.</p> <p>See {@link AbstractResponseProcessor}.</p> {@inheritDoc}
[ "<p", ">", "Executed", "for", "the", "root", "link", "which", "runs", "the", "{", "@link", "HeaderProcessor", "}", ".", "Takes", "the", "argument", "array", "which", "was", "provided", "in", "{", "@link", "#run", "(", "Object", "...", ")", "}", "and", ...
train
https://github.com/sahan/ZombieLink/blob/a9971add56d4f6919a4a5e84c78e9220011d8982/zombielink/src/main/java/com/lonepulse/zombielink/response/ResponseProcessorChain.java#L86-L90
jayantk/jklol
src/com/jayantkrish/jklol/models/FactorGraph.java
FactorGraph.addFactor
public FactorGraph addFactor(String factorName, Factor factor) { Preconditions.checkArgument(getVariables().containsAll(factor.getVars())); Factor[] newFactors = Arrays.copyOf(factors, factors.length + 1); String[] newFactorNames = Arrays.copyOf(factorNames, factorNames.length + 1); ; newFactors[factors.length] = factor; newFactorNames[factors.length] = factorName; return new FactorGraph(variables, newFactors, newFactorNames, conditionedVariables, conditionedValues, inferenceHint); }
java
public FactorGraph addFactor(String factorName, Factor factor) { Preconditions.checkArgument(getVariables().containsAll(factor.getVars())); Factor[] newFactors = Arrays.copyOf(factors, factors.length + 1); String[] newFactorNames = Arrays.copyOf(factorNames, factorNames.length + 1); ; newFactors[factors.length] = factor; newFactorNames[factors.length] = factorName; return new FactorGraph(variables, newFactors, newFactorNames, conditionedVariables, conditionedValues, inferenceHint); }
[ "public", "FactorGraph", "addFactor", "(", "String", "factorName", ",", "Factor", "factor", ")", "{", "Preconditions", ".", "checkArgument", "(", "getVariables", "(", ")", ".", "containsAll", "(", "factor", ".", "getVars", "(", ")", ")", ")", ";", "Factor", ...
Gets a new {@code FactorGraph} identical to this one, except with an additional factor. {@code factor} must be defined over variables which are already in {@code this} graph.
[ "Gets", "a", "new", "{" ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/FactorGraph.java#L474-L484
Talend/tesb-rt-se
job/controller/src/main/java/org/talend/esb/job/controller/internal/Configuration.java
Configuration.setProperties
public void setProperties(Dictionary<?, ?> properties) throws ConfigurationException { List<String> newArgumentList = new ArrayList<String>(); if (properties != null) { for (Enumeration<?> keysEnum = properties.keys(); keysEnum.hasMoreElements();) { String key = (String) keysEnum.nextElement(); Object val = properties.get(key); if (val instanceof String) { String value = (String) val; if(PropertyValueEncryptionUtils.isEncryptedValue(value)) { StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor(); EnvironmentStringPBEConfig env = new EnvironmentStringPBEConfig(); env.setProvider(new BouncyCastleProvider()); env.setProviderName(PROVIDER_NAME); env.setAlgorithm(ALGORITHM); env.setPasswordEnvName(PASSWORD_ENV_NAME); enc.setConfig(env); val = PropertyValueEncryptionUtils.decrypt(value, enc); } String strval = convertArgument(key, (String)val); if (strval != null) { newArgumentList.add(strval); } } else { throw new ConfigurationException(key, "Value is not of type String."); } } } argumentList = newArgumentList; configAvailable.countDown(); }
java
public void setProperties(Dictionary<?, ?> properties) throws ConfigurationException { List<String> newArgumentList = new ArrayList<String>(); if (properties != null) { for (Enumeration<?> keysEnum = properties.keys(); keysEnum.hasMoreElements();) { String key = (String) keysEnum.nextElement(); Object val = properties.get(key); if (val instanceof String) { String value = (String) val; if(PropertyValueEncryptionUtils.isEncryptedValue(value)) { StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor(); EnvironmentStringPBEConfig env = new EnvironmentStringPBEConfig(); env.setProvider(new BouncyCastleProvider()); env.setProviderName(PROVIDER_NAME); env.setAlgorithm(ALGORITHM); env.setPasswordEnvName(PASSWORD_ENV_NAME); enc.setConfig(env); val = PropertyValueEncryptionUtils.decrypt(value, enc); } String strval = convertArgument(key, (String)val); if (strval != null) { newArgumentList.add(strval); } } else { throw new ConfigurationException(key, "Value is not of type String."); } } } argumentList = newArgumentList; configAvailable.countDown(); }
[ "public", "void", "setProperties", "(", "Dictionary", "<", "?", ",", "?", ">", "properties", ")", "throws", "ConfigurationException", "{", "List", "<", "String", ">", "newArgumentList", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "if", "(",...
Back this <code>Configuration</code> by the given properties from ConfigurationAdmin. @param properties the properties from ConfigurationAdmin, may be <code>null</code>. @throws ConfigurationException thrown if the property values are not of type String
[ "Back", "this", "<code", ">", "Configuration<", "/", "code", ">", "by", "the", "given", "properties", "from", "ConfigurationAdmin", "." ]
train
https://github.com/Talend/tesb-rt-se/blob/0a151a6d91ffff65ac4b5ee0c5b2c882ac28d886/job/controller/src/main/java/org/talend/esb/job/controller/internal/Configuration.java#L128-L158
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.updateRegexEntityRoleAsync
public Observable<OperationStatus> updateRegexEntityRoleAsync(UUID appId, String versionId, UUID entityId, UUID roleId, UpdateRegexEntityRoleOptionalParameter updateRegexEntityRoleOptionalParameter) { return updateRegexEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, updateRegexEntityRoleOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
java
public Observable<OperationStatus> updateRegexEntityRoleAsync(UUID appId, String versionId, UUID entityId, UUID roleId, UpdateRegexEntityRoleOptionalParameter updateRegexEntityRoleOptionalParameter) { return updateRegexEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, updateRegexEntityRoleOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatus", ">", "updateRegexEntityRoleAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ",", "UUID", "roleId", ",", "UpdateRegexEntityRoleOptionalParameter", "updateRegexEntityRoleOptionalParameter", ")",...
Update an entity role for a given entity. @param appId The application ID. @param versionId The version ID. @param entityId The entity ID. @param roleId The entity role ID. @param updateRegexEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Update", "an", "entity", "role", "for", "a", "given", "entity", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L12082-L12089
sagiegurari/fax4j
src/main/java/org/fax4j/spi/hylafax/HylaFaxJob.java
HylaFaxJob.setProperty
public void setProperty(String key,String value) { try { this.JOB.setProperty(key,value); } catch(Exception exception) { throw new FaxException("Error while setting job property.",exception); } }
java
public void setProperty(String key,String value) { try { this.JOB.setProperty(key,value); } catch(Exception exception) { throw new FaxException("Error while setting job property.",exception); } }
[ "public", "void", "setProperty", "(", "String", "key", ",", "String", "value", ")", "{", "try", "{", "this", ".", "JOB", ".", "setProperty", "(", "key", ",", "value", ")", ";", "}", "catch", "(", "Exception", "exception", ")", "{", "throw", "new", "F...
This function sets the fax job property. @param key The property key @param value The property value
[ "This", "function", "sets", "the", "fax", "job", "property", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/hylafax/HylaFaxJob.java#L308-L318
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/jdbc/AbstractBlobClob.java
AbstractBlobClob.assertPosition
protected void assertPosition(long pos, long len) throws SQLException { checkFreed(); if (pos < 1) { throw new PSQLException(GT.tr("LOB positioning offsets start at 1."), PSQLState.INVALID_PARAMETER_VALUE); } if (pos + len - 1 > Integer.MAX_VALUE) { throw new PSQLException(GT.tr("PostgreSQL LOBs can only index to: {0}", Integer.MAX_VALUE), PSQLState.INVALID_PARAMETER_VALUE); } }
java
protected void assertPosition(long pos, long len) throws SQLException { checkFreed(); if (pos < 1) { throw new PSQLException(GT.tr("LOB positioning offsets start at 1."), PSQLState.INVALID_PARAMETER_VALUE); } if (pos + len - 1 > Integer.MAX_VALUE) { throw new PSQLException(GT.tr("PostgreSQL LOBs can only index to: {0}", Integer.MAX_VALUE), PSQLState.INVALID_PARAMETER_VALUE); } }
[ "protected", "void", "assertPosition", "(", "long", "pos", ",", "long", "len", ")", "throws", "SQLException", "{", "checkFreed", "(", ")", ";", "if", "(", "pos", "<", "1", ")", "{", "throw", "new", "PSQLException", "(", "GT", ".", "tr", "(", "\"LOB pos...
Throws an exception if the pos value exceeds the max value by which the large object API can index. @param pos Position to write at. @param len number of bytes to write. @throws SQLException if something goes wrong
[ "Throws", "an", "exception", "if", "the", "pos", "value", "exceeds", "the", "max", "value", "by", "which", "the", "large", "object", "API", "can", "index", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/AbstractBlobClob.java#L224-L234
snowflakedb/snowflake-jdbc
src/main/java/net/snowflake/client/loader/StreamLoader.java
StreamLoader.resetOperation
@Override public void resetOperation(Operation op) { LOGGER.debug("Reset Loader"); if (op.equals(_op)) { //no-op return; } LOGGER.debug("Operation is changing from {} to {}", _op, op); _op = op; if (_stage != null) { try { queuePut(_stage); } catch (InterruptedException ex) { LOGGER.error(_stage.getId(), ex); } } _stage = new BufferStage(this, _op, _csvFileBucketSize, _csvFileSize); }
java
@Override public void resetOperation(Operation op) { LOGGER.debug("Reset Loader"); if (op.equals(_op)) { //no-op return; } LOGGER.debug("Operation is changing from {} to {}", _op, op); _op = op; if (_stage != null) { try { queuePut(_stage); } catch (InterruptedException ex) { LOGGER.error(_stage.getId(), ex); } } _stage = new BufferStage(this, _op, _csvFileBucketSize, _csvFileSize); }
[ "@", "Override", "public", "void", "resetOperation", "(", "Operation", "op", ")", "{", "LOGGER", ".", "debug", "(", "\"Reset Loader\"", ")", ";", "if", "(", "op", ".", "equals", "(", "_op", ")", ")", "{", "//no-op", "return", ";", "}", "LOGGER", ".", ...
If operation changes, existing stage needs to be scheduled for processing.
[ "If", "operation", "changes", "existing", "stage", "needs", "to", "be", "scheduled", "for", "processing", "." ]
train
https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/loader/StreamLoader.java#L824-L852
btrplace/scheduler
json/src/main/java/org/btrplace/json/JSONs.java
JSONs.requiredVMs
public static List<VM> requiredVMs(Model mo, JSONObject o, String id) throws JSONConverterException { checkKeys(o, id); Object x = o.get(id); if (!(x instanceof JSONArray)) { throw new JSONConverterException("integers expected at key '" + id + "'"); } return vmsFromJSON(mo, (JSONArray) x); }
java
public static List<VM> requiredVMs(Model mo, JSONObject o, String id) throws JSONConverterException { checkKeys(o, id); Object x = o.get(id); if (!(x instanceof JSONArray)) { throw new JSONConverterException("integers expected at key '" + id + "'"); } return vmsFromJSON(mo, (JSONArray) x); }
[ "public", "static", "List", "<", "VM", ">", "requiredVMs", "(", "Model", "mo", ",", "JSONObject", "o", ",", "String", "id", ")", "throws", "JSONConverterException", "{", "checkKeys", "(", "o", ",", "id", ")", ";", "Object", "x", "=", "o", ".", "get", ...
Read an expected list of VMs. @param mo the associated model to browse @param o the object to parse @param id the key in the map that points to the list @return the parsed list @throws JSONConverterException if the key does not point to a list of VM identifiers
[ "Read", "an", "expected", "list", "of", "VMs", "." ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L263-L270
OpenBEL/openbel-framework
org.openbel.framework.core/src/main/java/org/openbel/framework/core/protonetwork/ProtoNetworkMerger.java
ProtoNetworkMerger.remapEdges
private void remapEdges(ProtoNetwork protoNetwork1, ProtoNetwork protoNetwork2, int documentId, Map<Integer, Integer> termMap, int newStatementIndex, List<TableProtoEdge> edges, Set<Integer> edgeIndices) { ProtoNodeTable nt = protoNetwork2.getProtoNodeTable(); Map<Integer, Integer> nodeTermIndex = nt.getNodeTermIndex(); TableProtoEdge[] remappedEdges = new TableProtoEdge[edgeIndices.size()]; int i = 0; for (Integer edgeIndex : edgeIndices) { TableProtoEdge edge = edges.get(edgeIndex); int sourceBefore = edge.getSource(); int targetBefore = edge.getTarget(); Integer sourceTerm = nodeTermIndex.get(sourceBefore); Integer targetTerm = nodeTermIndex.get(targetBefore); Integer newSource = termMap.get(sourceTerm); if (newSource == null) { newSource = mergeTerm(sourceTerm, protoNetwork1, protoNetwork2, documentId, termMap); } Integer newTarget = termMap.get(targetTerm); if (newTarget == null) { newTarget = mergeTerm(targetTerm, protoNetwork1, protoNetwork2, documentId, termMap); } remappedEdges[i++] = new TableProtoEdge(newSource, edge.getRel(), newTarget); } ProtoEdgeTable edgeTable = protoNetwork1.getProtoEdgeTable(); edgeTable.addEdges(newStatementIndex, remappedEdges); }
java
private void remapEdges(ProtoNetwork protoNetwork1, ProtoNetwork protoNetwork2, int documentId, Map<Integer, Integer> termMap, int newStatementIndex, List<TableProtoEdge> edges, Set<Integer> edgeIndices) { ProtoNodeTable nt = protoNetwork2.getProtoNodeTable(); Map<Integer, Integer> nodeTermIndex = nt.getNodeTermIndex(); TableProtoEdge[] remappedEdges = new TableProtoEdge[edgeIndices.size()]; int i = 0; for (Integer edgeIndex : edgeIndices) { TableProtoEdge edge = edges.get(edgeIndex); int sourceBefore = edge.getSource(); int targetBefore = edge.getTarget(); Integer sourceTerm = nodeTermIndex.get(sourceBefore); Integer targetTerm = nodeTermIndex.get(targetBefore); Integer newSource = termMap.get(sourceTerm); if (newSource == null) { newSource = mergeTerm(sourceTerm, protoNetwork1, protoNetwork2, documentId, termMap); } Integer newTarget = termMap.get(targetTerm); if (newTarget == null) { newTarget = mergeTerm(targetTerm, protoNetwork1, protoNetwork2, documentId, termMap); } remappedEdges[i++] = new TableProtoEdge(newSource, edge.getRel(), newTarget); } ProtoEdgeTable edgeTable = protoNetwork1.getProtoEdgeTable(); edgeTable.addEdges(newStatementIndex, remappedEdges); }
[ "private", "void", "remapEdges", "(", "ProtoNetwork", "protoNetwork1", ",", "ProtoNetwork", "protoNetwork2", ",", "int", "documentId", ",", "Map", "<", "Integer", ",", "Integer", ">", "termMap", ",", "int", "newStatementIndex", ",", "List", "<", "TableProtoEdge", ...
Remaps {@link TableProtoEdge proto edges} for a {@link TableStatement statement}. A new statement index is created from a merge which requires the old {@link TableProtoEdge proto edges} to be associated with it. @see https://github.com/OpenBEL/openbel-framework/issues/49 @param protoNetwork1 {@link ProtoNetwork}; merge into @param protoNetwork2 {@link ProtoNetwork}; merge from @param documentId {@code int}; bel document id @param termMap {@link Map} of old term id to new proto node id @param newStatementIndex {@code int} new merged statement id @param edges {@link List}; merging statement's {@link TableProtoEdge edges} @param edgeIndices {@link Set}; set of old statement's edge indices
[ "Remaps", "{", "@link", "TableProtoEdge", "proto", "edges", "}", "for", "a", "{", "@link", "TableStatement", "statement", "}", ".", "A", "new", "statement", "index", "is", "created", "from", "a", "merge", "which", "requires", "the", "old", "{", "@link", "T...
train
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.core/src/main/java/org/openbel/framework/core/protonetwork/ProtoNetworkMerger.java#L299-L332
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
FSNamesystem.getBlockLocations
public LocatedBlocks getBlockLocations(String src, long offset, long length) throws IOException { INode[] inodes = dir.getExistingPathINodes(src); return getBlockLocations(src, inodes[inodes.length-1], offset, length, false, BlockMetaInfoType.NONE); }
java
public LocatedBlocks getBlockLocations(String src, long offset, long length) throws IOException { INode[] inodes = dir.getExistingPathINodes(src); return getBlockLocations(src, inodes[inodes.length-1], offset, length, false, BlockMetaInfoType.NONE); }
[ "public", "LocatedBlocks", "getBlockLocations", "(", "String", "src", ",", "long", "offset", ",", "long", "length", ")", "throws", "IOException", "{", "INode", "[", "]", "inodes", "=", "dir", ".", "getExistingPathINodes", "(", "src", ")", ";", "return", "get...
Get block locations within the specified range. @see ClientProtocol#getBlockLocations(String, long, long)
[ "Get", "block", "locations", "within", "the", "specified", "range", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L1396-L1400
dkpro/dkpro-statistics
dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/coding/CodingAnnotationStudy.java
CodingAnnotationStudy.addMultipleItems
public void addMultipleItems(int times, final Object... values) { for (int i = 0; i < times; i++) { addItemAsArray(values); } }
java
public void addMultipleItems(int times, final Object... values) { for (int i = 0; i < times; i++) { addItemAsArray(values); } }
[ "public", "void", "addMultipleItems", "(", "int", "times", ",", "final", "Object", "...", "values", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "times", ";", "i", "++", ")", "{", "addItemAsArray", "(", "values", ")", ";", "}", "}" ]
Shorthand for invoking {@link #addItem(Object...)} with the same parameters multiple times. This method is useful for modeling annotation data based on a contingency table.
[ "Shorthand", "for", "invoking", "{" ]
train
https://github.com/dkpro/dkpro-statistics/blob/0b0e93dc49223984964411cbc6df420ba796a8cb/dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/coding/CodingAnnotationStudy.java#L117-L121
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java
JobsImpl.addAsync
public Observable<Void> addAsync(JobAddParameter job, JobAddOptions jobAddOptions) { return addWithServiceResponseAsync(job, jobAddOptions).map(new Func1<ServiceResponseWithHeaders<Void, JobAddHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, JobAddHeaders> response) { return response.body(); } }); }
java
public Observable<Void> addAsync(JobAddParameter job, JobAddOptions jobAddOptions) { return addWithServiceResponseAsync(job, jobAddOptions).map(new Func1<ServiceResponseWithHeaders<Void, JobAddHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, JobAddHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "addAsync", "(", "JobAddParameter", "job", ",", "JobAddOptions", "jobAddOptions", ")", "{", "return", "addWithServiceResponseAsync", "(", "job", ",", "jobAddOptions", ")", ".", "map", "(", "new", "Func1", "<", "ServiceRe...
Adds a job to the specified account. The Batch service supports two ways to control the work done as part of a job. In the first approach, the user specifies a Job Manager task. The Batch service launches this task when it is ready to start the job. The Job Manager task controls all other tasks that run under this job, by using the Task APIs. In the second approach, the user directly controls the execution of tasks under an active job, by using the Task APIs. Also note: when naming jobs, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. @param job The job to be added. @param jobAddOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful.
[ "Adds", "a", "job", "to", "the", "specified", "account", ".", "The", "Batch", "service", "supports", "two", "ways", "to", "control", "the", "work", "done", "as", "part", "of", "a", "job", ".", "In", "the", "first", "approach", "the", "user", "specifies",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L2146-L2153
RestComm/sip-servlets
containers/sip-servlets-as10/src/main/java/org/mobicents/servlet/sip/startup/ConvergedServletContextImpl.java
ConvergedServletContextImpl.executeMethod
private Object executeMethod(final Method method, final ServletContextImpl context, final Object[] params) throws PrivilegedActionException, IllegalAccessException, InvocationTargetException { if (SecurityUtil.isPackageProtectionEnabled()) { return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { public Object run() throws IllegalAccessException, InvocationTargetException { return method.invoke(context, params); } }); } else { return method.invoke(context, params); } }
java
private Object executeMethod(final Method method, final ServletContextImpl context, final Object[] params) throws PrivilegedActionException, IllegalAccessException, InvocationTargetException { if (SecurityUtil.isPackageProtectionEnabled()) { return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { public Object run() throws IllegalAccessException, InvocationTargetException { return method.invoke(context, params); } }); } else { return method.invoke(context, params); } }
[ "private", "Object", "executeMethod", "(", "final", "Method", "method", ",", "final", "ServletContextImpl", "context", ",", "final", "Object", "[", "]", "params", ")", "throws", "PrivilegedActionException", ",", "IllegalAccessException", ",", "InvocationTargetException"...
Executes the method of the specified <code>ApplicationContext</code> @param method The method object to be invoked. @param context The AppliationContext object on which the method will be invoked @param params The arguments passed to the called method.
[ "Executes", "the", "method", "of", "the", "specified", "<code", ">", "ApplicationContext<", "/", "code", ">" ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/containers/sip-servlets-as10/src/main/java/org/mobicents/servlet/sip/startup/ConvergedServletContextImpl.java#L859-L871
wirecardBrasil/moip-sdk-java
src/main/java/br/com/moip/api/request/RequestMaker.java
RequestMaker.logHeaders
private void logHeaders(Set<Map.Entry<String, List<String>>> entries) { for (Map.Entry<String, List<String>> header : entries) { if (header.getKey() != null) { LOGGER.debug("{}: {}", header.getKey(), header.getValue()); } } }
java
private void logHeaders(Set<Map.Entry<String, List<String>>> entries) { for (Map.Entry<String, List<String>> header : entries) { if (header.getKey() != null) { LOGGER.debug("{}: {}", header.getKey(), header.getValue()); } } }
[ "private", "void", "logHeaders", "(", "Set", "<", "Map", ".", "Entry", "<", "String", ",", "List", "<", "String", ">", ">", ">", "entries", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "List", "<", "String", ">", ">", "header", ...
This method is used to populate an {@code Map.Entry} with passed keys and values to charge the debug logger. @param entries {@code Map.Entry<String, List<String>>}
[ "This", "method", "is", "used", "to", "populate", "an", "{", "@code", "Map", ".", "Entry", "}", "with", "passed", "keys", "and", "values", "to", "charge", "the", "debug", "logger", "." ]
train
https://github.com/wirecardBrasil/moip-sdk-java/blob/5bee84fa9457d7becfd18954bf5105037f49829c/src/main/java/br/com/moip/api/request/RequestMaker.java#L265-L271
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiMetadata.java
BoxApiMetadata.getUpdateMetadataRequest
@Deprecated public BoxRequestsMetadata.UpdateFileMetadata getUpdateMetadataRequest(String id, String scope, String template) { return getUpdateFileMetadataRequest(id, scope, template); }
java
@Deprecated public BoxRequestsMetadata.UpdateFileMetadata getUpdateMetadataRequest(String id, String scope, String template) { return getUpdateFileMetadataRequest(id, scope, template); }
[ "@", "Deprecated", "public", "BoxRequestsMetadata", ".", "UpdateFileMetadata", "getUpdateMetadataRequest", "(", "String", "id", ",", "String", "scope", ",", "String", "template", ")", "{", "return", "getUpdateFileMetadataRequest", "(", "id", ",", "scope", ",", "temp...
Gets a request that updates the metadata for a specific template on a file Deprecated: Use getUpdateFileMetadataRequest or getUpdateFolderMetadataRequest instead. @param id id of the file to retrieve metadata for @param scope currently only global and enterprise scopes are supported @param template metadata template to use @return request to update metadata on a file
[ "Gets", "a", "request", "that", "updates", "the", "metadata", "for", "a", "specific", "template", "on", "a", "file", "Deprecated", ":", "Use", "getUpdateFileMetadataRequest", "or", "getUpdateFolderMetadataRequest", "instead", "." ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiMetadata.java#L215-L218
alkacon/opencms-core
src-setup/org/opencms/setup/CmsSetupBean.java
CmsSetupBean.isChecked
public String isChecked(String value1, String value2) { if ((value1 == null) || (value2 == null)) { return ""; } if (value1.trim().equalsIgnoreCase(value2.trim())) { return "checked"; } return ""; }
java
public String isChecked(String value1, String value2) { if ((value1 == null) || (value2 == null)) { return ""; } if (value1.trim().equalsIgnoreCase(value2.trim())) { return "checked"; } return ""; }
[ "public", "String", "isChecked", "(", "String", "value1", ",", "String", "value2", ")", "{", "if", "(", "(", "value1", "==", "null", ")", "||", "(", "value2", "==", "null", ")", ")", "{", "return", "\"\"", ";", "}", "if", "(", "value1", ".", "trim"...
Over simplistic helper to compare two strings to check radio buttons. @param value1 the first value @param value2 the second value @return "checked" if both values are equal, the empty String "" otherwise
[ "Over", "simplistic", "helper", "to", "compare", "two", "strings", "to", "check", "radio", "buttons", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupBean.java#L1393-L1404
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/ValidationObjUtil.java
ValidationObjUtil.objectDeepCopyWithWhiteList
public static <T> T objectDeepCopyWithWhiteList(Object from, Object to, String... copyFields) { return (T) to.getClass().cast(objDeepCopy(from, to, copyFields)); }
java
public static <T> T objectDeepCopyWithWhiteList(Object from, Object to, String... copyFields) { return (T) to.getClass().cast(objDeepCopy(from, to, copyFields)); }
[ "public", "static", "<", "T", ">", "T", "objectDeepCopyWithWhiteList", "(", "Object", "from", ",", "Object", "to", ",", "String", "...", "copyFields", ")", "{", "return", "(", "T", ")", "to", ".", "getClass", "(", ")", ".", "cast", "(", "objDeepCopy", ...
Object deep copy with white list t. @param <T> the type parameter @param from the from @param to the to @param copyFields the copy fields @return the t
[ "Object", "deep", "copy", "with", "white", "list", "t", "." ]
train
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/ValidationObjUtil.java#L360-L362
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/extension/std/XLifecycleExtension.java
XLifecycleExtension.assignTransition
public void assignTransition(XEvent event, String transition) { if (transition != null && transition.trim().length() > 0) { XAttributeLiteral transAttr = (XAttributeLiteral) ATTR_TRANSITION .clone(); transAttr.setValue(transition.trim()); event.getAttributes().put(KEY_TRANSITION, transAttr); } }
java
public void assignTransition(XEvent event, String transition) { if (transition != null && transition.trim().length() > 0) { XAttributeLiteral transAttr = (XAttributeLiteral) ATTR_TRANSITION .clone(); transAttr.setValue(transition.trim()); event.getAttributes().put(KEY_TRANSITION, transAttr); } }
[ "public", "void", "assignTransition", "(", "XEvent", "event", ",", "String", "transition", ")", "{", "if", "(", "transition", "!=", "null", "&&", "transition", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "XAttributeLiteral", "tran...
Assigns a lifecycle transition string to the given event. @param event Event to be tagged. @param transition Lifecycle transition string to be assigned.
[ "Assigns", "a", "lifecycle", "transition", "string", "to", "the", "given", "event", "." ]
train
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/std/XLifecycleExtension.java#L311-L318
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
PgResultSet.readDoubleValue
private double readDoubleValue(byte[] bytes, int oid, String targetType) throws PSQLException { // currently implemented binary encoded fields switch (oid) { case Oid.INT2: return ByteConverter.int2(bytes, 0); case Oid.INT4: return ByteConverter.int4(bytes, 0); case Oid.INT8: // might not fit but there still should be no overflow checking return ByteConverter.int8(bytes, 0); case Oid.FLOAT4: return ByteConverter.float4(bytes, 0); case Oid.FLOAT8: return ByteConverter.float8(bytes, 0); } throw new PSQLException(GT.tr("Cannot convert the column of type {0} to requested type {1}.", Oid.toString(oid), targetType), PSQLState.DATA_TYPE_MISMATCH); }
java
private double readDoubleValue(byte[] bytes, int oid, String targetType) throws PSQLException { // currently implemented binary encoded fields switch (oid) { case Oid.INT2: return ByteConverter.int2(bytes, 0); case Oid.INT4: return ByteConverter.int4(bytes, 0); case Oid.INT8: // might not fit but there still should be no overflow checking return ByteConverter.int8(bytes, 0); case Oid.FLOAT4: return ByteConverter.float4(bytes, 0); case Oid.FLOAT8: return ByteConverter.float8(bytes, 0); } throw new PSQLException(GT.tr("Cannot convert the column of type {0} to requested type {1}.", Oid.toString(oid), targetType), PSQLState.DATA_TYPE_MISMATCH); }
[ "private", "double", "readDoubleValue", "(", "byte", "[", "]", "bytes", ",", "int", "oid", ",", "String", "targetType", ")", "throws", "PSQLException", "{", "// currently implemented binary encoded fields", "switch", "(", "oid", ")", "{", "case", "Oid", ".", "IN...
Converts any numeric binary field to double value. This method does no overflow checking. @param bytes The bytes of the numeric field. @param oid The oid of the field. @param targetType The target type. Used for error reporting. @return The value as double. @throws PSQLException If the field type is not supported numeric type.
[ "Converts", "any", "numeric", "binary", "field", "to", "double", "value", ".", "This", "method", "does", "no", "overflow", "checking", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java#L2952-L2969
liferay/com-liferay-commerce
commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationAttachmentPersistenceImpl.java
CommerceNotificationAttachmentPersistenceImpl.countByUUID_G
@Override public int countByUUID_G(String uuid, long groupId) { FinderPath finderPath = FINDER_PATH_COUNT_BY_UUID_G; Object[] finderArgs = new Object[] { uuid, groupId }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_COMMERCENOTIFICATIONATTACHMENT_WHERE); boolean bindUuid = false; if (uuid == null) { query.append(_FINDER_COLUMN_UUID_G_UUID_1); } else if (uuid.equals("")) { query.append(_FINDER_COLUMN_UUID_G_UUID_3); } else { bindUuid = true; query.append(_FINDER_COLUMN_UUID_G_UUID_2); } query.append(_FINDER_COLUMN_UUID_G_GROUPID_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindUuid) { qPos.add(uuid); } qPos.add(groupId); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
java
@Override public int countByUUID_G(String uuid, long groupId) { FinderPath finderPath = FINDER_PATH_COUNT_BY_UUID_G; Object[] finderArgs = new Object[] { uuid, groupId }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_COMMERCENOTIFICATIONATTACHMENT_WHERE); boolean bindUuid = false; if (uuid == null) { query.append(_FINDER_COLUMN_UUID_G_UUID_1); } else if (uuid.equals("")) { query.append(_FINDER_COLUMN_UUID_G_UUID_3); } else { bindUuid = true; query.append(_FINDER_COLUMN_UUID_G_UUID_2); } query.append(_FINDER_COLUMN_UUID_G_GROUPID_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindUuid) { qPos.add(uuid); } qPos.add(groupId); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
[ "@", "Override", "public", "int", "countByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "{", "FinderPath", "finderPath", "=", "FINDER_PATH_COUNT_BY_UUID_G", ";", "Object", "[", "]", "finderArgs", "=", "new", "Object", "[", "]", "{", "uuid", ",...
Returns the number of commerce notification attachments where uuid = &#63; and groupId = &#63;. @param uuid the uuid @param groupId the group ID @return the number of matching commerce notification attachments
[ "Returns", "the", "number", "of", "commerce", "notification", "attachments", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationAttachmentPersistenceImpl.java#L845-L906
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/Router.java
Router.route
public RouteResult<T> route(HttpMethod method, String path) { return route(method, path, Collections.emptyMap()); }
java
public RouteResult<T> route(HttpMethod method, String path) { return route(method, path, Collections.emptyMap()); }
[ "public", "RouteResult", "<", "T", ">", "route", "(", "HttpMethod", "method", ",", "String", "path", ")", "{", "return", "route", "(", "method", ",", "path", ",", "Collections", ".", "emptyMap", "(", ")", ")", ";", "}" ]
If there's no match, returns the result with {@link #notFound(Object) notFound} as the target if it is set, otherwise returns {@code null}.
[ "If", "there", "s", "no", "match", "returns", "the", "result", "with", "{" ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/Router.java#L218-L220
eurekaclinical/protempa
protempa-framework/src/main/java/org/protempa/JBossRuleCreator.java
JBossRuleCreator.visit
@Override public void visit(LowLevelAbstractionDefinition def) throws ProtempaException { LOGGER.log(Level.FINER, "Creating rule for {0}", def); try { /* * If there are no value definitions defined, we might still have an * inverseIsA relationship with another low-level abstraction * definition. */ if (!def.getValueDefinitions().isEmpty()) { Rule rule = new Rule(def.getId()); Pattern sourceP = new Pattern(2, 1, PRIM_PARAM_OT, ""); Set<String> abstractedFrom = def.getAbstractedFrom(); String[] abstractedFromArr = abstractedFrom.toArray(new String[abstractedFrom.size()]); Set<String> subtrees = this.cache.collectPropIdDescendantsUsingInverseIsA(abstractedFromArr); sourceP.addConstraint(new PredicateConstraint( new PropositionPredicateExpression(subtrees))); Pattern resultP = new Pattern(1, 1, ARRAY_LIST_OT, "result"); resultP.setSource(new Collect(sourceP, new Pattern(1, 1, ARRAY_LIST_OT, "result"))); resultP.addConstraint(new PredicateConstraint( new CollectionSizeExpression(1))); rule.addPattern(resultP); String contextId = def.getContextId(); if (contextId != null) { Pattern sourceP2 = new Pattern(4, 1, CONTEXT_OT, "context"); sourceP2.addConstraint(new PredicateConstraint( new PropositionPredicateExpression(contextId))); Pattern resultP2 = new Pattern(3, 1, ARRAY_LIST_OT, "result2"); resultP2.setSource(new Collect(sourceP2, new Pattern(3, 1, ARRAY_LIST_OT, "result"))); resultP2.addConstraint(new PredicateConstraint( new CollectionSizeExpression(1))); rule.addPattern(resultP2); } Algorithm algo = this.algorithms.get(def); rule.setConsequence(new LowLevelAbstractionConsequence(def, algo, this.derivationsBuilder)); rule.setSalience(TWO_SALIENCE); this.ruleToAbstractionDefinition.put(rule, def); rules.add(rule); } } catch (InvalidRuleException e) { throw new AssertionError(e.getClass().getName() + ": " + e.getMessage()); } }
java
@Override public void visit(LowLevelAbstractionDefinition def) throws ProtempaException { LOGGER.log(Level.FINER, "Creating rule for {0}", def); try { /* * If there are no value definitions defined, we might still have an * inverseIsA relationship with another low-level abstraction * definition. */ if (!def.getValueDefinitions().isEmpty()) { Rule rule = new Rule(def.getId()); Pattern sourceP = new Pattern(2, 1, PRIM_PARAM_OT, ""); Set<String> abstractedFrom = def.getAbstractedFrom(); String[] abstractedFromArr = abstractedFrom.toArray(new String[abstractedFrom.size()]); Set<String> subtrees = this.cache.collectPropIdDescendantsUsingInverseIsA(abstractedFromArr); sourceP.addConstraint(new PredicateConstraint( new PropositionPredicateExpression(subtrees))); Pattern resultP = new Pattern(1, 1, ARRAY_LIST_OT, "result"); resultP.setSource(new Collect(sourceP, new Pattern(1, 1, ARRAY_LIST_OT, "result"))); resultP.addConstraint(new PredicateConstraint( new CollectionSizeExpression(1))); rule.addPattern(resultP); String contextId = def.getContextId(); if (contextId != null) { Pattern sourceP2 = new Pattern(4, 1, CONTEXT_OT, "context"); sourceP2.addConstraint(new PredicateConstraint( new PropositionPredicateExpression(contextId))); Pattern resultP2 = new Pattern(3, 1, ARRAY_LIST_OT, "result2"); resultP2.setSource(new Collect(sourceP2, new Pattern(3, 1, ARRAY_LIST_OT, "result"))); resultP2.addConstraint(new PredicateConstraint( new CollectionSizeExpression(1))); rule.addPattern(resultP2); } Algorithm algo = this.algorithms.get(def); rule.setConsequence(new LowLevelAbstractionConsequence(def, algo, this.derivationsBuilder)); rule.setSalience(TWO_SALIENCE); this.ruleToAbstractionDefinition.put(rule, def); rules.add(rule); } } catch (InvalidRuleException e) { throw new AssertionError(e.getClass().getName() + ": " + e.getMessage()); } }
[ "@", "Override", "public", "void", "visit", "(", "LowLevelAbstractionDefinition", "def", ")", "throws", "ProtempaException", "{", "LOGGER", ".", "log", "(", "Level", ".", "FINER", ",", "\"Creating rule for {0}\"", ",", "def", ")", ";", "try", "{", "/*\n ...
Translates a low-level abstraction definition into rules. @param def a {@link LowLevelAbstractionDefinition}. Cannot be <code>null</code>. @throws KnowledgeSourceReadException if an error occurs accessing the knowledge source during rule creation.
[ "Translates", "a", "low", "-", "level", "abstraction", "definition", "into", "rules", "." ]
train
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/JBossRuleCreator.java#L160-L209
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/RoaringBitmap.java
RoaringBitmap.flip
public static RoaringBitmap flip(RoaringBitmap bm, final long rangeStart, final long rangeEnd) { rangeSanityCheck(rangeStart, rangeEnd); if (rangeStart >= rangeEnd) { return bm.clone(); } RoaringBitmap answer = new RoaringBitmap(); final int hbStart = Util.toIntUnsigned(Util.highbits(rangeStart)); final int lbStart = Util.toIntUnsigned(Util.lowbits(rangeStart)); final int hbLast = Util.toIntUnsigned(Util.highbits(rangeEnd - 1)); final int lbLast = Util.toIntUnsigned(Util.lowbits(rangeEnd - 1)); // copy the containers before the active area answer.highLowContainer.appendCopiesUntil(bm.highLowContainer, (short) hbStart); for (int hb = hbStart; hb <= hbLast; ++hb) { final int containerStart = (hb == hbStart) ? lbStart : 0; final int containerLast = (hb == hbLast) ? lbLast : Util.maxLowBitAsInteger(); final int i = bm.highLowContainer.getIndex((short) hb); final int j = answer.highLowContainer.getIndex((short) hb); assert j < 0; if (i >= 0) { Container c = bm.highLowContainer.getContainerAtIndex(i).not(containerStart, containerLast + 1); if (!c.isEmpty()) { answer.highLowContainer.insertNewKeyValueAt(-j - 1, (short) hb, c); } } else { // *think* the range of ones must never be // empty. answer.highLowContainer.insertNewKeyValueAt(-j - 1, (short) hb, Container.rangeOfOnes(containerStart, containerLast + 1)); } } // copy the containers after the active area. answer.highLowContainer.appendCopiesAfter(bm.highLowContainer, (short) hbLast); return answer; }
java
public static RoaringBitmap flip(RoaringBitmap bm, final long rangeStart, final long rangeEnd) { rangeSanityCheck(rangeStart, rangeEnd); if (rangeStart >= rangeEnd) { return bm.clone(); } RoaringBitmap answer = new RoaringBitmap(); final int hbStart = Util.toIntUnsigned(Util.highbits(rangeStart)); final int lbStart = Util.toIntUnsigned(Util.lowbits(rangeStart)); final int hbLast = Util.toIntUnsigned(Util.highbits(rangeEnd - 1)); final int lbLast = Util.toIntUnsigned(Util.lowbits(rangeEnd - 1)); // copy the containers before the active area answer.highLowContainer.appendCopiesUntil(bm.highLowContainer, (short) hbStart); for (int hb = hbStart; hb <= hbLast; ++hb) { final int containerStart = (hb == hbStart) ? lbStart : 0; final int containerLast = (hb == hbLast) ? lbLast : Util.maxLowBitAsInteger(); final int i = bm.highLowContainer.getIndex((short) hb); final int j = answer.highLowContainer.getIndex((short) hb); assert j < 0; if (i >= 0) { Container c = bm.highLowContainer.getContainerAtIndex(i).not(containerStart, containerLast + 1); if (!c.isEmpty()) { answer.highLowContainer.insertNewKeyValueAt(-j - 1, (short) hb, c); } } else { // *think* the range of ones must never be // empty. answer.highLowContainer.insertNewKeyValueAt(-j - 1, (short) hb, Container.rangeOfOnes(containerStart, containerLast + 1)); } } // copy the containers after the active area. answer.highLowContainer.appendCopiesAfter(bm.highLowContainer, (short) hbLast); return answer; }
[ "public", "static", "RoaringBitmap", "flip", "(", "RoaringBitmap", "bm", ",", "final", "long", "rangeStart", ",", "final", "long", "rangeEnd", ")", "{", "rangeSanityCheck", "(", "rangeStart", ",", "rangeEnd", ")", ";", "if", "(", "rangeStart", ">=", "rangeEnd"...
Complements the bits in the given range, from rangeStart (inclusive) rangeEnd (exclusive). The given bitmap is unchanged. @param bm bitmap being negated @param rangeStart inclusive beginning of range, in [0, 0xffffffff] @param rangeEnd exclusive ending of range, in [0, 0xffffffff + 1] @return a new Bitmap
[ "Complements", "the", "bits", "in", "the", "given", "range", "from", "rangeStart", "(", "inclusive", ")", "rangeEnd", "(", "exclusive", ")", ".", "The", "given", "bitmap", "is", "unchanged", "." ]
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/RoaringBitmap.java#L553-L591
mapbox/mapbox-java
services-geojson/src/main/java/com/mapbox/geojson/Feature.java
Feature.toJson
@Override public String toJson() { Gson gson = new GsonBuilder() .registerTypeAdapterFactory(GeoJsonAdapterFactory.create()) .registerTypeAdapterFactory(GeometryAdapterFactory.create()) .create(); // Empty properties -> should not appear in json string Feature feature = this; if (properties().size() == 0) { feature = new Feature(TYPE, bbox(), id(), geometry(), null); } return gson.toJson(feature); }
java
@Override public String toJson() { Gson gson = new GsonBuilder() .registerTypeAdapterFactory(GeoJsonAdapterFactory.create()) .registerTypeAdapterFactory(GeometryAdapterFactory.create()) .create(); // Empty properties -> should not appear in json string Feature feature = this; if (properties().size() == 0) { feature = new Feature(TYPE, bbox(), id(), geometry(), null); } return gson.toJson(feature); }
[ "@", "Override", "public", "String", "toJson", "(", ")", "{", "Gson", "gson", "=", "new", "GsonBuilder", "(", ")", ".", "registerTypeAdapterFactory", "(", "GeoJsonAdapterFactory", ".", "create", "(", ")", ")", ".", "registerTypeAdapterFactory", "(", "GeometryAda...
This takes the currently defined values found inside this instance and converts it to a GeoJson string. @return a JSON string which represents this Feature @since 1.0.0
[ "This", "takes", "the", "currently", "defined", "values", "found", "inside", "this", "instance", "and", "converts", "it", "to", "a", "GeoJson", "string", "." ]
train
https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/Feature.java#L271-L287
apiman/apiman
common/servlet/src/main/java/io/apiman/common/servlet/AuthenticationFilter.java
AuthenticationFilter.parseAuthorizationBasic
private Creds parseAuthorizationBasic(String authHeader) { String userpassEncoded = authHeader.substring(6); String data = StringUtils.newStringUtf8(Base64.decodeBase64(userpassEncoded)); int sepIdx = data.indexOf(':'); if (sepIdx > 0) { String username = data.substring(0, sepIdx); String password = data.substring(sepIdx + 1); return new Creds(username, password); } else { return new Creds(data, null); } }
java
private Creds parseAuthorizationBasic(String authHeader) { String userpassEncoded = authHeader.substring(6); String data = StringUtils.newStringUtf8(Base64.decodeBase64(userpassEncoded)); int sepIdx = data.indexOf(':'); if (sepIdx > 0) { String username = data.substring(0, sepIdx); String password = data.substring(sepIdx + 1); return new Creds(username, password); } else { return new Creds(data, null); } }
[ "private", "Creds", "parseAuthorizationBasic", "(", "String", "authHeader", ")", "{", "String", "userpassEncoded", "=", "authHeader", ".", "substring", "(", "6", ")", ";", "String", "data", "=", "StringUtils", ".", "newStringUtf8", "(", "Base64", ".", "decodeBas...
Parses the Authorization request header into a username and password. @param authHeader the auth header
[ "Parses", "the", "Authorization", "request", "header", "into", "a", "username", "and", "password", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/common/servlet/src/main/java/io/apiman/common/servlet/AuthenticationFilter.java#L309-L320
HeidelTime/heideltime
src/de/unihd/dbs/uima/annotator/stanfordtagger/StanfordPOSTaggerWrapper.java
StanfordPOSTaggerWrapper.initialize
public void initialize(UimaContext aContext) { // get configuration from the descriptor annotate_tokens = (Boolean) aContext.getConfigParameterValue(PARAM_ANNOTATE_TOKENS); annotate_sentences = (Boolean) aContext.getConfigParameterValue(PARAM_ANNOTATE_SENTENCES); annotate_partofspeech = (Boolean) aContext.getConfigParameterValue(PARAM_ANNOTATE_PARTOFSPEECH); model_path = (String) aContext.getConfigParameterValue(PARAM_MODEL_PATH); config_path = (String) aContext.getConfigParameterValue(PARAM_CONFIG_PATH); // check if the model file exists if(model_path == null) { Logger.printError(component, "The model file for the Stanford Tagger was not correctly specified."); System.exit(-1); } // try instantiating the MaxEnt Tagger try { if(config_path != null) { // configuration exists FileInputStream isr = new FileInputStream(config_path); Properties props = new Properties(); props.load(isr); mt = new MaxentTagger(model_path, new TaggerConfig(props), false); } else { // instantiate without configuration file mt = new MaxentTagger(model_path, new TaggerConfig("-model", model_path), false); } } catch(Exception e) { e.printStackTrace(); Logger.printError(component, "MaxentTagger could not be instantiated with the supplied model("+model_path+") and config("+config_path+") file."); System.exit(-1); } }
java
public void initialize(UimaContext aContext) { // get configuration from the descriptor annotate_tokens = (Boolean) aContext.getConfigParameterValue(PARAM_ANNOTATE_TOKENS); annotate_sentences = (Boolean) aContext.getConfigParameterValue(PARAM_ANNOTATE_SENTENCES); annotate_partofspeech = (Boolean) aContext.getConfigParameterValue(PARAM_ANNOTATE_PARTOFSPEECH); model_path = (String) aContext.getConfigParameterValue(PARAM_MODEL_PATH); config_path = (String) aContext.getConfigParameterValue(PARAM_CONFIG_PATH); // check if the model file exists if(model_path == null) { Logger.printError(component, "The model file for the Stanford Tagger was not correctly specified."); System.exit(-1); } // try instantiating the MaxEnt Tagger try { if(config_path != null) { // configuration exists FileInputStream isr = new FileInputStream(config_path); Properties props = new Properties(); props.load(isr); mt = new MaxentTagger(model_path, new TaggerConfig(props), false); } else { // instantiate without configuration file mt = new MaxentTagger(model_path, new TaggerConfig("-model", model_path), false); } } catch(Exception e) { e.printStackTrace(); Logger.printError(component, "MaxentTagger could not be instantiated with the supplied model("+model_path+") and config("+config_path+") file."); System.exit(-1); } }
[ "public", "void", "initialize", "(", "UimaContext", "aContext", ")", "{", "// get configuration from the descriptor", "annotate_tokens", "=", "(", "Boolean", ")", "aContext", ".", "getConfigParameterValue", "(", "PARAM_ANNOTATE_TOKENS", ")", ";", "annotate_sentences", "="...
initialization method where we fill configuration values and check some prerequisites
[ "initialization", "method", "where", "we", "fill", "configuration", "values", "and", "check", "some", "prerequisites" ]
train
https://github.com/HeidelTime/heideltime/blob/4ef5002eb5ecfeb818086ff7e394e792ee360335/src/de/unihd/dbs/uima/annotator/stanfordtagger/StanfordPOSTaggerWrapper.java#L59-L88
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Assert.java
Assert.notEmpty
public static <T> Collection<T> notEmpty(Collection<T> collection, String errorMsgTemplate, Object... params) throws IllegalArgumentException { if (CollectionUtil.isEmpty(collection)) { throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params)); } return collection; }
java
public static <T> Collection<T> notEmpty(Collection<T> collection, String errorMsgTemplate, Object... params) throws IllegalArgumentException { if (CollectionUtil.isEmpty(collection)) { throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params)); } return collection; }
[ "public", "static", "<", "T", ">", "Collection", "<", "T", ">", "notEmpty", "(", "Collection", "<", "T", ">", "collection", ",", "String", "errorMsgTemplate", ",", "Object", "...", "params", ")", "throws", "IllegalArgumentException", "{", "if", "(", "Collect...
断言给定集合非空 <pre class="code"> Assert.notEmpty(collection, "Collection must have elements"); </pre> @param <T> 集合元素类型 @param collection 被检查的集合 @param errorMsgTemplate 异常时的消息模板 @param params 参数列表 @return 非空集合 @throws IllegalArgumentException if the collection is {@code null} or has no elements
[ "断言给定集合非空" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L351-L356
census-instrumentation/opencensus-java
api/src/main/java/io/opencensus/trace/BlankSpan.java
BlankSpan.putAttribute
@Override public void putAttribute(String key, AttributeValue value) { Utils.checkNotNull(key, "key"); Utils.checkNotNull(value, "value"); }
java
@Override public void putAttribute(String key, AttributeValue value) { Utils.checkNotNull(key, "key"); Utils.checkNotNull(value, "value"); }
[ "@", "Override", "public", "void", "putAttribute", "(", "String", "key", ",", "AttributeValue", "value", ")", "{", "Utils", ".", "checkNotNull", "(", "key", ",", "\"key\"", ")", ";", "Utils", ".", "checkNotNull", "(", "value", ",", "\"value\"", ")", ";", ...
No-op implementation of the {@link Span#putAttribute(String, AttributeValue)} method.
[ "No", "-", "op", "implementation", "of", "the", "{" ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/trace/BlankSpan.java#L45-L49
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java
ExcelWriter.merge
public ExcelWriter merge(int firstRow, int lastRow, int firstColumn, int lastColumn, Object content, boolean isSetHeaderStyle) { Assert.isFalse(this.isClosed, "ExcelWriter has been closed!"); final CellStyle style = (isSetHeaderStyle && null != this.styleSet && null != this.styleSet.headCellStyle) ? this.styleSet.headCellStyle : this.styleSet.cellStyle; CellUtil.mergingCells(this.sheet, firstRow, lastRow, firstColumn, lastColumn, style); // 设置内容 if (null != content) { final Cell cell = getOrCreateCell(firstColumn, firstRow); CellUtil.setCellValue(cell, content, this.styleSet, isSetHeaderStyle); } return this; }
java
public ExcelWriter merge(int firstRow, int lastRow, int firstColumn, int lastColumn, Object content, boolean isSetHeaderStyle) { Assert.isFalse(this.isClosed, "ExcelWriter has been closed!"); final CellStyle style = (isSetHeaderStyle && null != this.styleSet && null != this.styleSet.headCellStyle) ? this.styleSet.headCellStyle : this.styleSet.cellStyle; CellUtil.mergingCells(this.sheet, firstRow, lastRow, firstColumn, lastColumn, style); // 设置内容 if (null != content) { final Cell cell = getOrCreateCell(firstColumn, firstRow); CellUtil.setCellValue(cell, content, this.styleSet, isSetHeaderStyle); } return this; }
[ "public", "ExcelWriter", "merge", "(", "int", "firstRow", ",", "int", "lastRow", ",", "int", "firstColumn", ",", "int", "lastColumn", ",", "Object", "content", ",", "boolean", "isSetHeaderStyle", ")", "{", "Assert", ".", "isFalse", "(", "this", ".", "isClose...
合并某行的单元格,并写入对象到单元格<br> 如果写到单元格中的内容非null,行号自动+1,否则当前行号不变<br> 样式为默认标题样式,可使用{@link #getHeadCellStyle()}方法调用后自定义默认样式 @param lastColumn 合并到的最后一个列号 @param content 合并单元格后的内容 @param isSetHeaderStyle 是否为合并后的单元格设置默认标题样式 @return this @since 4.0.10
[ "合并某行的单元格,并写入对象到单元格<br", ">", "如果写到单元格中的内容非null,行号自动", "+", "1,否则当前行号不变<br", ">", "样式为默认标题样式,可使用", "{", "@link", "#getHeadCellStyle", "()", "}", "方法调用后自定义默认样式" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java#L542-L554
jglobus/JGlobus
ssl-proxies/src/main/java/org/globus/common/CoGProperties.java
CoGProperties.getUdpSourcePortRange
public String getUdpSourcePortRange() { String value = null; value = System.getProperty("GLOBUS_UDP_SOURCE_PORT_RANGE"); if (value != null) { return value; } value = System.getProperty("org.globus.udp.source.port.range"); if (value != null) { return value; } return getProperty("udp.source.port.range", null); }
java
public String getUdpSourcePortRange() { String value = null; value = System.getProperty("GLOBUS_UDP_SOURCE_PORT_RANGE"); if (value != null) { return value; } value = System.getProperty("org.globus.udp.source.port.range"); if (value != null) { return value; } return getProperty("udp.source.port.range", null); }
[ "public", "String", "getUdpSourcePortRange", "(", ")", "{", "String", "value", "=", "null", ";", "value", "=", "System", ".", "getProperty", "(", "\"GLOBUS_UDP_SOURCE_PORT_RANGE\"", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "return", "value", ";"...
Returns the udp source port range. It first checks the 'GLOBUS_UDP_SOURCE_PORT_RANGE' system property. If that system property is not set then 'org.globus.source.udp.port.range' system property is checked. If that system property is not set then it returns the value specified in the configuration file. Returns null if the port range is not defined.<BR> The port range is in the following form: &lt;minport&gt;, &lt;maxport&gt; @return <code>String</code> the port range.
[ "Returns", "the", "udp", "source", "port", "range", ".", "It", "first", "checks", "the", "GLOBUS_UDP_SOURCE_PORT_RANGE", "system", "property", ".", "If", "that", "system", "property", "is", "not", "set", "then", "org", ".", "globus", ".", "source", ".", "udp...
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/ssl-proxies/src/main/java/org/globus/common/CoGProperties.java#L458-L469
krummas/DrizzleJDBC
src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java
DrizzlePreparedStatement.setBlob
public void setBlob(final int parameterIndex, final Blob x) throws SQLException { if(x == null) { setNull(parameterIndex, Types.BLOB); return; } try { setParameter(parameterIndex, new StreamParameter(x.getBinaryStream(), x.length())); } catch (IOException e) { throw SQLExceptionMapper.getSQLException("Could not read stream", e); } }
java
public void setBlob(final int parameterIndex, final Blob x) throws SQLException { if(x == null) { setNull(parameterIndex, Types.BLOB); return; } try { setParameter(parameterIndex, new StreamParameter(x.getBinaryStream(), x.length())); } catch (IOException e) { throw SQLExceptionMapper.getSQLException("Could not read stream", e); } }
[ "public", "void", "setBlob", "(", "final", "int", "parameterIndex", ",", "final", "Blob", "x", ")", "throws", "SQLException", "{", "if", "(", "x", "==", "null", ")", "{", "setNull", "(", "parameterIndex", ",", "Types", ".", "BLOB", ")", ";", "return", ...
Sets the designated parameter to the given <code>java.sql.Blob</code> object. The driver converts this to an SQL <code>BLOB</code> value when it sends it to the database. @param parameterIndex the first parameter is 1, the second is 2, ... @param x a <code>Blob</code> object that maps an SQL <code>BLOB</code> value @throws java.sql.SQLException if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed <code>PreparedStatement</code> @throws java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support this method @since 1.2
[ "Sets", "the", "designated", "parameter", "to", "the", "given", "<code", ">", "java", ".", "sql", ".", "Blob<", "/", "code", ">", "object", ".", "The", "driver", "converts", "this", "to", "an", "SQL", "<code", ">", "BLOB<", "/", "code", ">", "value", ...
train
https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java#L263-L273
real-logic/agrona
agrona/src/main/java/org/agrona/concurrent/status/CountersReader.java
CountersReader.forEach
public void forEach(final MetaData metaData) { int counterId = 0; final AtomicBuffer metaDataBuffer = this.metaDataBuffer; for (int i = 0, capacity = metaDataBuffer.capacity(); i < capacity; i += METADATA_LENGTH) { final int recordStatus = metaDataBuffer.getIntVolatile(i); if (RECORD_ALLOCATED == recordStatus) { final int typeId = metaDataBuffer.getInt(i + TYPE_ID_OFFSET); final String label = labelValue(metaDataBuffer, i); final DirectBuffer keyBuffer = new UnsafeBuffer(metaDataBuffer, i + KEY_OFFSET, MAX_KEY_LENGTH); metaData.accept(counterId, typeId, keyBuffer, label); } else if (RECORD_UNUSED == recordStatus) { break; } counterId++; } }
java
public void forEach(final MetaData metaData) { int counterId = 0; final AtomicBuffer metaDataBuffer = this.metaDataBuffer; for (int i = 0, capacity = metaDataBuffer.capacity(); i < capacity; i += METADATA_LENGTH) { final int recordStatus = metaDataBuffer.getIntVolatile(i); if (RECORD_ALLOCATED == recordStatus) { final int typeId = metaDataBuffer.getInt(i + TYPE_ID_OFFSET); final String label = labelValue(metaDataBuffer, i); final DirectBuffer keyBuffer = new UnsafeBuffer(metaDataBuffer, i + KEY_OFFSET, MAX_KEY_LENGTH); metaData.accept(counterId, typeId, keyBuffer, label); } else if (RECORD_UNUSED == recordStatus) { break; } counterId++; } }
[ "public", "void", "forEach", "(", "final", "MetaData", "metaData", ")", "{", "int", "counterId", "=", "0", ";", "final", "AtomicBuffer", "metaDataBuffer", "=", "this", ".", "metaDataBuffer", ";", "for", "(", "int", "i", "=", "0", ",", "capacity", "=", "m...
Iterate over all the metadata in the buffer. @param metaData function to be called for each metadata record.
[ "Iterate", "over", "all", "the", "metadata", "in", "the", "buffer", "." ]
train
https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/concurrent/status/CountersReader.java#L342-L366
jenkinsci/jenkins
core/src/main/java/hudson/util/BootFailure.java
BootFailure.publish
public void publish(ServletContext context, @CheckForNull File home) { LOGGER.log(Level.SEVERE, "Failed to initialize Jenkins",this); WebApp.get(context).setApp(this); if (home == null) { return; } new GroovyHookScript("boot-failure", context, home, BootFailure.class.getClassLoader()) .bind("exception",this) .bind("home",home) .bind("servletContext", context) .bind("attempts",loadAttempts(home)) .run(); }
java
public void publish(ServletContext context, @CheckForNull File home) { LOGGER.log(Level.SEVERE, "Failed to initialize Jenkins",this); WebApp.get(context).setApp(this); if (home == null) { return; } new GroovyHookScript("boot-failure", context, home, BootFailure.class.getClassLoader()) .bind("exception",this) .bind("home",home) .bind("servletContext", context) .bind("attempts",loadAttempts(home)) .run(); }
[ "public", "void", "publish", "(", "ServletContext", "context", ",", "@", "CheckForNull", "File", "home", ")", "{", "LOGGER", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"Failed to initialize Jenkins\"", ",", "this", ")", ";", "WebApp", ".", "get", "(", ...
Exposes this failure to UI and invoke the hook. @param home JENKINS_HOME if it's already known.
[ "Exposes", "this", "failure", "to", "UI", "and", "invoke", "the", "hook", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/BootFailure.java#L39-L52
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/PatternMatchingFunctions.java
PatternMatchingFunctions.regexpContains
public static Expression regexpContains(Expression expression, String pattern) { return x("REGEXP_CONTAINS(" + expression.toString() + ", \"" + pattern + "\")"); }
java
public static Expression regexpContains(Expression expression, String pattern) { return x("REGEXP_CONTAINS(" + expression.toString() + ", \"" + pattern + "\")"); }
[ "public", "static", "Expression", "regexpContains", "(", "Expression", "expression", ",", "String", "pattern", ")", "{", "return", "x", "(", "\"REGEXP_CONTAINS(\"", "+", "expression", ".", "toString", "(", ")", "+", "\", \\\"\"", "+", "pattern", "+", "\"\\\")\""...
Returned expression results in True if the string value contains the regular expression pattern.
[ "Returned", "expression", "results", "in", "True", "if", "the", "string", "value", "contains", "the", "regular", "expression", "pattern", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/PatternMatchingFunctions.java#L42-L44
venkatramanm/swf-all
swf/src/main/java/com/venky/swf/views/HtmlView.java
HtmlView._createBody
protected void _createBody(_IControl body,boolean includeStatusMessage){ int statusMessageIndex = body.getContainedControls().size(); showErrorsIfAny(body,statusMessageIndex, includeStatusMessage); createBody(body); }
java
protected void _createBody(_IControl body,boolean includeStatusMessage){ int statusMessageIndex = body.getContainedControls().size(); showErrorsIfAny(body,statusMessageIndex, includeStatusMessage); createBody(body); }
[ "protected", "void", "_createBody", "(", "_IControl", "body", ",", "boolean", "includeStatusMessage", ")", "{", "int", "statusMessageIndex", "=", "body", ".", "getContainedControls", "(", ")", ".", "size", "(", ")", ";", "showErrorsIfAny", "(", "body", ",", "s...
/* When views are composed, includeStatusMessage is passed as false so that it may be included in parent/including view
[ "/", "*", "When", "views", "are", "composed", "includeStatusMessage", "is", "passed", "as", "false", "so", "that", "it", "may", "be", "included", "in", "parent", "/", "including", "view" ]
train
https://github.com/venkatramanm/swf-all/blob/e6ca342df0645bf1122d81e302575014ad565b69/swf/src/main/java/com/venky/swf/views/HtmlView.java#L214-L218
iipc/webarchive-commons
src/main/java/org/archive/util/FileUtils.java
FileUtils.storeProperties
public static void storeProperties(Properties p, File file) throws IOException { FileOutputStream fos = new FileOutputStream(file); try { p.store(fos,""); } finally { ArchiveUtils.closeQuietly(fos); } }
java
public static void storeProperties(Properties p, File file) throws IOException { FileOutputStream fos = new FileOutputStream(file); try { p.store(fos,""); } finally { ArchiveUtils.closeQuietly(fos); } }
[ "public", "static", "void", "storeProperties", "(", "Properties", "p", ",", "File", "file", ")", "throws", "IOException", "{", "FileOutputStream", "fos", "=", "new", "FileOutputStream", "(", "file", ")", ";", "try", "{", "p", ".", "store", "(", "fos", ",",...
Store Properties instance to a File @param p @param file destination File @throws IOException
[ "Store", "Properties", "instance", "to", "a", "File" ]
train
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/FileUtils.java#L352-L359
landawn/AbacusUtil
src/com/landawn/abacus/util/StringUtil.java
StringUtil.wrapIfMissing
public static String wrapIfMissing(final String str, final String prefix, final String suffix) { N.checkArgNotNull(prefix); N.checkArgNotNull(suffix); if (N.isNullOrEmpty(str)) { return prefix + suffix; } else if (str.startsWith(prefix)) { return (str.length() - prefix.length() >= suffix.length() && str.endsWith(suffix)) ? str : str + suffix; } else if (str.endsWith(suffix)) { return prefix + str; } else { return concat(prefix, str, suffix); } }
java
public static String wrapIfMissing(final String str, final String prefix, final String suffix) { N.checkArgNotNull(prefix); N.checkArgNotNull(suffix); if (N.isNullOrEmpty(str)) { return prefix + suffix; } else if (str.startsWith(prefix)) { return (str.length() - prefix.length() >= suffix.length() && str.endsWith(suffix)) ? str : str + suffix; } else if (str.endsWith(suffix)) { return prefix + str; } else { return concat(prefix, str, suffix); } }
[ "public", "static", "String", "wrapIfMissing", "(", "final", "String", "str", ",", "final", "String", "prefix", ",", "final", "String", "suffix", ")", "{", "N", ".", "checkArgNotNull", "(", "prefix", ")", ";", "N", ".", "checkArgNotNull", "(", "suffix", ")...
<pre> N.wrapIfMissing(null, "[", "]") -> "[]" N.wrapIfMissing("", "[", "]") -> "[]" N.wrapIfMissing("[", "[", "]") -> "[]" N.wrapIfMissing("]", "[", "]") -> "[]" N.wrapIfMissing("abc", "[", "]") -> "[abc]" N.wrapIfMissing("a", "aa", "aa") -> "aaaaa" N.wrapIfMissing("aa", "aa", "aa") -> "aaaa" N.wrapIfMissing("aaa", "aa", "aa") -> "aaaaa" N.wrapIfMissing("aaaa", "aa", "aa") -> "aaaa" </pre> @param str @param prefix @param suffix @return
[ "<pre", ">", "N", ".", "wrapIfMissing", "(", "null", "[", "]", ")", "-", ">", "[]", "N", ".", "wrapIfMissing", "(", "[", "]", ")", "-", ">", "[]", "N", ".", "wrapIfMissing", "(", "[", "[", "]", ")", "-", ">", "[]", "N", ".", "wrapIfMissing", ...
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/StringUtil.java#L2331-L2344
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/util/Properties.java
Properties.getProperty
public int getProperty(String propName, int defaultValue) { String propValue = props.getProperty(propName); return (propValue == null) ? defaultValue : Integer.parseInt(propValue); }
java
public int getProperty(String propName, int defaultValue) { String propValue = props.getProperty(propName); return (propValue == null) ? defaultValue : Integer.parseInt(propValue); }
[ "public", "int", "getProperty", "(", "String", "propName", ",", "int", "defaultValue", ")", "{", "String", "propValue", "=", "props", ".", "getProperty", "(", "propName", ")", ";", "return", "(", "propValue", "==", "null", ")", "?", "defaultValue", ":", "I...
Returns the integer value of the property associated with {@code propName}, or {@code defaultValue} if there is no property.
[ "Returns", "the", "integer", "value", "of", "the", "property", "associated", "with", "{" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/util/Properties.java#L73-L76
morimekta/providence
providence-generator-java/src/main/java/net/morimekta/providence/generator/format/java/utils/JUtils.java
JUtils.camelCase
public static String camelCase(String prefix, String name) { return Strings.camelCase(prefix, name); }
java
public static String camelCase(String prefix, String name) { return Strings.camelCase(prefix, name); }
[ "public", "static", "String", "camelCase", "(", "String", "prefix", ",", "String", "name", ")", "{", "return", "Strings", ".", "camelCase", "(", "prefix", ",", "name", ")", ";", "}" ]
Format a prefixed name as camelCase. The prefix is kept verbatim, while tha name is split on '_' chars, and joined with each part capitalized. @param prefix Name prefix, not modified. @param name The name to camel-case. @return theCamelCasedName
[ "Format", "a", "prefixed", "name", "as", "camelCase", ".", "The", "prefix", "is", "kept", "verbatim", "while", "tha", "name", "is", "split", "on", "_", "chars", "and", "joined", "with", "each", "part", "capitalized", "." ]
train
https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-generator-java/src/main/java/net/morimekta/providence/generator/format/java/utils/JUtils.java#L128-L130
kiegroup/droolsjbpm-integration
kie-server-parent/kie-server-common/src/main/java/org/kie/server/common/rest/KieServerHttpRequest.java
KieServerHttpRequest.responseHeaderParameter
private String responseHeaderParameter( final String headerName, final String paramName ) { return getHeaderParam(responseHeader(headerName), paramName); }
java
private String responseHeaderParameter( final String headerName, final String paramName ) { return getHeaderParam(responseHeader(headerName), paramName); }
[ "private", "String", "responseHeaderParameter", "(", "final", "String", "headerName", ",", "final", "String", "paramName", ")", "{", "return", "getHeaderParam", "(", "responseHeader", "(", "headerName", ")", ",", "paramName", ")", ";", "}" ]
Get parameter with given name from header value in response @param headerName @param paramName @return parameter value or null if missing
[ "Get", "parameter", "with", "given", "name", "from", "header", "value", "in", "response" ]
train
https://github.com/kiegroup/droolsjbpm-integration/blob/6c26200ab03855dbb92b56ca0c6363cdec0eaf2c/kie-server-parent/kie-server-common/src/main/java/org/kie/server/common/rest/KieServerHttpRequest.java#L1452-L1454
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.getPrefixedString
public String getPrefixedString(int fieldSize, Charset cs) { int len = 0; switch (fieldSize) { case 1: len = _buf.get(); break; case 2: len = _buf.getShort(); break; case 4: len = _buf.getInt(); break; default: throw new IllegalArgumentException("Illegal argument, field size should be 1,2 or 4 and fieldSize is: " + fieldSize); } if (len == 0) { return ""; } int oldLimit = _buf.limit(); try { _buf.limit(_buf.position() + len); byte[] bytes = new byte[len]; _buf.get(bytes, 0, len); String retVal = cs.decode(java.nio.ByteBuffer.wrap(bytes)).toString(); return retVal; } finally { _buf.limit(oldLimit); } }
java
public String getPrefixedString(int fieldSize, Charset cs) { int len = 0; switch (fieldSize) { case 1: len = _buf.get(); break; case 2: len = _buf.getShort(); break; case 4: len = _buf.getInt(); break; default: throw new IllegalArgumentException("Illegal argument, field size should be 1,2 or 4 and fieldSize is: " + fieldSize); } if (len == 0) { return ""; } int oldLimit = _buf.limit(); try { _buf.limit(_buf.position() + len); byte[] bytes = new byte[len]; _buf.get(bytes, 0, len); String retVal = cs.decode(java.nio.ByteBuffer.wrap(bytes)).toString(); return retVal; } finally { _buf.limit(oldLimit); } }
[ "public", "String", "getPrefixedString", "(", "int", "fieldSize", ",", "Charset", "cs", ")", "{", "int", "len", "=", "0", ";", "switch", "(", "fieldSize", ")", "{", "case", "1", ":", "len", "=", "_buf", ".", "get", "(", ")", ";", "break", ";", "cas...
Returns a length-prefixed string from the buffer at the current position. @param fieldSize the width in bytes of the prefixed length field @param cs the character set @return the length-prefixed string
[ "Returns", "a", "length", "-", "prefixed", "string", "from", "the", "buffer", "at", "the", "current", "position", "." ]
train
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L912-L943
Azure/azure-sdk-for-java
sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesInner.java
BackupShortTermRetentionPoliciesInner.beginUpdate
public BackupShortTermRetentionPolicyInner beginUpdate(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).toBlocking().single().body(); }
java
public BackupShortTermRetentionPolicyInner beginUpdate(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).toBlocking().single().body(); }
[ "public", "BackupShortTermRetentionPolicyInner", "beginUpdate", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "Integer", "retentionDays", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupName"...
Updates a database's short term retention policy. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. @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 BackupShortTermRetentionPolicyInner object if successful.
[ "Updates", "a", "database", "s", "short", "term", "retention", "policy", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesInner.java#L804-L806
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormatSymbols.java
DateFormatSymbols.copyMembers
private final void copyMembers(DateFormatSymbols src, DateFormatSymbols dst) { dst.eras = Arrays.copyOf(src.eras, src.eras.length); dst.months = Arrays.copyOf(src.months, src.months.length); dst.shortMonths = Arrays.copyOf(src.shortMonths, src.shortMonths.length); dst.weekdays = Arrays.copyOf(src.weekdays, src.weekdays.length); dst.shortWeekdays = Arrays.copyOf(src.shortWeekdays, src.shortWeekdays.length); dst.ampms = Arrays.copyOf(src.ampms, src.ampms.length); if (src.zoneStrings != null) { dst.zoneStrings = src.getZoneStringsImpl(true); } else { dst.zoneStrings = null; } dst.localPatternChars = src.localPatternChars; dst.tinyMonths = src.tinyMonths; dst.tinyWeekdays = src.tinyWeekdays; dst.standAloneMonths = src.standAloneMonths; dst.shortStandAloneMonths = src.shortStandAloneMonths; dst.tinyStandAloneMonths = src.tinyStandAloneMonths; dst.standAloneWeekdays = src.standAloneWeekdays; dst.shortStandAloneWeekdays = src.shortStandAloneWeekdays; dst.tinyStandAloneWeekdays = src.tinyStandAloneWeekdays; }
java
private final void copyMembers(DateFormatSymbols src, DateFormatSymbols dst) { dst.eras = Arrays.copyOf(src.eras, src.eras.length); dst.months = Arrays.copyOf(src.months, src.months.length); dst.shortMonths = Arrays.copyOf(src.shortMonths, src.shortMonths.length); dst.weekdays = Arrays.copyOf(src.weekdays, src.weekdays.length); dst.shortWeekdays = Arrays.copyOf(src.shortWeekdays, src.shortWeekdays.length); dst.ampms = Arrays.copyOf(src.ampms, src.ampms.length); if (src.zoneStrings != null) { dst.zoneStrings = src.getZoneStringsImpl(true); } else { dst.zoneStrings = null; } dst.localPatternChars = src.localPatternChars; dst.tinyMonths = src.tinyMonths; dst.tinyWeekdays = src.tinyWeekdays; dst.standAloneMonths = src.standAloneMonths; dst.shortStandAloneMonths = src.shortStandAloneMonths; dst.tinyStandAloneMonths = src.tinyStandAloneMonths; dst.standAloneWeekdays = src.standAloneWeekdays; dst.shortStandAloneWeekdays = src.shortStandAloneWeekdays; dst.tinyStandAloneWeekdays = src.tinyStandAloneWeekdays; }
[ "private", "final", "void", "copyMembers", "(", "DateFormatSymbols", "src", ",", "DateFormatSymbols", "dst", ")", "{", "dst", ".", "eras", "=", "Arrays", ".", "copyOf", "(", "src", ".", "eras", ",", "src", ".", "eras", ".", "length", ")", ";", "dst", "...
Clones all the data members from the source DateFormatSymbols to the target DateFormatSymbols. This is only for subclasses. @param src the source DateFormatSymbols. @param dst the target DateFormatSymbols.
[ "Clones", "all", "the", "data", "members", "from", "the", "source", "DateFormatSymbols", "to", "the", "target", "DateFormatSymbols", ".", "This", "is", "only", "for", "subclasses", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormatSymbols.java#L926-L951
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java
SerializedFormBuilder.buildSerialUIDInfo
public void buildSerialUIDInfo(XMLNode node, Content classTree) { Content serialUidTree = writer.getSerialUIDInfoHeader(); for (FieldDoc field : currentClass.fields(false)) { if (field.name().equals("serialVersionUID") && field.constantValueExpression() != null) { writer.addSerialUIDInfo(SERIAL_VERSION_UID_HEADER, field.constantValueExpression(), serialUidTree); break; } } classTree.addContent(serialUidTree); }
java
public void buildSerialUIDInfo(XMLNode node, Content classTree) { Content serialUidTree = writer.getSerialUIDInfoHeader(); for (FieldDoc field : currentClass.fields(false)) { if (field.name().equals("serialVersionUID") && field.constantValueExpression() != null) { writer.addSerialUIDInfo(SERIAL_VERSION_UID_HEADER, field.constantValueExpression(), serialUidTree); break; } } classTree.addContent(serialUidTree); }
[ "public", "void", "buildSerialUIDInfo", "(", "XMLNode", "node", ",", "Content", "classTree", ")", "{", "Content", "serialUidTree", "=", "writer", ".", "getSerialUIDInfoHeader", "(", ")", ";", "for", "(", "FieldDoc", "field", ":", "currentClass", ".", "fields", ...
Build the serial UID information for the given class. @param node the XML element that specifies which components to document @param classTree content tree to which the serial UID information will be added
[ "Build", "the", "serial", "UID", "information", "for", "the", "given", "class", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java#L240-L251
jeremylong/DependencyCheck
utils/src/main/java/org/owasp/dependencycheck/utils/Checksum.java
Checksum.getMessageDigest
private static MessageDigest getMessageDigest(String algorithm) { try { return MessageDigest.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { LOGGER.error(e.getMessage()); final String msg = String.format("Failed to obtain the %s message digest.", algorithm); throw new IllegalStateException(msg, e); } }
java
private static MessageDigest getMessageDigest(String algorithm) { try { return MessageDigest.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { LOGGER.error(e.getMessage()); final String msg = String.format("Failed to obtain the %s message digest.", algorithm); throw new IllegalStateException(msg, e); } }
[ "private", "static", "MessageDigest", "getMessageDigest", "(", "String", "algorithm", ")", "{", "try", "{", "return", "MessageDigest", ".", "getInstance", "(", "algorithm", ")", ";", "}", "catch", "(", "NoSuchAlgorithmException", "e", ")", "{", "LOGGER", ".", ...
Returns the message digest. @param algorithm the algorithm for the message digest @return the message digest
[ "Returns", "the", "message", "digest", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/Checksum.java#L229-L237
jqm4gwt/jqm4gwt
library/src/main/java/com/sksamuel/jqm4gwt/JQMCommon.java
JQMCommon.indexOfName
public static int indexOfName(String nameList, String name) { int idx = nameList.indexOf(name); // Calculate matching index. while (idx != -1) { if (idx == 0 || nameList.charAt(idx - 1) == ' ') { int last = idx + name.length(); int lastPos = nameList.length(); if ((last == lastPos) || ((last < lastPos) && (nameList.charAt(last) == ' '))) { break; } } idx = nameList.indexOf(name, idx + 1); } return idx; }
java
public static int indexOfName(String nameList, String name) { int idx = nameList.indexOf(name); // Calculate matching index. while (idx != -1) { if (idx == 0 || nameList.charAt(idx - 1) == ' ') { int last = idx + name.length(); int lastPos = nameList.length(); if ((last == lastPos) || ((last < lastPos) && (nameList.charAt(last) == ' '))) { break; } } idx = nameList.indexOf(name, idx + 1); } return idx; }
[ "public", "static", "int", "indexOfName", "(", "String", "nameList", ",", "String", "name", ")", "{", "int", "idx", "=", "nameList", ".", "indexOf", "(", "name", ")", ";", "// Calculate matching index.", "while", "(", "idx", "!=", "-", "1", ")", "{", "if...
Exact copy of com.google.gwt.dom.client.Element.indexOfName() <p> Returns the index of the first occurrence of name in a space-separated list of names, or -1 if not found. </p> @param nameList list of space delimited names @param name a non-empty string. Should be already trimmed.
[ "Exact", "copy", "of", "com", ".", "google", ".", "gwt", ".", "dom", ".", "client", ".", "Element", ".", "indexOfName", "()", "<p", ">", "Returns", "the", "index", "of", "the", "first", "occurrence", "of", "name", "in", "a", "space", "-", "separated", ...
train
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/JQMCommon.java#L129-L143
samskivert/samskivert
src/main/java/com/samskivert/util/QuickSort.java
QuickSort.rsort
public static <T> void rsort (T[] a, Comparator<? super T> comp) { rsort(a, 0, a.length - 1, comp); }
java
public static <T> void rsort (T[] a, Comparator<? super T> comp) { rsort(a, 0, a.length - 1, comp); }
[ "public", "static", "<", "T", ">", "void", "rsort", "(", "T", "[", "]", "a", ",", "Comparator", "<", "?", "super", "T", ">", "comp", ")", "{", "rsort", "(", "a", ",", "0", ",", "a", ".", "length", "-", "1", ",", "comp", ")", ";", "}" ]
Sorts the supplied array of objects from greatest to least, using the supplied comparator.
[ "Sorts", "the", "supplied", "array", "of", "objects", "from", "greatest", "to", "least", "using", "the", "supplied", "comparator", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/QuickSort.java#L36-L39
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java
ModelSerializer.writeModel
public static void writeModel(@NonNull Model model, @NonNull OutputStream stream, boolean saveUpdater) throws IOException { writeModel(model,stream,saveUpdater,null); }
java
public static void writeModel(@NonNull Model model, @NonNull OutputStream stream, boolean saveUpdater) throws IOException { writeModel(model,stream,saveUpdater,null); }
[ "public", "static", "void", "writeModel", "(", "@", "NonNull", "Model", "model", ",", "@", "NonNull", "OutputStream", "stream", ",", "boolean", "saveUpdater", ")", "throws", "IOException", "{", "writeModel", "(", "model", ",", "stream", ",", "saveUpdater", ","...
Write a model to an output stream @param model the model to save @param stream the output stream to write to @param saveUpdater whether to save the updater for the model or not @throws IOException
[ "Write", "a", "model", "to", "an", "output", "stream" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java#L117-L120
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/conf/Configuration.java
Configuration.setFirstMemory
public Configuration setFirstMemory(@NonNull AllocationStatus initialMemory) { if (initialMemory != AllocationStatus.DEVICE && initialMemory != AllocationStatus.HOST && initialMemory != AllocationStatus.DELAYED) throw new IllegalStateException("First memory should be either [HOST], [DEVICE] or [DELAYED]"); this.firstMemory = initialMemory; return this; }
java
public Configuration setFirstMemory(@NonNull AllocationStatus initialMemory) { if (initialMemory != AllocationStatus.DEVICE && initialMemory != AllocationStatus.HOST && initialMemory != AllocationStatus.DELAYED) throw new IllegalStateException("First memory should be either [HOST], [DEVICE] or [DELAYED]"); this.firstMemory = initialMemory; return this; }
[ "public", "Configuration", "setFirstMemory", "(", "@", "NonNull", "AllocationStatus", "initialMemory", ")", "{", "if", "(", "initialMemory", "!=", "AllocationStatus", ".", "DEVICE", "&&", "initialMemory", "!=", "AllocationStatus", ".", "HOST", "&&", "initialMemory", ...
This method allows to specify initial memory to be used within system. HOST: all data is located on host memory initially, and gets into DEVICE, if used frequent enough DEVICE: all memory is located on device. DELAYED: memory allocated on HOST first, and on first use gets moved to DEVICE PLEASE NOTE: For device memory all data still retains on host side as well. Default value: DEVICE @param initialMemory @return
[ "This", "method", "allows", "to", "specify", "initial", "memory", "to", "be", "used", "within", "system", ".", "HOST", ":", "all", "data", "is", "located", "on", "host", "memory", "initially", "and", "gets", "into", "DEVICE", "if", "used", "frequent", "eno...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/conf/Configuration.java#L643-L651
alkacon/opencms-core
src/org/opencms/xml/templatemapper/CmsTemplateMapper.java
CmsTemplateMapper.transformContainerpageBean
public CmsContainerPageBean transformContainerpageBean(CmsObject cms, CmsContainerPageBean input, String rootPath) { CmsTemplateMapperConfiguration config = getConfiguration(cms); if ((config == null) || !config.isEnabledForPath(rootPath)) { return input; } List<CmsContainerBean> newContainers = new ArrayList<>(); for (CmsContainerBean container : input.getContainers().values()) { List<CmsContainerElementBean> elements = container.getElements(); List<CmsContainerElementBean> newElements = new ArrayList<>(); for (CmsContainerElementBean element : elements) { CmsContainerElementBean newElement = transformContainerElement(cms, config, element); if (newElement != null) { newElements.add(newElement); } } CmsContainerBean newContainer = new CmsContainerBean( container.getName(), container.getType(), container.getParentInstanceId(), container.isRootContainer(), newElements); newContainers.add(newContainer); } CmsContainerPageBean result = new CmsContainerPageBean(newContainers); return result; }
java
public CmsContainerPageBean transformContainerpageBean(CmsObject cms, CmsContainerPageBean input, String rootPath) { CmsTemplateMapperConfiguration config = getConfiguration(cms); if ((config == null) || !config.isEnabledForPath(rootPath)) { return input; } List<CmsContainerBean> newContainers = new ArrayList<>(); for (CmsContainerBean container : input.getContainers().values()) { List<CmsContainerElementBean> elements = container.getElements(); List<CmsContainerElementBean> newElements = new ArrayList<>(); for (CmsContainerElementBean element : elements) { CmsContainerElementBean newElement = transformContainerElement(cms, config, element); if (newElement != null) { newElements.add(newElement); } } CmsContainerBean newContainer = new CmsContainerBean( container.getName(), container.getType(), container.getParentInstanceId(), container.isRootContainer(), newElements); newContainers.add(newContainer); } CmsContainerPageBean result = new CmsContainerPageBean(newContainers); return result; }
[ "public", "CmsContainerPageBean", "transformContainerpageBean", "(", "CmsObject", "cms", ",", "CmsContainerPageBean", "input", ",", "String", "rootPath", ")", "{", "CmsTemplateMapperConfiguration", "config", "=", "getConfiguration", "(", "cms", ")", ";", "if", "(", "(...
Transforms a container page bean.<p> @param cms the current CMS context @param input the bean to be transformed @param rootPath the root path of the page @return the transformed bean
[ "Transforms", "a", "container", "page", "bean", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/templatemapper/CmsTemplateMapper.java#L168-L194
VoltDB/voltdb
src/frontend/org/voltdb/planner/AbstractParsedStmt.java
AbstractParsedStmt.addSimplifiedSubqueryToStmtCache
private StmtTargetTableScan addSimplifiedSubqueryToStmtCache( StmtSubqueryScan subqueryScan, StmtTargetTableScan tableScan) { String tableAlias = subqueryScan.getTableAlias(); assert(tableAlias != null); // It is guaranteed by the canSimplifySubquery that there is // one and only one TABLE in the subquery's FROM clause. Table promotedTable = tableScan.getTargetTable(); StmtTargetTableScan promotedScan = new StmtTargetTableScan(promotedTable, tableAlias, m_stmtId); // Keep the original subquery scan to be able to tie the parent // statement column/table names and aliases to the table's. promotedScan.setOriginalSubqueryScan(subqueryScan); // Replace the subquery scan with the table scan StmtTableScan prior = m_tableAliasMap.put(tableAlias, promotedScan); assert(prior == subqueryScan); m_tableList.add(promotedTable); return promotedScan; }
java
private StmtTargetTableScan addSimplifiedSubqueryToStmtCache( StmtSubqueryScan subqueryScan, StmtTargetTableScan tableScan) { String tableAlias = subqueryScan.getTableAlias(); assert(tableAlias != null); // It is guaranteed by the canSimplifySubquery that there is // one and only one TABLE in the subquery's FROM clause. Table promotedTable = tableScan.getTargetTable(); StmtTargetTableScan promotedScan = new StmtTargetTableScan(promotedTable, tableAlias, m_stmtId); // Keep the original subquery scan to be able to tie the parent // statement column/table names and aliases to the table's. promotedScan.setOriginalSubqueryScan(subqueryScan); // Replace the subquery scan with the table scan StmtTableScan prior = m_tableAliasMap.put(tableAlias, promotedScan); assert(prior == subqueryScan); m_tableList.add(promotedTable); return promotedScan; }
[ "private", "StmtTargetTableScan", "addSimplifiedSubqueryToStmtCache", "(", "StmtSubqueryScan", "subqueryScan", ",", "StmtTargetTableScan", "tableScan", ")", "{", "String", "tableAlias", "=", "subqueryScan", ".", "getTableAlias", "(", ")", ";", "assert", "(", "tableAlias",...
Replace an existing subquery scan with its underlying table scan. The subquery has already passed all the checks from the canSimplifySubquery method. Subquery ORDER BY clause is ignored if such exists. @param subqueryScan subquery scan to simplify @param tableAlias @return StmtTargetTableScan
[ "Replace", "an", "existing", "subquery", "scan", "with", "its", "underlying", "table", "scan", ".", "The", "subquery", "has", "already", "passed", "all", "the", "checks", "from", "the", "canSimplifySubquery", "method", ".", "Subquery", "ORDER", "BY", "clause", ...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/planner/AbstractParsedStmt.java#L894-L911
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemWrapper.java
ProxiedFileSystemWrapper.getProxiedFileSystem
public FileSystem getProxiedFileSystem(State properties, AuthType authType, String authPath, String uri, final Configuration conf) throws IOException, InterruptedException, URISyntaxException { Preconditions.checkArgument(StringUtils.isNotBlank(properties.getProp(ConfigurationKeys.FS_PROXY_AS_USER_NAME)), "State does not contain a proper proxy user name"); String proxyUserName = properties.getProp(ConfigurationKeys.FS_PROXY_AS_USER_NAME); UserGroupInformation proxyUser; switch (authType) { case KEYTAB: // If the authentication type is KEYTAB, log in a super user first before creating a proxy user. Preconditions.checkArgument( StringUtils.isNotBlank(properties.getProp(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS)), "State does not contain a proper proxy token file name"); String superUser = properties.getProp(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS); UserGroupInformation.loginUserFromKeytab(superUser, authPath); proxyUser = UserGroupInformation.createProxyUser(proxyUserName, UserGroupInformation.getLoginUser()); break; case TOKEN: // If the authentication type is TOKEN, create a proxy user and then add the token to the user. proxyUser = UserGroupInformation.createProxyUser(proxyUserName, UserGroupInformation.getLoginUser()); Optional<Token<?>> proxyToken = getTokenFromSeqFile(authPath, proxyUserName); if (proxyToken.isPresent()) { proxyUser.addToken(proxyToken.get()); } else { LOG.warn("No delegation token found for the current proxy user."); } break; default: LOG.warn("Creating a proxy user without authentication, which could not perform File system operations."); proxyUser = UserGroupInformation.createProxyUser(proxyUserName, UserGroupInformation.getLoginUser()); break; } final URI fsURI = URI.create(uri); proxyUser.doAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws IOException { LOG.debug("Now performing file system operations as :" + UserGroupInformation.getCurrentUser()); proxiedFs = FileSystem.get(fsURI, conf); return null; } }); return this.proxiedFs; }
java
public FileSystem getProxiedFileSystem(State properties, AuthType authType, String authPath, String uri, final Configuration conf) throws IOException, InterruptedException, URISyntaxException { Preconditions.checkArgument(StringUtils.isNotBlank(properties.getProp(ConfigurationKeys.FS_PROXY_AS_USER_NAME)), "State does not contain a proper proxy user name"); String proxyUserName = properties.getProp(ConfigurationKeys.FS_PROXY_AS_USER_NAME); UserGroupInformation proxyUser; switch (authType) { case KEYTAB: // If the authentication type is KEYTAB, log in a super user first before creating a proxy user. Preconditions.checkArgument( StringUtils.isNotBlank(properties.getProp(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS)), "State does not contain a proper proxy token file name"); String superUser = properties.getProp(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS); UserGroupInformation.loginUserFromKeytab(superUser, authPath); proxyUser = UserGroupInformation.createProxyUser(proxyUserName, UserGroupInformation.getLoginUser()); break; case TOKEN: // If the authentication type is TOKEN, create a proxy user and then add the token to the user. proxyUser = UserGroupInformation.createProxyUser(proxyUserName, UserGroupInformation.getLoginUser()); Optional<Token<?>> proxyToken = getTokenFromSeqFile(authPath, proxyUserName); if (proxyToken.isPresent()) { proxyUser.addToken(proxyToken.get()); } else { LOG.warn("No delegation token found for the current proxy user."); } break; default: LOG.warn("Creating a proxy user without authentication, which could not perform File system operations."); proxyUser = UserGroupInformation.createProxyUser(proxyUserName, UserGroupInformation.getLoginUser()); break; } final URI fsURI = URI.create(uri); proxyUser.doAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws IOException { LOG.debug("Now performing file system operations as :" + UserGroupInformation.getCurrentUser()); proxiedFs = FileSystem.get(fsURI, conf); return null; } }); return this.proxiedFs; }
[ "public", "FileSystem", "getProxiedFileSystem", "(", "State", "properties", ",", "AuthType", "authType", ",", "String", "authPath", ",", "String", "uri", ",", "final", "Configuration", "conf", ")", "throws", "IOException", ",", "InterruptedException", ",", "URISynta...
Getter for proxiedFs, using the passed parameters to create an instance of a proxiedFs. @param properties @param authType is either TOKEN or KEYTAB. @param authPath is the KEYTAB location if the authType is KEYTAB; otherwise, it is the token file. @param uri File system URI. @throws IOException @throws InterruptedException @throws URISyntaxException @return proxiedFs
[ "Getter", "for", "proxiedFs", "using", "the", "passed", "parameters", "to", "create", "an", "instance", "of", "a", "proxiedFs", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemWrapper.java#L101-L141
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/apache/logging/log4j/spi/LoggerRegistry.java
LoggerRegistry.hasLogger
public boolean hasLogger(final String name, final Class<? extends MessageFactory> messageFactoryClass) { return getOrCreateInnerMap(factoryClassKey(messageFactoryClass)).containsKey(name); }
java
public boolean hasLogger(final String name, final Class<? extends MessageFactory> messageFactoryClass) { return getOrCreateInnerMap(factoryClassKey(messageFactoryClass)).containsKey(name); }
[ "public", "boolean", "hasLogger", "(", "final", "String", "name", ",", "final", "Class", "<", "?", "extends", "MessageFactory", ">", "messageFactoryClass", ")", "{", "return", "getOrCreateInnerMap", "(", "factoryClassKey", "(", "messageFactoryClass", ")", ")", "."...
Detects if a Logger with the specified name and MessageFactory type exists. @param name The Logger name to search for. @param messageFactoryClass The message factory class to search for. @return true if the Logger exists, false otherwise. @since 2.5
[ "Detects", "if", "a", "Logger", "with", "the", "specified", "name", "and", "MessageFactory", "type", "exists", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/spi/LoggerRegistry.java#L175-L177
micronaut-projects/micronaut-core
inject-java/src/main/java/io/micronaut/annotation/processing/ModelUtils.java
ModelUtils.isInheritedAndNotPublic
boolean isInheritedAndNotPublic(TypeElement concreteClass, TypeElement declaringClass, Element methodOrField) { PackageElement packageOfDeclaringClass = elementUtils.getPackageOf(declaringClass); PackageElement packageOfConcreteClass = elementUtils.getPackageOf(concreteClass); return declaringClass != concreteClass && !packageOfDeclaringClass.getQualifiedName().equals(packageOfConcreteClass.getQualifiedName()) && (isProtected(methodOrField) || !isPublic(methodOrField)); }
java
boolean isInheritedAndNotPublic(TypeElement concreteClass, TypeElement declaringClass, Element methodOrField) { PackageElement packageOfDeclaringClass = elementUtils.getPackageOf(declaringClass); PackageElement packageOfConcreteClass = elementUtils.getPackageOf(concreteClass); return declaringClass != concreteClass && !packageOfDeclaringClass.getQualifiedName().equals(packageOfConcreteClass.getQualifiedName()) && (isProtected(methodOrField) || !isPublic(methodOrField)); }
[ "boolean", "isInheritedAndNotPublic", "(", "TypeElement", "concreteClass", ",", "TypeElement", "declaringClass", ",", "Element", "methodOrField", ")", "{", "PackageElement", "packageOfDeclaringClass", "=", "elementUtils", ".", "getPackageOf", "(", "declaringClass", ")", "...
Return whether the given method or field is inherited but not public. @param concreteClass The concrete class @param declaringClass The declaring class of the field @param methodOrField The method or field @return True if it is inherited and not public
[ "Return", "whether", "the", "given", "method", "or", "field", "is", "inherited", "but", "not", "public", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject-java/src/main/java/io/micronaut/annotation/processing/ModelUtils.java#L419-L426
mgm-tp/jfunk
jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java
WebDriverTool.sendKeys
public void sendKeys(final By by, final CharSequence... keysToSend) { checkTopmostElement(by); findElement(by).sendKeys(keysToSend); }
java
public void sendKeys(final By by, final CharSequence... keysToSend) { checkTopmostElement(by); findElement(by).sendKeys(keysToSend); }
[ "public", "void", "sendKeys", "(", "final", "By", "by", ",", "final", "CharSequence", "...", "keysToSend", ")", "{", "checkTopmostElement", "(", "by", ")", ";", "findElement", "(", "by", ")", ".", "sendKeys", "(", "keysToSend", ")", ";", "}" ]
Delegates to {@link #findElement(By)} and calls {@link WebElement#sendKeys(CharSequence...) sendKeys(CharSequence...)} on the returned element. @param by the {@link By} used to locate the element @param keysToSend the keys to send
[ "Delegates", "to", "{", "@link", "#findElement", "(", "By", ")", "}", "and", "calls", "{", "@link", "WebElement#sendKeys", "(", "CharSequence", "...", ")", "sendKeys", "(", "CharSequence", "...", ")", "}", "on", "the", "returned", "element", "." ]
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java#L407-L410
ops4j/org.ops4j.pax.wicket
service/src/main/java/org/ops4j/pax/wicket/api/support/DefaultPageMounter.java
DefaultPageMounter.register
public void register() { LOGGER.debug("Register mount tracker as OSGi service"); synchronized (this) { if (serviceRegistration != null) { throw new IllegalStateException(String.format("%s [%s] had been already registered.", getClass() .getSimpleName(), this)); } serviceRegistration = bundleContext.registerService(SERVICE_CLASSES, this, properties); } }
java
public void register() { LOGGER.debug("Register mount tracker as OSGi service"); synchronized (this) { if (serviceRegistration != null) { throw new IllegalStateException(String.format("%s [%s] had been already registered.", getClass() .getSimpleName(), this)); } serviceRegistration = bundleContext.registerService(SERVICE_CLASSES, this, properties); } }
[ "public", "void", "register", "(", ")", "{", "LOGGER", ".", "debug", "(", "\"Register mount tracker as OSGi service\"", ")", ";", "synchronized", "(", "this", ")", "{", "if", "(", "serviceRegistration", "!=", "null", ")", "{", "throw", "new", "IllegalStateExcept...
Automatically regsiteres the {@link org.ops4j.pax.wicket.api.PageMounter} as OSGi service
[ "Automatically", "regsiteres", "the", "{" ]
train
https://github.com/ops4j/org.ops4j.pax.wicket/blob/ef7cb4bdf918e9e61ec69789b9c690567616faa9/service/src/main/java/org/ops4j/pax/wicket/api/support/DefaultPageMounter.java#L72-L82
CloudSlang/cs-actions
cs-commons/src/main/java/io/cloudslang/content/utils/NumberUtilities.java
NumberUtilities.toLong
public static long toLong(@Nullable final String longStr, final long defaultLong) { return StringUtils.isNoneEmpty(longStr) ? toLong(longStr) : defaultLong; }
java
public static long toLong(@Nullable final String longStr, final long defaultLong) { return StringUtils.isNoneEmpty(longStr) ? toLong(longStr) : defaultLong; }
[ "public", "static", "long", "toLong", "(", "@", "Nullable", "final", "String", "longStr", ",", "final", "long", "defaultLong", ")", "{", "return", "StringUtils", ".", "isNoneEmpty", "(", "longStr", ")", "?", "toLong", "(", "longStr", ")", ":", "defaultLong",...
If the long integer string is null or empty, it returns the defaultLong otherwise it returns the long integer value (see toLong) @param longStr the long integer to convert @param defaultLong the default value if the longStr is null or the empty string @return the long integer value of the string or the defaultLong if the long integer string is empty @throws IllegalArgumentException if the passed long integer string is not a valid long integer
[ "If", "the", "long", "integer", "string", "is", "null", "or", "empty", "it", "returns", "the", "defaultLong", "otherwise", "it", "returns", "the", "long", "integer", "value", "(", "see", "toLong", ")" ]
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-commons/src/main/java/io/cloudslang/content/utils/NumberUtilities.java#L198-L200
albfernandez/itext2
src/main/java/com/lowagie/text/SimpleCell.java
SimpleCell.addElement
public void addElement(Element element) throws BadElementException { if (cellgroup) { if (element instanceof SimpleCell) { if(((SimpleCell)element).isCellgroup()) { throw new BadElementException("You can't add one row to another row."); } content.add(element); return; } else { throw new BadElementException("You can only add cells to rows, no objects of type " + element.getClass().getName()); } } if (element.type() == Element.PARAGRAPH || element.type() == Element.PHRASE || element.type() == Element.ANCHOR || element.type() == Element.CHUNK || element.type() == Element.LIST || element.type() == Element.MARKED || element.type() == Element.JPEG || element.type() == Element.JPEG2000 || element.type() == Element.JBIG2 || element.type() == Element.IMGRAW || element.type() == Element.IMGTEMPLATE) { content.add(element); } else { throw new BadElementException("You can't add an element of type " + element.getClass().getName() + " to a SimpleCell."); } }
java
public void addElement(Element element) throws BadElementException { if (cellgroup) { if (element instanceof SimpleCell) { if(((SimpleCell)element).isCellgroup()) { throw new BadElementException("You can't add one row to another row."); } content.add(element); return; } else { throw new BadElementException("You can only add cells to rows, no objects of type " + element.getClass().getName()); } } if (element.type() == Element.PARAGRAPH || element.type() == Element.PHRASE || element.type() == Element.ANCHOR || element.type() == Element.CHUNK || element.type() == Element.LIST || element.type() == Element.MARKED || element.type() == Element.JPEG || element.type() == Element.JPEG2000 || element.type() == Element.JBIG2 || element.type() == Element.IMGRAW || element.type() == Element.IMGTEMPLATE) { content.add(element); } else { throw new BadElementException("You can't add an element of type " + element.getClass().getName() + " to a SimpleCell."); } }
[ "public", "void", "addElement", "(", "Element", "element", ")", "throws", "BadElementException", "{", "if", "(", "cellgroup", ")", "{", "if", "(", "element", "instanceof", "SimpleCell", ")", "{", "if", "(", "(", "(", "SimpleCell", ")", "element", ")", ".",...
Adds content to this object. @param element @throws BadElementException
[ "Adds", "content", "to", "this", "object", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/SimpleCell.java#L132-L161
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmetryAxes.java
SymmetryAxes.getSymmetryAxes
private void getSymmetryAxes(List<Axis> symmAxes, Matrix4d prior, int level, int firstRepeat) { if(level >= getNumLevels() ) { return; } Axis elem = axes.get(level); Matrix4d elemOp = elem.getOperator(); // Current axis: // elementary maps B -> A // prior maps I -> A and J -> B // want J -> I = J -> B -> A <- I= inv(prior) * elementary * prior Matrix4d currAxisOp = new Matrix4d(prior); currAxisOp.invert(); currAxisOp.mul(elemOp); currAxisOp.mul(prior); Axis currAxis = new Axis(currAxisOp,elem.getOrder(),elem.getSymmType(),level,firstRepeat); symmAxes.add(currAxis); //Remember that all degrees are at least 2 getSymmetryAxes(symmAxes,prior,level+1,firstRepeat); //New prior is elementary^d*prior Matrix4d newPrior = new Matrix4d(elemOp); newPrior.mul(prior); int childSize = getNumRepeats(level+1); getSymmetryAxes(symmAxes,newPrior,level+1,firstRepeat+childSize); for(int d=2;d<elem.getOrder();d++) { newPrior.mul(elemOp,newPrior); getSymmetryAxes(symmAxes,newPrior,level+1,firstRepeat+childSize*d); } }
java
private void getSymmetryAxes(List<Axis> symmAxes, Matrix4d prior, int level, int firstRepeat) { if(level >= getNumLevels() ) { return; } Axis elem = axes.get(level); Matrix4d elemOp = elem.getOperator(); // Current axis: // elementary maps B -> A // prior maps I -> A and J -> B // want J -> I = J -> B -> A <- I= inv(prior) * elementary * prior Matrix4d currAxisOp = new Matrix4d(prior); currAxisOp.invert(); currAxisOp.mul(elemOp); currAxisOp.mul(prior); Axis currAxis = new Axis(currAxisOp,elem.getOrder(),elem.getSymmType(),level,firstRepeat); symmAxes.add(currAxis); //Remember that all degrees are at least 2 getSymmetryAxes(symmAxes,prior,level+1,firstRepeat); //New prior is elementary^d*prior Matrix4d newPrior = new Matrix4d(elemOp); newPrior.mul(prior); int childSize = getNumRepeats(level+1); getSymmetryAxes(symmAxes,newPrior,level+1,firstRepeat+childSize); for(int d=2;d<elem.getOrder();d++) { newPrior.mul(elemOp,newPrior); getSymmetryAxes(symmAxes,newPrior,level+1,firstRepeat+childSize*d); } }
[ "private", "void", "getSymmetryAxes", "(", "List", "<", "Axis", ">", "symmAxes", ",", "Matrix4d", "prior", ",", "int", "level", ",", "int", "firstRepeat", ")", "{", "if", "(", "level", ">=", "getNumLevels", "(", ")", ")", "{", "return", ";", "}", "Axis...
Recursive helper @param symmAxes output list @param prior transformation aligning the first repeat of this axis with the first overall @param level current level
[ "Recursive", "helper" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmetryAxes.java#L469-L499
whitesource/fs-agent
src/main/java/org/whitesource/scm/ScmConnector.java
ScmConnector.cloneRepository
public File cloneRepository() { String scmTempFolder = new FilesUtils().createTmpFolder(false, TempFolders.UNIQUE_SCM_TEMP_FOLDER); cloneDirectory = new File(scmTempFolder, getType().toString().toLowerCase() + Constants.UNDERSCORE + getUrlName() + Constants.UNDERSCORE + getBranch()); FilesUtils.deleteDirectory(cloneDirectory); // delete just in case it's not empty logger.info("Cloning repository {} ...this may take a few minutes", getUrl()); File branchDirectory = cloneRepository(cloneDirectory); return branchDirectory; }
java
public File cloneRepository() { String scmTempFolder = new FilesUtils().createTmpFolder(false, TempFolders.UNIQUE_SCM_TEMP_FOLDER); cloneDirectory = new File(scmTempFolder, getType().toString().toLowerCase() + Constants.UNDERSCORE + getUrlName() + Constants.UNDERSCORE + getBranch()); FilesUtils.deleteDirectory(cloneDirectory); // delete just in case it's not empty logger.info("Cloning repository {} ...this may take a few minutes", getUrl()); File branchDirectory = cloneRepository(cloneDirectory); return branchDirectory; }
[ "public", "File", "cloneRepository", "(", ")", "{", "String", "scmTempFolder", "=", "new", "FilesUtils", "(", ")", ".", "createTmpFolder", "(", "false", ",", "TempFolders", ".", "UNIQUE_SCM_TEMP_FOLDER", ")", ";", "cloneDirectory", "=", "new", "File", "(", "sc...
Clones the given repository. @return The folder in which the specific branch/tag resides.
[ "Clones", "the", "given", "repository", "." ]
train
https://github.com/whitesource/fs-agent/blob/d6ee4842c4f08f4aeda7eb2307b24c49b6bed0e1/src/main/java/org/whitesource/scm/ScmConnector.java#L85-L94
abola/CrawlerPack
src/main/java/com/github/abola/crawler/CrawlerPack.java
CrawlerPack.addCookie
public CrawlerPack addCookie(String name, String value){ if( null == name ) { log.warn("addCookie: Cookie name null."); return this; } cookies.add( new Cookie("", name, value) ); return this; }
java
public CrawlerPack addCookie(String name, String value){ if( null == name ) { log.warn("addCookie: Cookie name null."); return this; } cookies.add( new Cookie("", name, value) ); return this; }
[ "public", "CrawlerPack", "addCookie", "(", "String", "name", ",", "String", "value", ")", "{", "if", "(", "null", "==", "name", ")", "{", "log", ".", "warn", "(", "\"addCookie: Cookie name null.\"", ")", ";", "return", "this", ";", "}", "cookies", ".", "...
Creates a cookie with the given name and value. @param name the cookie name @param value the cookie value @return CrawlerPack
[ "Creates", "a", "cookie", "with", "the", "given", "name", "and", "value", "." ]
train
https://github.com/abola/CrawlerPack/blob/a7b7703b7fad519994dc04a9c51d90adc11d618f/src/main/java/com/github/abola/crawler/CrawlerPack.java#L113-L122
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java
Frame.getInstance
public ValueType getInstance(Instruction ins, ConstantPoolGen cpg) throws DataflowAnalysisException { return getStackValue(getInstanceStackLocation(ins, cpg)); }
java
public ValueType getInstance(Instruction ins, ConstantPoolGen cpg) throws DataflowAnalysisException { return getStackValue(getInstanceStackLocation(ins, cpg)); }
[ "public", "ValueType", "getInstance", "(", "Instruction", "ins", ",", "ConstantPoolGen", "cpg", ")", "throws", "DataflowAnalysisException", "{", "return", "getStackValue", "(", "getInstanceStackLocation", "(", "ins", ",", "cpg", ")", ")", ";", "}" ]
Get the value corresponding to the object instance used in the given instruction. This relies on the observation that in instructions which use an object instance (such as getfield, invokevirtual, etc.), the object instance is the first operand used by the instruction. @param ins the instruction @param cpg the ConstantPoolGen for the method
[ "Get", "the", "value", "corresponding", "to", "the", "object", "instance", "used", "in", "the", "given", "instruction", ".", "This", "relies", "on", "the", "observation", "that", "in", "instructions", "which", "use", "an", "object", "instance", "(", "such", ...
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java#L282-L284
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/metadata/ModificationBuilderTarget.java
ModificationBuilderTarget.removeBundle
public T removeBundle(final String moduleName, final String slot, final byte[] existingHash) { final ContentItem item = createBundleItem(moduleName, slot, NO_CONTENT); addContentModification(createContentModification(item, ModificationType.REMOVE, existingHash)); return returnThis(); }
java
public T removeBundle(final String moduleName, final String slot, final byte[] existingHash) { final ContentItem item = createBundleItem(moduleName, slot, NO_CONTENT); addContentModification(createContentModification(item, ModificationType.REMOVE, existingHash)); return returnThis(); }
[ "public", "T", "removeBundle", "(", "final", "String", "moduleName", ",", "final", "String", "slot", ",", "final", "byte", "[", "]", "existingHash", ")", "{", "final", "ContentItem", "item", "=", "createBundleItem", "(", "moduleName", ",", "slot", ",", "NO_C...
Remove a bundle. @param moduleName the module name @param slot the module slot @param existingHash the existing hash @return the builder
[ "Remove", "a", "bundle", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/metadata/ModificationBuilderTarget.java#L101-L105
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java
SDMath.logSumExp
public SDVariable logSumExp(String name, SDVariable input, int... dimensions) { validateNumerical("logSumExp reduction", input); SDVariable ret = f().logSumExp(input, dimensions); return updateVariableNameAndReference(ret, name); }
java
public SDVariable logSumExp(String name, SDVariable input, int... dimensions) { validateNumerical("logSumExp reduction", input); SDVariable ret = f().logSumExp(input, dimensions); return updateVariableNameAndReference(ret, name); }
[ "public", "SDVariable", "logSumExp", "(", "String", "name", ",", "SDVariable", "input", ",", "int", "...", "dimensions", ")", "{", "validateNumerical", "(", "\"logSumExp reduction\"", ",", "input", ")", ";", "SDVariable", "ret", "=", "f", "(", ")", ".", "log...
Log-sum-exp reduction (optionally along dimension). Computes log(sum(exp(x)) @param name Name of the output variable @param input Input variable @param dimensions Optional dimensions to reduce along @return Output variable
[ "Log", "-", "sum", "-", "exp", "reduction", "(", "optionally", "along", "dimension", ")", ".", "Computes", "log", "(", "sum", "(", "exp", "(", "x", "))" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java#L1634-L1638
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/interest/FactoryInterestPointAlgs.java
FactoryInterestPointAlgs.hessianPyramid
public static <T extends ImageGray<T>, D extends ImageGray<D>> FeaturePyramid<T, D> hessianPyramid(int extractRadius, float detectThreshold, int maxFeatures, Class<T> imageType, Class<D> derivType) { GeneralFeatureIntensity<T, D> intensity = new WrapperHessianBlobIntensity<>(HessianBlobIntensity.Type.DETERMINANT, derivType); NonMaxSuppression extractor = FactoryFeatureExtractor.nonmax( new ConfigExtract(extractRadius, detectThreshold, extractRadius, true)); GeneralFeatureDetector<T, D> detector = new GeneralFeatureDetector<>(intensity, extractor); detector.setMaxFeatures(maxFeatures); AnyImageDerivative<T, D> deriv = GImageDerivativeOps.derivativeForScaleSpace(imageType, derivType); return new FeaturePyramid<>(detector, deriv, 2); }
java
public static <T extends ImageGray<T>, D extends ImageGray<D>> FeaturePyramid<T, D> hessianPyramid(int extractRadius, float detectThreshold, int maxFeatures, Class<T> imageType, Class<D> derivType) { GeneralFeatureIntensity<T, D> intensity = new WrapperHessianBlobIntensity<>(HessianBlobIntensity.Type.DETERMINANT, derivType); NonMaxSuppression extractor = FactoryFeatureExtractor.nonmax( new ConfigExtract(extractRadius, detectThreshold, extractRadius, true)); GeneralFeatureDetector<T, D> detector = new GeneralFeatureDetector<>(intensity, extractor); detector.setMaxFeatures(maxFeatures); AnyImageDerivative<T, D> deriv = GImageDerivativeOps.derivativeForScaleSpace(imageType, derivType); return new FeaturePyramid<>(detector, deriv, 2); }
[ "public", "static", "<", "T", "extends", "ImageGray", "<", "T", ">", ",", "D", "extends", "ImageGray", "<", "D", ">", ">", "FeaturePyramid", "<", "T", ",", "D", ">", "hessianPyramid", "(", "int", "extractRadius", ",", "float", "detectThreshold", ",", "in...
Creates a {@link FeaturePyramid} which is uses a hessian blob detector. @param extractRadius Size of the feature used to detect the corners. @param detectThreshold Minimum corner intensity required @param maxFeatures Max number of features that can be found. @param imageType Type of input image. @param derivType Image derivative type. @return CornerLaplaceScaleSpace
[ "Creates", "a", "{", "@link", "FeaturePyramid", "}", "which", "is", "uses", "a", "hessian", "blob", "detector", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/interest/FactoryInterestPointAlgs.java#L60-L75
vvakame/JsonPullParser
jsonpullparser-apt/src/main/java/net/vvakame/util/jsonpullparser/factory/template/MvelTemplate.java
MvelTemplate.writeGen
public static void writeGen(JavaFileObject fileObject, JsonModelModel model) throws IOException { Map<String, Object> map = convModelToMap(model); Writer writer = fileObject.openWriter(); PrintWriter printWriter = new PrintWriter(writer); String generated = (String) TemplateRuntime.eval(getTemplateString("JsonModelGen.java.mvel"), map); try { printWriter.write(generated); printWriter.flush(); printWriter.close(); } catch (Exception e) { throw new RuntimeException("error raised in process " + model.getTarget(), e); } }
java
public static void writeGen(JavaFileObject fileObject, JsonModelModel model) throws IOException { Map<String, Object> map = convModelToMap(model); Writer writer = fileObject.openWriter(); PrintWriter printWriter = new PrintWriter(writer); String generated = (String) TemplateRuntime.eval(getTemplateString("JsonModelGen.java.mvel"), map); try { printWriter.write(generated); printWriter.flush(); printWriter.close(); } catch (Exception e) { throw new RuntimeException("error raised in process " + model.getTarget(), e); } }
[ "public", "static", "void", "writeGen", "(", "JavaFileObject", "fileObject", ",", "JsonModelModel", "model", ")", "throws", "IOException", "{", "Map", "<", "String", ",", "Object", ">", "map", "=", "convModelToMap", "(", "model", ")", ";", "Writer", "writer", ...
Generates source code into the given file object from the given data model, utilizing the templating engine. @param fileObject Target file object @param model Data model for source code generation @throws IOException @author vvakame
[ "Generates", "source", "code", "into", "the", "given", "file", "object", "from", "the", "given", "data", "model", "utilizing", "the", "templating", "engine", "." ]
train
https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-apt/src/main/java/net/vvakame/util/jsonpullparser/factory/template/MvelTemplate.java#L55-L69
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java
CommerceCountryPersistenceImpl.findAll
@Override public List<CommerceCountry> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CommerceCountry> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CommerceCountry", ">", "findAll", "(", ")", "{", "return", "findAll", "(", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the commerce countries. @return the commerce countries
[ "Returns", "all", "the", "commerce", "countries", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java#L4980-L4983
alkacon/opencms-core
src/org/opencms/main/OpenCmsServlet.java
OpenCmsServlet.doGet
@Override public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { currentRequest.set(req); try { // check to OpenCms runlevel int runlevel = OpenCmsCore.getInstance().getRunLevel(); // write OpenCms server identification in the response header res.setHeader(CmsRequestUtil.HEADER_SERVER, OpenCmsCore.getInstance().getSystemInfo().getVersion()); if (runlevel != OpenCms.RUNLEVEL_4_SERVLET_ACCESS) { // not the "normal" servlet runlevel if (runlevel == OpenCms.RUNLEVEL_3_SHELL_ACCESS) { // we have shell runlevel only, upgrade to servlet runlevel (required after setup wizard) init(getServletConfig()); } else { // illegal runlevel, we can't process requests // sending status code 403, indicating the server understood the request but refused to fulfill it res.sendError(HttpServletResponse.SC_FORBIDDEN); // goodbye return; } } String path = OpenCmsCore.getInstance().getPathInfo(req); if (path.startsWith(HANDLE_PATH)) { // this is a request to an OpenCms handler URI invokeHandler(req, res); } else if (path.endsWith(HANDLE_GWT)) { // handle GWT rpc services String serviceName = CmsResource.getName(path); serviceName = serviceName.substring(0, serviceName.length() - HANDLE_GWT.length()); OpenCmsCore.getInstance().invokeGwtService(serviceName, req, res, getServletConfig()); } else { // standard request to a URI in the OpenCms VFS OpenCmsCore.getInstance().showResource(req, res); } } finally { currentRequest.remove(); } }
java
@Override public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { currentRequest.set(req); try { // check to OpenCms runlevel int runlevel = OpenCmsCore.getInstance().getRunLevel(); // write OpenCms server identification in the response header res.setHeader(CmsRequestUtil.HEADER_SERVER, OpenCmsCore.getInstance().getSystemInfo().getVersion()); if (runlevel != OpenCms.RUNLEVEL_4_SERVLET_ACCESS) { // not the "normal" servlet runlevel if (runlevel == OpenCms.RUNLEVEL_3_SHELL_ACCESS) { // we have shell runlevel only, upgrade to servlet runlevel (required after setup wizard) init(getServletConfig()); } else { // illegal runlevel, we can't process requests // sending status code 403, indicating the server understood the request but refused to fulfill it res.sendError(HttpServletResponse.SC_FORBIDDEN); // goodbye return; } } String path = OpenCmsCore.getInstance().getPathInfo(req); if (path.startsWith(HANDLE_PATH)) { // this is a request to an OpenCms handler URI invokeHandler(req, res); } else if (path.endsWith(HANDLE_GWT)) { // handle GWT rpc services String serviceName = CmsResource.getName(path); serviceName = serviceName.substring(0, serviceName.length() - HANDLE_GWT.length()); OpenCmsCore.getInstance().invokeGwtService(serviceName, req, res, getServletConfig()); } else { // standard request to a URI in the OpenCms VFS OpenCmsCore.getInstance().showResource(req, res); } } finally { currentRequest.remove(); } }
[ "@", "Override", "public", "void", "doGet", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ")", "throws", "IOException", ",", "ServletException", "{", "currentRequest", ".", "set", "(", "req", ")", ";", "try", "{", "// check to OpenCms runlev...
OpenCms servlet main request handling method.<p> @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
[ "OpenCms", "servlet", "main", "request", "handling", "method", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/OpenCmsServlet.java#L124-L166
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/calendar/CalendarRecordItem.java
CalendarRecordItem.init
public void init(BaseScreen gridScreen, int iIconField, int iStartDateTimeField, int iEndDateTimeField, int iDescriptionField, int iStatusField) { m_gridScreen = gridScreen; m_iDescriptionField = iDescriptionField; m_iStartDateTimeField = iStartDateTimeField; m_iEndDateTimeField = iEndDateTimeField; m_iStatusField = iStatusField; m_iIconField = iIconField; }
java
public void init(BaseScreen gridScreen, int iIconField, int iStartDateTimeField, int iEndDateTimeField, int iDescriptionField, int iStatusField) { m_gridScreen = gridScreen; m_iDescriptionField = iDescriptionField; m_iStartDateTimeField = iStartDateTimeField; m_iEndDateTimeField = iEndDateTimeField; m_iStatusField = iStatusField; m_iIconField = iIconField; }
[ "public", "void", "init", "(", "BaseScreen", "gridScreen", ",", "int", "iIconField", ",", "int", "iStartDateTimeField", ",", "int", "iEndDateTimeField", ",", "int", "iDescriptionField", ",", "int", "iStatusField", ")", "{", "m_gridScreen", "=", "gridScreen", ";", ...
Constructor. @param gridScreen The screen. @param iIconField The location of the icon field. @param iStartDateTimeField The location of the start time. @param iEndDateTimeField The location of the end time. @param iDescriptionField The location of the description. @param iStatusField The location of the status.
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/calendar/CalendarRecordItem.java#L74-L82
wildfly/wildfly-core
security-manager/src/main/java/org/wildfly/extension/security/manager/deployment/PermissionsParser.java
PermissionsParser.missingRequiredElement
private static XMLStreamException missingRequiredElement(final XMLStreamReader reader, final Set<?> required) { final StringBuilder builder = new StringBuilder(); Iterator<?> iterator = required.iterator(); while (iterator.hasNext()) { final Object o = iterator.next(); builder.append(o.toString()); if (iterator.hasNext()) { builder.append(", "); } } return SecurityManagerLogger.ROOT_LOGGER.missingRequiredElements(builder, reader.getLocation()); }
java
private static XMLStreamException missingRequiredElement(final XMLStreamReader reader, final Set<?> required) { final StringBuilder builder = new StringBuilder(); Iterator<?> iterator = required.iterator(); while (iterator.hasNext()) { final Object o = iterator.next(); builder.append(o.toString()); if (iterator.hasNext()) { builder.append(", "); } } return SecurityManagerLogger.ROOT_LOGGER.missingRequiredElements(builder, reader.getLocation()); }
[ "private", "static", "XMLStreamException", "missingRequiredElement", "(", "final", "XMLStreamReader", "reader", ",", "final", "Set", "<", "?", ">", "required", ")", "{", "final", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "Iterator", ...
Get an exception reporting missing required XML element(s). @param reader a reference to the stream reader. @param required a set of enums whose toString method returns the element name. @return the constructed {@link javax.xml.stream.XMLStreamException}.
[ "Get", "an", "exception", "reporting", "missing", "required", "XML", "element", "(", "s", ")", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/security-manager/src/main/java/org/wildfly/extension/security/manager/deployment/PermissionsParser.java#L317-L328
lucee/Lucee
core/src/main/java/lucee/runtime/registry/RegistryQuery.java
RegistryQuery.deleteValue
public static void deleteValue(String branch, String entry) throws IOException, InterruptedException { if (entry == null) { String[] cmd = new String[] { "reg", "delete", cleanBrunch(branch), "/f" }; executeQuery(cmd); // executeQuery("reg delete \""+List.trim(branch,"\\")+"\" /f"); } else { String[] cmd = new String[] { "reg", "delete", cleanBrunch(branch), "/v", entry, "/f" }; executeQuery(cmd); // executeQuery("reg delete \""+List.trim(branch,"\\")+"\" /v "+entry+" /f"); } }
java
public static void deleteValue(String branch, String entry) throws IOException, InterruptedException { if (entry == null) { String[] cmd = new String[] { "reg", "delete", cleanBrunch(branch), "/f" }; executeQuery(cmd); // executeQuery("reg delete \""+List.trim(branch,"\\")+"\" /f"); } else { String[] cmd = new String[] { "reg", "delete", cleanBrunch(branch), "/v", entry, "/f" }; executeQuery(cmd); // executeQuery("reg delete \""+List.trim(branch,"\\")+"\" /v "+entry+" /f"); } }
[ "public", "static", "void", "deleteValue", "(", "String", "branch", ",", "String", "entry", ")", "throws", "IOException", ",", "InterruptedException", "{", "if", "(", "entry", "==", "null", ")", "{", "String", "[", "]", "cmd", "=", "new", "String", "[", ...
deletes a value or a key @param branch @param entry @throws IOException @throws InterruptedException
[ "deletes", "a", "value", "or", "a", "key" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/registry/RegistryQuery.java#L124-L135
lucee/Lucee
core/src/main/java/lucee/runtime/config/ConfigImpl.java
ConfigImpl.setFLDs
protected void setFLDs(FunctionLib[] flds, int dialect) { if (dialect == CFMLEngine.DIALECT_CFML) { cfmlFlds = flds; combinedCFMLFLDs = null; // TODO improve check (hash) } else { luceeFlds = flds; combinedLuceeFLDs = null; // TODO improve check (hash) } }
java
protected void setFLDs(FunctionLib[] flds, int dialect) { if (dialect == CFMLEngine.DIALECT_CFML) { cfmlFlds = flds; combinedCFMLFLDs = null; // TODO improve check (hash) } else { luceeFlds = flds; combinedLuceeFLDs = null; // TODO improve check (hash) } }
[ "protected", "void", "setFLDs", "(", "FunctionLib", "[", "]", "flds", ",", "int", "dialect", ")", "{", "if", "(", "dialect", "==", "CFMLEngine", ".", "DIALECT_CFML", ")", "{", "cfmlFlds", "=", "flds", ";", "combinedCFMLFLDs", "=", "null", ";", "// TODO imp...
/* @Override public String[] getCFMLExtensions() { return getAllExtensions(); } @Override public String getCFCExtension() { return getComponentExtension(); } @Override public String[] getAllExtensions() { return Constants.ALL_EXTENSION; } @Override public String getComponentExtension() { return Constants.COMPONENT_EXTENSION; } @Override public String[] getTemplateExtensions() { return Constants.TEMPLATE_EXTENSIONS; }
[ "/", "*", "@Override", "public", "String", "[]", "getCFMLExtensions", "()", "{", "return", "getAllExtensions", "()", ";", "}" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/ConfigImpl.java#L531-L540
alkacon/opencms-core
src/org/opencms/flex/CmsFlexBucketConfiguration.java
CmsFlexBucketConfiguration.loadFromVfsFile
public static CmsFlexBucketConfiguration loadFromVfsFile(CmsObject cms, String path) throws CmsException { if (!cms.existsResource(path)) { return null; } CmsResource configRes = cms.readResource(path); if (configRes.isFolder()) { return null; } CmsFile configFile = cms.readFile(configRes); String encoding = CmsFileUtil.getEncoding(cms, configRes); Properties props = new Properties(); try { props.load(new InputStreamReader(new ByteArrayInputStream(configFile.getContents()), encoding)); return loadFromProperties(props); } catch (IOException e) { LOG.error(e.getLocalizedMessage(), e); } return null; }
java
public static CmsFlexBucketConfiguration loadFromVfsFile(CmsObject cms, String path) throws CmsException { if (!cms.existsResource(path)) { return null; } CmsResource configRes = cms.readResource(path); if (configRes.isFolder()) { return null; } CmsFile configFile = cms.readFile(configRes); String encoding = CmsFileUtil.getEncoding(cms, configRes); Properties props = new Properties(); try { props.load(new InputStreamReader(new ByteArrayInputStream(configFile.getContents()), encoding)); return loadFromProperties(props); } catch (IOException e) { LOG.error(e.getLocalizedMessage(), e); } return null; }
[ "public", "static", "CmsFlexBucketConfiguration", "loadFromVfsFile", "(", "CmsObject", "cms", ",", "String", "path", ")", "throws", "CmsException", "{", "if", "(", "!", "cms", ".", "existsResource", "(", "path", ")", ")", "{", "return", "null", ";", "}", "Cm...
Loads a flex bucket configuration from the OpenCms VFS.<p> @param cms the CMS context to use for VFS operations @param path the path of the resource @return the flex bucket configuration @throws CmsException if something goes wrong
[ "Loads", "a", "flex", "bucket", "configuration", "from", "the", "OpenCms", "VFS", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/flex/CmsFlexBucketConfiguration.java#L203-L222
Azure/azure-sdk-for-java
marketplaceordering/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/marketplaceordering/v2015_06_01/implementation/MarketplaceAgreementsInner.java
MarketplaceAgreementsInner.signAsync
public Observable<AgreementTermsInner> signAsync(String publisherId, String offerId, String planId) { return signWithServiceResponseAsync(publisherId, offerId, planId).map(new Func1<ServiceResponse<AgreementTermsInner>, AgreementTermsInner>() { @Override public AgreementTermsInner call(ServiceResponse<AgreementTermsInner> response) { return response.body(); } }); }
java
public Observable<AgreementTermsInner> signAsync(String publisherId, String offerId, String planId) { return signWithServiceResponseAsync(publisherId, offerId, planId).map(new Func1<ServiceResponse<AgreementTermsInner>, AgreementTermsInner>() { @Override public AgreementTermsInner call(ServiceResponse<AgreementTermsInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AgreementTermsInner", ">", "signAsync", "(", "String", "publisherId", ",", "String", "offerId", ",", "String", "planId", ")", "{", "return", "signWithServiceResponseAsync", "(", "publisherId", ",", "offerId", ",", "planId", ")", ".", ...
Sign marketplace terms. @param publisherId Publisher identifier string of image being deployed. @param offerId Offer identifier string of image being deployed. @param planId Plan identifier string of image being deployed. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AgreementTermsInner object
[ "Sign", "marketplace", "terms", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/marketplaceordering/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/marketplaceordering/v2015_06_01/implementation/MarketplaceAgreementsInner.java#L322-L329
ehcache/ehcache3
impl/src/main/java/org/ehcache/impl/config/serializer/DefaultSerializationProviderConfiguration.java
DefaultSerializationProviderConfiguration.addSerializerFor
public <T> DefaultSerializationProviderConfiguration addSerializerFor(Class<T> serializableClass, Class<? extends Serializer<T>> serializerClass, boolean overwrite) { if (serializableClass == null) { throw new NullPointerException("Serializable class cannot be null"); } if (serializerClass == null) { throw new NullPointerException("Serializer class cannot be null"); } if(!isConstructorPresent(serializerClass, ClassLoader.class)) { throw new IllegalArgumentException("The serializer: " + serializerClass.getName() + " does not have a constructor that takes in a ClassLoader."); } if (isConstructorPresent(serializerClass, ClassLoader.class, FileBasedPersistenceContext.class)) { LOGGER.warn(serializerClass.getName() + " class has a constructor that takes in a FileBasedPersistenceContext. " + "Support for this constructor has been removed since version 3.2. Consider removing it."); } if (defaultSerializers.containsKey(serializableClass) && !overwrite) { throw new IllegalArgumentException("Duplicate serializer for class : " + serializableClass.getName()); } else { defaultSerializers.put(serializableClass, serializerClass); } return this; }
java
public <T> DefaultSerializationProviderConfiguration addSerializerFor(Class<T> serializableClass, Class<? extends Serializer<T>> serializerClass, boolean overwrite) { if (serializableClass == null) { throw new NullPointerException("Serializable class cannot be null"); } if (serializerClass == null) { throw new NullPointerException("Serializer class cannot be null"); } if(!isConstructorPresent(serializerClass, ClassLoader.class)) { throw new IllegalArgumentException("The serializer: " + serializerClass.getName() + " does not have a constructor that takes in a ClassLoader."); } if (isConstructorPresent(serializerClass, ClassLoader.class, FileBasedPersistenceContext.class)) { LOGGER.warn(serializerClass.getName() + " class has a constructor that takes in a FileBasedPersistenceContext. " + "Support for this constructor has been removed since version 3.2. Consider removing it."); } if (defaultSerializers.containsKey(serializableClass) && !overwrite) { throw new IllegalArgumentException("Duplicate serializer for class : " + serializableClass.getName()); } else { defaultSerializers.put(serializableClass, serializerClass); } return this; }
[ "public", "<", "T", ">", "DefaultSerializationProviderConfiguration", "addSerializerFor", "(", "Class", "<", "T", ">", "serializableClass", ",", "Class", "<", "?", "extends", "Serializer", "<", "T", ">", ">", "serializerClass", ",", "boolean", "overwrite", ")", ...
Adds a new {@link Serializer} mapping for the class {@code serializableClass} @param serializableClass the {@code Class} to add the mapping for @param serializerClass the {@link Serializer} type to use @param overwrite indicates if an existing mapping is to be overwritten @param <T> the type of instances to be serialized / deserialized @return this configuration object @throws NullPointerException if any argument is null @throws IllegalArgumentException if a mapping for {@code serializableClass} already exists and {@code overwrite} is {@code false}
[ "Adds", "a", "new", "{", "@link", "Serializer", "}", "mapping", "for", "the", "class", "{", "@code", "serializableClass", "}" ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/config/serializer/DefaultSerializationProviderConfiguration.java#L90-L114
virgo47/javasimon
core/src/main/java/org/javasimon/callback/timeline/StopwatchTimeRange.java
StopwatchTimeRange.addSplit
public void addSplit(long timestampInMs, long durationInNs) { last = durationInNs; total += durationInNs; squareTotal += durationInNs * durationInNs; if (durationInNs > max) { max = durationInNs; } if (durationInNs < min) { min = durationInNs; } counter++; lastTimestamp = timestampInMs; }
java
public void addSplit(long timestampInMs, long durationInNs) { last = durationInNs; total += durationInNs; squareTotal += durationInNs * durationInNs; if (durationInNs > max) { max = durationInNs; } if (durationInNs < min) { min = durationInNs; } counter++; lastTimestamp = timestampInMs; }
[ "public", "void", "addSplit", "(", "long", "timestampInMs", ",", "long", "durationInNs", ")", "{", "last", "=", "durationInNs", ";", "total", "+=", "durationInNs", ";", "squareTotal", "+=", "durationInNs", "*", "durationInNs", ";", "if", "(", "durationInNs", "...
Add stopwatch split information. @param timestampInMs when the split started, expressed in milliseconds @param durationInNs how long the split was, expressed in nanoseconds
[ "Add", "stopwatch", "split", "information", "." ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/timeline/StopwatchTimeRange.java#L42-L54
Azure/azure-sdk-for-java
eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/EventSubscriptionsInner.java
EventSubscriptionsInner.listByDomainTopicAsync
public Observable<List<EventSubscriptionInner>> listByDomainTopicAsync(String resourceGroupName, String domainName, String topicName) { return listByDomainTopicWithServiceResponseAsync(resourceGroupName, domainName, topicName).map(new Func1<ServiceResponse<List<EventSubscriptionInner>>, List<EventSubscriptionInner>>() { @Override public List<EventSubscriptionInner> call(ServiceResponse<List<EventSubscriptionInner>> response) { return response.body(); } }); }
java
public Observable<List<EventSubscriptionInner>> listByDomainTopicAsync(String resourceGroupName, String domainName, String topicName) { return listByDomainTopicWithServiceResponseAsync(resourceGroupName, domainName, topicName).map(new Func1<ServiceResponse<List<EventSubscriptionInner>>, List<EventSubscriptionInner>>() { @Override public List<EventSubscriptionInner> call(ServiceResponse<List<EventSubscriptionInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "EventSubscriptionInner", ">", ">", "listByDomainTopicAsync", "(", "String", "resourceGroupName", ",", "String", "domainName", ",", "String", "topicName", ")", "{", "return", "listByDomainTopicWithServiceResponseAsync", "(", "re...
List all event subscriptions for a specific domain topic. List all event subscriptions that have been created for a specific domain topic. @param resourceGroupName The name of the resource group within the user's subscription. @param domainName Name of the top level domain @param topicName Name of the domain topic @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;EventSubscriptionInner&gt; object
[ "List", "all", "event", "subscriptions", "for", "a", "specific", "domain", "topic", ".", "List", "all", "event", "subscriptions", "that", "have", "been", "created", "for", "a", "specific", "domain", "topic", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/EventSubscriptionsInner.java#L1707-L1714
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.updateStorageAccountAsync
public ServiceFuture<StorageBundle> updateStorageAccountAsync(String vaultBaseUrl, String storageAccountName, String activeKeyName, Boolean autoRegenerateKey, String regenerationPeriod, StorageAccountAttributes storageAccountAttributes, Map<String, String> tags, final ServiceCallback<StorageBundle> serviceCallback) { return ServiceFuture.fromResponse(updateStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName, activeKeyName, autoRegenerateKey, regenerationPeriod, storageAccountAttributes, tags), serviceCallback); }
java
public ServiceFuture<StorageBundle> updateStorageAccountAsync(String vaultBaseUrl, String storageAccountName, String activeKeyName, Boolean autoRegenerateKey, String regenerationPeriod, StorageAccountAttributes storageAccountAttributes, Map<String, String> tags, final ServiceCallback<StorageBundle> serviceCallback) { return ServiceFuture.fromResponse(updateStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName, activeKeyName, autoRegenerateKey, regenerationPeriod, storageAccountAttributes, tags), serviceCallback); }
[ "public", "ServiceFuture", "<", "StorageBundle", ">", "updateStorageAccountAsync", "(", "String", "vaultBaseUrl", ",", "String", "storageAccountName", ",", "String", "activeKeyName", ",", "Boolean", "autoRegenerateKey", ",", "String", "regenerationPeriod", ",", "StorageAc...
Updates the specified attributes associated with the given storage account. This operation requires the storage/set/update permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @param activeKeyName The current active storage account key name. @param autoRegenerateKey whether keyvault should manage the storage account for the user. @param regenerationPeriod The key regeneration time duration specified in ISO-8601 format. @param storageAccountAttributes The attributes of the storage account. @param tags Application specific metadata in the form of key-value pairs. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Updates", "the", "specified", "attributes", "associated", "with", "the", "given", "storage", "account", ".", "This", "operation", "requires", "the", "storage", "/", "set", "/", "update", "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#L10204-L10206
EsupPortail/esup-smsu-api
src/main/java/org/esupportail/smsuapi/business/stats/StatisticBuilder.java
StatisticBuilder.buildAllStatistics
public void buildAllStatistics() { for (Map<String,?> map : daoService.getAppsAndCountsToTreat()) { // get the date of older SMS for this app and account final Application application = (Application) map.get(Sms.PROP_APP); final Account account = (Account) map.get(Sms.PROP_ACC); final Date olderSmsDate = daoService.getDateOfOlderSmsByApplicationAndAccount(application, account); // if there is not at least 1 sms in db for the specified app / account, the // previous method returns null, so we have to check it. if (olderSmsDate != null) { // get the list of month where stats was not computed since the date of the older SMS in DB for (Date monthToComputeStats : getListOfMarkerDateForNonComputedStats(application, account, olderSmsDate)) { // compute the stats for this specific app, account and month buildStatisticForAMonth(application, account, monthToComputeStats); } } } }
java
public void buildAllStatistics() { for (Map<String,?> map : daoService.getAppsAndCountsToTreat()) { // get the date of older SMS for this app and account final Application application = (Application) map.get(Sms.PROP_APP); final Account account = (Account) map.get(Sms.PROP_ACC); final Date olderSmsDate = daoService.getDateOfOlderSmsByApplicationAndAccount(application, account); // if there is not at least 1 sms in db for the specified app / account, the // previous method returns null, so we have to check it. if (olderSmsDate != null) { // get the list of month where stats was not computed since the date of the older SMS in DB for (Date monthToComputeStats : getListOfMarkerDateForNonComputedStats(application, account, olderSmsDate)) { // compute the stats for this specific app, account and month buildStatisticForAMonth(application, account, monthToComputeStats); } } } }
[ "public", "void", "buildAllStatistics", "(", ")", "{", "for", "(", "Map", "<", "String", ",", "?", ">", "map", ":", "daoService", ".", "getAppsAndCountsToTreat", "(", ")", ")", "{", "// get the date of older SMS for this app and account\r", "final", "Application", ...
Build all non already computed statistic whatever the application, account or date.
[ "Build", "all", "non", "already", "computed", "statistic", "whatever", "the", "application", "account", "or", "date", "." ]
train
https://github.com/EsupPortail/esup-smsu-api/blob/7b6a4388065adfd84655dbc83f37080874953b20/src/main/java/org/esupportail/smsuapi/business/stats/StatisticBuilder.java#L40-L57
jeremiehuchet/acrachilisync
acrachilisync-core/src/main/java/fr/dudie/acrachilisync/utils/IssueDescriptionReader.java
IssueDescriptionReader.parseStacktrace
private String parseStacktrace(final String pDescription, final String pStacktraceMD5) throws IssueParseException { String stacktrace = null; // escape braces { and } to use strings in regexp final String start = "<pre class=\"javastacktrace\">"; final String qStart = Pattern.quote(start); final String end = "</pre>"; final String qEnd = Pattern.quote(end); final Pattern p = Pattern.compile(qStart + "(.*)" + qEnd, Pattern.DOTALL | Pattern.CASE_INSENSITIVE); final Matcher m = p.matcher(pDescription); if (m.find()) { stacktrace = m.group(1); // if a start tag or an end tag is found in the stacktrace, then there is a problem if (StringUtils.contains(stacktrace, start) || StringUtils.contains(stacktrace, end)) { throw new IssueParseException("Invalid stacktrace block"); } } else { throw new IssueParseException("0 stacktrace block found in the description"); } return stacktrace; }
java
private String parseStacktrace(final String pDescription, final String pStacktraceMD5) throws IssueParseException { String stacktrace = null; // escape braces { and } to use strings in regexp final String start = "<pre class=\"javastacktrace\">"; final String qStart = Pattern.quote(start); final String end = "</pre>"; final String qEnd = Pattern.quote(end); final Pattern p = Pattern.compile(qStart + "(.*)" + qEnd, Pattern.DOTALL | Pattern.CASE_INSENSITIVE); final Matcher m = p.matcher(pDescription); if (m.find()) { stacktrace = m.group(1); // if a start tag or an end tag is found in the stacktrace, then there is a problem if (StringUtils.contains(stacktrace, start) || StringUtils.contains(stacktrace, end)) { throw new IssueParseException("Invalid stacktrace block"); } } else { throw new IssueParseException("0 stacktrace block found in the description"); } return stacktrace; }
[ "private", "String", "parseStacktrace", "(", "final", "String", "pDescription", ",", "final", "String", "pStacktraceMD5", ")", "throws", "IssueParseException", "{", "String", "stacktrace", "=", "null", ";", "// escape braces { and } to use strings in regexp\r", "final", "...
Extracts the bug stacktrace from the description. @param pDescription the issue description @param pStacktraceMD5 the stacktrace MD5 hash the issue is related to @return the stacktrace @throws IssueParseException malformed issue description
[ "Extracts", "the", "bug", "stacktrace", "from", "the", "description", "." ]
train
https://github.com/jeremiehuchet/acrachilisync/blob/4eadb0218623e77e0d92b5a08515eea2db51e988/acrachilisync-core/src/main/java/fr/dudie/acrachilisync/utils/IssueDescriptionReader.java#L252-L278
gallandarakhneorg/afc
advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java
ZoomableGraphicsContext.fillRoundRect
public void fillRoundRect(double x, double y, double width, double height, double arcWidth, double arcHeight) { this.gc.fillRoundRect( doc2fxX(x), doc2fxY(y), doc2fxSize(width), doc2fxSize(height), doc2fxSize(arcWidth), doc2fxSize(arcHeight)); }
java
public void fillRoundRect(double x, double y, double width, double height, double arcWidth, double arcHeight) { this.gc.fillRoundRect( doc2fxX(x), doc2fxY(y), doc2fxSize(width), doc2fxSize(height), doc2fxSize(arcWidth), doc2fxSize(arcHeight)); }
[ "public", "void", "fillRoundRect", "(", "double", "x", ",", "double", "y", ",", "double", "width", ",", "double", "height", ",", "double", "arcWidth", ",", "double", "arcHeight", ")", "{", "this", ".", "gc", ".", "fillRoundRect", "(", "doc2fxX", "(", "x"...
Fills a rounded rectangle using the current fill paint. <p>This method will be affected by any of the global common or fill attributes as specified in the Rendering Attributes Table of {@link GraphicsContext}. @param x the X coordinate of the upper left bound of the oval. @param y the Y coordinate of the upper left bound of the oval. @param width the width at the center of the oval. @param height the height at the center of the oval. @param arcWidth the arc width of the rectangle corners. @param arcHeight the arc height of the rectangle corners.
[ "Fills", "a", "rounded", "rectangle", "using", "the", "current", "fill", "paint", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java#L1600-L1605
cdapio/tephra
tephra-core/src/main/java/co/cask/tephra/util/TxUtils.java
TxUtils.getOldestVisibleTimestamp
public static long getOldestVisibleTimestamp(Map<byte[], Long> ttlByFamily, Transaction tx) { long maxTTL = getMaxTTL(ttlByFamily); // we know that data will not be cleaned up while this tx is running up to this point as janitor uses it return maxTTL < Long.MAX_VALUE ? tx.getVisibilityUpperBound() - maxTTL * TxConstants.MAX_TX_PER_MS : 0; }
java
public static long getOldestVisibleTimestamp(Map<byte[], Long> ttlByFamily, Transaction tx) { long maxTTL = getMaxTTL(ttlByFamily); // we know that data will not be cleaned up while this tx is running up to this point as janitor uses it return maxTTL < Long.MAX_VALUE ? tx.getVisibilityUpperBound() - maxTTL * TxConstants.MAX_TX_PER_MS : 0; }
[ "public", "static", "long", "getOldestVisibleTimestamp", "(", "Map", "<", "byte", "[", "]", ",", "Long", ">", "ttlByFamily", ",", "Transaction", "tx", ")", "{", "long", "maxTTL", "=", "getMaxTTL", "(", "ttlByFamily", ")", ";", "// we know that data will not be c...
Returns the oldest visible timestamp for the given transaction, based on the TTLs configured for each column family. If no TTL is set on any column family, the oldest visible timestamp will be {@code 0}. @param ttlByFamily A map of column family name to TTL value (in milliseconds) @param tx The current transaction @return The oldest timestamp that will be visible for the given transaction and TTL configuration
[ "Returns", "the", "oldest", "visible", "timestamp", "for", "the", "given", "transaction", "based", "on", "the", "TTLs", "configured", "for", "each", "column", "family", ".", "If", "no", "TTL", "is", "set", "on", "any", "column", "family", "the", "oldest", ...
train
https://github.com/cdapio/tephra/blob/082c56c15c6ece15002631ff6f89206a00d8915c/tephra-core/src/main/java/co/cask/tephra/util/TxUtils.java#L61-L65
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworkClient.java
SubnetworkClient.insertSubnetwork
@BetaApi public final Operation insertSubnetwork(ProjectRegionName region, Subnetwork subnetworkResource) { InsertSubnetworkHttpRequest request = InsertSubnetworkHttpRequest.newBuilder() .setRegion(region == null ? null : region.toString()) .setSubnetworkResource(subnetworkResource) .build(); return insertSubnetwork(request); }
java
@BetaApi public final Operation insertSubnetwork(ProjectRegionName region, Subnetwork subnetworkResource) { InsertSubnetworkHttpRequest request = InsertSubnetworkHttpRequest.newBuilder() .setRegion(region == null ? null : region.toString()) .setSubnetworkResource(subnetworkResource) .build(); return insertSubnetwork(request); }
[ "@", "BetaApi", "public", "final", "Operation", "insertSubnetwork", "(", "ProjectRegionName", "region", ",", "Subnetwork", "subnetworkResource", ")", "{", "InsertSubnetworkHttpRequest", "request", "=", "InsertSubnetworkHttpRequest", ".", "newBuilder", "(", ")", ".", "se...
Creates a subnetwork in the specified project using the data included in the request. <p>Sample code: <pre><code> try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) { ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); Subnetwork subnetworkResource = Subnetwork.newBuilder().build(); Operation response = subnetworkClient.insertSubnetwork(region, subnetworkResource); } </code></pre> @param region Name of the region scoping this request. @param subnetworkResource A Subnetwork resource. (== resource_for beta.subnetworks ==) (== resource_for v1.subnetworks ==) @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "subnetwork", "in", "the", "specified", "project", "using", "the", "data", "included", "in", "the", "request", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworkClient.java#L726-L735