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
telly/groundy
library/src/main/java/com/telly/groundy/Groundy.java
Groundy.arg
public Groundy arg(String key, Bundle value) { """ Inserts a Bundle value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value a Bundle object, or null @return itself """ mArgs.putBundle(key, value); return this; }
java
public Groundy arg(String key, Bundle value) { mArgs.putBundle(key, value); return this; }
[ "public", "Groundy", "arg", "(", "String", "key", ",", "Bundle", "value", ")", "{", "mArgs", ".", "putBundle", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts a Bundle value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value a Bundle object, or null @return itself
[ "Inserts", "a", "Bundle", "value", "into", "the", "mapping", "of", "this", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", ".", "Either", "key", "or", "value", "may", "be", "null", "." ]
train
https://github.com/telly/groundy/blob/e90baf9901a8be20b348bd1575d5ad782560cec8/library/src/main/java/com/telly/groundy/Groundy.java#L730-L733
s1-platform/s1
s1-mongodb/src/java/org/s1/mongodb/MongoDBQueryHelper.java
MongoDBQueryHelper.get
public static Map<String, Object> get(CollectionId c, Map<String,Object> search) throws NotFoundException, MoreThanOneFoundException { """ Select exactly one record from collection @param c @param search @throws NotFoundException @throws MoreThanOneFoundException @return """ ensureOnlyOne(c, search); DBCollection coll = MongoDBConnectionHelper.getConnection(c.getDatabase()).getCollection(c.getCollection()); Map<String,Object> m = MongoDBFormat.toMap(coll.findOne(MongoDBFormat.fromMap(search))); if(LOG.isDebugEnabled()) LOG.debug("MongoDB get result ("+c+", search:"+search+"\n\t> "+m); return m; }
java
public static Map<String, Object> get(CollectionId c, Map<String,Object> search) throws NotFoundException, MoreThanOneFoundException { ensureOnlyOne(c, search); DBCollection coll = MongoDBConnectionHelper.getConnection(c.getDatabase()).getCollection(c.getCollection()); Map<String,Object> m = MongoDBFormat.toMap(coll.findOne(MongoDBFormat.fromMap(search))); if(LOG.isDebugEnabled()) LOG.debug("MongoDB get result ("+c+", search:"+search+"\n\t> "+m); return m; }
[ "public", "static", "Map", "<", "String", ",", "Object", ">", "get", "(", "CollectionId", "c", ",", "Map", "<", "String", ",", "Object", ">", "search", ")", "throws", "NotFoundException", ",", "MoreThanOneFoundException", "{", "ensureOnlyOne", "(", "c", ",",...
Select exactly one record from collection @param c @param search @throws NotFoundException @throws MoreThanOneFoundException @return
[ "Select", "exactly", "one", "record", "from", "collection" ]
train
https://github.com/s1-platform/s1/blob/370101c13fef01af524bc171bcc1a97e5acc76e8/s1-mongodb/src/java/org/s1/mongodb/MongoDBQueryHelper.java#L65-L74
mbrade/prefixedproperties
pp-spring/src/main/java/net/sf/prefixedproperties/spring/PrefixedPropertiesPersister.java
PrefixedPropertiesPersister.loadFromYAML
public void loadFromYAML(final Properties props, final InputStream is) throws IOException { """ Loads from json. @param props the props @param is the is @throws IOException Signals that an I/O exception has occurred. """ try { ((PrefixedProperties) props).loadFromYAML(is); } catch (final NoSuchMethodError err) { throw new IOException( "Cannot load properties JSON file - not using PrefixedProperties: " + err.getMessage()); } }
java
public void loadFromYAML(final Properties props, final InputStream is) throws IOException { try { ((PrefixedProperties) props).loadFromYAML(is); } catch (final NoSuchMethodError err) { throw new IOException( "Cannot load properties JSON file - not using PrefixedProperties: " + err.getMessage()); } }
[ "public", "void", "loadFromYAML", "(", "final", "Properties", "props", ",", "final", "InputStream", "is", ")", "throws", "IOException", "{", "try", "{", "(", "(", "PrefixedProperties", ")", "props", ")", ".", "loadFromYAML", "(", "is", ")", ";", "}", "catc...
Loads from json. @param props the props @param is the is @throws IOException Signals that an I/O exception has occurred.
[ "Loads", "from", "json", "." ]
train
https://github.com/mbrade/prefixedproperties/blob/ac430409ea37e244158002b3cf1504417835a0b2/pp-spring/src/main/java/net/sf/prefixedproperties/spring/PrefixedPropertiesPersister.java#L90-L97
audit4j/audit4j-core
src/main/java/org/audit4j/core/extra/scannotation/ClasspathUrlFinder.java
ClasspathUrlFinder.findClassBase
public static URL findClassBase(Class clazz) { """ Find the classpath for the particular class @param clazz @return """ String resource = clazz.getName().replace('.', '/') + ".class"; return findResourceBase(resource, clazz.getClassLoader()); }
java
public static URL findClassBase(Class clazz) { String resource = clazz.getName().replace('.', '/') + ".class"; return findResourceBase(resource, clazz.getClassLoader()); }
[ "public", "static", "URL", "findClassBase", "(", "Class", "clazz", ")", "{", "String", "resource", "=", "clazz", ".", "getName", "(", ")", ".", "replace", "(", "'", "'", ",", "'", "'", ")", "+", "\".class\"", ";", "return", "findResourceBase", "(", "re...
Find the classpath for the particular class @param clazz @return
[ "Find", "the", "classpath", "for", "the", "particular", "class" ]
train
https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/extra/scannotation/ClasspathUrlFinder.java#L115-L119
mapsforge/mapsforge
sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteQuery.java
SQLiteQuery.fillWindow
int fillWindow(CursorWindow window, int startPos, int requiredPos, boolean countAllRows) { """ Reads rows into a buffer. @param window The window to fill into @param startPos The start position for filling the window. @param requiredPos The position of a row that MUST be in the window. If it won't fit, then the query should discard part of what it filled. @param countAllRows True to count all rows that the query would return regardless of whether they fit in the window. @return Number of rows that were enumerated. Might not be all rows unless countAllRows is true. @throws SQLiteException if an error occurs. @throws OperationCanceledException if the operation was canceled. """ acquireReference(); try { window.acquireReference(); try { int numRows = getSession().executeForCursorWindow(getSql(), getBindArgs(), window, startPos, requiredPos, countAllRows, getConnectionFlags(), mCancellationSignal); return numRows; } catch (SQLiteDatabaseCorruptException ex) { onCorruption(); throw ex; } catch (SQLiteException ex) { Log.e(TAG, "exception: " + ex.getMessage() + "; query: " + getSql()); throw ex; } finally { window.releaseReference(); } } finally { releaseReference(); } }
java
int fillWindow(CursorWindow window, int startPos, int requiredPos, boolean countAllRows) { acquireReference(); try { window.acquireReference(); try { int numRows = getSession().executeForCursorWindow(getSql(), getBindArgs(), window, startPos, requiredPos, countAllRows, getConnectionFlags(), mCancellationSignal); return numRows; } catch (SQLiteDatabaseCorruptException ex) { onCorruption(); throw ex; } catch (SQLiteException ex) { Log.e(TAG, "exception: " + ex.getMessage() + "; query: " + getSql()); throw ex; } finally { window.releaseReference(); } } finally { releaseReference(); } }
[ "int", "fillWindow", "(", "CursorWindow", "window", ",", "int", "startPos", ",", "int", "requiredPos", ",", "boolean", "countAllRows", ")", "{", "acquireReference", "(", ")", ";", "try", "{", "window", ".", "acquireReference", "(", ")", ";", "try", "{", "i...
Reads rows into a buffer. @param window The window to fill into @param startPos The start position for filling the window. @param requiredPos The position of a row that MUST be in the window. If it won't fit, then the query should discard part of what it filled. @param countAllRows True to count all rows that the query would return regardless of whether they fit in the window. @return Number of rows that were enumerated. Might not be all rows unless countAllRows is true. @throws SQLiteException if an error occurs. @throws OperationCanceledException if the operation was canceled.
[ "Reads", "rows", "into", "a", "buffer", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteQuery.java#L61-L82
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
MPPUtility.getDouble
public static final double getDouble(byte[] data, int offset) { """ This method reads an eight byte double from the input array. @param data the input array @param offset offset of double data in the array @return double value """ double result = Double.longBitsToDouble(getLong(data, offset)); if (Double.isNaN(result)) { result = 0; } return result; }
java
public static final double getDouble(byte[] data, int offset) { double result = Double.longBitsToDouble(getLong(data, offset)); if (Double.isNaN(result)) { result = 0; } return result; }
[ "public", "static", "final", "double", "getDouble", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "double", "result", "=", "Double", ".", "longBitsToDouble", "(", "getLong", "(", "data", ",", "offset", ")", ")", ";", "if", "(", "Double...
This method reads an eight byte double from the input array. @param data the input array @param offset offset of double data in the array @return double value
[ "This", "method", "reads", "an", "eight", "byte", "double", "from", "the", "input", "array", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L256-L264
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java
ZKPaths.deleteChildren
public static void deleteChildren(ZooKeeper zookeeper, String path, boolean deleteSelf) throws InterruptedException, KeeperException { """ Recursively deletes children of a node. @param zookeeper the client @param path path of the node to delete @param deleteSelf flag that indicates that the node should also get deleted @throws InterruptedException @throws KeeperException """ PathUtils.validatePath(path); List<String> children = zookeeper.getChildren(path, null); for ( String child : children ) { String fullPath = makePath(path, child); deleteChildren(zookeeper, fullPath, true); } if ( deleteSelf ) { try { zookeeper.delete(path, -1); } catch ( KeeperException.NotEmptyException e ) { //someone has created a new child since we checked ... delete again. deleteChildren(zookeeper, path, true); } catch ( KeeperException.NoNodeException e ) { // ignore... someone else has deleted the node it since we checked } } }
java
public static void deleteChildren(ZooKeeper zookeeper, String path, boolean deleteSelf) throws InterruptedException, KeeperException { PathUtils.validatePath(path); List<String> children = zookeeper.getChildren(path, null); for ( String child : children ) { String fullPath = makePath(path, child); deleteChildren(zookeeper, fullPath, true); } if ( deleteSelf ) { try { zookeeper.delete(path, -1); } catch ( KeeperException.NotEmptyException e ) { //someone has created a new child since we checked ... delete again. deleteChildren(zookeeper, path, true); } catch ( KeeperException.NoNodeException e ) { // ignore... someone else has deleted the node it since we checked } } }
[ "public", "static", "void", "deleteChildren", "(", "ZooKeeper", "zookeeper", ",", "String", "path", ",", "boolean", "deleteSelf", ")", "throws", "InterruptedException", ",", "KeeperException", "{", "PathUtils", ".", "validatePath", "(", "path", ")", ";", "List", ...
Recursively deletes children of a node. @param zookeeper the client @param path path of the node to delete @param deleteSelf flag that indicates that the node should also get deleted @throws InterruptedException @throws KeeperException
[ "Recursively", "deletes", "children", "of", "a", "node", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java#L312-L339
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java
QueryExecutorImpl.readFromCopy
synchronized void readFromCopy(CopyOperationImpl op, boolean block) throws SQLException { """ Wait for a row of data to be received from server on an active copy operation Connection gets unlocked by processCopyResults() at end of operation. @param op the copy operation presumably currently holding lock on this connection @param block whether to block waiting for input @throws SQLException on any failure """ if (!hasLock(op)) { throw new PSQLException(GT.tr("Tried to read from inactive copy"), PSQLState.OBJECT_NOT_IN_STATE); } try { processCopyResults(op, block); // expect a call to handleCopydata() to store the data } catch (IOException ioe) { throw new PSQLException(GT.tr("Database connection failed when reading from copy"), PSQLState.CONNECTION_FAILURE, ioe); } }
java
synchronized void readFromCopy(CopyOperationImpl op, boolean block) throws SQLException { if (!hasLock(op)) { throw new PSQLException(GT.tr("Tried to read from inactive copy"), PSQLState.OBJECT_NOT_IN_STATE); } try { processCopyResults(op, block); // expect a call to handleCopydata() to store the data } catch (IOException ioe) { throw new PSQLException(GT.tr("Database connection failed when reading from copy"), PSQLState.CONNECTION_FAILURE, ioe); } }
[ "synchronized", "void", "readFromCopy", "(", "CopyOperationImpl", "op", ",", "boolean", "block", ")", "throws", "SQLException", "{", "if", "(", "!", "hasLock", "(", "op", ")", ")", "{", "throw", "new", "PSQLException", "(", "GT", ".", "tr", "(", "\"Tried t...
Wait for a row of data to be received from server on an active copy operation Connection gets unlocked by processCopyResults() at end of operation. @param op the copy operation presumably currently holding lock on this connection @param block whether to block waiting for input @throws SQLException on any failure
[ "Wait", "for", "a", "row", "of", "data", "to", "be", "received", "from", "server", "on", "an", "active", "copy", "operation", "Connection", "gets", "unlocked", "by", "processCopyResults", "()", "at", "end", "of", "operation", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java#L1056-L1068
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/groups/discuss/GroupDiscussInterface.java
GroupDiscussInterface.getReplyList
public ReplyObject getReplyList(String topicId, int perPage, int page) throws FlickrException { """ Get list of replies @param topicId Unique identifier of a topic for a given group {@link Topic}. @return A reply object @throws FlickrException @see <a href="http://www.flickr.com/services/api/flickr.groups.discuss.replies.getList.html">API Documentation</a> """ ReplyList<Reply> reply = new ReplyList<Reply>(); TopicList<Topic> topic = new TopicList<Topic>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_REPLIES_GET_LIST); parameters.put("topic_id", topicId); if (perPage > 0) { parameters.put("per_page", "" + perPage); } if (page > 0) { parameters.put("page", "" + page); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element replyElements = response.getPayload(); ReplyObject ro = new ReplyObject(); NodeList replyNodes = replyElements.getElementsByTagName("reply"); for (int i = 0; i < replyNodes.getLength(); i++) { Element replyNodeElement = (Element) replyNodes.item(i); // Element replyElement = XMLUtilities.getChild(replyNodeElement, "reply"); reply.add(parseReply(replyNodeElement)); ro.setReplyList(reply); } NodeList topicNodes = replyElements.getElementsByTagName("topic"); for (int i = 0; i < topicNodes.getLength(); i++) { Element replyNodeElement = (Element) replyNodes.item(i); // Element topicElement = XMLUtilities.getChild(replyNodeElement, "topic"); topic.add(parseTopic(replyNodeElement)); ro.setTopicList(topic); } return ro; }
java
public ReplyObject getReplyList(String topicId, int perPage, int page) throws FlickrException { ReplyList<Reply> reply = new ReplyList<Reply>(); TopicList<Topic> topic = new TopicList<Topic>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_REPLIES_GET_LIST); parameters.put("topic_id", topicId); if (perPage > 0) { parameters.put("per_page", "" + perPage); } if (page > 0) { parameters.put("page", "" + page); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element replyElements = response.getPayload(); ReplyObject ro = new ReplyObject(); NodeList replyNodes = replyElements.getElementsByTagName("reply"); for (int i = 0; i < replyNodes.getLength(); i++) { Element replyNodeElement = (Element) replyNodes.item(i); // Element replyElement = XMLUtilities.getChild(replyNodeElement, "reply"); reply.add(parseReply(replyNodeElement)); ro.setReplyList(reply); } NodeList topicNodes = replyElements.getElementsByTagName("topic"); for (int i = 0; i < topicNodes.getLength(); i++) { Element replyNodeElement = (Element) replyNodes.item(i); // Element topicElement = XMLUtilities.getChild(replyNodeElement, "topic"); topic.add(parseTopic(replyNodeElement)); ro.setTopicList(topic); } return ro; }
[ "public", "ReplyObject", "getReplyList", "(", "String", "topicId", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "ReplyList", "<", "Reply", ">", "reply", "=", "new", "ReplyList", "<", "Reply", ">", "(", ")", ";", "TopicL...
Get list of replies @param topicId Unique identifier of a topic for a given group {@link Topic}. @return A reply object @throws FlickrException @see <a href="http://www.flickr.com/services/api/flickr.groups.discuss.replies.getList.html">API Documentation</a>
[ "Get", "list", "of", "replies" ]
train
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/groups/discuss/GroupDiscussInterface.java#L128-L167
LevelFourAB/commons
commons-io/src/main/java/se/l4/commons/io/BytesBuilder.java
BytesBuilder.createViaDataOutput
static Bytes createViaDataOutput(@NonNull IOConsumer<ExtendedDataOutput> creator, int expectedSize) throws IOException { """ Create an instance of {@link Bytes} that is created and stored in memory. @param creator the creator of byte data @param expectedSize the expected size of the created byte data, used to allocate memory for the data @return instance of bytes """ Objects.requireNonNull(creator); if(expectedSize <= 0) throw new IllegalArgumentException("expectedSize should be larger than 0"); ByteArrayOutputStream out = new ByteArrayOutputStream(expectedSize); try(ExtendedDataOutput dataOut = new ExtendedDataOutputStream(out)) { creator.accept(dataOut); } return Bytes.create(out.toByteArray()); }
java
static Bytes createViaDataOutput(@NonNull IOConsumer<ExtendedDataOutput> creator, int expectedSize) throws IOException { Objects.requireNonNull(creator); if(expectedSize <= 0) throw new IllegalArgumentException("expectedSize should be larger than 0"); ByteArrayOutputStream out = new ByteArrayOutputStream(expectedSize); try(ExtendedDataOutput dataOut = new ExtendedDataOutputStream(out)) { creator.accept(dataOut); } return Bytes.create(out.toByteArray()); }
[ "static", "Bytes", "createViaDataOutput", "(", "@", "NonNull", "IOConsumer", "<", "ExtendedDataOutput", ">", "creator", ",", "int", "expectedSize", ")", "throws", "IOException", "{", "Objects", ".", "requireNonNull", "(", "creator", ")", ";", "if", "(", "expecte...
Create an instance of {@link Bytes} that is created and stored in memory. @param creator the creator of byte data @param expectedSize the expected size of the created byte data, used to allocate memory for the data @return instance of bytes
[ "Create", "an", "instance", "of", "{", "@link", "Bytes", "}", "that", "is", "created", "and", "stored", "in", "memory", "." ]
train
https://github.com/LevelFourAB/commons/blob/aa121b3a5504b43d0c10450a1b984694fcd2b8ee/commons-io/src/main/java/se/l4/commons/io/BytesBuilder.java#L123-L135
yanzhenjie/AndServer
api/src/main/java/com/yanzhenjie/andserver/framework/view/ViewResolver.java
ViewResolver.resolve
public void resolve(@Nullable View view, @NonNull HttpRequest request, @NonNull HttpResponse response) { """ Solve the view and convert the view to http package content. @param view current view. @param request current request. @param response current response. """ if (view == null) return; Object output = view.output(); if (output == null) return; if (view.rest()) { resolveRest(output, request, response); } else { resolvePath(output, request, response); } }
java
public void resolve(@Nullable View view, @NonNull HttpRequest request, @NonNull HttpResponse response) { if (view == null) return; Object output = view.output(); if (output == null) return; if (view.rest()) { resolveRest(output, request, response); } else { resolvePath(output, request, response); } }
[ "public", "void", "resolve", "(", "@", "Nullable", "View", "view", ",", "@", "NonNull", "HttpRequest", "request", ",", "@", "NonNull", "HttpResponse", "response", ")", "{", "if", "(", "view", "==", "null", ")", "return", ";", "Object", "output", "=", "vi...
Solve the view and convert the view to http package content. @param view current view. @param request current request. @param response current response.
[ "Solve", "the", "view", "and", "convert", "the", "view", "to", "http", "package", "content", "." ]
train
https://github.com/yanzhenjie/AndServer/blob/f95f316cdfa5755d6a3fec3c6a1b5df783b81517/api/src/main/java/com/yanzhenjie/andserver/framework/view/ViewResolver.java#L57-L68
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java
ApiOvhDedicatedCloud.serviceName_datacenter_datacenterId_backup_changeProperties_POST
public OvhTask serviceName_datacenter_datacenterId_backup_changeProperties_POST(String serviceName, Long datacenterId, Boolean backupDurationInReport, OvhOfferTypeEnum backupOffer, Boolean backupSizeInReport, Boolean diskSizeInReport, Boolean fullDayInReport, String mailAddress, Boolean restorePointInReport, Date scheduleHour) throws IOException { """ Edit the backup on a Private Cloud REST: POST /dedicatedCloud/{serviceName}/datacenter/{datacenterId}/backup/changeProperties @param scheduleHour [required] Schedule hour for start backup. UTC Timezone @param fullDayInReport [required] Full day on mail report @param mailAddress [required] Unique additional email address for backup daily report @param restorePointInReport [required] RestorePoint number on mail report @param diskSizeInReport [required] Disk size on mail report @param backupSizeInReport [required] Backup size on day on email report @param backupDurationInReport [required] Duration on email report @param backupOffer [required] Backup offer type @param serviceName [required] Domain of the service @param datacenterId [required] """ String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/backup/changeProperties"; StringBuilder sb = path(qPath, serviceName, datacenterId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "backupDurationInReport", backupDurationInReport); addBody(o, "backupOffer", backupOffer); addBody(o, "backupSizeInReport", backupSizeInReport); addBody(o, "diskSizeInReport", diskSizeInReport); addBody(o, "fullDayInReport", fullDayInReport); addBody(o, "mailAddress", mailAddress); addBody(o, "restorePointInReport", restorePointInReport); addBody(o, "scheduleHour", scheduleHour); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_datacenter_datacenterId_backup_changeProperties_POST(String serviceName, Long datacenterId, Boolean backupDurationInReport, OvhOfferTypeEnum backupOffer, Boolean backupSizeInReport, Boolean diskSizeInReport, Boolean fullDayInReport, String mailAddress, Boolean restorePointInReport, Date scheduleHour) throws IOException { String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/backup/changeProperties"; StringBuilder sb = path(qPath, serviceName, datacenterId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "backupDurationInReport", backupDurationInReport); addBody(o, "backupOffer", backupOffer); addBody(o, "backupSizeInReport", backupSizeInReport); addBody(o, "diskSizeInReport", diskSizeInReport); addBody(o, "fullDayInReport", fullDayInReport); addBody(o, "mailAddress", mailAddress); addBody(o, "restorePointInReport", restorePointInReport); addBody(o, "scheduleHour", scheduleHour); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_datacenter_datacenterId_backup_changeProperties_POST", "(", "String", "serviceName", ",", "Long", "datacenterId", ",", "Boolean", "backupDurationInReport", ",", "OvhOfferTypeEnum", "backupOffer", ",", "Boolean", "backupSizeInReport", ",", "Bool...
Edit the backup on a Private Cloud REST: POST /dedicatedCloud/{serviceName}/datacenter/{datacenterId}/backup/changeProperties @param scheduleHour [required] Schedule hour for start backup. UTC Timezone @param fullDayInReport [required] Full day on mail report @param mailAddress [required] Unique additional email address for backup daily report @param restorePointInReport [required] RestorePoint number on mail report @param diskSizeInReport [required] Disk size on mail report @param backupSizeInReport [required] Backup size on day on email report @param backupDurationInReport [required] Duration on email report @param backupOffer [required] Backup offer type @param serviceName [required] Domain of the service @param datacenterId [required]
[ "Edit", "the", "backup", "on", "a", "Private", "Cloud" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L2406-L2420
netty/netty
example/src/main/java/io/netty/example/http/upload/HttpUploadClient.java
HttpUploadClient.formget
private static List<Entry<String, String>> formget( Bootstrap bootstrap, String host, int port, String get, URI uriSimple) throws Exception { """ Standard usage of HTTP API in Netty without file Upload (get is not able to achieve File upload due to limitation on request size). @return the list of headers that will be used in every example after """ // XXX /formget // No use of HttpPostRequestEncoder since not a POST Channel channel = bootstrap.connect(host, port).sync().channel(); // Prepare the HTTP request. QueryStringEncoder encoder = new QueryStringEncoder(get); // add Form attribute encoder.addParam("getform", "GET"); encoder.addParam("info", "first value"); encoder.addParam("secondinfo", "secondvalue ���&"); // not the big one since it is not compatible with GET size // encoder.addParam("thirdinfo", textArea); encoder.addParam("thirdinfo", "third value\r\ntest second line\r\n\r\nnew line\r\n"); encoder.addParam("Send", "Send"); URI uriGet = new URI(encoder.toString()); HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, uriGet.toASCIIString()); HttpHeaders headers = request.headers(); headers.set(HttpHeaderNames.HOST, host); headers.set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE); headers.set(HttpHeaderNames.ACCEPT_ENCODING, HttpHeaderValues.GZIP + "," + HttpHeaderValues.DEFLATE); headers.set(HttpHeaderNames.ACCEPT_CHARSET, "ISO-8859-1,utf-8;q=0.7,*;q=0.7"); headers.set(HttpHeaderNames.ACCEPT_LANGUAGE, "fr"); headers.set(HttpHeaderNames.REFERER, uriSimple.toString()); headers.set(HttpHeaderNames.USER_AGENT, "Netty Simple Http Client side"); headers.set(HttpHeaderNames.ACCEPT, "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); //connection will not close but needed // headers.set("Connection","keep-alive"); // headers.set("Keep-Alive","300"); headers.set( HttpHeaderNames.COOKIE, ClientCookieEncoder.STRICT.encode( new DefaultCookie("my-cookie", "foo"), new DefaultCookie("another-cookie", "bar")) ); // send request channel.writeAndFlush(request); // Wait for the server to close the connection. channel.closeFuture().sync(); // convert headers to list return headers.entries(); }
java
private static List<Entry<String, String>> formget( Bootstrap bootstrap, String host, int port, String get, URI uriSimple) throws Exception { // XXX /formget // No use of HttpPostRequestEncoder since not a POST Channel channel = bootstrap.connect(host, port).sync().channel(); // Prepare the HTTP request. QueryStringEncoder encoder = new QueryStringEncoder(get); // add Form attribute encoder.addParam("getform", "GET"); encoder.addParam("info", "first value"); encoder.addParam("secondinfo", "secondvalue ���&"); // not the big one since it is not compatible with GET size // encoder.addParam("thirdinfo", textArea); encoder.addParam("thirdinfo", "third value\r\ntest second line\r\n\r\nnew line\r\n"); encoder.addParam("Send", "Send"); URI uriGet = new URI(encoder.toString()); HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, uriGet.toASCIIString()); HttpHeaders headers = request.headers(); headers.set(HttpHeaderNames.HOST, host); headers.set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE); headers.set(HttpHeaderNames.ACCEPT_ENCODING, HttpHeaderValues.GZIP + "," + HttpHeaderValues.DEFLATE); headers.set(HttpHeaderNames.ACCEPT_CHARSET, "ISO-8859-1,utf-8;q=0.7,*;q=0.7"); headers.set(HttpHeaderNames.ACCEPT_LANGUAGE, "fr"); headers.set(HttpHeaderNames.REFERER, uriSimple.toString()); headers.set(HttpHeaderNames.USER_AGENT, "Netty Simple Http Client side"); headers.set(HttpHeaderNames.ACCEPT, "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); //connection will not close but needed // headers.set("Connection","keep-alive"); // headers.set("Keep-Alive","300"); headers.set( HttpHeaderNames.COOKIE, ClientCookieEncoder.STRICT.encode( new DefaultCookie("my-cookie", "foo"), new DefaultCookie("another-cookie", "bar")) ); // send request channel.writeAndFlush(request); // Wait for the server to close the connection. channel.closeFuture().sync(); // convert headers to list return headers.entries(); }
[ "private", "static", "List", "<", "Entry", "<", "String", ",", "String", ">", ">", "formget", "(", "Bootstrap", "bootstrap", ",", "String", "host", ",", "int", "port", ",", "String", "get", ",", "URI", "uriSimple", ")", "throws", "Exception", "{", "// XX...
Standard usage of HTTP API in Netty without file Upload (get is not able to achieve File upload due to limitation on request size). @return the list of headers that will be used in every example after
[ "Standard", "usage", "of", "HTTP", "API", "in", "Netty", "without", "file", "Upload", "(", "get", "is", "not", "able", "to", "achieve", "File", "upload", "due", "to", "limitation", "on", "request", "size", ")", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/example/src/main/java/io/netty/example/http/upload/HttpUploadClient.java#L149-L197
NessComputing/components-ness-event
core/src/main/java/com/nesscomputing/event/NessEvent.java
NessEvent.createEvent
public static NessEvent createEvent(@Nullable final UUID user, @Nullable final DateTime timestamp, @Nonnull final NessEventType type, @Nullable final Map<String, ? extends Object> payload) { """ Create a new event. @param user User that the event happened for. Can be null for a system level event. @param timestamp The time when this event entered the system @param type The Event type. @param payload Arbitrary data describing the event. """ return new NessEvent(user, timestamp, type, payload, UUID.randomUUID()); }
java
public static NessEvent createEvent(@Nullable final UUID user, @Nullable final DateTime timestamp, @Nonnull final NessEventType type, @Nullable final Map<String, ? extends Object> payload) { return new NessEvent(user, timestamp, type, payload, UUID.randomUUID()); }
[ "public", "static", "NessEvent", "createEvent", "(", "@", "Nullable", "final", "UUID", "user", ",", "@", "Nullable", "final", "DateTime", "timestamp", ",", "@", "Nonnull", "final", "NessEventType", "type", ",", "@", "Nullable", "final", "Map", "<", "String", ...
Create a new event. @param user User that the event happened for. Can be null for a system level event. @param timestamp The time when this event entered the system @param type The Event type. @param payload Arbitrary data describing the event.
[ "Create", "a", "new", "event", "." ]
train
https://github.com/NessComputing/components-ness-event/blob/6d41f9e7c810c3ffa6bb79e19bb8cfb1d1c12c33/core/src/main/java/com/nesscomputing/event/NessEvent.java#L81-L87
hal/core
gui/src/main/java/org/jboss/as/console/mbui/widgets/ComplexAttributeForm.java
ComplexAttributeForm.getSecurityContext
private SecurityContext getSecurityContext() { """ Simply delegates all auth decision to the parent context attribute scope represented by {@link #attributeName} @return """ return new SecurityContext() { @Override public AuthorisationDecision getReadPriviledge() { return securityContextDelegate.getReadPriviledge(); } @Override public AuthorisationDecision getWritePriviledge() { return securityContextDelegate.getWritePriviledge(); } @Override public AuthorisationDecision getAttributeWritePriviledge(String s) { return securityContextDelegate.getAttributeWritePriviledge(attributeName); } @Override public AuthorisationDecision getAttributeReadPriviledge(String s) { return securityContextDelegate.getAttributeReadPriviledge(attributeName); } @Override public AuthorisationDecision getAttributeWritePriviledge(String resourceAddress, String attributeName) { return securityContextDelegate.getAttributeWritePriviledge(attributeName); } @Override public AuthorisationDecision getAttributeReadPriviledge(String resourceAddress, String attributeName) { return securityContextDelegate.getAttributeReadPriviledge(attributeName); } @Override public AuthorisationDecision getReadPrivilege(String resourceAddress) { return securityContextDelegate.getAttributeReadPriviledge(attributeName); } @Override public AuthorisationDecision getWritePrivilege(String resourceAddress) { return securityContextDelegate.getAttributeWritePriviledge(attributeName); } @Override public AuthorisationDecision getOperationPriviledge(String resourceAddress, String operationName) { return securityContextDelegate.getOperationPriviledge(resourceAddress, operationName); } @Override public boolean hasChildContext(Object s, String resolvedKey) { return false; } @Override public void activateChildContext(Object resourceAddress, String resolvedKey) { } @Override public void seal() { securityContextDelegate.seal(); } }; }
java
private SecurityContext getSecurityContext() { return new SecurityContext() { @Override public AuthorisationDecision getReadPriviledge() { return securityContextDelegate.getReadPriviledge(); } @Override public AuthorisationDecision getWritePriviledge() { return securityContextDelegate.getWritePriviledge(); } @Override public AuthorisationDecision getAttributeWritePriviledge(String s) { return securityContextDelegate.getAttributeWritePriviledge(attributeName); } @Override public AuthorisationDecision getAttributeReadPriviledge(String s) { return securityContextDelegate.getAttributeReadPriviledge(attributeName); } @Override public AuthorisationDecision getAttributeWritePriviledge(String resourceAddress, String attributeName) { return securityContextDelegate.getAttributeWritePriviledge(attributeName); } @Override public AuthorisationDecision getAttributeReadPriviledge(String resourceAddress, String attributeName) { return securityContextDelegate.getAttributeReadPriviledge(attributeName); } @Override public AuthorisationDecision getReadPrivilege(String resourceAddress) { return securityContextDelegate.getAttributeReadPriviledge(attributeName); } @Override public AuthorisationDecision getWritePrivilege(String resourceAddress) { return securityContextDelegate.getAttributeWritePriviledge(attributeName); } @Override public AuthorisationDecision getOperationPriviledge(String resourceAddress, String operationName) { return securityContextDelegate.getOperationPriviledge(resourceAddress, operationName); } @Override public boolean hasChildContext(Object s, String resolvedKey) { return false; } @Override public void activateChildContext(Object resourceAddress, String resolvedKey) { } @Override public void seal() { securityContextDelegate.seal(); } }; }
[ "private", "SecurityContext", "getSecurityContext", "(", ")", "{", "return", "new", "SecurityContext", "(", ")", "{", "@", "Override", "public", "AuthorisationDecision", "getReadPriviledge", "(", ")", "{", "return", "securityContextDelegate", ".", "getReadPriviledge", ...
Simply delegates all auth decision to the parent context attribute scope represented by {@link #attributeName} @return
[ "Simply", "delegates", "all", "auth", "decision", "to", "the", "parent", "context", "attribute", "scope", "represented", "by", "{" ]
train
https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/mbui/widgets/ComplexAttributeForm.java#L84-L146
googlemaps/google-maps-services-java
src/main/java/com/google/maps/RoadsApi.java
RoadsApi.speedLimits
public static PendingResult<SpeedLimit[]> speedLimits(GeoApiContext context, LatLng... path) { """ Returns the posted speed limit for given road segments. The provided LatLngs will first be snapped to the most likely roads the vehicle was traveling along. <p>Note: The accuracy of speed limit data returned by the Google Maps Roads API cannot be guaranteed. Speed limit data provided is not real-time, and may be estimated, inaccurate, incomplete, and/or outdated. Inaccuracies in our data may be reported through <a href="https://www.localguidesconnect.com/t5/News-Updates/Exclusive-Edit-a-road-segment-in-Google-Maps/ba-p/149865"> Google Maps Feedback</a>. @param context The {@link GeoApiContext} to make requests through. @param path The collected GPS points as a path. @return Returns the speed limits as a {@link PendingResult}. """ return context.get(SPEEDS_API_CONFIG, SpeedsResponse.class, "path", join('|', path)); }
java
public static PendingResult<SpeedLimit[]> speedLimits(GeoApiContext context, LatLng... path) { return context.get(SPEEDS_API_CONFIG, SpeedsResponse.class, "path", join('|', path)); }
[ "public", "static", "PendingResult", "<", "SpeedLimit", "[", "]", ">", "speedLimits", "(", "GeoApiContext", "context", ",", "LatLng", "...", "path", ")", "{", "return", "context", ".", "get", "(", "SPEEDS_API_CONFIG", ",", "SpeedsResponse", ".", "class", ",", ...
Returns the posted speed limit for given road segments. The provided LatLngs will first be snapped to the most likely roads the vehicle was traveling along. <p>Note: The accuracy of speed limit data returned by the Google Maps Roads API cannot be guaranteed. Speed limit data provided is not real-time, and may be estimated, inaccurate, incomplete, and/or outdated. Inaccuracies in our data may be reported through <a href="https://www.localguidesconnect.com/t5/News-Updates/Exclusive-Edit-a-road-segment-in-Google-Maps/ba-p/149865"> Google Maps Feedback</a>. @param context The {@link GeoApiContext} to make requests through. @param path The collected GPS points as a path. @return Returns the speed limits as a {@link PendingResult}.
[ "Returns", "the", "posted", "speed", "limit", "for", "given", "road", "segments", ".", "The", "provided", "LatLngs", "will", "first", "be", "snapped", "to", "the", "most", "likely", "roads", "the", "vehicle", "was", "traveling", "along", "." ]
train
https://github.com/googlemaps/google-maps-services-java/blob/23d20d1930f80e310d856d2da51d72ee0db4476b/src/main/java/com/google/maps/RoadsApi.java#L111-L113
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/PrimaryKey.java
PrimaryKey.addComponent
public PrimaryKey addComponent(String keyAttributeName, Object keyAttributeValue) { """ Add a key component to this primary key. Note adding a key component with the same name as that of an existing one would overwrite and become a single key component instead of two. """ components.put(keyAttributeName, new KeyAttribute(keyAttributeName, keyAttributeValue)); return this; }
java
public PrimaryKey addComponent(String keyAttributeName, Object keyAttributeValue) { components.put(keyAttributeName, new KeyAttribute(keyAttributeName, keyAttributeValue)); return this; }
[ "public", "PrimaryKey", "addComponent", "(", "String", "keyAttributeName", ",", "Object", "keyAttributeValue", ")", "{", "components", ".", "put", "(", "keyAttributeName", ",", "new", "KeyAttribute", "(", "keyAttributeName", ",", "keyAttributeValue", ")", ")", ";", ...
Add a key component to this primary key. Note adding a key component with the same name as that of an existing one would overwrite and become a single key component instead of two.
[ "Add", "a", "key", "component", "to", "this", "primary", "key", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/PrimaryKey.java#L101-L105
bushidowallet/bushido-java-service
bushido-service-lib/src/main/java/com/bccapi/bitlib/util/CoinUtil.java
CoinUtil.valueString
public static String valueString(long value, Denomination denomination) { """ Get the given value in satoshis as a string on the form "10.12345" using the specified denomination. <p> This method only returns necessary decimal points to tell the exact value. If you wish to display all digits use {@link CoinUtil#fullValueString(long, Denomination)} @param value The number of satoshis @param denomination The denomination to use @return The given value in satoshis as a string on the form "10.12345". """ BigDecimal d = BigDecimal.valueOf(value); d = d.divide(denomination.getOneUnitInSatoshis()); return d.toPlainString(); }
java
public static String valueString(long value, Denomination denomination) { BigDecimal d = BigDecimal.valueOf(value); d = d.divide(denomination.getOneUnitInSatoshis()); return d.toPlainString(); }
[ "public", "static", "String", "valueString", "(", "long", "value", ",", "Denomination", "denomination", ")", "{", "BigDecimal", "d", "=", "BigDecimal", ".", "valueOf", "(", "value", ")", ";", "d", "=", "d", ".", "divide", "(", "denomination", ".", "getOneU...
Get the given value in satoshis as a string on the form "10.12345" using the specified denomination. <p> This method only returns necessary decimal points to tell the exact value. If you wish to display all digits use {@link CoinUtil#fullValueString(long, Denomination)} @param value The number of satoshis @param denomination The denomination to use @return The given value in satoshis as a string on the form "10.12345".
[ "Get", "the", "given", "value", "in", "satoshis", "as", "a", "string", "on", "the", "form", "10", ".", "12345", "using", "the", "specified", "denomination", ".", "<p", ">", "This", "method", "only", "returns", "necessary", "decimal", "points", "to", "tell"...
train
https://github.com/bushidowallet/bushido-java-service/blob/e1a0157527e57459b509718044d2df44084876a2/bushido-service-lib/src/main/java/com/bccapi/bitlib/util/CoinUtil.java#L118-L122
Netflix/Nicobar
nicobar-core/src/main/java/com/netflix/nicobar/core/archive/ModuleId.java
ModuleId.fromString
public static ModuleId fromString(String moduleId) throws IllegalArgumentException { """ Parse a module id from a string. If a version identifier cannot be extracted, the version identifier will be set to "" (empty string). @param moduleId the id string @return the module identifier @throws IllegalArgumentException if the format of the module specification is invalid or it is {@code null} """ if (moduleId == null) { throw new IllegalArgumentException("Module Id String is null"); } if (moduleId.length() == 0) { throw new IllegalArgumentException("Empty Module Id String"); } final int c1 = moduleId.lastIndexOf(MODULE_VERSION_SEPARATOR); final String name; final String version; if (c1 != -1) { name = moduleId.substring(0, c1); version = moduleId.substring(c1 + 1); } else { name = moduleId; version = DEFAULT_VERSION; } return new ModuleId(name, version); }
java
public static ModuleId fromString(String moduleId) throws IllegalArgumentException { if (moduleId == null) { throw new IllegalArgumentException("Module Id String is null"); } if (moduleId.length() == 0) { throw new IllegalArgumentException("Empty Module Id String"); } final int c1 = moduleId.lastIndexOf(MODULE_VERSION_SEPARATOR); final String name; final String version; if (c1 != -1) { name = moduleId.substring(0, c1); version = moduleId.substring(c1 + 1); } else { name = moduleId; version = DEFAULT_VERSION; } return new ModuleId(name, version); }
[ "public", "static", "ModuleId", "fromString", "(", "String", "moduleId", ")", "throws", "IllegalArgumentException", "{", "if", "(", "moduleId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Module Id String is null\"", ")", ";", "}", ...
Parse a module id from a string. If a version identifier cannot be extracted, the version identifier will be set to "" (empty string). @param moduleId the id string @return the module identifier @throws IllegalArgumentException if the format of the module specification is invalid or it is {@code null}
[ "Parse", "a", "module", "id", "from", "a", "string", ".", "If", "a", "version", "identifier", "cannot", "be", "extracted", "the", "version", "identifier", "will", "be", "set", "to", "(", "empty", "string", ")", "." ]
train
https://github.com/Netflix/Nicobar/blob/507173dcae4a86a955afc3df222a855862fab8d7/nicobar-core/src/main/java/com/netflix/nicobar/core/archive/ModuleId.java#L122-L142
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/ImageImpl.java
ImageImpl.computeRenderingPoint
private void computeRenderingPoint(int width, int height) { """ Compute the rendering point. @param width The width to use. @param height The height to use. """ rx = (int) Math.floor(origin.getX(x, width)); ry = (int) Math.floor(origin.getY(y, height)); }
java
private void computeRenderingPoint(int width, int height) { rx = (int) Math.floor(origin.getX(x, width)); ry = (int) Math.floor(origin.getY(y, height)); }
[ "private", "void", "computeRenderingPoint", "(", "int", "width", ",", "int", "height", ")", "{", "rx", "=", "(", "int", ")", "Math", ".", "floor", "(", "origin", ".", "getX", "(", "x", ",", "width", ")", ")", ";", "ry", "=", "(", "int", ")", "Mat...
Compute the rendering point. @param width The width to use. @param height The height to use.
[ "Compute", "the", "rendering", "point", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/ImageImpl.java#L99-L103
PinaeOS/timon
src/main/java/org/pinae/timon/cache/CacheFactory.java
CacheFactory.createCache
public Cache createCache(String name, CacheConfiguration config, int type) throws CacheException { """ 生成缓存 @param name 缓存名称 @param config 缓存配置 @param type 缓存类别 @return 生成的缓存对象 @throws CacheException 缓存异常 """ if (config == null) { throw new CacheException("Cache configuration is null"); } Cache cache = null; switch (type) { case Cache.SYN_CACHE: cache = new SynchronizedCache(name, (SynchronizedCacheConfiguration) config); break; case Cache.EHCACHE_CACHE: cache = new EhCache(name, (EhCacheConfiguration) config); break; case Cache.MEMCACHED_CACHE: cache = new MemcachedCache(name, (MemcachedCacheConfiguration)config); break; } if (name != null && cache != null) { this.cachePool.put(name, cache); } return cache; }
java
public Cache createCache(String name, CacheConfiguration config, int type) throws CacheException { if (config == null) { throw new CacheException("Cache configuration is null"); } Cache cache = null; switch (type) { case Cache.SYN_CACHE: cache = new SynchronizedCache(name, (SynchronizedCacheConfiguration) config); break; case Cache.EHCACHE_CACHE: cache = new EhCache(name, (EhCacheConfiguration) config); break; case Cache.MEMCACHED_CACHE: cache = new MemcachedCache(name, (MemcachedCacheConfiguration)config); break; } if (name != null && cache != null) { this.cachePool.put(name, cache); } return cache; }
[ "public", "Cache", "createCache", "(", "String", "name", ",", "CacheConfiguration", "config", ",", "int", "type", ")", "throws", "CacheException", "{", "if", "(", "config", "==", "null", ")", "{", "throw", "new", "CacheException", "(", "\"Cache configuration is ...
生成缓存 @param name 缓存名称 @param config 缓存配置 @param type 缓存类别 @return 生成的缓存对象 @throws CacheException 缓存异常
[ "生成缓存" ]
train
https://github.com/PinaeOS/timon/blob/b8c66868624e3eb1b36f6ecda3c556c456a30cd3/src/main/java/org/pinae/timon/cache/CacheFactory.java#L52-L75
offbynull/coroutines
instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java
GenericGenerators.lineNumber
public static InsnList lineNumber(int num) { """ Generates instructions for line numbers. This is useful for debugging. For example, you can put a line number of 99999 or some other special number to denote that the code being executed is instrumented code. Then if a stacktrace happens, you'll know that if instrumented code was immediately involved. @param num line number @return instructions for a line number @throws IllegalArgumentException if {@code num < 0} """ Validate.isTrue(num >= 0); InsnList ret = new InsnList(); LabelNode labelNode = new LabelNode(); ret.add(labelNode); ret.add(new LineNumberNode(num, labelNode)); return ret; }
java
public static InsnList lineNumber(int num) { Validate.isTrue(num >= 0); InsnList ret = new InsnList(); LabelNode labelNode = new LabelNode(); ret.add(labelNode); ret.add(new LineNumberNode(num, labelNode)); return ret; }
[ "public", "static", "InsnList", "lineNumber", "(", "int", "num", ")", "{", "Validate", ".", "isTrue", "(", "num", ">=", "0", ")", ";", "InsnList", "ret", "=", "new", "InsnList", "(", ")", ";", "LabelNode", "labelNode", "=", "new", "LabelNode", "(", ")"...
Generates instructions for line numbers. This is useful for debugging. For example, you can put a line number of 99999 or some other special number to denote that the code being executed is instrumented code. Then if a stacktrace happens, you'll know that if instrumented code was immediately involved. @param num line number @return instructions for a line number @throws IllegalArgumentException if {@code num < 0}
[ "Generates", "instructions", "for", "line", "numbers", ".", "This", "is", "useful", "for", "debugging", ".", "For", "example", "you", "can", "put", "a", "line", "number", "of", "99999", "or", "some", "other", "special", "number", "to", "denote", "that", "t...
train
https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java#L286-L296
codelibs/jcifs
src/main/java/jcifs/smb1/Config.java
Config.getInetAddress
public static InetAddress getInetAddress( String key, InetAddress def ) { """ Retrieve an <code>InetAddress</code>. If the address is not an IP address and cannot be resolved <code>null</code> will be returned. """ String addr = prp.getProperty( key ); if( addr != null ) { try { def = InetAddress.getByName( addr ); } catch( UnknownHostException uhe ) { if( log.level > 0 ) { log.println( addr ); uhe.printStackTrace( log ); } } } return def; }
java
public static InetAddress getInetAddress( String key, InetAddress def ) { String addr = prp.getProperty( key ); if( addr != null ) { try { def = InetAddress.getByName( addr ); } catch( UnknownHostException uhe ) { if( log.level > 0 ) { log.println( addr ); uhe.printStackTrace( log ); } } } return def; }
[ "public", "static", "InetAddress", "getInetAddress", "(", "String", "key", ",", "InetAddress", "def", ")", "{", "String", "addr", "=", "prp", ".", "getProperty", "(", "key", ")", ";", "if", "(", "addr", "!=", "null", ")", "{", "try", "{", "def", "=", ...
Retrieve an <code>InetAddress</code>. If the address is not an IP address and cannot be resolved <code>null</code> will be returned.
[ "Retrieve", "an", "<code", ">", "InetAddress<", "/", "code", ">", ".", "If", "the", "address", "is", "not", "an", "IP", "address", "and", "cannot", "be", "resolved", "<code", ">", "null<", "/", "code", ">", "will", "be", "returned", "." ]
train
https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/Config.java#L278-L291
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerAgentUtils.java
DockerAgentUtils.registerImage
private static void registerImage(String imageId, String imageTag, String targetRepo, ArrayListMultimap<String, String> artifactsProps, int buildInfoId) throws IOException { """ Registers an image to the images cache, so that it can be captured by the build-info proxy. @param imageId @param imageTag @param targetRepo @param buildInfoId @throws IOException """ DockerImage image = new DockerImage(imageId, imageTag, targetRepo, buildInfoId, artifactsProps); images.add(image); }
java
private static void registerImage(String imageId, String imageTag, String targetRepo, ArrayListMultimap<String, String> artifactsProps, int buildInfoId) throws IOException { DockerImage image = new DockerImage(imageId, imageTag, targetRepo, buildInfoId, artifactsProps); images.add(image); }
[ "private", "static", "void", "registerImage", "(", "String", "imageId", ",", "String", "imageTag", ",", "String", "targetRepo", ",", "ArrayListMultimap", "<", "String", ",", "String", ">", "artifactsProps", ",", "int", "buildInfoId", ")", "throws", "IOException", ...
Registers an image to the images cache, so that it can be captured by the build-info proxy. @param imageId @param imageTag @param targetRepo @param buildInfoId @throws IOException
[ "Registers", "an", "image", "to", "the", "images", "cache", "so", "that", "it", "can", "be", "captured", "by", "the", "build", "-", "info", "proxy", "." ]
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerAgentUtils.java#L74-L78
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/WikipediaInfo.java
WikipediaInfo.iterateCategoriesGetArticles
private void iterateCategoriesGetArticles(Wikipedia pWiki, CategoryGraph catGraph) throws WikiPageNotFoundException { """ Methods computing stuff that have to iterate over all categories and access category articles can plug-in here. Recently plugin-in: numberOfCategorizedArticles distributionOfArticlesByCategory @param pWiki The wikipedia object. @param catGraph The category graph. @throws WikiPageNotFoundException """ Map<Integer,Integer> localDegreeDistribution = new HashMap<Integer,Integer>(); Set<Integer> localCategorizedArticleSet = new HashSet<Integer>(); Set<Integer> categoryNodes = catGraph.getGraph().vertexSet(); // iterate over all categories int progress = 0; for (int node : categoryNodes) { progress++; ApiUtilities.printProgressInfo(progress, categoryNodes.size(), 100, ApiUtilities.ProgressInfoMode.TEXT, "iterate over categories"); // get the category Category cat = pWiki.getCategory(node); if (cat != null) { Set<Integer> pages = new HashSet<Integer>(cat.__getPages()); // update degree distribution map int numberOfArticles = pages.size(); if (localDegreeDistribution.containsKey(numberOfArticles)) { int count = localDegreeDistribution.get(numberOfArticles); count++; localDegreeDistribution.put(numberOfArticles, count); } else { localDegreeDistribution.put(numberOfArticles, 1); } // add the page to the categorized articles set, if it is to already in it for (int page : pages) { if (!localCategorizedArticleSet.contains(page)) { localCategorizedArticleSet.add(page); } } } else { logger.info("{} is not a category.", node); } } this.degreeDistribution = localDegreeDistribution; this.categorizedArticleSet = localCategorizedArticleSet; }
java
private void iterateCategoriesGetArticles(Wikipedia pWiki, CategoryGraph catGraph) throws WikiPageNotFoundException { Map<Integer,Integer> localDegreeDistribution = new HashMap<Integer,Integer>(); Set<Integer> localCategorizedArticleSet = new HashSet<Integer>(); Set<Integer> categoryNodes = catGraph.getGraph().vertexSet(); // iterate over all categories int progress = 0; for (int node : categoryNodes) { progress++; ApiUtilities.printProgressInfo(progress, categoryNodes.size(), 100, ApiUtilities.ProgressInfoMode.TEXT, "iterate over categories"); // get the category Category cat = pWiki.getCategory(node); if (cat != null) { Set<Integer> pages = new HashSet<Integer>(cat.__getPages()); // update degree distribution map int numberOfArticles = pages.size(); if (localDegreeDistribution.containsKey(numberOfArticles)) { int count = localDegreeDistribution.get(numberOfArticles); count++; localDegreeDistribution.put(numberOfArticles, count); } else { localDegreeDistribution.put(numberOfArticles, 1); } // add the page to the categorized articles set, if it is to already in it for (int page : pages) { if (!localCategorizedArticleSet.contains(page)) { localCategorizedArticleSet.add(page); } } } else { logger.info("{} is not a category.", node); } } this.degreeDistribution = localDegreeDistribution; this.categorizedArticleSet = localCategorizedArticleSet; }
[ "private", "void", "iterateCategoriesGetArticles", "(", "Wikipedia", "pWiki", ",", "CategoryGraph", "catGraph", ")", "throws", "WikiPageNotFoundException", "{", "Map", "<", "Integer", ",", "Integer", ">", "localDegreeDistribution", "=", "new", "HashMap", "<", "Integer...
Methods computing stuff that have to iterate over all categories and access category articles can plug-in here. Recently plugin-in: numberOfCategorizedArticles distributionOfArticlesByCategory @param pWiki The wikipedia object. @param catGraph The category graph. @throws WikiPageNotFoundException
[ "Methods", "computing", "stuff", "that", "have", "to", "iterate", "over", "all", "categories", "and", "access", "category", "articles", "can", "plug", "-", "in", "here", ".", "Recently", "plugin", "-", "in", ":", "numberOfCategorizedArticles", "distributionOfArtic...
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/WikipediaInfo.java#L318-L357
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java
Validator.validateFalse
@SuppressWarnings("all") public void validateFalse(boolean value, String name, String message) { """ Validates a given value to be false @param value The value to check @param name The name of the field to display the error message @param message A custom error message instead of the default one """ if (value) { addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.FALSE_KEY.name(), name))); } }
java
@SuppressWarnings("all") public void validateFalse(boolean value, String name, String message) { if (value) { addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.FALSE_KEY.name(), name))); } }
[ "@", "SuppressWarnings", "(", "\"all\"", ")", "public", "void", "validateFalse", "(", "boolean", "value", ",", "String", "name", ",", "String", "message", ")", "{", "if", "(", "value", ")", "{", "addError", "(", "name", ",", "Optional", ".", "ofNullable", ...
Validates a given value to be false @param value The value to check @param name The name of the field to display the error message @param message A custom error message instead of the default one
[ "Validates", "a", "given", "value", "to", "be", "false" ]
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java#L452-L457
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/dsl/ParsingModelIo.java
ParsingModelIo.saveRelationsFile
public static void saveRelationsFile( FileDefinition relationsFile, boolean writeComments, String lineSeparator ) throws IOException { """ Saves the model into the original file. @param relationsFile the relations file @param writeComments true to write comments @param lineSeparator the line separator (if null, the OS' one is used) @throws IOException if the file could not be saved """ if( relationsFile.getEditedFile() == null ) throw new IOException( "Save operation could not be performed. The model was not loaded from a local file." ); saveRelationsFileInto( relationsFile.getEditedFile(), relationsFile, writeComments, lineSeparator ); }
java
public static void saveRelationsFile( FileDefinition relationsFile, boolean writeComments, String lineSeparator ) throws IOException { if( relationsFile.getEditedFile() == null ) throw new IOException( "Save operation could not be performed. The model was not loaded from a local file." ); saveRelationsFileInto( relationsFile.getEditedFile(), relationsFile, writeComments, lineSeparator ); }
[ "public", "static", "void", "saveRelationsFile", "(", "FileDefinition", "relationsFile", ",", "boolean", "writeComments", ",", "String", "lineSeparator", ")", "throws", "IOException", "{", "if", "(", "relationsFile", ".", "getEditedFile", "(", ")", "==", "null", "...
Saves the model into the original file. @param relationsFile the relations file @param writeComments true to write comments @param lineSeparator the line separator (if null, the OS' one is used) @throws IOException if the file could not be saved
[ "Saves", "the", "model", "into", "the", "original", "file", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/dsl/ParsingModelIo.java#L87-L94
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java
HtmlTree.escapeHtmlChars
private static String escapeHtmlChars(String s) { """ Given a string, escape all special html characters and return the result. @param s The string to check. @return the original string with all of the HTML characters escaped. """ for (int i = 0; i < s.length(); i++) { char ch = s.charAt(i); switch (ch) { // only start building a new string if we need to case '<': case '>': case '&': StringBuilder sb = new StringBuilder(s.substring(0, i)); for ( ; i < s.length(); i++) { ch = s.charAt(i); switch (ch) { case '<': sb.append("&lt;"); break; case '>': sb.append("&gt;"); break; case '&': sb.append("&amp;"); break; default: sb.append(ch); break; } } return sb.toString(); } } return s; }
java
private static String escapeHtmlChars(String s) { for (int i = 0; i < s.length(); i++) { char ch = s.charAt(i); switch (ch) { // only start building a new string if we need to case '<': case '>': case '&': StringBuilder sb = new StringBuilder(s.substring(0, i)); for ( ; i < s.length(); i++) { ch = s.charAt(i); switch (ch) { case '<': sb.append("&lt;"); break; case '>': sb.append("&gt;"); break; case '&': sb.append("&amp;"); break; default: sb.append(ch); break; } } return sb.toString(); } } return s; }
[ "private", "static", "String", "escapeHtmlChars", "(", "String", "s", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "s", ".", "length", "(", ")", ";", "i", "++", ")", "{", "char", "ch", "=", "s", ".", "charAt", "(", "i", ")", ";"...
Given a string, escape all special html characters and return the result. @param s The string to check. @return the original string with all of the HTML characters escaped.
[ "Given", "a", "string", "escape", "all", "special", "html", "characters", "and", "return", "the", "result", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L162-L182
landawn/AbacusUtil
src/com/landawn/abacus/util/DynamoDBExecutor.java
DynamoDBExecutor.putItem
PutItemResult putItem(final String tableName, final Object entity) { """ And it may cause error because the "Object" is ambiguous to any type. """ return putItem(tableName, toItem(entity)); }
java
PutItemResult putItem(final String tableName, final Object entity) { return putItem(tableName, toItem(entity)); }
[ "PutItemResult", "putItem", "(", "final", "String", "tableName", ",", "final", "Object", "entity", ")", "{", "return", "putItem", "(", "tableName", ",", "toItem", "(", "entity", ")", ")", ";", "}" ]
And it may cause error because the "Object" is ambiguous to any type.
[ "And", "it", "may", "cause", "error", "because", "the", "Object", "is", "ambiguous", "to", "any", "type", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DynamoDBExecutor.java#L946-L948
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/EvaluationUtils.java
EvaluationUtils.falseNegativeRate
public static double falseNegativeRate(long fnCount, long tpCount, double edgeCase) { """ Calculate the false negative rate from the false negative counts and true positive count @param fnCount False negative count @param tpCount True positive count @param edgeCase Edge case value to use to avoid 0/0 @return False negative rate """ //Edge case if (fnCount == 0 && tpCount == 0) { return edgeCase; } return fnCount / (double) (fnCount + tpCount); }
java
public static double falseNegativeRate(long fnCount, long tpCount, double edgeCase) { //Edge case if (fnCount == 0 && tpCount == 0) { return edgeCase; } return fnCount / (double) (fnCount + tpCount); }
[ "public", "static", "double", "falseNegativeRate", "(", "long", "fnCount", ",", "long", "tpCount", ",", "double", "edgeCase", ")", "{", "//Edge case", "if", "(", "fnCount", "==", "0", "&&", "tpCount", "==", "0", ")", "{", "return", "edgeCase", ";", "}", ...
Calculate the false negative rate from the false negative counts and true positive count @param fnCount False negative count @param tpCount True positive count @param edgeCase Edge case value to use to avoid 0/0 @return False negative rate
[ "Calculate", "the", "false", "negative", "rate", "from", "the", "false", "negative", "counts", "and", "true", "positive", "count" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/EvaluationUtils.java#L91-L98
io7m/jcanephora
com.io7m.jcanephora.core/src/main/java/com/io7m/jcanephora/core/JCGLTextureUpdates.java
JCGLTextureUpdates.newUpdateReplacingAll2D
public static JCGLTexture2DUpdateType newUpdateReplacingAll2D( final JCGLTexture2DUsableType t) { """ Create a new update that will replace the entirety of {@code t}. @param t The texture @return A new update """ NullCheck.notNull(t, "Texture"); return newUpdateReplacingArea2D(t, AreaSizesL.area(t.size())); }
java
public static JCGLTexture2DUpdateType newUpdateReplacingAll2D( final JCGLTexture2DUsableType t) { NullCheck.notNull(t, "Texture"); return newUpdateReplacingArea2D(t, AreaSizesL.area(t.size())); }
[ "public", "static", "JCGLTexture2DUpdateType", "newUpdateReplacingAll2D", "(", "final", "JCGLTexture2DUsableType", "t", ")", "{", "NullCheck", ".", "notNull", "(", "t", ",", "\"Texture\"", ")", ";", "return", "newUpdateReplacingArea2D", "(", "t", ",", "AreaSizesL", ...
Create a new update that will replace the entirety of {@code t}. @param t The texture @return A new update
[ "Create", "a", "new", "update", "that", "will", "replace", "the", "entirety", "of", "{", "@code", "t", "}", "." ]
train
https://github.com/io7m/jcanephora/blob/0004c1744b7f0969841d04cd4fa693f402b10980/com.io7m.jcanephora.core/src/main/java/com/io7m/jcanephora/core/JCGLTextureUpdates.java#L109-L114
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java
SqlQueryStatement.appendFieldCriteria
private void appendFieldCriteria(TableAlias alias, PathInfo pathInfo, FieldCriteria c, StringBuffer buf) { """ Answer the SQL-Clause for a FieldCriteria<br> The value of the FieldCriteria will be translated @param alias @param pathInfo @param c ColumnCriteria @param buf """ appendColName(alias, pathInfo, c.isTranslateAttribute(), buf); buf.append(c.getClause()); if (c.isTranslateField()) { appendColName((String) c.getValue(), false, c.getUserAlias(), buf); } else { buf.append(c.getValue()); } }
java
private void appendFieldCriteria(TableAlias alias, PathInfo pathInfo, FieldCriteria c, StringBuffer buf) { appendColName(alias, pathInfo, c.isTranslateAttribute(), buf); buf.append(c.getClause()); if (c.isTranslateField()) { appendColName((String) c.getValue(), false, c.getUserAlias(), buf); } else { buf.append(c.getValue()); } }
[ "private", "void", "appendFieldCriteria", "(", "TableAlias", "alias", ",", "PathInfo", "pathInfo", ",", "FieldCriteria", "c", ",", "StringBuffer", "buf", ")", "{", "appendColName", "(", "alias", ",", "pathInfo", ",", "c", ".", "isTranslateAttribute", "(", ")", ...
Answer the SQL-Clause for a FieldCriteria<br> The value of the FieldCriteria will be translated @param alias @param pathInfo @param c ColumnCriteria @param buf
[ "Answer", "the", "SQL", "-", "Clause", "for", "a", "FieldCriteria<br", ">", "The", "value", "of", "the", "FieldCriteria", "will", "be", "translated" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L728-L741
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/ApplicationMetadata.java
ApplicationMetadata.addEntityMetadata
public void addEntityMetadata(String persistenceUnit, Class<?> clazz, EntityMetadata entityMetadata) { """ Adds the entity metadata. @param persistenceUnit the persistence unit @param clazz the clazz @param entityMetadata the entity metadata """ Metamodel metamodel = getMetamodelMap().get(persistenceUnit); Map<String, EntityMetadata> entityClassToMetadataMap = ((MetamodelImpl) metamodel).getEntityMetadataMap(); if (entityClassToMetadataMap == null || entityClassToMetadataMap.isEmpty()) { entityClassToMetadataMap.put(clazz.getName(), entityMetadata); } else { if (logger.isDebugEnabled()) logger.debug("Entity meta model already exists for persistence unit " + persistenceUnit + " and class " + clazz + ". Noting needs to be done"); } }
java
public void addEntityMetadata(String persistenceUnit, Class<?> clazz, EntityMetadata entityMetadata) { Metamodel metamodel = getMetamodelMap().get(persistenceUnit); Map<String, EntityMetadata> entityClassToMetadataMap = ((MetamodelImpl) metamodel).getEntityMetadataMap(); if (entityClassToMetadataMap == null || entityClassToMetadataMap.isEmpty()) { entityClassToMetadataMap.put(clazz.getName(), entityMetadata); } else { if (logger.isDebugEnabled()) logger.debug("Entity meta model already exists for persistence unit " + persistenceUnit + " and class " + clazz + ". Noting needs to be done"); } }
[ "public", "void", "addEntityMetadata", "(", "String", "persistenceUnit", ",", "Class", "<", "?", ">", "clazz", ",", "EntityMetadata", "entityMetadata", ")", "{", "Metamodel", "metamodel", "=", "getMetamodelMap", "(", ")", ".", "get", "(", "persistenceUnit", ")",...
Adds the entity metadata. @param persistenceUnit the persistence unit @param clazz the clazz @param entityMetadata the entity metadata
[ "Adds", "the", "entity", "metadata", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/ApplicationMetadata.java#L75-L89
aoindustries/ao-encoding
src/main/java/com/aoindustries/encoding/ChainWriter.java
ChainWriter.printTimeJS
@Deprecated public ChainWriter printTimeJS(long date, Sequence sequence, Appendable scriptOut) throws IOException { """ Writes a JavaScript script tag that a time in the user's locale. Prints <code>&amp;#160;</code> if the date is <code>-1</code>. Writes to the internal <code>PrintWriter</code>. @deprecated @see #writeTimeJavaScript(long) """ return writeTimeJavaScript(date==-1 ? null : new Date(date), sequence, scriptOut); }
java
@Deprecated public ChainWriter printTimeJS(long date, Sequence sequence, Appendable scriptOut) throws IOException { return writeTimeJavaScript(date==-1 ? null : new Date(date), sequence, scriptOut); }
[ "@", "Deprecated", "public", "ChainWriter", "printTimeJS", "(", "long", "date", ",", "Sequence", "sequence", ",", "Appendable", "scriptOut", ")", "throws", "IOException", "{", "return", "writeTimeJavaScript", "(", "date", "==", "-", "1", "?", "null", ":", "new...
Writes a JavaScript script tag that a time in the user's locale. Prints <code>&amp;#160;</code> if the date is <code>-1</code>. Writes to the internal <code>PrintWriter</code>. @deprecated @see #writeTimeJavaScript(long)
[ "Writes", "a", "JavaScript", "script", "tag", "that", "a", "time", "in", "the", "user", "s", "locale", ".", "Prints", "<code", ">", "&amp", ";", "#160", ";", "<", "/", "code", ">", "if", "the", "date", "is", "<code", ">", "-", "1<", "/", "code", ...
train
https://github.com/aoindustries/ao-encoding/blob/54eeb8ff58ab7b44bb02549bbe2572625b449e4e/src/main/java/com/aoindustries/encoding/ChainWriter.java#L961-L964
sagiegurari/fax4j
src/main/java/org/fax4j/spi/http/ApacheHTTPClient.java
ApacheHTTPClient.createStringRequestContent
protected RequestEntity createStringRequestContent(HTTPRequest httpRequest) { """ This function creates a string type request entity and populates it with the data from the provided HTTP request. @param httpRequest The HTTP request @return The request entity """ RequestEntity requestEntity=null; String contentString=httpRequest.getContentAsString(); if(contentString!=null) { try { requestEntity=new StringRequestEntity(contentString,"text/plain",null); } catch(UnsupportedEncodingException exception) { throw new FaxException("Unable to set string request entity.",exception); } } return requestEntity; }
java
protected RequestEntity createStringRequestContent(HTTPRequest httpRequest) { RequestEntity requestEntity=null; String contentString=httpRequest.getContentAsString(); if(contentString!=null) { try { requestEntity=new StringRequestEntity(contentString,"text/plain",null); } catch(UnsupportedEncodingException exception) { throw new FaxException("Unable to set string request entity.",exception); } } return requestEntity; }
[ "protected", "RequestEntity", "createStringRequestContent", "(", "HTTPRequest", "httpRequest", ")", "{", "RequestEntity", "requestEntity", "=", "null", ";", "String", "contentString", "=", "httpRequest", ".", "getContentAsString", "(", ")", ";", "if", "(", "contentStr...
This function creates a string type request entity and populates it with the data from the provided HTTP request. @param httpRequest The HTTP request @return The request entity
[ "This", "function", "creates", "a", "string", "type", "request", "entity", "and", "populates", "it", "with", "the", "data", "from", "the", "provided", "HTTP", "request", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/http/ApacheHTTPClient.java#L282-L299
mfornos/humanize
humanize-icu/src/main/java/humanize/ICUHumanize.java
ICUHumanize.formatCurrency
public static String formatCurrency(final Number value) { """ <p> Smartly formats the given number as a monetary amount. </p> <p> For en_GB: <table border="0" cellspacing="0" cellpadding="3" width="100%"> <tr> <th class="colFirst">Input</th> <th class="colLast">Output</th> </tr> <tr> <td>34</td> <td>"£34"</td> </tr> <tr> <td>1000</td> <td>"£1,000"</td> </tr> <tr> <td>12.5</td> <td>"£12.50"</td> </tr> </table> </p> @param value Number to be formatted @return String representing the monetary amount """ DecimalFormat decf = context.get().getCurrencyFormat(); return stripZeros(decf, decf.format(value)); }
java
public static String formatCurrency(final Number value) { DecimalFormat decf = context.get().getCurrencyFormat(); return stripZeros(decf, decf.format(value)); }
[ "public", "static", "String", "formatCurrency", "(", "final", "Number", "value", ")", "{", "DecimalFormat", "decf", "=", "context", ".", "get", "(", ")", ".", "getCurrencyFormat", "(", ")", ";", "return", "stripZeros", "(", "decf", ",", "decf", ".", "forma...
<p> Smartly formats the given number as a monetary amount. </p> <p> For en_GB: <table border="0" cellspacing="0" cellpadding="3" width="100%"> <tr> <th class="colFirst">Input</th> <th class="colLast">Output</th> </tr> <tr> <td>34</td> <td>"£34"</td> </tr> <tr> <td>1000</td> <td>"£1,000"</td> </tr> <tr> <td>12.5</td> <td>"£12.50"</td> </tr> </table> </p> @param value Number to be formatted @return String representing the monetary amount
[ "<p", ">", "Smartly", "formats", "the", "given", "number", "as", "a", "monetary", "amount", ".", "<", "/", "p", ">" ]
train
https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-icu/src/main/java/humanize/ICUHumanize.java#L630-L634
apereo/cas
support/cas-server-support-wsfederation/src/main/java/org/apereo/cas/support/wsfederation/WsFederationConfiguration.java
WsFederationConfiguration.getAuthorizationUrl
public String getAuthorizationUrl(final String relyingPartyIdentifier, final String wctx) { """ Gets authorization url. @param relyingPartyIdentifier the relying party identifier @param wctx the wctx @return the authorization url """ return String.format(getIdentityProviderUrl() + QUERYSTRING, relyingPartyIdentifier, wctx); }
java
public String getAuthorizationUrl(final String relyingPartyIdentifier, final String wctx) { return String.format(getIdentityProviderUrl() + QUERYSTRING, relyingPartyIdentifier, wctx); }
[ "public", "String", "getAuthorizationUrl", "(", "final", "String", "relyingPartyIdentifier", ",", "final", "String", "wctx", ")", "{", "return", "String", ".", "format", "(", "getIdentityProviderUrl", "(", ")", "+", "QUERYSTRING", ",", "relyingPartyIdentifier", ",",...
Gets authorization url. @param relyingPartyIdentifier the relying party identifier @param wctx the wctx @return the authorization url
[ "Gets", "authorization", "url", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-wsfederation/src/main/java/org/apereo/cas/support/wsfederation/WsFederationConfiguration.java#L137-L139
reactor/reactor-netty
src/main/java/reactor/netty/udp/UdpServer.java
UdpServer.runOn
public final UdpServer runOn(LoopResources channelResources, InternetProtocolFamily family) { """ Run IO loops on a supplied {@link EventLoopGroup} from the {@link LoopResources} container. @param channelResources a {@link LoopResources} accepting native runtime expectation and returning an eventLoopGroup. @param family a specific {@link InternetProtocolFamily} to run with @return a new {@link UdpServer} """ return new UdpServerRunOn(this, channelResources, false, family); }
java
public final UdpServer runOn(LoopResources channelResources, InternetProtocolFamily family) { return new UdpServerRunOn(this, channelResources, false, family); }
[ "public", "final", "UdpServer", "runOn", "(", "LoopResources", "channelResources", ",", "InternetProtocolFamily", "family", ")", "{", "return", "new", "UdpServerRunOn", "(", "this", ",", "channelResources", ",", "false", ",", "family", ")", ";", "}" ]
Run IO loops on a supplied {@link EventLoopGroup} from the {@link LoopResources} container. @param channelResources a {@link LoopResources} accepting native runtime expectation and returning an eventLoopGroup. @param family a specific {@link InternetProtocolFamily} to run with @return a new {@link UdpServer}
[ "Run", "IO", "loops", "on", "a", "supplied", "{", "@link", "EventLoopGroup", "}", "from", "the", "{", "@link", "LoopResources", "}", "container", "." ]
train
https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/udp/UdpServer.java#L354-L356
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/FileInputFormat.java
FileInputFormat.addInputPath
public static void addInputPath(JobConf conf, Path path ) { """ Add a {@link Path} to the list of inputs for the map-reduce job. @param conf The configuration of the job @param path {@link Path} to be added to the list of inputs for the map-reduce job. """ if (!path.isAbsolute()) { FileSystem.LogForCollect.info("set input path to relative path: " + path + " working directory: " + conf.getWorkingDirectory()); } path = new Path(conf.getWorkingDirectory(), path); String dirStr = StringUtils.escapeString(path.toString()); String dirs = conf.get("mapred.input.dir"); conf.set("mapred.input.dir", dirs == null ? dirStr : dirs + StringUtils.COMMA_STR + dirStr); }
java
public static void addInputPath(JobConf conf, Path path ) { if (!path.isAbsolute()) { FileSystem.LogForCollect.info("set input path to relative path: " + path + " working directory: " + conf.getWorkingDirectory()); } path = new Path(conf.getWorkingDirectory(), path); String dirStr = StringUtils.escapeString(path.toString()); String dirs = conf.get("mapred.input.dir"); conf.set("mapred.input.dir", dirs == null ? dirStr : dirs + StringUtils.COMMA_STR + dirStr); }
[ "public", "static", "void", "addInputPath", "(", "JobConf", "conf", ",", "Path", "path", ")", "{", "if", "(", "!", "path", ".", "isAbsolute", "(", ")", ")", "{", "FileSystem", ".", "LogForCollect", ".", "info", "(", "\"set input path to relative path: \"", "...
Add a {@link Path} to the list of inputs for the map-reduce job. @param conf The configuration of the job @param path {@link Path} to be added to the list of inputs for the map-reduce job.
[ "Add", "a", "{", "@link", "Path", "}", "to", "the", "list", "of", "inputs", "for", "the", "map", "-", "reduce", "job", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/FileInputFormat.java#L542-L552
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java
GISTreeSetUtil.classifies
@Pure public static int classifies(AbstractGISTreeSetNode<?, ?> node, GeoLocation location) { """ Replies the classificiation of the specified location. @param node the classification base. @param location the point to classify. @return the classificiation of the specified location inside to the node. """ if (node.getZone() == IcosepQuadTreeZone.ICOSEP) { return classifiesIcocep(node.verticalSplit, node.horizontalSplit, location.toBounds2D()); } return classifiesNonIcocep(node.verticalSplit, node.horizontalSplit, location.toBounds2D()); }
java
@Pure public static int classifies(AbstractGISTreeSetNode<?, ?> node, GeoLocation location) { if (node.getZone() == IcosepQuadTreeZone.ICOSEP) { return classifiesIcocep(node.verticalSplit, node.horizontalSplit, location.toBounds2D()); } return classifiesNonIcocep(node.verticalSplit, node.horizontalSplit, location.toBounds2D()); }
[ "@", "Pure", "public", "static", "int", "classifies", "(", "AbstractGISTreeSetNode", "<", "?", ",", "?", ">", "node", ",", "GeoLocation", "location", ")", "{", "if", "(", "node", ".", "getZone", "(", ")", "==", "IcosepQuadTreeZone", ".", "ICOSEP", ")", "...
Replies the classificiation of the specified location. @param node the classification base. @param location the point to classify. @return the classificiation of the specified location inside to the node.
[ "Replies", "the", "classificiation", "of", "the", "specified", "location", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java#L62-L68
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java
NodeSet.removeNode
public void removeNode(Node n) { """ Remove a node. @param n Node to be added @throws RuntimeException thrown if this NodeSet is not of a mutable type. """ if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); this.removeElement(n); }
java
public void removeNode(Node n) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); this.removeElement(n); }
[ "public", "void", "removeNode", "(", "Node", "n", ")", "{", "if", "(", "!", "m_mutable", ")", "throw", "new", "RuntimeException", "(", "XSLMessages", ".", "createXPATHMessage", "(", "XPATHErrorResources", ".", "ER_NODESET_NOT_MUTABLE", ",", "null", ")", ")", "...
Remove a node. @param n Node to be added @throws RuntimeException thrown if this NodeSet is not of a mutable type.
[ "Remove", "a", "node", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java#L413-L420
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.isProtectedAccessible
private boolean isProtectedAccessible(Symbol sym, ClassSymbol c, Type site) { """ Is given protected symbol accessible if it is selected from given site and the selection takes place in given class? @param sym The symbol with protected access @param c The class where the access takes place @site The type of the qualifier """ Type newSite = site.hasTag(TYPEVAR) ? site.getUpperBound() : site; while (c != null && !(c.isSubClass(sym.owner, types) && (c.flags() & INTERFACE) == 0 && // In JLS 2e 6.6.2.1, the subclass restriction applies // only to instance fields and methods -- types are excluded // regardless of whether they are declared 'static' or not. ((sym.flags() & STATIC) != 0 || sym.kind == TYP || newSite.tsym.isSubClass(c, types)))) c = c.owner.enclClass(); return c != null; }
java
private boolean isProtectedAccessible(Symbol sym, ClassSymbol c, Type site) { Type newSite = site.hasTag(TYPEVAR) ? site.getUpperBound() : site; while (c != null && !(c.isSubClass(sym.owner, types) && (c.flags() & INTERFACE) == 0 && // In JLS 2e 6.6.2.1, the subclass restriction applies // only to instance fields and methods -- types are excluded // regardless of whether they are declared 'static' or not. ((sym.flags() & STATIC) != 0 || sym.kind == TYP || newSite.tsym.isSubClass(c, types)))) c = c.owner.enclClass(); return c != null; }
[ "private", "boolean", "isProtectedAccessible", "(", "Symbol", "sym", ",", "ClassSymbol", "c", ",", "Type", "site", ")", "{", "Type", "newSite", "=", "site", ".", "hasTag", "(", "TYPEVAR", ")", "?", "site", ".", "getUpperBound", "(", ")", ":", "site", ";"...
Is given protected symbol accessible if it is selected from given site and the selection takes place in given class? @param sym The symbol with protected access @param c The class where the access takes place @site The type of the qualifier
[ "Is", "given", "protected", "symbol", "accessible", "if", "it", "is", "selected", "from", "given", "site", "and", "the", "selection", "takes", "place", "in", "given", "class?" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L467-L479
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalReader.java
JournalReader.readJournalEntry
protected ConsumerJournalEntry readJournalEntry(XMLEventReader reader) throws JournalException, XMLStreamException { """ Read a JournalEntry from the journal, to produce a <code>ConsumerJournalEntry</code> instance. Concrete sub-classes should insure that the XMLEventReader is positioned at the beginning of a JournalEntry before calling this method. """ StartElement startTag = getJournalEntryStartTag(reader); String methodName = getRequiredAttributeValue(startTag, QNAME_ATTR_METHOD); JournalEntryContext context = new ContextXmlReader().readContext(reader); ConsumerJournalEntry cje = new ConsumerJournalEntry(methodName, context); readArguments(reader, cje); return cje; }
java
protected ConsumerJournalEntry readJournalEntry(XMLEventReader reader) throws JournalException, XMLStreamException { StartElement startTag = getJournalEntryStartTag(reader); String methodName = getRequiredAttributeValue(startTag, QNAME_ATTR_METHOD); JournalEntryContext context = new ContextXmlReader().readContext(reader); ConsumerJournalEntry cje = new ConsumerJournalEntry(methodName, context); readArguments(reader, cje); return cje; }
[ "protected", "ConsumerJournalEntry", "readJournalEntry", "(", "XMLEventReader", "reader", ")", "throws", "JournalException", ",", "XMLStreamException", "{", "StartElement", "startTag", "=", "getJournalEntryStartTag", "(", "reader", ")", ";", "String", "methodName", "=", ...
Read a JournalEntry from the journal, to produce a <code>ConsumerJournalEntry</code> instance. Concrete sub-classes should insure that the XMLEventReader is positioned at the beginning of a JournalEntry before calling this method.
[ "Read", "a", "JournalEntry", "from", "the", "journal", "to", "produce", "a", "<code", ">", "ConsumerJournalEntry<", "/", "code", ">", "instance", ".", "Concrete", "sub", "-", "classes", "should", "insure", "that", "the", "XMLEventReader", "is", "positioned", "...
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalReader.java#L199-L213
actorapp/actor-platform
actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageScaling.java
ImageScaling.scaleFill
public static Bitmap scaleFill(Bitmap src, int w, int h) { """ Scaling bitmap to fill rect with centering. Method keep aspect ratio. @param src source bitmap @param w width of result @param h height of result @return scaled bitmap """ Bitmap res = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); scaleFill(src, res); return res; }
java
public static Bitmap scaleFill(Bitmap src, int w, int h) { Bitmap res = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); scaleFill(src, res); return res; }
[ "public", "static", "Bitmap", "scaleFill", "(", "Bitmap", "src", ",", "int", "w", ",", "int", "h", ")", "{", "Bitmap", "res", "=", "Bitmap", ".", "createBitmap", "(", "w", ",", "h", ",", "Bitmap", ".", "Config", ".", "ARGB_8888", ")", ";", "scaleFill...
Scaling bitmap to fill rect with centering. Method keep aspect ratio. @param src source bitmap @param w width of result @param h height of result @return scaled bitmap
[ "Scaling", "bitmap", "to", "fill", "rect", "with", "centering", ".", "Method", "keep", "aspect", "ratio", "." ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageScaling.java#L23-L27
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java
HtmlTree.INPUT
public static HtmlTree INPUT(String type, String id) { """ Generates a INPUT tag with some id. @param type the type of input @param id id for the tag @return an HtmlTree object for the INPUT tag """ HtmlTree htmltree = new HtmlTree(HtmlTag.INPUT); htmltree.addAttr(HtmlAttr.TYPE, nullCheck(type)); htmltree.addAttr(HtmlAttr.ID, nullCheck(id)); htmltree.addAttr(HtmlAttr.VALUE, " "); htmltree.addAttr(HtmlAttr.DISABLED, "disabled"); return htmltree; }
java
public static HtmlTree INPUT(String type, String id) { HtmlTree htmltree = new HtmlTree(HtmlTag.INPUT); htmltree.addAttr(HtmlAttr.TYPE, nullCheck(type)); htmltree.addAttr(HtmlAttr.ID, nullCheck(id)); htmltree.addAttr(HtmlAttr.VALUE, " "); htmltree.addAttr(HtmlAttr.DISABLED, "disabled"); return htmltree; }
[ "public", "static", "HtmlTree", "INPUT", "(", "String", "type", ",", "String", "id", ")", "{", "HtmlTree", "htmltree", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "INPUT", ")", ";", "htmltree", ".", "addAttr", "(", "HtmlAttr", ".", "TYPE", ",", "nullChe...
Generates a INPUT tag with some id. @param type the type of input @param id id for the tag @return an HtmlTree object for the INPUT tag
[ "Generates", "a", "INPUT", "tag", "with", "some", "id", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L479-L486
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.println
public static void println(PrintStream self, Object value) { """ Print a value formatted Groovy style (followed by a newline) to the print stream. @param self any Object @param value the value to print @since 1.6.0 """ self.println(InvokerHelper.toString(value)); }
java
public static void println(PrintStream self, Object value) { self.println(InvokerHelper.toString(value)); }
[ "public", "static", "void", "println", "(", "PrintStream", "self", ",", "Object", "value", ")", "{", "self", ".", "println", "(", "InvokerHelper", ".", "toString", "(", "value", ")", ")", ";", "}" ]
Print a value formatted Groovy style (followed by a newline) to the print stream. @param self any Object @param value the value to print @since 1.6.0
[ "Print", "a", "value", "formatted", "Groovy", "style", "(", "followed", "by", "a", "newline", ")", "to", "the", "print", "stream", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L825-L827
GerdHolz/TOVAL
src/de/invation/code/toval/misc/SetUtils.java
SetUtils.getRandomSubsetMin
public static <T> Set<T> getRandomSubsetMin(Set<T> set, int minCount) { """ Generates a random subset of <code>set</code>, that contains at least <code>maxCount</code> elements. @param <T> Type of set elements @param set Basic set for operation @param minCount Minimum number of items @return A subset with at least <code>minCount</code> elements """ int count = RandomUtils.randomIntBetween(minCount, set.size()); return getRandomSubset(set, count); }
java
public static <T> Set<T> getRandomSubsetMin(Set<T> set, int minCount) { int count = RandomUtils.randomIntBetween(minCount, set.size()); return getRandomSubset(set, count); }
[ "public", "static", "<", "T", ">", "Set", "<", "T", ">", "getRandomSubsetMin", "(", "Set", "<", "T", ">", "set", ",", "int", "minCount", ")", "{", "int", "count", "=", "RandomUtils", ".", "randomIntBetween", "(", "minCount", ",", "set", ".", "size", ...
Generates a random subset of <code>set</code>, that contains at least <code>maxCount</code> elements. @param <T> Type of set elements @param set Basic set for operation @param minCount Minimum number of items @return A subset with at least <code>minCount</code> elements
[ "Generates", "a", "random", "subset", "of", "<code", ">", "set<", "/", "code", ">", "that", "contains", "at", "least", "<code", ">", "maxCount<", "/", "code", ">", "elements", "." ]
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/SetUtils.java#L63-L66
hap-java/HAP-Java
src/main/java/io/github/hapjava/impl/pairing/HomekitSRP6ServerSession.java
HomekitSRP6ServerSession.mockStep1
public BigInteger mockStep1(final String userID, final BigInteger s, final BigInteger v) { """ Increments this SRP-6a authentication session to {@link State#STEP_1} indicating a non-existing user identity 'I' with mock (simulated) salt 's' and password verifier 'v' values. <p>This method can be used to avoid informing the client at step one that the user identity is bad and throw instead a guaranteed general "bad credentials" SRP-6a exception at step two. <p>Argument origin: <ul> <li>From client: user identity 'I'. <li>Simulated by server, preferably consistently for the specified identity 'I': salt 's' and password verifier 'v' values. </ul> @param userID The identity 'I' of the authenticating user. Must not be {@code null} or empty. @param s The password salt 's'. Must not be {@code null}. @param v The password verifier 'v'. Must not be {@code null}. @return The server public value 'B'. @throws IllegalStateException If the method is invoked in a state other than {@link State#INIT}. """ noSuchUserIdentity = true; return step1(userID, s, v); }
java
public BigInteger mockStep1(final String userID, final BigInteger s, final BigInteger v) { noSuchUserIdentity = true; return step1(userID, s, v); }
[ "public", "BigInteger", "mockStep1", "(", "final", "String", "userID", ",", "final", "BigInteger", "s", ",", "final", "BigInteger", "v", ")", "{", "noSuchUserIdentity", "=", "true", ";", "return", "step1", "(", "userID", ",", "s", ",", "v", ")", ";", "}"...
Increments this SRP-6a authentication session to {@link State#STEP_1} indicating a non-existing user identity 'I' with mock (simulated) salt 's' and password verifier 'v' values. <p>This method can be used to avoid informing the client at step one that the user identity is bad and throw instead a guaranteed general "bad credentials" SRP-6a exception at step two. <p>Argument origin: <ul> <li>From client: user identity 'I'. <li>Simulated by server, preferably consistently for the specified identity 'I': salt 's' and password verifier 'v' values. </ul> @param userID The identity 'I' of the authenticating user. Must not be {@code null} or empty. @param s The password salt 's'. Must not be {@code null}. @param v The password verifier 'v'. Must not be {@code null}. @return The server public value 'B'. @throws IllegalStateException If the method is invoked in a state other than {@link State#INIT}.
[ "Increments", "this", "SRP", "-", "6a", "authentication", "session", "to", "{", "@link", "State#STEP_1", "}", "indicating", "a", "non", "-", "existing", "user", "identity", "I", "with", "mock", "(", "simulated", ")", "salt", "s", "and", "password", "verifier...
train
https://github.com/hap-java/HAP-Java/blob/d2b2f4f1579580a2b5958af3a192128345843db9/src/main/java/io/github/hapjava/impl/pairing/HomekitSRP6ServerSession.java#L191-L196
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/MachinetagsApi.java
MachinetagsApi.getPredicates
public Predicates getPredicates(String namespace, int perPage, int page, boolean sign) throws JinxException { """ Return a list of unique predicates, optionally limited by a given namespace. <br> This method does not require authentication. namespace (Optional) <br> per_page (Optional) Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500. page (Optional) The page of results to return. If this argument is omitted, it defaults to 1. @param namespace (Optional) Limit the list of predicates returned to those that have this namespace. @param perPage Number of photos to return per page. If this argument is less than 1, it defaults to 100. The maximum allowed value is 500. @param page The page of results to return. If this argument is less than 1, it defaults to 1. @param sign if true, the request will be signed. @return object containing a list of unique predicates. @throws JinxException if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.machinetags.getPredicates.html">flickr.machinetags.getPredicates</a> """ Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.machinetags.getPredicates"); if (!JinxUtils.isNullOrEmpty(namespace)) { params.put("namespace", namespace); } if (perPage > 0) { params.put("per_page", Integer.toString(perPage)); } if (page > 0) { params.put("page", Integer.toString(page)); } return jinx.flickrGet(params, Predicates.class, sign); }
java
public Predicates getPredicates(String namespace, int perPage, int page, boolean sign) throws JinxException { Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.machinetags.getPredicates"); if (!JinxUtils.isNullOrEmpty(namespace)) { params.put("namespace", namespace); } if (perPage > 0) { params.put("per_page", Integer.toString(perPage)); } if (page > 0) { params.put("page", Integer.toString(page)); } return jinx.flickrGet(params, Predicates.class, sign); }
[ "public", "Predicates", "getPredicates", "(", "String", "namespace", ",", "int", "perPage", ",", "int", "page", ",", "boolean", "sign", ")", "throws", "JinxException", "{", "Map", "<", "String", ",", "String", ">", "params", "=", "new", "TreeMap", "<>", "(...
Return a list of unique predicates, optionally limited by a given namespace. <br> This method does not require authentication. namespace (Optional) <br> per_page (Optional) Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500. page (Optional) The page of results to return. If this argument is omitted, it defaults to 1. @param namespace (Optional) Limit the list of predicates returned to those that have this namespace. @param perPage Number of photos to return per page. If this argument is less than 1, it defaults to 100. The maximum allowed value is 500. @param page The page of results to return. If this argument is less than 1, it defaults to 1. @param sign if true, the request will be signed. @return object containing a list of unique predicates. @throws JinxException if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.machinetags.getPredicates.html">flickr.machinetags.getPredicates</a>
[ "Return", "a", "list", "of", "unique", "predicates", "optionally", "limited", "by", "a", "given", "namespace", ".", "<br", ">", "This", "method", "does", "not", "require", "authentication", ".", "namespace", "(", "Optional", ")", "<br", ">", "per_page", "(",...
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/MachinetagsApi.java#L123-L136
molgenis/molgenis
molgenis-data-import/src/main/java/org/molgenis/data/importer/emx/EmxDataProvider.java
EmxDataProvider.toEntity
private Entity toEntity(EntityType entityType, Entity emxEntity) { """ Create an entity from the EMX entity @param entityType entity meta data @param emxEntity EMX entity @return MOLGENIS entity """ Entity entity = entityManager.create(entityType, POPULATE); for (Attribute attr : entityType.getAtomicAttributes()) { if (attr.getExpression() == null && !attr.isMappedBy()) { String attrName = attr.getName(); Object emxValue = emxEntity.get(attrName); AttributeType attrType = attr.getDataType(); switch (attrType) { case BOOL: case DATE: case DATE_TIME: case DECIMAL: case EMAIL: case ENUM: case HTML: case HYPERLINK: case INT: case LONG: case SCRIPT: case STRING: case TEXT: Object value = emxValue != null ? DataConverter.convert(emxValue, attr) : null; if ((!attr.isAuto() || value != null) && (!attr.hasDefaultValue() || value != null)) { entity.set(attrName, value); } break; case CATEGORICAL: case FILE: case XREF: // DataConverter.convert performs no conversion for reference types Entity refEntity = toRefEntity(attr, emxValue); // do not set generated auto refEntities to null if ((!attr.isAuto() || refEntity != null) && (!attr.hasDefaultValue() || refEntity != null)) { entity.set(attrName, refEntity); } break; case CATEGORICAL_MREF: case MREF: // DataConverter.convert performs no conversion for reference types List<Entity> refEntities = toRefEntities(attr, emxValue); // do not set generated auto refEntities to null if (!refEntities.isEmpty()) { entity.set(attrName, refEntities); } break; case COMPOUND: throw new IllegalAttributeTypeException(attrType); default: throw new UnexpectedEnumException(attrType); } } } return entity; }
java
private Entity toEntity(EntityType entityType, Entity emxEntity) { Entity entity = entityManager.create(entityType, POPULATE); for (Attribute attr : entityType.getAtomicAttributes()) { if (attr.getExpression() == null && !attr.isMappedBy()) { String attrName = attr.getName(); Object emxValue = emxEntity.get(attrName); AttributeType attrType = attr.getDataType(); switch (attrType) { case BOOL: case DATE: case DATE_TIME: case DECIMAL: case EMAIL: case ENUM: case HTML: case HYPERLINK: case INT: case LONG: case SCRIPT: case STRING: case TEXT: Object value = emxValue != null ? DataConverter.convert(emxValue, attr) : null; if ((!attr.isAuto() || value != null) && (!attr.hasDefaultValue() || value != null)) { entity.set(attrName, value); } break; case CATEGORICAL: case FILE: case XREF: // DataConverter.convert performs no conversion for reference types Entity refEntity = toRefEntity(attr, emxValue); // do not set generated auto refEntities to null if ((!attr.isAuto() || refEntity != null) && (!attr.hasDefaultValue() || refEntity != null)) { entity.set(attrName, refEntity); } break; case CATEGORICAL_MREF: case MREF: // DataConverter.convert performs no conversion for reference types List<Entity> refEntities = toRefEntities(attr, emxValue); // do not set generated auto refEntities to null if (!refEntities.isEmpty()) { entity.set(attrName, refEntities); } break; case COMPOUND: throw new IllegalAttributeTypeException(attrType); default: throw new UnexpectedEnumException(attrType); } } } return entity; }
[ "private", "Entity", "toEntity", "(", "EntityType", "entityType", ",", "Entity", "emxEntity", ")", "{", "Entity", "entity", "=", "entityManager", ".", "create", "(", "entityType", ",", "POPULATE", ")", ";", "for", "(", "Attribute", "attr", ":", "entityType", ...
Create an entity from the EMX entity @param entityType entity meta data @param emxEntity EMX entity @return MOLGENIS entity
[ "Create", "an", "entity", "from", "the", "EMX", "entity" ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-import/src/main/java/org/molgenis/data/importer/emx/EmxDataProvider.java#L84-L141
esigate/esigate
esigate-core/src/main/java/org/esigate/Driver.java
Driver.logAction
private void logAction(String action, String onUrl, Renderer[] renderers) { """ Log current provider, page and renderers that will be applied. <p> This methods log at the INFO level. <p> You should only call this method if INFO level is enabled. <pre> if (LOG.isInfoEnabled()) { logAction(pageUrl, renderers); } </pre> @param action Action name (eg. "proxy" or "render") @param onUrl current page url. @param renderers array of renderers """ if (LOG.isInfoEnabled()) { List<String> rendererNames = new ArrayList<>(renderers.length); for (Renderer renderer : renderers) { rendererNames.add(renderer.getClass().getName()); } LOG.info("{} provider={} page= {} renderers={}", action, this.config.getInstanceName(), onUrl, rendererNames); } }
java
private void logAction(String action, String onUrl, Renderer[] renderers) { if (LOG.isInfoEnabled()) { List<String> rendererNames = new ArrayList<>(renderers.length); for (Renderer renderer : renderers) { rendererNames.add(renderer.getClass().getName()); } LOG.info("{} provider={} page= {} renderers={}", action, this.config.getInstanceName(), onUrl, rendererNames); } }
[ "private", "void", "logAction", "(", "String", "action", ",", "String", "onUrl", ",", "Renderer", "[", "]", "renderers", ")", "{", "if", "(", "LOG", ".", "isInfoEnabled", "(", ")", ")", "{", "List", "<", "String", ">", "rendererNames", "=", "new", "Arr...
Log current provider, page and renderers that will be applied. <p> This methods log at the INFO level. <p> You should only call this method if INFO level is enabled. <pre> if (LOG.isInfoEnabled()) { logAction(pageUrl, renderers); } </pre> @param action Action name (eg. "proxy" or "render") @param onUrl current page url. @param renderers array of renderers
[ "Log", "current", "provider", "page", "and", "renderers", "that", "will", "be", "applied", ".", "<p", ">", "This", "methods", "log", "at", "the", "INFO", "level", ".", "<p", ">", "You", "should", "only", "call", "this", "method", "if", "INFO", "level", ...
train
https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/Driver.java#L243-L252
qiniu/java-sdk
src/main/java/com/qiniu/storage/BucketManager.java
BucketManager.deleteAfterDays
public Response deleteAfterDays(String bucket, String key, int days) throws QiniuException { """ 设置文件的存活时间 @param bucket 空间名称 @param key 文件名称 @param days 存活时间,单位:天 """ return rsPost(bucket, String.format("/deleteAfterDays/%s/%d", encodedEntry(bucket, key), days), null); }
java
public Response deleteAfterDays(String bucket, String key, int days) throws QiniuException { return rsPost(bucket, String.format("/deleteAfterDays/%s/%d", encodedEntry(bucket, key), days), null); }
[ "public", "Response", "deleteAfterDays", "(", "String", "bucket", ",", "String", "key", ",", "int", "days", ")", "throws", "QiniuException", "{", "return", "rsPost", "(", "bucket", ",", "String", ".", "format", "(", "\"/deleteAfterDays/%s/%d\"", ",", "encodedEnt...
设置文件的存活时间 @param bucket 空间名称 @param key 文件名称 @param days 存活时间,单位:天
[ "设置文件的存活时间" ]
train
https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/storage/BucketManager.java#L594-L596
Netflix/governator
governator-core/src/main/java/com/netflix/governator/internal/PreDestroyMonitor.java
PreDestroyMonitor.addScopeBindings
public void addScopeBindings(Map<Class<? extends Annotation>, Scope> bindings) { """ allows late-binding of scopes to PreDestroyMonitor, useful if more than one Injector contributes scope bindings @param bindings additional annotation-to-scope bindings to add """ if (scopeCleaner.isRunning()) { scopeBindings.putAll(bindings); } }
java
public void addScopeBindings(Map<Class<? extends Annotation>, Scope> bindings) { if (scopeCleaner.isRunning()) { scopeBindings.putAll(bindings); } }
[ "public", "void", "addScopeBindings", "(", "Map", "<", "Class", "<", "?", "extends", "Annotation", ">", ",", "Scope", ">", "bindings", ")", "{", "if", "(", "scopeCleaner", ".", "isRunning", "(", ")", ")", "{", "scopeBindings", ".", "putAll", "(", "bindin...
allows late-binding of scopes to PreDestroyMonitor, useful if more than one Injector contributes scope bindings @param bindings additional annotation-to-scope bindings to add
[ "allows", "late", "-", "binding", "of", "scopes", "to", "PreDestroyMonitor", "useful", "if", "more", "than", "one", "Injector", "contributes", "scope", "bindings" ]
train
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-core/src/main/java/com/netflix/governator/internal/PreDestroyMonitor.java#L181-L185
amzn/ion-java
src/com/amazon/ion/impl/IonUTF8.java
IonUTF8.getScalarFromBytes
public final static int getScalarFromBytes(byte[] bytes, int offset, int maxLength) { """ this helper converts the bytes starting at offset from UTF8 to a Unicode scalar. This does not check for valid Unicode scalar ranges but simply handle the UTF8 decoding. getScalarReadLengthFromBytes can be used to determine how many bytes would be converted (consumed) in this process if the same parameters are passed in. This will throw ArrayIndexOutOfBoundsException if the array has too few bytes to fully decode the scalar. It will throw InvalidUnicodeCodePoint if the first byte isn't a valid UTF8 initial byte with a length of 4 or less. @param bytes UTF8 bytes in an array @param offset initial array element to decode from @param maxLength maximum number of bytes to consume from the array @return Unicode scalar """ int src = offset; int end = offset + maxLength; if (src >= end) throw new ArrayIndexOutOfBoundsException(); int c = bytes[src++] & 0xff; int utf8length = getUTF8LengthFromFirstByte(c); if (src + utf8length > end) throw new ArrayIndexOutOfBoundsException(); switch (utf8length) { case 1: break; case 2: c = (c & UNICODE_TWO_BYTE_MASK); c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK); break; case 3: c = (c & UNICODE_THREE_BYTE_MASK); c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK); c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK); break; case 4: c = (c & UNICODE_FOUR_BYTE_MASK); c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK); c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK); c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK); break; default: throw new InvalidUnicodeCodePoint("code point is invalid: "+utf8length); } return c; }
java
public final static int getScalarFromBytes(byte[] bytes, int offset, int maxLength) { int src = offset; int end = offset + maxLength; if (src >= end) throw new ArrayIndexOutOfBoundsException(); int c = bytes[src++] & 0xff; int utf8length = getUTF8LengthFromFirstByte(c); if (src + utf8length > end) throw new ArrayIndexOutOfBoundsException(); switch (utf8length) { case 1: break; case 2: c = (c & UNICODE_TWO_BYTE_MASK); c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK); break; case 3: c = (c & UNICODE_THREE_BYTE_MASK); c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK); c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK); break; case 4: c = (c & UNICODE_FOUR_BYTE_MASK); c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK); c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK); c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK); break; default: throw new InvalidUnicodeCodePoint("code point is invalid: "+utf8length); } return c; }
[ "public", "final", "static", "int", "getScalarFromBytes", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ",", "int", "maxLength", ")", "{", "int", "src", "=", "offset", ";", "int", "end", "=", "offset", "+", "maxLength", ";", "if", "(", "src", ...
this helper converts the bytes starting at offset from UTF8 to a Unicode scalar. This does not check for valid Unicode scalar ranges but simply handle the UTF8 decoding. getScalarReadLengthFromBytes can be used to determine how many bytes would be converted (consumed) in this process if the same parameters are passed in. This will throw ArrayIndexOutOfBoundsException if the array has too few bytes to fully decode the scalar. It will throw InvalidUnicodeCodePoint if the first byte isn't a valid UTF8 initial byte with a length of 4 or less. @param bytes UTF8 bytes in an array @param offset initial array element to decode from @param maxLength maximum number of bytes to consume from the array @return Unicode scalar
[ "this", "helper", "converts", "the", "bytes", "starting", "at", "offset", "from", "UTF8", "to", "a", "Unicode", "scalar", ".", "This", "does", "not", "check", "for", "valid", "Unicode", "scalar", "ranges", "but", "simply", "handle", "the", "UTF8", "decoding"...
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonUTF8.java#L346-L378
lessthanoptimal/BoofCV
integration/boofcv-swing/src/main/java/boofcv/gui/feature/VisualizeShapes.java
VisualizeShapes.drawPolygon
public static<T extends Point2D_I32> void drawPolygon( List<T> vertexes , boolean loop, Graphics2D g2 ) { """ Draws a polygon @param vertexes List of vertices in the polygon @param loop true if the end points are connected, forming a loop @param g2 Graphics object it's drawn to """ for( int i = 0; i < vertexes.size()-1; i++ ) { Point2D_I32 p0 = vertexes.get(i); Point2D_I32 p1 = vertexes.get(i+1); g2.drawLine(p0.x,p0.y,p1.x,p1.y); } if( loop && vertexes.size() > 0) { Point2D_I32 p0 = vertexes.get(0); Point2D_I32 p1 = vertexes.get(vertexes.size()-1); g2.drawLine(p0.x,p0.y,p1.x,p1.y); } }
java
public static<T extends Point2D_I32> void drawPolygon( List<T> vertexes , boolean loop, Graphics2D g2 ) { for( int i = 0; i < vertexes.size()-1; i++ ) { Point2D_I32 p0 = vertexes.get(i); Point2D_I32 p1 = vertexes.get(i+1); g2.drawLine(p0.x,p0.y,p1.x,p1.y); } if( loop && vertexes.size() > 0) { Point2D_I32 p0 = vertexes.get(0); Point2D_I32 p1 = vertexes.get(vertexes.size()-1); g2.drawLine(p0.x,p0.y,p1.x,p1.y); } }
[ "public", "static", "<", "T", "extends", "Point2D_I32", ">", "void", "drawPolygon", "(", "List", "<", "T", ">", "vertexes", ",", "boolean", "loop", ",", "Graphics2D", "g2", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "vertexes", ".", ...
Draws a polygon @param vertexes List of vertices in the polygon @param loop true if the end points are connected, forming a loop @param g2 Graphics object it's drawn to
[ "Draws", "a", "polygon" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/feature/VisualizeShapes.java#L166-L177
getlantern/kaleidoscope
src/main/java/org/kaleidoscope/LocalTrustGraph.java
LocalTrustGraph.addRoute
public void addRoute(final TrustGraphNodeId a, final TrustGraphNodeId b) { """ create a bidirectional trust link between the nodes with ids 'a' and 'b' @param a id of node that will form a trust link with 'b' @param b id of node that will form a trust link with 'a' """ addDirectedRoute(a,b); addDirectedRoute(b,a); }
java
public void addRoute(final TrustGraphNodeId a, final TrustGraphNodeId b) { addDirectedRoute(a,b); addDirectedRoute(b,a); }
[ "public", "void", "addRoute", "(", "final", "TrustGraphNodeId", "a", ",", "final", "TrustGraphNodeId", "b", ")", "{", "addDirectedRoute", "(", "a", ",", "b", ")", ";", "addDirectedRoute", "(", "b", ",", "a", ")", ";", "}" ]
create a bidirectional trust link between the nodes with ids 'a' and 'b' @param a id of node that will form a trust link with 'b' @param b id of node that will form a trust link with 'a'
[ "create", "a", "bidirectional", "trust", "link", "between", "the", "nodes", "with", "ids", "a", "and", "b" ]
train
https://github.com/getlantern/kaleidoscope/blob/7516f05724c8f54e5d535d23da9116817c08a09f/src/main/java/org/kaleidoscope/LocalTrustGraph.java#L260-L263
cybazeitalia/emaze-dysfunctional
src/main/java/net/emaze/dysfunctional/Spies.java
Spies.spy1st
public static <R, T> Function<T, R> spy1st(Function<T, R> function, Box<T> param) { """ Proxies a function spying for parameter. @param <R> the function result type @param <T> the function parameter type @param function the function that will be spied @param param a box that will be containing spied parameter @return the proxied function """ return spy(function, Box.<R>empty(), param); }
java
public static <R, T> Function<T, R> spy1st(Function<T, R> function, Box<T> param) { return spy(function, Box.<R>empty(), param); }
[ "public", "static", "<", "R", ",", "T", ">", "Function", "<", "T", ",", "R", ">", "spy1st", "(", "Function", "<", "T", ",", "R", ">", "function", ",", "Box", "<", "T", ">", "param", ")", "{", "return", "spy", "(", "function", ",", "Box", ".", ...
Proxies a function spying for parameter. @param <R> the function result type @param <T> the function parameter type @param function the function that will be spied @param param a box that will be containing spied parameter @return the proxied function
[ "Proxies", "a", "function", "spying", "for", "parameter", "." ]
train
https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Spies.java#L307-L309
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java
JobsImpl.listFromJobScheduleAsync
public ServiceFuture<List<CloudJob>> listFromJobScheduleAsync(final String jobScheduleId, final JobListFromJobScheduleOptions jobListFromJobScheduleOptions, final ListOperationCallback<CloudJob> serviceCallback) { """ Lists the jobs that have been created under the specified job schedule. @param jobScheduleId The ID of the job schedule from which you want to get a list of jobs. @param jobListFromJobScheduleOptions Additional parameters for the 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 AzureServiceFuture.fromHeaderPageResponse( listFromJobScheduleSinglePageAsync(jobScheduleId, jobListFromJobScheduleOptions), new Func1<String, Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>> call(String nextPageLink) { JobListFromJobScheduleNextOptions jobListFromJobScheduleNextOptions = null; if (jobListFromJobScheduleOptions != null) { jobListFromJobScheduleNextOptions = new JobListFromJobScheduleNextOptions(); jobListFromJobScheduleNextOptions.withClientRequestId(jobListFromJobScheduleOptions.clientRequestId()); jobListFromJobScheduleNextOptions.withReturnClientRequestId(jobListFromJobScheduleOptions.returnClientRequestId()); jobListFromJobScheduleNextOptions.withOcpDate(jobListFromJobScheduleOptions.ocpDate()); } return listFromJobScheduleNextSinglePageAsync(nextPageLink, jobListFromJobScheduleNextOptions); } }, serviceCallback); }
java
public ServiceFuture<List<CloudJob>> listFromJobScheduleAsync(final String jobScheduleId, final JobListFromJobScheduleOptions jobListFromJobScheduleOptions, final ListOperationCallback<CloudJob> serviceCallback) { return AzureServiceFuture.fromHeaderPageResponse( listFromJobScheduleSinglePageAsync(jobScheduleId, jobListFromJobScheduleOptions), new Func1<String, Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>> call(String nextPageLink) { JobListFromJobScheduleNextOptions jobListFromJobScheduleNextOptions = null; if (jobListFromJobScheduleOptions != null) { jobListFromJobScheduleNextOptions = new JobListFromJobScheduleNextOptions(); jobListFromJobScheduleNextOptions.withClientRequestId(jobListFromJobScheduleOptions.clientRequestId()); jobListFromJobScheduleNextOptions.withReturnClientRequestId(jobListFromJobScheduleOptions.returnClientRequestId()); jobListFromJobScheduleNextOptions.withOcpDate(jobListFromJobScheduleOptions.ocpDate()); } return listFromJobScheduleNextSinglePageAsync(nextPageLink, jobListFromJobScheduleNextOptions); } }, serviceCallback); }
[ "public", "ServiceFuture", "<", "List", "<", "CloudJob", ">", ">", "listFromJobScheduleAsync", "(", "final", "String", "jobScheduleId", ",", "final", "JobListFromJobScheduleOptions", "jobListFromJobScheduleOptions", ",", "final", "ListOperationCallback", "<", "CloudJob", ...
Lists the jobs that have been created under the specified job schedule. @param jobScheduleId The ID of the job schedule from which you want to get a list of jobs. @param jobListFromJobScheduleOptions Additional parameters for the 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
[ "Lists", "the", "jobs", "that", "have", "been", "created", "under", "the", "specified", "job", "schedule", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L2661-L2678
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/layout/UIManager.java
UIManager.findConfiguredRenderer
private Renderer findConfiguredRenderer(final WComponent component, final String rendererPackage) { """ Attempts to find the configured renderer for the given output format and component. @param component the component to find a manager for. @param rendererPackage the package containing the renderers. @return the Renderer for the component, or null if there is no renderer defined. """ Renderer renderer = null; // We loop for each WComponent in the class hierarchy, as the // Renderer may have been specified at a higher level. for (Class<?> c = component.getClass(); renderer == null && c != null && !AbstractWComponent.class. equals(c); c = c.getSuperclass()) { String qualifiedClassName = c.getName(); // Is there an override for this class? String rendererName = ConfigurationProperties.getRendererOverride(qualifiedClassName); if (rendererName != null) { renderer = createRenderer(rendererName); if (renderer == null) { LOG.warn( "Layout Manager \"" + rendererName + "\" specified for " + qualifiedClassName + " was not found"); } else { return renderer; } } renderer = findRendererFactory(rendererPackage).getRenderer(c); } return renderer; }
java
private Renderer findConfiguredRenderer(final WComponent component, final String rendererPackage) { Renderer renderer = null; // We loop for each WComponent in the class hierarchy, as the // Renderer may have been specified at a higher level. for (Class<?> c = component.getClass(); renderer == null && c != null && !AbstractWComponent.class. equals(c); c = c.getSuperclass()) { String qualifiedClassName = c.getName(); // Is there an override for this class? String rendererName = ConfigurationProperties.getRendererOverride(qualifiedClassName); if (rendererName != null) { renderer = createRenderer(rendererName); if (renderer == null) { LOG.warn( "Layout Manager \"" + rendererName + "\" specified for " + qualifiedClassName + " was not found"); } else { return renderer; } } renderer = findRendererFactory(rendererPackage).getRenderer(c); } return renderer; }
[ "private", "Renderer", "findConfiguredRenderer", "(", "final", "WComponent", "component", ",", "final", "String", "rendererPackage", ")", "{", "Renderer", "renderer", "=", "null", ";", "// We loop for each WComponent in the class hierarchy, as the", "// Renderer may have been s...
Attempts to find the configured renderer for the given output format and component. @param component the component to find a manager for. @param rendererPackage the package containing the renderers. @return the Renderer for the component, or null if there is no renderer defined.
[ "Attempts", "to", "find", "the", "configured", "renderer", "for", "the", "given", "output", "format", "and", "component", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/layout/UIManager.java#L253-L280
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/operators/BatchTask.java
BatchTask.instantiateUserCode
public static <T> T instantiateUserCode(TaskConfig config, ClassLoader cl, Class<? super T> superClass) { """ Instantiates a user code class from is definition in the task configuration. The class is instantiated without arguments using the null-ary constructor. Instantiation will fail if this constructor does not exist or is not public. @param <T> The generic type of the user code class. @param config The task configuration containing the class description. @param cl The class loader to be used to load the class. @param superClass The super class that the user code class extends or implements, for type checking. @return An instance of the user code class. """ try { T stub = config.<T>getStubWrapper(cl).getUserCodeObject(superClass, cl); // check if the class is a subclass, if the check is required if (superClass != null && !superClass.isAssignableFrom(stub.getClass())) { throw new RuntimeException("The class '" + stub.getClass().getName() + "' is not a subclass of '" + superClass.getName() + "' as is required."); } return stub; } catch (ClassCastException ccex) { throw new RuntimeException("The UDF class is not a proper subclass of " + superClass.getName(), ccex); } }
java
public static <T> T instantiateUserCode(TaskConfig config, ClassLoader cl, Class<? super T> superClass) { try { T stub = config.<T>getStubWrapper(cl).getUserCodeObject(superClass, cl); // check if the class is a subclass, if the check is required if (superClass != null && !superClass.isAssignableFrom(stub.getClass())) { throw new RuntimeException("The class '" + stub.getClass().getName() + "' is not a subclass of '" + superClass.getName() + "' as is required."); } return stub; } catch (ClassCastException ccex) { throw new RuntimeException("The UDF class is not a proper subclass of " + superClass.getName(), ccex); } }
[ "public", "static", "<", "T", ">", "T", "instantiateUserCode", "(", "TaskConfig", "config", ",", "ClassLoader", "cl", ",", "Class", "<", "?", "super", "T", ">", "superClass", ")", "{", "try", "{", "T", "stub", "=", "config", ".", "<", "T", ">", "getS...
Instantiates a user code class from is definition in the task configuration. The class is instantiated without arguments using the null-ary constructor. Instantiation will fail if this constructor does not exist or is not public. @param <T> The generic type of the user code class. @param config The task configuration containing the class description. @param cl The class loader to be used to load the class. @param superClass The super class that the user code class extends or implements, for type checking. @return An instance of the user code class.
[ "Instantiates", "a", "user", "code", "class", "from", "is", "definition", "in", "the", "task", "configuration", ".", "The", "class", "is", "instantiated", "without", "arguments", "using", "the", "null", "-", "ary", "constructor", ".", "Instantiation", "will", ...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/BatchTask.java#L1446-L1459
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/cluster/ClusterDistributionChannelWriter.java
ClusterDistributionChannelWriter.getIntent
static Intent getIntent(Collection<? extends RedisCommand<?, ?, ?>> commands) { """ Optimization: Determine command intents and optimize for bulk execution preferring one node. <p> If there is only one intent, then we take the intent derived from the commands. If there is more than one intent, then use {@link Intent#WRITE}. @param commands {@link Collection} of {@link RedisCommand commands}. @return the intent. """ boolean w = false; boolean r = false; Intent singleIntent = Intent.WRITE; for (RedisCommand<?, ?, ?> command : commands) { if (command instanceof ClusterCommand) { continue; } singleIntent = getIntent(command.getType()); if (singleIntent == Intent.READ) { r = true; } if (singleIntent == Intent.WRITE) { w = true; } if (r && w) { return Intent.WRITE; } } return singleIntent; }
java
static Intent getIntent(Collection<? extends RedisCommand<?, ?, ?>> commands) { boolean w = false; boolean r = false; Intent singleIntent = Intent.WRITE; for (RedisCommand<?, ?, ?> command : commands) { if (command instanceof ClusterCommand) { continue; } singleIntent = getIntent(command.getType()); if (singleIntent == Intent.READ) { r = true; } if (singleIntent == Intent.WRITE) { w = true; } if (r && w) { return Intent.WRITE; } } return singleIntent; }
[ "static", "Intent", "getIntent", "(", "Collection", "<", "?", "extends", "RedisCommand", "<", "?", ",", "?", ",", "?", ">", ">", "commands", ")", "{", "boolean", "w", "=", "false", ";", "boolean", "r", "=", "false", ";", "Intent", "singleIntent", "=", ...
Optimization: Determine command intents and optimize for bulk execution preferring one node. <p> If there is only one intent, then we take the intent derived from the commands. If there is more than one intent, then use {@link Intent#WRITE}. @param commands {@link Collection} of {@link RedisCommand commands}. @return the intent.
[ "Optimization", ":", "Determine", "command", "intents", "and", "optimize", "for", "bulk", "execution", "preferring", "one", "node", ".", "<p", ">", "If", "there", "is", "only", "one", "intent", "then", "we", "take", "the", "intent", "derived", "from", "the",...
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/cluster/ClusterDistributionChannelWriter.java#L269-L296
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.health/src/com/ibm/ws/microprofile/health/internal/AppTrackerImpl.java
AppTrackerImpl.setAppModuleNames
private AppModuleName setAppModuleNames(IServletContext isc) { """ /* collect all app and module names and save it for later use """ WebAppConfig webAppConfig = isc.getWebAppConfig(); if (webAppConfig.isSystemApp()) { Tr.debug(tc, "Detected system app so won't track for health check; appName = ", webAppConfig.getApplicationName()); return null; } if (isOsgiApp(isc)) { Tr.debug(tc, "Detected OSGi app, so won't track for health check; appName = ", webAppConfig.getApplicationName()); return null; } WebModuleMetaData webModuleMetaData = ((WebAppConfigExtended) webAppConfig).getMetaData(); String appName = webModuleMetaData.getApplicationMetaData().getName(); String moduleName = webModuleMetaData.getJ2EEName().toString(); return addAppModuleNames(appName, moduleName); }
java
private AppModuleName setAppModuleNames(IServletContext isc) { WebAppConfig webAppConfig = isc.getWebAppConfig(); if (webAppConfig.isSystemApp()) { Tr.debug(tc, "Detected system app so won't track for health check; appName = ", webAppConfig.getApplicationName()); return null; } if (isOsgiApp(isc)) { Tr.debug(tc, "Detected OSGi app, so won't track for health check; appName = ", webAppConfig.getApplicationName()); return null; } WebModuleMetaData webModuleMetaData = ((WebAppConfigExtended) webAppConfig).getMetaData(); String appName = webModuleMetaData.getApplicationMetaData().getName(); String moduleName = webModuleMetaData.getJ2EEName().toString(); return addAppModuleNames(appName, moduleName); }
[ "private", "AppModuleName", "setAppModuleNames", "(", "IServletContext", "isc", ")", "{", "WebAppConfig", "webAppConfig", "=", "isc", ".", "getWebAppConfig", "(", ")", ";", "if", "(", "webAppConfig", ".", "isSystemApp", "(", ")", ")", "{", "Tr", ".", "debug", ...
/* collect all app and module names and save it for later use
[ "/", "*", "collect", "all", "app", "and", "module", "names", "and", "save", "it", "for", "later", "use" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.health/src/com/ibm/ws/microprofile/health/internal/AppTrackerImpl.java#L99-L117
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/EvaluationCalibration.java
EvaluationCalibration.getReliabilityDiagram
public ReliabilityDiagram getReliabilityDiagram(int classIdx) { """ Get the reliability diagram for the specified class @param classIdx Index of the class to get the reliability diagram for """ INDArray totalCountBins = rDiagBinTotalCount.getColumn(classIdx); INDArray countPositiveBins = rDiagBinPosCount.getColumn(classIdx); double[] meanPredictionBins = rDiagBinSumPredictions.getColumn(classIdx).castTo(DataType.DOUBLE) .div(totalCountBins.castTo(DataType.DOUBLE)).data().asDouble(); double[] fracPositives = countPositiveBins.castTo(DataType.DOUBLE).div(totalCountBins.castTo(DataType.DOUBLE)).data().asDouble(); if (excludeEmptyBins) { val condition = new MatchCondition(totalCountBins, Conditions.equals(0)); int numZeroBins = Nd4j.getExecutioner().exec(condition).getInt(0); if (numZeroBins != 0) { double[] mpb = meanPredictionBins; double[] fp = fracPositives; // FIXME: int cast meanPredictionBins = new double[(int) (totalCountBins.length() - numZeroBins)]; fracPositives = new double[meanPredictionBins.length]; int j = 0; for (int i = 0; i < mpb.length; i++) { if (totalCountBins.getDouble(i) != 0) { meanPredictionBins[j] = mpb[i]; fracPositives[j] = fp[i]; j++; } } } } String title = "Reliability Diagram: Class " + classIdx; return new ReliabilityDiagram(title, meanPredictionBins, fracPositives); }
java
public ReliabilityDiagram getReliabilityDiagram(int classIdx) { INDArray totalCountBins = rDiagBinTotalCount.getColumn(classIdx); INDArray countPositiveBins = rDiagBinPosCount.getColumn(classIdx); double[] meanPredictionBins = rDiagBinSumPredictions.getColumn(classIdx).castTo(DataType.DOUBLE) .div(totalCountBins.castTo(DataType.DOUBLE)).data().asDouble(); double[] fracPositives = countPositiveBins.castTo(DataType.DOUBLE).div(totalCountBins.castTo(DataType.DOUBLE)).data().asDouble(); if (excludeEmptyBins) { val condition = new MatchCondition(totalCountBins, Conditions.equals(0)); int numZeroBins = Nd4j.getExecutioner().exec(condition).getInt(0); if (numZeroBins != 0) { double[] mpb = meanPredictionBins; double[] fp = fracPositives; // FIXME: int cast meanPredictionBins = new double[(int) (totalCountBins.length() - numZeroBins)]; fracPositives = new double[meanPredictionBins.length]; int j = 0; for (int i = 0; i < mpb.length; i++) { if (totalCountBins.getDouble(i) != 0) { meanPredictionBins[j] = mpb[i]; fracPositives[j] = fp[i]; j++; } } } } String title = "Reliability Diagram: Class " + classIdx; return new ReliabilityDiagram(title, meanPredictionBins, fracPositives); }
[ "public", "ReliabilityDiagram", "getReliabilityDiagram", "(", "int", "classIdx", ")", "{", "INDArray", "totalCountBins", "=", "rDiagBinTotalCount", ".", "getColumn", "(", "classIdx", ")", ";", "INDArray", "countPositiveBins", "=", "rDiagBinPosCount", ".", "getColumn", ...
Get the reliability diagram for the specified class @param classIdx Index of the class to get the reliability diagram for
[ "Get", "the", "reliability", "diagram", "for", "the", "specified", "class" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/EvaluationCalibration.java#L371-L403
before/uadetector
modules/uadetector-core/src/main/java/net/sf/uadetector/datastore/AbstractUpdateOperation.java
AbstractUpdateOperation.retrieveRemoteVersion
@Nullable private static String retrieveRemoteVersion(@Nonnull final URL url, @Nonnull final Charset charset) throws IOException { """ Reads the current User-Agent data version from <a href="http://data.udger.com">http://data.udger.com</a>. @param url a URL which the version information can be loaded @return a version string or {@code null} @throws IOException if an I/O exception occurs """ final InputStream stream = url.openStream(); final InputStreamReader reader = new InputStreamReader(stream, charset); final LineNumberReader lnr = new LineNumberReader(reader); final String line = lnr.readLine(); lnr.close(); reader.close(); stream.close(); return line; }
java
@Nullable private static String retrieveRemoteVersion(@Nonnull final URL url, @Nonnull final Charset charset) throws IOException { final InputStream stream = url.openStream(); final InputStreamReader reader = new InputStreamReader(stream, charset); final LineNumberReader lnr = new LineNumberReader(reader); final String line = lnr.readLine(); lnr.close(); reader.close(); stream.close(); return line; }
[ "@", "Nullable", "private", "static", "String", "retrieveRemoteVersion", "(", "@", "Nonnull", "final", "URL", "url", ",", "@", "Nonnull", "final", "Charset", "charset", ")", "throws", "IOException", "{", "final", "InputStream", "stream", "=", "url", ".", "open...
Reads the current User-Agent data version from <a href="http://data.udger.com">http://data.udger.com</a>. @param url a URL which the version information can be loaded @return a version string or {@code null} @throws IOException if an I/O exception occurs
[ "Reads", "the", "current", "User", "-", "Agent", "data", "version", "from", "<a", "href", "=", "http", ":", "//", "data", ".", "udger", ".", "com", ">", "http", ":", "//", "data", ".", "udger", ".", "com<", "/", "a", ">", "." ]
train
https://github.com/before/uadetector/blob/215fb652723c52866572cff885f52a3fe67b9db5/modules/uadetector-core/src/main/java/net/sf/uadetector/datastore/AbstractUpdateOperation.java#L117-L127
undera/jmeter-plugins
plugins/csvars/src/main/java/kg/apc/jmeter/config/VariableFromCsvFileReader.java
VariableFromCsvFileReader.getDataAsMap
public Map<String, String> getDataAsMap(String prefix, String separator) { """ Parses (name, value) pairs from the input and returns the result as a Map. The name is taken from the first column and value from the second column. If an input line contains only one column its value is defaulted to an empty string. Any extra columns are ignored. @param prefix a prefix to apply to the mapped variable names @param separator the field delimiter @return a map of (name, value) pairs """ return getDataAsMap(prefix, separator, 0); }
java
public Map<String, String> getDataAsMap(String prefix, String separator) { return getDataAsMap(prefix, separator, 0); }
[ "public", "Map", "<", "String", ",", "String", ">", "getDataAsMap", "(", "String", "prefix", ",", "String", "separator", ")", "{", "return", "getDataAsMap", "(", "prefix", ",", "separator", ",", "0", ")", ";", "}" ]
Parses (name, value) pairs from the input and returns the result as a Map. The name is taken from the first column and value from the second column. If an input line contains only one column its value is defaulted to an empty string. Any extra columns are ignored. @param prefix a prefix to apply to the mapped variable names @param separator the field delimiter @return a map of (name, value) pairs
[ "Parses", "(", "name", "value", ")", "pairs", "from", "the", "input", "and", "returns", "the", "result", "as", "a", "Map", ".", "The", "name", "is", "taken", "from", "the", "first", "column", "and", "value", "from", "the", "second", "column", ".", "If"...
train
https://github.com/undera/jmeter-plugins/blob/416d2a77249ab921c7e4134c3e6a9639901ef7e8/plugins/csvars/src/main/java/kg/apc/jmeter/config/VariableFromCsvFileReader.java#L49-L51
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/PropsCodeGen.java
PropsCodeGen.importConfigProperty
protected void importConfigProperty(Definition def, Writer out) throws IOException { """ import ConfigProperty @param def definition @param out Writer @throws IOException IOException """ if (getConfigProps(def).size() > 0) { out.write("import javax.resource.spi.ConfigProperty;\n"); } }
java
protected void importConfigProperty(Definition def, Writer out) throws IOException { if (getConfigProps(def).size() > 0) { out.write("import javax.resource.spi.ConfigProperty;\n"); } }
[ "protected", "void", "importConfigProperty", "(", "Definition", "def", ",", "Writer", "out", ")", "throws", "IOException", "{", "if", "(", "getConfigProps", "(", "def", ")", ".", "size", "(", ")", ">", "0", ")", "{", "out", ".", "write", "(", "\"import j...
import ConfigProperty @param def definition @param out Writer @throws IOException IOException
[ "import", "ConfigProperty" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/PropsCodeGen.java#L243-L249
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.serviceName_pca_pcaServiceName_billing_billingId_GET
public OvhBilling serviceName_pca_pcaServiceName_billing_billingId_GET(String serviceName, String pcaServiceName, Long billingId) throws IOException { """ Get this object properties REST: GET /cloud/{serviceName}/pca/{pcaServiceName}/billing/{billingId} @param serviceName [required] The internal name of your public cloud passport @param pcaServiceName [required] The internal name of your PCA offer @param billingId [required] Billing id @deprecated """ String qPath = "/cloud/{serviceName}/pca/{pcaServiceName}/billing/{billingId}"; StringBuilder sb = path(qPath, serviceName, pcaServiceName, billingId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBilling.class); }
java
public OvhBilling serviceName_pca_pcaServiceName_billing_billingId_GET(String serviceName, String pcaServiceName, Long billingId) throws IOException { String qPath = "/cloud/{serviceName}/pca/{pcaServiceName}/billing/{billingId}"; StringBuilder sb = path(qPath, serviceName, pcaServiceName, billingId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBilling.class); }
[ "public", "OvhBilling", "serviceName_pca_pcaServiceName_billing_billingId_GET", "(", "String", "serviceName", ",", "String", "pcaServiceName", ",", "Long", "billingId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/{serviceName}/pca/{pcaServiceName}/billi...
Get this object properties REST: GET /cloud/{serviceName}/pca/{pcaServiceName}/billing/{billingId} @param serviceName [required] The internal name of your public cloud passport @param pcaServiceName [required] The internal name of your PCA offer @param billingId [required] Billing id @deprecated
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L2581-L2586
gsi-upm/Shanks
shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/ScenarioPortrayal.java
ScenarioPortrayal.addDataToDataSerieInTimeChart
public void addDataToDataSerieInTimeChart(String chartID, String dataSerieID, double x, double y) throws ShanksException { """ Add a datum in the chart @param chartID @param dataSerieID @param x @param y @throws ShanksException """ if (this.containsDataSerieInTimeChart(chartID, dataSerieID)) { this.timeChartData.get(chartID).get(dataSerieID).add(x, y, true); } else { try { this.addDataSerieToTimeChart(chartID, dataSerieID); this.timeChartData.get(chartID).get(dataSerieID).add(x, y, true); } catch (DuplicatedDataSerieIDException e) { e.printStackTrace(); } } }
java
public void addDataToDataSerieInTimeChart(String chartID, String dataSerieID, double x, double y) throws ShanksException { if (this.containsDataSerieInTimeChart(chartID, dataSerieID)) { this.timeChartData.get(chartID).get(dataSerieID).add(x, y, true); } else { try { this.addDataSerieToTimeChart(chartID, dataSerieID); this.timeChartData.get(chartID).get(dataSerieID).add(x, y, true); } catch (DuplicatedDataSerieIDException e) { e.printStackTrace(); } } }
[ "public", "void", "addDataToDataSerieInTimeChart", "(", "String", "chartID", ",", "String", "dataSerieID", ",", "double", "x", ",", "double", "y", ")", "throws", "ShanksException", "{", "if", "(", "this", ".", "containsDataSerieInTimeChart", "(", "chartID", ",", ...
Add a datum in the chart @param chartID @param dataSerieID @param x @param y @throws ShanksException
[ "Add", "a", "datum", "in", "the", "chart" ]
train
https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/ScenarioPortrayal.java#L240-L251
OpenTSDB/opentsdb
src/core/Tags.java
Tags.resolveOrCreateAllAsync
static Deferred<ArrayList<byte[]>> resolveOrCreateAllAsync(final TSDB tsdb, final Map<String, String> tags) { """ Resolves (and creates, if necessary) all the tags (name=value) into the a sorted byte arrays. @param tsdb The TSDB to use for UniqueId lookups. @param tags The tags to resolve. If a new tag name or tag value is seen, it will be assigned an ID. @return an array of sorted tags (tag id, tag name). @since 2.0 """ return resolveAllInternalAsync(tsdb, null, tags, true); }
java
static Deferred<ArrayList<byte[]>> resolveOrCreateAllAsync(final TSDB tsdb, final Map<String, String> tags) { return resolveAllInternalAsync(tsdb, null, tags, true); }
[ "static", "Deferred", "<", "ArrayList", "<", "byte", "[", "]", ">", ">", "resolveOrCreateAllAsync", "(", "final", "TSDB", "tsdb", ",", "final", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "resolveAllInternalAsync", "(", "tsdb", ",...
Resolves (and creates, if necessary) all the tags (name=value) into the a sorted byte arrays. @param tsdb The TSDB to use for UniqueId lookups. @param tags The tags to resolve. If a new tag name or tag value is seen, it will be assigned an ID. @return an array of sorted tags (tag id, tag name). @since 2.0
[ "Resolves", "(", "and", "creates", "if", "necessary", ")", "all", "the", "tags", "(", "name", "=", "value", ")", "into", "the", "a", "sorted", "byte", "arrays", "." ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Tags.java#L648-L651
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.listMultiRolePoolInstanceMetricsWithServiceResponseAsync
public Observable<ServiceResponse<Page<ResourceMetricInner>>> listMultiRolePoolInstanceMetricsWithServiceResponseAsync(final String resourceGroupName, final String name, final String instance, final Boolean details) { """ Get metrics for a specific instance of a multi-role pool of an App Service Environment. Get metrics for a specific instance of a multi-role pool of an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @param instance Name of the instance in the multi-role pool. @param details Specify &lt;code&gt;true&lt;/code&gt; to include instance details. The default is &lt;code&gt;false&lt;/code&gt;. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ResourceMetricInner&gt; object """ return listMultiRolePoolInstanceMetricsSinglePageAsync(resourceGroupName, name, instance, details) .concatMap(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Observable<ServiceResponse<Page<ResourceMetricInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricInner>>> call(ServiceResponse<Page<ResourceMetricInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listMultiRolePoolInstanceMetricsNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<ResourceMetricInner>>> listMultiRolePoolInstanceMetricsWithServiceResponseAsync(final String resourceGroupName, final String name, final String instance, final Boolean details) { return listMultiRolePoolInstanceMetricsSinglePageAsync(resourceGroupName, name, instance, details) .concatMap(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Observable<ServiceResponse<Page<ResourceMetricInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricInner>>> call(ServiceResponse<Page<ResourceMetricInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listMultiRolePoolInstanceMetricsNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "ResourceMetricInner", ">", ">", ">", "listMultiRolePoolInstanceMetricsWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ",", "final", "String", "inst...
Get metrics for a specific instance of a multi-role pool of an App Service Environment. Get metrics for a specific instance of a multi-role pool of an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @param instance Name of the instance in the multi-role pool. @param details Specify &lt;code&gt;true&lt;/code&gt; to include instance details. The default is &lt;code&gt;false&lt;/code&gt;. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ResourceMetricInner&gt; object
[ "Get", "metrics", "for", "a", "specific", "instance", "of", "a", "multi", "-", "role", "pool", "of", "an", "App", "Service", "Environment", ".", "Get", "metrics", "for", "a", "specific", "instance", "of", "a", "multi", "-", "role", "pool", "of", "an", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L2891-L2903
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/resolver/NamedResolverMap.java
NamedResolverMap.getGroupName
public GroupName getGroupName(@NonNull SimpleGroupPath prefixPath, @NonNull Map<String, MetricValue> extraTags) { """ Create a GroupName from this NamedResolverMap. @param prefixPath Additional path elements to put in front of the returned path. @param extraTags Additional tags to put in the tag set. The extraTags argument will override any values present in the NamedResolverMap. @return A group name derived from this NamedResolverMap and the supplied arguments. """ return getGroupName(prefixPath.getPath(), extraTags); }
java
public GroupName getGroupName(@NonNull SimpleGroupPath prefixPath, @NonNull Map<String, MetricValue> extraTags) { return getGroupName(prefixPath.getPath(), extraTags); }
[ "public", "GroupName", "getGroupName", "(", "@", "NonNull", "SimpleGroupPath", "prefixPath", ",", "@", "NonNull", "Map", "<", "String", ",", "MetricValue", ">", "extraTags", ")", "{", "return", "getGroupName", "(", "prefixPath", ".", "getPath", "(", ")", ",", ...
Create a GroupName from this NamedResolverMap. @param prefixPath Additional path elements to put in front of the returned path. @param extraTags Additional tags to put in the tag set. The extraTags argument will override any values present in the NamedResolverMap. @return A group name derived from this NamedResolverMap and the supplied arguments.
[ "Create", "a", "GroupName", "from", "this", "NamedResolverMap", "." ]
train
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/resolver/NamedResolverMap.java#L265-L267
antopen/alipay-sdk-java
src/main/java/com/alipay/api/internal/util/XmlUtils.java
XmlUtils.xmlToHtml
public static String xmlToHtml(String payload, File xsltFile) throws AlipayApiException { """ Transforms the XML content to XHTML/HTML format string with the XSL. @param payload the XML payload to convert @param xsltFile the XML stylesheet file @return the transformed XHTML/HTML format string @throws ApiException problem converting XML to HTML """ String result = null; try { Source template = new StreamSource(xsltFile); Transformer transformer = TransformerFactory.newInstance() .newTransformer(template); Properties props = transformer.getOutputProperties(); props.setProperty(OutputKeys.OMIT_XML_DECLARATION, LOGIC_YES); transformer.setOutputProperties(props); StreamSource source = new StreamSource(new StringReader(payload)); StreamResult sr = new StreamResult(new StringWriter()); transformer.transform(source, sr); result = sr.getWriter().toString(); } catch (TransformerException e) { throw new AlipayApiException("XML_TRANSFORM_ERROR", e); } return result; }
java
public static String xmlToHtml(String payload, File xsltFile) throws AlipayApiException { String result = null; try { Source template = new StreamSource(xsltFile); Transformer transformer = TransformerFactory.newInstance() .newTransformer(template); Properties props = transformer.getOutputProperties(); props.setProperty(OutputKeys.OMIT_XML_DECLARATION, LOGIC_YES); transformer.setOutputProperties(props); StreamSource source = new StreamSource(new StringReader(payload)); StreamResult sr = new StreamResult(new StringWriter()); transformer.transform(source, sr); result = sr.getWriter().toString(); } catch (TransformerException e) { throw new AlipayApiException("XML_TRANSFORM_ERROR", e); } return result; }
[ "public", "static", "String", "xmlToHtml", "(", "String", "payload", ",", "File", "xsltFile", ")", "throws", "AlipayApiException", "{", "String", "result", "=", "null", ";", "try", "{", "Source", "template", "=", "new", "StreamSource", "(", "xsltFile", ")", ...
Transforms the XML content to XHTML/HTML format string with the XSL. @param payload the XML payload to convert @param xsltFile the XML stylesheet file @return the transformed XHTML/HTML format string @throws ApiException problem converting XML to HTML
[ "Transforms", "the", "XML", "content", "to", "XHTML", "/", "HTML", "format", "string", "with", "the", "XSL", "." ]
train
https://github.com/antopen/alipay-sdk-java/blob/e82aeac7d0239330ee173c7e393596e51e41c1cd/src/main/java/com/alipay/api/internal/util/XmlUtils.java#L568-L591
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/ProxySelectorImpl.java
ProxySelectorImpl.isNonProxyHost
private boolean isNonProxyHost(String host, String nonProxyHosts) { """ Returns true if the {@code nonProxyHosts} system property pattern exists and matches {@code host}. """ if (host == null || nonProxyHosts == null) { return false; } // construct pattern StringBuilder patternBuilder = new StringBuilder(); for (int i = 0; i < nonProxyHosts.length(); i++) { char c = nonProxyHosts.charAt(i); switch (c) { case '.': patternBuilder.append("\\."); break; case '*': patternBuilder.append(".*"); break; default: patternBuilder.append(c); } } // check whether the host is the nonProxyHosts. String pattern = patternBuilder.toString(); return host.matches(pattern); }
java
private boolean isNonProxyHost(String host, String nonProxyHosts) { if (host == null || nonProxyHosts == null) { return false; } // construct pattern StringBuilder patternBuilder = new StringBuilder(); for (int i = 0; i < nonProxyHosts.length(); i++) { char c = nonProxyHosts.charAt(i); switch (c) { case '.': patternBuilder.append("\\."); break; case '*': patternBuilder.append(".*"); break; default: patternBuilder.append(c); } } // check whether the host is the nonProxyHosts. String pattern = patternBuilder.toString(); return host.matches(pattern); }
[ "private", "boolean", "isNonProxyHost", "(", "String", "host", ",", "String", "nonProxyHosts", ")", "{", "if", "(", "host", "==", "null", "||", "nonProxyHosts", "==", "null", ")", "{", "return", "false", ";", "}", "// construct pattern", "StringBuilder", "patt...
Returns true if the {@code nonProxyHosts} system property pattern exists and matches {@code host}.
[ "Returns", "true", "if", "the", "{" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/ProxySelectorImpl.java#L119-L142
google/auto
common/src/main/java/com/google/auto/common/MoreTypes.java
MoreTypes.isTypeOf
public static boolean isTypeOf(final Class<?> clazz, TypeMirror type) { """ Returns true if the raw type underlying the given {@link TypeMirror} represents the same raw type as the given {@link Class} and throws an IllegalArgumentException if the {@link TypeMirror} does not represent a type that can be referenced by a {@link Class} """ checkNotNull(clazz); return type.accept(new IsTypeOf(clazz), null); }
java
public static boolean isTypeOf(final Class<?> clazz, TypeMirror type) { checkNotNull(clazz); return type.accept(new IsTypeOf(clazz), null); }
[ "public", "static", "boolean", "isTypeOf", "(", "final", "Class", "<", "?", ">", "clazz", ",", "TypeMirror", "type", ")", "{", "checkNotNull", "(", "clazz", ")", ";", "return", "type", ".", "accept", "(", "new", "IsTypeOf", "(", "clazz", ")", ",", "nul...
Returns true if the raw type underlying the given {@link TypeMirror} represents the same raw type as the given {@link Class} and throws an IllegalArgumentException if the {@link TypeMirror} does not represent a type that can be referenced by a {@link Class}
[ "Returns", "true", "if", "the", "raw", "type", "underlying", "the", "given", "{" ]
train
https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/common/src/main/java/com/google/auto/common/MoreTypes.java#L811-L814
alkacon/opencms-core
src/org/opencms/util/CmsStringUtil.java
CmsStringUtil.parseDuration
public static final long parseDuration(String durationStr, long defaultValue) { """ Parses a duration and returns the corresponding number of milliseconds. Durations consist of a space-separated list of components of the form {number}{time unit}, for example 1d 5m. The available units are d (days), h (hours), m (months), s (seconds), ms (milliseconds).<p> @param durationStr the duration string @param defaultValue the default value to return in case the pattern does not match @return the corresponding number of milliseconds """ durationStr = durationStr.toLowerCase().trim(); Matcher matcher = DURATION_NUMBER_AND_UNIT_PATTERN.matcher(durationStr); long millis = 0; boolean matched = false; while (matcher.find()) { long number = Long.valueOf(matcher.group(1)).longValue(); String unit = matcher.group(2); long multiplier = 0; for (int j = 0; j < DURATION_UNTIS.length; j++) { if (unit.equals(DURATION_UNTIS[j])) { multiplier = DURATION_MULTIPLIERS[j]; break; } } if (multiplier == 0) { LOG.warn("parseDuration: Unknown unit " + unit); } else { matched = true; } millis += number * multiplier; } if (!matched) { millis = defaultValue; } return millis; }
java
public static final long parseDuration(String durationStr, long defaultValue) { durationStr = durationStr.toLowerCase().trim(); Matcher matcher = DURATION_NUMBER_AND_UNIT_PATTERN.matcher(durationStr); long millis = 0; boolean matched = false; while (matcher.find()) { long number = Long.valueOf(matcher.group(1)).longValue(); String unit = matcher.group(2); long multiplier = 0; for (int j = 0; j < DURATION_UNTIS.length; j++) { if (unit.equals(DURATION_UNTIS[j])) { multiplier = DURATION_MULTIPLIERS[j]; break; } } if (multiplier == 0) { LOG.warn("parseDuration: Unknown unit " + unit); } else { matched = true; } millis += number * multiplier; } if (!matched) { millis = defaultValue; } return millis; }
[ "public", "static", "final", "long", "parseDuration", "(", "String", "durationStr", ",", "long", "defaultValue", ")", "{", "durationStr", "=", "durationStr", ".", "toLowerCase", "(", ")", ".", "trim", "(", ")", ";", "Matcher", "matcher", "=", "DURATION_NUMBER_...
Parses a duration and returns the corresponding number of milliseconds. Durations consist of a space-separated list of components of the form {number}{time unit}, for example 1d 5m. The available units are d (days), h (hours), m (months), s (seconds), ms (milliseconds).<p> @param durationStr the duration string @param defaultValue the default value to return in case the pattern does not match @return the corresponding number of milliseconds
[ "Parses", "a", "duration", "and", "returns", "the", "corresponding", "number", "of", "milliseconds", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsStringUtil.java#L1366-L1393
samskivert/samskivert
src/main/java/com/samskivert/util/RandomUtil.java
RandomUtil.pickRandom
public static <T> T pickRandom (Iterator<T> iter, int count, T skip) { """ Picks a random object from the supplied iterator (which must iterate over exactly <code>count</code> objects. The specified skip object will be skipped when selecting a random value. The skipped object must exist exactly once in the set of objects returned by the iterator. @return a randomly selected item. @exception NoSuchElementException thrown if the iterator provides fewer than <code>count</code> elements. """ if (count < 2) { throw new IllegalArgumentException( "Must have at least two elements [count=" + count + "]"); } int index = getInt(count-1); T value = null; do { value = iter.next(); if (value == skip) { value = iter.next(); } } while (index-- > 0); return value; }
java
public static <T> T pickRandom (Iterator<T> iter, int count, T skip) { if (count < 2) { throw new IllegalArgumentException( "Must have at least two elements [count=" + count + "]"); } int index = getInt(count-1); T value = null; do { value = iter.next(); if (value == skip) { value = iter.next(); } } while (index-- > 0); return value; }
[ "public", "static", "<", "T", ">", "T", "pickRandom", "(", "Iterator", "<", "T", ">", "iter", ",", "int", "count", ",", "T", "skip", ")", "{", "if", "(", "count", "<", "2", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Must have at leas...
Picks a random object from the supplied iterator (which must iterate over exactly <code>count</code> objects. The specified skip object will be skipped when selecting a random value. The skipped object must exist exactly once in the set of objects returned by the iterator. @return a randomly selected item. @exception NoSuchElementException thrown if the iterator provides fewer than <code>count</code> elements.
[ "Picks", "a", "random", "object", "from", "the", "supplied", "iterator", "(", "which", "must", "iterate", "over", "exactly", "<code", ">", "count<", "/", "code", ">", "objects", ".", "The", "specified", "skip", "object", "will", "be", "skipped", "when", "s...
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/RandomUtil.java#L430-L446
adamfisk/littleshoot-commons-id
src/main/java/org/apache/commons/id/serial/TimeBasedAlphanumericIdentifierGenerator.java
TimeBasedAlphanumericIdentifierGenerator.getMillisecondsFromId
public long getMillisecondsFromId(final Object id, final long offset) { """ Retrieve the number of milliseconds since 1st Jan 1970 that were the base for the given id. @param id the id to use @param offset the offset used to create the id @return the number of milliseconds @throws IllegalArgumentException if <code>id</code> is not a valid id from this type of generator """ if (id instanceof String && id.toString().length() >= MAX_LONG_ALPHANUMERIC_VALUE_LENGTH) { final char[] buffer = new char[MAX_LONG_ALPHANUMERIC_VALUE_LENGTH]; System.arraycopy( id.toString().toCharArray(), 0, buffer, 0, MAX_LONG_ALPHANUMERIC_VALUE_LENGTH); final boolean overflow = buffer[0] > '1'; if (overflow) { buffer[0] -= 2; } long value = Long.parseLong(new String(buffer), ALPHA_NUMERIC_CHARSET_SIZE); if (overflow) { value -= Long.MAX_VALUE + 1; } return value + offset; } throw new IllegalArgumentException("'" + id + "' is not an id from this generator"); }
java
public long getMillisecondsFromId(final Object id, final long offset) { if (id instanceof String && id.toString().length() >= MAX_LONG_ALPHANUMERIC_VALUE_LENGTH) { final char[] buffer = new char[MAX_LONG_ALPHANUMERIC_VALUE_LENGTH]; System.arraycopy( id.toString().toCharArray(), 0, buffer, 0, MAX_LONG_ALPHANUMERIC_VALUE_LENGTH); final boolean overflow = buffer[0] > '1'; if (overflow) { buffer[0] -= 2; } long value = Long.parseLong(new String(buffer), ALPHA_NUMERIC_CHARSET_SIZE); if (overflow) { value -= Long.MAX_VALUE + 1; } return value + offset; } throw new IllegalArgumentException("'" + id + "' is not an id from this generator"); }
[ "public", "long", "getMillisecondsFromId", "(", "final", "Object", "id", ",", "final", "long", "offset", ")", "{", "if", "(", "id", "instanceof", "String", "&&", "id", ".", "toString", "(", ")", ".", "length", "(", ")", ">=", "MAX_LONG_ALPHANUMERIC_VALUE_LEN...
Retrieve the number of milliseconds since 1st Jan 1970 that were the base for the given id. @param id the id to use @param offset the offset used to create the id @return the number of milliseconds @throws IllegalArgumentException if <code>id</code> is not a valid id from this type of generator
[ "Retrieve", "the", "number", "of", "milliseconds", "since", "1st", "Jan", "1970", "that", "were", "the", "base", "for", "the", "given", "id", "." ]
train
https://github.com/adamfisk/littleshoot-commons-id/blob/49a8f5f2b10831c509876ca463bf1a87e1e49ae9/src/main/java/org/apache/commons/id/serial/TimeBasedAlphanumericIdentifierGenerator.java#L192-L208
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs.java
FindBugs.processCommandLine
public static void processCommandLine(TextUICommandLine commandLine, String[] argv, IFindBugsEngine findBugs) throws IOException, FilterException { """ Process the command line. @param commandLine the TextUICommandLine object which will parse the command line @param argv the command line arguments @param findBugs the IFindBugsEngine to configure @throws IOException @throws FilterException """ // Expand option files in command line. // An argument beginning with "@" is treated as specifying // the name of an option file. // Each line of option files are treated as a single argument. // Blank lines and comment lines (beginning with "#") // are ignored. try { argv = commandLine.expandOptionFiles(argv, true, true); } catch (HelpRequestedException e) { showHelp(commandLine); } int argCount = 0; try { argCount = commandLine.parse(argv); } catch (IllegalArgumentException e) { LOG.severe(e.getMessage()); showHelp(commandLine); } catch (HelpRequestedException e) { showHelp(commandLine); } Project project = commandLine.getProject(); for (int i = argCount; i < argv.length; ++i) { project.addFile(argv[i]); } commandLine.handleXArgs(); commandLine.configureEngine(findBugs); if (commandLine.getProject().getFileCount() == 0 && !commandLine.justPrintConfiguration() && !commandLine.justPrintVersion()) { LOG.warning("No files to be analyzed"); showHelp(commandLine); } }
java
public static void processCommandLine(TextUICommandLine commandLine, String[] argv, IFindBugsEngine findBugs) throws IOException, FilterException { // Expand option files in command line. // An argument beginning with "@" is treated as specifying // the name of an option file. // Each line of option files are treated as a single argument. // Blank lines and comment lines (beginning with "#") // are ignored. try { argv = commandLine.expandOptionFiles(argv, true, true); } catch (HelpRequestedException e) { showHelp(commandLine); } int argCount = 0; try { argCount = commandLine.parse(argv); } catch (IllegalArgumentException e) { LOG.severe(e.getMessage()); showHelp(commandLine); } catch (HelpRequestedException e) { showHelp(commandLine); } Project project = commandLine.getProject(); for (int i = argCount; i < argv.length; ++i) { project.addFile(argv[i]); } commandLine.handleXArgs(); commandLine.configureEngine(findBugs); if (commandLine.getProject().getFileCount() == 0 && !commandLine.justPrintConfiguration() && !commandLine.justPrintVersion()) { LOG.warning("No files to be analyzed"); showHelp(commandLine); } }
[ "public", "static", "void", "processCommandLine", "(", "TextUICommandLine", "commandLine", ",", "String", "[", "]", "argv", ",", "IFindBugsEngine", "findBugs", ")", "throws", "IOException", ",", "FilterException", "{", "// Expand option files in command line.", "// An arg...
Process the command line. @param commandLine the TextUICommandLine object which will parse the command line @param argv the command line arguments @param findBugs the IFindBugsEngine to configure @throws IOException @throws FilterException
[ "Process", "the", "command", "line", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs.java#L328-L365
aws/aws-sdk-java
aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/JmesPathCodeGenVisitor.java
JmesPathCodeGenVisitor.visit
@Override public String visit(final JmesPathLiteral literal, final Void aVoid) { """ Generates the code for a new JmesPathLiteral. @param literal JmesPath literal type @param aVoid void @return String that represents a call to the new literal expression """ return "new JmesPathLiteral(\"" + StringEscapeUtils .escapeJava(literal.getValue().toString()) + "\")"; }
java
@Override public String visit(final JmesPathLiteral literal, final Void aVoid) { return "new JmesPathLiteral(\"" + StringEscapeUtils .escapeJava(literal.getValue().toString()) + "\")"; }
[ "@", "Override", "public", "String", "visit", "(", "final", "JmesPathLiteral", "literal", ",", "final", "Void", "aVoid", ")", "{", "return", "\"new JmesPathLiteral(\\\"\"", "+", "StringEscapeUtils", ".", "escapeJava", "(", "literal", ".", "getValue", "(", ")", "...
Generates the code for a new JmesPathLiteral. @param literal JmesPath literal type @param aVoid void @return String that represents a call to the new literal expression
[ "Generates", "the", "code", "for", "a", "new", "JmesPathLiteral", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/JmesPathCodeGenVisitor.java#L143-L148
jenkinsci/jenkins
core/src/main/java/hudson/util/CopyOnWriteMap.java
CopyOnWriteMap.replaceBy
public void replaceBy(Map<? extends K, ? extends V> data) { """ Atomically replaces the entire map by the copy of the specified map. """ Map<K, V> d = copy(); d.clear(); d.putAll(data); update(d); }
java
public void replaceBy(Map<? extends K, ? extends V> data) { Map<K, V> d = copy(); d.clear(); d.putAll(data); update(d); }
[ "public", "void", "replaceBy", "(", "Map", "<", "?", "extends", "K", ",", "?", "extends", "V", ">", "data", ")", "{", "Map", "<", "K", ",", "V", ">", "d", "=", "copy", "(", ")", ";", "d", ".", "clear", "(", ")", ";", "d", ".", "putAll", "("...
Atomically replaces the entire map by the copy of the specified map.
[ "Atomically", "replaces", "the", "entire", "map", "by", "the", "copy", "of", "the", "specified", "map", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/CopyOnWriteMap.java#L75-L80
bmelnychuk/AndroidTreeView
library/src/main/java/com/unnamed/b/atv/view/TwoDScrollView.java
TwoDScrollView.fullScroll
public boolean fullScroll(int direction, boolean horizontal) { """ <p>Handles scrolling in response to a "home/end" shortcut press. This method will scroll the view to the top or bottom and give the focus to the topmost/bottommost component in the new visible area. If no component is a good candidate for focus, this scrollview reclaims the focus.</p> @param direction the scroll direction: {@link android.view.View#FOCUS_UP} to go the top of the view or {@link android.view.View#FOCUS_DOWN} to go the bottom @return true if the key event is consumed by this method, false otherwise """ if (!horizontal) { boolean down = direction == View.FOCUS_DOWN; int height = getHeight(); mTempRect.top = 0; mTempRect.bottom = height; if (down) { int count = getChildCount(); if (count > 0) { View view = getChildAt(count - 1); mTempRect.bottom = view.getBottom(); mTempRect.top = mTempRect.bottom - height; } } return scrollAndFocus(direction, mTempRect.top, mTempRect.bottom, 0, 0, 0); } else { boolean right = direction == View.FOCUS_DOWN; int width = getWidth(); mTempRect.left = 0; mTempRect.right = width; if (right) { int count = getChildCount(); if (count > 0) { View view = getChildAt(count - 1); mTempRect.right = view.getBottom(); mTempRect.left = mTempRect.right - width; } } return scrollAndFocus(0, 0, 0, direction, mTempRect.top, mTempRect.bottom); } }
java
public boolean fullScroll(int direction, boolean horizontal) { if (!horizontal) { boolean down = direction == View.FOCUS_DOWN; int height = getHeight(); mTempRect.top = 0; mTempRect.bottom = height; if (down) { int count = getChildCount(); if (count > 0) { View view = getChildAt(count - 1); mTempRect.bottom = view.getBottom(); mTempRect.top = mTempRect.bottom - height; } } return scrollAndFocus(direction, mTempRect.top, mTempRect.bottom, 0, 0, 0); } else { boolean right = direction == View.FOCUS_DOWN; int width = getWidth(); mTempRect.left = 0; mTempRect.right = width; if (right) { int count = getChildCount(); if (count > 0) { View view = getChildAt(count - 1); mTempRect.right = view.getBottom(); mTempRect.left = mTempRect.right - width; } } return scrollAndFocus(0, 0, 0, direction, mTempRect.top, mTempRect.bottom); } }
[ "public", "boolean", "fullScroll", "(", "int", "direction", ",", "boolean", "horizontal", ")", "{", "if", "(", "!", "horizontal", ")", "{", "boolean", "down", "=", "direction", "==", "View", ".", "FOCUS_DOWN", ";", "int", "height", "=", "getHeight", "(", ...
<p>Handles scrolling in response to a "home/end" shortcut press. This method will scroll the view to the top or bottom and give the focus to the topmost/bottommost component in the new visible area. If no component is a good candidate for focus, this scrollview reclaims the focus.</p> @param direction the scroll direction: {@link android.view.View#FOCUS_UP} to go the top of the view or {@link android.view.View#FOCUS_DOWN} to go the bottom @return true if the key event is consumed by this method, false otherwise
[ "<p", ">", "Handles", "scrolling", "in", "response", "to", "a", "home", "/", "end", "shortcut", "press", ".", "This", "method", "will", "scroll", "the", "view", "to", "the", "top", "or", "bottom", "and", "give", "the", "focus", "to", "the", "topmost", ...
train
https://github.com/bmelnychuk/AndroidTreeView/blob/d051ce75f5c9bd5206481808f6133b51f581c8f1/library/src/main/java/com/unnamed/b/atv/view/TwoDScrollView.java#L575-L605
petergeneric/stdlib
guice/hibernate/src/main/java/com/peterphi/std/guice/hibernate/module/HibernateModule.java
HibernateModule.validateHibernateProperties
private void validateHibernateProperties(final GuiceConfig configuration, final Properties hibernateProperties) { """ Checks whether hbm2ddl is set to a prohibited value, throwing an exception if it is @param configuration the global app config @param hibernateProperties the hibernate-specific config @throws IllegalArgumentException if the hibernate.hbm2ddl.auto property is set to a prohibited value """ final boolean allowCreateSchema = configuration.getBoolean(GuiceProperties.HIBERNATE_ALLOW_HBM2DDL_CREATE, false); if (!allowCreateSchema) { // Check that hbm2ddl is not set to a prohibited value, throwing an exception if it is final String hbm2ddl = hibernateProperties.getProperty("hibernate.hbm2ddl.auto"); if (hbm2ddl != null && (hbm2ddl.equalsIgnoreCase("create") || hbm2ddl.equalsIgnoreCase("create-drop"))) { throw new IllegalArgumentException("Value '" + hbm2ddl + "' is not permitted for hibernate property 'hibernate.hbm2ddl.auto' under the current configuration, consider using 'update' instead. If you must use the value 'create' then set configuration parameter '" + GuiceProperties.HIBERNATE_ALLOW_HBM2DDL_CREATE + "' to 'true'"); } } }
java
private void validateHibernateProperties(final GuiceConfig configuration, final Properties hibernateProperties) { final boolean allowCreateSchema = configuration.getBoolean(GuiceProperties.HIBERNATE_ALLOW_HBM2DDL_CREATE, false); if (!allowCreateSchema) { // Check that hbm2ddl is not set to a prohibited value, throwing an exception if it is final String hbm2ddl = hibernateProperties.getProperty("hibernate.hbm2ddl.auto"); if (hbm2ddl != null && (hbm2ddl.equalsIgnoreCase("create") || hbm2ddl.equalsIgnoreCase("create-drop"))) { throw new IllegalArgumentException("Value '" + hbm2ddl + "' is not permitted for hibernate property 'hibernate.hbm2ddl.auto' under the current configuration, consider using 'update' instead. If you must use the value 'create' then set configuration parameter '" + GuiceProperties.HIBERNATE_ALLOW_HBM2DDL_CREATE + "' to 'true'"); } } }
[ "private", "void", "validateHibernateProperties", "(", "final", "GuiceConfig", "configuration", ",", "final", "Properties", "hibernateProperties", ")", "{", "final", "boolean", "allowCreateSchema", "=", "configuration", ".", "getBoolean", "(", "GuiceProperties", ".", "H...
Checks whether hbm2ddl is set to a prohibited value, throwing an exception if it is @param configuration the global app config @param hibernateProperties the hibernate-specific config @throws IllegalArgumentException if the hibernate.hbm2ddl.auto property is set to a prohibited value
[ "Checks", "whether", "hbm2ddl", "is", "set", "to", "a", "prohibited", "value", "throwing", "an", "exception", "if", "it", "is" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/guice/hibernate/src/main/java/com/peterphi/std/guice/hibernate/module/HibernateModule.java#L171-L189
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java
XmlSchemaParser.handleWarning
public static void handleWarning(final Node node, final String msg) { """ Handle a warning condition as a consequence of parsing. @param node as the context for the warning. @param msg associated with the warning. """ final ErrorHandler handler = (ErrorHandler)node.getOwnerDocument().getUserData(ERROR_HANDLER_KEY); if (handler == null) { throw new IllegalStateException("WARNING: " + formatLocationInfo(node) + msg); } else { handler.warning(formatLocationInfo(node) + msg); } }
java
public static void handleWarning(final Node node, final String msg) { final ErrorHandler handler = (ErrorHandler)node.getOwnerDocument().getUserData(ERROR_HANDLER_KEY); if (handler == null) { throw new IllegalStateException("WARNING: " + formatLocationInfo(node) + msg); } else { handler.warning(formatLocationInfo(node) + msg); } }
[ "public", "static", "void", "handleWarning", "(", "final", "Node", "node", ",", "final", "String", "msg", ")", "{", "final", "ErrorHandler", "handler", "=", "(", "ErrorHandler", ")", "node", ".", "getOwnerDocument", "(", ")", ".", "getUserData", "(", "ERROR_...
Handle a warning condition as a consequence of parsing. @param node as the context for the warning. @param msg associated with the warning.
[ "Handle", "a", "warning", "condition", "as", "a", "consequence", "of", "parsing", "." ]
train
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java#L258-L270
real-logic/agrona
agrona/src/main/java/org/agrona/concurrent/MappedResizeableBuffer.java
MappedResizeableBuffer.wrap
public void wrap(final long offset, final long length) { """ Remap the buffer using the existing file based on a new offset and length @param offset the offset of the file to start the mapping @param length of the buffer from the given address """ if (offset == addressOffset && length == capacity) { return; } wrap(fileChannel, offset, length); }
java
public void wrap(final long offset, final long length) { if (offset == addressOffset && length == capacity) { return; } wrap(fileChannel, offset, length); }
[ "public", "void", "wrap", "(", "final", "long", "offset", ",", "final", "long", "length", ")", "{", "if", "(", "offset", "==", "addressOffset", "&&", "length", "==", "capacity", ")", "{", "return", ";", "}", "wrap", "(", "fileChannel", ",", "offset", "...
Remap the buffer using the existing file based on a new offset and length @param offset the offset of the file to start the mapping @param length of the buffer from the given address
[ "Remap", "the", "buffer", "using", "the", "existing", "file", "based", "on", "a", "new", "offset", "and", "length" ]
train
https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/concurrent/MappedResizeableBuffer.java#L100-L108
Harium/keel
src/main/java/com/harium/keel/effect/rotate/RotateOperation.java
RotateOperation.fillColor
public RotateOperation fillColor(int red, int green, int blue) { """ Set Fill color. @param red Red channel's value. @param green Green channel's value. @param blue Blue channel's value. """ this.fillRed = red; this.fillGreen = green; this.fillBlue = blue; return this; }
java
public RotateOperation fillColor(int red, int green, int blue) { this.fillRed = red; this.fillGreen = green; this.fillBlue = blue; return this; }
[ "public", "RotateOperation", "fillColor", "(", "int", "red", ",", "int", "green", ",", "int", "blue", ")", "{", "this", ".", "fillRed", "=", "red", ";", "this", ".", "fillGreen", "=", "green", ";", "this", ".", "fillBlue", "=", "blue", ";", "return", ...
Set Fill color. @param red Red channel's value. @param green Green channel's value. @param blue Blue channel's value.
[ "Set", "Fill", "color", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/effect/rotate/RotateOperation.java#L70-L75
jenkinsci/jenkins
core/src/main/java/hudson/security/csrf/CrumbIssuer.java
CrumbIssuer.validateCrumb
public boolean validateCrumb(ServletRequest request) { """ Get a crumb from a request parameter and validate it against other data in the current request. The salt and request parameter that is used is defined by the current configuration. @param request """ CrumbIssuerDescriptor<CrumbIssuer> desc = getDescriptor(); String crumbField = desc.getCrumbRequestField(); String crumbSalt = desc.getCrumbSalt(); return validateCrumb(request, crumbSalt, request.getParameter(crumbField)); }
java
public boolean validateCrumb(ServletRequest request) { CrumbIssuerDescriptor<CrumbIssuer> desc = getDescriptor(); String crumbField = desc.getCrumbRequestField(); String crumbSalt = desc.getCrumbSalt(); return validateCrumb(request, crumbSalt, request.getParameter(crumbField)); }
[ "public", "boolean", "validateCrumb", "(", "ServletRequest", "request", ")", "{", "CrumbIssuerDescriptor", "<", "CrumbIssuer", ">", "desc", "=", "getDescriptor", "(", ")", ";", "String", "crumbField", "=", "desc", ".", "getCrumbRequestField", "(", ")", ";", "Str...
Get a crumb from a request parameter and validate it against other data in the current request. The salt and request parameter that is used is defined by the current configuration. @param request
[ "Get", "a", "crumb", "from", "a", "request", "parameter", "and", "validate", "it", "against", "other", "data", "in", "the", "current", "request", ".", "The", "salt", "and", "request", "parameter", "that", "is", "used", "is", "defined", "by", "the", "curren...
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/csrf/CrumbIssuer.java#L115-L121
joniles/mpxj
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
MapFileGenerator.addClass
private void addClass(URLClassLoader loader, JarEntry jarEntry, XMLStreamWriter writer, boolean mapClassMethods) throws ClassNotFoundException, XMLStreamException, IntrospectionException { """ Add an individual class to the map file. @param loader jar file class loader @param jarEntry jar file entry @param writer XML stream writer @param mapClassMethods true if we want to produce .Net style class method names @throws ClassNotFoundException @throws XMLStreamException @throws IntrospectionException """ String className = jarEntry.getName().replaceAll("\\.class", "").replaceAll("/", "."); writer.writeStartElement("class"); writer.writeAttribute("name", className); Set<Method> methodSet = new HashSet<Method>(); Class<?> aClass = loader.loadClass(className); processProperties(writer, methodSet, aClass); if (mapClassMethods && !Modifier.isInterface(aClass.getModifiers())) { processClassMethods(writer, aClass, methodSet); } writer.writeEndElement(); }
java
private void addClass(URLClassLoader loader, JarEntry jarEntry, XMLStreamWriter writer, boolean mapClassMethods) throws ClassNotFoundException, XMLStreamException, IntrospectionException { String className = jarEntry.getName().replaceAll("\\.class", "").replaceAll("/", "."); writer.writeStartElement("class"); writer.writeAttribute("name", className); Set<Method> methodSet = new HashSet<Method>(); Class<?> aClass = loader.loadClass(className); processProperties(writer, methodSet, aClass); if (mapClassMethods && !Modifier.isInterface(aClass.getModifiers())) { processClassMethods(writer, aClass, methodSet); } writer.writeEndElement(); }
[ "private", "void", "addClass", "(", "URLClassLoader", "loader", ",", "JarEntry", "jarEntry", ",", "XMLStreamWriter", "writer", ",", "boolean", "mapClassMethods", ")", "throws", "ClassNotFoundException", ",", "XMLStreamException", ",", "IntrospectionException", "{", "Str...
Add an individual class to the map file. @param loader jar file class loader @param jarEntry jar file entry @param writer XML stream writer @param mapClassMethods true if we want to produce .Net style class method names @throws ClassNotFoundException @throws XMLStreamException @throws IntrospectionException
[ "Add", "an", "individual", "class", "to", "the", "map", "file", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L178-L194
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/splitassigner/InputSplitManager.java
InputSplitManager.unregisterJob
public void unregisterJob(final ExecutionGraph executionGraph) { """ Unregisters the given job represented by its {@link ExecutionGraph} with the input split manager. @param executionGraph the job to be unregistered """ final Iterator<ExecutionGroupVertex> it = new ExecutionGroupVertexIterator(executionGraph, true, -1); while (it.hasNext()) { final ExecutionGroupVertex groupVertex = it.next(); final InputSplit[] inputSplits = groupVertex.getInputSplits(); if (inputSplits == null) { continue; } if (inputSplits.length == 0) { continue; } final InputSplitAssigner assigner = this.assignerCache.remove(groupVertex); if (assigner == null) { LOG.error("Group vertex " + groupVertex.getName() + " is unregistered, but cannot be found in assigner cache"); continue; } assigner.unregisterGroupVertex(groupVertex); } // Unregister job from input split tracker this.inputSplitTracker.unregisterJob(executionGraph); }
java
public void unregisterJob(final ExecutionGraph executionGraph) { final Iterator<ExecutionGroupVertex> it = new ExecutionGroupVertexIterator(executionGraph, true, -1); while (it.hasNext()) { final ExecutionGroupVertex groupVertex = it.next(); final InputSplit[] inputSplits = groupVertex.getInputSplits(); if (inputSplits == null) { continue; } if (inputSplits.length == 0) { continue; } final InputSplitAssigner assigner = this.assignerCache.remove(groupVertex); if (assigner == null) { LOG.error("Group vertex " + groupVertex.getName() + " is unregistered, but cannot be found in assigner cache"); continue; } assigner.unregisterGroupVertex(groupVertex); } // Unregister job from input split tracker this.inputSplitTracker.unregisterJob(executionGraph); }
[ "public", "void", "unregisterJob", "(", "final", "ExecutionGraph", "executionGraph", ")", "{", "final", "Iterator", "<", "ExecutionGroupVertex", ">", "it", "=", "new", "ExecutionGroupVertexIterator", "(", "executionGraph", ",", "true", ",", "-", "1", ")", ";", "...
Unregisters the given job represented by its {@link ExecutionGraph} with the input split manager. @param executionGraph the job to be unregistered
[ "Unregisters", "the", "given", "job", "represented", "by", "its", "{", "@link", "ExecutionGraph", "}", "with", "the", "input", "split", "manager", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/splitassigner/InputSplitManager.java#L133-L161
gwtplus/google-gin
src/main/java/com/google/gwt/inject/rebind/util/GuiceUtil.java
GuiceUtil.getDependencies
public Collection<Dependency> getDependencies(Key<?> typeKey, MethodLiteral<?, ?> method) { """ Collects and returns all keys required to inject the given method. @param typeKey the key that depends on injecting the arguments of method @param method method for which required keys are calculated @return required keys """ String context; if (method.isConstructor()) { context = "@Inject constructor of " + method.getDeclaringType(); } else if (typeKey == Dependency.GINJECTOR) { context = "Member injector " + method; } else { context = "Member injection via " + method; } Set<Dependency> required = new LinkedHashSet<Dependency>(); for (Key<?> key : method.getParameterKeys()) { required.add(new Dependency(typeKey, key, isOptional(method), false, context)); } return required; }
java
public Collection<Dependency> getDependencies(Key<?> typeKey, MethodLiteral<?, ?> method) { String context; if (method.isConstructor()) { context = "@Inject constructor of " + method.getDeclaringType(); } else if (typeKey == Dependency.GINJECTOR) { context = "Member injector " + method; } else { context = "Member injection via " + method; } Set<Dependency> required = new LinkedHashSet<Dependency>(); for (Key<?> key : method.getParameterKeys()) { required.add(new Dependency(typeKey, key, isOptional(method), false, context)); } return required; }
[ "public", "Collection", "<", "Dependency", ">", "getDependencies", "(", "Key", "<", "?", ">", "typeKey", ",", "MethodLiteral", "<", "?", ",", "?", ">", "method", ")", "{", "String", "context", ";", "if", "(", "method", ".", "isConstructor", "(", ")", "...
Collects and returns all keys required to inject the given method. @param typeKey the key that depends on injecting the arguments of method @param method method for which required keys are calculated @return required keys
[ "Collects", "and", "returns", "all", "keys", "required", "to", "inject", "the", "given", "method", "." ]
train
https://github.com/gwtplus/google-gin/blob/595e61ee0d2fa508815c016e924ec0e5cea2a2aa/src/main/java/com/google/gwt/inject/rebind/util/GuiceUtil.java#L156-L172
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/security/support/AbstractSecurityController.java
AbstractSecurityController.doPostProcessorAction
protected void doPostProcessorAction(String actionId, Object controlledObject, boolean authorized) { """ Post-process a controlled object after its authorization state has been updated. Subclasses that override this method MUST ensure that this method is called id they do not process the given action id. @param actionId Id of the post-processor action to run @param controlledObject Object being controlled @param authorized state that has been installed on controlledObject """ if( VISIBLE_TRACKS_AUTHORIZED_ACTION.equals( actionId ) ) { setVisibilityOnControlledObject( controlledObject, authorized ); } }
java
protected void doPostProcessorAction(String actionId, Object controlledObject, boolean authorized) { if( VISIBLE_TRACKS_AUTHORIZED_ACTION.equals( actionId ) ) { setVisibilityOnControlledObject( controlledObject, authorized ); } }
[ "protected", "void", "doPostProcessorAction", "(", "String", "actionId", ",", "Object", "controlledObject", ",", "boolean", "authorized", ")", "{", "if", "(", "VISIBLE_TRACKS_AUTHORIZED_ACTION", ".", "equals", "(", "actionId", ")", ")", "{", "setVisibilityOnControlled...
Post-process a controlled object after its authorization state has been updated. Subclasses that override this method MUST ensure that this method is called id they do not process the given action id. @param actionId Id of the post-processor action to run @param controlledObject Object being controlled @param authorized state that has been installed on controlledObject
[ "Post", "-", "process", "a", "controlled", "object", "after", "its", "authorization", "state", "has", "been", "updated", ".", "Subclasses", "that", "override", "this", "method", "MUST", "ensure", "that", "this", "method", "is", "called", "id", "they", "do", ...
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/security/support/AbstractSecurityController.java#L208-L212
looly/hutool
hutool-core/src/main/java/cn/hutool/core/math/Arrangement.java
Arrangement.count
public static long count(int n, int m) { """ 计算排列数,即A(n, m) = n!/(n-m)! @param n 总数 @param m 选择的个数 @return 排列数 """ if(n == m) { return NumberUtil.factorial(n); } return (n > m) ? NumberUtil.factorial(n, n - m) : 0; }
java
public static long count(int n, int m) { if(n == m) { return NumberUtil.factorial(n); } return (n > m) ? NumberUtil.factorial(n, n - m) : 0; }
[ "public", "static", "long", "count", "(", "int", "n", ",", "int", "m", ")", "{", "if", "(", "n", "==", "m", ")", "{", "return", "NumberUtil", ".", "factorial", "(", "n", ")", ";", "}", "return", "(", "n", ">", "m", ")", "?", "NumberUtil", ".", ...
计算排列数,即A(n, m) = n!/(n-m)! @param n 总数 @param m 选择的个数 @return 排列数
[ "计算排列数,即A", "(", "n", "m", ")", "=", "n!", "/", "(", "n", "-", "m", ")", "!" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/math/Arrangement.java#L46-L51
twitter/cloudhopper-commons
ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/GsmUtil.java
GsmUtil.getShortMessageUserDataHeader
static public byte[] getShortMessageUserDataHeader(byte[] shortMessage) throws IllegalArgumentException { """ Gets the "User Data Header" part of a short message byte array. Only call this method if the short message contains a user data header. This method will take the value of the first byte ("N") as the length of the user data header and return the first ("N+1") bytes from the the short message. @param shortMessage The byte array representing the entire message including a user data header and user data. A null will return null. An empty byte array will return an empty byte array. A byte array not containing enough data will throw an IllegalArgumentException. @return A byte array of the user data header (minus the user data) @throws IllegalArgumentException If the byte array does not contain enough data to fit both the user data header and user data. """ if (shortMessage == null) { return null; } if (shortMessage.length == 0) { return shortMessage; } // the entire length of UDH is the first byte + the length int userDataHeaderLength = ByteUtil.decodeUnsigned(shortMessage[0]) + 1; // is there enough data? if (userDataHeaderLength > shortMessage.length) { throw new IllegalArgumentException("User data header length exceeds short message length [shortMessageLength=" + shortMessage.length + ", userDataHeaderLength=" + userDataHeaderLength + "]"); } // is the user data header the only part of the payload (optimization) if (userDataHeaderLength == shortMessage.length) { return shortMessage; } // create a new message with just the header byte[] userDataHeader = new byte[userDataHeaderLength]; System.arraycopy(shortMessage, 0, userDataHeader, 0, userDataHeaderLength); return userDataHeader; }
java
static public byte[] getShortMessageUserDataHeader(byte[] shortMessage) throws IllegalArgumentException { if (shortMessage == null) { return null; } if (shortMessage.length == 0) { return shortMessage; } // the entire length of UDH is the first byte + the length int userDataHeaderLength = ByteUtil.decodeUnsigned(shortMessage[0]) + 1; // is there enough data? if (userDataHeaderLength > shortMessage.length) { throw new IllegalArgumentException("User data header length exceeds short message length [shortMessageLength=" + shortMessage.length + ", userDataHeaderLength=" + userDataHeaderLength + "]"); } // is the user data header the only part of the payload (optimization) if (userDataHeaderLength == shortMessage.length) { return shortMessage; } // create a new message with just the header byte[] userDataHeader = new byte[userDataHeaderLength]; System.arraycopy(shortMessage, 0, userDataHeader, 0, userDataHeaderLength); return userDataHeader; }
[ "static", "public", "byte", "[", "]", "getShortMessageUserDataHeader", "(", "byte", "[", "]", "shortMessage", ")", "throws", "IllegalArgumentException", "{", "if", "(", "shortMessage", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "shortMessag...
Gets the "User Data Header" part of a short message byte array. Only call this method if the short message contains a user data header. This method will take the value of the first byte ("N") as the length of the user data header and return the first ("N+1") bytes from the the short message. @param shortMessage The byte array representing the entire message including a user data header and user data. A null will return null. An empty byte array will return an empty byte array. A byte array not containing enough data will throw an IllegalArgumentException. @return A byte array of the user data header (minus the user data) @throws IllegalArgumentException If the byte array does not contain enough data to fit both the user data header and user data.
[ "Gets", "the", "User", "Data", "Header", "part", "of", "a", "short", "message", "byte", "array", ".", "Only", "call", "this", "method", "if", "the", "short", "message", "contains", "a", "user", "data", "header", ".", "This", "method", "will", "take", "th...
train
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/GsmUtil.java#L211-L238
thymeleaf/thymeleaf
src/main/java/org/thymeleaf/util/TextUtils.java
TextUtils.endsWith
public static boolean endsWith(final boolean caseSensitive, final CharSequence text, final char[] suffix) { """ <p> Checks whether a text ends with a specified suffix. </p> @param caseSensitive whether the comparison must be done in a case-sensitive or case-insensitive way. @param text the text to be checked for suffixes. @param suffix the suffix to be searched. @return whether the text ends with the suffix or not. """ return endsWith(caseSensitive, text, 0, text.length(), suffix, 0, suffix.length); }
java
public static boolean endsWith(final boolean caseSensitive, final CharSequence text, final char[] suffix) { return endsWith(caseSensitive, text, 0, text.length(), suffix, 0, suffix.length); }
[ "public", "static", "boolean", "endsWith", "(", "final", "boolean", "caseSensitive", ",", "final", "CharSequence", "text", ",", "final", "char", "[", "]", "suffix", ")", "{", "return", "endsWith", "(", "caseSensitive", ",", "text", ",", "0", ",", "text", "...
<p> Checks whether a text ends with a specified suffix. </p> @param caseSensitive whether the comparison must be done in a case-sensitive or case-insensitive way. @param text the text to be checked for suffixes. @param suffix the suffix to be searched. @return whether the text ends with the suffix or not.
[ "<p", ">", "Checks", "whether", "a", "text", "ends", "with", "a", "specified", "suffix", ".", "<", "/", "p", ">" ]
train
https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/util/TextUtils.java#L708-L710
cdk/cdk
tool/sdg/src/main/java/org/openscience/cdk/layout/LayoutRefiner.java
LayoutRefiner.restoreCoords
private void restoreCoords(IntStack stack, Point2d[] src) { """ Restore the coordinates of atoms (idxs) in the stack to the provided source. @param stack atom indexes to backup @param src source of coordinates """ for (int i = 0; i < stack.len; i++) { int v = stack.xs[i]; atoms[v].getPoint2d().x = src[v].x; atoms[v].getPoint2d().y = src[v].y; } }
java
private void restoreCoords(IntStack stack, Point2d[] src) { for (int i = 0; i < stack.len; i++) { int v = stack.xs[i]; atoms[v].getPoint2d().x = src[v].x; atoms[v].getPoint2d().y = src[v].y; } }
[ "private", "void", "restoreCoords", "(", "IntStack", "stack", ",", "Point2d", "[", "]", "src", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "stack", ".", "len", ";", "i", "++", ")", "{", "int", "v", "=", "stack", ".", "xs", "[", ...
Restore the coordinates of atoms (idxs) in the stack to the provided source. @param stack atom indexes to backup @param src source of coordinates
[ "Restore", "the", "coordinates", "of", "atoms", "(", "idxs", ")", "in", "the", "stack", "to", "the", "provided", "source", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/LayoutRefiner.java#L850-L856
Red5/red5-server-common
src/main/java/org/red5/server/net/rtmp/RTMPUtils.java
RTMPUtils.writeReverseInt
public static void writeReverseInt(IoBuffer out, int value) { """ Writes reversed integer to buffer. @param out Buffer @param value Integer to write """ out.put((byte) (0xFF & value)); out.put((byte) (0xFF & (value >> 8))); out.put((byte) (0xFF & (value >> 16))); out.put((byte) (0xFF & (value >> 24))); }
java
public static void writeReverseInt(IoBuffer out, int value) { out.put((byte) (0xFF & value)); out.put((byte) (0xFF & (value >> 8))); out.put((byte) (0xFF & (value >> 16))); out.put((byte) (0xFF & (value >> 24))); }
[ "public", "static", "void", "writeReverseInt", "(", "IoBuffer", "out", ",", "int", "value", ")", "{", "out", ".", "put", "(", "(", "byte", ")", "(", "0xFF", "&", "value", ")", ")", ";", "out", ".", "put", "(", "(", "byte", ")", "(", "0xFF", "&", ...
Writes reversed integer to buffer. @param out Buffer @param value Integer to write
[ "Writes", "reversed", "integer", "to", "buffer", "." ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPUtils.java#L41-L46
syphr42/prom
src/main/java/org/syphr/prom/PropertiesManagers.java
PropertiesManagers.newManager
public static <T extends Enum<T> & Defaultable> PropertiesManager<T> newManager(File file, Class<T> keyType, Evaluator evaluator, ExecutorService executor, final Retriever... retrievers) { """ Build a new manager for the given properties file. @param <T> the type of key used for the new manager @param file the file system location of the properties represented here @param keyType the enumeration of keys in the properties file @param evaluator the evaluator to convert nested property references into fully evaluated strings @param executor a service to handle potentially long running tasks, such as interacting with the file system @param retrievers a set of retrievers that will be used to resolve extra property references (i.e. if a nested value reference is found in a properties file and there is no property to match it, the given retrievers will be used) @return a new manager """ Translator<T> translator = getEnumTranslator(keyType); return new PropertiesManager<T>(file, getDefaultProperties(keyType, translator), translator, evaluator, executor) { @Override protected Retriever createRetriever() { return new AddOnRetriever(true, super.createRetriever(), retrievers); } }; }
java
public static <T extends Enum<T> & Defaultable> PropertiesManager<T> newManager(File file, Class<T> keyType, Evaluator evaluator, ExecutorService executor, final Retriever... retrievers) { Translator<T> translator = getEnumTranslator(keyType); return new PropertiesManager<T>(file, getDefaultProperties(keyType, translator), translator, evaluator, executor) { @Override protected Retriever createRetriever() { return new AddOnRetriever(true, super.createRetriever(), retrievers); } }; }
[ "public", "static", "<", "T", "extends", "Enum", "<", "T", ">", "&", "Defaultable", ">", "PropertiesManager", "<", "T", ">", "newManager", "(", "File", "file", ",", "Class", "<", "T", ">", "keyType", ",", "Evaluator", "evaluator", ",", "ExecutorService", ...
Build a new manager for the given properties file. @param <T> the type of key used for the new manager @param file the file system location of the properties represented here @param keyType the enumeration of keys in the properties file @param evaluator the evaluator to convert nested property references into fully evaluated strings @param executor a service to handle potentially long running tasks, such as interacting with the file system @param retrievers a set of retrievers that will be used to resolve extra property references (i.e. if a nested value reference is found in a properties file and there is no property to match it, the given retrievers will be used) @return a new manager
[ "Build", "a", "new", "manager", "for", "the", "given", "properties", "file", "." ]
train
https://github.com/syphr42/prom/blob/074d67c4ebb3afb0b163fcb0bc4826ee577ac803/src/main/java/org/syphr/prom/PropertiesManagers.java#L329-L349
citrusframework/citrus
modules/citrus-kubernetes/src/main/java/com/consol/citrus/kubernetes/message/KubernetesMessageConverter.java
KubernetesMessageConverter.getCommand
private KubernetesCommand<?> getCommand(Message message, KubernetesEndpointConfiguration endpointConfiguration) { """ Reads Citrus internal mail message model object from message payload. Either payload is actually a mail message object or XML payload String is unmarshalled to mail message object. @param message @param endpointConfiguration @return """ Object payload = message.getPayload(); KubernetesCommand<?> command; if (message instanceof KubernetesMessage) { command = createCommandFromRequest(message.getPayload(KubernetesRequest.class)); } else if (message.getHeaders().containsKey(KubernetesMessageHeaders.COMMAND) && (payload == null || !StringUtils.hasText(payload.toString()))) { command = getCommandByName(message.getHeader(KubernetesMessageHeaders.COMMAND).toString()); } else if (payload instanceof KubernetesCommand) { command = (KubernetesCommand) payload; } else { try { KubernetesRequest request = endpointConfiguration.getObjectMapper() .readValue(message.getPayload(String.class), KubernetesRequest.class); command = createCommandFromRequest(request); } catch (IOException e) { throw new CitrusRuntimeException("Failed to read kubernetes request from payload", e); } } if (command == null) { throw new CitrusRuntimeException("Unable to create proper Kubernetes command from payload: " + payload); } return command; }
java
private KubernetesCommand<?> getCommand(Message message, KubernetesEndpointConfiguration endpointConfiguration) { Object payload = message.getPayload(); KubernetesCommand<?> command; if (message instanceof KubernetesMessage) { command = createCommandFromRequest(message.getPayload(KubernetesRequest.class)); } else if (message.getHeaders().containsKey(KubernetesMessageHeaders.COMMAND) && (payload == null || !StringUtils.hasText(payload.toString()))) { command = getCommandByName(message.getHeader(KubernetesMessageHeaders.COMMAND).toString()); } else if (payload instanceof KubernetesCommand) { command = (KubernetesCommand) payload; } else { try { KubernetesRequest request = endpointConfiguration.getObjectMapper() .readValue(message.getPayload(String.class), KubernetesRequest.class); command = createCommandFromRequest(request); } catch (IOException e) { throw new CitrusRuntimeException("Failed to read kubernetes request from payload", e); } } if (command == null) { throw new CitrusRuntimeException("Unable to create proper Kubernetes command from payload: " + payload); } return command; }
[ "private", "KubernetesCommand", "<", "?", ">", "getCommand", "(", "Message", "message", ",", "KubernetesEndpointConfiguration", "endpointConfiguration", ")", "{", "Object", "payload", "=", "message", ".", "getPayload", "(", ")", ";", "KubernetesCommand", "<", "?", ...
Reads Citrus internal mail message model object from message payload. Either payload is actually a mail message object or XML payload String is unmarshalled to mail message object. @param message @param endpointConfiguration @return
[ "Reads", "Citrus", "internal", "mail", "message", "model", "object", "from", "message", "payload", ".", "Either", "payload", "is", "actually", "a", "mail", "message", "object", "or", "XML", "payload", "String", "is", "unmarshalled", "to", "mail", "message", "o...
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kubernetes/src/main/java/com/consol/citrus/kubernetes/message/KubernetesMessageConverter.java#L161-L187
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxApiAuthentication.java
BoxApiAuthentication.revokeOAuth
BoxRevokeAuthRequest revokeOAuth(String token, String clientId, String clientSecret) { """ Revoke OAuth, to be called when you need to logout a user/revoke authentication. """ BoxRevokeAuthRequest request = new BoxRevokeAuthRequest(mSession, getTokenRevokeUrl(), token, clientId, clientSecret); request.setRequestHandler(new BoxRequest.BoxRequestHandler(request){ @Override public boolean onException(BoxRequest request, BoxHttpResponse response, BoxException ex) throws BoxException.RefreshFailure { // if a revoke request fails for any reason we do not want to retry it again after the user refreshes or logs in again. return false; } }); return request; }
java
BoxRevokeAuthRequest revokeOAuth(String token, String clientId, String clientSecret) { BoxRevokeAuthRequest request = new BoxRevokeAuthRequest(mSession, getTokenRevokeUrl(), token, clientId, clientSecret); request.setRequestHandler(new BoxRequest.BoxRequestHandler(request){ @Override public boolean onException(BoxRequest request, BoxHttpResponse response, BoxException ex) throws BoxException.RefreshFailure { // if a revoke request fails for any reason we do not want to retry it again after the user refreshes or logs in again. return false; } }); return request; }
[ "BoxRevokeAuthRequest", "revokeOAuth", "(", "String", "token", ",", "String", "clientId", ",", "String", "clientSecret", ")", "{", "BoxRevokeAuthRequest", "request", "=", "new", "BoxRevokeAuthRequest", "(", "mSession", ",", "getTokenRevokeUrl", "(", ")", ",", "token...
Revoke OAuth, to be called when you need to logout a user/revoke authentication.
[ "Revoke", "OAuth", "to", "be", "called", "when", "you", "need", "to", "logout", "a", "user", "/", "revoke", "authentication", "." ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxApiAuthentication.java#L66-L77
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/ByteArrayObjectDataInput.java
ByteArrayObjectDataInput.readUTF
@Override public final String readUTF() throws IOException { """ See the general contract of the {@code readUTF} method of {@code DataInput}. <p> Bytes for this operation are read from the contained input stream. @return a Unicode string. @throws java.io.EOFException if this input stream reaches the end before reading all the bytes @throws java.io.IOException if an I/O error occurs @throws java.io.UTFDataFormatException if the bytes do not represent a valid modified UTF-8 encoding of a string @see java.io.DataInputStream#readUTF(java.io.DataInput) """ int charCount = readInt(); if (charCount == NULL_ARRAY_LENGTH) { return null; } if (charBuffer == null || charCount > charBuffer.length) { charBuffer = new char[charCount]; } byte b; for (int i = 0; i < charCount; i++) { b = readByte(); if (b < 0) { charBuffer[i] = Bits.readUtf8Char(this, b); } else { charBuffer[i] = (char) b; } } return new String(charBuffer, 0, charCount); }
java
@Override public final String readUTF() throws IOException { int charCount = readInt(); if (charCount == NULL_ARRAY_LENGTH) { return null; } if (charBuffer == null || charCount > charBuffer.length) { charBuffer = new char[charCount]; } byte b; for (int i = 0; i < charCount; i++) { b = readByte(); if (b < 0) { charBuffer[i] = Bits.readUtf8Char(this, b); } else { charBuffer[i] = (char) b; } } return new String(charBuffer, 0, charCount); }
[ "@", "Override", "public", "final", "String", "readUTF", "(", ")", "throws", "IOException", "{", "int", "charCount", "=", "readInt", "(", ")", ";", "if", "(", "charCount", "==", "NULL_ARRAY_LENGTH", ")", "{", "return", "null", ";", "}", "if", "(", "charB...
See the general contract of the {@code readUTF} method of {@code DataInput}. <p> Bytes for this operation are read from the contained input stream. @return a Unicode string. @throws java.io.EOFException if this input stream reaches the end before reading all the bytes @throws java.io.IOException if an I/O error occurs @throws java.io.UTFDataFormatException if the bytes do not represent a valid modified UTF-8 encoding of a string @see java.io.DataInputStream#readUTF(java.io.DataInput)
[ "See", "the", "general", "contract", "of", "the", "{", "@code", "readUTF", "}", "method", "of", "{", "@code", "DataInput", "}", ".", "<p", ">", "Bytes", "for", "this", "operation", "are", "read", "from", "the", "contained", "input", "stream", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/ByteArrayObjectDataInput.java#L551-L570
fcrepo4/fcrepo4
fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/VersionServiceImpl.java
VersionServiceImpl.createContainer
private Container createContainer(final FedoraSession session, final String path) { """ /* Creates a minimal container node for further population elsewhere """ try { final Node node = findOrCreateNode(session, path, NT_FOLDER); if (node.canAddMixin(FEDORA_RESOURCE)) { node.addMixin(FEDORA_RESOURCE); node.addMixin(FEDORA_CONTAINER); } return new ContainerImpl(node); } catch (final RepositoryException e) { throw new RepositoryRuntimeException(e); } }
java
private Container createContainer(final FedoraSession session, final String path) { try { final Node node = findOrCreateNode(session, path, NT_FOLDER); if (node.canAddMixin(FEDORA_RESOURCE)) { node.addMixin(FEDORA_RESOURCE); node.addMixin(FEDORA_CONTAINER); } return new ContainerImpl(node); } catch (final RepositoryException e) { throw new RepositoryRuntimeException(e); } }
[ "private", "Container", "createContainer", "(", "final", "FedoraSession", "session", ",", "final", "String", "path", ")", "{", "try", "{", "final", "Node", "node", "=", "findOrCreateNode", "(", "session", ",", "path", ",", "NT_FOLDER", ")", ";", "if", "(", ...
/* Creates a minimal container node for further population elsewhere
[ "/", "*", "Creates", "a", "minimal", "container", "node", "for", "further", "population", "elsewhere" ]
train
https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/VersionServiceImpl.java#L186-L199