repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
google/closure-compiler
src/com/google/javascript/refactoring/Matchers.java
Matchers.allOf
public static Matcher allOf(final Matcher... matchers) { """ Returns a Matcher that returns true only if all of the provided matchers match. """ return new Matcher() { @Override public boolean matches(Node node, NodeMetadata metadata) { for (Matcher m : matchers) { if (!m.matches(node, metadata)) { return false; } } return true; } }; }
java
public static Matcher allOf(final Matcher... matchers) { return new Matcher() { @Override public boolean matches(Node node, NodeMetadata metadata) { for (Matcher m : matchers) { if (!m.matches(node, metadata)) { return false; } } return true; } }; }
[ "public", "static", "Matcher", "allOf", "(", "final", "Matcher", "...", "matchers", ")", "{", "return", "new", "Matcher", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(", "Node", "node", ",", "NodeMetadata", "metadata", ")", "{", "for", "(", "Matcher", "m", ":", "matchers", ")", "{", "if", "(", "!", "m", ".", "matches", "(", "node", ",", "metadata", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}", "}", ";", "}" ]
Returns a Matcher that returns true only if all of the provided matchers match.
[ "Returns", "a", "Matcher", "that", "returns", "true", "only", "if", "all", "of", "the", "provided", "matchers", "match", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L49-L60
GenesysPureEngage/provisioning-client-java
src/main/java/com/genesys/internal/provisioning/api/NotificationsApi.java
NotificationsApi.disconnectWithHttpInfo
public ApiResponse<Void> disconnectWithHttpInfo() throws ApiException { """ CometD disconnect CometD disconnect, see https://docs.cometd.org/current/reference/#_bayeux_meta_disconnect @return ApiResponse&lt;Void&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ com.squareup.okhttp.Call call = disconnectValidateBeforeCall(null, null); return apiClient.execute(call); }
java
public ApiResponse<Void> disconnectWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = disconnectValidateBeforeCall(null, null); return apiClient.execute(call); }
[ "public", "ApiResponse", "<", "Void", ">", "disconnectWithHttpInfo", "(", ")", "throws", "ApiException", "{", "com", ".", "squareup", ".", "okhttp", ".", "Call", "call", "=", "disconnectValidateBeforeCall", "(", "null", ",", "null", ")", ";", "return", "apiClient", ".", "execute", "(", "call", ")", ";", "}" ]
CometD disconnect CometD disconnect, see https://docs.cometd.org/current/reference/#_bayeux_meta_disconnect @return ApiResponse&lt;Void&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "CometD", "disconnect", "CometD", "disconnect", "see", "https", ":", "//", "docs", ".", "cometd", ".", "org", "/", "current", "/", "reference", "/", "#_bayeux_meta_disconnect" ]
train
https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/NotificationsApi.java#L237-L240
stapler/stapler
core/src/main/java/org/kohsuke/stapler/CrumbIssuer.java
CrumbIssuer.validateCrumb
public void validateCrumb(StaplerRequest request, String submittedCrumb) { """ Validates a crumb that was submitted along with the request. @param request The request that submitted the crumb @param submittedCrumb The submitted crumb value to be validated. @throws SecurityException If the crumb doesn't match and the request processing should abort. """ if (!issueCrumb(request).equals(submittedCrumb)) { throw new SecurityException("Request failed to pass the crumb test (try clearing your cookies)"); } }
java
public void validateCrumb(StaplerRequest request, String submittedCrumb) { if (!issueCrumb(request).equals(submittedCrumb)) { throw new SecurityException("Request failed to pass the crumb test (try clearing your cookies)"); } }
[ "public", "void", "validateCrumb", "(", "StaplerRequest", "request", ",", "String", "submittedCrumb", ")", "{", "if", "(", "!", "issueCrumb", "(", "request", ")", ".", "equals", "(", "submittedCrumb", ")", ")", "{", "throw", "new", "SecurityException", "(", "\"Request failed to pass the crumb test (try clearing your cookies)\"", ")", ";", "}", "}" ]
Validates a crumb that was submitted along with the request. @param request The request that submitted the crumb @param submittedCrumb The submitted crumb value to be validated. @throws SecurityException If the crumb doesn't match and the request processing should abort.
[ "Validates", "a", "crumb", "that", "was", "submitted", "along", "with", "the", "request", "." ]
train
https://github.com/stapler/stapler/blob/11ad5af185e062fb46e01bf9fbed66f3ebf2a8f7/core/src/main/java/org/kohsuke/stapler/CrumbIssuer.java#L44-L48
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/GalleriesApi.java
GalleriesApi.editPhoto
public Response editPhoto(String galleryId, String photoId, String comment) throws JinxException { """ Edit the comment for a gallery photo. <br> This method requires authentication with 'write' permission. @param galleryId Required. The ID of the gallery containing the photo. Note: this is the compound ID returned in methods like flickr.galleries.getList, and flickr.galleries.getListForPhoto. @param photoId Required. The photo ID in the gallery whose comment to edit. @param comment Required. The updated comment for the photo. @return object with response from Flickr indicating ok or fail. @throws JinxException if required parameters are null or empty, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.galleries.editPhoto.html">flickr.galleries.editPhoto</a> """ JinxUtils.validateParams(galleryId, photoId, comment); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.galleries.editPhoto"); params.put("gallery_id", galleryId); params.put("photo_id", photoId); params.put("comment", comment); return jinx.flickrPost(params, Response.class); }
java
public Response editPhoto(String galleryId, String photoId, String comment) throws JinxException { JinxUtils.validateParams(galleryId, photoId, comment); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.galleries.editPhoto"); params.put("gallery_id", galleryId); params.put("photo_id", photoId); params.put("comment", comment); return jinx.flickrPost(params, Response.class); }
[ "public", "Response", "editPhoto", "(", "String", "galleryId", ",", "String", "photoId", ",", "String", "comment", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validateParams", "(", "galleryId", ",", "photoId", ",", "comment", ")", ";", "Map", "<", "String", ",", "String", ">", "params", "=", "new", "TreeMap", "<>", "(", ")", ";", "params", ".", "put", "(", "\"method\"", ",", "\"flickr.galleries.editPhoto\"", ")", ";", "params", ".", "put", "(", "\"gallery_id\"", ",", "galleryId", ")", ";", "params", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "params", ".", "put", "(", "\"comment\"", ",", "comment", ")", ";", "return", "jinx", ".", "flickrPost", "(", "params", ",", "Response", ".", "class", ")", ";", "}" ]
Edit the comment for a gallery photo. <br> This method requires authentication with 'write' permission. @param galleryId Required. The ID of the gallery containing the photo. Note: this is the compound ID returned in methods like flickr.galleries.getList, and flickr.galleries.getListForPhoto. @param photoId Required. The photo ID in the gallery whose comment to edit. @param comment Required. The updated comment for the photo. @return object with response from Flickr indicating ok or fail. @throws JinxException if required parameters are null or empty, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.galleries.editPhoto.html">flickr.galleries.editPhoto</a>
[ "Edit", "the", "comment", "for", "a", "gallery", "photo", ".", "<br", ">", "This", "method", "requires", "authentication", "with", "write", "permission", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/GalleriesApi.java#L136-L144
lessthanoptimal/BoofCV
main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d2/StitchingFromMotion2D.java
StitchingFromMotion2D.configure
public void configure( int widthStitch, int heightStitch , IT worldToInit ) { """ Specifies size of stitch image and the location of the initial coordinate system. @param widthStitch Width of the image being stitched into @param heightStitch Height of the image being stitched into @param worldToInit (Option) Used to change the location of the initial frame in stitched image. null means no transform. """ this.worldToInit = (IT)worldToCurr.createInstance(); if( worldToInit != null ) this.worldToInit.set(worldToInit); this.widthStitch = widthStitch; this.heightStitch = heightStitch; }
java
public void configure( int widthStitch, int heightStitch , IT worldToInit ) { this.worldToInit = (IT)worldToCurr.createInstance(); if( worldToInit != null ) this.worldToInit.set(worldToInit); this.widthStitch = widthStitch; this.heightStitch = heightStitch; }
[ "public", "void", "configure", "(", "int", "widthStitch", ",", "int", "heightStitch", ",", "IT", "worldToInit", ")", "{", "this", ".", "worldToInit", "=", "(", "IT", ")", "worldToCurr", ".", "createInstance", "(", ")", ";", "if", "(", "worldToInit", "!=", "null", ")", "this", ".", "worldToInit", ".", "set", "(", "worldToInit", ")", ";", "this", ".", "widthStitch", "=", "widthStitch", ";", "this", ".", "heightStitch", "=", "heightStitch", ";", "}" ]
Specifies size of stitch image and the location of the initial coordinate system. @param widthStitch Width of the image being stitched into @param heightStitch Height of the image being stitched into @param worldToInit (Option) Used to change the location of the initial frame in stitched image. null means no transform.
[ "Specifies", "size", "of", "stitch", "image", "and", "the", "location", "of", "the", "initial", "coordinate", "system", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d2/StitchingFromMotion2D.java#L120-L126
graphhopper/graphhopper
core/src/main/java/com/graphhopper/util/BitUtil.java
BitUtil.toBitString
public String toBitString(long value, int bits) { """ Higher order bits comes first in the returned string. <p> @param bits how many bits should be returned. """ StringBuilder sb = new StringBuilder(bits); long lastBit = 1L << 63; for (int i = 0; i < bits; i++) { if ((value & lastBit) == 0) sb.append('0'); else sb.append('1'); value <<= 1; } return sb.toString(); }
java
public String toBitString(long value, int bits) { StringBuilder sb = new StringBuilder(bits); long lastBit = 1L << 63; for (int i = 0; i < bits; i++) { if ((value & lastBit) == 0) sb.append('0'); else sb.append('1'); value <<= 1; } return sb.toString(); }
[ "public", "String", "toBitString", "(", "long", "value", ",", "int", "bits", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "bits", ")", ";", "long", "lastBit", "=", "1L", "<<", "63", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "bits", ";", "i", "++", ")", "{", "if", "(", "(", "value", "&", "lastBit", ")", "==", "0", ")", "sb", ".", "append", "(", "'", "'", ")", ";", "else", "sb", ".", "append", "(", "'", "'", ")", ";", "value", "<<=", "1", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Higher order bits comes first in the returned string. <p> @param bits how many bits should be returned.
[ "Higher", "order", "bits", "comes", "first", "in", "the", "returned", "string", ".", "<p", ">" ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/util/BitUtil.java#L207-L219
mikepenz/FastAdapter
app/src/main/java/com/mikepenz/fastadapter/app/items/RealmSampleUserItem.java
RealmSampleUserItem.generateView
@Override public View generateView(Context ctx, ViewGroup parent) { """ generates a view by the defined LayoutRes and pass the LayoutParams from the parent @param ctx @param parent @return """ ViewHolder viewHolder = getViewHolder(LayoutInflater.from(ctx).inflate(getLayoutRes(), parent, false)); //as we already know the type of our ViewHolder cast it to our type bindView(viewHolder, Collections.EMPTY_LIST); //return the bound and generatedView return viewHolder.itemView; }
java
@Override public View generateView(Context ctx, ViewGroup parent) { ViewHolder viewHolder = getViewHolder(LayoutInflater.from(ctx).inflate(getLayoutRes(), parent, false)); //as we already know the type of our ViewHolder cast it to our type bindView(viewHolder, Collections.EMPTY_LIST); //return the bound and generatedView return viewHolder.itemView; }
[ "@", "Override", "public", "View", "generateView", "(", "Context", "ctx", ",", "ViewGroup", "parent", ")", "{", "ViewHolder", "viewHolder", "=", "getViewHolder", "(", "LayoutInflater", ".", "from", "(", "ctx", ")", ".", "inflate", "(", "getLayoutRes", "(", ")", ",", "parent", ",", "false", ")", ")", ";", "//as we already know the type of our ViewHolder cast it to our type", "bindView", "(", "viewHolder", ",", "Collections", ".", "EMPTY_LIST", ")", ";", "//return the bound and generatedView", "return", "viewHolder", ".", "itemView", ";", "}" ]
generates a view by the defined LayoutRes and pass the LayoutParams from the parent @param ctx @param parent @return
[ "generates", "a", "view", "by", "the", "defined", "LayoutRes", "and", "pass", "the", "LayoutParams", "from", "the", "parent" ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/app/src/main/java/com/mikepenz/fastadapter/app/items/RealmSampleUserItem.java#L202-L210
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGScoreBar.java
SVGScoreBar.setFill
public void setFill(double val, double min, double max) { """ Set the fill of the score bar. @param val Value @param min Minimum value @param max Maximum value """ this.val = val; this.min = min; this.max = max; }
java
public void setFill(double val, double min, double max) { this.val = val; this.min = min; this.max = max; }
[ "public", "void", "setFill", "(", "double", "val", ",", "double", "min", ",", "double", "max", ")", "{", "this", ".", "val", "=", "val", ";", "this", ".", "min", "=", "min", ";", "this", ".", "max", "=", "max", ";", "}" ]
Set the fill of the score bar. @param val Value @param min Minimum value @param max Maximum value
[ "Set", "the", "fill", "of", "the", "score", "bar", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGScoreBar.java#L71-L75
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/user/UserCoreDao.java
UserCoreDao.queryForLike
public TResult queryForLike(String fieldName, Object value) { """ Query for the row where the field is like the value @param fieldName field name @param value value @return result @since 3.0.1 """ return queryForLike(fieldName, value, null, null, null); }
java
public TResult queryForLike(String fieldName, Object value) { return queryForLike(fieldName, value, null, null, null); }
[ "public", "TResult", "queryForLike", "(", "String", "fieldName", ",", "Object", "value", ")", "{", "return", "queryForLike", "(", "fieldName", ",", "value", ",", "null", ",", "null", ",", "null", ")", ";", "}" ]
Query for the row where the field is like the value @param fieldName field name @param value value @return result @since 3.0.1
[ "Query", "for", "the", "row", "where", "the", "field", "is", "like", "the", "value" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/user/UserCoreDao.java#L298-L300
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/DurationUtility.java
DurationUtility.getInstance
public static Duration getInstance(String dur, NumberFormat format, Locale locale) throws MPXJException { """ Retrieve an Duration instance. Use shared objects to represent common values for memory efficiency. @param dur duration formatted as a string @param format number format @param locale target locale @return Duration instance @throws MPXJException """ try { int lastIndex = dur.length() - 1; int index = lastIndex; double duration; TimeUnit units; while ((index > 0) && (Character.isDigit(dur.charAt(index)) == false)) { --index; } // // If we have no units suffix, assume days to allow for MPX3 // if (index == lastIndex) { duration = format.parse(dur).doubleValue(); units = TimeUnit.DAYS; } else { ++index; duration = format.parse(dur.substring(0, index)).doubleValue(); while ((index < lastIndex) && (Character.isWhitespace(dur.charAt(index)))) { ++index; } units = TimeUnitUtility.getInstance(dur.substring(index), locale); } return (Duration.getInstance(duration, units)); } catch (ParseException ex) { throw new MPXJException("Failed to parse duration", ex); } }
java
public static Duration getInstance(String dur, NumberFormat format, Locale locale) throws MPXJException { try { int lastIndex = dur.length() - 1; int index = lastIndex; double duration; TimeUnit units; while ((index > 0) && (Character.isDigit(dur.charAt(index)) == false)) { --index; } // // If we have no units suffix, assume days to allow for MPX3 // if (index == lastIndex) { duration = format.parse(dur).doubleValue(); units = TimeUnit.DAYS; } else { ++index; duration = format.parse(dur.substring(0, index)).doubleValue(); while ((index < lastIndex) && (Character.isWhitespace(dur.charAt(index)))) { ++index; } units = TimeUnitUtility.getInstance(dur.substring(index), locale); } return (Duration.getInstance(duration, units)); } catch (ParseException ex) { throw new MPXJException("Failed to parse duration", ex); } }
[ "public", "static", "Duration", "getInstance", "(", "String", "dur", ",", "NumberFormat", "format", ",", "Locale", "locale", ")", "throws", "MPXJException", "{", "try", "{", "int", "lastIndex", "=", "dur", ".", "length", "(", ")", "-", "1", ";", "int", "index", "=", "lastIndex", ";", "double", "duration", ";", "TimeUnit", "units", ";", "while", "(", "(", "index", ">", "0", ")", "&&", "(", "Character", ".", "isDigit", "(", "dur", ".", "charAt", "(", "index", ")", ")", "==", "false", ")", ")", "{", "--", "index", ";", "}", "//", "// If we have no units suffix, assume days to allow for MPX3", "//", "if", "(", "index", "==", "lastIndex", ")", "{", "duration", "=", "format", ".", "parse", "(", "dur", ")", ".", "doubleValue", "(", ")", ";", "units", "=", "TimeUnit", ".", "DAYS", ";", "}", "else", "{", "++", "index", ";", "duration", "=", "format", ".", "parse", "(", "dur", ".", "substring", "(", "0", ",", "index", ")", ")", ".", "doubleValue", "(", ")", ";", "while", "(", "(", "index", "<", "lastIndex", ")", "&&", "(", "Character", ".", "isWhitespace", "(", "dur", ".", "charAt", "(", "index", ")", ")", ")", ")", "{", "++", "index", ";", "}", "units", "=", "TimeUnitUtility", ".", "getInstance", "(", "dur", ".", "substring", "(", "index", ")", ",", "locale", ")", ";", "}", "return", "(", "Duration", ".", "getInstance", "(", "duration", ",", "units", ")", ")", ";", "}", "catch", "(", "ParseException", "ex", ")", "{", "throw", "new", "MPXJException", "(", "\"Failed to parse duration\"", ",", "ex", ")", ";", "}", "}" ]
Retrieve an Duration instance. Use shared objects to represent common values for memory efficiency. @param dur duration formatted as a string @param format number format @param locale target locale @return Duration instance @throws MPXJException
[ "Retrieve", "an", "Duration", "instance", ".", "Use", "shared", "objects", "to", "represent", "common", "values", "for", "memory", "efficiency", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/DurationUtility.java#L58-L98
petergeneric/stdlib
util/carbon-client/src/main/java/com/peterphi/carbon/type/mutable/CarbonSource.java
CarbonSource.buildFilterElement
static Element buildFilterElement(String filterName, String filterGUID) { """ Builds a filter element that looks like: <p/> <pre> &lt;Filter_0> &lt;Module_0 PresetGUID="{D527E1A0-2CC7-4FE5-99F7-C62355BFBD31}" /> &lt;/Filter_0> <pre> @param filterGUID the guid to use for the PresetGUID attribute @return """ Element filter = new Element(filterName); Element module = new Element("Module_0"); filter.addContent(module); module.setAttribute("PresetGUID", filterGUID); return filter; }
java
static Element buildFilterElement(String filterName, String filterGUID) { Element filter = new Element(filterName); Element module = new Element("Module_0"); filter.addContent(module); module.setAttribute("PresetGUID", filterGUID); return filter; }
[ "static", "Element", "buildFilterElement", "(", "String", "filterName", ",", "String", "filterGUID", ")", "{", "Element", "filter", "=", "new", "Element", "(", "filterName", ")", ";", "Element", "module", "=", "new", "Element", "(", "\"Module_0\"", ")", ";", "filter", ".", "addContent", "(", "module", ")", ";", "module", ".", "setAttribute", "(", "\"PresetGUID\"", ",", "filterGUID", ")", ";", "return", "filter", ";", "}" ]
Builds a filter element that looks like: <p/> <pre> &lt;Filter_0> &lt;Module_0 PresetGUID="{D527E1A0-2CC7-4FE5-99F7-C62355BFBD31}" /> &lt;/Filter_0> <pre> @param filterGUID the guid to use for the PresetGUID attribute @return
[ "Builds", "a", "filter", "element", "that", "looks", "like", ":", "<p", "/", ">", "<pre", ">", "&lt", ";", "Filter_0", ">", "&lt", ";", "Module_0", "PresetGUID", "=", "{", "D527E1A0", "-", "2CC7", "-", "4FE5", "-", "99F7", "-", "C62355BFBD31", "}", "/", ">", "&lt", ";", "/", "Filter_0", ">" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/util/carbon-client/src/main/java/com/peterphi/carbon/type/mutable/CarbonSource.java#L175-L184
google/jimfs
jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java
FileSystemView.createDirectory
public Directory createDirectory(JimfsPath path, FileAttribute<?>... attrs) throws IOException { """ Creates a new directory at the given path. The given attributes will be set on the new file if possible. """ return (Directory) createFile(path, store.directoryCreator(), true, attrs); }
java
public Directory createDirectory(JimfsPath path, FileAttribute<?>... attrs) throws IOException { return (Directory) createFile(path, store.directoryCreator(), true, attrs); }
[ "public", "Directory", "createDirectory", "(", "JimfsPath", "path", ",", "FileAttribute", "<", "?", ">", "...", "attrs", ")", "throws", "IOException", "{", "return", "(", "Directory", ")", "createFile", "(", "path", ",", "store", ".", "directoryCreator", "(", ")", ",", "true", ",", "attrs", ")", ";", "}" ]
Creates a new directory at the given path. The given attributes will be set on the new file if possible.
[ "Creates", "a", "new", "directory", "at", "the", "given", "path", ".", "The", "given", "attributes", "will", "be", "set", "on", "the", "new", "file", "if", "possible", "." ]
train
https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java#L224-L226
b3dgs/lionengine
lionengine-network/src/main/java/com/b3dgs/lionengine/network/message/NetworkMessageEntity.java
NetworkMessageEntity.addAction
public void addAction(M element, double value) { """ Add an action. @param element The action type. @param value The action value. """ actions.put(element, Double.valueOf(value)); }
java
public void addAction(M element, double value) { actions.put(element, Double.valueOf(value)); }
[ "public", "void", "addAction", "(", "M", "element", ",", "double", "value", ")", "{", "actions", ".", "put", "(", "element", ",", "Double", ".", "valueOf", "(", "value", ")", ")", ";", "}" ]
Add an action. @param element The action type. @param value The action value.
[ "Add", "an", "action", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-network/src/main/java/com/b3dgs/lionengine/network/message/NetworkMessageEntity.java#L166-L169
pagehelper/Mybatis-PageHelper
src/main/java/com/github/pagehelper/parser/SqlServerParser.java
SqlServerParser.cloneOrderByElement
protected OrderByElement cloneOrderByElement(OrderByElement orig, Expression expression) { """ 复制 OrderByElement @param orig 原 OrderByElement @param expression 新 OrderByElement 的排序要素 @return 复制的新 OrderByElement """ OrderByElement element = new OrderByElement(); element.setAsc(orig.isAsc()); element.setAscDescPresent(orig.isAscDescPresent()); element.setNullOrdering(orig.getNullOrdering()); element.setExpression(expression); return element; }
java
protected OrderByElement cloneOrderByElement(OrderByElement orig, Expression expression) { OrderByElement element = new OrderByElement(); element.setAsc(orig.isAsc()); element.setAscDescPresent(orig.isAscDescPresent()); element.setNullOrdering(orig.getNullOrdering()); element.setExpression(expression); return element; }
[ "protected", "OrderByElement", "cloneOrderByElement", "(", "OrderByElement", "orig", ",", "Expression", "expression", ")", "{", "OrderByElement", "element", "=", "new", "OrderByElement", "(", ")", ";", "element", ".", "setAsc", "(", "orig", ".", "isAsc", "(", ")", ")", ";", "element", ".", "setAscDescPresent", "(", "orig", ".", "isAscDescPresent", "(", ")", ")", ";", "element", ".", "setNullOrdering", "(", "orig", ".", "getNullOrdering", "(", ")", ")", ";", "element", ".", "setExpression", "(", "expression", ")", ";", "return", "element", ";", "}" ]
复制 OrderByElement @param orig 原 OrderByElement @param expression 新 OrderByElement 的排序要素 @return 复制的新 OrderByElement
[ "复制", "OrderByElement" ]
train
https://github.com/pagehelper/Mybatis-PageHelper/blob/319750fd47cf75328ff321f38125fa15e954e60f/src/main/java/com/github/pagehelper/parser/SqlServerParser.java#L414-L421
geomajas/geomajas-project-client-gwt
plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/ribbon/RibbonColumnRegistry.java
RibbonColumnRegistry.put
public static void put(String key, RibbonColumnCreator ribbonColumnCreator) { """ Add another key to the registry. This will overwrite the previous value. @param key Unique key for the action within this registry. @param ribbonColumnCreator Implementation of the {@link RibbonColumnCreator} interface to link the correct type of ribbon column widget to the key. """ if (null != key && null != ribbonColumnCreator) { REGISTRY.put(key, ribbonColumnCreator); } }
java
public static void put(String key, RibbonColumnCreator ribbonColumnCreator) { if (null != key && null != ribbonColumnCreator) { REGISTRY.put(key, ribbonColumnCreator); } }
[ "public", "static", "void", "put", "(", "String", "key", ",", "RibbonColumnCreator", "ribbonColumnCreator", ")", "{", "if", "(", "null", "!=", "key", "&&", "null", "!=", "ribbonColumnCreator", ")", "{", "REGISTRY", ".", "put", "(", "key", ",", "ribbonColumnCreator", ")", ";", "}", "}" ]
Add another key to the registry. This will overwrite the previous value. @param key Unique key for the action within this registry. @param ribbonColumnCreator Implementation of the {@link RibbonColumnCreator} interface to link the correct type of ribbon column widget to the key.
[ "Add", "another", "key", "to", "the", "registry", ".", "This", "will", "overwrite", "the", "previous", "value", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/ribbon/RibbonColumnRegistry.java#L132-L136
offbynull/coroutines
instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java
GenericGenerators.throwRuntimeException
public static InsnList throwRuntimeException(String message) { """ Generates instructions to throw an exception of type {@link RuntimeException} with a constant message. @param message message of exception @return instructions to throw an exception @throws NullPointerException if any argument is {@code null} """ Validate.notNull(message); InsnList ret = new InsnList(); ret.add(new TypeInsnNode(Opcodes.NEW, "java/lang/RuntimeException")); ret.add(new InsnNode(Opcodes.DUP)); ret.add(new LdcInsnNode(message)); ret.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, "java/lang/RuntimeException", "<init>", "(Ljava/lang/String;)V", false)); ret.add(new InsnNode(Opcodes.ATHROW)); return ret; }
java
public static InsnList throwRuntimeException(String message) { Validate.notNull(message); InsnList ret = new InsnList(); ret.add(new TypeInsnNode(Opcodes.NEW, "java/lang/RuntimeException")); ret.add(new InsnNode(Opcodes.DUP)); ret.add(new LdcInsnNode(message)); ret.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, "java/lang/RuntimeException", "<init>", "(Ljava/lang/String;)V", false)); ret.add(new InsnNode(Opcodes.ATHROW)); return ret; }
[ "public", "static", "InsnList", "throwRuntimeException", "(", "String", "message", ")", "{", "Validate", ".", "notNull", "(", "message", ")", ";", "InsnList", "ret", "=", "new", "InsnList", "(", ")", ";", "ret", ".", "add", "(", "new", "TypeInsnNode", "(", "Opcodes", ".", "NEW", ",", "\"java/lang/RuntimeException\"", ")", ")", ";", "ret", ".", "add", "(", "new", "InsnNode", "(", "Opcodes", ".", "DUP", ")", ")", ";", "ret", ".", "add", "(", "new", "LdcInsnNode", "(", "message", ")", ")", ";", "ret", ".", "add", "(", "new", "MethodInsnNode", "(", "Opcodes", ".", "INVOKESPECIAL", ",", "\"java/lang/RuntimeException\"", ",", "\"<init>\"", ",", "\"(Ljava/lang/String;)V\"", ",", "false", ")", ")", ";", "ret", ".", "add", "(", "new", "InsnNode", "(", "Opcodes", ".", "ATHROW", ")", ")", ";", "return", "ret", ";", "}" ]
Generates instructions to throw an exception of type {@link RuntimeException} with a constant message. @param message message of exception @return instructions to throw an exception @throws NullPointerException if any argument is {@code null}
[ "Generates", "instructions", "to", "throw", "an", "exception", "of", "type", "{" ]
train
https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java#L895-L907
pebble/pebble-android-sdk
PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/PebbleKit.java
PebbleKit.startAppOnPebble
public static void startAppOnPebble(final Context context, final UUID watchappUuid) throws IllegalArgumentException { """ Send a message to the connected Pebble to launch an application identified by a UUID. If another application is currently running it will be terminated and the new application will be brought to the foreground. @param context The context used to send the broadcast. @param watchappUuid A UUID uniquely identifying the target application. UUIDs for the stock PebbleKit applications are available in {@link Constants}. @throws IllegalArgumentException Thrown if the specified UUID is invalid. """ if (watchappUuid == null) { throw new IllegalArgumentException("uuid cannot be null"); } final Intent startAppIntent = new Intent(INTENT_APP_START); startAppIntent.putExtra(APP_UUID, watchappUuid); context.sendBroadcast(startAppIntent); }
java
public static void startAppOnPebble(final Context context, final UUID watchappUuid) throws IllegalArgumentException { if (watchappUuid == null) { throw new IllegalArgumentException("uuid cannot be null"); } final Intent startAppIntent = new Intent(INTENT_APP_START); startAppIntent.putExtra(APP_UUID, watchappUuid); context.sendBroadcast(startAppIntent); }
[ "public", "static", "void", "startAppOnPebble", "(", "final", "Context", "context", ",", "final", "UUID", "watchappUuid", ")", "throws", "IllegalArgumentException", "{", "if", "(", "watchappUuid", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"uuid cannot be null\"", ")", ";", "}", "final", "Intent", "startAppIntent", "=", "new", "Intent", "(", "INTENT_APP_START", ")", ";", "startAppIntent", ".", "putExtra", "(", "APP_UUID", ",", "watchappUuid", ")", ";", "context", ".", "sendBroadcast", "(", "startAppIntent", ")", ";", "}" ]
Send a message to the connected Pebble to launch an application identified by a UUID. If another application is currently running it will be terminated and the new application will be brought to the foreground. @param context The context used to send the broadcast. @param watchappUuid A UUID uniquely identifying the target application. UUIDs for the stock PebbleKit applications are available in {@link Constants}. @throws IllegalArgumentException Thrown if the specified UUID is invalid.
[ "Send", "a", "message", "to", "the", "connected", "Pebble", "to", "launch", "an", "application", "identified", "by", "a", "UUID", ".", "If", "another", "application", "is", "currently", "running", "it", "will", "be", "terminated", "and", "the", "new", "application", "will", "be", "brought", "to", "the", "foreground", "." ]
train
https://github.com/pebble/pebble-android-sdk/blob/ddfc53ecf3950deebb62a1f205aa21fbe9bce45d/PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/PebbleKit.java#L212-L222
pac4j/pac4j
pac4j-config/src/main/java/org/pac4j/config/ldaptive/LdaptiveAuthenticatorBuilder.java
LdaptiveAuthenticatorBuilder.newSearchFilter
public static SearchFilter newSearchFilter(final String filterQuery, final String... params) { """ Constructs a new search filter using {@link SearchExecutor#searchFilter} as a template and the username as a parameter. @param filterQuery the query filter @param params the username @return Search filter with parameters applied. """ final SearchFilter filter = new SearchFilter(); filter.setFilter(filterQuery); if (params != null) { for (int i = 0; i < params.length; i++) { if (filter.getFilter().contains("{" + i + "}")) { filter.setParameter(i, params[i]); } else { filter.setParameter("user", params[i]); } } } LOGGER.debug("Constructed LDAP search filter [{}]", filter.format()); return filter; }
java
public static SearchFilter newSearchFilter(final String filterQuery, final String... params) { final SearchFilter filter = new SearchFilter(); filter.setFilter(filterQuery); if (params != null) { for (int i = 0; i < params.length; i++) { if (filter.getFilter().contains("{" + i + "}")) { filter.setParameter(i, params[i]); } else { filter.setParameter("user", params[i]); } } } LOGGER.debug("Constructed LDAP search filter [{}]", filter.format()); return filter; }
[ "public", "static", "SearchFilter", "newSearchFilter", "(", "final", "String", "filterQuery", ",", "final", "String", "...", "params", ")", "{", "final", "SearchFilter", "filter", "=", "new", "SearchFilter", "(", ")", ";", "filter", ".", "setFilter", "(", "filterQuery", ")", ";", "if", "(", "params", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "params", ".", "length", ";", "i", "++", ")", "{", "if", "(", "filter", ".", "getFilter", "(", ")", ".", "contains", "(", "\"{\"", "+", "i", "+", "\"}\"", ")", ")", "{", "filter", ".", "setParameter", "(", "i", ",", "params", "[", "i", "]", ")", ";", "}", "else", "{", "filter", ".", "setParameter", "(", "\"user\"", ",", "params", "[", "i", "]", ")", ";", "}", "}", "}", "LOGGER", ".", "debug", "(", "\"Constructed LDAP search filter [{}]\"", ",", "filter", ".", "format", "(", ")", ")", ";", "return", "filter", ";", "}" ]
Constructs a new search filter using {@link SearchExecutor#searchFilter} as a template and the username as a parameter. @param filterQuery the query filter @param params the username @return Search filter with parameters applied.
[ "Constructs", "a", "new", "search", "filter", "using", "{", "@link", "SearchExecutor#searchFilter", "}", "as", "a", "template", "and", "the", "username", "as", "a", "parameter", "." ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-config/src/main/java/org/pac4j/config/ldaptive/LdaptiveAuthenticatorBuilder.java#L365-L379
liferay/com-liferay-commerce
commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListPersistenceImpl.java
CommercePriceListPersistenceImpl.findByG_NotS
@Override public List<CommercePriceList> findByG_NotS(long groupId, int status, int start, int end, OrderByComparator<CommercePriceList> orderByComparator) { """ Returns an ordered range of all the commerce price lists where groupId = &#63; and status &ne; &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommercePriceListModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param groupId the group ID @param status the status @param start the lower bound of the range of commerce price lists @param end the upper bound of the range of commerce price lists (not inclusive) @param orderByComparator the comparator to order the results by (optionally <code>null</code>) @return the ordered range of matching commerce price lists """ return findByG_NotS(groupId, status, start, end, orderByComparator, true); }
java
@Override public List<CommercePriceList> findByG_NotS(long groupId, int status, int start, int end, OrderByComparator<CommercePriceList> orderByComparator) { return findByG_NotS(groupId, status, start, end, orderByComparator, true); }
[ "@", "Override", "public", "List", "<", "CommercePriceList", ">", "findByG_NotS", "(", "long", "groupId", ",", "int", "status", ",", "int", "start", ",", "int", "end", ",", "OrderByComparator", "<", "CommercePriceList", ">", "orderByComparator", ")", "{", "return", "findByG_NotS", "(", "groupId", ",", "status", ",", "start", ",", "end", ",", "orderByComparator", ",", "true", ")", ";", "}" ]
Returns an ordered range of all the commerce price lists where groupId = &#63; and status &ne; &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommercePriceListModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param groupId the group ID @param status the status @param start the lower bound of the range of commerce price lists @param end the upper bound of the range of commerce price lists (not inclusive) @param orderByComparator the comparator to order the results by (optionally <code>null</code>) @return the ordered range of matching commerce price lists
[ "Returns", "an", "ordered", "range", "of", "all", "the", "commerce", "price", "lists", "where", "groupId", "=", "&#63", ";", "and", "status", "&ne", ";", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListPersistenceImpl.java#L3868-L3873
fuzzylite/jfuzzylite
jfuzzylite/src/main/java/com/fuzzylite/Op.java
Op.standardDeviation
public static double standardDeviation(double[] x, double mean) { """ Computes the standard deviation of the vector using the given mean @param x @param mean is the mean value of x @return ` \sqrt{\mbox{variance}(x, \bar{x})} ` """ if (x.length == 0) { return Double.NaN; } if (x.length == 1) { return 0.0; } return Math.sqrt(variance(x, mean)); }
java
public static double standardDeviation(double[] x, double mean) { if (x.length == 0) { return Double.NaN; } if (x.length == 1) { return 0.0; } return Math.sqrt(variance(x, mean)); }
[ "public", "static", "double", "standardDeviation", "(", "double", "[", "]", "x", ",", "double", "mean", ")", "{", "if", "(", "x", ".", "length", "==", "0", ")", "{", "return", "Double", ".", "NaN", ";", "}", "if", "(", "x", ".", "length", "==", "1", ")", "{", "return", "0.0", ";", "}", "return", "Math", ".", "sqrt", "(", "variance", "(", "x", ",", "mean", ")", ")", ";", "}" ]
Computes the standard deviation of the vector using the given mean @param x @param mean is the mean value of x @return ` \sqrt{\mbox{variance}(x, \bar{x})} `
[ "Computes", "the", "standard", "deviation", "of", "the", "vector", "using", "the", "given", "mean" ]
train
https://github.com/fuzzylite/jfuzzylite/blob/583ac1928f39512af75de80d560e67448039595a/jfuzzylite/src/main/java/com/fuzzylite/Op.java#L586-L594
rhuss/jolokia
agent/core/src/main/java/org/jolokia/detector/AbstractServerDetector.java
AbstractServerDetector.getAttributeValue
protected String getAttributeValue(MBeanServerExecutor pMBeanServerExecutor, final ObjectName pMBean, final String pAttribute) { """ Get the string representation of an attribute @param pMBeanServerExecutor set of MBeanServers to query. The first one wins. @param pMBean name of MBean to lookup @param pAttribute attribute to lookup @return string value of attribute or <code>null</code> if the attribute could not be fetched """ try { return pMBeanServerExecutor.call(pMBean, GET_ATTRIBUTE_HANDLER, pAttribute); } catch (IOException e) { return null; } catch (ReflectionException e) { return null; } catch (JMException e) { return null; } }
java
protected String getAttributeValue(MBeanServerExecutor pMBeanServerExecutor, final ObjectName pMBean, final String pAttribute) { try { return pMBeanServerExecutor.call(pMBean, GET_ATTRIBUTE_HANDLER, pAttribute); } catch (IOException e) { return null; } catch (ReflectionException e) { return null; } catch (JMException e) { return null; } }
[ "protected", "String", "getAttributeValue", "(", "MBeanServerExecutor", "pMBeanServerExecutor", ",", "final", "ObjectName", "pMBean", ",", "final", "String", "pAttribute", ")", "{", "try", "{", "return", "pMBeanServerExecutor", ".", "call", "(", "pMBean", ",", "GET_ATTRIBUTE_HANDLER", ",", "pAttribute", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "return", "null", ";", "}", "catch", "(", "ReflectionException", "e", ")", "{", "return", "null", ";", "}", "catch", "(", "JMException", "e", ")", "{", "return", "null", ";", "}", "}" ]
Get the string representation of an attribute @param pMBeanServerExecutor set of MBeanServers to query. The first one wins. @param pMBean name of MBean to lookup @param pAttribute attribute to lookup @return string value of attribute or <code>null</code> if the attribute could not be fetched
[ "Get", "the", "string", "representation", "of", "an", "attribute" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/detector/AbstractServerDetector.java#L93-L103
wkgcass/Style
src/main/java/net/cassite/style/aggregation/MapFuncSup.java
MapFuncSup.forEach
public <R> R forEach(def<R> func) { """ define a function to deal with each entry in the map @param func a function returns 'last loop result' @return return 'last loop value'.<br> check <a href="https://github.com/wkgcass/Style/">tutorial</a> for more info about 'last loop value' """ return forThose((k, v) -> true, func); }
java
public <R> R forEach(def<R> func) { return forThose((k, v) -> true, func); }
[ "public", "<", "R", ">", "R", "forEach", "(", "def", "<", "R", ">", "func", ")", "{", "return", "forThose", "(", "(", "k", ",", "v", ")", "->", "true", ",", "func", ")", ";", "}" ]
define a function to deal with each entry in the map @param func a function returns 'last loop result' @return return 'last loop value'.<br> check <a href="https://github.com/wkgcass/Style/">tutorial</a> for more info about 'last loop value'
[ "define", "a", "function", "to", "deal", "with", "each", "entry", "in", "the", "map" ]
train
https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/aggregation/MapFuncSup.java#L96-L98
westnordost/osmapi
src/main/java/de/westnordost/osmapi/map/MapDataDao.java
MapDataDao.openChangeset
public long openChangeset(Map<String, String> tags) { """ Open a new changeset with the given tags @param tags tags of this changeset. Usually it is comment and source. @throws OsmAuthorizationException if the application does not have permission to edit the map (Permission.MODIFY_MAP) """ return osm.makeAuthenticatedRequest("changeset/create", "PUT", createOsmChangesetTagsWriter(tags), new IdResponseReader()); }
java
public long openChangeset(Map<String, String> tags) { return osm.makeAuthenticatedRequest("changeset/create", "PUT", createOsmChangesetTagsWriter(tags), new IdResponseReader()); }
[ "public", "long", "openChangeset", "(", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "osm", ".", "makeAuthenticatedRequest", "(", "\"changeset/create\"", ",", "\"PUT\"", ",", "createOsmChangesetTagsWriter", "(", "tags", ")", ",", "new", "IdResponseReader", "(", ")", ")", ";", "}" ]
Open a new changeset with the given tags @param tags tags of this changeset. Usually it is comment and source. @throws OsmAuthorizationException if the application does not have permission to edit the map (Permission.MODIFY_MAP)
[ "Open", "a", "new", "changeset", "with", "the", "given", "tags", "@param", "tags", "tags", "of", "this", "changeset", ".", "Usually", "it", "is", "comment", "and", "source", "." ]
train
https://github.com/westnordost/osmapi/blob/dda6978fd12e117d0cf17812bc22037f61e22c4b/src/main/java/de/westnordost/osmapi/map/MapDataDao.java#L132-L136
mapsforge/mapsforge
mapsforge-map-reader/src/main/java/org/mapsforge/map/reader/IndexCache.java
IndexCache.getIndexEntry
long getIndexEntry(SubFileParameter subFileParameter, long blockNumber) throws IOException { """ Returns the index entry of a block in the given map file. If the required index entry is not cached, it will be read from the map file index and put in the cache. @param subFileParameter the parameters of the map file for which the index entry is needed. @param blockNumber the number of the block in the map file. @return the index entry. @throws IOException if an I/O error occurs during reading. """ // check if the block number is out of bounds if (blockNumber >= subFileParameter.numberOfBlocks) { throw new IOException("invalid block number: " + blockNumber); } // calculate the index block number long indexBlockNumber = blockNumber / INDEX_ENTRIES_PER_BLOCK; // create the cache entry key for this request IndexCacheEntryKey indexCacheEntryKey = new IndexCacheEntryKey(subFileParameter, indexBlockNumber); // check for cached index block byte[] indexBlock = this.map.get(indexCacheEntryKey); if (indexBlock == null) { // cache miss, seek to the correct index block in the file and read it long indexBlockPosition = subFileParameter.indexStartAddress + indexBlockNumber * SIZE_OF_INDEX_BLOCK; int remainingIndexSize = (int) (subFileParameter.indexEndAddress - indexBlockPosition); int indexBlockSize = Math.min(SIZE_OF_INDEX_BLOCK, remainingIndexSize); indexBlock = new byte[indexBlockSize]; ByteBuffer indexBlockWrapper = ByteBuffer.wrap(indexBlock, 0, indexBlockSize); synchronized (this.fileChannel) { this.fileChannel.position(indexBlockPosition); if (this.fileChannel.read(indexBlockWrapper) != indexBlockSize) { throw new IOException("could not read index block with size: " + indexBlockSize); } } // put the index block in the map this.map.put(indexCacheEntryKey, indexBlock); } // calculate the address of the index entry inside the index block long indexEntryInBlock = blockNumber % INDEX_ENTRIES_PER_BLOCK; int addressInIndexBlock = (int) (indexEntryInBlock * SubFileParameter.BYTES_PER_INDEX_ENTRY); // return the real index entry return Deserializer.getFiveBytesLong(indexBlock, addressInIndexBlock); }
java
long getIndexEntry(SubFileParameter subFileParameter, long blockNumber) throws IOException { // check if the block number is out of bounds if (blockNumber >= subFileParameter.numberOfBlocks) { throw new IOException("invalid block number: " + blockNumber); } // calculate the index block number long indexBlockNumber = blockNumber / INDEX_ENTRIES_PER_BLOCK; // create the cache entry key for this request IndexCacheEntryKey indexCacheEntryKey = new IndexCacheEntryKey(subFileParameter, indexBlockNumber); // check for cached index block byte[] indexBlock = this.map.get(indexCacheEntryKey); if (indexBlock == null) { // cache miss, seek to the correct index block in the file and read it long indexBlockPosition = subFileParameter.indexStartAddress + indexBlockNumber * SIZE_OF_INDEX_BLOCK; int remainingIndexSize = (int) (subFileParameter.indexEndAddress - indexBlockPosition); int indexBlockSize = Math.min(SIZE_OF_INDEX_BLOCK, remainingIndexSize); indexBlock = new byte[indexBlockSize]; ByteBuffer indexBlockWrapper = ByteBuffer.wrap(indexBlock, 0, indexBlockSize); synchronized (this.fileChannel) { this.fileChannel.position(indexBlockPosition); if (this.fileChannel.read(indexBlockWrapper) != indexBlockSize) { throw new IOException("could not read index block with size: " + indexBlockSize); } } // put the index block in the map this.map.put(indexCacheEntryKey, indexBlock); } // calculate the address of the index entry inside the index block long indexEntryInBlock = blockNumber % INDEX_ENTRIES_PER_BLOCK; int addressInIndexBlock = (int) (indexEntryInBlock * SubFileParameter.BYTES_PER_INDEX_ENTRY); // return the real index entry return Deserializer.getFiveBytesLong(indexBlock, addressInIndexBlock); }
[ "long", "getIndexEntry", "(", "SubFileParameter", "subFileParameter", ",", "long", "blockNumber", ")", "throws", "IOException", "{", "// check if the block number is out of bounds", "if", "(", "blockNumber", ">=", "subFileParameter", ".", "numberOfBlocks", ")", "{", "throw", "new", "IOException", "(", "\"invalid block number: \"", "+", "blockNumber", ")", ";", "}", "// calculate the index block number", "long", "indexBlockNumber", "=", "blockNumber", "/", "INDEX_ENTRIES_PER_BLOCK", ";", "// create the cache entry key for this request", "IndexCacheEntryKey", "indexCacheEntryKey", "=", "new", "IndexCacheEntryKey", "(", "subFileParameter", ",", "indexBlockNumber", ")", ";", "// check for cached index block", "byte", "[", "]", "indexBlock", "=", "this", ".", "map", ".", "get", "(", "indexCacheEntryKey", ")", ";", "if", "(", "indexBlock", "==", "null", ")", "{", "// cache miss, seek to the correct index block in the file and read it", "long", "indexBlockPosition", "=", "subFileParameter", ".", "indexStartAddress", "+", "indexBlockNumber", "*", "SIZE_OF_INDEX_BLOCK", ";", "int", "remainingIndexSize", "=", "(", "int", ")", "(", "subFileParameter", ".", "indexEndAddress", "-", "indexBlockPosition", ")", ";", "int", "indexBlockSize", "=", "Math", ".", "min", "(", "SIZE_OF_INDEX_BLOCK", ",", "remainingIndexSize", ")", ";", "indexBlock", "=", "new", "byte", "[", "indexBlockSize", "]", ";", "ByteBuffer", "indexBlockWrapper", "=", "ByteBuffer", ".", "wrap", "(", "indexBlock", ",", "0", ",", "indexBlockSize", ")", ";", "synchronized", "(", "this", ".", "fileChannel", ")", "{", "this", ".", "fileChannel", ".", "position", "(", "indexBlockPosition", ")", ";", "if", "(", "this", ".", "fileChannel", ".", "read", "(", "indexBlockWrapper", ")", "!=", "indexBlockSize", ")", "{", "throw", "new", "IOException", "(", "\"could not read index block with size: \"", "+", "indexBlockSize", ")", ";", "}", "}", "// put the index block in the map", "this", ".", "map", ".", "put", "(", "indexCacheEntryKey", ",", "indexBlock", ")", ";", "}", "// calculate the address of the index entry inside the index block", "long", "indexEntryInBlock", "=", "blockNumber", "%", "INDEX_ENTRIES_PER_BLOCK", ";", "int", "addressInIndexBlock", "=", "(", "int", ")", "(", "indexEntryInBlock", "*", "SubFileParameter", ".", "BYTES_PER_INDEX_ENTRY", ")", ";", "// return the real index entry", "return", "Deserializer", ".", "getFiveBytesLong", "(", "indexBlock", ",", "addressInIndexBlock", ")", ";", "}" ]
Returns the index entry of a block in the given map file. If the required index entry is not cached, it will be read from the map file index and put in the cache. @param subFileParameter the parameters of the map file for which the index entry is needed. @param blockNumber the number of the block in the map file. @return the index entry. @throws IOException if an I/O error occurs during reading.
[ "Returns", "the", "index", "entry", "of", "a", "block", "in", "the", "given", "map", "file", ".", "If", "the", "required", "index", "entry", "is", "not", "cached", "it", "will", "be", "read", "from", "the", "map", "file", "index", "and", "put", "in", "the", "cache", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-reader/src/main/java/org/mapsforge/map/reader/IndexCache.java#L71-L111
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.getItemData
public ItemData getItemData(NodeData parent, QPathEntry[] relPathEntries, ItemType itemType) throws RepositoryException { """ Return item data by parent NodeDada and relPathEntries If relpath is JCRPath.THIS_RELPATH = '.' it return itself @param parent @param relPathEntries - array of QPathEntry which represents the relation path to the searched item @param itemType - item type @return existed item data or null if not found @throws RepositoryException """ ItemData item = parent; for (int i = 0; i < relPathEntries.length; i++) { if (i == relPathEntries.length - 1) { item = getItemData(parent, relPathEntries[i], itemType); } else { item = getItemData(parent, relPathEntries[i], ItemType.UNKNOWN); } if (item == null) { break; } if (item.isNode()) { parent = (NodeData)item; } else if (i < relPathEntries.length - 1) { throw new IllegalPathException("Path can not contains a property as the intermediate element"); } } return item; }
java
public ItemData getItemData(NodeData parent, QPathEntry[] relPathEntries, ItemType itemType) throws RepositoryException { ItemData item = parent; for (int i = 0; i < relPathEntries.length; i++) { if (i == relPathEntries.length - 1) { item = getItemData(parent, relPathEntries[i], itemType); } else { item = getItemData(parent, relPathEntries[i], ItemType.UNKNOWN); } if (item == null) { break; } if (item.isNode()) { parent = (NodeData)item; } else if (i < relPathEntries.length - 1) { throw new IllegalPathException("Path can not contains a property as the intermediate element"); } } return item; }
[ "public", "ItemData", "getItemData", "(", "NodeData", "parent", ",", "QPathEntry", "[", "]", "relPathEntries", ",", "ItemType", "itemType", ")", "throws", "RepositoryException", "{", "ItemData", "item", "=", "parent", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "relPathEntries", ".", "length", ";", "i", "++", ")", "{", "if", "(", "i", "==", "relPathEntries", ".", "length", "-", "1", ")", "{", "item", "=", "getItemData", "(", "parent", ",", "relPathEntries", "[", "i", "]", ",", "itemType", ")", ";", "}", "else", "{", "item", "=", "getItemData", "(", "parent", ",", "relPathEntries", "[", "i", "]", ",", "ItemType", ".", "UNKNOWN", ")", ";", "}", "if", "(", "item", "==", "null", ")", "{", "break", ";", "}", "if", "(", "item", ".", "isNode", "(", ")", ")", "{", "parent", "=", "(", "NodeData", ")", "item", ";", "}", "else", "if", "(", "i", "<", "relPathEntries", ".", "length", "-", "1", ")", "{", "throw", "new", "IllegalPathException", "(", "\"Path can not contains a property as the intermediate element\"", ")", ";", "}", "}", "return", "item", ";", "}" ]
Return item data by parent NodeDada and relPathEntries If relpath is JCRPath.THIS_RELPATH = '.' it return itself @param parent @param relPathEntries - array of QPathEntry which represents the relation path to the searched item @param itemType - item type @return existed item data or null if not found @throws RepositoryException
[ "Return", "item", "data", "by", "parent", "NodeDada", "and", "relPathEntries", "If", "relpath", "is", "JCRPath", ".", "THIS_RELPATH", "=", ".", "it", "return", "itself" ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L179-L209
groovy/groovy-core
subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
Sql.withInstance
public static void withInstance(String url, Closure c) throws SQLException { """ Invokes a closure passing it a new Sql instance created from the given JDBC connection URL. The created connection will be closed if required. @param url a database url of the form <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> @param c the Closure to call @see #newInstance(String) @throws SQLException if a database access error occurs """ Sql sql = null; try { sql = newInstance(url); c.call(sql); } finally { if (sql != null) sql.close(); } }
java
public static void withInstance(String url, Closure c) throws SQLException { Sql sql = null; try { sql = newInstance(url); c.call(sql); } finally { if (sql != null) sql.close(); } }
[ "public", "static", "void", "withInstance", "(", "String", "url", ",", "Closure", "c", ")", "throws", "SQLException", "{", "Sql", "sql", "=", "null", ";", "try", "{", "sql", "=", "newInstance", "(", "url", ")", ";", "c", ".", "call", "(", "sql", ")", ";", "}", "finally", "{", "if", "(", "sql", "!=", "null", ")", "sql", ".", "close", "(", ")", ";", "}", "}" ]
Invokes a closure passing it a new Sql instance created from the given JDBC connection URL. The created connection will be closed if required. @param url a database url of the form <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> @param c the Closure to call @see #newInstance(String) @throws SQLException if a database access error occurs
[ "Invokes", "a", "closure", "passing", "it", "a", "new", "Sql", "instance", "created", "from", "the", "given", "JDBC", "connection", "URL", ".", "The", "created", "connection", "will", "be", "closed", "if", "required", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L293-L301
ow2-chameleon/fuchsia
bases/knx/calimero/src/main/java/tuwien/auto/calimero/dptxlator/DPTXlatorTime.java
DPTXlatorTime.setValue
public final void setValue(int dayOfWeek, int hour, int minute, int second) { """ Sets the day of week, hour, minute and second information for the first time item. <p> Any other items in the translator are discarded on successful set.<br> A day of week value of 0 corresponds to "no-day", indicating the day of week is not used. The first day of week is Monday with a value of 1, the last day is Sunday with a value of 7. <br> @param dayOfWeek day of week, 0 &lt;= day &lt;= 7 @param hour hour value, 0 &lt;= hour &lt;= 23 @param minute minute value, 0 &lt;= minute &lt;= 59 @param second second value, 0 &lt;= second &lt;= 59 """ data = set(dayOfWeek, hour, minute, second, new short[3], 0); }
java
public final void setValue(int dayOfWeek, int hour, int minute, int second) { data = set(dayOfWeek, hour, minute, second, new short[3], 0); }
[ "public", "final", "void", "setValue", "(", "int", "dayOfWeek", ",", "int", "hour", ",", "int", "minute", ",", "int", "second", ")", "{", "data", "=", "set", "(", "dayOfWeek", ",", "hour", ",", "minute", ",", "second", ",", "new", "short", "[", "3", "]", ",", "0", ")", ";", "}" ]
Sets the day of week, hour, minute and second information for the first time item. <p> Any other items in the translator are discarded on successful set.<br> A day of week value of 0 corresponds to "no-day", indicating the day of week is not used. The first day of week is Monday with a value of 1, the last day is Sunday with a value of 7. <br> @param dayOfWeek day of week, 0 &lt;= day &lt;= 7 @param hour hour value, 0 &lt;= hour &lt;= 23 @param minute minute value, 0 &lt;= minute &lt;= 59 @param second second value, 0 &lt;= second &lt;= 59
[ "Sets", "the", "day", "of", "week", "hour", "minute", "and", "second", "information", "for", "the", "first", "time", "item", ".", "<p", ">", "Any", "other", "items", "in", "the", "translator", "are", "discarded", "on", "successful", "set", ".", "<br", ">", "A", "day", "of", "week", "value", "of", "0", "corresponds", "to", "no", "-", "day", "indicating", "the", "day", "of", "week", "is", "not", "used", ".", "The", "first", "day", "of", "week", "is", "Monday", "with", "a", "value", "of", "1", "the", "last", "day", "is", "Sunday", "with", "a", "value", "of", "7", ".", "<br", ">" ]
train
https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/dptxlator/DPTXlatorTime.java#L194-L197
MTDdk/jawn
jawn-server/src/main/java/net/javapla/jawn/server/SessionFacadeImpl.java
SessionFacadeImpl.get
public <T> T get(String name, Class<T> type) { """ Convenience method, will do internal check for null and then cast. Will throw <code>ClassCastException</code> only in case the object in session is different type than expected. @param name name of session object. @param type expected type @param <T> type of the returned object @return object in session, or null if not found. """ return get(name) != null? type.cast(get(name)) : null; }
java
public <T> T get(String name, Class<T> type){ return get(name) != null? type.cast(get(name)) : null; }
[ "public", "<", "T", ">", "T", "get", "(", "String", "name", ",", "Class", "<", "T", ">", "type", ")", "{", "return", "get", "(", "name", ")", "!=", "null", "?", "type", ".", "cast", "(", "get", "(", "name", ")", ")", ":", "null", ";", "}" ]
Convenience method, will do internal check for null and then cast. Will throw <code>ClassCastException</code> only in case the object in session is different type than expected. @param name name of session object. @param type expected type @param <T> type of the returned object @return object in session, or null if not found.
[ "Convenience", "method", "will", "do", "internal", "check", "for", "null", "and", "then", "cast", ".", "Will", "throw", "<code", ">", "ClassCastException<", "/", "code", ">", "only", "in", "case", "the", "object", "in", "session", "is", "different", "type", "than", "expected", "." ]
train
https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-server/src/main/java/net/javapla/jawn/server/SessionFacadeImpl.java#L54-L56
CodeNarc/CodeNarc
src/main/java/org/codenarc/util/AstUtil.java
AstUtil.isBinaryExpressionType
public static boolean isBinaryExpressionType(Expression expression, String token) { """ Returns true if the expression is a binary expression with the specified token. @param expression expression @param token token @return as described """ if (expression instanceof BinaryExpression) { if (token.equals(((BinaryExpression) expression).getOperation().getText())) { return true; } } return false; }
java
public static boolean isBinaryExpressionType(Expression expression, String token) { if (expression instanceof BinaryExpression) { if (token.equals(((BinaryExpression) expression).getOperation().getText())) { return true; } } return false; }
[ "public", "static", "boolean", "isBinaryExpressionType", "(", "Expression", "expression", ",", "String", "token", ")", "{", "if", "(", "expression", "instanceof", "BinaryExpression", ")", "{", "if", "(", "token", ".", "equals", "(", "(", "(", "BinaryExpression", ")", "expression", ")", ".", "getOperation", "(", ")", ".", "getText", "(", ")", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Returns true if the expression is a binary expression with the specified token. @param expression expression @param token token @return as described
[ "Returns", "true", "if", "the", "expression", "is", "a", "binary", "expression", "with", "the", "specified", "token", "." ]
train
https://github.com/CodeNarc/CodeNarc/blob/9a7cec02cb8cbaf845030f2434309e8968f5d7a7/src/main/java/org/codenarc/util/AstUtil.java#L771-L778
alkacon/opencms-core
src/org/opencms/db/CmsAliasManager.java
CmsAliasManager.getAliasesForStructureId
public List<CmsAlias> getAliasesForStructureId(CmsObject cms, CmsUUID structureId) throws CmsException { """ Gets the aliases for a given structure id.<p> @param cms the current CMS context @param structureId the structure id of a resource @return the aliases which point to the resource with the given structure id @throws CmsException if something goes wrong """ List<CmsAlias> aliases = m_securityManager.readAliasesById(cms.getRequestContext(), structureId); Collections.sort(aliases, new Comparator<CmsAlias>() { public int compare(CmsAlias first, CmsAlias second) { return first.getAliasPath().compareTo(second.getAliasPath()); } }); return aliases; }
java
public List<CmsAlias> getAliasesForStructureId(CmsObject cms, CmsUUID structureId) throws CmsException { List<CmsAlias> aliases = m_securityManager.readAliasesById(cms.getRequestContext(), structureId); Collections.sort(aliases, new Comparator<CmsAlias>() { public int compare(CmsAlias first, CmsAlias second) { return first.getAliasPath().compareTo(second.getAliasPath()); } }); return aliases; }
[ "public", "List", "<", "CmsAlias", ">", "getAliasesForStructureId", "(", "CmsObject", "cms", ",", "CmsUUID", "structureId", ")", "throws", "CmsException", "{", "List", "<", "CmsAlias", ">", "aliases", "=", "m_securityManager", ".", "readAliasesById", "(", "cms", ".", "getRequestContext", "(", ")", ",", "structureId", ")", ";", "Collections", ".", "sort", "(", "aliases", ",", "new", "Comparator", "<", "CmsAlias", ">", "(", ")", "{", "public", "int", "compare", "(", "CmsAlias", "first", ",", "CmsAlias", "second", ")", "{", "return", "first", ".", "getAliasPath", "(", ")", ".", "compareTo", "(", "second", ".", "getAliasPath", "(", ")", ")", ";", "}", "}", ")", ";", "return", "aliases", ";", "}" ]
Gets the aliases for a given structure id.<p> @param cms the current CMS context @param structureId the structure id of a resource @return the aliases which point to the resource with the given structure id @throws CmsException if something goes wrong
[ "Gets", "the", "aliases", "for", "a", "given", "structure", "id", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsAliasManager.java#L133-L144
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessageUtils.java
HttpMessageUtils.copy
public static void copy(HttpMessage from, HttpMessage to) { """ Apply message settings to target http message. @param from @param to """ to.setName(from.getName()); to.setPayload(from.getPayload()); from.getHeaders().entrySet() .stream() .filter(entry -> !entry.getKey().equals(MessageHeaders.ID) && !entry.getKey().equals(MessageHeaders.TIMESTAMP)) .forEach(entry -> to.header(entry.getKey(), entry.getValue())); from.getHeaderData().forEach(to::addHeaderData); from.getCookies().forEach(to::cookie); }
java
public static void copy(HttpMessage from, HttpMessage to) { to.setName(from.getName()); to.setPayload(from.getPayload()); from.getHeaders().entrySet() .stream() .filter(entry -> !entry.getKey().equals(MessageHeaders.ID) && !entry.getKey().equals(MessageHeaders.TIMESTAMP)) .forEach(entry -> to.header(entry.getKey(), entry.getValue())); from.getHeaderData().forEach(to::addHeaderData); from.getCookies().forEach(to::cookie); }
[ "public", "static", "void", "copy", "(", "HttpMessage", "from", ",", "HttpMessage", "to", ")", "{", "to", ".", "setName", "(", "from", ".", "getName", "(", ")", ")", ";", "to", ".", "setPayload", "(", "from", ".", "getPayload", "(", ")", ")", ";", "from", ".", "getHeaders", "(", ")", ".", "entrySet", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "entry", "->", "!", "entry", ".", "getKey", "(", ")", ".", "equals", "(", "MessageHeaders", ".", "ID", ")", "&&", "!", "entry", ".", "getKey", "(", ")", ".", "equals", "(", "MessageHeaders", ".", "TIMESTAMP", ")", ")", ".", "forEach", "(", "entry", "->", "to", ".", "header", "(", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ")", ")", ";", "from", ".", "getHeaderData", "(", ")", ".", "forEach", "(", "to", "::", "addHeaderData", ")", ";", "from", ".", "getCookies", "(", ")", ".", "forEach", "(", "to", "::", "cookie", ")", ";", "}" ]
Apply message settings to target http message. @param from @param to
[ "Apply", "message", "settings", "to", "target", "http", "message", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessageUtils.java#L56-L67
VoltDB/voltdb
src/frontend/org/voltdb/compiler/PlannerTool.java
PlannerTool.planSqlCore
public synchronized CompiledPlan planSqlCore(String sql, StatementPartitioning partitioning) { """ Stripped down compile that is ONLY used to plan default procedures. """ TrivialCostModel costModel = new TrivialCostModel(); DatabaseEstimates estimates = new DatabaseEstimates(); CompiledPlan plan = null; // This try-with-resources block acquires a global lock on all planning // This is required until we figure out how to do parallel planning. try (QueryPlanner planner = new QueryPlanner( sql, "PlannerTool", "PlannerToolProc", m_database, partitioning, m_hsql, estimates, !VoltCompiler.DEBUG_MODE, costModel, null, null, DeterminismMode.FASTER, false)) { // do the expensive full planning. planner.parse(); plan = planner.plan(); assert(plan != null); } catch (Exception e) { /* * Don't log PlanningErrorExceptions or HSQLParseExceptions, as they * are at least somewhat expected. */ String loggedMsg = ""; if (!(e instanceof PlanningErrorException || e instanceof HSQLParseException)) { logException(e, "Error compiling query"); loggedMsg = " (Stack trace has been written to the log.)"; } if (e.getMessage() != null) { throw new RuntimeException("SQL error while compiling query: " + e.getMessage() + loggedMsg, e); } throw new RuntimeException("SQL error while compiling query: " + e.toString() + loggedMsg, e); } if (plan == null) { throw new RuntimeException("Null plan received in PlannerTool.planSql"); } return plan; }
java
public synchronized CompiledPlan planSqlCore(String sql, StatementPartitioning partitioning) { TrivialCostModel costModel = new TrivialCostModel(); DatabaseEstimates estimates = new DatabaseEstimates(); CompiledPlan plan = null; // This try-with-resources block acquires a global lock on all planning // This is required until we figure out how to do parallel planning. try (QueryPlanner planner = new QueryPlanner( sql, "PlannerTool", "PlannerToolProc", m_database, partitioning, m_hsql, estimates, !VoltCompiler.DEBUG_MODE, costModel, null, null, DeterminismMode.FASTER, false)) { // do the expensive full planning. planner.parse(); plan = planner.plan(); assert(plan != null); } catch (Exception e) { /* * Don't log PlanningErrorExceptions or HSQLParseExceptions, as they * are at least somewhat expected. */ String loggedMsg = ""; if (!(e instanceof PlanningErrorException || e instanceof HSQLParseException)) { logException(e, "Error compiling query"); loggedMsg = " (Stack trace has been written to the log.)"; } if (e.getMessage() != null) { throw new RuntimeException("SQL error while compiling query: " + e.getMessage() + loggedMsg, e); } throw new RuntimeException("SQL error while compiling query: " + e.toString() + loggedMsg, e); } if (plan == null) { throw new RuntimeException("Null plan received in PlannerTool.planSql"); } return plan; }
[ "public", "synchronized", "CompiledPlan", "planSqlCore", "(", "String", "sql", ",", "StatementPartitioning", "partitioning", ")", "{", "TrivialCostModel", "costModel", "=", "new", "TrivialCostModel", "(", ")", ";", "DatabaseEstimates", "estimates", "=", "new", "DatabaseEstimates", "(", ")", ";", "CompiledPlan", "plan", "=", "null", ";", "// This try-with-resources block acquires a global lock on all planning", "// This is required until we figure out how to do parallel planning.", "try", "(", "QueryPlanner", "planner", "=", "new", "QueryPlanner", "(", "sql", ",", "\"PlannerTool\"", ",", "\"PlannerToolProc\"", ",", "m_database", ",", "partitioning", ",", "m_hsql", ",", "estimates", ",", "!", "VoltCompiler", ".", "DEBUG_MODE", ",", "costModel", ",", "null", ",", "null", ",", "DeterminismMode", ".", "FASTER", ",", "false", ")", ")", "{", "// do the expensive full planning.", "planner", ".", "parse", "(", ")", ";", "plan", "=", "planner", ".", "plan", "(", ")", ";", "assert", "(", "plan", "!=", "null", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "/*\n * Don't log PlanningErrorExceptions or HSQLParseExceptions, as they\n * are at least somewhat expected.\n */", "String", "loggedMsg", "=", "\"\"", ";", "if", "(", "!", "(", "e", "instanceof", "PlanningErrorException", "||", "e", "instanceof", "HSQLParseException", ")", ")", "{", "logException", "(", "e", ",", "\"Error compiling query\"", ")", ";", "loggedMsg", "=", "\" (Stack trace has been written to the log.)\"", ";", "}", "if", "(", "e", ".", "getMessage", "(", ")", "!=", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"SQL error while compiling query: \"", "+", "e", ".", "getMessage", "(", ")", "+", "loggedMsg", ",", "e", ")", ";", "}", "throw", "new", "RuntimeException", "(", "\"SQL error while compiling query: \"", "+", "e", ".", "toString", "(", ")", "+", "loggedMsg", ",", "e", ")", ";", "}", "if", "(", "plan", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"Null plan received in PlannerTool.planSql\"", ")", ";", "}", "return", "plan", ";", "}" ]
Stripped down compile that is ONLY used to plan default procedures.
[ "Stripped", "down", "compile", "that", "is", "ONLY", "used", "to", "plan", "default", "procedures", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compiler/PlannerTool.java#L147-L185
RestComm/jss7
map/map-impl/src/main/java/org/restcomm/protocols/ss7/map/MAPServiceBaseImpl.java
MAPServiceBaseImpl.createNewTCAPDialog
protected Dialog createNewTCAPDialog(SccpAddress origAddress, SccpAddress destAddress, Long localTrId) throws MAPException { """ Creating new outgoing TCAP Dialog. Used when creating a new outgoing MAP Dialog @param origAddress @param destAddress @return @throws MAPException """ try { return this.mapProviderImpl.getTCAPProvider().getNewDialog(origAddress, destAddress, localTrId); } catch (TCAPException e) { throw new MAPException(e.getMessage(), e); } }
java
protected Dialog createNewTCAPDialog(SccpAddress origAddress, SccpAddress destAddress, Long localTrId) throws MAPException { try { return this.mapProviderImpl.getTCAPProvider().getNewDialog(origAddress, destAddress, localTrId); } catch (TCAPException e) { throw new MAPException(e.getMessage(), e); } }
[ "protected", "Dialog", "createNewTCAPDialog", "(", "SccpAddress", "origAddress", ",", "SccpAddress", "destAddress", ",", "Long", "localTrId", ")", "throws", "MAPException", "{", "try", "{", "return", "this", ".", "mapProviderImpl", ".", "getTCAPProvider", "(", ")", ".", "getNewDialog", "(", "origAddress", ",", "destAddress", ",", "localTrId", ")", ";", "}", "catch", "(", "TCAPException", "e", ")", "{", "throw", "new", "MAPException", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "}" ]
Creating new outgoing TCAP Dialog. Used when creating a new outgoing MAP Dialog @param origAddress @param destAddress @return @throws MAPException
[ "Creating", "new", "outgoing", "TCAP", "Dialog", ".", "Used", "when", "creating", "a", "new", "outgoing", "MAP", "Dialog" ]
train
https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/map/map-impl/src/main/java/org/restcomm/protocols/ss7/map/MAPServiceBaseImpl.java#L82-L88
threerings/narya
core/src/main/java/com/threerings/presents/peer/util/PeerUtil.java
PeerUtil.createProviderProxy
public static <S extends InvocationProvider, T extends InvocationService<?>> S createProviderProxy (Class<S> clazz, final T svc, final Client client) { """ Creates a proxy object implementing the specified provider interface (a subinterface of {@link InvocationProvider} that forwards requests to the given service implementation (a subinterface of {@link InvocationService} corresponding to the provider interface) on the specified client. This is useful for server entities that need to call a method either on the current server (with <code>null</code> as the caller parameter) or on a peer server. @param clazz the subclass of {@link InvocationProvider} desired to be implemented @param svc the implementation of the corresponding subclass of {@link InvocationService} @param client the client to pass to the service methods """ return clazz.cast(Proxy.newProxyInstance( clazz.getClassLoader(), new Class<?>[] { clazz }, new InvocationHandler() { public Object invoke (Object proxy, Method method, Object[] args) throws Throwable { Method smethod = _pmethods.get(method); if (smethod == null) { Class<?>[] ptypes = method.getParameterTypes(); _pmethods.put(method, smethod = svc.getClass().getMethod( method.getName(), ArrayUtil.splice(ptypes, 0, 1))); } return smethod.invoke(svc, ArrayUtil.splice(args, 0, 1)); } })); }
java
public static <S extends InvocationProvider, T extends InvocationService<?>> S createProviderProxy (Class<S> clazz, final T svc, final Client client) { return clazz.cast(Proxy.newProxyInstance( clazz.getClassLoader(), new Class<?>[] { clazz }, new InvocationHandler() { public Object invoke (Object proxy, Method method, Object[] args) throws Throwable { Method smethod = _pmethods.get(method); if (smethod == null) { Class<?>[] ptypes = method.getParameterTypes(); _pmethods.put(method, smethod = svc.getClass().getMethod( method.getName(), ArrayUtil.splice(ptypes, 0, 1))); } return smethod.invoke(svc, ArrayUtil.splice(args, 0, 1)); } })); }
[ "public", "static", "<", "S", "extends", "InvocationProvider", ",", "T", "extends", "InvocationService", "<", "?", ">", ">", "S", "createProviderProxy", "(", "Class", "<", "S", ">", "clazz", ",", "final", "T", "svc", ",", "final", "Client", "client", ")", "{", "return", "clazz", ".", "cast", "(", "Proxy", ".", "newProxyInstance", "(", "clazz", ".", "getClassLoader", "(", ")", ",", "new", "Class", "<", "?", ">", "[", "]", "{", "clazz", "}", ",", "new", "InvocationHandler", "(", ")", "{", "public", "Object", "invoke", "(", "Object", "proxy", ",", "Method", "method", ",", "Object", "[", "]", "args", ")", "throws", "Throwable", "{", "Method", "smethod", "=", "_pmethods", ".", "get", "(", "method", ")", ";", "if", "(", "smethod", "==", "null", ")", "{", "Class", "<", "?", ">", "[", "]", "ptypes", "=", "method", ".", "getParameterTypes", "(", ")", ";", "_pmethods", ".", "put", "(", "method", ",", "smethod", "=", "svc", ".", "getClass", "(", ")", ".", "getMethod", "(", "method", ".", "getName", "(", ")", ",", "ArrayUtil", ".", "splice", "(", "ptypes", ",", "0", ",", "1", ")", ")", ")", ";", "}", "return", "smethod", ".", "invoke", "(", "svc", ",", "ArrayUtil", ".", "splice", "(", "args", ",", "0", ",", "1", ")", ")", ";", "}", "}", ")", ")", ";", "}" ]
Creates a proxy object implementing the specified provider interface (a subinterface of {@link InvocationProvider} that forwards requests to the given service implementation (a subinterface of {@link InvocationService} corresponding to the provider interface) on the specified client. This is useful for server entities that need to call a method either on the current server (with <code>null</code> as the caller parameter) or on a peer server. @param clazz the subclass of {@link InvocationProvider} desired to be implemented @param svc the implementation of the corresponding subclass of {@link InvocationService} @param client the client to pass to the service methods
[ "Creates", "a", "proxy", "object", "implementing", "the", "specified", "provider", "interface", "(", "a", "subinterface", "of", "{", "@link", "InvocationProvider", "}", "that", "forwards", "requests", "to", "the", "given", "service", "implementation", "(", "a", "subinterface", "of", "{", "@link", "InvocationService", "}", "corresponding", "to", "the", "provider", "interface", ")", "on", "the", "specified", "client", ".", "This", "is", "useful", "for", "server", "entities", "that", "need", "to", "call", "a", "method", "either", "on", "the", "current", "server", "(", "with", "<code", ">", "null<", "/", "code", ">", "as", "the", "caller", "parameter", ")", "or", "on", "a", "peer", "server", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/util/PeerUtil.java#L54-L71
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuGraphGetEdges
public static int cuGraphGetEdges(CUgraph hGraph, CUgraphNode from[], CUgraphNode to[], long numEdges[]) { """ Returns a graph's dependency edges.<br> <br> Returns a list of \p hGraph's dependency edges. Edges are returned via corresponding indices in \p from and \p to; that is, the node in \p to[i] has a dependency on the node in \p from[i]. \p from and \p to may both be NULL, in which case this function only returns the number of edges in \p numEdges. Otherwise, \p numEdges entries will be filled in. If \p numEdges is higher than the actual number of edges, the remaining entries in \p from and \p to will be set to NULL, and the number of edges actually returned will be written to \p numEdges. @param hGraph - Graph to get the edges from @param from - Location to return edge endpoints @param to - Location to return edge endpoints @param numEdges - See description @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_VALUE @see JCudaDriver#cuGraphGetNodes JCudaDriver#cuGraphGetRootNodes JCudaDriver#cuGraphAddDependencies JCudaDriver#cuGraphRemoveDependencies JCudaDriver#cuGraphNodeGetDependencies JCudaDriver#cuGraphNodeGetDependentNodes """ return checkResult(cuGraphGetEdgesNative(hGraph, from, to, numEdges)); }
java
public static int cuGraphGetEdges(CUgraph hGraph, CUgraphNode from[], CUgraphNode to[], long numEdges[]) { return checkResult(cuGraphGetEdgesNative(hGraph, from, to, numEdges)); }
[ "public", "static", "int", "cuGraphGetEdges", "(", "CUgraph", "hGraph", ",", "CUgraphNode", "from", "[", "]", ",", "CUgraphNode", "to", "[", "]", ",", "long", "numEdges", "[", "]", ")", "{", "return", "checkResult", "(", "cuGraphGetEdgesNative", "(", "hGraph", ",", "from", ",", "to", ",", "numEdges", ")", ")", ";", "}" ]
Returns a graph's dependency edges.<br> <br> Returns a list of \p hGraph's dependency edges. Edges are returned via corresponding indices in \p from and \p to; that is, the node in \p to[i] has a dependency on the node in \p from[i]. \p from and \p to may both be NULL, in which case this function only returns the number of edges in \p numEdges. Otherwise, \p numEdges entries will be filled in. If \p numEdges is higher than the actual number of edges, the remaining entries in \p from and \p to will be set to NULL, and the number of edges actually returned will be written to \p numEdges. @param hGraph - Graph to get the edges from @param from - Location to return edge endpoints @param to - Location to return edge endpoints @param numEdges - See description @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_VALUE @see JCudaDriver#cuGraphGetNodes JCudaDriver#cuGraphGetRootNodes JCudaDriver#cuGraphAddDependencies JCudaDriver#cuGraphRemoveDependencies JCudaDriver#cuGraphNodeGetDependencies JCudaDriver#cuGraphNodeGetDependentNodes
[ "Returns", "a", "graph", "s", "dependency", "edges", ".", "<br", ">", "<br", ">", "Returns", "a", "list", "of", "\\", "p", "hGraph", "s", "dependency", "edges", ".", "Edges", "are", "returned", "via", "corresponding", "indices", "in", "\\", "p", "from", "and", "\\", "p", "to", ";", "that", "is", "the", "node", "in", "\\", "p", "to", "[", "i", "]", "has", "a", "dependency", "on", "the", "node", "in", "\\", "p", "from", "[", "i", "]", ".", "\\", "p", "from", "and", "\\", "p", "to", "may", "both", "be", "NULL", "in", "which", "case", "this", "function", "only", "returns", "the", "number", "of", "edges", "in", "\\", "p", "numEdges", ".", "Otherwise", "\\", "p", "numEdges", "entries", "will", "be", "filled", "in", ".", "If", "\\", "p", "numEdges", "is", "higher", "than", "the", "actual", "number", "of", "edges", "the", "remaining", "entries", "in", "\\", "p", "from", "and", "\\", "p", "to", "will", "be", "set", "to", "NULL", "and", "the", "number", "of", "edges", "actually", "returned", "will", "be", "written", "to", "\\", "p", "numEdges", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L12747-L12750
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.addInlineComment
public void addInlineComment(Doc doc, Content htmltree) { """ Adds the inline comment. @param doc the doc for which the inline comments will be generated @param htmltree the documentation tree to which the inline comments will be added """ addCommentTags(doc, doc.inlineTags(), false, false, htmltree); }
java
public void addInlineComment(Doc doc, Content htmltree) { addCommentTags(doc, doc.inlineTags(), false, false, htmltree); }
[ "public", "void", "addInlineComment", "(", "Doc", "doc", ",", "Content", "htmltree", ")", "{", "addCommentTags", "(", "doc", ",", "doc", ".", "inlineTags", "(", ")", ",", "false", ",", "false", ",", "htmltree", ")", ";", "}" ]
Adds the inline comment. @param doc the doc for which the inline comments will be generated @param htmltree the documentation tree to which the inline comments will be added
[ "Adds", "the", "inline", "comment", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L1465-L1467
astrapi69/mystic-crypt
crypt-data/src/main/java/de/alpharogroup/crypto/factories/KeyPairFactory.java
KeyPairFactory.newKeyPair
public static KeyPair newKeyPair(final File publicKeyDerFile, final File privateKeyDerFile) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException, IOException { """ Factory method for creating a new {@link KeyPair} from the given parameters. @param publicKeyDerFile the public key der file @param privateKeyDerFile the private key der file @return the new {@link KeyPair} from the given parameters. @throws IOException Signals that an I/O exception has occurred. @throws NoSuchAlgorithmException is thrown if no Provider supports a KeyPairGeneratorSpi implementation for the specified algorithm @throws InvalidKeySpecException is thrown if generation of the SecretKey object fails. @throws NoSuchProviderException is thrown if the specified provider is not registered in the security provider list """ final PublicKey publicKey = PublicKeyReader.readPublicKey(publicKeyDerFile); final PrivateKey privateKey = PrivateKeyReader.readPrivateKey(privateKeyDerFile); return newKeyPair(publicKey, privateKey); }
java
public static KeyPair newKeyPair(final File publicKeyDerFile, final File privateKeyDerFile) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException, IOException { final PublicKey publicKey = PublicKeyReader.readPublicKey(publicKeyDerFile); final PrivateKey privateKey = PrivateKeyReader.readPrivateKey(privateKeyDerFile); return newKeyPair(publicKey, privateKey); }
[ "public", "static", "KeyPair", "newKeyPair", "(", "final", "File", "publicKeyDerFile", ",", "final", "File", "privateKeyDerFile", ")", "throws", "NoSuchAlgorithmException", ",", "InvalidKeySpecException", ",", "NoSuchProviderException", ",", "IOException", "{", "final", "PublicKey", "publicKey", "=", "PublicKeyReader", ".", "readPublicKey", "(", "publicKeyDerFile", ")", ";", "final", "PrivateKey", "privateKey", "=", "PrivateKeyReader", ".", "readPrivateKey", "(", "privateKeyDerFile", ")", ";", "return", "newKeyPair", "(", "publicKey", ",", "privateKey", ")", ";", "}" ]
Factory method for creating a new {@link KeyPair} from the given parameters. @param publicKeyDerFile the public key der file @param privateKeyDerFile the private key der file @return the new {@link KeyPair} from the given parameters. @throws IOException Signals that an I/O exception has occurred. @throws NoSuchAlgorithmException is thrown if no Provider supports a KeyPairGeneratorSpi implementation for the specified algorithm @throws InvalidKeySpecException is thrown if generation of the SecretKey object fails. @throws NoSuchProviderException is thrown if the specified provider is not registered in the security provider list
[ "Factory", "method", "for", "creating", "a", "new", "{", "@link", "KeyPair", "}", "from", "the", "given", "parameters", "." ]
train
https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-data/src/main/java/de/alpharogroup/crypto/factories/KeyPairFactory.java#L154-L161
jboss/jboss-jad-api_spec
src/main/java/javax/enterprise/deploy/shared/factories/DeploymentFactoryManager.java
DeploymentFactoryManager.getDeploymentManager
public DeploymentManager getDeploymentManager(String uri, String userName, String password) throws DeploymentManagerCreationException { """ Get a connected deployment manager @param uri the uri of the deployment manager @param userName the user name @param password the password @return the deployment manager @throws DeploymentManagerCreationException """ Set clone; synchronized (deploymentFactories) { clone = new HashSet(deploymentFactories); } for (Iterator i = clone.iterator(); i.hasNext();) { DeploymentFactory factory = (DeploymentFactory)i.next(); if (factory.handlesURI(uri)) return factory.getDeploymentManager(uri, userName, password); } throw new DeploymentManagerCreationException("No deployment manager for uri=" + uri); }
java
public DeploymentManager getDeploymentManager(String uri, String userName, String password) throws DeploymentManagerCreationException { Set clone; synchronized (deploymentFactories) { clone = new HashSet(deploymentFactories); } for (Iterator i = clone.iterator(); i.hasNext();) { DeploymentFactory factory = (DeploymentFactory)i.next(); if (factory.handlesURI(uri)) return factory.getDeploymentManager(uri, userName, password); } throw new DeploymentManagerCreationException("No deployment manager for uri=" + uri); }
[ "public", "DeploymentManager", "getDeploymentManager", "(", "String", "uri", ",", "String", "userName", ",", "String", "password", ")", "throws", "DeploymentManagerCreationException", "{", "Set", "clone", ";", "synchronized", "(", "deploymentFactories", ")", "{", "clone", "=", "new", "HashSet", "(", "deploymentFactories", ")", ";", "}", "for", "(", "Iterator", "i", "=", "clone", ".", "iterator", "(", ")", ";", "i", ".", "hasNext", "(", ")", ";", ")", "{", "DeploymentFactory", "factory", "=", "(", "DeploymentFactory", ")", "i", ".", "next", "(", ")", ";", "if", "(", "factory", ".", "handlesURI", "(", "uri", ")", ")", "return", "factory", ".", "getDeploymentManager", "(", "uri", ",", "userName", ",", "password", ")", ";", "}", "throw", "new", "DeploymentManagerCreationException", "(", "\"No deployment manager for uri=\"", "+", "uri", ")", ";", "}" ]
Get a connected deployment manager @param uri the uri of the deployment manager @param userName the user name @param password the password @return the deployment manager @throws DeploymentManagerCreationException
[ "Get", "a", "connected", "deployment", "manager" ]
train
https://github.com/jboss/jboss-jad-api_spec/blob/b5ebffc7082aadf327023d81a799ae6567d20cef/src/main/java/javax/enterprise/deploy/shared/factories/DeploymentFactoryManager.java#L86-L100
resilience4j/resilience4j
resilience4j-prometheus/src/main/java/io/github/resilience4j/prometheus/RateLimiterExports.java
RateLimiterExports.ofIterable
public static RateLimiterExports ofIterable(String prefix, Iterable<RateLimiter> rateLimiters) { """ Creates a new instance of {@link RateLimiterExports} with specified metrics names prefix and {@link Iterable} of rate limiters. @param prefix the prefix of metrics names @param rateLimiters the rate limiters """ return new RateLimiterExports(prefix, rateLimiters); }
java
public static RateLimiterExports ofIterable(String prefix, Iterable<RateLimiter> rateLimiters) { return new RateLimiterExports(prefix, rateLimiters); }
[ "public", "static", "RateLimiterExports", "ofIterable", "(", "String", "prefix", ",", "Iterable", "<", "RateLimiter", ">", "rateLimiters", ")", "{", "return", "new", "RateLimiterExports", "(", "prefix", ",", "rateLimiters", ")", ";", "}" ]
Creates a new instance of {@link RateLimiterExports} with specified metrics names prefix and {@link Iterable} of rate limiters. @param prefix the prefix of metrics names @param rateLimiters the rate limiters
[ "Creates", "a", "new", "instance", "of", "{", "@link", "RateLimiterExports", "}", "with", "specified", "metrics", "names", "prefix", "and", "{", "@link", "Iterable", "}", "of", "rate", "limiters", "." ]
train
https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-prometheus/src/main/java/io/github/resilience4j/prometheus/RateLimiterExports.java#L117-L119
m-m-m/util
pojopath/src/main/java/net/sf/mmm/util/pojo/path/base/AbstractPojoPathNavigator.java
AbstractPojoPathNavigator.setInList
protected Object setInList(CachingPojoPath currentPath, PojoPathContext context, PojoPathState state, Object parentPojo, Object value, int index) { """ This method {@link CollectionReflectionUtil#set(Object, int, Object, GenericBean) sets} the single {@link CachingPojoPath#getSegment() segment} of the given {@code currentPath} from the array or {@link java.util.List} given by {@code parentPojo}. If the result is {@code null} and {@code mode} is {@link PojoPathMode#CREATE_IF_NULL} it creates and attaches (sets) the missing object. @param currentPath is the current {@link CachingPojoPath} to set. @param context is the {@link PojoPathContext context} for this operation. @param state is the {@link #createState(Object, String, PojoPathMode, PojoPathContext) state} to use. @param parentPojo is the parent {@link net.sf.mmm.util.pojo.api.Pojo} to work on. @param value is the value to set in {@code parentPojo}. @param index is the position of the {@code value} to set in the array or {@link java.util.List} given by {@code parentPojo}. @return the replaced value. It may be {@code null}. """ Object arrayOrList = convertList(currentPath, context, state, parentPojo); GenericBean<Object> arrayReceiver = new GenericBean<>(); Object convertedValue = value; if (currentPath.parent != null) { GenericType<?> collectionType = currentPath.parent.pojoType; if (collectionType != null) { GenericType<?> valueType = collectionType.getComponentType(); convertedValue = convert(currentPath, context, value, valueType.getAssignmentClass(), valueType); } } Object result = getCollectionReflectionUtil().set(arrayOrList, index, convertedValue, arrayReceiver); Object newArray = arrayReceiver.getValue(); if (newArray != null) { if (currentPath.parent.parent == null) { throw new PojoPathCreationException(state.rootPath.pojo, currentPath.getPojoPath()); } Object parentParentPojo; if (currentPath.parent.parent == null) { parentParentPojo = state.rootPath.pojo; } else { parentParentPojo = currentPath.parent.parent.pojo; } set(currentPath.parent, context, state, parentParentPojo, newArray); } return result; }
java
protected Object setInList(CachingPojoPath currentPath, PojoPathContext context, PojoPathState state, Object parentPojo, Object value, int index) { Object arrayOrList = convertList(currentPath, context, state, parentPojo); GenericBean<Object> arrayReceiver = new GenericBean<>(); Object convertedValue = value; if (currentPath.parent != null) { GenericType<?> collectionType = currentPath.parent.pojoType; if (collectionType != null) { GenericType<?> valueType = collectionType.getComponentType(); convertedValue = convert(currentPath, context, value, valueType.getAssignmentClass(), valueType); } } Object result = getCollectionReflectionUtil().set(arrayOrList, index, convertedValue, arrayReceiver); Object newArray = arrayReceiver.getValue(); if (newArray != null) { if (currentPath.parent.parent == null) { throw new PojoPathCreationException(state.rootPath.pojo, currentPath.getPojoPath()); } Object parentParentPojo; if (currentPath.parent.parent == null) { parentParentPojo = state.rootPath.pojo; } else { parentParentPojo = currentPath.parent.parent.pojo; } set(currentPath.parent, context, state, parentParentPojo, newArray); } return result; }
[ "protected", "Object", "setInList", "(", "CachingPojoPath", "currentPath", ",", "PojoPathContext", "context", ",", "PojoPathState", "state", ",", "Object", "parentPojo", ",", "Object", "value", ",", "int", "index", ")", "{", "Object", "arrayOrList", "=", "convertList", "(", "currentPath", ",", "context", ",", "state", ",", "parentPojo", ")", ";", "GenericBean", "<", "Object", ">", "arrayReceiver", "=", "new", "GenericBean", "<>", "(", ")", ";", "Object", "convertedValue", "=", "value", ";", "if", "(", "currentPath", ".", "parent", "!=", "null", ")", "{", "GenericType", "<", "?", ">", "collectionType", "=", "currentPath", ".", "parent", ".", "pojoType", ";", "if", "(", "collectionType", "!=", "null", ")", "{", "GenericType", "<", "?", ">", "valueType", "=", "collectionType", ".", "getComponentType", "(", ")", ";", "convertedValue", "=", "convert", "(", "currentPath", ",", "context", ",", "value", ",", "valueType", ".", "getAssignmentClass", "(", ")", ",", "valueType", ")", ";", "}", "}", "Object", "result", "=", "getCollectionReflectionUtil", "(", ")", ".", "set", "(", "arrayOrList", ",", "index", ",", "convertedValue", ",", "arrayReceiver", ")", ";", "Object", "newArray", "=", "arrayReceiver", ".", "getValue", "(", ")", ";", "if", "(", "newArray", "!=", "null", ")", "{", "if", "(", "currentPath", ".", "parent", ".", "parent", "==", "null", ")", "{", "throw", "new", "PojoPathCreationException", "(", "state", ".", "rootPath", ".", "pojo", ",", "currentPath", ".", "getPojoPath", "(", ")", ")", ";", "}", "Object", "parentParentPojo", ";", "if", "(", "currentPath", ".", "parent", ".", "parent", "==", "null", ")", "{", "parentParentPojo", "=", "state", ".", "rootPath", ".", "pojo", ";", "}", "else", "{", "parentParentPojo", "=", "currentPath", ".", "parent", ".", "parent", ".", "pojo", ";", "}", "set", "(", "currentPath", ".", "parent", ",", "context", ",", "state", ",", "parentParentPojo", ",", "newArray", ")", ";", "}", "return", "result", ";", "}" ]
This method {@link CollectionReflectionUtil#set(Object, int, Object, GenericBean) sets} the single {@link CachingPojoPath#getSegment() segment} of the given {@code currentPath} from the array or {@link java.util.List} given by {@code parentPojo}. If the result is {@code null} and {@code mode} is {@link PojoPathMode#CREATE_IF_NULL} it creates and attaches (sets) the missing object. @param currentPath is the current {@link CachingPojoPath} to set. @param context is the {@link PojoPathContext context} for this operation. @param state is the {@link #createState(Object, String, PojoPathMode, PojoPathContext) state} to use. @param parentPojo is the parent {@link net.sf.mmm.util.pojo.api.Pojo} to work on. @param value is the value to set in {@code parentPojo}. @param index is the position of the {@code value} to set in the array or {@link java.util.List} given by {@code parentPojo}. @return the replaced value. It may be {@code null}.
[ "This", "method", "{", "@link", "CollectionReflectionUtil#set", "(", "Object", "int", "Object", "GenericBean", ")", "sets", "}", "the", "single", "{", "@link", "CachingPojoPath#getSegment", "()", "segment", "}", "of", "the", "given", "{", "@code", "currentPath", "}", "from", "the", "array", "or", "{", "@link", "java", ".", "util", ".", "List", "}", "given", "by", "{", "@code", "parentPojo", "}", ".", "If", "the", "result", "is", "{", "@code", "null", "}", "and", "{", "@code", "mode", "}", "is", "{", "@link", "PojoPathMode#CREATE_IF_NULL", "}", "it", "creates", "and", "attaches", "(", "sets", ")", "the", "missing", "object", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/pojopath/src/main/java/net/sf/mmm/util/pojo/path/base/AbstractPojoPathNavigator.java#L886-L913
rzwitserloot/lombok.ast
src/main/lombok/ast/syntaxChecks/SyntacticValidityVisitorBase.java
SyntacticValidityVisitorBase.checkChildValidity
void checkChildValidity(Node node, Node child, String name, boolean mandatory, Class<?> typeAssertion) { """ Checks if a given child is syntactically valid; you specify exactly what is required for this to hold in the parameters. This method will recursively call {@link #checkSyntacticValidity()} on the child. @param node The node responsible for the check. @param child The actual child node object that will be checked. @param name The name of this node. For example, in a binary operation, {@code "left side"}. @param mandatory If this node not being there (being {@code null}) is a problem or acceptable. @param typeAssertion If the node exists, it must be an instance of this type. """ verifyNodeRelation(node, child, name, mandatory, typeAssertion); }
java
void checkChildValidity(Node node, Node child, String name, boolean mandatory, Class<?> typeAssertion) { verifyNodeRelation(node, child, name, mandatory, typeAssertion); }
[ "void", "checkChildValidity", "(", "Node", "node", ",", "Node", "child", ",", "String", "name", ",", "boolean", "mandatory", ",", "Class", "<", "?", ">", "typeAssertion", ")", "{", "verifyNodeRelation", "(", "node", ",", "child", ",", "name", ",", "mandatory", ",", "typeAssertion", ")", ";", "}" ]
Checks if a given child is syntactically valid; you specify exactly what is required for this to hold in the parameters. This method will recursively call {@link #checkSyntacticValidity()} on the child. @param node The node responsible for the check. @param child The actual child node object that will be checked. @param name The name of this node. For example, in a binary operation, {@code "left side"}. @param mandatory If this node not being there (being {@code null}) is a problem or acceptable. @param typeAssertion If the node exists, it must be an instance of this type.
[ "Checks", "if", "a", "given", "child", "is", "syntactically", "valid", ";", "you", "specify", "exactly", "what", "is", "required", "for", "this", "to", "hold", "in", "the", "parameters", ".", "This", "method", "will", "recursively", "call", "{", "@link", "#checkSyntacticValidity", "()", "}", "on", "the", "child", "." ]
train
https://github.com/rzwitserloot/lombok.ast/blob/ed83541c1a5a08952a5d4d7e316a6be9a05311fb/src/main/lombok/ast/syntaxChecks/SyntacticValidityVisitorBase.java#L69-L71
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java
EventDispatcher.publishCreated
public void publishCreated(Cache<K, V> cache, K key, V value) { """ Publishes a creation event for the entry to all of the interested listeners. @param cache the cache where the entry was created @param key the entry's key @param value the entry's value """ publish(cache, EventType.CREATED, key, /* newValue */ null, value, /* quiet */ false); }
java
public void publishCreated(Cache<K, V> cache, K key, V value) { publish(cache, EventType.CREATED, key, /* newValue */ null, value, /* quiet */ false); }
[ "public", "void", "publishCreated", "(", "Cache", "<", "K", ",", "V", ">", "cache", ",", "K", "key", ",", "V", "value", ")", "{", "publish", "(", "cache", ",", "EventType", ".", "CREATED", ",", "key", ",", "/* newValue */", "null", ",", "value", ",", "/* quiet */", "false", ")", ";", "}" ]
Publishes a creation event for the entry to all of the interested listeners. @param cache the cache where the entry was created @param key the entry's key @param value the entry's value
[ "Publishes", "a", "creation", "event", "for", "the", "entry", "to", "all", "of", "the", "interested", "listeners", "." ]
train
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java#L113-L115
facebook/fresco
imagepipeline-base/src/main/java/com/facebook/imagepipeline/bitmaps/PlatformBitmapFactory.java
PlatformBitmapFactory.createBitmap
public CloseableReference<Bitmap> createBitmap(int width, int height) { """ Creates a bitmap of the specified width and height. The bitmap will be created with the default ARGB_8888 configuration @param width the width of the bitmap @param height the height of the bitmap @return a reference to the bitmap @throws TooManyBitmapsException if the pool is full @throws java.lang.OutOfMemoryError if the Bitmap cannot be allocated """ return createBitmap(width, height, Bitmap.Config.ARGB_8888); }
java
public CloseableReference<Bitmap> createBitmap(int width, int height) { return createBitmap(width, height, Bitmap.Config.ARGB_8888); }
[ "public", "CloseableReference", "<", "Bitmap", ">", "createBitmap", "(", "int", "width", ",", "int", "height", ")", "{", "return", "createBitmap", "(", "width", ",", "height", ",", "Bitmap", ".", "Config", ".", "ARGB_8888", ")", ";", "}" ]
Creates a bitmap of the specified width and height. The bitmap will be created with the default ARGB_8888 configuration @param width the width of the bitmap @param height the height of the bitmap @return a reference to the bitmap @throws TooManyBitmapsException if the pool is full @throws java.lang.OutOfMemoryError if the Bitmap cannot be allocated
[ "Creates", "a", "bitmap", "of", "the", "specified", "width", "and", "height", ".", "The", "bitmap", "will", "be", "created", "with", "the", "default", "ARGB_8888", "configuration" ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imagepipeline/bitmaps/PlatformBitmapFactory.java#L54-L56
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/landf/ScreenUtil.java
ScreenUtil.setProperty
public static void setProperty(String key, String value, PropertyOwner propertyOwner, Map<String,Object> properties) { """ A utility to set the property from the propertyowner or the property. """ if (propertyOwner != null) { propertyOwner.setProperty(key, value); } if (properties != null) { if (value != null) properties.put(key, value); else properties.remove(key); } }
java
public static void setProperty(String key, String value, PropertyOwner propertyOwner, Map<String,Object> properties) { if (propertyOwner != null) { propertyOwner.setProperty(key, value); } if (properties != null) { if (value != null) properties.put(key, value); else properties.remove(key); } }
[ "public", "static", "void", "setProperty", "(", "String", "key", ",", "String", "value", ",", "PropertyOwner", "propertyOwner", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "if", "(", "propertyOwner", "!=", "null", ")", "{", "propertyOwner", ".", "setProperty", "(", "key", ",", "value", ")", ";", "}", "if", "(", "properties", "!=", "null", ")", "{", "if", "(", "value", "!=", "null", ")", "properties", ".", "put", "(", "key", ",", "value", ")", ";", "else", "properties", ".", "remove", "(", "key", ")", ";", "}", "}" ]
A utility to set the property from the propertyowner or the property.
[ "A", "utility", "to", "set", "the", "property", "from", "the", "propertyowner", "or", "the", "property", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/landf/ScreenUtil.java#L224-L237
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java
StylesheetHandler.endElement
public void endElement(String uri, String localName, String rawName) throws org.xml.sax.SAXException { """ Receive notification of the end of an element. @param uri The Namespace URI, or an empty string. @param localName The local name (without prefix), or empty string if not namespace processing. @param rawName The qualified name (with prefix). @see org.xml.sax.ContentHandler#endElement @throws org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception. """ m_elementID--; if (!m_shouldProcess) return; if ((m_elementID + 1) == m_fragmentID) m_shouldProcess = false; flushCharacters(); popSpaceHandling(); XSLTElementProcessor p = getCurrentProcessor(); p.endElement(this, uri, localName, rawName); this.popProcessor(); this.getNamespaceSupport().popContext(); }
java
public void endElement(String uri, String localName, String rawName) throws org.xml.sax.SAXException { m_elementID--; if (!m_shouldProcess) return; if ((m_elementID + 1) == m_fragmentID) m_shouldProcess = false; flushCharacters(); popSpaceHandling(); XSLTElementProcessor p = getCurrentProcessor(); p.endElement(this, uri, localName, rawName); this.popProcessor(); this.getNamespaceSupport().popContext(); }
[ "public", "void", "endElement", "(", "String", "uri", ",", "String", "localName", ",", "String", "rawName", ")", "throws", "org", ".", "xml", ".", "sax", ".", "SAXException", "{", "m_elementID", "--", ";", "if", "(", "!", "m_shouldProcess", ")", "return", ";", "if", "(", "(", "m_elementID", "+", "1", ")", "==", "m_fragmentID", ")", "m_shouldProcess", "=", "false", ";", "flushCharacters", "(", ")", ";", "popSpaceHandling", "(", ")", ";", "XSLTElementProcessor", "p", "=", "getCurrentProcessor", "(", ")", ";", "p", ".", "endElement", "(", "this", ",", "uri", ",", "localName", ",", "rawName", ")", ";", "this", ".", "popProcessor", "(", ")", ";", "this", ".", "getNamespaceSupport", "(", ")", ".", "popContext", "(", ")", ";", "}" ]
Receive notification of the end of an element. @param uri The Namespace URI, or an empty string. @param localName The local name (without prefix), or empty string if not namespace processing. @param rawName The qualified name (with prefix). @see org.xml.sax.ContentHandler#endElement @throws org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
[ "Receive", "notification", "of", "the", "end", "of", "an", "element", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java#L647-L668
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java
JacksonUtils.readJson
public static JsonNode readJson(InputStream source, ClassLoader classLoader) { """ Read a JSON string and parse to {@link JsonNode} instance, with a custom class loader. @param source @param classLoader @return """ return SerializationUtils.readJson(source, classLoader); }
java
public static JsonNode readJson(InputStream source, ClassLoader classLoader) { return SerializationUtils.readJson(source, classLoader); }
[ "public", "static", "JsonNode", "readJson", "(", "InputStream", "source", ",", "ClassLoader", "classLoader", ")", "{", "return", "SerializationUtils", ".", "readJson", "(", "source", ",", "classLoader", ")", ";", "}" ]
Read a JSON string and parse to {@link JsonNode} instance, with a custom class loader. @param source @param classLoader @return
[ "Read", "a", "JSON", "string", "and", "parse", "to", "{", "@link", "JsonNode", "}", "instance", "with", "a", "custom", "class", "loader", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java#L159-L161
bwkimmel/jdcp
jdcp-console/src/main/java/ca/eandb/jdcp/client/ScriptFacade.java
ScriptFacade.setJobPriority
public void setJobPriority(UUID jobId, int priority) throws Exception { """ Sets the priority of the specified job. @param jobId The <code>UUID</code> of the job for which to set the priority. @param priority The priority to assign to the job. @throws Exception if an error occurs in delegating the request to the configured job service """ config.getJobService().setJobPriority(jobId, priority); }
java
public void setJobPriority(UUID jobId, int priority) throws Exception { config.getJobService().setJobPriority(jobId, priority); }
[ "public", "void", "setJobPriority", "(", "UUID", "jobId", ",", "int", "priority", ")", "throws", "Exception", "{", "config", ".", "getJobService", "(", ")", ".", "setJobPriority", "(", "jobId", ",", "priority", ")", ";", "}" ]
Sets the priority of the specified job. @param jobId The <code>UUID</code> of the job for which to set the priority. @param priority The priority to assign to the job. @throws Exception if an error occurs in delegating the request to the configured job service
[ "Sets", "the", "priority", "of", "the", "specified", "job", "." ]
train
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-console/src/main/java/ca/eandb/jdcp/client/ScriptFacade.java#L71-L73
j256/ormlite-core
src/main/java/com/j256/ormlite/field/FieldType.java
FieldType.createFieldType
public static FieldType createFieldType(DatabaseType databaseType, String tableName, Field field, Class<?> parentClass) throws SQLException { """ Return An instantiated {@link FieldType} or null if the field does not have a {@link DatabaseField} annotation. """ DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(databaseType, tableName, field, fieldConfig, parentClass); } }
java
public static FieldType createFieldType(DatabaseType databaseType, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(databaseType, tableName, field, fieldConfig, parentClass); } }
[ "public", "static", "FieldType", "createFieldType", "(", "DatabaseType", "databaseType", ",", "String", "tableName", ",", "Field", "field", ",", "Class", "<", "?", ">", "parentClass", ")", "throws", "SQLException", "{", "DatabaseFieldConfig", "fieldConfig", "=", "DatabaseFieldConfig", ".", "fromField", "(", "databaseType", ",", "tableName", ",", "field", ")", ";", "if", "(", "fieldConfig", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "return", "new", "FieldType", "(", "databaseType", ",", "tableName", ",", "field", ",", "fieldConfig", ",", "parentClass", ")", ";", "}", "}" ]
Return An instantiated {@link FieldType} or null if the field does not have a {@link DatabaseField} annotation.
[ "Return", "An", "instantiated", "{" ]
train
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/field/FieldType.java#L992-L1000
cdk/cdk
base/silent/src/main/java/org/openscience/cdk/silent/Reaction.java
Reaction.addProduct
@Override public void addProduct(IAtomContainer product, Double coefficient) { """ Adds a product to this reaction. @param product Molecule added as product to this reaction @param coefficient Stoichiometry coefficient for this molecule @see #getProducts """ products.addAtomContainer(product, coefficient); /* * notifyChanged() is called by addReactant(Molecule reactant, double * coefficient) */ }
java
@Override public void addProduct(IAtomContainer product, Double coefficient) { products.addAtomContainer(product, coefficient); /* * notifyChanged() is called by addReactant(Molecule reactant, double * coefficient) */ }
[ "@", "Override", "public", "void", "addProduct", "(", "IAtomContainer", "product", ",", "Double", "coefficient", ")", "{", "products", ".", "addAtomContainer", "(", "product", ",", "coefficient", ")", ";", "/*\n * notifyChanged() is called by addReactant(Molecule reactant, double\n * coefficient)\n */", "}" ]
Adds a product to this reaction. @param product Molecule added as product to this reaction @param coefficient Stoichiometry coefficient for this molecule @see #getProducts
[ "Adds", "a", "product", "to", "this", "reaction", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/silent/src/main/java/org/openscience/cdk/silent/Reaction.java#L268-L275
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.createUser
public CmsUser createUser(String userFqn, String password, String description, Map<String, Object> additionalInfos) throws CmsException { """ Creates a new user.<p> @param userFqn the name for the new user @param password the password for the new user @param description the description for the new user @param additionalInfos the additional infos for the user @return the created user @throws CmsException if something goes wrong """ return m_securityManager.createUser(m_context, userFqn, password, description, additionalInfos); }
java
public CmsUser createUser(String userFqn, String password, String description, Map<String, Object> additionalInfos) throws CmsException { return m_securityManager.createUser(m_context, userFqn, password, description, additionalInfos); }
[ "public", "CmsUser", "createUser", "(", "String", "userFqn", ",", "String", "password", ",", "String", "description", ",", "Map", "<", "String", ",", "Object", ">", "additionalInfos", ")", "throws", "CmsException", "{", "return", "m_securityManager", ".", "createUser", "(", "m_context", ",", "userFqn", ",", "password", ",", "description", ",", "additionalInfos", ")", ";", "}" ]
Creates a new user.<p> @param userFqn the name for the new user @param password the password for the new user @param description the description for the new user @param additionalInfos the additional infos for the user @return the created user @throws CmsException if something goes wrong
[ "Creates", "a", "new", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L896-L900
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/Channel.java
Channel.queryBlockByNumber
public BlockInfo queryBlockByNumber(Collection<Peer> peers, long blockNumber) throws InvalidArgumentException, ProposalException { """ query a peer in this channel for a Block by the blockNumber <STRONG>This method may not be thread safe if client context is changed!</STRONG> @param peers the peers to try and send the request to @param blockNumber index of the Block in the chain @return the {@link BlockInfo} with the given blockNumber @throws InvalidArgumentException @throws ProposalException """ return queryBlockByNumber(peers, blockNumber, client.getUserContext()); }
java
public BlockInfo queryBlockByNumber(Collection<Peer> peers, long blockNumber) throws InvalidArgumentException, ProposalException { return queryBlockByNumber(peers, blockNumber, client.getUserContext()); }
[ "public", "BlockInfo", "queryBlockByNumber", "(", "Collection", "<", "Peer", ">", "peers", ",", "long", "blockNumber", ")", "throws", "InvalidArgumentException", ",", "ProposalException", "{", "return", "queryBlockByNumber", "(", "peers", ",", "blockNumber", ",", "client", ".", "getUserContext", "(", ")", ")", ";", "}" ]
query a peer in this channel for a Block by the blockNumber <STRONG>This method may not be thread safe if client context is changed!</STRONG> @param peers the peers to try and send the request to @param blockNumber index of the Block in the chain @return the {@link BlockInfo} with the given blockNumber @throws InvalidArgumentException @throws ProposalException
[ "query", "a", "peer", "in", "this", "channel", "for", "a", "Block", "by", "the", "blockNumber" ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L2912-L2915
alkacon/opencms-core
src/org/opencms/search/solr/CmsSolrQuery.java
CmsSolrQuery.addFilterQuery
public void addFilterQuery(String fieldName, List<String> vals, boolean all, boolean useQuotes) { """ Creates and adds a filter query.<p> @param fieldName the field name to create a filter query on @param vals the values that should match for the given field @param all <code>true</code> to combine the given values with 'AND', <code>false</code> for 'OR' @param useQuotes <code>true</code> to surround the given values with double quotes, <code>false</code> otherwise """ if (getFilterQueries() != null) { for (String fq : getFilterQueries()) { if (fq.startsWith(fieldName + ":")) { removeFilterQuery(fq); } } } addFilterQuery(createFilterQuery(fieldName, vals, all, useQuotes)); }
java
public void addFilterQuery(String fieldName, List<String> vals, boolean all, boolean useQuotes) { if (getFilterQueries() != null) { for (String fq : getFilterQueries()) { if (fq.startsWith(fieldName + ":")) { removeFilterQuery(fq); } } } addFilterQuery(createFilterQuery(fieldName, vals, all, useQuotes)); }
[ "public", "void", "addFilterQuery", "(", "String", "fieldName", ",", "List", "<", "String", ">", "vals", ",", "boolean", "all", ",", "boolean", "useQuotes", ")", "{", "if", "(", "getFilterQueries", "(", ")", "!=", "null", ")", "{", "for", "(", "String", "fq", ":", "getFilterQueries", "(", ")", ")", "{", "if", "(", "fq", ".", "startsWith", "(", "fieldName", "+", "\":\"", ")", ")", "{", "removeFilterQuery", "(", "fq", ")", ";", "}", "}", "}", "addFilterQuery", "(", "createFilterQuery", "(", "fieldName", ",", "vals", ",", "all", ",", "useQuotes", ")", ")", ";", "}" ]
Creates and adds a filter query.<p> @param fieldName the field name to create a filter query on @param vals the values that should match for the given field @param all <code>true</code> to combine the given values with 'AND', <code>false</code> for 'OR' @param useQuotes <code>true</code> to surround the given values with double quotes, <code>false</code> otherwise
[ "Creates", "and", "adds", "a", "filter", "query", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/CmsSolrQuery.java#L206-L216
camunda/camunda-bpm-platform
engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/jsf/TaskForm.java
TaskForm.startProcessInstanceByKeyForm
@Deprecated public void startProcessInstanceByKeyForm(String processDefinitionKey, String callbackUrl) { """ @deprecated use {@link startProcessInstanceByKeyForm()} instead @param processDefinitionKey @param callbackUrl """ this.url = callbackUrl; this.processDefinitionKey = processDefinitionKey; beginConversation(); }
java
@Deprecated public void startProcessInstanceByKeyForm(String processDefinitionKey, String callbackUrl) { this.url = callbackUrl; this.processDefinitionKey = processDefinitionKey; beginConversation(); }
[ "@", "Deprecated", "public", "void", "startProcessInstanceByKeyForm", "(", "String", "processDefinitionKey", ",", "String", "callbackUrl", ")", "{", "this", ".", "url", "=", "callbackUrl", ";", "this", ".", "processDefinitionKey", "=", "processDefinitionKey", ";", "beginConversation", "(", ")", ";", "}" ]
@deprecated use {@link startProcessInstanceByKeyForm()} instead @param processDefinitionKey @param callbackUrl
[ "@deprecated", "use", "{", "@link", "startProcessInstanceByKeyForm", "()", "}", "instead" ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/jsf/TaskForm.java#L161-L166
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/hoverbar/CmsSitemapHoverbar.java
CmsSitemapHoverbar.installOn
public static void installOn(CmsSitemapController controller, CmsTreeItem treeItem, CmsUUID entryId) { """ Installs a hover bar for the given item widget.<p> @param controller the controller @param treeItem the item to hover @param entryId the entry id """ CmsSitemapHoverbar hoverbar = new CmsSitemapHoverbar(controller, entryId, true, true, null); installHoverbar(hoverbar, treeItem.getListItemWidget()); }
java
public static void installOn(CmsSitemapController controller, CmsTreeItem treeItem, CmsUUID entryId) { CmsSitemapHoverbar hoverbar = new CmsSitemapHoverbar(controller, entryId, true, true, null); installHoverbar(hoverbar, treeItem.getListItemWidget()); }
[ "public", "static", "void", "installOn", "(", "CmsSitemapController", "controller", ",", "CmsTreeItem", "treeItem", ",", "CmsUUID", "entryId", ")", "{", "CmsSitemapHoverbar", "hoverbar", "=", "new", "CmsSitemapHoverbar", "(", "controller", ",", "entryId", ",", "true", ",", "true", ",", "null", ")", ";", "installHoverbar", "(", "hoverbar", ",", "treeItem", ".", "getListItemWidget", "(", ")", ")", ";", "}" ]
Installs a hover bar for the given item widget.<p> @param controller the controller @param treeItem the item to hover @param entryId the entry id
[ "Installs", "a", "hover", "bar", "for", "the", "given", "item", "widget", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/hoverbar/CmsSitemapHoverbar.java#L150-L154
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java
IoUtil.copy
public static long copy(Reader reader, Writer writer) throws IORuntimeException { """ 将Reader中的内容复制到Writer中 使用默认缓存大小 @param reader Reader @param writer Writer @return 拷贝的字节数 @throws IORuntimeException IO异常 """ return copy(reader, writer, DEFAULT_BUFFER_SIZE); }
java
public static long copy(Reader reader, Writer writer) throws IORuntimeException { return copy(reader, writer, DEFAULT_BUFFER_SIZE); }
[ "public", "static", "long", "copy", "(", "Reader", "reader", ",", "Writer", "writer", ")", "throws", "IORuntimeException", "{", "return", "copy", "(", "reader", ",", "writer", ",", "DEFAULT_BUFFER_SIZE", ")", ";", "}" ]
将Reader中的内容复制到Writer中 使用默认缓存大小 @param reader Reader @param writer Writer @return 拷贝的字节数 @throws IORuntimeException IO异常
[ "将Reader中的内容复制到Writer中", "使用默认缓存大小" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L73-L75
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/UserResources.java
UserResources.updateUserPreferences
@PUT @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Path(" { """ Updates user preferences. @param req The HTTP request. @param userId The ID of the user to update. @param prefs The updated preferences. @return The updated user DTO. @throws WebApplicationException If an error occurs. """userId}/preferences") @Description("Update user preferences.") public PrincipalUserDto updateUserPreferences(@Context HttpServletRequest req, @PathParam("userId") final BigInteger userId, final Map<Preference, String> prefs) { if (userId == null || userId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("User Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } if (prefs == null) { throw new WebApplicationException("Cannot update with null prefs.", Status.BAD_REQUEST); } PrincipalUser remoteUser = getRemoteUser(req); PrincipalUser user = _uService.findUserByPrimaryKey(userId); validateResourceAuthorization(req, user, remoteUser); if (user == null) { throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); } user.getPreferences().putAll(prefs); user = _uService.updateUser(user); return PrincipalUserDto.transformToDto(user); }
java
@PUT @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Path("{userId}/preferences") @Description("Update user preferences.") public PrincipalUserDto updateUserPreferences(@Context HttpServletRequest req, @PathParam("userId") final BigInteger userId, final Map<Preference, String> prefs) { if (userId == null || userId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("User Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } if (prefs == null) { throw new WebApplicationException("Cannot update with null prefs.", Status.BAD_REQUEST); } PrincipalUser remoteUser = getRemoteUser(req); PrincipalUser user = _uService.findUserByPrimaryKey(userId); validateResourceAuthorization(req, user, remoteUser); if (user == null) { throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); } user.getPreferences().putAll(prefs); user = _uService.updateUser(user); return PrincipalUserDto.transformToDto(user); }
[ "@", "PUT", "@", "Produces", "(", "MediaType", ".", "APPLICATION_JSON", ")", "@", "Consumes", "(", "MediaType", ".", "APPLICATION_JSON", ")", "@", "Path", "(", "\"{userId}/preferences\"", ")", "@", "Description", "(", "\"Update user preferences.\"", ")", "public", "PrincipalUserDto", "updateUserPreferences", "(", "@", "Context", "HttpServletRequest", "req", ",", "@", "PathParam", "(", "\"userId\"", ")", "final", "BigInteger", "userId", ",", "final", "Map", "<", "Preference", ",", "String", ">", "prefs", ")", "{", "if", "(", "userId", "==", "null", "||", "userId", ".", "compareTo", "(", "BigInteger", ".", "ZERO", ")", "<", "1", ")", "{", "throw", "new", "WebApplicationException", "(", "\"User Id cannot be null and must be a positive non-zero number.\"", ",", "Status", ".", "BAD_REQUEST", ")", ";", "}", "if", "(", "prefs", "==", "null", ")", "{", "throw", "new", "WebApplicationException", "(", "\"Cannot update with null prefs.\"", ",", "Status", ".", "BAD_REQUEST", ")", ";", "}", "PrincipalUser", "remoteUser", "=", "getRemoteUser", "(", "req", ")", ";", "PrincipalUser", "user", "=", "_uService", ".", "findUserByPrimaryKey", "(", "userId", ")", ";", "validateResourceAuthorization", "(", "req", ",", "user", ",", "remoteUser", ")", ";", "if", "(", "user", "==", "null", ")", "{", "throw", "new", "WebApplicationException", "(", "Response", ".", "Status", ".", "NOT_FOUND", ".", "getReasonPhrase", "(", ")", ",", "Response", ".", "Status", ".", "NOT_FOUND", ")", ";", "}", "user", ".", "getPreferences", "(", ")", ".", "putAll", "(", "prefs", ")", ";", "user", "=", "_uService", ".", "updateUser", "(", "user", ")", ";", "return", "PrincipalUserDto", ".", "transformToDto", "(", "user", ")", ";", "}" ]
Updates user preferences. @param req The HTTP request. @param userId The ID of the user to update. @param prefs The updated preferences. @return The updated user DTO. @throws WebApplicationException If an error occurs.
[ "Updates", "user", "preferences", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/UserResources.java#L289-L313
cdk/cdk
legacy/src/main/java/org/openscience/cdk/smsd/tools/ExtAtomContainerManipulator.java
ExtAtomContainerManipulator.getHydrogenCount
public static int getHydrogenCount(IAtomContainer atomContainer, IAtom atom) { """ The summed implicit + explicit hydrogens of the given IAtom. @param atomContainer @param atom @return The summed implicit + explicit hydrogens of the given IAtom. """ return getExplicitHydrogenCount(atomContainer, atom) + getImplicitHydrogenCount(atom); }
java
public static int getHydrogenCount(IAtomContainer atomContainer, IAtom atom) { return getExplicitHydrogenCount(atomContainer, atom) + getImplicitHydrogenCount(atom); }
[ "public", "static", "int", "getHydrogenCount", "(", "IAtomContainer", "atomContainer", ",", "IAtom", "atom", ")", "{", "return", "getExplicitHydrogenCount", "(", "atomContainer", ",", "atom", ")", "+", "getImplicitHydrogenCount", "(", "atom", ")", ";", "}" ]
The summed implicit + explicit hydrogens of the given IAtom. @param atomContainer @param atom @return The summed implicit + explicit hydrogens of the given IAtom.
[ "The", "summed", "implicit", "+", "explicit", "hydrogens", "of", "the", "given", "IAtom", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/smsd/tools/ExtAtomContainerManipulator.java#L214-L216
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/tools/manipulator/ReactionSetManipulator.java
ReactionSetManipulator.getReactionByReactionID
public static IReaction getReactionByReactionID(IReactionSet reactionSet, String id) { """ Gets a reaction from a ReactionSet by ID. If several exist, only the first one will be returned. @param reactionSet The reactionSet to search in @param id The id to search for. @return The Reaction or null; """ Iterable<IReaction> reactionIter = reactionSet.reactions(); for (IReaction reaction : reactionIter) { if (reaction.getID() != null && reaction.getID().equals(id)) { return reaction; } } return null; }
java
public static IReaction getReactionByReactionID(IReactionSet reactionSet, String id) { Iterable<IReaction> reactionIter = reactionSet.reactions(); for (IReaction reaction : reactionIter) { if (reaction.getID() != null && reaction.getID().equals(id)) { return reaction; } } return null; }
[ "public", "static", "IReaction", "getReactionByReactionID", "(", "IReactionSet", "reactionSet", ",", "String", "id", ")", "{", "Iterable", "<", "IReaction", ">", "reactionIter", "=", "reactionSet", ".", "reactions", "(", ")", ";", "for", "(", "IReaction", "reaction", ":", "reactionIter", ")", "{", "if", "(", "reaction", ".", "getID", "(", ")", "!=", "null", "&&", "reaction", ".", "getID", "(", ")", ".", "equals", "(", "id", ")", ")", "{", "return", "reaction", ";", "}", "}", "return", "null", ";", "}" ]
Gets a reaction from a ReactionSet by ID. If several exist, only the first one will be returned. @param reactionSet The reactionSet to search in @param id The id to search for. @return The Reaction or null;
[ "Gets", "a", "reaction", "from", "a", "ReactionSet", "by", "ID", ".", "If", "several", "exist", "only", "the", "first", "one", "will", "be", "returned", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/tools/manipulator/ReactionSetManipulator.java#L250-L258
yidongnan/grpc-spring-boot-starter
grpc-server-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/server/security/authentication/BasicGrpcAuthenticationReader.java
BasicGrpcAuthenticationReader.extractAndDecodeHeader
private String[] extractAndDecodeHeader(final String header) { """ Decodes the header into a username and password. @param header The authorization header. @return The decoded username and password. @throws BadCredentialsException If the Basic header is not valid Base64 or is missing the {@code ':'} separator. @see <a href= "https://github.com/spring-projects/spring-security/blob/master/web/src/main/java/org/springframework/security/web/authentication/www/BasicAuthenticationFilter.java">BasicAuthenticationFilter</a> """ final byte[] base64Token = header.substring(PREFIX_LENGTH).getBytes(UTF_8); byte[] decoded; try { decoded = Base64.getDecoder().decode(base64Token); } catch (final IllegalArgumentException e) { throw new BadCredentialsException("Failed to decode basic authentication token", e); } final String token = new String(decoded, UTF_8); final int delim = token.indexOf(':'); if (delim == -1) { throw new BadCredentialsException("Invalid basic authentication token"); } return new String[] {token.substring(0, delim), token.substring(delim + 1)}; }
java
private String[] extractAndDecodeHeader(final String header) { final byte[] base64Token = header.substring(PREFIX_LENGTH).getBytes(UTF_8); byte[] decoded; try { decoded = Base64.getDecoder().decode(base64Token); } catch (final IllegalArgumentException e) { throw new BadCredentialsException("Failed to decode basic authentication token", e); } final String token = new String(decoded, UTF_8); final int delim = token.indexOf(':'); if (delim == -1) { throw new BadCredentialsException("Invalid basic authentication token"); } return new String[] {token.substring(0, delim), token.substring(delim + 1)}; }
[ "private", "String", "[", "]", "extractAndDecodeHeader", "(", "final", "String", "header", ")", "{", "final", "byte", "[", "]", "base64Token", "=", "header", ".", "substring", "(", "PREFIX_LENGTH", ")", ".", "getBytes", "(", "UTF_8", ")", ";", "byte", "[", "]", "decoded", ";", "try", "{", "decoded", "=", "Base64", ".", "getDecoder", "(", ")", ".", "decode", "(", "base64Token", ")", ";", "}", "catch", "(", "final", "IllegalArgumentException", "e", ")", "{", "throw", "new", "BadCredentialsException", "(", "\"Failed to decode basic authentication token\"", ",", "e", ")", ";", "}", "final", "String", "token", "=", "new", "String", "(", "decoded", ",", "UTF_8", ")", ";", "final", "int", "delim", "=", "token", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "delim", "==", "-", "1", ")", "{", "throw", "new", "BadCredentialsException", "(", "\"Invalid basic authentication token\"", ")", ";", "}", "return", "new", "String", "[", "]", "{", "token", ".", "substring", "(", "0", ",", "delim", ")", ",", "token", ".", "substring", "(", "delim", "+", "1", ")", "}", ";", "}" ]
Decodes the header into a username and password. @param header The authorization header. @return The decoded username and password. @throws BadCredentialsException If the Basic header is not valid Base64 or is missing the {@code ':'} separator. @see <a href= "https://github.com/spring-projects/spring-security/blob/master/web/src/main/java/org/springframework/security/web/authentication/www/BasicAuthenticationFilter.java">BasicAuthenticationFilter</a>
[ "Decodes", "the", "header", "into", "a", "username", "and", "password", "." ]
train
https://github.com/yidongnan/grpc-spring-boot-starter/blob/07f8853cfafc9707584f2371aff012e590217b85/grpc-server-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/server/security/authentication/BasicGrpcAuthenticationReader.java#L67-L85
rapidpro/expressions
java/src/main/java/io/rapidpro/expressions/functions/ExcelFunctions.java
ExcelFunctions.unicode
public static int unicode(EvaluationContext ctx, Object text) { """ Returns a numeric code for the first character in a text string """ String _text = Conversions.toString(text, ctx); if (_text.length() == 0) { throw new RuntimeException("Text can't be empty"); } return (int) _text.charAt(0); }
java
public static int unicode(EvaluationContext ctx, Object text) { String _text = Conversions.toString(text, ctx); if (_text.length() == 0) { throw new RuntimeException("Text can't be empty"); } return (int) _text.charAt(0); }
[ "public", "static", "int", "unicode", "(", "EvaluationContext", "ctx", ",", "Object", "text", ")", "{", "String", "_text", "=", "Conversions", ".", "toString", "(", "text", ",", "ctx", ")", ";", "if", "(", "_text", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "RuntimeException", "(", "\"Text can't be empty\"", ")", ";", "}", "return", "(", "int", ")", "_text", ".", "charAt", "(", "0", ")", ";", "}" ]
Returns a numeric code for the first character in a text string
[ "Returns", "a", "numeric", "code", "for", "the", "first", "character", "in", "a", "text", "string" ]
train
https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/java/src/main/java/io/rapidpro/expressions/functions/ExcelFunctions.java#L185-L191
Javacord/Javacord
javacord-core/src/main/java/org/javacord/core/entity/message/MessageSetImpl.java
MessageSetImpl.getMessagesBeforeWhile
public static CompletableFuture<MessageSet> getMessagesBeforeWhile( TextChannel channel, Predicate<Message> condition, long before) { """ Gets messages in the given channel before a given message in any channel while they meet the given condition. If the first message does not match the condition, an empty set is returned. @param channel The channel of the messages. @param condition The condition that has to be met. @param before Get messages before the message with this id. @return The messages. @see #getMessagesBeforeAsStream(TextChannel, long) """ return getMessagesWhile(channel, condition, before, -1); }
java
public static CompletableFuture<MessageSet> getMessagesBeforeWhile( TextChannel channel, Predicate<Message> condition, long before) { return getMessagesWhile(channel, condition, before, -1); }
[ "public", "static", "CompletableFuture", "<", "MessageSet", ">", "getMessagesBeforeWhile", "(", "TextChannel", "channel", ",", "Predicate", "<", "Message", ">", "condition", ",", "long", "before", ")", "{", "return", "getMessagesWhile", "(", "channel", ",", "condition", ",", "before", ",", "-", "1", ")", ";", "}" ]
Gets messages in the given channel before a given message in any channel while they meet the given condition. If the first message does not match the condition, an empty set is returned. @param channel The channel of the messages. @param condition The condition that has to be met. @param before Get messages before the message with this id. @return The messages. @see #getMessagesBeforeAsStream(TextChannel, long)
[ "Gets", "messages", "in", "the", "given", "channel", "before", "a", "given", "message", "in", "any", "channel", "while", "they", "meet", "the", "given", "condition", ".", "If", "the", "first", "message", "does", "not", "match", "the", "condition", "an", "empty", "set", "is", "returned", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/message/MessageSetImpl.java#L346-L349
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java
StyleUtils.setFeatureStyle
public static boolean setFeatureStyle(MarkerOptions markerOptions, FeatureStyle featureStyle, float density) { """ Set the feature style (icon or style) into the marker options @param markerOptions marker options @param featureStyle feature style @param density display density: {@link android.util.DisplayMetrics#density} @return true if icon or style was set into the marker options """ return setFeatureStyle(markerOptions, featureStyle, density, null); }
java
public static boolean setFeatureStyle(MarkerOptions markerOptions, FeatureStyle featureStyle, float density) { return setFeatureStyle(markerOptions, featureStyle, density, null); }
[ "public", "static", "boolean", "setFeatureStyle", "(", "MarkerOptions", "markerOptions", ",", "FeatureStyle", "featureStyle", ",", "float", "density", ")", "{", "return", "setFeatureStyle", "(", "markerOptions", ",", "featureStyle", ",", "density", ",", "null", ")", ";", "}" ]
Set the feature style (icon or style) into the marker options @param markerOptions marker options @param featureStyle feature style @param density display density: {@link android.util.DisplayMetrics#density} @return true if icon or style was set into the marker options
[ "Set", "the", "feature", "style", "(", "icon", "or", "style", ")", "into", "the", "marker", "options" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java#L184-L186
jfinal/jfinal
src/main/java/com/jfinal/plugin/activerecord/Db.java
Db.queryColumn
public static <T> T queryColumn(String sql, Object... paras) { """ Execute sql query just return one column. @param <T> the type of the column that in your sql's select statement @param sql an SQL statement that may contain one or more '?' IN parameter placeholders @param paras the parameters of sql @return <T> T """ return MAIN.queryColumn(sql, paras); }
java
public static <T> T queryColumn(String sql, Object... paras) { return MAIN.queryColumn(sql, paras); }
[ "public", "static", "<", "T", ">", "T", "queryColumn", "(", "String", "sql", ",", "Object", "...", "paras", ")", "{", "return", "MAIN", ".", "queryColumn", "(", "sql", ",", "paras", ")", ";", "}" ]
Execute sql query just return one column. @param <T> the type of the column that in your sql's select statement @param sql an SQL statement that may contain one or more '?' IN parameter placeholders @param paras the parameters of sql @return <T> T
[ "Execute", "sql", "query", "just", "return", "one", "column", "." ]
train
https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Db.java#L115-L117
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAnnotationPropertyDomainAxiomImpl_CustomFieldSerializer.java
OWLAnnotationPropertyDomainAxiomImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLAnnotationPropertyDomainAxiomImpl instance) throws SerializationException { """ Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful """ deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLAnnotationPropertyDomainAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLAnnotationPropertyDomainAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", "}" ]
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAnnotationPropertyDomainAxiomImpl_CustomFieldSerializer.java#L98-L101
podio/podio-java
src/main/java/com/podio/user/UserAPI.java
UserAPI.updateProfileField
public <F> void updateProfileField(ProfileField<F, ?> field, F value) { """ Updates a single field on the profile of the user @param field The field that should be updated @param value The new value of the field """ if (field.isSingle()) { getResourceFactory() .getApiResource("/user/profile/" + field.getName()) .entity(new ProfileFieldSingleValue<F>(value), MediaType.APPLICATION_JSON_TYPE).put(); } else { getResourceFactory() .getApiResource("/user/profile/" + field.getName()) .entity(new ProfileFieldMultiValue<F>(value), MediaType.APPLICATION_JSON_TYPE).put(); } }
java
public <F> void updateProfileField(ProfileField<F, ?> field, F value) { if (field.isSingle()) { getResourceFactory() .getApiResource("/user/profile/" + field.getName()) .entity(new ProfileFieldSingleValue<F>(value), MediaType.APPLICATION_JSON_TYPE).put(); } else { getResourceFactory() .getApiResource("/user/profile/" + field.getName()) .entity(new ProfileFieldMultiValue<F>(value), MediaType.APPLICATION_JSON_TYPE).put(); } }
[ "public", "<", "F", ">", "void", "updateProfileField", "(", "ProfileField", "<", "F", ",", "?", ">", "field", ",", "F", "value", ")", "{", "if", "(", "field", ".", "isSingle", "(", ")", ")", "{", "getResourceFactory", "(", ")", ".", "getApiResource", "(", "\"/user/profile/\"", "+", "field", ".", "getName", "(", ")", ")", ".", "entity", "(", "new", "ProfileFieldSingleValue", "<", "F", ">", "(", "value", ")", ",", "MediaType", ".", "APPLICATION_JSON_TYPE", ")", ".", "put", "(", ")", ";", "}", "else", "{", "getResourceFactory", "(", ")", ".", "getApiResource", "(", "\"/user/profile/\"", "+", "field", ".", "getName", "(", ")", ")", ".", "entity", "(", "new", "ProfileFieldMultiValue", "<", "F", ">", "(", "value", ")", ",", "MediaType", ".", "APPLICATION_JSON_TYPE", ")", ".", "put", "(", ")", ";", "}", "}" ]
Updates a single field on the profile of the user @param field The field that should be updated @param value The new value of the field
[ "Updates", "a", "single", "field", "on", "the", "profile", "of", "the", "user" ]
train
https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/user/UserAPI.java#L98-L110
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.updateClosedList
public OperationStatus updateClosedList(UUID appId, String versionId, UUID clEntityId, ClosedListModelUpdateObject closedListModelUpdateObject) { """ Updates the closed list model. @param appId The application ID. @param versionId The version ID. @param clEntityId The closed list model ID. @param closedListModelUpdateObject The new entity name and words list. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful. """ return updateClosedListWithServiceResponseAsync(appId, versionId, clEntityId, closedListModelUpdateObject).toBlocking().single().body(); }
java
public OperationStatus updateClosedList(UUID appId, String versionId, UUID clEntityId, ClosedListModelUpdateObject closedListModelUpdateObject) { return updateClosedListWithServiceResponseAsync(appId, versionId, clEntityId, closedListModelUpdateObject).toBlocking().single().body(); }
[ "public", "OperationStatus", "updateClosedList", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "clEntityId", ",", "ClosedListModelUpdateObject", "closedListModelUpdateObject", ")", "{", "return", "updateClosedListWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "clEntityId", ",", "closedListModelUpdateObject", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Updates the closed list model. @param appId The application ID. @param versionId The version ID. @param clEntityId The closed list model ID. @param closedListModelUpdateObject The new entity name and words list. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful.
[ "Updates", "the", "closed", "list", "model", "." ]
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#L4310-L4312
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/StrictMath.java
StrictMath.copySign
public static float copySign(float magnitude, float sign) { """ Returns the first floating-point argument with the sign of the second floating-point argument. For this method, a NaN {@code sign} argument is always treated as if it were positive. @param magnitude the parameter providing the magnitude of the result @param sign the parameter providing the sign of the result @return a value with the magnitude of {@code magnitude} and the sign of {@code sign}. @since 1.6 """ return Math.copySign(magnitude, (Float.isNaN(sign)?1.0f:sign)); }
java
public static float copySign(float magnitude, float sign) { return Math.copySign(magnitude, (Float.isNaN(sign)?1.0f:sign)); }
[ "public", "static", "float", "copySign", "(", "float", "magnitude", ",", "float", "sign", ")", "{", "return", "Math", ".", "copySign", "(", "magnitude", ",", "(", "Float", ".", "isNaN", "(", "sign", ")", "?", "1.0f", ":", "sign", ")", ")", ";", "}" ]
Returns the first floating-point argument with the sign of the second floating-point argument. For this method, a NaN {@code sign} argument is always treated as if it were positive. @param magnitude the parameter providing the magnitude of the result @param sign the parameter providing the sign of the result @return a value with the magnitude of {@code magnitude} and the sign of {@code sign}. @since 1.6
[ "Returns", "the", "first", "floating", "-", "point", "argument", "with", "the", "sign", "of", "the", "second", "floating", "-", "point", "argument", ".", "For", "this", "method", "a", "NaN", "{", "@code", "sign", "}", "argument", "is", "always", "treated", "as", "if", "it", "were", "positive", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/StrictMath.java#L1403-L1405
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableIOSupport.java
CASableIOSupport.openFile
public FileDigestOutputStream openFile(File file) throws IOException { """ Open digester output.<br> Digester output will write into given file and calc hash for a content. @param file - destenation file @return - digester output stream @throws IOException """ MessageDigest md; try { md = MessageDigest.getInstance(digestAlgo); } catch (NoSuchAlgorithmException e) { LOG.error("Can't wriet using " + digestAlgo + " algorithm, " + e, e); throw new IOException(e.getMessage(), e); } return new FileDigestOutputStream(file, md); }
java
public FileDigestOutputStream openFile(File file) throws IOException { MessageDigest md; try { md = MessageDigest.getInstance(digestAlgo); } catch (NoSuchAlgorithmException e) { LOG.error("Can't wriet using " + digestAlgo + " algorithm, " + e, e); throw new IOException(e.getMessage(), e); } return new FileDigestOutputStream(file, md); }
[ "public", "FileDigestOutputStream", "openFile", "(", "File", "file", ")", "throws", "IOException", "{", "MessageDigest", "md", ";", "try", "{", "md", "=", "MessageDigest", ".", "getInstance", "(", "digestAlgo", ")", ";", "}", "catch", "(", "NoSuchAlgorithmException", "e", ")", "{", "LOG", ".", "error", "(", "\"Can't wriet using \"", "+", "digestAlgo", "+", "\" algorithm, \"", "+", "e", ",", "e", ")", ";", "throw", "new", "IOException", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "return", "new", "FileDigestOutputStream", "(", "file", ",", "md", ")", ";", "}" ]
Open digester output.<br> Digester output will write into given file and calc hash for a content. @param file - destenation file @return - digester output stream @throws IOException
[ "Open", "digester", "output", ".", "<br", ">", "Digester", "output", "will", "write", "into", "given", "file", "and", "calc", "hash", "for", "a", "content", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableIOSupport.java#L66-L80
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/DevicesStatusApi.java
DevicesStatusApi.getDevicesStatus
public DeviceStatusBatch getDevicesStatus(String dids, Boolean includeSnapshot, Boolean includeSnapshotTimestamp) throws ApiException { """ Get Devices Status Get Devices Status @param dids List of device ids (comma-separated) for which the statuses are requested. (required) @param includeSnapshot Include device snapshot into the response (optional) @param includeSnapshotTimestamp Include device snapshot timestamp into the response (optional) @return DeviceStatusBatch @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ ApiResponse<DeviceStatusBatch> resp = getDevicesStatusWithHttpInfo(dids, includeSnapshot, includeSnapshotTimestamp); return resp.getData(); }
java
public DeviceStatusBatch getDevicesStatus(String dids, Boolean includeSnapshot, Boolean includeSnapshotTimestamp) throws ApiException { ApiResponse<DeviceStatusBatch> resp = getDevicesStatusWithHttpInfo(dids, includeSnapshot, includeSnapshotTimestamp); return resp.getData(); }
[ "public", "DeviceStatusBatch", "getDevicesStatus", "(", "String", "dids", ",", "Boolean", "includeSnapshot", ",", "Boolean", "includeSnapshotTimestamp", ")", "throws", "ApiException", "{", "ApiResponse", "<", "DeviceStatusBatch", ">", "resp", "=", "getDevicesStatusWithHttpInfo", "(", "dids", ",", "includeSnapshot", ",", "includeSnapshotTimestamp", ")", ";", "return", "resp", ".", "getData", "(", ")", ";", "}" ]
Get Devices Status Get Devices Status @param dids List of device ids (comma-separated) for which the statuses are requested. (required) @param includeSnapshot Include device snapshot into the response (optional) @param includeSnapshotTimestamp Include device snapshot timestamp into the response (optional) @return DeviceStatusBatch @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "Devices", "Status", "Get", "Devices", "Status" ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/DevicesStatusApi.java#L262-L265
op4j/op4j
src/main/java/org/op4j/functions/FnString.java
FnString.replaceLast
public static final Function<String,String> replaceLast(final String regex, final String replacement) { """ <p> Replaces in the target String the last substring matching the specified regular expression with the specified replacement String. </p> <p> Regular expressions must conform to the <tt>java.util.regex.Pattern</tt> format. </p> @param regex the regular expression to match against @param replacement the replacement string @return the resulting String """ return new Replace(regex, replacement, ReplaceType.LAST); }
java
public static final Function<String,String> replaceLast(final String regex, final String replacement) { return new Replace(regex, replacement, ReplaceType.LAST); }
[ "public", "static", "final", "Function", "<", "String", ",", "String", ">", "replaceLast", "(", "final", "String", "regex", ",", "final", "String", "replacement", ")", "{", "return", "new", "Replace", "(", "regex", ",", "replacement", ",", "ReplaceType", ".", "LAST", ")", ";", "}" ]
<p> Replaces in the target String the last substring matching the specified regular expression with the specified replacement String. </p> <p> Regular expressions must conform to the <tt>java.util.regex.Pattern</tt> format. </p> @param regex the regular expression to match against @param replacement the replacement string @return the resulting String
[ "<p", ">", "Replaces", "in", "the", "target", "String", "the", "last", "substring", "matching", "the", "specified", "regular", "expression", "with", "the", "specified", "replacement", "String", ".", "<", "/", "p", ">", "<p", ">", "Regular", "expressions", "must", "conform", "to", "the", "<tt", ">", "java", ".", "util", ".", "regex", ".", "Pattern<", "/", "tt", ">", "format", ".", "<", "/", "p", ">" ]
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnString.java#L2040-L2042
sarxos/webcam-capture
webcam-capture/src/main/java/com/github/sarxos/webcam/WebcamMotionDetector.java
WebcamMotionDetector.getMotionCog
public Point getMotionCog() { """ Get motion center of gravity. When no motion is detected this value points to the image center. @return Center of gravity point """ Point cog = algorithm.getCog(); if (cog == null) { // detectorAlgorithm hasn't been called so far - get image center int w = webcam.getViewSize().width; int h = webcam.getViewSize().height; cog = new Point(w / 2, h / 2); } return cog; }
java
public Point getMotionCog() { Point cog = algorithm.getCog(); if (cog == null) { // detectorAlgorithm hasn't been called so far - get image center int w = webcam.getViewSize().width; int h = webcam.getViewSize().height; cog = new Point(w / 2, h / 2); } return cog; }
[ "public", "Point", "getMotionCog", "(", ")", "{", "Point", "cog", "=", "algorithm", ".", "getCog", "(", ")", ";", "if", "(", "cog", "==", "null", ")", "{", "// detectorAlgorithm hasn't been called so far - get image center\r", "int", "w", "=", "webcam", ".", "getViewSize", "(", ")", ".", "width", ";", "int", "h", "=", "webcam", ".", "getViewSize", "(", ")", ".", "height", ";", "cog", "=", "new", "Point", "(", "w", "/", "2", ",", "h", "/", "2", ")", ";", "}", "return", "cog", ";", "}" ]
Get motion center of gravity. When no motion is detected this value points to the image center. @return Center of gravity point
[ "Get", "motion", "center", "of", "gravity", ".", "When", "no", "motion", "is", "detected", "this", "value", "points", "to", "the", "image", "center", "." ]
train
https://github.com/sarxos/webcam-capture/blob/efbdae04f9ba48db9ec621e94a9bcd6f031882c8/webcam-capture/src/main/java/com/github/sarxos/webcam/WebcamMotionDetector.java#L415-L424
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/CompositeTextWatcher.java
CompositeTextWatcher.addWatcher
public void addWatcher(int id, TextWatcher watcher, boolean enabled) { """ Add a {@link TextWatcher} with a specified Id and whether or not it is enabled by default @param id the id of the {@link TextWatcher} to add @param watcher the {@link TextWatcher} to add @param enabled whether or not it is enabled by default """ mWatchers.put(id, watcher); mEnabledKeys.put(id, enabled); }
java
public void addWatcher(int id, TextWatcher watcher, boolean enabled){ mWatchers.put(id, watcher); mEnabledKeys.put(id, enabled); }
[ "public", "void", "addWatcher", "(", "int", "id", ",", "TextWatcher", "watcher", ",", "boolean", "enabled", ")", "{", "mWatchers", ".", "put", "(", "id", ",", "watcher", ")", ";", "mEnabledKeys", ".", "put", "(", "id", ",", "enabled", ")", ";", "}" ]
Add a {@link TextWatcher} with a specified Id and whether or not it is enabled by default @param id the id of the {@link TextWatcher} to add @param watcher the {@link TextWatcher} to add @param enabled whether or not it is enabled by default
[ "Add", "a", "{", "@link", "TextWatcher", "}", "with", "a", "specified", "Id", "and", "whether", "or", "not", "it", "is", "enabled", "by", "default" ]
train
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/CompositeTextWatcher.java#L109-L112
btc-ag/redg
redg-generator/src/main/java/com/btc/redg/generator/CodeGenerator.java
CodeGenerator.generateMainClass
public String generateMainClass(final Collection<TableModel> tables, final boolean enableVisualizationSupport) { """ Generates the main class used for creating the extractor objects and later generating the insert statements. For each passed table a appropriate creation method will be generated that will return the new object and internally add it to the list of objects that will be used to generate the insert strings @param tables All tables that should get a creation method in the main class @param enableVisualizationSupport If {@code true}, the RedG visualization features will be enabled for the generated code. This will result in a small performance hit and slightly more memory usage if activated. @return The generated source code """ Objects.requireNonNull(tables); //get package from the table models final String targetPackage = ((TableModel) tables.toArray()[0]).getPackageName(); final ST template = this.stGroup.getInstanceOf("mainClass"); LOG.debug("Filling main class template containing helpers for {} classes...", tables.size()); template.add("package", targetPackage); // TODO: make prefix usable template.add("prefix", ""); template.add("enableVisualizationSupport", enableVisualizationSupport); LOG.debug("Package is {} | Prefix is {}", targetPackage, ""); template.add("tables", tables); return template.render(); }
java
public String generateMainClass(final Collection<TableModel> tables, final boolean enableVisualizationSupport) { Objects.requireNonNull(tables); //get package from the table models final String targetPackage = ((TableModel) tables.toArray()[0]).getPackageName(); final ST template = this.stGroup.getInstanceOf("mainClass"); LOG.debug("Filling main class template containing helpers for {} classes...", tables.size()); template.add("package", targetPackage); // TODO: make prefix usable template.add("prefix", ""); template.add("enableVisualizationSupport", enableVisualizationSupport); LOG.debug("Package is {} | Prefix is {}", targetPackage, ""); template.add("tables", tables); return template.render(); }
[ "public", "String", "generateMainClass", "(", "final", "Collection", "<", "TableModel", ">", "tables", ",", "final", "boolean", "enableVisualizationSupport", ")", "{", "Objects", ".", "requireNonNull", "(", "tables", ")", ";", "//get package from the table models\r", "final", "String", "targetPackage", "=", "(", "(", "TableModel", ")", "tables", ".", "toArray", "(", ")", "[", "0", "]", ")", ".", "getPackageName", "(", ")", ";", "final", "ST", "template", "=", "this", ".", "stGroup", ".", "getInstanceOf", "(", "\"mainClass\"", ")", ";", "LOG", ".", "debug", "(", "\"Filling main class template containing helpers for {} classes...\"", ",", "tables", ".", "size", "(", ")", ")", ";", "template", ".", "add", "(", "\"package\"", ",", "targetPackage", ")", ";", "// TODO: make prefix usable\r", "template", ".", "add", "(", "\"prefix\"", ",", "\"\"", ")", ";", "template", ".", "add", "(", "\"enableVisualizationSupport\"", ",", "enableVisualizationSupport", ")", ";", "LOG", ".", "debug", "(", "\"Package is {} | Prefix is {}\"", ",", "targetPackage", ",", "\"\"", ")", ";", "template", ".", "add", "(", "\"tables\"", ",", "tables", ")", ";", "return", "template", ".", "render", "(", ")", ";", "}" ]
Generates the main class used for creating the extractor objects and later generating the insert statements. For each passed table a appropriate creation method will be generated that will return the new object and internally add it to the list of objects that will be used to generate the insert strings @param tables All tables that should get a creation method in the main class @param enableVisualizationSupport If {@code true}, the RedG visualization features will be enabled for the generated code. This will result in a small performance hit and slightly more memory usage if activated. @return The generated source code
[ "Generates", "the", "main", "class", "used", "for", "creating", "the", "extractor", "objects", "and", "later", "generating", "the", "insert", "statements", ".", "For", "each", "passed", "table", "a", "appropriate", "creation", "method", "will", "be", "generated", "that", "will", "return", "the", "new", "object", "and", "internally", "add", "it", "to", "the", "list", "of", "objects", "that", "will", "be", "used", "to", "generate", "the", "insert", "strings" ]
train
https://github.com/btc-ag/redg/blob/416a68639d002512cabfebff09afd2e1909e27df/redg-generator/src/main/java/com/btc/redg/generator/CodeGenerator.java#L223-L239
auth0/auth0-java
src/main/java/com/auth0/client/mgmt/filter/FieldsFilter.java
FieldsFilter.withFields
public FieldsFilter withFields(String fields, boolean includeFields) { """ Only retrieve certain fields from the item. @param fields a list of comma separated fields to retrieve. @param includeFields whether to include or exclude in the response the fields that were given. @return this filter instance """ parameters.put("fields", fields); parameters.put("include_fields", includeFields); return this; }
java
public FieldsFilter withFields(String fields, boolean includeFields) { parameters.put("fields", fields); parameters.put("include_fields", includeFields); return this; }
[ "public", "FieldsFilter", "withFields", "(", "String", "fields", ",", "boolean", "includeFields", ")", "{", "parameters", ".", "put", "(", "\"fields\"", ",", "fields", ")", ";", "parameters", ".", "put", "(", "\"include_fields\"", ",", "includeFields", ")", ";", "return", "this", ";", "}" ]
Only retrieve certain fields from the item. @param fields a list of comma separated fields to retrieve. @param includeFields whether to include or exclude in the response the fields that were given. @return this filter instance
[ "Only", "retrieve", "certain", "fields", "from", "the", "item", "." ]
train
https://github.com/auth0/auth0-java/blob/b7bc099ee9c6cde5a87c4ecfebc6d811aeb1027c/src/main/java/com/auth0/client/mgmt/filter/FieldsFilter.java#L15-L19
doanduyhai/Achilles
achilles-core/src/main/java/info/archinnov/achilles/internals/metamodel/AbstractProperty.java
AbstractProperty.encodeFieldToUdt
public void encodeFieldToUdt(ENTITY entity, UDTValue udtValue) { """ <ol> <li>First extract all the values from the given entity</li> <li>Then encode each of the extracted value into CQL-compatible value using Achilles codec system</li> <li>Finally set the encoded value to the given UDTValue instance</li> </ol> @param entity @param udtValue """ encodeFieldToUdt(entity, udtValue, Optional.empty()); }
java
public void encodeFieldToUdt(ENTITY entity, UDTValue udtValue) { encodeFieldToUdt(entity, udtValue, Optional.empty()); }
[ "public", "void", "encodeFieldToUdt", "(", "ENTITY", "entity", ",", "UDTValue", "udtValue", ")", "{", "encodeFieldToUdt", "(", "entity", ",", "udtValue", ",", "Optional", ".", "empty", "(", ")", ")", ";", "}" ]
<ol> <li>First extract all the values from the given entity</li> <li>Then encode each of the extracted value into CQL-compatible value using Achilles codec system</li> <li>Finally set the encoded value to the given UDTValue instance</li> </ol> @param entity @param udtValue
[ "<ol", ">", "<li", ">", "First", "extract", "all", "the", "values", "from", "the", "given", "entity<", "/", "li", ">", "<li", ">", "Then", "encode", "each", "of", "the", "extracted", "value", "into", "CQL", "-", "compatible", "value", "using", "Achilles", "codec", "system<", "/", "li", ">", "<li", ">", "Finally", "set", "the", "encoded", "value", "to", "the", "given", "UDTValue", "instance<", "/", "li", ">", "<", "/", "ol", ">" ]
train
https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/internals/metamodel/AbstractProperty.java#L210-L212
json-path/JsonPath
json-path/src/main/java/com/jayway/jsonpath/JsonPath.java
JsonPath.read
@SuppressWarnings( { """ Creates a new JsonPath and applies it to the provided Json object @param jsonURL url pointing to json doc @param jsonPath the json path @param filters filters to be applied to the filter place holders [?] in the path @param <T> expected return type @return list of objects matched by the given path """"unchecked"}) @Deprecated public static <T> T read(URL jsonURL, String jsonPath, Predicate... filters) throws IOException { return new ParseContextImpl().parse(jsonURL).read(jsonPath, filters); }
java
@SuppressWarnings({"unchecked"}) @Deprecated public static <T> T read(URL jsonURL, String jsonPath, Predicate... filters) throws IOException { return new ParseContextImpl().parse(jsonURL).read(jsonPath, filters); }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", "}", ")", "@", "Deprecated", "public", "static", "<", "T", ">", "T", "read", "(", "URL", "jsonURL", ",", "String", "jsonPath", ",", "Predicate", "...", "filters", ")", "throws", "IOException", "{", "return", "new", "ParseContextImpl", "(", ")", ".", "parse", "(", "jsonURL", ")", ".", "read", "(", "jsonPath", ",", "filters", ")", ";", "}" ]
Creates a new JsonPath and applies it to the provided Json object @param jsonURL url pointing to json doc @param jsonPath the json path @param filters filters to be applied to the filter place holders [?] in the path @param <T> expected return type @return list of objects matched by the given path
[ "Creates", "a", "new", "JsonPath", "and", "applies", "it", "to", "the", "provided", "Json", "object" ]
train
https://github.com/json-path/JsonPath/blob/5a09489c3252b74bbf81992aadb3073be59c04f9/json-path/src/main/java/com/jayway/jsonpath/JsonPath.java#L511-L515
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/URLConnection.java
URLConnection.addRequestProperty
public void addRequestProperty(String key, String value) { """ The following three methods addRequestProperty, getRequestProperty, and getRequestProperties were copied from the superclass implementation before it was changed by CR:6230836, to maintain backward compatibility. """ if (connected) throw new IllegalStateException("Already connected"); if (key == null) throw new NullPointerException ("key is null"); }
java
public void addRequestProperty(String key, String value) { if (connected) throw new IllegalStateException("Already connected"); if (key == null) throw new NullPointerException ("key is null"); }
[ "public", "void", "addRequestProperty", "(", "String", "key", ",", "String", "value", ")", "{", "if", "(", "connected", ")", "throw", "new", "IllegalStateException", "(", "\"Already connected\"", ")", ";", "if", "(", "key", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"key is null\"", ")", ";", "}" ]
The following three methods addRequestProperty, getRequestProperty, and getRequestProperties were copied from the superclass implementation before it was changed by CR:6230836, to maintain backward compatibility.
[ "The", "following", "three", "methods", "addRequestProperty", "getRequestProperty", "and", "getRequestProperties", "were", "copied", "from", "the", "superclass", "implementation", "before", "it", "was", "changed", "by", "CR", ":", "6230836", "to", "maintain", "backward", "compatibility", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/URLConnection.java#L86-L91
mikepenz/Materialize
library/src/main/java/com/mikepenz/materialize/holder/ImageHolder.java
ImageHolder.applyToOrSetInvisible
public static void applyToOrSetInvisible(ImageHolder imageHolder, ImageView imageView, String tag) { """ a small static helper to set the image from the imageHolder nullSave to the imageView and hide the view if no image was set @param imageHolder @param imageView @param tag used to identify imageViews and define different placeholders """ boolean imageSet = applyTo(imageHolder, imageView, tag); if (imageView != null) { if (imageSet) { imageView.setVisibility(View.VISIBLE); } else { imageView.setVisibility(View.INVISIBLE); } } }
java
public static void applyToOrSetInvisible(ImageHolder imageHolder, ImageView imageView, String tag) { boolean imageSet = applyTo(imageHolder, imageView, tag); if (imageView != null) { if (imageSet) { imageView.setVisibility(View.VISIBLE); } else { imageView.setVisibility(View.INVISIBLE); } } }
[ "public", "static", "void", "applyToOrSetInvisible", "(", "ImageHolder", "imageHolder", ",", "ImageView", "imageView", ",", "String", "tag", ")", "{", "boolean", "imageSet", "=", "applyTo", "(", "imageHolder", ",", "imageView", ",", "tag", ")", ";", "if", "(", "imageView", "!=", "null", ")", "{", "if", "(", "imageSet", ")", "{", "imageView", ".", "setVisibility", "(", "View", ".", "VISIBLE", ")", ";", "}", "else", "{", "imageView", ".", "setVisibility", "(", "View", ".", "INVISIBLE", ")", ";", "}", "}", "}" ]
a small static helper to set the image from the imageHolder nullSave to the imageView and hide the view if no image was set @param imageHolder @param imageView @param tag used to identify imageViews and define different placeholders
[ "a", "small", "static", "helper", "to", "set", "the", "image", "from", "the", "imageHolder", "nullSave", "to", "the", "imageView", "and", "hide", "the", "view", "if", "no", "image", "was", "set" ]
train
https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/holder/ImageHolder.java#L194-L203
jbundle/webapp
base/src/main/java/org/jbundle/util/webapp/base/BaseOsgiServlet.java
BaseOsgiServlet.sendResourceFile
public boolean sendResourceFile(HttpServletRequest request, HttpServletResponse response) throws IOException { """ Send this resource to the response stream. @param request @param response @return @throws IOException """ String path = request.getPathInfo(); if (path == null) path = request.getRequestURI(); if (path == null) return false; path = this.fixPathInfo(path); return this.sendResourceFile(path, response); }
java
public boolean sendResourceFile(HttpServletRequest request, HttpServletResponse response) throws IOException { String path = request.getPathInfo(); if (path == null) path = request.getRequestURI(); if (path == null) return false; path = this.fixPathInfo(path); return this.sendResourceFile(path, response); }
[ "public", "boolean", "sendResourceFile", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "IOException", "{", "String", "path", "=", "request", ".", "getPathInfo", "(", ")", ";", "if", "(", "path", "==", "null", ")", "path", "=", "request", ".", "getRequestURI", "(", ")", ";", "if", "(", "path", "==", "null", ")", "return", "false", ";", "path", "=", "this", ".", "fixPathInfo", "(", "path", ")", ";", "return", "this", ".", "sendResourceFile", "(", "path", ",", "response", ")", ";", "}" ]
Send this resource to the response stream. @param request @param response @return @throws IOException
[ "Send", "this", "resource", "to", "the", "response", "stream", "." ]
train
https://github.com/jbundle/webapp/blob/af2cf32bd92254073052f1f9b4bcd47c2f76ba7d/base/src/main/java/org/jbundle/util/webapp/base/BaseOsgiServlet.java#L69-L79
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/DeltaMap.java
DeltaMap.put
@Override @SuppressWarnings("unchecked") public V put(K key, V value) { """ This may cost twice what it would in the original Map because we have to find the original value for this key. @param key key with which the specified value is to be associated. @param value value to be associated with the specified key. @return previous value associated with specified key, or <tt>null</tt> if there was no mapping for key. A <tt>null</tt> return can also indicate that the map previously associated <tt>null</tt> with the specified key, if the implementation supports <tt>null</tt> values. """ if (value == null) { return put(key, (V)nullValue); } // key could be not in original or in deltaMap // key could be not in original but in deltaMap // key could be in original but removed from deltaMap // key could be in original but mapped to something else in deltaMap V result = deltaMap.put(key, value); if (result == null) { return originalMap.get(key); } if (result == nullValue) { return null; } if (result == removedValue) { return null; } return result; }
java
@Override @SuppressWarnings("unchecked") public V put(K key, V value) { if (value == null) { return put(key, (V)nullValue); } // key could be not in original or in deltaMap // key could be not in original but in deltaMap // key could be in original but removed from deltaMap // key could be in original but mapped to something else in deltaMap V result = deltaMap.put(key, value); if (result == null) { return originalMap.get(key); } if (result == nullValue) { return null; } if (result == removedValue) { return null; } return result; }
[ "@", "Override", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "V", "put", "(", "K", "key", ",", "V", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "put", "(", "key", ",", "(", "V", ")", "nullValue", ")", ";", "}", "// key could be not in original or in deltaMap\r", "// key could be not in original but in deltaMap\r", "// key could be in original but removed from deltaMap\r", "// key could be in original but mapped to something else in deltaMap\r", "V", "result", "=", "deltaMap", ".", "put", "(", "key", ",", "value", ")", ";", "if", "(", "result", "==", "null", ")", "{", "return", "originalMap", ".", "get", "(", "key", ")", ";", "}", "if", "(", "result", "==", "nullValue", ")", "{", "return", "null", ";", "}", "if", "(", "result", "==", "removedValue", ")", "{", "return", "null", ";", "}", "return", "result", ";", "}" ]
This may cost twice what it would in the original Map because we have to find the original value for this key. @param key key with which the specified value is to be associated. @param value value to be associated with the specified key. @return previous value associated with specified key, or <tt>null</tt> if there was no mapping for key. A <tt>null</tt> return can also indicate that the map previously associated <tt>null</tt> with the specified key, if the implementation supports <tt>null</tt> values.
[ "This", "may", "cost", "twice", "what", "it", "would", "in", "the", "original", "Map", "because", "we", "have", "to", "find", "the", "original", "value", "for", "this", "key", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/DeltaMap.java#L138-L159
Azure/azure-sdk-for-java
servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/ManagementClientAsync.java
ManagementClientAsync.createSubscriptionAsync
public CompletableFuture<SubscriptionDescription> createSubscriptionAsync(SubscriptionDescription subscriptionDescription, RuleDescription defaultRule) { """ Creates a new subscription in the service namespace with the provided default rule. See {@link SubscriptionDescription} for default values of subscription properties. @param subscriptionDescription - A {@link SubscriptionDescription} object describing the attributes with which the new subscription will be created. @param defaultRule - A {@link RuleDescription} object describing the default rule. If null, then pass-through filter will be created. @return {@link SubscriptionDescription} of the newly created subscription. """ subscriptionDescription.defaultRule = defaultRule; return putSubscriptionAsync(subscriptionDescription, false); }
java
public CompletableFuture<SubscriptionDescription> createSubscriptionAsync(SubscriptionDescription subscriptionDescription, RuleDescription defaultRule) { subscriptionDescription.defaultRule = defaultRule; return putSubscriptionAsync(subscriptionDescription, false); }
[ "public", "CompletableFuture", "<", "SubscriptionDescription", ">", "createSubscriptionAsync", "(", "SubscriptionDescription", "subscriptionDescription", ",", "RuleDescription", "defaultRule", ")", "{", "subscriptionDescription", ".", "defaultRule", "=", "defaultRule", ";", "return", "putSubscriptionAsync", "(", "subscriptionDescription", ",", "false", ")", ";", "}" ]
Creates a new subscription in the service namespace with the provided default rule. See {@link SubscriptionDescription} for default values of subscription properties. @param subscriptionDescription - A {@link SubscriptionDescription} object describing the attributes with which the new subscription will be created. @param defaultRule - A {@link RuleDescription} object describing the default rule. If null, then pass-through filter will be created. @return {@link SubscriptionDescription} of the newly created subscription.
[ "Creates", "a", "new", "subscription", "in", "the", "service", "namespace", "with", "the", "provided", "default", "rule", ".", "See", "{" ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/ManagementClientAsync.java#L650-L653
xvik/generics-resolver
src/main/java/ru/vyarus/java/generics/resolver/util/TypeToStringUtils.java
TypeToStringUtils.toStringType
@SuppressWarnings("PMD.UseStringBufferForStringAppends") public static String toStringType(final Type type, final Map<String, Type> generics) { """ Prints type as string. E.g. {@code toStringType(ParameterizedType(List, String), [:]) == "List<String>"}, {@code toStringType(WildcardType(String), [:]) == "? extends String" }. <p> If {@link ParameterizedType} is inner class and contains information about outer generics, it will be printed as {@code Outer<Generics>.Inner<Generics>} in order to indicate all available information. In other cases outer class is not indicated. @param type type to convert to string @param generics type class generics type @return string representation of provided type @throws UnknownGenericException when found generic not declared on type (e.g. method generic) @see ru.vyarus.java.generics.resolver.util.map.PrintableGenericsMap to print not known generic names @see #toStringTypeIgnoringVariables(Type) shortcut to print Object instead of not known generic @see #toStringType(Type) shortcut for types without variables """ final String res; if (type instanceof Class) { res = processClass((Class) type); } else if (type instanceof ParameterizedType) { res = processParametrizedType((ParameterizedType) type, generics); } else if (type instanceof GenericArrayType) { res = toStringType(((GenericArrayType) type).getGenericComponentType(), generics) + "[]"; } else if (type instanceof WildcardType) { res = processWildcardType((WildcardType) type, generics); } else if (type instanceof ExplicitTypeVariable) { // print generic name (only when PrintableGenericsMap used) res = type.toString(); } else { // deep generics nesting case // when PrintableGenericsMap used and generics is not known, will print generic name (see above) res = toStringType(declaredGeneric((TypeVariable) type, generics), generics); } return res; }
java
@SuppressWarnings("PMD.UseStringBufferForStringAppends") public static String toStringType(final Type type, final Map<String, Type> generics) { final String res; if (type instanceof Class) { res = processClass((Class) type); } else if (type instanceof ParameterizedType) { res = processParametrizedType((ParameterizedType) type, generics); } else if (type instanceof GenericArrayType) { res = toStringType(((GenericArrayType) type).getGenericComponentType(), generics) + "[]"; } else if (type instanceof WildcardType) { res = processWildcardType((WildcardType) type, generics); } else if (type instanceof ExplicitTypeVariable) { // print generic name (only when PrintableGenericsMap used) res = type.toString(); } else { // deep generics nesting case // when PrintableGenericsMap used and generics is not known, will print generic name (see above) res = toStringType(declaredGeneric((TypeVariable) type, generics), generics); } return res; }
[ "@", "SuppressWarnings", "(", "\"PMD.UseStringBufferForStringAppends\"", ")", "public", "static", "String", "toStringType", "(", "final", "Type", "type", ",", "final", "Map", "<", "String", ",", "Type", ">", "generics", ")", "{", "final", "String", "res", ";", "if", "(", "type", "instanceof", "Class", ")", "{", "res", "=", "processClass", "(", "(", "Class", ")", "type", ")", ";", "}", "else", "if", "(", "type", "instanceof", "ParameterizedType", ")", "{", "res", "=", "processParametrizedType", "(", "(", "ParameterizedType", ")", "type", ",", "generics", ")", ";", "}", "else", "if", "(", "type", "instanceof", "GenericArrayType", ")", "{", "res", "=", "toStringType", "(", "(", "(", "GenericArrayType", ")", "type", ")", ".", "getGenericComponentType", "(", ")", ",", "generics", ")", "+", "\"[]\"", ";", "}", "else", "if", "(", "type", "instanceof", "WildcardType", ")", "{", "res", "=", "processWildcardType", "(", "(", "WildcardType", ")", "type", ",", "generics", ")", ";", "}", "else", "if", "(", "type", "instanceof", "ExplicitTypeVariable", ")", "{", "// print generic name (only when PrintableGenericsMap used)", "res", "=", "type", ".", "toString", "(", ")", ";", "}", "else", "{", "// deep generics nesting case", "// when PrintableGenericsMap used and generics is not known, will print generic name (see above)", "res", "=", "toStringType", "(", "declaredGeneric", "(", "(", "TypeVariable", ")", "type", ",", "generics", ")", ",", "generics", ")", ";", "}", "return", "res", ";", "}" ]
Prints type as string. E.g. {@code toStringType(ParameterizedType(List, String), [:]) == "List<String>"}, {@code toStringType(WildcardType(String), [:]) == "? extends String" }. <p> If {@link ParameterizedType} is inner class and contains information about outer generics, it will be printed as {@code Outer<Generics>.Inner<Generics>} in order to indicate all available information. In other cases outer class is not indicated. @param type type to convert to string @param generics type class generics type @return string representation of provided type @throws UnknownGenericException when found generic not declared on type (e.g. method generic) @see ru.vyarus.java.generics.resolver.util.map.PrintableGenericsMap to print not known generic names @see #toStringTypeIgnoringVariables(Type) shortcut to print Object instead of not known generic @see #toStringType(Type) shortcut for types without variables
[ "Prints", "type", "as", "string", ".", "E", ".", "g", ".", "{", "@code", "toStringType", "(", "ParameterizedType", "(", "List", "String", ")", "[", ":", "]", ")", "==", "List<String", ">", "}", "{", "@code", "toStringType", "(", "WildcardType", "(", "String", ")", "[", ":", "]", ")", "==", "?", "extends", "String", "}", ".", "<p", ">", "If", "{", "@link", "ParameterizedType", "}", "is", "inner", "class", "and", "contains", "information", "about", "outer", "generics", "it", "will", "be", "printed", "as", "{", "@code", "Outer<Generics", ">", ".", "Inner<Generics", ">", "}", "in", "order", "to", "indicate", "all", "available", "information", ".", "In", "other", "cases", "outer", "class", "is", "not", "indicated", "." ]
train
https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/util/TypeToStringUtils.java#L69-L89
OpenLiberty/open-liberty
dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/WebServerPluginUtility.java
WebServerPluginUtility.looksLikeHelp
private static boolean looksLikeHelp(HelpTask help, String taskname) { """ note that the string is already trim()'d by command-line parsing unless user explicitly escaped a space """ if (taskname == null) return false; // applied paranoia, since this isn't in a performance path int start = 0, len = taskname.length(); while (start < len && !Character.isLetter(taskname.charAt(start))) ++start; return help.getTaskName().equalsIgnoreCase(taskname.substring(start).toLowerCase()); }
java
private static boolean looksLikeHelp(HelpTask help, String taskname) { if (taskname == null) return false; // applied paranoia, since this isn't in a performance path int start = 0, len = taskname.length(); while (start < len && !Character.isLetter(taskname.charAt(start))) ++start; return help.getTaskName().equalsIgnoreCase(taskname.substring(start).toLowerCase()); }
[ "private", "static", "boolean", "looksLikeHelp", "(", "HelpTask", "help", ",", "String", "taskname", ")", "{", "if", "(", "taskname", "==", "null", ")", "return", "false", ";", "// applied paranoia, since this isn't in a performance path", "int", "start", "=", "0", ",", "len", "=", "taskname", ".", "length", "(", ")", ";", "while", "(", "start", "<", "len", "&&", "!", "Character", ".", "isLetter", "(", "taskname", ".", "charAt", "(", "start", ")", ")", ")", "++", "start", ";", "return", "help", ".", "getTaskName", "(", ")", ".", "equalsIgnoreCase", "(", "taskname", ".", "substring", "(", "start", ")", ".", "toLowerCase", "(", ")", ")", ";", "}" ]
note that the string is already trim()'d by command-line parsing unless user explicitly escaped a space
[ "note", "that", "the", "string", "is", "already", "trim", "()", "d", "by", "command", "-", "line", "parsing", "unless", "user", "explicitly", "escaped", "a", "space" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/WebServerPluginUtility.java#L114-L121
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/LiveEventsInner.java
LiveEventsInner.beginStartAsync
public Observable<Void> beginStartAsync(String resourceGroupName, String accountName, String liveEventName) { """ Start Live Event. Starts an existing Live Event. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param liveEventName The name of the Live Event. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ return beginStartWithServiceResponseAsync(resourceGroupName, accountName, liveEventName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> beginStartAsync(String resourceGroupName, String accountName, String liveEventName) { return beginStartWithServiceResponseAsync(resourceGroupName, accountName, liveEventName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "beginStartAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "liveEventName", ")", "{", "return", "beginStartWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "liveEventName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Void", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponse", "<", "Void", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Start Live Event. Starts an existing Live Event. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param liveEventName The name of the Live Event. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Start", "Live", "Event", ".", "Starts", "an", "existing", "Live", "Event", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/LiveEventsInner.java#L1226-L1233
jMetal/jMetal
jmetal-algorithm/src/main/java/org/uma/jmetal/algorithm/multiobjective/moead/util/MOEADUtils.java
MOEADUtils.quickSort
public static void quickSort(double[] array, int[] idx, int from, int to) { """ Quick sort procedure (ascending order) @param array @param idx @param from @param to """ if (from < to) { double temp = array[to]; int tempIdx = idx[to]; int i = from - 1; for (int j = from; j < to; j++) { if (array[j] <= temp) { i++; double tempValue = array[j]; array[j] = array[i]; array[i] = tempValue; int tempIndex = idx[j]; idx[j] = idx[i]; idx[i] = tempIndex; } } array[to] = array[i + 1]; array[i + 1] = temp; idx[to] = idx[i + 1]; idx[i + 1] = tempIdx; quickSort(array, idx, from, i); quickSort(array, idx, i + 1, to); } }
java
public static void quickSort(double[] array, int[] idx, int from, int to) { if (from < to) { double temp = array[to]; int tempIdx = idx[to]; int i = from - 1; for (int j = from; j < to; j++) { if (array[j] <= temp) { i++; double tempValue = array[j]; array[j] = array[i]; array[i] = tempValue; int tempIndex = idx[j]; idx[j] = idx[i]; idx[i] = tempIndex; } } array[to] = array[i + 1]; array[i + 1] = temp; idx[to] = idx[i + 1]; idx[i + 1] = tempIdx; quickSort(array, idx, from, i); quickSort(array, idx, i + 1, to); } }
[ "public", "static", "void", "quickSort", "(", "double", "[", "]", "array", ",", "int", "[", "]", "idx", ",", "int", "from", ",", "int", "to", ")", "{", "if", "(", "from", "<", "to", ")", "{", "double", "temp", "=", "array", "[", "to", "]", ";", "int", "tempIdx", "=", "idx", "[", "to", "]", ";", "int", "i", "=", "from", "-", "1", ";", "for", "(", "int", "j", "=", "from", ";", "j", "<", "to", ";", "j", "++", ")", "{", "if", "(", "array", "[", "j", "]", "<=", "temp", ")", "{", "i", "++", ";", "double", "tempValue", "=", "array", "[", "j", "]", ";", "array", "[", "j", "]", "=", "array", "[", "i", "]", ";", "array", "[", "i", "]", "=", "tempValue", ";", "int", "tempIndex", "=", "idx", "[", "j", "]", ";", "idx", "[", "j", "]", "=", "idx", "[", "i", "]", ";", "idx", "[", "i", "]", "=", "tempIndex", ";", "}", "}", "array", "[", "to", "]", "=", "array", "[", "i", "+", "1", "]", ";", "array", "[", "i", "+", "1", "]", "=", "temp", ";", "idx", "[", "to", "]", "=", "idx", "[", "i", "+", "1", "]", ";", "idx", "[", "i", "+", "1", "]", "=", "tempIdx", ";", "quickSort", "(", "array", ",", "idx", ",", "from", ",", "i", ")", ";", "quickSort", "(", "array", ",", "idx", ",", "i", "+", "1", ",", "to", ")", ";", "}", "}" ]
Quick sort procedure (ascending order) @param array @param idx @param from @param to
[ "Quick", "sort", "procedure", "(", "ascending", "order", ")" ]
train
https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-algorithm/src/main/java/org/uma/jmetal/algorithm/multiobjective/moead/util/MOEADUtils.java#L26-L49
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/LinAlgExceptions.java
LinAlgExceptions.assertMultiplies
public static void assertMultiplies(INDArray nd1, INDArray nd2) { """ Asserts matrix multiply rules (columns of left == rows of right or rows of left == columns of right) @param nd1 the left ndarray @param nd2 the right ndarray """ if (nd1.rank() == 2 && nd2.rank() == 2 && nd1.columns() == nd2.rows()) { return; } // 1D edge case if (nd1.rank() == 2 && nd2.rank() == 1 && nd1.columns() == nd2.length()) return; throw new ND4JIllegalStateException("Cannot execute matrix multiplication: " + Arrays.toString(nd1.shape()) + "x" + Arrays.toString(nd2.shape()) + (nd1.rank() != 2 || nd2.rank() != 2 ? ": inputs are not matrices" : ": Column of left array " + nd1.columns() + " != rows of right " + nd2.rows())); }
java
public static void assertMultiplies(INDArray nd1, INDArray nd2) { if (nd1.rank() == 2 && nd2.rank() == 2 && nd1.columns() == nd2.rows()) { return; } // 1D edge case if (nd1.rank() == 2 && nd2.rank() == 1 && nd1.columns() == nd2.length()) return; throw new ND4JIllegalStateException("Cannot execute matrix multiplication: " + Arrays.toString(nd1.shape()) + "x" + Arrays.toString(nd2.shape()) + (nd1.rank() != 2 || nd2.rank() != 2 ? ": inputs are not matrices" : ": Column of left array " + nd1.columns() + " != rows of right " + nd2.rows())); }
[ "public", "static", "void", "assertMultiplies", "(", "INDArray", "nd1", ",", "INDArray", "nd2", ")", "{", "if", "(", "nd1", ".", "rank", "(", ")", "==", "2", "&&", "nd2", ".", "rank", "(", ")", "==", "2", "&&", "nd1", ".", "columns", "(", ")", "==", "nd2", ".", "rows", "(", ")", ")", "{", "return", ";", "}", "// 1D edge case", "if", "(", "nd1", ".", "rank", "(", ")", "==", "2", "&&", "nd2", ".", "rank", "(", ")", "==", "1", "&&", "nd1", ".", "columns", "(", ")", "==", "nd2", ".", "length", "(", ")", ")", "return", ";", "throw", "new", "ND4JIllegalStateException", "(", "\"Cannot execute matrix multiplication: \"", "+", "Arrays", ".", "toString", "(", "nd1", ".", "shape", "(", ")", ")", "+", "\"x\"", "+", "Arrays", ".", "toString", "(", "nd2", ".", "shape", "(", ")", ")", "+", "(", "nd1", ".", "rank", "(", ")", "!=", "2", "||", "nd2", ".", "rank", "(", ")", "!=", "2", "?", "\": inputs are not matrices\"", ":", "\": Column of left array \"", "+", "nd1", ".", "columns", "(", ")", "+", "\" != rows of right \"", "+", "nd2", ".", "rows", "(", ")", ")", ")", ";", "}" ]
Asserts matrix multiply rules (columns of left == rows of right or rows of left == columns of right) @param nd1 the left ndarray @param nd2 the right ndarray
[ "Asserts", "matrix", "multiply", "rules", "(", "columns", "of", "left", "==", "rows", "of", "right", "or", "rows", "of", "left", "==", "columns", "of", "right", ")" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/LinAlgExceptions.java#L104-L118
ehcache/ehcache3
impl/src/main/java/org/ehcache/config/builders/UserManagedCacheBuilder.java
UserManagedCacheBuilder.withSizeOfMaxObjectSize
public UserManagedCacheBuilder<K, V, T> withSizeOfMaxObjectSize(long size, MemoryUnit unit) { """ Adds or updates the {@link DefaultSizeOfEngineProviderConfiguration} with the specified maximum mapping size to the configured builder. <p> {@link SizeOfEngine} is what enables the heap tier to be sized in {@link MemoryUnit}. @param size the maximum mapping size @param unit the memory unit @return a new builder with the added / updated configuration """ UserManagedCacheBuilder<K, V, T> otherBuilder = new UserManagedCacheBuilder<>(this); removeAnySizeOfEngine(otherBuilder); otherBuilder.maxObjectSize = size; otherBuilder.sizeOfUnit = unit; otherBuilder.serviceCreationConfigurations.add(new DefaultSizeOfEngineProviderConfiguration(otherBuilder.maxObjectSize, otherBuilder.sizeOfUnit, otherBuilder.objectGraphSize)); return otherBuilder; }
java
public UserManagedCacheBuilder<K, V, T> withSizeOfMaxObjectSize(long size, MemoryUnit unit) { UserManagedCacheBuilder<K, V, T> otherBuilder = new UserManagedCacheBuilder<>(this); removeAnySizeOfEngine(otherBuilder); otherBuilder.maxObjectSize = size; otherBuilder.sizeOfUnit = unit; otherBuilder.serviceCreationConfigurations.add(new DefaultSizeOfEngineProviderConfiguration(otherBuilder.maxObjectSize, otherBuilder.sizeOfUnit, otherBuilder.objectGraphSize)); return otherBuilder; }
[ "public", "UserManagedCacheBuilder", "<", "K", ",", "V", ",", "T", ">", "withSizeOfMaxObjectSize", "(", "long", "size", ",", "MemoryUnit", "unit", ")", "{", "UserManagedCacheBuilder", "<", "K", ",", "V", ",", "T", ">", "otherBuilder", "=", "new", "UserManagedCacheBuilder", "<>", "(", "this", ")", ";", "removeAnySizeOfEngine", "(", "otherBuilder", ")", ";", "otherBuilder", ".", "maxObjectSize", "=", "size", ";", "otherBuilder", ".", "sizeOfUnit", "=", "unit", ";", "otherBuilder", ".", "serviceCreationConfigurations", ".", "add", "(", "new", "DefaultSizeOfEngineProviderConfiguration", "(", "otherBuilder", ".", "maxObjectSize", ",", "otherBuilder", ".", "sizeOfUnit", ",", "otherBuilder", ".", "objectGraphSize", ")", ")", ";", "return", "otherBuilder", ";", "}" ]
Adds or updates the {@link DefaultSizeOfEngineProviderConfiguration} with the specified maximum mapping size to the configured builder. <p> {@link SizeOfEngine} is what enables the heap tier to be sized in {@link MemoryUnit}. @param size the maximum mapping size @param unit the memory unit @return a new builder with the added / updated configuration
[ "Adds", "or", "updates", "the", "{", "@link", "DefaultSizeOfEngineProviderConfiguration", "}", "with", "the", "specified", "maximum", "mapping", "size", "to", "the", "configured", "builder", ".", "<p", ">", "{", "@link", "SizeOfEngine", "}", "is", "what", "enables", "the", "heap", "tier", "to", "be", "sized", "in", "{", "@link", "MemoryUnit", "}", "." ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/config/builders/UserManagedCacheBuilder.java#L759-L766
pravega/pravega
common/src/main/java/io/pravega/common/concurrent/Futures.java
Futures.await
public static <T> boolean await(CompletableFuture<T> f, long timeout) { """ Waits for the provided future to be complete, and returns true if it was successful, false if it failed or did not complete. @param timeout The maximum number of milliseconds to block @param f The future to wait for. @param <T> The Type of the future's result. @return True if the given CompletableFuture is completed and successful within the given timeout. """ Exceptions.handleInterrupted(() -> { try { f.get(timeout, TimeUnit.MILLISECONDS); } catch (TimeoutException | ExecutionException e) { // Not handled here. } }); return isSuccessful(f); }
java
public static <T> boolean await(CompletableFuture<T> f, long timeout) { Exceptions.handleInterrupted(() -> { try { f.get(timeout, TimeUnit.MILLISECONDS); } catch (TimeoutException | ExecutionException e) { // Not handled here. } }); return isSuccessful(f); }
[ "public", "static", "<", "T", ">", "boolean", "await", "(", "CompletableFuture", "<", "T", ">", "f", ",", "long", "timeout", ")", "{", "Exceptions", ".", "handleInterrupted", "(", "(", ")", "->", "{", "try", "{", "f", ".", "get", "(", "timeout", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "}", "catch", "(", "TimeoutException", "|", "ExecutionException", "e", ")", "{", "// Not handled here.", "}", "}", ")", ";", "return", "isSuccessful", "(", "f", ")", ";", "}" ]
Waits for the provided future to be complete, and returns true if it was successful, false if it failed or did not complete. @param timeout The maximum number of milliseconds to block @param f The future to wait for. @param <T> The Type of the future's result. @return True if the given CompletableFuture is completed and successful within the given timeout.
[ "Waits", "for", "the", "provided", "future", "to", "be", "complete", "and", "returns", "true", "if", "it", "was", "successful", "false", "if", "it", "failed", "or", "did", "not", "complete", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/concurrent/Futures.java#L65-L74
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/MetamodelImpl.java
MetamodelImpl.assignManagedTypes
public void assignManagedTypes(Map<Class<?>, EntityType<?>> managedTypes) { """ Assign to managedTypes. @param managedTypes the managedTypes to set """ if (this.entityTypes == null) { this.entityTypes = managedTypes; } else { this.entityTypes.putAll(managedTypes); } }
java
public void assignManagedTypes(Map<Class<?>, EntityType<?>> managedTypes) { if (this.entityTypes == null) { this.entityTypes = managedTypes; } else { this.entityTypes.putAll(managedTypes); } }
[ "public", "void", "assignManagedTypes", "(", "Map", "<", "Class", "<", "?", ">", ",", "EntityType", "<", "?", ">", ">", "managedTypes", ")", "{", "if", "(", "this", ".", "entityTypes", "==", "null", ")", "{", "this", ".", "entityTypes", "=", "managedTypes", ";", "}", "else", "{", "this", ".", "entityTypes", ".", "putAll", "(", "managedTypes", ")", ";", "}", "}" ]
Assign to managedTypes. @param managedTypes the managedTypes to set
[ "Assign", "to", "managedTypes", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/MetamodelImpl.java#L297-L307
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/util/VersionInfoUtils.java
VersionInfoUtils.languageVersion
private static String languageVersion(String language, String className, String methodOrFieldName, boolean isMethod) { """ Attempt to determine if this language exists on the classpath and what it's version is @param language the name of the language @param className a class of that lanauge that exposes runtime version information @param methodOrFieldName the static field or method name that holds the version number @param isMethod whether the above is a field or method @return the version number or empty string if the language does not exist on the classpath """ StringBuilder sb = new StringBuilder(); try { Class<?> clz = Class.forName(className); sb.append(language); String version = isMethod ? (String) clz.getMethod(methodOrFieldName).invoke(null) : (String) clz.getField(methodOrFieldName).get(null); concat(sb, version, "/"); } catch (ClassNotFoundException e) { //Ignore } catch (Exception e) { if (log.isTraceEnabled()){ log.trace("Exception attempting to get " + language + " version.", e); } } return sb.toString(); }
java
private static String languageVersion(String language, String className, String methodOrFieldName, boolean isMethod) { StringBuilder sb = new StringBuilder(); try { Class<?> clz = Class.forName(className); sb.append(language); String version = isMethod ? (String) clz.getMethod(methodOrFieldName).invoke(null) : (String) clz.getField(methodOrFieldName).get(null); concat(sb, version, "/"); } catch (ClassNotFoundException e) { //Ignore } catch (Exception e) { if (log.isTraceEnabled()){ log.trace("Exception attempting to get " + language + " version.", e); } } return sb.toString(); }
[ "private", "static", "String", "languageVersion", "(", "String", "language", ",", "String", "className", ",", "String", "methodOrFieldName", ",", "boolean", "isMethod", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "try", "{", "Class", "<", "?", ">", "clz", "=", "Class", ".", "forName", "(", "className", ")", ";", "sb", ".", "append", "(", "language", ")", ";", "String", "version", "=", "isMethod", "?", "(", "String", ")", "clz", ".", "getMethod", "(", "methodOrFieldName", ")", ".", "invoke", "(", "null", ")", ":", "(", "String", ")", "clz", ".", "getField", "(", "methodOrFieldName", ")", ".", "get", "(", "null", ")", ";", "concat", "(", "sb", ",", "version", ",", "\"/\"", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "//Ignore", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "log", ".", "isTraceEnabled", "(", ")", ")", "{", "log", ".", "trace", "(", "\"Exception attempting to get \"", "+", "language", "+", "\" version.\"", ",", "e", ")", ";", "}", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Attempt to determine if this language exists on the classpath and what it's version is @param language the name of the language @param className a class of that lanauge that exposes runtime version information @param methodOrFieldName the static field or method name that holds the version number @param isMethod whether the above is a field or method @return the version number or empty string if the language does not exist on the classpath
[ "Attempt", "to", "determine", "if", "this", "language", "exists", "on", "the", "classpath", "and", "what", "it", "s", "version", "is" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/VersionInfoUtils.java#L278-L293
michael-rapp/AndroidMaterialValidation
library/src/main/java/de/mrapp/android/validation/Validators.java
Validators.iPv4Address
public static Validator<CharSequence> iPv4Address(@NonNull final Context context) { """ Creates and returns a validator, which allows to validate texts to ensure, that they represent valid IPv4 addresses. Empty texts are also accepted. @param context The context, which should be used to retrieve the error message, as an instance of the class {@link Context}. The context may not be null @return The validator, which has been created, as an instance of the type {@link Validator} """ return new IPv4AddressValidator(context, R.string.default_error_message); }
java
public static Validator<CharSequence> iPv4Address(@NonNull final Context context) { return new IPv4AddressValidator(context, R.string.default_error_message); }
[ "public", "static", "Validator", "<", "CharSequence", ">", "iPv4Address", "(", "@", "NonNull", "final", "Context", "context", ")", "{", "return", "new", "IPv4AddressValidator", "(", "context", ",", "R", ".", "string", ".", "default_error_message", ")", ";", "}" ]
Creates and returns a validator, which allows to validate texts to ensure, that they represent valid IPv4 addresses. Empty texts are also accepted. @param context The context, which should be used to retrieve the error message, as an instance of the class {@link Context}. The context may not be null @return The validator, which has been created, as an instance of the type {@link Validator}
[ "Creates", "and", "returns", "a", "validator", "which", "allows", "to", "validate", "texts", "to", "ensure", "that", "they", "represent", "valid", "IPv4", "addresses", ".", "Empty", "texts", "are", "also", "accepted", "." ]
train
https://github.com/michael-rapp/AndroidMaterialValidation/blob/ac8693baeac7abddf2e38a47da4c1849d4661a8b/library/src/main/java/de/mrapp/android/validation/Validators.java#L924-L926
Azure/azure-sdk-for-java
iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java
IotHubResourcesInner.exportDevicesAsync
public ServiceFuture<JobResponseInner> exportDevicesAsync(String resourceGroupName, String resourceName, ExportDevicesRequest exportDevicesParameters, final ServiceCallback<JobResponseInner> serviceCallback) { """ Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @param exportDevicesParameters The parameters that specify the export devices operation. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object """ return ServiceFuture.fromResponse(exportDevicesWithServiceResponseAsync(resourceGroupName, resourceName, exportDevicesParameters), serviceCallback); }
java
public ServiceFuture<JobResponseInner> exportDevicesAsync(String resourceGroupName, String resourceName, ExportDevicesRequest exportDevicesParameters, final ServiceCallback<JobResponseInner> serviceCallback) { return ServiceFuture.fromResponse(exportDevicesWithServiceResponseAsync(resourceGroupName, resourceName, exportDevicesParameters), serviceCallback); }
[ "public", "ServiceFuture", "<", "JobResponseInner", ">", "exportDevicesAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "ExportDevicesRequest", "exportDevicesParameters", ",", "final", "ServiceCallback", "<", "JobResponseInner", ">", "serviceCallback", ")", "{", "return", "ServiceFuture", ".", "fromResponse", "(", "exportDevicesWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ",", "exportDevicesParameters", ")", ",", "serviceCallback", ")", ";", "}" ]
Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @param exportDevicesParameters The parameters that specify the export devices operation. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Exports", "all", "the", "device", "identities", "in", "the", "IoT", "hub", "identity", "registry", "to", "an", "Azure", "Storage", "blob", "container", ".", "For", "more", "information", "see", ":", "https", ":", "//", "docs", ".", "microsoft", ".", "com", "/", "azure", "/", "iot", "-", "hub", "/", "iot", "-", "hub", "-", "devguide", "-", "identity", "-", "registry#import", "-", "and", "-", "export", "-", "device", "-", "identities", ".", "Exports", "all", "the", "device", "identities", "in", "the", "IoT", "hub", "identity", "registry", "to", "an", "Azure", "Storage", "blob", "container", ".", "For", "more", "information", "see", ":", "https", ":", "//", "docs", ".", "microsoft", ".", "com", "/", "azure", "/", "iot", "-", "hub", "/", "iot", "-", "hub", "-", "devguide", "-", "identity", "-", "registry#import", "-", "and", "-", "export", "-", "device", "-", "identities", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L3082-L3084
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
ClassReader.enterClass
public ClassSymbol enterClass(Name name, TypeSymbol owner) { """ Create a new toplevel or member class symbol with given name and owner and enter in `classes' unless already there. """ Name flatname = TypeSymbol.formFlatName(name, owner); ClassSymbol c = classes.get(flatname); if (c == null) { c = defineClass(name, owner); classes.put(flatname, c); } else if ((c.name != name || c.owner != owner) && owner.kind == TYP && c.owner.kind == PCK) { // reassign fields of classes that might have been loaded with // their flat names. c.owner.members().remove(c); c.name = name; c.owner = owner; c.fullname = ClassSymbol.formFullName(name, owner); } return c; }
java
public ClassSymbol enterClass(Name name, TypeSymbol owner) { Name flatname = TypeSymbol.formFlatName(name, owner); ClassSymbol c = classes.get(flatname); if (c == null) { c = defineClass(name, owner); classes.put(flatname, c); } else if ((c.name != name || c.owner != owner) && owner.kind == TYP && c.owner.kind == PCK) { // reassign fields of classes that might have been loaded with // their flat names. c.owner.members().remove(c); c.name = name; c.owner = owner; c.fullname = ClassSymbol.formFullName(name, owner); } return c; }
[ "public", "ClassSymbol", "enterClass", "(", "Name", "name", ",", "TypeSymbol", "owner", ")", "{", "Name", "flatname", "=", "TypeSymbol", ".", "formFlatName", "(", "name", ",", "owner", ")", ";", "ClassSymbol", "c", "=", "classes", ".", "get", "(", "flatname", ")", ";", "if", "(", "c", "==", "null", ")", "{", "c", "=", "defineClass", "(", "name", ",", "owner", ")", ";", "classes", ".", "put", "(", "flatname", ",", "c", ")", ";", "}", "else", "if", "(", "(", "c", ".", "name", "!=", "name", "||", "c", ".", "owner", "!=", "owner", ")", "&&", "owner", ".", "kind", "==", "TYP", "&&", "c", ".", "owner", ".", "kind", "==", "PCK", ")", "{", "// reassign fields of classes that might have been loaded with", "// their flat names.", "c", ".", "owner", ".", "members", "(", ")", ".", "remove", "(", "c", ")", ";", "c", ".", "name", "=", "name", ";", "c", ".", "owner", "=", "owner", ";", "c", ".", "fullname", "=", "ClassSymbol", ".", "formFullName", "(", "name", ",", "owner", ")", ";", "}", "return", "c", ";", "}" ]
Create a new toplevel or member class symbol with given name and owner and enter in `classes' unless already there.
[ "Create", "a", "new", "toplevel", "or", "member", "class", "symbol", "with", "given", "name", "and", "owner", "and", "enter", "in", "classes", "unless", "already", "there", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L2381-L2396
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java
VersionsImpl.listWithServiceResponseAsync
public Observable<ServiceResponse<List<VersionInfo>>> listWithServiceResponseAsync(UUID appId, ListVersionsOptionalParameter listOptionalParameter) { """ Gets the application versions info. @param appId The application ID. @param listOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;VersionInfo&gt; object """ if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } final Integer skip = listOptionalParameter != null ? listOptionalParameter.skip() : null; final Integer take = listOptionalParameter != null ? listOptionalParameter.take() : null; return listWithServiceResponseAsync(appId, skip, take); }
java
public Observable<ServiceResponse<List<VersionInfo>>> listWithServiceResponseAsync(UUID appId, ListVersionsOptionalParameter listOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } final Integer skip = listOptionalParameter != null ? listOptionalParameter.skip() : null; final Integer take = listOptionalParameter != null ? listOptionalParameter.take() : null; return listWithServiceResponseAsync(appId, skip, take); }
[ "public", "Observable", "<", "ServiceResponse", "<", "List", "<", "VersionInfo", ">", ">", ">", "listWithServiceResponseAsync", "(", "UUID", "appId", ",", "ListVersionsOptionalParameter", "listOptionalParameter", ")", "{", "if", "(", "this", ".", "client", ".", "endpoint", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter this.client.endpoint() is required and cannot be null.\"", ")", ";", "}", "if", "(", "appId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter appId is required and cannot be null.\"", ")", ";", "}", "final", "Integer", "skip", "=", "listOptionalParameter", "!=", "null", "?", "listOptionalParameter", ".", "skip", "(", ")", ":", "null", ";", "final", "Integer", "take", "=", "listOptionalParameter", "!=", "null", "?", "listOptionalParameter", ".", "take", "(", ")", ":", "null", ";", "return", "listWithServiceResponseAsync", "(", "appId", ",", "skip", ",", "take", ")", ";", "}" ]
Gets the application versions info. @param appId The application ID. @param listOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;VersionInfo&gt; object
[ "Gets", "the", "application", "versions", "info", "." ]
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/VersionsImpl.java#L332-L343
craftercms/core
src/main/java/org/craftercms/core/processors/impl/template/BeanFactoryModelFactory.java
BeanFactoryModelFactory.getModel
@Override public Object getModel(Item item, Node node, String template) { """ Returns always the {@link BeanFactory} of the current Spring application context as the model. """ return beanFactory; }
java
@Override public Object getModel(Item item, Node node, String template) { return beanFactory; }
[ "@", "Override", "public", "Object", "getModel", "(", "Item", "item", ",", "Node", "node", ",", "String", "template", ")", "{", "return", "beanFactory", ";", "}" ]
Returns always the {@link BeanFactory} of the current Spring application context as the model.
[ "Returns", "always", "the", "{" ]
train
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/processors/impl/template/BeanFactoryModelFactory.java#L50-L53
schallee/alib4j
core/src/main/java/net/darkmist/alib/io/OutputStreamBitsOutput.java
OutputStreamBitsOutput.uncheckedWriteBits
protected void uncheckedWriteBits(int numAddBits, int addBits) throws IOException { """ Writes bits to the output without checking arguments. Any currently incomplete byte is first completed and written. Bits left after last full byte is writeen are buffered until the next write. @param numAddBits The number of bits to write @param addBits The integer containing the bits to write. @throws IOException if the underlying {@link OutputStream#write(int)} does. """ int chunks; if(numAddBits < numBitsLeft) // not equal { // all added bits fit in currentBits // clean other bits addBits &= (0xFF >>> (8-numAddBits)); // move addBits to position addBits <<= numBitsLeft - numAddBits; // add addBits to currentBits currentBits |= addBits; // fixup numBitsLeft numBitsLeft -= numAddBits; return; } // all bits left, also cleans any high bits addBits <<= Integer.SIZE - numAddBits; // shift numBitsLeft bits to right, add to current bits currentBits |= addBits >>> (Integer.SIZE - numBitsLeft); // remove used bits from addBits numAddBits -= numBitsLeft; addBits <<= numBitsLeft; // write the now full current byte writeCurrent(); // how many byte sized chunks? numAddBits/8 chunks = numAddBits >> 3; // write out each byte directly for(int i=0;i<chunks;i++) { // next byte to lsb int tmpBits = addBits >>> (Integer.SIZE - Byte.SIZE); // write out byte wrappedWrite(tmpBits); // clear out byte addBits <<= Byte.SIZE; } // figure out what we have left. numAddBits%8 if((numAddBits &= 0x7)==0) return; // nothing left. // set current bits to what is left currentBits = addBits >>> (Integer.SIZE - Byte.SIZE); // set to however many bits are left. %8 numBitsLeft = Byte.SIZE - numAddBits; }
java
protected void uncheckedWriteBits(int numAddBits, int addBits) throws IOException { int chunks; if(numAddBits < numBitsLeft) // not equal { // all added bits fit in currentBits // clean other bits addBits &= (0xFF >>> (8-numAddBits)); // move addBits to position addBits <<= numBitsLeft - numAddBits; // add addBits to currentBits currentBits |= addBits; // fixup numBitsLeft numBitsLeft -= numAddBits; return; } // all bits left, also cleans any high bits addBits <<= Integer.SIZE - numAddBits; // shift numBitsLeft bits to right, add to current bits currentBits |= addBits >>> (Integer.SIZE - numBitsLeft); // remove used bits from addBits numAddBits -= numBitsLeft; addBits <<= numBitsLeft; // write the now full current byte writeCurrent(); // how many byte sized chunks? numAddBits/8 chunks = numAddBits >> 3; // write out each byte directly for(int i=0;i<chunks;i++) { // next byte to lsb int tmpBits = addBits >>> (Integer.SIZE - Byte.SIZE); // write out byte wrappedWrite(tmpBits); // clear out byte addBits <<= Byte.SIZE; } // figure out what we have left. numAddBits%8 if((numAddBits &= 0x7)==0) return; // nothing left. // set current bits to what is left currentBits = addBits >>> (Integer.SIZE - Byte.SIZE); // set to however many bits are left. %8 numBitsLeft = Byte.SIZE - numAddBits; }
[ "protected", "void", "uncheckedWriteBits", "(", "int", "numAddBits", ",", "int", "addBits", ")", "throws", "IOException", "{", "int", "chunks", ";", "if", "(", "numAddBits", "<", "numBitsLeft", ")", "// not equal", "{", "// all added bits fit in currentBits", "// clean other bits", "addBits", "&=", "(", "0xFF", ">>>", "(", "8", "-", "numAddBits", ")", ")", ";", "// move addBits to position", "addBits", "<<=", "numBitsLeft", "-", "numAddBits", ";", "// add addBits to currentBits", "currentBits", "|=", "addBits", ";", "// fixup numBitsLeft", "numBitsLeft", "-=", "numAddBits", ";", "return", ";", "}", "// all bits left, also cleans any high bits", "addBits", "<<=", "Integer", ".", "SIZE", "-", "numAddBits", ";", "// shift numBitsLeft bits to right, add to current bits", "currentBits", "|=", "addBits", ">>>", "(", "Integer", ".", "SIZE", "-", "numBitsLeft", ")", ";", "// remove used bits from addBits", "numAddBits", "-=", "numBitsLeft", ";", "addBits", "<<=", "numBitsLeft", ";", "// write the now full current byte", "writeCurrent", "(", ")", ";", "// how many byte sized chunks? numAddBits/8", "chunks", "=", "numAddBits", ">>", "3", ";", "// write out each byte directly", "for", "(", "int", "i", "=", "0", ";", "i", "<", "chunks", ";", "i", "++", ")", "{", "// next byte to lsb", "int", "tmpBits", "=", "addBits", ">>>", "(", "Integer", ".", "SIZE", "-", "Byte", ".", "SIZE", ")", ";", "// write out byte", "wrappedWrite", "(", "tmpBits", ")", ";", "// clear out byte", "addBits", "<<=", "Byte", ".", "SIZE", ";", "}", "// figure out what we have left. numAddBits%8", "if", "(", "(", "numAddBits", "&=", "0x7", ")", "==", "0", ")", "return", ";", "// nothing left.", "// set current bits to what is left", "currentBits", "=", "addBits", ">>>", "(", "Integer", ".", "SIZE", "-", "Byte", ".", "SIZE", ")", ";", "// set to however many bits are left. %8", "numBitsLeft", "=", "Byte", ".", "SIZE", "-", "numAddBits", ";", "}" ]
Writes bits to the output without checking arguments. Any currently incomplete byte is first completed and written. Bits left after last full byte is writeen are buffered until the next write. @param numAddBits The number of bits to write @param addBits The integer containing the bits to write. @throws IOException if the underlying {@link OutputStream#write(int)} does.
[ "Writes", "bits", "to", "the", "output", "without", "checking", "arguments", ".", "Any", "currently", "incomplete", "byte", "is", "first", "completed", "and", "written", ".", "Bits", "left", "after", "last", "full", "byte", "is", "writeen", "are", "buffered", "until", "the", "next", "write", "." ]
train
https://github.com/schallee/alib4j/blob/0e0718aee574bbb62268e1cf58e99286529ce529/core/src/main/java/net/darkmist/alib/io/OutputStreamBitsOutput.java#L119-L178
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMenu.java
WMenu.getSelectableItems
private List<MenuItemSelectable> getSelectableItems(final MenuSelectContainer selectContainer) { """ Retrieves the selectable items for the given container. @param selectContainer the component to search within. @return the list of selectable items for the given component. May be empty. """ List<MenuItemSelectable> result = new ArrayList<>(selectContainer.getMenuItems().size()); SelectionMode selectionMode = selectContainer.getSelectionMode(); for (MenuItem item : selectContainer.getMenuItems()) { if (item instanceof MenuItemGroup) { for (MenuItem groupItem : ((MenuItemGroup) item).getMenuItems()) { if (isSelectable(groupItem, selectionMode)) { result.add((MenuItemSelectable) groupItem); } } } else if (isSelectable(item, selectionMode)) { result.add((MenuItemSelectable) item); } } return result; }
java
private List<MenuItemSelectable> getSelectableItems(final MenuSelectContainer selectContainer) { List<MenuItemSelectable> result = new ArrayList<>(selectContainer.getMenuItems().size()); SelectionMode selectionMode = selectContainer.getSelectionMode(); for (MenuItem item : selectContainer.getMenuItems()) { if (item instanceof MenuItemGroup) { for (MenuItem groupItem : ((MenuItemGroup) item).getMenuItems()) { if (isSelectable(groupItem, selectionMode)) { result.add((MenuItemSelectable) groupItem); } } } else if (isSelectable(item, selectionMode)) { result.add((MenuItemSelectable) item); } } return result; }
[ "private", "List", "<", "MenuItemSelectable", ">", "getSelectableItems", "(", "final", "MenuSelectContainer", "selectContainer", ")", "{", "List", "<", "MenuItemSelectable", ">", "result", "=", "new", "ArrayList", "<>", "(", "selectContainer", ".", "getMenuItems", "(", ")", ".", "size", "(", ")", ")", ";", "SelectionMode", "selectionMode", "=", "selectContainer", ".", "getSelectionMode", "(", ")", ";", "for", "(", "MenuItem", "item", ":", "selectContainer", ".", "getMenuItems", "(", ")", ")", "{", "if", "(", "item", "instanceof", "MenuItemGroup", ")", "{", "for", "(", "MenuItem", "groupItem", ":", "(", "(", "MenuItemGroup", ")", "item", ")", ".", "getMenuItems", "(", ")", ")", "{", "if", "(", "isSelectable", "(", "groupItem", ",", "selectionMode", ")", ")", "{", "result", ".", "add", "(", "(", "MenuItemSelectable", ")", "groupItem", ")", ";", "}", "}", "}", "else", "if", "(", "isSelectable", "(", "item", ",", "selectionMode", ")", ")", "{", "result", ".", "add", "(", "(", "MenuItemSelectable", ")", "item", ")", ";", "}", "}", "return", "result", ";", "}" ]
Retrieves the selectable items for the given container. @param selectContainer the component to search within. @return the list of selectable items for the given component. May be empty.
[ "Retrieves", "the", "selectable", "items", "for", "the", "given", "container", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMenu.java#L541-L559
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/config/refresher/CarrierRefresher.java
CarrierRefresher.refreshAgainstNode
private Observable<ProposedBucketConfigContext> refreshAgainstNode(final String bucketName, final NetworkAddress hostname) { """ Helper method to fetch a config from a specific node of the cluster. @param bucketName the name of the bucket. @param hostname the hostname of the node to fetch from. @return a raw configuration or an error. """ return Buffers.wrapColdWithAutoRelease(Observable.defer(new Func0<Observable<GetBucketConfigResponse>>() { @Override public Observable<GetBucketConfigResponse> call() { return cluster().send(new GetBucketConfigRequest(bucketName, hostname)); } })) .doOnNext(new Action1<GetBucketConfigResponse>() { @Override public void call(GetBucketConfigResponse response) { if (!response.status().isSuccess()) { if (response.content() != null && response.content().refCnt() > 0) { response.content().release(); } throw new ConfigurationException("Could not fetch config from node: " + response); } } }) .map(new Func1<GetBucketConfigResponse, ProposedBucketConfigContext>() { @Override public ProposedBucketConfigContext call(GetBucketConfigResponse response) { String raw = response.content().toString(CharsetUtil.UTF_8).trim(); if (response.content().refCnt() > 0) { response.content().release(); } raw = raw.replace("$HOST", response.hostname().address()); return new ProposedBucketConfigContext(bucketName, raw, hostname); } }) .doOnError(new Action1<Throwable>() { @Override public void call(Throwable ex) { LOGGER.debug("Could not fetch config from bucket \"" + bucketName + "\" against \"" + hostname + "\".", ex); } }); }
java
private Observable<ProposedBucketConfigContext> refreshAgainstNode(final String bucketName, final NetworkAddress hostname) { return Buffers.wrapColdWithAutoRelease(Observable.defer(new Func0<Observable<GetBucketConfigResponse>>() { @Override public Observable<GetBucketConfigResponse> call() { return cluster().send(new GetBucketConfigRequest(bucketName, hostname)); } })) .doOnNext(new Action1<GetBucketConfigResponse>() { @Override public void call(GetBucketConfigResponse response) { if (!response.status().isSuccess()) { if (response.content() != null && response.content().refCnt() > 0) { response.content().release(); } throw new ConfigurationException("Could not fetch config from node: " + response); } } }) .map(new Func1<GetBucketConfigResponse, ProposedBucketConfigContext>() { @Override public ProposedBucketConfigContext call(GetBucketConfigResponse response) { String raw = response.content().toString(CharsetUtil.UTF_8).trim(); if (response.content().refCnt() > 0) { response.content().release(); } raw = raw.replace("$HOST", response.hostname().address()); return new ProposedBucketConfigContext(bucketName, raw, hostname); } }) .doOnError(new Action1<Throwable>() { @Override public void call(Throwable ex) { LOGGER.debug("Could not fetch config from bucket \"" + bucketName + "\" against \"" + hostname + "\".", ex); } }); }
[ "private", "Observable", "<", "ProposedBucketConfigContext", ">", "refreshAgainstNode", "(", "final", "String", "bucketName", ",", "final", "NetworkAddress", "hostname", ")", "{", "return", "Buffers", ".", "wrapColdWithAutoRelease", "(", "Observable", ".", "defer", "(", "new", "Func0", "<", "Observable", "<", "GetBucketConfigResponse", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "GetBucketConfigResponse", ">", "call", "(", ")", "{", "return", "cluster", "(", ")", ".", "send", "(", "new", "GetBucketConfigRequest", "(", "bucketName", ",", "hostname", ")", ")", ";", "}", "}", ")", ")", ".", "doOnNext", "(", "new", "Action1", "<", "GetBucketConfigResponse", ">", "(", ")", "{", "@", "Override", "public", "void", "call", "(", "GetBucketConfigResponse", "response", ")", "{", "if", "(", "!", "response", ".", "status", "(", ")", ".", "isSuccess", "(", ")", ")", "{", "if", "(", "response", ".", "content", "(", ")", "!=", "null", "&&", "response", ".", "content", "(", ")", ".", "refCnt", "(", ")", ">", "0", ")", "{", "response", ".", "content", "(", ")", ".", "release", "(", ")", ";", "}", "throw", "new", "ConfigurationException", "(", "\"Could not fetch config from node: \"", "+", "response", ")", ";", "}", "}", "}", ")", ".", "map", "(", "new", "Func1", "<", "GetBucketConfigResponse", ",", "ProposedBucketConfigContext", ">", "(", ")", "{", "@", "Override", "public", "ProposedBucketConfigContext", "call", "(", "GetBucketConfigResponse", "response", ")", "{", "String", "raw", "=", "response", ".", "content", "(", ")", ".", "toString", "(", "CharsetUtil", ".", "UTF_8", ")", ".", "trim", "(", ")", ";", "if", "(", "response", ".", "content", "(", ")", ".", "refCnt", "(", ")", ">", "0", ")", "{", "response", ".", "content", "(", ")", ".", "release", "(", ")", ";", "}", "raw", "=", "raw", ".", "replace", "(", "\"$HOST\"", ",", "response", ".", "hostname", "(", ")", ".", "address", "(", ")", ")", ";", "return", "new", "ProposedBucketConfigContext", "(", "bucketName", ",", "raw", ",", "hostname", ")", ";", "}", "}", ")", ".", "doOnError", "(", "new", "Action1", "<", "Throwable", ">", "(", ")", "{", "@", "Override", "public", "void", "call", "(", "Throwable", "ex", ")", "{", "LOGGER", ".", "debug", "(", "\"Could not fetch config from bucket \\\"\"", "+", "bucketName", "+", "\"\\\" against \\\"\"", "+", "hostname", "+", "\"\\\".\"", ",", "ex", ")", ";", "}", "}", ")", ";", "}" ]
Helper method to fetch a config from a specific node of the cluster. @param bucketName the name of the bucket. @param hostname the hostname of the node to fetch from. @return a raw configuration or an error.
[ "Helper", "method", "to", "fetch", "a", "config", "from", "a", "specific", "node", "of", "the", "cluster", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/config/refresher/CarrierRefresher.java#L333-L370
grpc/grpc-java
stub/src/main/java/io/grpc/stub/ClientCalls.java
ClientCalls.blockingUnaryCall
public static <ReqT, RespT> RespT blockingUnaryCall(ClientCall<ReqT, RespT> call, ReqT req) { """ Executes a unary call and blocks on the response. The {@code call} should not be already started. After calling this method, {@code call} should no longer be used. @return the single response message. """ try { return getUnchecked(futureUnaryCall(call, req)); } catch (RuntimeException e) { throw cancelThrow(call, e); } catch (Error e) { throw cancelThrow(call, e); } }
java
public static <ReqT, RespT> RespT blockingUnaryCall(ClientCall<ReqT, RespT> call, ReqT req) { try { return getUnchecked(futureUnaryCall(call, req)); } catch (RuntimeException e) { throw cancelThrow(call, e); } catch (Error e) { throw cancelThrow(call, e); } }
[ "public", "static", "<", "ReqT", ",", "RespT", ">", "RespT", "blockingUnaryCall", "(", "ClientCall", "<", "ReqT", ",", "RespT", ">", "call", ",", "ReqT", "req", ")", "{", "try", "{", "return", "getUnchecked", "(", "futureUnaryCall", "(", "call", ",", "req", ")", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "throw", "cancelThrow", "(", "call", ",", "e", ")", ";", "}", "catch", "(", "Error", "e", ")", "{", "throw", "cancelThrow", "(", "call", ",", "e", ")", ";", "}", "}" ]
Executes a unary call and blocks on the response. The {@code call} should not be already started. After calling this method, {@code call} should no longer be used. @return the single response message.
[ "Executes", "a", "unary", "call", "and", "blocks", "on", "the", "response", ".", "The", "{", "@code", "call", "}", "should", "not", "be", "already", "started", ".", "After", "calling", "this", "method", "{", "@code", "call", "}", "should", "no", "longer", "be", "used", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/stub/src/main/java/io/grpc/stub/ClientCalls.java#L107-L115
HsiangLeekwok/hlklib
hlklib/src/main/java/com/hlk/hlklib/etc/Cryptography.java
Cryptography.stringMessageDigest
private static String stringMessageDigest(String source, String algorithm) { """ Get the sha1 value of a string @param source string @return the sha value """ return getMessageDigest(source.getBytes(), algorithm); }
java
private static String stringMessageDigest(String source, String algorithm) { return getMessageDigest(source.getBytes(), algorithm); }
[ "private", "static", "String", "stringMessageDigest", "(", "String", "source", ",", "String", "algorithm", ")", "{", "return", "getMessageDigest", "(", "source", ".", "getBytes", "(", ")", ",", "algorithm", ")", ";", "}" ]
Get the sha1 value of a string @param source string @return the sha value
[ "Get", "the", "sha1", "value", "of", "a", "string" ]
train
https://github.com/HsiangLeekwok/hlklib/blob/b122f6dcab7cec60c8e5455e0c31613d08bec6ad/hlklib/src/main/java/com/hlk/hlklib/etc/Cryptography.java#L142-L144