repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/Member.java
Member.getTotalDetailEstimate
public Double getTotalDetailEstimate(WorkitemFilter filter) { filter = (filter != null) ? filter : new WorkitemFilter(); return getSum("OwnedWorkitems", filter, "DetailEstimate"); }
java
public Double getTotalDetailEstimate(WorkitemFilter filter) { filter = (filter != null) ? filter : new WorkitemFilter(); return getSum("OwnedWorkitems", filter, "DetailEstimate"); }
[ "public", "Double", "getTotalDetailEstimate", "(", "WorkitemFilter", "filter", ")", "{", "filter", "=", "(", "filter", "!=", "null", ")", "?", "filter", ":", "new", "WorkitemFilter", "(", ")", ";", "return", "getSum", "(", "\"OwnedWorkitems\"", ",", "filter", ...
Return the total detail estimate for all workitems owned by this member optionally filtered. @param filter Criteria to filter workitems on. @return total detail estimate of selected Workitems.
[ "Return", "the", "total", "detail", "estimate", "for", "all", "workitems", "owned", "by", "this", "member", "optionally", "filtered", "." ]
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Member.java#L296-L300
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/ZipUtils.java
ZipUtils.unzip
public static void unzip(final File zip, final File patchDir) throws IOException { try (final ZipFile zipFile = new ZipFile(zip)){ unzip(zipFile, patchDir); } }
java
public static void unzip(final File zip, final File patchDir) throws IOException { try (final ZipFile zipFile = new ZipFile(zip)){ unzip(zipFile, patchDir); } }
[ "public", "static", "void", "unzip", "(", "final", "File", "zip", ",", "final", "File", "patchDir", ")", "throws", "IOException", "{", "try", "(", "final", "ZipFile", "zipFile", "=", "new", "ZipFile", "(", "zip", ")", ")", "{", "unzip", "(", "zipFile", ...
unpack... @param zip the zip @param patchDir the patch dir @throws IOException
[ "unpack", "..." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/ZipUtils.java#L100-L104
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/MessagesApi.java
MessagesApi.getNormalizedMessagesAsync
public com.squareup.okhttp.Call getNormalizedMessagesAsync(String uid, String sdid, String mid, String fieldPresence, String filter, String offset, Integer count, Long startDate, Long endDate, String order, final ApiCallback<NormalizedMessagesEnvelope> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getNormalizedMessagesValidateBeforeCall(uid, sdid, mid, fieldPresence, filter, offset, count, startDate, endDate, order, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<NormalizedMessagesEnvelope>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
java
public com.squareup.okhttp.Call getNormalizedMessagesAsync(String uid, String sdid, String mid, String fieldPresence, String filter, String offset, Integer count, Long startDate, Long endDate, String order, final ApiCallback<NormalizedMessagesEnvelope> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getNormalizedMessagesValidateBeforeCall(uid, sdid, mid, fieldPresence, filter, offset, count, startDate, endDate, order, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<NormalizedMessagesEnvelope>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "getNormalizedMessagesAsync", "(", "String", "uid", ",", "String", "sdid", ",", "String", "mid", ",", "String", "fieldPresence", ",", "String", "filter", ",", "String", "offset", ",", "Integer", "...
Get Normalized Messages (asynchronously) Get the messages normalized @param uid User ID. If not specified, assume that of the current authenticated user. If specified, it must be that of a user for which the current authenticated user has read access to. (optional) @param sdid Source device ID of the messages being searched. (optional) @param mid The message ID being searched. (optional) @param fieldPresence String representing a field from the specified device ID. (optional) @param filter Filter. (optional) @param offset A string that represents the starting item, should be the value of &#39;next&#39; field received in the last response. (required for pagination) (optional) @param count count (optional) @param startDate startDate (optional) @param endDate endDate (optional) @param order Desired sort order: &#39;asc&#39; or &#39;desc&#39; (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
[ "Get", "Normalized", "Messages", "(", "asynchronously", ")", "Get", "the", "messages", "normalized" ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/MessagesApi.java#L1044-L1069
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.readNewestUrlNameForId
public String readNewestUrlNameForId(CmsDbContext dbc, CmsUUID id) throws CmsDataAccessException { List<CmsUrlNameMappingEntry> entries = getVfsDriver(dbc).readUrlNameMappingEntries( dbc, dbc.currentProject().isOnlineProject(), CmsUrlNameMappingFilter.ALL.filterStructureId(id)); if (entries.isEmpty()) { return null; } Collections.sort(entries, new UrlNameMappingComparator()); CmsUrlNameMappingEntry lastEntry = entries.get(entries.size() - 1); return lastEntry.getName(); }
java
public String readNewestUrlNameForId(CmsDbContext dbc, CmsUUID id) throws CmsDataAccessException { List<CmsUrlNameMappingEntry> entries = getVfsDriver(dbc).readUrlNameMappingEntries( dbc, dbc.currentProject().isOnlineProject(), CmsUrlNameMappingFilter.ALL.filterStructureId(id)); if (entries.isEmpty()) { return null; } Collections.sort(entries, new UrlNameMappingComparator()); CmsUrlNameMappingEntry lastEntry = entries.get(entries.size() - 1); return lastEntry.getName(); }
[ "public", "String", "readNewestUrlNameForId", "(", "CmsDbContext", "dbc", ",", "CmsUUID", "id", ")", "throws", "CmsDataAccessException", "{", "List", "<", "CmsUrlNameMappingEntry", ">", "entries", "=", "getVfsDriver", "(", "dbc", ")", ".", "readUrlNameMappingEntries",...
Reads the URL name which has been most recently mapped to the given structure id, or null if no URL name is mapped to the id.<p> @param dbc the current database context @param id a structure id @return the name which has been most recently mapped to the given structure id @throws CmsDataAccessException if something goes wrong
[ "Reads", "the", "URL", "name", "which", "has", "been", "most", "recently", "mapped", "to", "the", "given", "structure", "id", "or", "null", "if", "no", "URL", "name", "is", "mapped", "to", "the", "id", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L7071-L7084
orbisgis/h2gis
h2gis-utilities/src/main/java/org/h2gis/utilities/jts_utils/TriMarkers.java
TriMarkers.getSteepestVector
public static Vector3D getSteepestVector(final Vector3D normal, final double epsilon) { if (Math.abs(normal.getX()) < epsilon && Math.abs(normal.getY()) < epsilon) { return new Vector3D(0, 0, 0); } Vector3D slope; if (Math.abs(normal.getX()) < epsilon) { slope = new Vector3D(0, 1, -normal.getY() / normal.getZ()); } else if (Math.abs(normal.getY()) < epsilon) { slope = new Vector3D(1, 0, -normal.getX() / normal.getZ()); } else { slope = new Vector3D(normal.getX() / normal.getY(), 1, -1 / normal.getZ() * (normal.getX() * normal.getX() / normal.getY() + normal.getY())); } //We want the vector to be low-oriented. if (slope.getZ() > epsilon) { slope = new Vector3D(-slope.getX(), -slope.getY(), -slope.getZ()); } //We normalize it return slope.normalize(); }
java
public static Vector3D getSteepestVector(final Vector3D normal, final double epsilon) { if (Math.abs(normal.getX()) < epsilon && Math.abs(normal.getY()) < epsilon) { return new Vector3D(0, 0, 0); } Vector3D slope; if (Math.abs(normal.getX()) < epsilon) { slope = new Vector3D(0, 1, -normal.getY() / normal.getZ()); } else if (Math.abs(normal.getY()) < epsilon) { slope = new Vector3D(1, 0, -normal.getX() / normal.getZ()); } else { slope = new Vector3D(normal.getX() / normal.getY(), 1, -1 / normal.getZ() * (normal.getX() * normal.getX() / normal.getY() + normal.getY())); } //We want the vector to be low-oriented. if (slope.getZ() > epsilon) { slope = new Vector3D(-slope.getX(), -slope.getY(), -slope.getZ()); } //We normalize it return slope.normalize(); }
[ "public", "static", "Vector3D", "getSteepestVector", "(", "final", "Vector3D", "normal", ",", "final", "double", "epsilon", ")", "{", "if", "(", "Math", ".", "abs", "(", "normal", ".", "getX", "(", ")", ")", "<", "epsilon", "&&", "Math", ".", "abs", "(...
Get the vector with the highest down slope in the plan. @param normal @param epsilon @return the steepest vector.
[ "Get", "the", "vector", "with", "the", "highest", "down", "slope", "in", "the", "plan", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/jts_utils/TriMarkers.java#L190-L209
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/ringbuffer/impl/RingbufferContainer.java
RingbufferContainer.readMany
public long readMany(long beginSequence, ReadResultSetImpl result) { checkReadSequence(beginSequence); long seq = beginSequence; while (seq <= ringbuffer.tailSequence()) { result.addItem(seq, readOrLoadItem(seq)); seq++; if (result.isMaxSizeReached()) { // we have found all items we are looking for. We are done. break; } } return seq; }
java
public long readMany(long beginSequence, ReadResultSetImpl result) { checkReadSequence(beginSequence); long seq = beginSequence; while (seq <= ringbuffer.tailSequence()) { result.addItem(seq, readOrLoadItem(seq)); seq++; if (result.isMaxSizeReached()) { // we have found all items we are looking for. We are done. break; } } return seq; }
[ "public", "long", "readMany", "(", "long", "beginSequence", ",", "ReadResultSetImpl", "result", ")", "{", "checkReadSequence", "(", "beginSequence", ")", ";", "long", "seq", "=", "beginSequence", ";", "while", "(", "seq", "<=", "ringbuffer", ".", "tailSequence",...
Reads multiple items from the ring buffer and adds them to {@code result} in the stored format. If an item is not available, it will try and load it from the ringbuffer store. @param beginSequence the sequence of the first item to read. @param result the List where the result are stored in. @return returns the sequenceId of the next item to read. This is needed if not all required items are found. @throws StaleSequenceException if the sequence is : 1. larger than the tailSequence or 2. smaller than the headSequence and the data store is disabled
[ "Reads", "multiple", "items", "from", "the", "ring", "buffer", "and", "adds", "them", "to", "{", "@code", "result", "}", "in", "the", "stored", "format", ".", "If", "an", "item", "is", "not", "available", "it", "will", "try", "and", "load", "it", "from...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/ringbuffer/impl/RingbufferContainer.java#L407-L420
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/privatejgoodies/common/base/Objects.java
Objects.deepCopy
public static <T extends Serializable> T deepCopy(T original) { if (original == null) { return null; } try { final ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); final ObjectOutputStream oas = new ObjectOutputStream(baos); oas.writeObject(original); oas.flush(); // close is unnecessary final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); final ObjectInputStream ois = new ObjectInputStream(bais); return (T) ois.readObject(); } catch (Throwable e) { throw new RuntimeException("Deep copy failed", e); } }
java
public static <T extends Serializable> T deepCopy(T original) { if (original == null) { return null; } try { final ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); final ObjectOutputStream oas = new ObjectOutputStream(baos); oas.writeObject(original); oas.flush(); // close is unnecessary final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); final ObjectInputStream ois = new ObjectInputStream(bais); return (T) ois.readObject(); } catch (Throwable e) { throw new RuntimeException("Deep copy failed", e); } }
[ "public", "static", "<", "T", "extends", "Serializable", ">", "T", "deepCopy", "(", "T", "original", ")", "{", "if", "(", "original", "==", "null", ")", "{", "return", "null", ";", "}", "try", "{", "final", "ByteArrayOutputStream", "baos", "=", "new", ...
Provides a means to copy objects that do not implement Cloneable. Performs a deep copy where the copied object has no references to the original object for any object that implements Serializable. If the original is {@code null}, this method just returns {@code null}. @param <T> the type of the object to be cloned @param original the object to copied, may be {@code null} @return the copied object @since 1.1.1
[ "Provides", "a", "means", "to", "copy", "objects", "that", "do", "not", "implement", "Cloneable", ".", "Performs", "a", "deep", "copy", "where", "the", "copied", "object", "has", "no", "references", "to", "the", "original", "object", "for", "any", "object", ...
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/common/base/Objects.java#L61-L77
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShader.java
GVRShader.generateSignature
public String generateSignature(HashMap<String, Integer> defined, GVRLight[] lightlist) { return getClass().getSimpleName(); }
java
public String generateSignature(HashMap<String, Integer> defined, GVRLight[] lightlist) { return getClass().getSimpleName(); }
[ "public", "String", "generateSignature", "(", "HashMap", "<", "String", ",", "Integer", ">", "defined", ",", "GVRLight", "[", "]", "lightlist", ")", "{", "return", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ";", "}" ]
Create a unique signature for this shader. The signature for simple shaders is just the class name. For the more complex shaders generated by GVRShaderTemplate the signature includes information about the vertex attributes, uniforms, textures and lights used by the shader variant. @param defined names to be defined for this shader @return string signature for shader @see GVRShaderTemplate
[ "Create", "a", "unique", "signature", "for", "this", "shader", ".", "The", "signature", "for", "simple", "shaders", "is", "just", "the", "class", "name", ".", "For", "the", "more", "complex", "shaders", "generated", "by", "GVRShaderTemplate", "the", "signature...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShader.java#L244-L247
Azure/azure-sdk-for-java
storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java
BlobContainersInner.lockImmutabilityPolicy
public ImmutabilityPolicyInner lockImmutabilityPolicy(String resourceGroupName, String accountName, String containerName, String ifMatch) { return lockImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch).toBlocking().single().body(); }
java
public ImmutabilityPolicyInner lockImmutabilityPolicy(String resourceGroupName, String accountName, String containerName, String ifMatch) { return lockImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch).toBlocking().single().body(); }
[ "public", "ImmutabilityPolicyInner", "lockImmutabilityPolicy", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "containerName", ",", "String", "ifMatch", ")", "{", "return", "lockImmutabilityPolicyWithServiceResponseAsync", "(", "resourceGroup...
Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. @param ifMatch The entity state (ETag) version of the immutability policy to update. A value of "*" can be used to apply the operation only if the immutability policy already exists. If omitted, this operation will always be applied. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ImmutabilityPolicyInner object if successful.
[ "Sets", "the", "ImmutabilityPolicy", "to", "Locked", "state", ".", "The", "only", "action", "allowed", "on", "a", "Locked", "policy", "is", "ExtendImmutabilityPolicy", "action", ".", "ETag", "in", "If", "-", "Match", "is", "required", "for", "this", "operation...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java#L1486-L1488
aoindustries/aoweb-framework
src/main/java/com/aoindustries/website/framework/WebPage.java
WebPage.doPostWithSearch
protected void doPostWithSearch(WebSiteRequest req, HttpServletResponse resp) throws ServletException, IOException, SQLException { String query=req.getParameter("search_query"); String searchTarget=req.getParameter("search_target"); WebPageLayout layout=getWebPageLayout(req); if(query!=null && searchTarget!=null) { try (ChainWriter out = getHTMLChainWriter(req, resp)) { layout.startHTML(this, req, resp, out, "document.forms['search_two'].search_query.select(); document.forms['search_two'].search_query.focus();"); boolean entire_site=searchTarget.equals("entire_site"); WebPage target = entire_site ? getRootPage() : this; // If the target contains no pages, use its parent if(target.getCachedPages(req).length==0) target=target.getParent(); // Get the list of words to search for String[] words=StringUtility.splitString(query.replace('.', ' ')); List<SearchResult> results=new ArrayList<>(); if(words.length>0) { // Perform the search target.search(words, req, resp, results, new AoByteArrayOutputStream(), new SortedArrayList<>()); Collections.sort(results); //StringUtility.sortObjectsAndFloatDescending(results, 1, 5); } layout.printSearchOutput(this, out, req, resp, query, entire_site, results, words); layout.endHTML(this, req, resp, out); } } else { doPost(req, resp); } }
java
protected void doPostWithSearch(WebSiteRequest req, HttpServletResponse resp) throws ServletException, IOException, SQLException { String query=req.getParameter("search_query"); String searchTarget=req.getParameter("search_target"); WebPageLayout layout=getWebPageLayout(req); if(query!=null && searchTarget!=null) { try (ChainWriter out = getHTMLChainWriter(req, resp)) { layout.startHTML(this, req, resp, out, "document.forms['search_two'].search_query.select(); document.forms['search_two'].search_query.focus();"); boolean entire_site=searchTarget.equals("entire_site"); WebPage target = entire_site ? getRootPage() : this; // If the target contains no pages, use its parent if(target.getCachedPages(req).length==0) target=target.getParent(); // Get the list of words to search for String[] words=StringUtility.splitString(query.replace('.', ' ')); List<SearchResult> results=new ArrayList<>(); if(words.length>0) { // Perform the search target.search(words, req, resp, results, new AoByteArrayOutputStream(), new SortedArrayList<>()); Collections.sort(results); //StringUtility.sortObjectsAndFloatDescending(results, 1, 5); } layout.printSearchOutput(this, out, req, resp, query, entire_site, results, words); layout.endHTML(this, req, resp, out); } } else { doPost(req, resp); } }
[ "protected", "void", "doPostWithSearch", "(", "WebSiteRequest", "req", ",", "HttpServletResponse", "resp", ")", "throws", "ServletException", ",", "IOException", ",", "SQLException", "{", "String", "query", "=", "req", ".", "getParameter", "(", "\"search_query\"", "...
Handles any search posts, sends everything else on to <code>doPost(WebSiteRequest,HttpServletResponse)</code>. The search assumes the search parameters of <code>search_query</code> and <code>search_target</code>. Both these values must be present for a search to be performed. Search target may be either <code>"this_area"</code> or <code>"entire_site"</code>, defaulting to <code>"area"</code> for any other value. @see #doPost(WebSiteRequest,HttpServletResponse)
[ "Handles", "any", "search", "posts", "sends", "everything", "else", "on", "to", "<code", ">", "doPost", "(", "WebSiteRequest", "HttpServletResponse", ")", "<", "/", "code", ">", ".", "The", "search", "assumes", "the", "search", "parameters", "of", "<code", "...
train
https://github.com/aoindustries/aoweb-framework/blob/8e58af4f5dd898cd2fdb855ffa810a1ca6973ae0/src/main/java/com/aoindustries/website/framework/WebPage.java#L428-L459
facebookarchive/hadoop-20
src/core/org/apache/hadoop/ipc/RPC.java
RPC.getServer
public static Server getServer(final Object instance, final String bindAddress, final int port, Configuration conf) throws IOException { return getServer(instance, bindAddress, port, 1, false, conf); }
java
public static Server getServer(final Object instance, final String bindAddress, final int port, Configuration conf) throws IOException { return getServer(instance, bindAddress, port, 1, false, conf); }
[ "public", "static", "Server", "getServer", "(", "final", "Object", "instance", ",", "final", "String", "bindAddress", ",", "final", "int", "port", ",", "Configuration", "conf", ")", "throws", "IOException", "{", "return", "getServer", "(", "instance", ",", "bi...
Construct a server for a protocol implementation instance listening on a port and address.
[ "Construct", "a", "server", "for", "a", "protocol", "implementation", "instance", "listening", "on", "a", "port", "and", "address", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/ipc/RPC.java#L716-L719
threerings/nenya
core/src/main/java/com/threerings/media/tile/TileSet.java
TileSet.initTile
protected void initTile (Tile tile, int tileIndex, Colorization[] zations) { if (_improv != null) { tile.setImage(getTileMirage(tileIndex, zations)); } }
java
protected void initTile (Tile tile, int tileIndex, Colorization[] zations) { if (_improv != null) { tile.setImage(getTileMirage(tileIndex, zations)); } }
[ "protected", "void", "initTile", "(", "Tile", "tile", ",", "int", "tileIndex", ",", "Colorization", "[", "]", "zations", ")", "{", "if", "(", "_improv", "!=", "null", ")", "{", "tile", ".", "setImage", "(", "getTileMirage", "(", "tileIndex", ",", "zation...
Initializes the supplied tile. Derived classes can override this method to add in their own tile information, but should be sure to call <code>super.initTile()</code>. @param tile the tile to initialize. @param tileIndex the index of the tile. @param zations the colorizations to be used when generating the tile image.
[ "Initializes", "the", "supplied", "tile", ".", "Derived", "classes", "can", "override", "this", "method", "to", "add", "in", "their", "own", "tile", "information", "but", "should", "be", "sure", "to", "call", "<code", ">", "super", ".", "initTile", "()", "...
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/TileSet.java#L362-L367
yavijava/yavijava
src/main/java/com/vmware/vim25/mox/VirtualMachineDeviceManager.java
VirtualMachineDeviceManager.removeDevice
public Task removeDevice(VirtualDevice device, boolean destroyDeviceBacking) throws InvalidName, VmConfigFault, DuplicateName, TaskInProgress, FileFault, InvalidState, ConcurrentAccess, InvalidDatastore, InsufficientResourcesFault, RuntimeFault, RemoteException { ArrayList<VirtualDevice> deviceList = new ArrayList<VirtualDevice>(); deviceList.add(device); return removeDevices(deviceList, destroyDeviceBacking); }
java
public Task removeDevice(VirtualDevice device, boolean destroyDeviceBacking) throws InvalidName, VmConfigFault, DuplicateName, TaskInProgress, FileFault, InvalidState, ConcurrentAccess, InvalidDatastore, InsufficientResourcesFault, RuntimeFault, RemoteException { ArrayList<VirtualDevice> deviceList = new ArrayList<VirtualDevice>(); deviceList.add(device); return removeDevices(deviceList, destroyDeviceBacking); }
[ "public", "Task", "removeDevice", "(", "VirtualDevice", "device", ",", "boolean", "destroyDeviceBacking", ")", "throws", "InvalidName", ",", "VmConfigFault", ",", "DuplicateName", ",", "TaskInProgress", ",", "FileFault", ",", "InvalidState", ",", "ConcurrentAccess", "...
Remove the device. Make sure the VM is powered off before calling this method. If destroyDeviceBacking is true, it deletes backings for example files in datastore. BE CAREFUL!
[ "Remove", "the", "device", ".", "Make", "sure", "the", "VM", "is", "powered", "off", "before", "calling", "this", "method", ".", "If", "destroyDeviceBacking", "is", "true", "it", "deletes", "backings", "for", "example", "files", "in", "datastore", ".", "BE",...
train
https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mox/VirtualMachineDeviceManager.java#L673-L677
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.getKeysAsync
public Observable<Page<KeyItem>> getKeysAsync(final String vaultBaseUrl, final Integer maxresults) { return getKeysWithServiceResponseAsync(vaultBaseUrl, maxresults) .map(new Func1<ServiceResponse<Page<KeyItem>>, Page<KeyItem>>() { @Override public Page<KeyItem> call(ServiceResponse<Page<KeyItem>> response) { return response.body(); } }); }
java
public Observable<Page<KeyItem>> getKeysAsync(final String vaultBaseUrl, final Integer maxresults) { return getKeysWithServiceResponseAsync(vaultBaseUrl, maxresults) .map(new Func1<ServiceResponse<Page<KeyItem>>, Page<KeyItem>>() { @Override public Page<KeyItem> call(ServiceResponse<Page<KeyItem>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "KeyItem", ">", ">", "getKeysAsync", "(", "final", "String", "vaultBaseUrl", ",", "final", "Integer", "maxresults", ")", "{", "return", "getKeysWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "maxresults", ")", ".", ...
List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public part of a stored key. The LIST operation is applicable to all key types, however only the base key identifier, attributes, and tags are provided in the response. Individual versions of a key are not listed in the response. This operation requires the keys/list permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param maxresults Maximum number of results to return in a page. If not specified the service will return up to 25 results. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;KeyItem&gt; object
[ "List", "keys", "in", "the", "specified", "vault", ".", "Retrieves", "a", "list", "of", "the", "keys", "in", "the", "Key", "Vault", "as", "JSON", "Web", "Key", "structures", "that", "contain", "the", "public", "part", "of", "a", "stored", "key", ".", "...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L1883-L1891
jamesdbloom/mockserver
mockserver-core/src/main/java/org/mockserver/model/HttpResponse.java
HttpResponse.withHeader
public HttpResponse withHeader(NottableString name, NottableString... values) { this.headers.withEntry(header(name, values)); return this; }
java
public HttpResponse withHeader(NottableString name, NottableString... values) { this.headers.withEntry(header(name, values)); return this; }
[ "public", "HttpResponse", "withHeader", "(", "NottableString", "name", ",", "NottableString", "...", "values", ")", "{", "this", ".", "headers", ".", "withEntry", "(", "header", "(", "name", ",", "values", ")", ")", ";", "return", "this", ";", "}" ]
Add a header to return as a Header object, if a header with the same name already exists this will NOT be modified but two headers will exist @param name the header name as a NottableString @param values the header values which can be a varags of NottableStrings
[ "Add", "a", "header", "to", "return", "as", "a", "Header", "object", "if", "a", "header", "with", "the", "same", "name", "already", "exists", "this", "will", "NOT", "be", "modified", "but", "two", "headers", "will", "exist" ]
train
https://github.com/jamesdbloom/mockserver/blob/8b84fdd877e57b4eb780c9f8c8b1d65bcb448025/mockserver-core/src/main/java/org/mockserver/model/HttpResponse.java#L235-L238
VoltDB/voltdb
src/frontend/org/voltdb/jni/ExecutionEngine.java
ExecutionEngine.crashVoltDB
public static void crashVoltDB(String reason, String traces[], String filename, int lineno) { VoltLogger hostLog = new VoltLogger("HOST"); String fn = (filename == null) ? "unknown" : filename; String re = (reason == null) ? "Fatal EE error." : reason; hostLog.fatal(re + " In " + fn + ":" + lineno); if (traces != null) { for ( String trace : traces) { hostLog.fatal(trace); } } VoltDB.crashLocalVoltDB(re + " In " + fn + ":" + lineno, true, null); }
java
public static void crashVoltDB(String reason, String traces[], String filename, int lineno) { VoltLogger hostLog = new VoltLogger("HOST"); String fn = (filename == null) ? "unknown" : filename; String re = (reason == null) ? "Fatal EE error." : reason; hostLog.fatal(re + " In " + fn + ":" + lineno); if (traces != null) { for ( String trace : traces) { hostLog.fatal(trace); } } VoltDB.crashLocalVoltDB(re + " In " + fn + ":" + lineno, true, null); }
[ "public", "static", "void", "crashVoltDB", "(", "String", "reason", ",", "String", "traces", "[", "]", ",", "String", "filename", ",", "int", "lineno", ")", "{", "VoltLogger", "hostLog", "=", "new", "VoltLogger", "(", "\"HOST\"", ")", ";", "String", "fn", ...
Call VoltDB.crashVoltDB on behalf of the EE @param reason Reason the EE crashed
[ "Call", "VoltDB", ".", "crashVoltDB", "on", "behalf", "of", "the", "EE" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jni/ExecutionEngine.java#L385-L396
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_ns_runningconfig.java
ns_ns_runningconfig.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { ns_ns_runningconfig_responses result = (ns_ns_runningconfig_responses) service.get_payload_formatter().string_to_resource(ns_ns_runningconfig_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_ns_runningconfig_response_array); } ns_ns_runningconfig[] result_ns_ns_runningconfig = new ns_ns_runningconfig[result.ns_ns_runningconfig_response_array.length]; for(int i = 0; i < result.ns_ns_runningconfig_response_array.length; i++) { result_ns_ns_runningconfig[i] = result.ns_ns_runningconfig_response_array[i].ns_ns_runningconfig[0]; } return result_ns_ns_runningconfig; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { ns_ns_runningconfig_responses result = (ns_ns_runningconfig_responses) service.get_payload_formatter().string_to_resource(ns_ns_runningconfig_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_ns_runningconfig_response_array); } ns_ns_runningconfig[] result_ns_ns_runningconfig = new ns_ns_runningconfig[result.ns_ns_runningconfig_response_array.length]; for(int i = 0; i < result.ns_ns_runningconfig_response_array.length; i++) { result_ns_ns_runningconfig[i] = result.ns_ns_runningconfig_response_array[i].ns_ns_runningconfig[0]; } return result_ns_ns_runningconfig; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "ns_ns_runningconfig_responses", "result", "=", "(", "ns_ns_runningconfig_responses", ")", "service", ".", "ge...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_ns_runningconfig.java#L215-L232
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_monitor.java
xen_health_monitor.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { xen_health_monitor_responses result = (xen_health_monitor_responses) service.get_payload_formatter().string_to_resource(xen_health_monitor_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_health_monitor_response_array); } xen_health_monitor[] result_xen_health_monitor = new xen_health_monitor[result.xen_health_monitor_response_array.length]; for(int i = 0; i < result.xen_health_monitor_response_array.length; i++) { result_xen_health_monitor[i] = result.xen_health_monitor_response_array[i].xen_health_monitor[0]; } return result_xen_health_monitor; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { xen_health_monitor_responses result = (xen_health_monitor_responses) service.get_payload_formatter().string_to_resource(xen_health_monitor_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_health_monitor_response_array); } xen_health_monitor[] result_xen_health_monitor = new xen_health_monitor[result.xen_health_monitor_response_array.length]; for(int i = 0; i < result.xen_health_monitor_response_array.length; i++) { result_xen_health_monitor[i] = result.xen_health_monitor_response_array[i].xen_health_monitor[0]; } return result_xen_health_monitor; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "xen_health_monitor_responses", "result", "=", "(", "xen_health_monitor_responses", ")", "service", ".", "get_...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_monitor.java#L292-L309
bignerdranch/expandable-recycler-view
expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java
ExpandableRecyclerAdapter.notifyChildMoved
@UiThread public void notifyChildMoved(int parentPosition, int fromChildPosition, int toChildPosition) { P parent = mParentList.get(parentPosition); int flatParentPosition = getFlatParentPosition(parentPosition); ExpandableWrapper<P, C> parentWrapper = mFlatItemList.get(flatParentPosition); parentWrapper.setParent(parent); if (parentWrapper.isExpanded()) { ExpandableWrapper<P, C> fromChild = mFlatItemList.remove(flatParentPosition + 1 + fromChildPosition); mFlatItemList.add(flatParentPosition + 1 + toChildPosition, fromChild); notifyItemMoved(flatParentPosition + 1 + fromChildPosition, flatParentPosition + 1 + toChildPosition); } }
java
@UiThread public void notifyChildMoved(int parentPosition, int fromChildPosition, int toChildPosition) { P parent = mParentList.get(parentPosition); int flatParentPosition = getFlatParentPosition(parentPosition); ExpandableWrapper<P, C> parentWrapper = mFlatItemList.get(flatParentPosition); parentWrapper.setParent(parent); if (parentWrapper.isExpanded()) { ExpandableWrapper<P, C> fromChild = mFlatItemList.remove(flatParentPosition + 1 + fromChildPosition); mFlatItemList.add(flatParentPosition + 1 + toChildPosition, fromChild); notifyItemMoved(flatParentPosition + 1 + fromChildPosition, flatParentPosition + 1 + toChildPosition); } }
[ "@", "UiThread", "public", "void", "notifyChildMoved", "(", "int", "parentPosition", ",", "int", "fromChildPosition", ",", "int", "toChildPosition", ")", "{", "P", "parent", "=", "mParentList", ".", "get", "(", "parentPosition", ")", ";", "int", "flatParentPosit...
Notify any registered observers that the child list item contained within the parent at {@code parentPosition} has moved from {@code fromChildPosition} to {@code toChildPosition}. <p> <p>This is a structural change event. Representations of other existing items in the data set are still considered up to date and will not be rebound, though their positions may be altered.</p> @param parentPosition Position of the parent which has a child that has moved @param fromChildPosition Previous position of the child @param toChildPosition New position of the child
[ "Notify", "any", "registered", "observers", "that", "the", "child", "list", "item", "contained", "within", "the", "parent", "at", "{", "@code", "parentPosition", "}", "has", "moved", "from", "{", "@code", "fromChildPosition", "}", "to", "{", "@code", "toChildP...
train
https://github.com/bignerdranch/expandable-recycler-view/blob/930912510620894c531d236856fa79d646e2f1ed/expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java#L1297-L1309
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/f/FundamentalLinear.java
FundamentalLinear.createA
protected void createA(List<AssociatedPair> points, DMatrixRMaj A ) { A.reshape(points.size(),9, false); A.zero(); Point2D_F64 f_norm = new Point2D_F64(); Point2D_F64 s_norm = new Point2D_F64(); final int size = points.size(); for( int i = 0; i < size; i++ ) { AssociatedPair p = points.get(i); Point2D_F64 f = p.p1; Point2D_F64 s = p.p2; // normalize the points N1.apply(f, f_norm); N2.apply(s, s_norm); // perform the Kronecker product with the two points being in // homogeneous coordinates (z=1) A.unsafe_set(i,0,s_norm.x*f_norm.x); A.unsafe_set(i,1,s_norm.x*f_norm.y); A.unsafe_set(i,2,s_norm.x); A.unsafe_set(i,3,s_norm.y*f_norm.x); A.unsafe_set(i,4,s_norm.y*f_norm.y); A.unsafe_set(i,5,s_norm.y); A.unsafe_set(i,6,f_norm.x); A.unsafe_set(i,7,f_norm.y); A.unsafe_set(i,8,1); } }
java
protected void createA(List<AssociatedPair> points, DMatrixRMaj A ) { A.reshape(points.size(),9, false); A.zero(); Point2D_F64 f_norm = new Point2D_F64(); Point2D_F64 s_norm = new Point2D_F64(); final int size = points.size(); for( int i = 0; i < size; i++ ) { AssociatedPair p = points.get(i); Point2D_F64 f = p.p1; Point2D_F64 s = p.p2; // normalize the points N1.apply(f, f_norm); N2.apply(s, s_norm); // perform the Kronecker product with the two points being in // homogeneous coordinates (z=1) A.unsafe_set(i,0,s_norm.x*f_norm.x); A.unsafe_set(i,1,s_norm.x*f_norm.y); A.unsafe_set(i,2,s_norm.x); A.unsafe_set(i,3,s_norm.y*f_norm.x); A.unsafe_set(i,4,s_norm.y*f_norm.y); A.unsafe_set(i,5,s_norm.y); A.unsafe_set(i,6,f_norm.x); A.unsafe_set(i,7,f_norm.y); A.unsafe_set(i,8,1); } }
[ "protected", "void", "createA", "(", "List", "<", "AssociatedPair", ">", "points", ",", "DMatrixRMaj", "A", ")", "{", "A", ".", "reshape", "(", "points", ".", "size", "(", ")", ",", "9", ",", "false", ")", ";", "A", ".", "zero", "(", ")", ";", "P...
Reorganizes the epipolar constraint equation (x<sup>T</sup><sub>2</sub>*F*x<sub>1</sub> = 0) such that it is formulated as a standard linear system of the form Ax=0. Where A contains the pixel locations and x is the reformatted fundamental matrix. @param points Set of associated points in left and right images. @param A Matrix where the reformatted points are written to.
[ "Reorganizes", "the", "epipolar", "constraint", "equation", "(", "x<sup", ">", "T<", "/", "sup", ">", "<sub", ">", "2<", "/", "sub", ">", "*", "F", "*", "x<sub", ">", "1<", "/", "sub", ">", "=", "0", ")", "such", "that", "it", "is", "formulated", ...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/f/FundamentalLinear.java#L141-L171
kiegroup/drools
kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/DirectCompilerVisitor.java
DirectCompilerVisitor.visitExpressionList
@Override public DirectCompilerResult visitExpressionList(FEEL_1_1Parser.ExpressionListContext ctx) { List<DirectCompilerResult> exprs = new ArrayList<>(); for (int i = 0; i < ctx.getChildCount(); i++) { if (ctx.getChild(i) instanceof FEEL_1_1Parser.ExpressionContext) { FEEL_1_1Parser.ExpressionContext childCtx = (FEEL_1_1Parser.ExpressionContext) ctx.getChild(i); DirectCompilerResult child = visit(childCtx); exprs.add(child); } } MethodCallExpr list = new MethodCallExpr(null, "list"); exprs.stream().map(DirectCompilerResult::getExpression).forEach(list::addArgument); return DirectCompilerResult.of(list, BuiltInType.LIST, DirectCompilerResult.mergeFDs(exprs.toArray(new DirectCompilerResult[]{}))); }
java
@Override public DirectCompilerResult visitExpressionList(FEEL_1_1Parser.ExpressionListContext ctx) { List<DirectCompilerResult> exprs = new ArrayList<>(); for (int i = 0; i < ctx.getChildCount(); i++) { if (ctx.getChild(i) instanceof FEEL_1_1Parser.ExpressionContext) { FEEL_1_1Parser.ExpressionContext childCtx = (FEEL_1_1Parser.ExpressionContext) ctx.getChild(i); DirectCompilerResult child = visit(childCtx); exprs.add(child); } } MethodCallExpr list = new MethodCallExpr(null, "list"); exprs.stream().map(DirectCompilerResult::getExpression).forEach(list::addArgument); return DirectCompilerResult.of(list, BuiltInType.LIST, DirectCompilerResult.mergeFDs(exprs.toArray(new DirectCompilerResult[]{}))); }
[ "@", "Override", "public", "DirectCompilerResult", "visitExpressionList", "(", "FEEL_1_1Parser", ".", "ExpressionListContext", "ctx", ")", "{", "List", "<", "DirectCompilerResult", ">", "exprs", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "int", "i...
NOTE: technically this rule of the grammar does not have an equivalent Java expression (or a valid FEEL expression) per-se. Using here as assuming if this grammar rule trigger, it is intended as a List, either to be returned, or re-used internally in this visitor.
[ "NOTE", ":", "technically", "this", "rule", "of", "the", "grammar", "does", "not", "have", "an", "equivalent", "Java", "expression", "(", "or", "a", "valid", "FEEL", "expression", ")", "per", "-", "se", ".", "Using", "here", "as", "assuming", "if", "this...
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/DirectCompilerVisitor.java#L478-L491
BotMill/fb-botmill
src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/PaymentSummaryBuilder.java
PaymentSummaryBuilder.addPriceLabel
public PaymentSummaryBuilder addPriceLabel(String label, String amount) { PriceLabel priceLabel = new PriceLabel(label, amount); return addPriceLabel(priceLabel); }
java
public PaymentSummaryBuilder addPriceLabel(String label, String amount) { PriceLabel priceLabel = new PriceLabel(label, amount); return addPriceLabel(priceLabel); }
[ "public", "PaymentSummaryBuilder", "addPriceLabel", "(", "String", "label", ",", "String", "amount", ")", "{", "PriceLabel", "priceLabel", "=", "new", "PriceLabel", "(", "label", ",", "amount", ")", ";", "return", "addPriceLabel", "(", "priceLabel", ")", ";", ...
Adds a {@link PriceLabel} to the {@link PaymentSummary}. @param label the {@link PriceLabel#label}. @param amount the {@link PriceLabel#amount}. @return this builder.
[ "Adds", "a", "{", "@link", "PriceLabel", "}", "to", "the", "{", "@link", "PaymentSummary", "}", "." ]
train
https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/PaymentSummaryBuilder.java#L93-L96
j256/ormlite-android
src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java
OrmLiteConfigUtil.writeConfigFile
public static void writeConfigFile(OutputStream outputStream, Class<?>[] classes) throws SQLException, IOException { writeConfigFile(outputStream, classes, false); }
java
public static void writeConfigFile(OutputStream outputStream, Class<?>[] classes) throws SQLException, IOException { writeConfigFile(outputStream, classes, false); }
[ "public", "static", "void", "writeConfigFile", "(", "OutputStream", "outputStream", ",", "Class", "<", "?", ">", "[", "]", "classes", ")", "throws", "SQLException", ",", "IOException", "{", "writeConfigFile", "(", "outputStream", ",", "classes", ",", "false", ...
Write a configuration file to an output stream with the configuration for classes.
[ "Write", "a", "configuration", "file", "to", "an", "output", "stream", "with", "the", "configuration", "for", "classes", "." ]
train
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java#L225-L227
venmo/cursor-utils
cursor-utils/src/main/java/com/venmo/cursor/IterableCursorWrapper.java
IterableCursorWrapper.getString
public String getString(String columnName, String defaultValue) { int index = getColumnIndex(columnName); if (isValidIndex(index)) { return getString(index); } else { return defaultValue; } }
java
public String getString(String columnName, String defaultValue) { int index = getColumnIndex(columnName); if (isValidIndex(index)) { return getString(index); } else { return defaultValue; } }
[ "public", "String", "getString", "(", "String", "columnName", ",", "String", "defaultValue", ")", "{", "int", "index", "=", "getColumnIndex", "(", "columnName", ")", ";", "if", "(", "isValidIndex", "(", "index", ")", ")", "{", "return", "getString", "(", "...
Convenience alias to {@code getString\(getColumnIndex(columnName))}. If the column does not exist for the cursor, return {@code defaultValue}.
[ "Convenience", "alias", "to", "{" ]
train
https://github.com/venmo/cursor-utils/blob/52cf91c4253346632fe70b8d7b7eab8bbcc9b248/cursor-utils/src/main/java/com/venmo/cursor/IterableCursorWrapper.java#L70-L77
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/ChatApi.java
ChatApi.acceptChat
public ApiSuccessResponse acceptChat(String id, AcceptData acceptData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = acceptChatWithHttpInfo(id, acceptData); return resp.getData(); }
java
public ApiSuccessResponse acceptChat(String id, AcceptData acceptData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = acceptChatWithHttpInfo(id, acceptData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "acceptChat", "(", "String", "id", ",", "AcceptData", "acceptData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "acceptChatWithHttpInfo", "(", "id", ",", "acceptData", ")", ";", "r...
Accept a chat Accept the specified chat interaction. @param id The ID of the chat interaction. (required) @param acceptData Request parameters. (optional) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Accept", "a", "chat", "Accept", "the", "specified", "chat", "interaction", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/ChatApi.java#L149-L152
rackerlabs/clouddocs-maven-plugin
src/main/java/com/rackspace/cloud/api/docs/builders/PDFBuilder.java
PDFBuilder.createStyleSheetResolver
private URIResolver createStyleSheetResolver(CatalogResolver catalogResolver) throws MojoExecutionException { URIResolver uriResolver; try { URL url = getNonDefaultStylesheetURL() == null ? getDefaultStylesheetURL() : getNonDefaultStylesheetURL(); if (getLog().isDebugEnabled()) { getLog().debug("Using stylesheet: " + url.toExternalForm()); } uriResolver = new StylesheetResolver("urn:docbkx:stylesheet", new StreamSource(url.openStream(), url .toExternalForm()), catalogResolver); } catch (IOException ioe) { throw new MojoExecutionException("Failed to read stylesheet.", ioe); } return uriResolver; }
java
private URIResolver createStyleSheetResolver(CatalogResolver catalogResolver) throws MojoExecutionException { URIResolver uriResolver; try { URL url = getNonDefaultStylesheetURL() == null ? getDefaultStylesheetURL() : getNonDefaultStylesheetURL(); if (getLog().isDebugEnabled()) { getLog().debug("Using stylesheet: " + url.toExternalForm()); } uriResolver = new StylesheetResolver("urn:docbkx:stylesheet", new StreamSource(url.openStream(), url .toExternalForm()), catalogResolver); } catch (IOException ioe) { throw new MojoExecutionException("Failed to read stylesheet.", ioe); } return uriResolver; }
[ "private", "URIResolver", "createStyleSheetResolver", "(", "CatalogResolver", "catalogResolver", ")", "throws", "MojoExecutionException", "{", "URIResolver", "uriResolver", ";", "try", "{", "URL", "url", "=", "getNonDefaultStylesheetURL", "(", ")", "==", "null", "?", ...
Creates an URI resolver to handle <code>urn:docbkx:stylesheet(/)</code> as a special URI. This URI points to the default docbook stylesheet location @param catalogResolver The initial resolver to use @return The Stylesheet resolver. @throws MojoExecutionException If an error occurs while reading the stylesheet
[ "Creates", "an", "URI", "resolver", "to", "handle", "<code", ">", "urn", ":", "docbkx", ":", "stylesheet", "(", "/", ")", "<", "/", "code", ">", "as", "a", "special", "URI", ".", "This", "URI", "points", "to", "the", "default", "docbook", "stylesheet",...
train
https://github.com/rackerlabs/clouddocs-maven-plugin/blob/ba8554dc340db674307efdaac647c6fd2b58a34b/src/main/java/com/rackspace/cloud/api/docs/builders/PDFBuilder.java#L941-L954
Axway/Grapes
server/src/main/java/org/axway/grapes/server/webapp/resources/ArtifactResource.java
ArtifactResource.getGroupIds
@GET @Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON}) @Path(ServerAPI.GET_GROUPIDS) public Response getGroupIds(@Context final UriInfo uriInfo){ LOG.info("Got a get groupIds request [" + uriInfo.getPath() + "]"); final ListView view = new ListView("GroupIds view", "groupId"); final FiltersHolder filters = new FiltersHolder(); filters.init(uriInfo.getQueryParameters()); final List<String> groupIds = getArtifactHandler().getArtifactGroupIds(filters); Collections.sort(groupIds); view.addAll(groupIds); return Response.ok(view).build(); }
java
@GET @Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON}) @Path(ServerAPI.GET_GROUPIDS) public Response getGroupIds(@Context final UriInfo uriInfo){ LOG.info("Got a get groupIds request [" + uriInfo.getPath() + "]"); final ListView view = new ListView("GroupIds view", "groupId"); final FiltersHolder filters = new FiltersHolder(); filters.init(uriInfo.getQueryParameters()); final List<String> groupIds = getArtifactHandler().getArtifactGroupIds(filters); Collections.sort(groupIds); view.addAll(groupIds); return Response.ok(view).build(); }
[ "@", "GET", "@", "Produces", "(", "{", "MediaType", ".", "TEXT_HTML", ",", "MediaType", ".", "APPLICATION_JSON", "}", ")", "@", "Path", "(", "ServerAPI", ".", "GET_GROUPIDS", ")", "public", "Response", "getGroupIds", "(", "@", "Context", "final", "UriInfo", ...
Return a list of groupIds, stored in Grapes. This method is call via GET <grapes_url>/artifact/groupids @return Response A list (in HTML or JSON) of gavc
[ "Return", "a", "list", "of", "groupIds", "stored", "in", "Grapes", ".", "This", "method", "is", "call", "via", "GET", "<grapes_url", ">", "/", "artifact", "/", "groupids" ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/webapp/resources/ArtifactResource.java#L144-L158
apereo/cas
support/cas-server-support-couchdb-service-registry/src/main/java/org/apereo/cas/couchdb/services/RegisteredServiceCouchDbRepository.java
RegisteredServiceCouchDbRepository.findByServiceId
@View(name = "by_serviceId", map = "function(doc) { if (doc.service) { emit(doc.service.serviceId, doc._id) }}") public RegisteredServiceDocument findByServiceId(final String serviceId) { return queryView("by_serviceId", serviceId).stream().findFirst().orElse(null); }
java
@View(name = "by_serviceId", map = "function(doc) { if (doc.service) { emit(doc.service.serviceId, doc._id) }}") public RegisteredServiceDocument findByServiceId(final String serviceId) { return queryView("by_serviceId", serviceId).stream().findFirst().orElse(null); }
[ "@", "View", "(", "name", "=", "\"by_serviceId\"", ",", "map", "=", "\"function(doc) { if (doc.service) { emit(doc.service.serviceId, doc._id) }}\"", ")", "public", "RegisteredServiceDocument", "findByServiceId", "(", "final", "String", "serviceId", ")", "{", "return", "que...
Implements search by serviceId. @param serviceId The serviceId of the service to find. @return The service found or +null+.
[ "Implements", "search", "by", "serviceId", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-couchdb-service-registry/src/main/java/org/apereo/cas/couchdb/services/RegisteredServiceCouchDbRepository.java#L36-L39
xetorthio/jedis
src/main/java/redis/clients/jedis/BinaryJedis.java
BinaryJedis.incrBy
@Override public Long incrBy(final byte[] key, final long increment) { checkIsInMultiOrPipeline(); client.incrBy(key, increment); return client.getIntegerReply(); }
java
@Override public Long incrBy(final byte[] key, final long increment) { checkIsInMultiOrPipeline(); client.incrBy(key, increment); return client.getIntegerReply(); }
[ "@", "Override", "public", "Long", "incrBy", "(", "final", "byte", "[", "]", "key", ",", "final", "long", "increment", ")", "{", "checkIsInMultiOrPipeline", "(", ")", ";", "client", ".", "incrBy", "(", "key", ",", "increment", ")", ";", "return", "client...
INCRBY work just like {@link #incr(byte[]) INCR} but instead to increment by 1 the increment is integer. <p> INCR commands are limited to 64 bit signed integers. <p> Note: this is actually a string operation, that is, in Redis there are not "integer" types. Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented, and then converted back as a string. <p> Time complexity: O(1) @see #incr(byte[]) @see #decr(byte[]) @see #decrBy(byte[], long) @param key @param increment @return Integer reply, this commands will reply with the new value of key after the increment.
[ "INCRBY", "work", "just", "like", "{" ]
train
https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L781-L786
dmart28/reveno
reveno-core/src/main/java/org/reveno/atp/core/repository/ImmutableModelRepository.java
ImmutableModelRepository.isDeleted
protected boolean isDeleted(Class<?> type, long key) { return removed.size() > 0 && removed.containsKey(type) && removed.get(type).size() > 0 && removed.get(type).contains(key); }
java
protected boolean isDeleted(Class<?> type, long key) { return removed.size() > 0 && removed.containsKey(type) && removed.get(type).size() > 0 && removed.get(type).contains(key); }
[ "protected", "boolean", "isDeleted", "(", "Class", "<", "?", ">", "type", ",", "long", "key", ")", "{", "return", "removed", ".", "size", "(", ")", ">", "0", "&&", "removed", ".", "containsKey", "(", "type", ")", "&&", "removed", ".", "get", "(", "...
/* size checking mainly for performance issues on cases where there is no need to check map
[ "/", "*", "size", "checking", "mainly", "for", "performance", "issues", "on", "cases", "where", "there", "is", "no", "need", "to", "check", "map" ]
train
https://github.com/dmart28/reveno/blob/33617651fab8f0c0af70e7d3af7273cdbfe164d2/reveno-core/src/main/java/org/reveno/atp/core/repository/ImmutableModelRepository.java#L164-L166
elki-project/elki
elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/subspace/OUTRES.java
OUTRES.subsetNeighborhoodQuery
private DoubleDBIDList subsetNeighborhoodQuery(DoubleDBIDList neighc, DBIDRef dbid, PrimitiveDistanceFunction<? super NumberVector> df, double adjustedEps, KernelDensityEstimator kernel, ModifiableDoubleDBIDList n) { n.clear(); NumberVector query = kernel.relation.get(dbid); for(DoubleDBIDListIter neighbor = neighc.iter(); neighbor.valid(); neighbor.advance()) { // TODO: use triangle inequality for pruning double dist = df.distance(query, kernel.relation.get(neighbor)); if(dist <= adjustedEps) { n.add(dist, neighbor); } } return n; }
java
private DoubleDBIDList subsetNeighborhoodQuery(DoubleDBIDList neighc, DBIDRef dbid, PrimitiveDistanceFunction<? super NumberVector> df, double adjustedEps, KernelDensityEstimator kernel, ModifiableDoubleDBIDList n) { n.clear(); NumberVector query = kernel.relation.get(dbid); for(DoubleDBIDListIter neighbor = neighc.iter(); neighbor.valid(); neighbor.advance()) { // TODO: use triangle inequality for pruning double dist = df.distance(query, kernel.relation.get(neighbor)); if(dist <= adjustedEps) { n.add(dist, neighbor); } } return n; }
[ "private", "DoubleDBIDList", "subsetNeighborhoodQuery", "(", "DoubleDBIDList", "neighc", ",", "DBIDRef", "dbid", ",", "PrimitiveDistanceFunction", "<", "?", "super", "NumberVector", ">", "df", ",", "double", "adjustedEps", ",", "KernelDensityEstimator", "kernel", ",", ...
Refine neighbors within a subset. @param neighc Neighbor candidates @param dbid Query object @param df distance function @param adjustedEps Epsilon range @param kernel Kernel @param n Output list @return Neighbors of neighbor object
[ "Refine", "neighbors", "within", "a", "subset", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/subspace/OUTRES.java#L228-L239
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/taskmanager/TaskManagerService.java
TaskManagerService.attemptToExecuteTask
private void attemptToExecuteTask(ApplicationDefinition appDef, Task task, TaskRecord taskRecord) { Tenant tenant = Tenant.getTenant(appDef); String taskID = taskRecord.getTaskID(); String claimID = "_claim/" + taskID; long claimStamp = System.currentTimeMillis(); writeTaskClaim(tenant, claimID, claimStamp); if (taskClaimedByUs(tenant, claimID)) { startTask(appDef, task, taskRecord); } else { m_logger.info("Will not start task: it was claimed by another service"); } }
java
private void attemptToExecuteTask(ApplicationDefinition appDef, Task task, TaskRecord taskRecord) { Tenant tenant = Tenant.getTenant(appDef); String taskID = taskRecord.getTaskID(); String claimID = "_claim/" + taskID; long claimStamp = System.currentTimeMillis(); writeTaskClaim(tenant, claimID, claimStamp); if (taskClaimedByUs(tenant, claimID)) { startTask(appDef, task, taskRecord); } else { m_logger.info("Will not start task: it was claimed by another service"); } }
[ "private", "void", "attemptToExecuteTask", "(", "ApplicationDefinition", "appDef", ",", "Task", "task", ",", "TaskRecord", "taskRecord", ")", "{", "Tenant", "tenant", "=", "Tenant", ".", "getTenant", "(", "appDef", ")", ";", "String", "taskID", "=", "taskRecord"...
Attempt to start the given task by creating claim and see if we win it.
[ "Attempt", "to", "start", "the", "given", "task", "by", "creating", "claim", "and", "see", "if", "we", "win", "it", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/taskmanager/TaskManagerService.java#L398-L409
m-m-m/util
collection/src/main/java/net/sf/mmm/util/collection/base/AbstractClassHierarchyMap.java
AbstractClassHierarchyMap.isPreferable
protected boolean isPreferable(E element, Class<?> elementType, E existing, Class<?> currentType) { return false; }
java
protected boolean isPreferable(E element, Class<?> elementType, E existing, Class<?> currentType) { return false; }
[ "protected", "boolean", "isPreferable", "(", "E", "element", ",", "Class", "<", "?", ">", "elementType", ",", "E", "existing", ",", "Class", "<", "?", ">", "currentType", ")", "{", "return", "false", ";", "}" ]
This method determines if the given {@code element} should be {@link #get(Class) associated} with {@code currentType} in preference to the element {@code existing} that is already registered and will be replaced according to the result of this method. @param element is the element to register. @param elementType is the type for which the given {@code element} is to be registered originally. @param existing is the element that has already been registered before and is {@link #get(Class) associated} with {@code currentType}. @param currentType is the registration type. @return {@code true} if the given {@code element} is preferable and should replace {@code existing} for {@code currentType}, {@code false} otherwise (if {@code existing} should remain {@link #get(Class) associated} with {@code currentType} ).
[ "This", "method", "determines", "if", "the", "given", "{", "@code", "element", "}", "should", "be", "{", "@link", "#get", "(", "Class", ")", "associated", "}", "with", "{", "@code", "currentType", "}", "in", "preference", "to", "the", "element", "{", "@c...
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/collection/src/main/java/net/sf/mmm/util/collection/base/AbstractClassHierarchyMap.java#L69-L72
alkacon/opencms-core
src/org/opencms/ui/apps/user/CmsUserTable.java
CmsUserTable.addUserToContainer
protected void addUserToContainer(IndexedContainer container, CmsUser user) { if (m_blackList.contains(user)) { return; } Item item = container.addItem(user); fillItem(item, user); }
java
protected void addUserToContainer(IndexedContainer container, CmsUser user) { if (m_blackList.contains(user)) { return; } Item item = container.addItem(user); fillItem(item, user); }
[ "protected", "void", "addUserToContainer", "(", "IndexedContainer", "container", ",", "CmsUser", "user", ")", "{", "if", "(", "m_blackList", ".", "contains", "(", "user", ")", ")", "{", "return", ";", "}", "Item", "item", "=", "container", ".", "addItem", ...
Adds given user to given IndexedContainer.<p> @param container to add the user to @param user to add
[ "Adds", "given", "user", "to", "given", "IndexedContainer", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsUserTable.java#L1017-L1024
Jasig/uPortal
uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/login/LoginPortletHelper.java
LoginPortletHelper.getSelectedProfile
public String getSelectedProfile(PortletRequest request) { // if a profile selection exists in the session, use it final PortletSession session = request.getPortletSession(); String profileName = (String) session.getAttribute( SessionAttributeProfileMapperImpl.DEFAULT_SESSION_ATTRIBUTE_NAME, PortletSession.APPLICATION_SCOPE); // otherwise, set the selected profile to the one currently in use by // the user if (profileName == null) { // get the profile for the current request final HttpServletRequest httpServletRequest = portalRequestUtils.getPortletHttpRequest(request); final IUserInstance ui = userInstanceManager.getUserInstance(httpServletRequest); final IUserProfile profile = ui.getPreferencesManager().getUserProfile(); // check to see if the profile's fname matches one of the entries in // the profile key map used by the session attribute profile mapper for (Map.Entry<String, String> entry : mappings.entrySet()) { if (entry.getValue().equals(profile.getProfileFname())) { profileName = entry.getKey(); break; } } } return profileName; }
java
public String getSelectedProfile(PortletRequest request) { // if a profile selection exists in the session, use it final PortletSession session = request.getPortletSession(); String profileName = (String) session.getAttribute( SessionAttributeProfileMapperImpl.DEFAULT_SESSION_ATTRIBUTE_NAME, PortletSession.APPLICATION_SCOPE); // otherwise, set the selected profile to the one currently in use by // the user if (profileName == null) { // get the profile for the current request final HttpServletRequest httpServletRequest = portalRequestUtils.getPortletHttpRequest(request); final IUserInstance ui = userInstanceManager.getUserInstance(httpServletRequest); final IUserProfile profile = ui.getPreferencesManager().getUserProfile(); // check to see if the profile's fname matches one of the entries in // the profile key map used by the session attribute profile mapper for (Map.Entry<String, String> entry : mappings.entrySet()) { if (entry.getValue().equals(profile.getProfileFname())) { profileName = entry.getKey(); break; } } } return profileName; }
[ "public", "String", "getSelectedProfile", "(", "PortletRequest", "request", ")", "{", "// if a profile selection exists in the session, use it", "final", "PortletSession", "session", "=", "request", ".", "getPortletSession", "(", ")", ";", "String", "profileName", "=", "(...
Get the profile that should be pre-selected in the local login form. @param request @return
[ "Get", "the", "profile", "that", "should", "be", "pre", "-", "selected", "in", "the", "local", "login", "form", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/login/LoginPortletHelper.java#L69-L99
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/NewInstance.java
NewInstance.newInstance
static Object newInstance (ClassLoader classLoader, String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException { Class driverClass; if (classLoader == null) { driverClass = Class.forName(className); } else { driverClass = classLoader.loadClass(className); } return driverClass.newInstance(); }
java
static Object newInstance (ClassLoader classLoader, String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException { Class driverClass; if (classLoader == null) { driverClass = Class.forName(className); } else { driverClass = classLoader.loadClass(className); } return driverClass.newInstance(); }
[ "static", "Object", "newInstance", "(", "ClassLoader", "classLoader", ",", "String", "className", ")", "throws", "ClassNotFoundException", ",", "IllegalAccessException", ",", "InstantiationException", "{", "Class", "driverClass", ";", "if", "(", "classLoader", "==", "...
Creates a new instance of the specified class name Package private so this code is not exposed at the API level.
[ "Creates", "a", "new", "instance", "of", "the", "specified", "class", "name" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/NewInstance.java#L41-L52
steveohara/j2mod
src/main/java/com/ghgande/j2mod/modbus/io/ModbusRTUTransport.java
ModbusRTUTransport.readResponseIn
protected ModbusResponse readResponseIn() throws ModbusIOException { boolean done; ModbusResponse response; int dlength; try { do { // 1. read to function code, create request and read function // specific bytes synchronized (byteInputStream) { int uid = readByte(); if (uid != -1) { int fc = readByte(); byteInputOutputStream.reset(); byteInputOutputStream.writeByte(uid); byteInputOutputStream.writeByte(fc); // create response to acquire length of message response = ModbusResponse.createModbusResponse(fc); response.setHeadless(); /* * With Modbus RTU, there is no end frame. Either we * assume the message is complete as is or we must do * function specific processing to know the correct * length. To avoid moving frame timing to the serial * input functions, we set the timeout and to message * specific parsing to read a response. */ getResponse(fc, byteInputOutputStream); dlength = byteInputOutputStream.size() - 2; // less the crc if (logger.isDebugEnabled()) { logger.debug("Response: {}", ModbusUtil.toHex(byteInputOutputStream.getBuffer(), 0, dlength + 2)); } byteInputStream.reset(inBuffer, dlength); // check CRC int[] crc = ModbusUtil.calculateCRC(inBuffer, 0, dlength); // does not include CRC if (ModbusUtil.unsignedByteToInt(inBuffer[dlength]) != crc[0] || ModbusUtil.unsignedByteToInt(inBuffer[dlength + 1]) != crc[1]) { logger.debug("CRC should be {}, {}", crc[0], crc[1]); throw new IOException("CRC Error in received frame: " + dlength + " bytes: " + ModbusUtil.toHex(byteInputStream.getBuffer(), 0, dlength)); } } else { throw new IOException("Error reading response"); } // read response byteInputStream.reset(inBuffer, dlength); response.readFrom(byteInputStream); done = true; } } while (!done); return response; } catch (IOException ex) { // FIXME: This printout is wrong when reading response from other slave throw new ModbusIOException("I/O exception - failed to read response for request [%s] - %s", ModbusUtil.toHex(lastRequest), ex.getMessage()); } }
java
protected ModbusResponse readResponseIn() throws ModbusIOException { boolean done; ModbusResponse response; int dlength; try { do { // 1. read to function code, create request and read function // specific bytes synchronized (byteInputStream) { int uid = readByte(); if (uid != -1) { int fc = readByte(); byteInputOutputStream.reset(); byteInputOutputStream.writeByte(uid); byteInputOutputStream.writeByte(fc); // create response to acquire length of message response = ModbusResponse.createModbusResponse(fc); response.setHeadless(); /* * With Modbus RTU, there is no end frame. Either we * assume the message is complete as is or we must do * function specific processing to know the correct * length. To avoid moving frame timing to the serial * input functions, we set the timeout and to message * specific parsing to read a response. */ getResponse(fc, byteInputOutputStream); dlength = byteInputOutputStream.size() - 2; // less the crc if (logger.isDebugEnabled()) { logger.debug("Response: {}", ModbusUtil.toHex(byteInputOutputStream.getBuffer(), 0, dlength + 2)); } byteInputStream.reset(inBuffer, dlength); // check CRC int[] crc = ModbusUtil.calculateCRC(inBuffer, 0, dlength); // does not include CRC if (ModbusUtil.unsignedByteToInt(inBuffer[dlength]) != crc[0] || ModbusUtil.unsignedByteToInt(inBuffer[dlength + 1]) != crc[1]) { logger.debug("CRC should be {}, {}", crc[0], crc[1]); throw new IOException("CRC Error in received frame: " + dlength + " bytes: " + ModbusUtil.toHex(byteInputStream.getBuffer(), 0, dlength)); } } else { throw new IOException("Error reading response"); } // read response byteInputStream.reset(inBuffer, dlength); response.readFrom(byteInputStream); done = true; } } while (!done); return response; } catch (IOException ex) { // FIXME: This printout is wrong when reading response from other slave throw new ModbusIOException("I/O exception - failed to read response for request [%s] - %s", ModbusUtil.toHex(lastRequest), ex.getMessage()); } }
[ "protected", "ModbusResponse", "readResponseIn", "(", ")", "throws", "ModbusIOException", "{", "boolean", "done", ";", "ModbusResponse", "response", ";", "int", "dlength", ";", "try", "{", "do", "{", "// 1. read to function code, create request and read function", "// spe...
readResponse - Read the bytes for the response from the slave. @return a <tt>ModbusRespose</tt> @throws com.ghgande.j2mod.modbus.ModbusIOException If the response cannot be read from the socket/port
[ "readResponse", "-", "Read", "the", "bytes", "for", "the", "response", "from", "the", "slave", "." ]
train
https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/io/ModbusRTUTransport.java#L406-L466
contentful/contentful-management.java
src/main/java/com/contentful/java/cma/model/CMAEntry.java
CMAEntry.setField
public CMAEntry setField(String key, String locale, Object value) { if (fields == null) { fields = new LinkedHashMap<String, LinkedHashMap<String, Object>>(); } LinkedHashMap<String, Object> field = fields.get(key); if (field == null) { field = new LinkedHashMap<String, Object>(); } field.put(locale, value); fields.put(key, field); return this; }
java
public CMAEntry setField(String key, String locale, Object value) { if (fields == null) { fields = new LinkedHashMap<String, LinkedHashMap<String, Object>>(); } LinkedHashMap<String, Object> field = fields.get(key); if (field == null) { field = new LinkedHashMap<String, Object>(); } field.put(locale, value); fields.put(key, field); return this; }
[ "public", "CMAEntry", "setField", "(", "String", "key", ",", "String", "locale", ",", "Object", "value", ")", "{", "if", "(", "fields", "==", "null", ")", "{", "fields", "=", "new", "LinkedHashMap", "<", "String", ",", "LinkedHashMap", "<", "String", ","...
Creates a new field with the given {@code value}. If a field named {@code key} already exists it will be replaced. @param key field key @param locale locale @param value value @return this {@code CMAEntry}
[ "Creates", "a", "new", "field", "with", "the", "given", "{", "@code", "value", "}", ".", "If", "a", "field", "named", "{", "@code", "key", "}", "already", "exists", "it", "will", "be", "replaced", "." ]
train
https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/model/CMAEntry.java#L99-L112
telly/groundy
library/src/main/java/com/telly/groundy/TaskResult.java
TaskResult.add
public TaskResult add(String key, String[] value) { mBundle.putStringArray(key, value); return this; }
java
public TaskResult add(String key, String[] value) { mBundle.putStringArray(key, value); return this; }
[ "public", "TaskResult", "add", "(", "String", "key", ",", "String", "[", "]", "value", ")", "{", "mBundle", ".", "putStringArray", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts a String array 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 String array object, or null
[ "Inserts", "a", "String", "array", "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/TaskResult.java#L372-L375
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java
AbstractIndexWriter.addDescription
protected void addDescription(PackageDoc pkg, Content dlTree) { Content link = getPackageLink(pkg, new StringContent(Util.getPackageName(pkg))); Content dt = HtmlTree.DT(link); dt.addContent(" - "); dt.addContent(getResource("doclet.package")); dt.addContent(" " + pkg.name()); dlTree.addContent(dt); Content dd = new HtmlTree(HtmlTag.DD); addSummaryComment(pkg, dd); dlTree.addContent(dd); }
java
protected void addDescription(PackageDoc pkg, Content dlTree) { Content link = getPackageLink(pkg, new StringContent(Util.getPackageName(pkg))); Content dt = HtmlTree.DT(link); dt.addContent(" - "); dt.addContent(getResource("doclet.package")); dt.addContent(" " + pkg.name()); dlTree.addContent(dt); Content dd = new HtmlTree(HtmlTag.DD); addSummaryComment(pkg, dd); dlTree.addContent(dd); }
[ "protected", "void", "addDescription", "(", "PackageDoc", "pkg", ",", "Content", "dlTree", ")", "{", "Content", "link", "=", "getPackageLink", "(", "pkg", ",", "new", "StringContent", "(", "Util", ".", "getPackageName", "(", "pkg", ")", ")", ")", ";", "Con...
Add one line summary comment for the package. @param pkg the package to be documented @param dlTree the content tree to which the description will be added
[ "Add", "one", "line", "summary", "comment", "for", "the", "package", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java#L124-L134
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/Table.java
Table.insertSys
public int insertSys(PersistentStore store, Result ins) { RowSetNavigator nav = ins.getNavigator(); int count = 0; while (nav.hasNext()) { insertSys(store, nav.getNext()); count++; } return count; }
java
public int insertSys(PersistentStore store, Result ins) { RowSetNavigator nav = ins.getNavigator(); int count = 0; while (nav.hasNext()) { insertSys(store, nav.getNext()); count++; } return count; }
[ "public", "int", "insertSys", "(", "PersistentStore", "store", ",", "Result", "ins", ")", "{", "RowSetNavigator", "nav", "=", "ins", ".", "getNavigator", "(", ")", ";", "int", "count", "=", "0", ";", "while", "(", "nav", ".", "hasNext", "(", ")", ")", ...
Used for system table inserts. No checks. No identity columns.
[ "Used", "for", "system", "table", "inserts", ".", "No", "checks", ".", "No", "identity", "columns", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/Table.java#L2310-L2322
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/FdfWriter.java
FdfWriter.setFieldAsString
public boolean setFieldAsString(String field, String value) { return setField(field, new PdfString(value, PdfObject.TEXT_UNICODE)); }
java
public boolean setFieldAsString(String field, String value) { return setField(field, new PdfString(value, PdfObject.TEXT_UNICODE)); }
[ "public", "boolean", "setFieldAsString", "(", "String", "field", ",", "String", "value", ")", "{", "return", "setField", "(", "field", ",", "new", "PdfString", "(", "value", ",", "PdfObject", ".", "TEXT_UNICODE", ")", ")", ";", "}" ]
Sets the field value as a string. @param field the fully qualified field name @param value the value @return <CODE>true</CODE> if the value was inserted, <CODE>false</CODE> if the name is incompatible with an existing field
[ "Sets", "the", "field", "value", "as", "a", "string", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/FdfWriter.java#L227-L229
mgormley/optimize
src/main/java/edu/jhu/hlt/util/Utilities.java
Utilities.logSubtractExact
public static double logSubtractExact(double x, double y) { if (x < y) { throw new IllegalStateException("x must be >= y. x=" + x + " y=" + y); } // p = 0 or q = 0, where x = log(p), y = log(q) if (Double.NEGATIVE_INFINITY == y) { return x; } else if (Double.NEGATIVE_INFINITY == x) { return y; } // p != 0 && q != 0 return x + Math.log1p(-exp(y - x)); }
java
public static double logSubtractExact(double x, double y) { if (x < y) { throw new IllegalStateException("x must be >= y. x=" + x + " y=" + y); } // p = 0 or q = 0, where x = log(p), y = log(q) if (Double.NEGATIVE_INFINITY == y) { return x; } else if (Double.NEGATIVE_INFINITY == x) { return y; } // p != 0 && q != 0 return x + Math.log1p(-exp(y - x)); }
[ "public", "static", "double", "logSubtractExact", "(", "double", "x", ",", "double", "y", ")", "{", "if", "(", "x", "<", "y", ")", "{", "throw", "new", "IllegalStateException", "(", "\"x must be >= y. x=\"", "+", "x", "+", "\" y=\"", "+", "y", ")", ";", ...
Subtracts two probabilities that are stored as log probabilities. Note that x >= y. @param x log(p) @param y log(q) @return log(p - q) = log(exp(p) + exp(q)) @throws IllegalStateException if x < y
[ "Subtracts", "two", "probabilities", "that", "are", "stored", "as", "log", "probabilities", ".", "Note", "that", "x", ">", "=", "y", "." ]
train
https://github.com/mgormley/optimize/blob/3d1b93260b99febb8a5ecd9e8543c223e151a8d3/src/main/java/edu/jhu/hlt/util/Utilities.java#L222-L236
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/IntegrationAccountsInner.java
IntegrationAccountsInner.logTrackingEvents
public void logTrackingEvents(String resourceGroupName, String integrationAccountName, TrackingEventsDefinition logTrackingEvents) { logTrackingEventsWithServiceResponseAsync(resourceGroupName, integrationAccountName, logTrackingEvents).toBlocking().single().body(); }
java
public void logTrackingEvents(String resourceGroupName, String integrationAccountName, TrackingEventsDefinition logTrackingEvents) { logTrackingEventsWithServiceResponseAsync(resourceGroupName, integrationAccountName, logTrackingEvents).toBlocking().single().body(); }
[ "public", "void", "logTrackingEvents", "(", "String", "resourceGroupName", ",", "String", "integrationAccountName", ",", "TrackingEventsDefinition", "logTrackingEvents", ")", "{", "logTrackingEventsWithServiceResponseAsync", "(", "resourceGroupName", ",", "integrationAccountName"...
Logs the integration account's tracking events. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param logTrackingEvents The callback URL parameters. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Logs", "the", "integration", "account", "s", "tracking", "events", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/IntegrationAccountsInner.java#L1130-L1132
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/core/utils/MiscUtil.java
MiscUtil.createRequestBody
public static RequestBody createRequestBody(final MediaType contentType, final InputStream stream) { return new RequestBody() { @Override public MediaType contentType() { return contentType; } @Override public void writeTo(BufferedSink sink) throws IOException { try (Source source = Okio.source(stream)) { sink.writeAll(source); } } }; }
java
public static RequestBody createRequestBody(final MediaType contentType, final InputStream stream) { return new RequestBody() { @Override public MediaType contentType() { return contentType; } @Override public void writeTo(BufferedSink sink) throws IOException { try (Source source = Okio.source(stream)) { sink.writeAll(source); } } }; }
[ "public", "static", "RequestBody", "createRequestBody", "(", "final", "MediaType", "contentType", ",", "final", "InputStream", "stream", ")", "{", "return", "new", "RequestBody", "(", ")", "{", "@", "Override", "public", "MediaType", "contentType", "(", ")", "{"...
Creates a new request body that transmits the provided {@link java.io.InputStream InputStream}. @param contentType The {@link okhttp3.MediaType MediaType} of the data @param stream The {@link java.io.InputStream InputStream} to be transmitted @return RequestBody capable of transmitting the provided InputStream of data
[ "Creates", "a", "new", "request", "body", "that", "transmits", "the", "provided", "{", "@link", "java", ".", "io", ".", "InputStream", "InputStream", "}", "." ]
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/utils/MiscUtil.java#L299-L318
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java
SourceStream.msgCanBeSent
private synchronized boolean msgCanBeSent( long stamp, boolean nackMsg ) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "msgCanBeSent", new Object[] { Long.valueOf(stamp), Boolean.valueOf(nackMsg), Long.valueOf(firstMsgOutsideWindow), Boolean.valueOf(containsGuesses)}); boolean sendMessage = true; // Check whether we can send the message // Don't send any messages once there is a guess in the stream (unless a NACK) if ((stamp >= firstMsgOutsideWindow) || (containsGuesses && !nackMsg)) { sendMessage = false; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "firstMsgOutsideWindow is: " + firstMsgOutsideWindow + " sendWindow is " + sendWindow + " containsGuesses is " + containsGuesses); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "msgCanBeSent", Boolean.valueOf(sendMessage)); return sendMessage; }
java
private synchronized boolean msgCanBeSent( long stamp, boolean nackMsg ) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "msgCanBeSent", new Object[] { Long.valueOf(stamp), Boolean.valueOf(nackMsg), Long.valueOf(firstMsgOutsideWindow), Boolean.valueOf(containsGuesses)}); boolean sendMessage = true; // Check whether we can send the message // Don't send any messages once there is a guess in the stream (unless a NACK) if ((stamp >= firstMsgOutsideWindow) || (containsGuesses && !nackMsg)) { sendMessage = false; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "firstMsgOutsideWindow is: " + firstMsgOutsideWindow + " sendWindow is " + sendWindow + " containsGuesses is " + containsGuesses); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "msgCanBeSent", Boolean.valueOf(sendMessage)); return sendMessage; }
[ "private", "synchronized", "boolean", "msgCanBeSent", "(", "long", "stamp", ",", "boolean", "nackMsg", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", ...
Method that determines if the message can be sent. If the message is a NACK message then we should not check the stream for guesses, but we should still follow the other checks for the stream. @param stamp @return
[ "Method", "that", "determines", "if", "the", "message", "can", "be", "sent", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java#L2037-L2063
sebastiangraf/treetank
interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/util/WorkerHelper.java
WorkerHelper.serializeXML
public static XMLSerializer serializeXML(final ISession session, final OutputStream out, final boolean serializeXMLDec, final boolean serializeRest, final Long revision) { final XMLSerializerBuilder builder; if (revision == null) builder = new XMLSerializerBuilder(session, out); else builder = new XMLSerializerBuilder(session, out, revision); builder.setREST(serializeRest); builder.setID(serializeRest); builder.setDeclaration(serializeXMLDec); final XMLSerializer serializer = builder.build(); return serializer; }
java
public static XMLSerializer serializeXML(final ISession session, final OutputStream out, final boolean serializeXMLDec, final boolean serializeRest, final Long revision) { final XMLSerializerBuilder builder; if (revision == null) builder = new XMLSerializerBuilder(session, out); else builder = new XMLSerializerBuilder(session, out, revision); builder.setREST(serializeRest); builder.setID(serializeRest); builder.setDeclaration(serializeXMLDec); final XMLSerializer serializer = builder.build(); return serializer; }
[ "public", "static", "XMLSerializer", "serializeXML", "(", "final", "ISession", "session", ",", "final", "OutputStream", "out", ",", "final", "boolean", "serializeXMLDec", ",", "final", "boolean", "serializeRest", ",", "final", "Long", "revision", ")", "{", "final"...
This method creates a new XMLSerializer reference @param session Associated session. @param out OutputStream @param serializeXMLDec specifies whether XML declaration should be shown @param serializeRest specifies whether node id should be shown @return new XMLSerializer reference
[ "This", "method", "creates", "a", "new", "XMLSerializer", "reference" ]
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/util/WorkerHelper.java#L125-L137
jamesagnew/hapi-fhir
hapi-fhir-base/src/main/java/ca/uhn/fhir/util/DateUtils.java
DateUtils.formatDate
public static String formatDate(final Date date, final String pattern) { notNull(date, "Date"); notNull(pattern, "Pattern"); final SimpleDateFormat formatter = DateFormatHolder.formatFor(pattern); return formatter.format(date); }
java
public static String formatDate(final Date date, final String pattern) { notNull(date, "Date"); notNull(pattern, "Pattern"); final SimpleDateFormat formatter = DateFormatHolder.formatFor(pattern); return formatter.format(date); }
[ "public", "static", "String", "formatDate", "(", "final", "Date", "date", ",", "final", "String", "pattern", ")", "{", "notNull", "(", "date", ",", "\"Date\"", ")", ";", "notNull", "(", "pattern", ",", "\"Pattern\"", ")", ";", "final", "SimpleDateFormat", ...
Formats the given date according to the specified pattern. The pattern must conform to that used by the {@link SimpleDateFormat simple date format} class. @param date The date to format. @param pattern The pattern to use for formatting the date. @return A formatted date string. @throws IllegalArgumentException If the given date pattern is invalid. @see SimpleDateFormat
[ "Formats", "the", "given", "date", "according", "to", "the", "specified", "pattern", ".", "The", "pattern", "must", "conform", "to", "that", "used", "by", "the", "{", "@link", "SimpleDateFormat", "simple", "date", "format", "}", "class", "." ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/DateUtils.java#L188-L193
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/messageControl/MessageControllerCache.java
MessageControllerCache.saveToCache
public void saveToCache(String topic, Class<? extends JsTopicMessageController> cls) { if(null != topic && null != cls) { messageControllers.put(topic, cls); } }
java
public void saveToCache(String topic, Class<? extends JsTopicMessageController> cls) { if(null != topic && null != cls) { messageControllers.put(topic, cls); } }
[ "public", "void", "saveToCache", "(", "String", "topic", ",", "Class", "<", "?", "extends", "JsTopicMessageController", ">", "cls", ")", "{", "if", "(", "null", "!=", "topic", "&&", "null", "!=", "cls", ")", "{", "messageControllers", ".", "put", "(", "t...
Save messageController Factory for topic @param topic @param cls
[ "Save", "messageController", "Factory", "for", "topic" ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/messageControl/MessageControllerCache.java#L32-L36
Stratio/deep-spark
deep-commons/src/main/java/com/stratio/deep/commons/utils/CellsUtils.java
CellsUtils.subDocumentListCase
private static <T> Object subDocumentListCase(Type type, List<T> jsonObject) throws IllegalAccessException, InstantiationException, InvocationTargetException { ParameterizedType listType = (ParameterizedType) type; Class<?> listClass = (Class<?>) listType.getActualTypeArguments()[0]; List list = new ArrayList(); for (T t : jsonObject) { list.add(getObjectFromJson(listClass, (JSONObject) t)); } return list; }
java
private static <T> Object subDocumentListCase(Type type, List<T> jsonObject) throws IllegalAccessException, InstantiationException, InvocationTargetException { ParameterizedType listType = (ParameterizedType) type; Class<?> listClass = (Class<?>) listType.getActualTypeArguments()[0]; List list = new ArrayList(); for (T t : jsonObject) { list.add(getObjectFromJson(listClass, (JSONObject) t)); } return list; }
[ "private", "static", "<", "T", ">", "Object", "subDocumentListCase", "(", "Type", "type", ",", "List", "<", "T", ">", "jsonObject", ")", "throws", "IllegalAccessException", ",", "InstantiationException", ",", "InvocationTargetException", "{", "ParameterizedType", "l...
Sub document list case. @param <T> the type parameter @param type the type @param jsonObject the json object @return the object @throws IllegalAccessException the illegal access exception @throws InstantiationException the instantiation exception @throws InvocationTargetException the invocation target exception
[ "Sub", "document", "list", "case", "." ]
train
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-commons/src/main/java/com/stratio/deep/commons/utils/CellsUtils.java#L379-L391
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/dsl/NumberExpression.java
NumberExpression.notBetween
public final <A extends Number & Comparable<?>> BooleanExpression notBetween(A from, A to) { return between(from, to).not(); }
java
public final <A extends Number & Comparable<?>> BooleanExpression notBetween(A from, A to) { return between(from, to).not(); }
[ "public", "final", "<", "A", "extends", "Number", "&", "Comparable", "<", "?", ">", ">", "BooleanExpression", "notBetween", "(", "A", "from", ",", "A", "to", ")", "{", "return", "between", "(", "from", ",", "to", ")", ".", "not", "(", ")", ";", "}"...
Create a {@code this not between from and to} expression <p>Is equivalent to {@code this < from || this > to}</p> @param from inclusive start of range @param to inclusive end of range @return this not between from and to
[ "Create", "a", "{", "@code", "this", "not", "between", "from", "and", "to", "}", "expression" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/NumberExpression.java#L450-L452
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.java
AssemblyAnalyzer.addMatchingValues
protected static void addMatchingValues(List<String> packages, String value, Dependency dep, EvidenceType type) { if (value == null || value.isEmpty() || packages == null || packages.isEmpty()) { return; } for (String key : packages) { final int pos = StringUtils.indexOfIgnoreCase(value, key); if ((pos == 0 && (key.length() == value.length() || (key.length() < value.length() && !Character.isLetterOrDigit(value.charAt(key.length()))))) || (pos > 0 && !Character.isLetterOrDigit(value.charAt(pos - 1)) && (pos + key.length() == value.length() || (key.length() < value.length() && !Character.isLetterOrDigit(value.charAt(pos + key.length())))))) { dep.addEvidence(type, "dll", "namespace", key, Confidence.HIGHEST); } } }
java
protected static void addMatchingValues(List<String> packages, String value, Dependency dep, EvidenceType type) { if (value == null || value.isEmpty() || packages == null || packages.isEmpty()) { return; } for (String key : packages) { final int pos = StringUtils.indexOfIgnoreCase(value, key); if ((pos == 0 && (key.length() == value.length() || (key.length() < value.length() && !Character.isLetterOrDigit(value.charAt(key.length()))))) || (pos > 0 && !Character.isLetterOrDigit(value.charAt(pos - 1)) && (pos + key.length() == value.length() || (key.length() < value.length() && !Character.isLetterOrDigit(value.charAt(pos + key.length())))))) { dep.addEvidence(type, "dll", "namespace", key, Confidence.HIGHEST); } } }
[ "protected", "static", "void", "addMatchingValues", "(", "List", "<", "String", ">", "packages", ",", "String", "value", ",", "Dependency", "dep", ",", "EvidenceType", "type", ")", "{", "if", "(", "value", "==", "null", "||", "value", ".", "isEmpty", "(", ...
Cycles through the collection of class name information to see if parts of the package names are contained in the provided value. If found, it will be added as the HIGHEST confidence evidence because we have more then one source corroborating the value. @param packages a collection of class name information @param value the value to check to see if it contains a package name @param dep the dependency to add new entries too @param type the type of evidence (vendor, product, or version)
[ "Cycles", "through", "the", "collection", "of", "class", "name", "information", "to", "see", "if", "parts", "of", "the", "package", "names", "are", "contained", "in", "the", "provided", "value", ".", "If", "found", "it", "will", "be", "added", "as", "the",...
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.java#L480-L495
netty/netty
handler/src/main/java/io/netty/handler/traffic/TrafficCounter.java
TrafficCounter.writeTimeToWait
@Deprecated public long writeTimeToWait(final long size, final long limitTraffic, final long maxTime) { return writeTimeToWait(size, limitTraffic, maxTime, milliSecondFromNano()); }
java
@Deprecated public long writeTimeToWait(final long size, final long limitTraffic, final long maxTime) { return writeTimeToWait(size, limitTraffic, maxTime, milliSecondFromNano()); }
[ "@", "Deprecated", "public", "long", "writeTimeToWait", "(", "final", "long", "size", ",", "final", "long", "limitTraffic", ",", "final", "long", "maxTime", ")", "{", "return", "writeTimeToWait", "(", "size", ",", "limitTraffic", ",", "maxTime", ",", "milliSec...
Returns the time to wait (if any) for the given length message, using the given limitTraffic and the max wait time. @param size the write size @param limitTraffic the traffic limit in bytes per second. @param maxTime the max time in ms to wait in case of excess of traffic. @return the current time to wait (in ms) if needed for Write operation.
[ "Returns", "the", "time", "to", "wait", "(", "if", "any", ")", "for", "the", "given", "length", "message", "using", "the", "given", "limitTraffic", "and", "the", "max", "wait", "time", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/traffic/TrafficCounter.java#L555-L558
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/modules/r/houghes/HoughCircles.java
HoughCircles.getCenterPoints
private Coordinate[] getCenterPoints( double[][][] houghValues, int maxCircles ) { Coordinate[] centerPoints = new Coordinate[maxCircles]; int xMax = 0; int yMax = 0; int rMax = 0; for( int c = 0; c < maxCircles; c++ ) { double counterMax = -1; for( int radius = radiusMin; radius <= radiusMax; radius = radius + radiusInc ) { int indexR = (radius - radiusMin) / radiusInc; for( int y = 0; y < height; y++ ) { for( int x = 0; x < width; x++ ) { if (houghValues[x][y][indexR] > counterMax) { counterMax = houghValues[x][y][indexR]; xMax = x; yMax = y; rMax = radius; } } } } centerPoints[c] = new Coordinate(xMax, yMax, rMax); clearNeighbours(houghValues, xMax, yMax, rMax); } return centerPoints; }
java
private Coordinate[] getCenterPoints( double[][][] houghValues, int maxCircles ) { Coordinate[] centerPoints = new Coordinate[maxCircles]; int xMax = 0; int yMax = 0; int rMax = 0; for( int c = 0; c < maxCircles; c++ ) { double counterMax = -1; for( int radius = radiusMin; radius <= radiusMax; radius = radius + radiusInc ) { int indexR = (radius - radiusMin) / radiusInc; for( int y = 0; y < height; y++ ) { for( int x = 0; x < width; x++ ) { if (houghValues[x][y][indexR] > counterMax) { counterMax = houghValues[x][y][indexR]; xMax = x; yMax = y; rMax = radius; } } } } centerPoints[c] = new Coordinate(xMax, yMax, rMax); clearNeighbours(houghValues, xMax, yMax, rMax); } return centerPoints; }
[ "private", "Coordinate", "[", "]", "getCenterPoints", "(", "double", "[", "]", "[", "]", "[", "]", "houghValues", ",", "int", "maxCircles", ")", "{", "Coordinate", "[", "]", "centerPoints", "=", "new", "Coordinate", "[", "maxCircles", "]", ";", "int", "x...
Search for a fixed number of circles. @param maxCircles The number of circles that should be found. @param houghValues
[ "Search", "for", "a", "fixed", "number", "of", "circles", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/modules/r/houghes/HoughCircles.java#L315-L345
aws/aws-sdk-java
aws-java-sdk-cloudwatchmetrics/src/main/java/com/amazonaws/metrics/internal/cloudwatch/RequestMetricCollectorSupport.java
RequestMetricCollectorSupport.collectMetrics
@Override public void collectMetrics(Request<?> request, Response<?> response) { try { collectMetrics0(request, response); } catch(Exception ex) { // defensive code if (log.isDebugEnabled()) { log.debug("Ignoring unexpected failure", ex); } } }
java
@Override public void collectMetrics(Request<?> request, Response<?> response) { try { collectMetrics0(request, response); } catch(Exception ex) { // defensive code if (log.isDebugEnabled()) { log.debug("Ignoring unexpected failure", ex); } } }
[ "@", "Override", "public", "void", "collectMetrics", "(", "Request", "<", "?", ">", "request", ",", "Response", "<", "?", ">", "response", ")", "{", "try", "{", "collectMetrics0", "(", "request", ",", "response", ")", ";", "}", "catch", "(", "Exception",...
Collects the metrics at the end of a request/response cycle, transforms the metric data points into a cloud watch metric datum representation, and then adds it to a memory queue so it will get summarized into the necessary statistics and uploaded to Amazon CloudWatch.
[ "Collects", "the", "metrics", "at", "the", "end", "of", "a", "request", "/", "response", "cycle", "transforms", "the", "metric", "data", "points", "into", "a", "cloud", "watch", "metric", "datum", "representation", "and", "then", "adds", "it", "to", "a", "...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cloudwatchmetrics/src/main/java/com/amazonaws/metrics/internal/cloudwatch/RequestMetricCollectorSupport.java#L55-L64
strator-dev/greenpepper
greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/macros/AbstractGreenPepperMacro.java
AbstractGreenPepperMacro.isExpanded
protected boolean isExpanded(Map<String,String> parameters) { String all = parameters.get("expanded"); return all != null && Boolean.valueOf(all); }
java
protected boolean isExpanded(Map<String,String> parameters) { String all = parameters.get("expanded"); return all != null && Boolean.valueOf(all); }
[ "protected", "boolean", "isExpanded", "(", "Map", "<", "String", ",", "String", ">", "parameters", ")", "{", "String", "all", "=", "parameters", ".", "get", "(", "\"expanded\"", ")", ";", "return", "all", "!=", "null", "&&", "Boolean", ".", "valueOf", "(...
<p>isExpanded.</p> @param parameters a {@link java.util.Map} object. @return a boolean.
[ "<p", ">", "isExpanded", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/macros/AbstractGreenPepperMacro.java#L251-L255
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_serviceInfos_PUT
public void billingAccount_serviceInfos_PUT(String billingAccount, OvhService body) throws IOException { String qPath = "/telephony/{billingAccount}/serviceInfos"; StringBuilder sb = path(qPath, billingAccount); exec(qPath, "PUT", sb.toString(), body); }
java
public void billingAccount_serviceInfos_PUT(String billingAccount, OvhService body) throws IOException { String qPath = "/telephony/{billingAccount}/serviceInfos"; StringBuilder sb = path(qPath, billingAccount); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "billingAccount_serviceInfos_PUT", "(", "String", "billingAccount", ",", "OvhService", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/serviceInfos\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPa...
Alter this object properties REST: PUT /telephony/{billingAccount}/serviceInfos @param body [required] New object properties @param billingAccount [required] The name of your billingAccount
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L8386-L8390
mike10004/common-helper
native-helper/src/main/java/com/github/mike10004/nativehelper/subprocess/StreamConduit.java
StreamConduit.createPump
private Thread createPump(InputStream is, OutputStream os, boolean closeWhenExhausted) { BlockingStreamPumper pumper = new BlockingStreamPumper(is, os, closeWhenExhausted); // pumper.setAutoflush(true); // always auto-flush final Thread result = new ThreadWithPumper(pumper); result.setDaemon(true); return result; }
java
private Thread createPump(InputStream is, OutputStream os, boolean closeWhenExhausted) { BlockingStreamPumper pumper = new BlockingStreamPumper(is, os, closeWhenExhausted); // pumper.setAutoflush(true); // always auto-flush final Thread result = new ThreadWithPumper(pumper); result.setDaemon(true); return result; }
[ "private", "Thread", "createPump", "(", "InputStream", "is", ",", "OutputStream", "os", ",", "boolean", "closeWhenExhausted", ")", "{", "BlockingStreamPumper", "pumper", "=", "new", "BlockingStreamPumper", "(", "is", ",", "os", ",", "closeWhenExhausted", ")", ";",...
Creates a stream pumper to copy the given input stream to the given output stream. @param is the input stream to copy from. @param os the output stream to copy to. @param closeWhenExhausted if true close the inputstream. @return a thread object that does the pumping, subclasses should return an instance of {@code PumpStreamHandler.ThreadWithPumper ThreadWithPumper}.
[ "Creates", "a", "stream", "pumper", "to", "copy", "the", "given", "input", "stream", "to", "the", "given", "output", "stream", "." ]
train
https://github.com/mike10004/common-helper/blob/744f82d9b0768a9ad9c63a57a37ab2c93bf408f4/native-helper/src/main/java/com/github/mike10004/nativehelper/subprocess/StreamConduit.java#L213-L220
threerings/nenya
core/src/main/java/com/threerings/miso/tile/FringeConfiguration.java
FringeConfiguration.fringesOn
public int fringesOn (int first, int second) { FringeRecord f1 = _frecs.get(first); // we better have a fringe record for the first if (null != f1) { // it had better have some tilesets defined if (f1.tilesets.size() > 0) { FringeRecord f2 = _frecs.get(second); // and we only fringe if second doesn't exist or has a lower // priority if ((null == f2) || (f1.priority > f2.priority)) { return f1.priority; } } } return -1; }
java
public int fringesOn (int first, int second) { FringeRecord f1 = _frecs.get(first); // we better have a fringe record for the first if (null != f1) { // it had better have some tilesets defined if (f1.tilesets.size() > 0) { FringeRecord f2 = _frecs.get(second); // and we only fringe if second doesn't exist or has a lower // priority if ((null == f2) || (f1.priority > f2.priority)) { return f1.priority; } } } return -1; }
[ "public", "int", "fringesOn", "(", "int", "first", ",", "int", "second", ")", "{", "FringeRecord", "f1", "=", "_frecs", ".", "get", "(", "first", ")", ";", "// we better have a fringe record for the first", "if", "(", "null", "!=", "f1", ")", "{", "// it had...
If the first base tileset fringes upon the second, return the fringe priority of the first base tileset, otherwise return -1.
[ "If", "the", "first", "base", "tileset", "fringes", "upon", "the", "second", "return", "the", "fringe", "priority", "of", "the", "first", "base", "tileset", "otherwise", "return", "-", "1", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/tile/FringeConfiguration.java#L119-L140
telly/groundy
library/src/main/java/com/telly/groundy/Groundy.java
Groundy.arg
public Groundy arg(String key, Parcelable value) { mArgs.putParcelable(key, value); return this; }
java
public Groundy arg(String key, Parcelable value) { mArgs.putParcelable(key, value); return this; }
[ "public", "Groundy", "arg", "(", "String", "key", ",", "Parcelable", "value", ")", "{", "mArgs", ".", "putParcelable", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts a Parcelable 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 Parcelable object, or null
[ "Inserts", "a", "Parcelable", "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#L536-L539
astrapi69/jaulp-wicket
jaulp-wicket-dialogs/src/main/java/de/alpharogroup/wicket/dialogs/panels/save/SaveDialogPanel.java
SaveDialogPanel.newSaveLabel
protected Label newSaveLabel(final String id, final ResourceBundleKey resourceKey) { return ComponentFactory.newLabel(id, resourceKey, this); }
java
protected Label newSaveLabel(final String id, final ResourceBundleKey resourceKey) { return ComponentFactory.newLabel(id, resourceKey, this); }
[ "protected", "Label", "newSaveLabel", "(", "final", "String", "id", ",", "final", "ResourceBundleKey", "resourceKey", ")", "{", "return", "ComponentFactory", ".", "newLabel", "(", "id", ",", "resourceKey", ",", "this", ")", ";", "}" ]
Factory method for creating a new save {@link Label} with a {@link ResourceBundleKey}. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a save {@link Label}. @param id the id @param resourceKey the resource key @return the new {@link Label}
[ "Factory", "method", "for", "creating", "a", "new", "save", "{", "@link", "Label", "}", "with", "a", "{", "@link", "ResourceBundleKey", "}", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "the", "derived", "classes", "and", "ca...
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-dialogs/src/main/java/de/alpharogroup/wicket/dialogs/panels/save/SaveDialogPanel.java#L235-L238
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java
DiagnosticsInner.getSiteDiagnosticCategorySlot
public DiagnosticCategoryInner getSiteDiagnosticCategorySlot(String resourceGroupName, String siteName, String diagnosticCategory, String slot) { return getSiteDiagnosticCategorySlotWithServiceResponseAsync(resourceGroupName, siteName, diagnosticCategory, slot).toBlocking().single().body(); }
java
public DiagnosticCategoryInner getSiteDiagnosticCategorySlot(String resourceGroupName, String siteName, String diagnosticCategory, String slot) { return getSiteDiagnosticCategorySlotWithServiceResponseAsync(resourceGroupName, siteName, diagnosticCategory, slot).toBlocking().single().body(); }
[ "public", "DiagnosticCategoryInner", "getSiteDiagnosticCategorySlot", "(", "String", "resourceGroupName", ",", "String", "siteName", ",", "String", "diagnosticCategory", ",", "String", "slot", ")", "{", "return", "getSiteDiagnosticCategorySlotWithServiceResponseAsync", "(", "...
Get Diagnostics Category. Get Diagnostics Category. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Site Name @param diagnosticCategory Diagnostic Category @param slot Slot Name @throws IllegalArgumentException thrown if parameters fail the validation @throws DefaultErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the DiagnosticCategoryInner object if successful.
[ "Get", "Diagnostics", "Category", ".", "Get", "Diagnostics", "Category", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java#L1486-L1488
SpringForAll/spring-boot-starter-swagger
src/main/java/com/spring4all/swagger/SwaggerAutoConfiguration.java
SwaggerAutoConfiguration.buildGlobalResponseMessage
private void buildGlobalResponseMessage(SwaggerProperties swaggerProperties, Docket docketForBuilder) { SwaggerProperties.GlobalResponseMessage globalResponseMessages = swaggerProperties.getGlobalResponseMessage(); /* POST,GET,PUT,PATCH,DELETE,HEAD,OPTIONS,TRACE 响应消息体 **/ List<ResponseMessage> postResponseMessages = getResponseMessageList(globalResponseMessages.getPost()); List<ResponseMessage> getResponseMessages = getResponseMessageList(globalResponseMessages.getGet()); List<ResponseMessage> putResponseMessages = getResponseMessageList(globalResponseMessages.getPut()); List<ResponseMessage> patchResponseMessages = getResponseMessageList(globalResponseMessages.getPatch()); List<ResponseMessage> deleteResponseMessages = getResponseMessageList(globalResponseMessages.getDelete()); List<ResponseMessage> headResponseMessages = getResponseMessageList(globalResponseMessages.getHead()); List<ResponseMessage> optionsResponseMessages = getResponseMessageList(globalResponseMessages.getOptions()); List<ResponseMessage> trackResponseMessages = getResponseMessageList(globalResponseMessages.getTrace()); docketForBuilder.useDefaultResponseMessages(swaggerProperties.getApplyDefaultResponseMessages()) .globalResponseMessage(RequestMethod.POST, postResponseMessages) .globalResponseMessage(RequestMethod.GET, getResponseMessages) .globalResponseMessage(RequestMethod.PUT, putResponseMessages) .globalResponseMessage(RequestMethod.PATCH, patchResponseMessages) .globalResponseMessage(RequestMethod.DELETE, deleteResponseMessages) .globalResponseMessage(RequestMethod.HEAD, headResponseMessages) .globalResponseMessage(RequestMethod.OPTIONS, optionsResponseMessages) .globalResponseMessage(RequestMethod.TRACE, trackResponseMessages); }
java
private void buildGlobalResponseMessage(SwaggerProperties swaggerProperties, Docket docketForBuilder) { SwaggerProperties.GlobalResponseMessage globalResponseMessages = swaggerProperties.getGlobalResponseMessage(); /* POST,GET,PUT,PATCH,DELETE,HEAD,OPTIONS,TRACE 响应消息体 **/ List<ResponseMessage> postResponseMessages = getResponseMessageList(globalResponseMessages.getPost()); List<ResponseMessage> getResponseMessages = getResponseMessageList(globalResponseMessages.getGet()); List<ResponseMessage> putResponseMessages = getResponseMessageList(globalResponseMessages.getPut()); List<ResponseMessage> patchResponseMessages = getResponseMessageList(globalResponseMessages.getPatch()); List<ResponseMessage> deleteResponseMessages = getResponseMessageList(globalResponseMessages.getDelete()); List<ResponseMessage> headResponseMessages = getResponseMessageList(globalResponseMessages.getHead()); List<ResponseMessage> optionsResponseMessages = getResponseMessageList(globalResponseMessages.getOptions()); List<ResponseMessage> trackResponseMessages = getResponseMessageList(globalResponseMessages.getTrace()); docketForBuilder.useDefaultResponseMessages(swaggerProperties.getApplyDefaultResponseMessages()) .globalResponseMessage(RequestMethod.POST, postResponseMessages) .globalResponseMessage(RequestMethod.GET, getResponseMessages) .globalResponseMessage(RequestMethod.PUT, putResponseMessages) .globalResponseMessage(RequestMethod.PATCH, patchResponseMessages) .globalResponseMessage(RequestMethod.DELETE, deleteResponseMessages) .globalResponseMessage(RequestMethod.HEAD, headResponseMessages) .globalResponseMessage(RequestMethod.OPTIONS, optionsResponseMessages) .globalResponseMessage(RequestMethod.TRACE, trackResponseMessages); }
[ "private", "void", "buildGlobalResponseMessage", "(", "SwaggerProperties", "swaggerProperties", ",", "Docket", "docketForBuilder", ")", "{", "SwaggerProperties", ".", "GlobalResponseMessage", "globalResponseMessages", "=", "swaggerProperties", ".", "getGlobalResponseMessage", "...
设置全局响应消息 @param swaggerProperties swaggerProperties 支持 POST,GET,PUT,PATCH,DELETE,HEAD,OPTIONS,TRACE @param docketForBuilder swagger docket builder
[ "设置全局响应消息" ]
train
https://github.com/SpringForAll/spring-boot-starter-swagger/blob/420e146f0ac2fcfd3a63b43cd4d605e895502fe4/src/main/java/com/spring4all/swagger/SwaggerAutoConfiguration.java#L332-L356
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java
StylesheetHandler.createXPath
public XPath createXPath(String str, ElemTemplateElement owningTemplate) throws javax.xml.transform.TransformerException { ErrorListener handler = m_stylesheetProcessor.getErrorListener(); XPath xpath = new XPath(str, owningTemplate, this, XPath.SELECT, handler, m_funcTable); // Visit the expression, registering namespaces for any extension functions it includes. xpath.callVisitors(xpath, new ExpressionVisitor(getStylesheetRoot())); return xpath; }
java
public XPath createXPath(String str, ElemTemplateElement owningTemplate) throws javax.xml.transform.TransformerException { ErrorListener handler = m_stylesheetProcessor.getErrorListener(); XPath xpath = new XPath(str, owningTemplate, this, XPath.SELECT, handler, m_funcTable); // Visit the expression, registering namespaces for any extension functions it includes. xpath.callVisitors(xpath, new ExpressionVisitor(getStylesheetRoot())); return xpath; }
[ "public", "XPath", "createXPath", "(", "String", "str", ",", "ElemTemplateElement", "owningTemplate", ")", "throws", "javax", ".", "xml", ".", "transform", ".", "TransformerException", "{", "ErrorListener", "handler", "=", "m_stylesheetProcessor", ".", "getErrorListen...
Process an expression string into an XPath. Must be public for access by the AVT class. @param str A non-null reference to a valid or invalid XPath expression string. @return A non-null reference to an XPath object that represents the string argument. @throws javax.xml.transform.TransformerException if the expression can not be processed. @see <a href="http://www.w3.org/TR/xslt#section-Expressions">Section 4 Expressions in XSLT Specification</a>
[ "Process", "an", "expression", "string", "into", "an", "XPath", ".", "Must", "be", "public", "for", "access", "by", "the", "AVT", "class", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java#L151-L160
Faylixe/googlecodejam-client
src/main/java/fr/faylixe/googlecodejam/client/CodeJamSession.java
CodeJamSession.createContent
private MultipartContent createContent(final ProblemInput input, final File output, final File source) throws IOException { final HttpMediaType type = new HttpMediaType(MEDIA_TYPE); type.setParameter(BOUNDARY, createBoundary()); // Submission from Chrome through contest website sends fake path for security, // which presumes the server only uses the last token to generate the downloadable // zip. It is possible to submit real path here (source.getAbsolutePath) but to // preserve user privacy a fake path will do source.getName() might be sufficient // as well but it's not tested using a fake path is the safest option since that's // what Chrome does. final String sourceFilePath = new StringBuilder(PATH_PREFIX) .append(source.getName()) .toString(); final MultipartContent content = new MultipartContent() .setMediaType(type) .addPart(HttpRequestExecutor.buildDataPart(CSRF_PARAMETER_NAME, values.getToken())) .addPart(HttpRequestExecutor.buildFilePart(ANSWER_PARAMETER, output)) .addPart(HttpRequestExecutor.buildFilePart(SOURCE_FILE_PARAMETER, source)) .addPart(HttpRequestExecutor.buildDataPart(SOURCE_FILE_NAME_PARAMETER, sourceFilePath)) .addPart(HttpRequestExecutor.buildDataPart(COMMAND_PARAMETER_NAME, SUBMIT_COMMAND)) .addPart(HttpRequestExecutor.buildDataPart(PROBLEM_PARAMETER_NAME, input.getProblem().getId())) .addPart(HttpRequestExecutor.buildDataPart(INPUT_ID_PARAMETER_NAME, String.valueOf(input.getNumber()))) .addPart(HttpRequestExecutor.buildDataPart(NUM_SOURCE_FILE_PARAMETER, DEFAULT_NUM_SOURCE_FILE)) .addPart(HttpRequestExecutor.buildDataPart(AGENT_PARAMETER_NAME, DEFAULT_AGENT)); return content; }
java
private MultipartContent createContent(final ProblemInput input, final File output, final File source) throws IOException { final HttpMediaType type = new HttpMediaType(MEDIA_TYPE); type.setParameter(BOUNDARY, createBoundary()); // Submission from Chrome through contest website sends fake path for security, // which presumes the server only uses the last token to generate the downloadable // zip. It is possible to submit real path here (source.getAbsolutePath) but to // preserve user privacy a fake path will do source.getName() might be sufficient // as well but it's not tested using a fake path is the safest option since that's // what Chrome does. final String sourceFilePath = new StringBuilder(PATH_PREFIX) .append(source.getName()) .toString(); final MultipartContent content = new MultipartContent() .setMediaType(type) .addPart(HttpRequestExecutor.buildDataPart(CSRF_PARAMETER_NAME, values.getToken())) .addPart(HttpRequestExecutor.buildFilePart(ANSWER_PARAMETER, output)) .addPart(HttpRequestExecutor.buildFilePart(SOURCE_FILE_PARAMETER, source)) .addPart(HttpRequestExecutor.buildDataPart(SOURCE_FILE_NAME_PARAMETER, sourceFilePath)) .addPart(HttpRequestExecutor.buildDataPart(COMMAND_PARAMETER_NAME, SUBMIT_COMMAND)) .addPart(HttpRequestExecutor.buildDataPart(PROBLEM_PARAMETER_NAME, input.getProblem().getId())) .addPart(HttpRequestExecutor.buildDataPart(INPUT_ID_PARAMETER_NAME, String.valueOf(input.getNumber()))) .addPart(HttpRequestExecutor.buildDataPart(NUM_SOURCE_FILE_PARAMETER, DEFAULT_NUM_SOURCE_FILE)) .addPart(HttpRequestExecutor.buildDataPart(AGENT_PARAMETER_NAME, DEFAULT_AGENT)); return content; }
[ "private", "MultipartContent", "createContent", "(", "final", "ProblemInput", "input", ",", "final", "File", "output", ",", "final", "File", "source", ")", "throws", "IOException", "{", "final", "HttpMediaType", "type", "=", "new", "HttpMediaType", "(", "MEDIA_TYP...
<p>Created and returns a valid {@link MultipartContent} instance that contains data required for submission.</p> @param input Input file to submit solution for. @param output Output file produced by the algorithm. @param source Source code file of the algorithm to submit. @return Created multipart content.
[ "<p", ">", "Created", "and", "returns", "a", "valid", "{", "@link", "MultipartContent", "}", "instance", "that", "contains", "data", "required", "for", "submission", ".", "<", "/", "p", ">" ]
train
https://github.com/Faylixe/googlecodejam-client/blob/84a5fed4e049dca48994dc3f70213976aaff4bd3/src/main/java/fr/faylixe/googlecodejam/client/CodeJamSession.java#L332-L356
Baidu-AIP/java-sdk
src/main/java/com/baidu/aip/face/AipFace.java
AipFace.videoFaceliveness
public JSONObject videoFaceliveness(String sessionId, byte[] video, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("session_id", sessionId); String base64Content = Base64Util.encode(video); request.addBody("video_base64", base64Content); if (options != null) { request.addBody(options); } request.setUri(FaceConsts.VIDEO_FACELIVENESS); postOperation(request); return requestServer(request); }
java
public JSONObject videoFaceliveness(String sessionId, byte[] video, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("session_id", sessionId); String base64Content = Base64Util.encode(video); request.addBody("video_base64", base64Content); if (options != null) { request.addBody(options); } request.setUri(FaceConsts.VIDEO_FACELIVENESS); postOperation(request); return requestServer(request); }
[ "public", "JSONObject", "videoFaceliveness", "(", "String", "sessionId", ",", "byte", "[", "]", "video", ",", "HashMap", "<", "String", ",", "String", ">", "options", ")", "{", "AipRequest", "request", "=", "new", "AipRequest", "(", ")", ";", "preOperation",...
视频活体检测接口接口 @param sessionId - 语音校验码会话id,使用此接口的前提是已经调用了语音校验码接口 @param video - 二进制图像数据 @param options - 可选参数对象,key: value都为string类型 options - options列表: @return JSONObject
[ "视频活体检测接口接口" ]
train
https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/face/AipFace.java#L441-L455
citrusframework/citrus
modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/client/SftpEndpointComponent.java
SftpEndpointComponent.getPort
private Integer getPort(String resourcePath, FtpEndpointConfiguration endpointConfiguration) { if (resourcePath.contains(":")) { return Integer.valueOf(resourcePath.split(":")[1]); } return endpointConfiguration.getPort(); }
java
private Integer getPort(String resourcePath, FtpEndpointConfiguration endpointConfiguration) { if (resourcePath.contains(":")) { return Integer.valueOf(resourcePath.split(":")[1]); } return endpointConfiguration.getPort(); }
[ "private", "Integer", "getPort", "(", "String", "resourcePath", ",", "FtpEndpointConfiguration", "endpointConfiguration", ")", "{", "if", "(", "resourcePath", ".", "contains", "(", "\":\"", ")", ")", "{", "return", "Integer", ".", "valueOf", "(", "resourcePath", ...
Extract port number from resource path. If not present use default port from endpoint configuration. @param resourcePath @param endpointConfiguration @return
[ "Extract", "port", "number", "from", "resource", "path", ".", "If", "not", "present", "use", "default", "port", "from", "endpoint", "configuration", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/client/SftpEndpointComponent.java#L57-L63
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java
MercatorProjection.longitudeToPixelXWithScaleFactor
public static double longitudeToPixelXWithScaleFactor(double longitude, double scaleFactor, int tileSize) { long mapSize = getMapSizeWithScaleFactor(scaleFactor, tileSize); return (longitude + 180) / 360 * mapSize; }
java
public static double longitudeToPixelXWithScaleFactor(double longitude, double scaleFactor, int tileSize) { long mapSize = getMapSizeWithScaleFactor(scaleFactor, tileSize); return (longitude + 180) / 360 * mapSize; }
[ "public", "static", "double", "longitudeToPixelXWithScaleFactor", "(", "double", "longitude", ",", "double", "scaleFactor", ",", "int", "tileSize", ")", "{", "long", "mapSize", "=", "getMapSizeWithScaleFactor", "(", "scaleFactor", ",", "tileSize", ")", ";", "return"...
Converts a longitude coordinate (in degrees) to a pixel X coordinate at a certain scale factor. @param longitude the longitude coordinate that should be converted. @param scaleFactor the scale factor at which the coordinate should be converted. @return the pixel X coordinate of the longitude value.
[ "Converts", "a", "longitude", "coordinate", "(", "in", "degrees", ")", "to", "a", "pixel", "X", "coordinate", "at", "a", "certain", "scale", "factor", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java#L253-L256
Erudika/para
para-core/src/main/java/com/erudika/para/utils/Config.java
Config.getConfigInt
public static int getConfigInt(String key, int defaultValue) { return NumberUtils.toInt(getConfigParam(key, Integer.toString(defaultValue))); }
java
public static int getConfigInt(String key, int defaultValue) { return NumberUtils.toInt(getConfigParam(key, Integer.toString(defaultValue))); }
[ "public", "static", "int", "getConfigInt", "(", "String", "key", ",", "int", "defaultValue", ")", "{", "return", "NumberUtils", ".", "toInt", "(", "getConfigParam", "(", "key", ",", "Integer", ".", "toString", "(", "defaultValue", ")", ")", ")", ";", "}" ]
Returns the integer value of a configuration parameter. @param key the param key @param defaultValue the default param value @return the value of a param
[ "Returns", "the", "integer", "value", "of", "a", "configuration", "parameter", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/utils/Config.java#L334-L336
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java
CommerceCountryPersistenceImpl.findByG_B_A
@Override public List<CommerceCountry> findByG_B_A(long groupId, boolean billingAllowed, boolean active, int start, int end) { return findByG_B_A(groupId, billingAllowed, active, start, end, null); }
java
@Override public List<CommerceCountry> findByG_B_A(long groupId, boolean billingAllowed, boolean active, int start, int end) { return findByG_B_A(groupId, billingAllowed, active, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceCountry", ">", "findByG_B_A", "(", "long", "groupId", ",", "boolean", "billingAllowed", ",", "boolean", "active", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByG_B_A", "(", "groupId", ",",...
Returns a range of all the commerce countries where groupId = &#63; and billingAllowed = &#63; and active = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceCountryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param groupId the group ID @param billingAllowed the billing allowed @param active the active @param start the lower bound of the range of commerce countries @param end the upper bound of the range of commerce countries (not inclusive) @return the range of matching commerce countries
[ "Returns", "a", "range", "of", "all", "the", "commerce", "countries", "where", "groupId", "=", "&#63", ";", "and", "billingAllowed", "=", "&#63", ";", "and", "active", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java#L3060-L3064
fuinorg/units4j
src/main/java/org/fuin/units4j/assertionrules/Utils.java
Utils.hasAnnotation
public static boolean hasAnnotation(final List<AnnotationInstance> annotations, final String annotationClaszName) { final DotName annotationName = DotName.createSimple(annotationClaszName); for (final AnnotationInstance annotation : annotations) { if (annotation.name().equals(annotationName)) { return true; } } return false; }
java
public static boolean hasAnnotation(final List<AnnotationInstance> annotations, final String annotationClaszName) { final DotName annotationName = DotName.createSimple(annotationClaszName); for (final AnnotationInstance annotation : annotations) { if (annotation.name().equals(annotationName)) { return true; } } return false; }
[ "public", "static", "boolean", "hasAnnotation", "(", "final", "List", "<", "AnnotationInstance", ">", "annotations", ",", "final", "String", "annotationClaszName", ")", "{", "final", "DotName", "annotationName", "=", "DotName", ".", "createSimple", "(", "annotationC...
Verifies if a list of annotations contains a given one. @param annotations List with annotations to check. @param annotationClaszName Full qualified name of annotation class to find. @return TRUE if the list contains the annotation, else FALSE.
[ "Verifies", "if", "a", "list", "of", "annotations", "contains", "a", "given", "one", "." ]
train
https://github.com/fuinorg/units4j/blob/29383e30b0f9c246b309e734df9cc63dc5d5499e/src/main/java/org/fuin/units4j/assertionrules/Utils.java#L56-L64
aggregateknowledge/java-hll
src/main/java/net/agkn/hll/serialization/SerializationUtil.java
SerializationUtil.packParametersByte
public static byte packParametersByte(final int registerWidth, final int registerCountLog2) { final int widthBits = ((registerWidth - 1) & REGISTER_WIDTH_MASK); final int countBits = (registerCountLog2 & LOG2_REGISTER_COUNT_MASK); return (byte)((widthBits << LOG2_REGISTER_COUNT_BITS) | countBits); }
java
public static byte packParametersByte(final int registerWidth, final int registerCountLog2) { final int widthBits = ((registerWidth - 1) & REGISTER_WIDTH_MASK); final int countBits = (registerCountLog2 & LOG2_REGISTER_COUNT_MASK); return (byte)((widthBits << LOG2_REGISTER_COUNT_BITS) | countBits); }
[ "public", "static", "byte", "packParametersByte", "(", "final", "int", "registerWidth", ",", "final", "int", "registerCountLog2", ")", "{", "final", "int", "widthBits", "=", "(", "(", "registerWidth", "-", "1", ")", "&", "REGISTER_WIDTH_MASK", ")", ";", "final...
Generates a byte that encodes the parameters of a {@link HLLType#FULL} or {@link HLLType#SPARSE} HLL.<p/> The top 3 bits are used to encode <code>registerWidth - 1</code> (range of <code>registerWidth</code> is thus 1-9) and the bottom 5 bits are used to encode <code>registerCountLog2</code> (range of <code>registerCountLog2</code> is thus 0-31). @param registerWidth the register width (must be at least 1 and at most 9) @param registerCountLog2 the log-base-2 of the register count (must be at least 0 and at most 31) @return the packed parameters byte
[ "Generates", "a", "byte", "that", "encodes", "the", "parameters", "of", "a", "{", "@link", "HLLType#FULL", "}", "or", "{", "@link", "HLLType#SPARSE", "}", "HLL", ".", "<p", "/", ">" ]
train
https://github.com/aggregateknowledge/java-hll/blob/1f4126e79a85b79581460c75bf1c1634b8a7402d/src/main/java/net/agkn/hll/serialization/SerializationUtil.java#L206-L210
sdaschner/jaxrs-analyzer
src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/ResultInterpreter.java
ResultInterpreter.addResponseComments
private void addResponseComments(MethodResult methodResult, ResourceMethod resourceMethod) { MethodComment methodDoc = methodResult.getMethodDoc(); if (methodDoc == null) return; methodDoc.getResponseComments() .forEach((k, v) -> addResponseComment(k, v, resourceMethod)); ClassComment classDoc = methodDoc.getContainingClassComment(); // class-level response comments are added last (if absent) to keep hierarchy if (classDoc != null) classDoc.getResponseComments() .forEach((k, v) -> addResponseComment(k, v, resourceMethod)); }
java
private void addResponseComments(MethodResult methodResult, ResourceMethod resourceMethod) { MethodComment methodDoc = methodResult.getMethodDoc(); if (methodDoc == null) return; methodDoc.getResponseComments() .forEach((k, v) -> addResponseComment(k, v, resourceMethod)); ClassComment classDoc = methodDoc.getContainingClassComment(); // class-level response comments are added last (if absent) to keep hierarchy if (classDoc != null) classDoc.getResponseComments() .forEach((k, v) -> addResponseComment(k, v, resourceMethod)); }
[ "private", "void", "addResponseComments", "(", "MethodResult", "methodResult", ",", "ResourceMethod", "resourceMethod", ")", "{", "MethodComment", "methodDoc", "=", "methodResult", ".", "getMethodDoc", "(", ")", ";", "if", "(", "methodDoc", "==", "null", ")", "ret...
Adds the comments for the individual status code to the corresponding Responses. The information is based on the {@code @response} javadoc tags.
[ "Adds", "the", "comments", "for", "the", "individual", "status", "code", "to", "the", "corresponding", "Responses", ".", "The", "information", "is", "based", "on", "the", "{" ]
train
https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/ResultInterpreter.java#L139-L153
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/MapPrinter.java
MapPrinter.parseSpec
public static PJsonObject parseSpec(final String spec) { final JSONObject jsonSpec; try { jsonSpec = new JSONObject(spec); } catch (JSONException e) { throw new RuntimeException("Cannot parse the spec file: " + spec, e); } return new PJsonObject(jsonSpec, "spec"); }
java
public static PJsonObject parseSpec(final String spec) { final JSONObject jsonSpec; try { jsonSpec = new JSONObject(spec); } catch (JSONException e) { throw new RuntimeException("Cannot parse the spec file: " + spec, e); } return new PJsonObject(jsonSpec, "spec"); }
[ "public", "static", "PJsonObject", "parseSpec", "(", "final", "String", "spec", ")", "{", "final", "JSONObject", "jsonSpec", ";", "try", "{", "jsonSpec", "=", "new", "JSONObject", "(", "spec", ")", ";", "}", "catch", "(", "JSONException", "e", ")", "{", ...
Parse the JSON string and return the object. The string is expected to be the JSON print data from the client. @param spec the JSON formatted string. @return The encapsulated JSON object
[ "Parse", "the", "JSON", "string", "and", "return", "the", "object", ".", "The", "string", "is", "expected", "to", "be", "the", "JSON", "print", "data", "from", "the", "client", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/MapPrinter.java#L54-L62
Danny02/JOpenCTM
src/main/java/darwin/jopenctm/compression/MG2Encoder.java
MG2Encoder.pointToGridIdx
private int pointToGridIdx(Grid grid, float x, float y, float z) { Vec3f size = grid.getSize(); int idx = calcIndex(x, size.getX(), grid.getMin().getX(), grid.getDivision().getX()); int idy = calcIndex(y, size.getY(), grid.getMin().getY(), grid.getDivision().getY()); int idz = calcIndex(z, size.getZ(), grid.getMin().getZ(), grid.getDivision().getZ()); return idx + grid.getDivision().getX() * (idy + grid.getDivision().getY() * idz); }
java
private int pointToGridIdx(Grid grid, float x, float y, float z) { Vec3f size = grid.getSize(); int idx = calcIndex(x, size.getX(), grid.getMin().getX(), grid.getDivision().getX()); int idy = calcIndex(y, size.getY(), grid.getMin().getY(), grid.getDivision().getY()); int idz = calcIndex(z, size.getZ(), grid.getMin().getZ(), grid.getDivision().getZ()); return idx + grid.getDivision().getX() * (idy + grid.getDivision().getY() * idz); }
[ "private", "int", "pointToGridIdx", "(", "Grid", "grid", ",", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "Vec3f", "size", "=", "grid", ".", "getSize", "(", ")", ";", "int", "idx", "=", "calcIndex", "(", "x", ",", "size", ".", "...
Convert a point to a grid index. @param grid grid definition @return grid index of point
[ "Convert", "a", "point", "to", "a", "grid", "index", "." ]
train
https://github.com/Danny02/JOpenCTM/blob/c55a2a2d166a55979190f1bb08214fc84c93008f/src/main/java/darwin/jopenctm/compression/MG2Encoder.java#L197-L205
Stratio/stratio-connector-commons
connector-commons/src/main/java/com/stratio/connector/commons/metadata/IndexMetadataBuilder.java
IndexMetadataBuilder.withOptions
@TimerJ public IndexMetadataBuilder withOptions(Map<Selector, Selector> opts) { options = new HashMap<Selector, Selector>(opts); return this; }
java
@TimerJ public IndexMetadataBuilder withOptions(Map<Selector, Selector> opts) { options = new HashMap<Selector, Selector>(opts); return this; }
[ "@", "TimerJ", "public", "IndexMetadataBuilder", "withOptions", "(", "Map", "<", "Selector", ",", "Selector", ">", "opts", ")", "{", "options", "=", "new", "HashMap", "<", "Selector", ",", "Selector", ">", "(", "opts", ")", ";", "return", "this", ";", "}...
Set the options. Any options previously created are removed. @param opts the opts @return the index metadata builder
[ "Set", "the", "options", ".", "Any", "options", "previously", "created", "are", "removed", "." ]
train
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/metadata/IndexMetadataBuilder.java#L92-L96
esigate/esigate
esigate-core/src/main/java/org/esigate/http/ProxyingHttpClientBuilder.java
ProxyingHttpClientBuilder.addFetchEvent
private ClientExecChain addFetchEvent(final ClientExecChain wrapped) { return new ClientExecChain() { @Override public CloseableHttpResponse execute(HttpRoute route, HttpRequestWrapper request, HttpClientContext httpClientContext, HttpExecutionAware execAware) throws IOException, HttpException { OutgoingRequestContext context = OutgoingRequestContext.adapt(httpClientContext); // Create request event FetchEvent fetchEvent = new FetchEvent(context, request); eventManager.fire(EventManager.EVENT_FETCH_PRE, fetchEvent); if (fetchEvent.isExit()) { if (fetchEvent.getHttpResponse() == null) { // Provide an error page in order to avoid a NullPointerException fetchEvent.setHttpResponse(HttpErrorPage.generateHttpResponse( HttpStatus.SC_INTERNAL_SERVER_ERROR, "An extension stopped the processing of the request without providing a response")); } } else { try { fetchEvent.setHttpResponse(wrapped.execute(route, request, context, execAware)); eventManager.fire(EventManager.EVENT_FETCH_POST, fetchEvent); } catch (IOException | HttpException e) { fetchEvent.setHttpResponse(HttpErrorPage.generateHttpResponse(e)); // Usually we want to render and cache the exception but we let an extension decide fetchEvent.setExit(true); eventManager.fire(EventManager.EVENT_FETCH_POST, fetchEvent); if (!fetchEvent.isExit()) throw e; // Throw the exception and let http client process it (may retry) } } return fetchEvent.getHttpResponse(); } }; }
java
private ClientExecChain addFetchEvent(final ClientExecChain wrapped) { return new ClientExecChain() { @Override public CloseableHttpResponse execute(HttpRoute route, HttpRequestWrapper request, HttpClientContext httpClientContext, HttpExecutionAware execAware) throws IOException, HttpException { OutgoingRequestContext context = OutgoingRequestContext.adapt(httpClientContext); // Create request event FetchEvent fetchEvent = new FetchEvent(context, request); eventManager.fire(EventManager.EVENT_FETCH_PRE, fetchEvent); if (fetchEvent.isExit()) { if (fetchEvent.getHttpResponse() == null) { // Provide an error page in order to avoid a NullPointerException fetchEvent.setHttpResponse(HttpErrorPage.generateHttpResponse( HttpStatus.SC_INTERNAL_SERVER_ERROR, "An extension stopped the processing of the request without providing a response")); } } else { try { fetchEvent.setHttpResponse(wrapped.execute(route, request, context, execAware)); eventManager.fire(EventManager.EVENT_FETCH_POST, fetchEvent); } catch (IOException | HttpException e) { fetchEvent.setHttpResponse(HttpErrorPage.generateHttpResponse(e)); // Usually we want to render and cache the exception but we let an extension decide fetchEvent.setExit(true); eventManager.fire(EventManager.EVENT_FETCH_POST, fetchEvent); if (!fetchEvent.isExit()) throw e; // Throw the exception and let http client process it (may retry) } } return fetchEvent.getHttpResponse(); } }; }
[ "private", "ClientExecChain", "addFetchEvent", "(", "final", "ClientExecChain", "wrapped", ")", "{", "return", "new", "ClientExecChain", "(", ")", "{", "@", "Override", "public", "CloseableHttpResponse", "execute", "(", "HttpRoute", "route", ",", "HttpRequestWrapper",...
Decorate with fetch event managements @param wrapped @return the decorated ClientExecChain
[ "Decorate", "with", "fetch", "event", "managements" ]
train
https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/http/ProxyingHttpClientBuilder.java#L84-L122
xcesco/kripton
kripton-orm/src/main/java/com/abubusoft/kripton/android/sqlite/SQLiteUpdateTaskHelper.java
SQLiteUpdateTaskHelper.executeSQL
public static void executeSQL(final SQLiteDatabase database, InputStream fileInputStream) { List<String> commands = readSQLFromFile(fileInputStream); executeSQL(database, commands); }
java
public static void executeSQL(final SQLiteDatabase database, InputStream fileInputStream) { List<String> commands = readSQLFromFile(fileInputStream); executeSQL(database, commands); }
[ "public", "static", "void", "executeSQL", "(", "final", "SQLiteDatabase", "database", ",", "InputStream", "fileInputStream", ")", "{", "List", "<", "String", ">", "commands", "=", "readSQLFromFile", "(", "fileInputStream", ")", ";", "executeSQL", "(", "database", ...
Execute SQL. @param database the database @param fileInputStream the file input stream
[ "Execute", "SQL", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-orm/src/main/java/com/abubusoft/kripton/android/sqlite/SQLiteUpdateTaskHelper.java#L289-L292
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
PropertiesUtil.extractSubset
public static Properties extractSubset(final Properties properties, final String prefix) { final Properties subset = new Properties(); if (prefix == null || prefix.length() == 0) { return subset; } final String prefixToMatch = prefix.charAt(prefix.length() - 1) != '.' ? prefix + '.' : prefix; final List<String> keys = new ArrayList<>(); for (final String key : properties.stringPropertyNames()) { if (key.startsWith(prefixToMatch)) { subset.setProperty(key.substring(prefixToMatch.length()), properties.getProperty(key)); keys.add(key); } } for (final String key : keys) { properties.remove(key); } return subset; }
java
public static Properties extractSubset(final Properties properties, final String prefix) { final Properties subset = new Properties(); if (prefix == null || prefix.length() == 0) { return subset; } final String prefixToMatch = prefix.charAt(prefix.length() - 1) != '.' ? prefix + '.' : prefix; final List<String> keys = new ArrayList<>(); for (final String key : properties.stringPropertyNames()) { if (key.startsWith(prefixToMatch)) { subset.setProperty(key.substring(prefixToMatch.length()), properties.getProperty(key)); keys.add(key); } } for (final String key : keys) { properties.remove(key); } return subset; }
[ "public", "static", "Properties", "extractSubset", "(", "final", "Properties", "properties", ",", "final", "String", "prefix", ")", "{", "final", "Properties", "subset", "=", "new", "Properties", "(", ")", ";", "if", "(", "prefix", "==", "null", "||", "prefi...
Extracts properties that start with or are equals to the specific prefix and returns them in a new Properties object with the prefix removed. @param properties The Properties to evaluate. @param prefix The prefix to extract. @return The subset of properties.
[ "Extracts", "properties", "that", "start", "with", "or", "are", "equals", "to", "the", "specific", "prefix", "and", "returns", "them", "in", "a", "new", "Properties", "object", "with", "the", "prefix", "removed", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java#L288-L310
phax/as2-peppol-client
src/main/java/com/helger/peppol/as2client/AS2ClientBuilder.java
AS2ClientBuilder.setPKCS12KeyStore
@Nonnull @Deprecated public AS2ClientBuilder setPKCS12KeyStore (@Nullable final File aKeyStoreFile, @Nullable final String sKeyStorePassword) { return setKeyStore (EKeyStoreType.PKCS12, aKeyStoreFile, sKeyStorePassword); }
java
@Nonnull @Deprecated public AS2ClientBuilder setPKCS12KeyStore (@Nullable final File aKeyStoreFile, @Nullable final String sKeyStorePassword) { return setKeyStore (EKeyStoreType.PKCS12, aKeyStoreFile, sKeyStorePassword); }
[ "@", "Nonnull", "@", "Deprecated", "public", "AS2ClientBuilder", "setPKCS12KeyStore", "(", "@", "Nullable", "final", "File", "aKeyStoreFile", ",", "@", "Nullable", "final", "String", "sKeyStorePassword", ")", "{", "return", "setKeyStore", "(", "EKeyStoreType", ".", ...
Set the key store file and password for the AS2 client. The key store must be an existing file of type PKCS12 containing at least the key alias of the sender (see {@link #setSenderAS2ID(String)}). The key store file must be writable as dynamically certificates of partners are added. @param aKeyStoreFile The existing key store file. Must exist and may not be <code>null</code>. @param sKeyStorePassword The password to the key store. May not be <code>null</code> but empty. @return this for chaining
[ "Set", "the", "key", "store", "file", "and", "password", "for", "the", "AS2", "client", ".", "The", "key", "store", "must", "be", "an", "existing", "file", "of", "type", "PKCS12", "containing", "at", "least", "the", "key", "alias", "of", "the", "sender",...
train
https://github.com/phax/as2-peppol-client/blob/499fea5938df1a3c69aade5bf8be26b6e261988f/src/main/java/com/helger/peppol/as2client/AS2ClientBuilder.java#L190-L196
fernandospr/java-wns
src/main/java/ar/com/fernandospr/wns/WnsService.java
WnsService.pushBadge
public WnsNotificationResponse pushBadge(String channelUri, WnsBadge badge) throws WnsException { return this.pushBadge(channelUri, null, badge); }
java
public WnsNotificationResponse pushBadge(String channelUri, WnsBadge badge) throws WnsException { return this.pushBadge(channelUri, null, badge); }
[ "public", "WnsNotificationResponse", "pushBadge", "(", "String", "channelUri", ",", "WnsBadge", "badge", ")", "throws", "WnsException", "{", "return", "this", ".", "pushBadge", "(", "channelUri", ",", "null", ",", "badge", ")", ";", "}" ]
Pushes a badge to channelUri @param channelUri @param badge which should be built with {@link ar.com.fernandospr.wns.model.builders.WnsBadgeBuilder} @return WnsNotificationResponse please see response headers from <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response">http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response</a> @throws WnsException when authentication fails
[ "Pushes", "a", "badge", "to", "channelUri" ]
train
https://github.com/fernandospr/java-wns/blob/cd621b9c17d1e706f6284e0913531d834904a90d/src/main/java/ar/com/fernandospr/wns/WnsService.java#L168-L170
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java
ConstantsSummaryBuilder.buildConstantSummary
public void buildConstantSummary(XMLNode node, Content contentTree) throws Exception { contentTree = writer.getHeader(); buildChildren(node, contentTree); writer.addFooter(contentTree); writer.printDocument(contentTree); writer.close(); }
java
public void buildConstantSummary(XMLNode node, Content contentTree) throws Exception { contentTree = writer.getHeader(); buildChildren(node, contentTree); writer.addFooter(contentTree); writer.printDocument(contentTree); writer.close(); }
[ "public", "void", "buildConstantSummary", "(", "XMLNode", "node", ",", "Content", "contentTree", ")", "throws", "Exception", "{", "contentTree", "=", "writer", ".", "getHeader", "(", ")", ";", "buildChildren", "(", "node", ",", "contentTree", ")", ";", "writer...
Build the constant summary. @param node the XML element that specifies which components to document @param contentTree the content tree to which the documentation will be added
[ "Build", "the", "constant", "summary", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java#L144-L150
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesQuickSelectSketch.java
ArrayOfDoublesQuickSelectSketch.merge
void merge(final long key, final double[] values) { setNotEmpty(); if (key < theta_) { final int index = findOrInsertKey(key); if (index < 0) { incrementCount(); setValues(~index, values); } else { updateValues(index, values); } rebuildIfNeeded(); } }
java
void merge(final long key, final double[] values) { setNotEmpty(); if (key < theta_) { final int index = findOrInsertKey(key); if (index < 0) { incrementCount(); setValues(~index, values); } else { updateValues(index, values); } rebuildIfNeeded(); } }
[ "void", "merge", "(", "final", "long", "key", ",", "final", "double", "[", "]", "values", ")", "{", "setNotEmpty", "(", ")", ";", "if", "(", "key", "<", "theta_", ")", "{", "final", "int", "index", "=", "findOrInsertKey", "(", "key", ")", ";", "if"...
not sufficient by itself without keeping track of theta of another sketch
[ "not", "sufficient", "by", "itself", "without", "keeping", "track", "of", "theta", "of", "another", "sketch" ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesQuickSelectSketch.java#L100-L112
app55/app55-java
src/support/java/com/googlecode/openbeans/DefaultPersistenceDelegate.java
DefaultPersistenceDelegate.instantiate
@Override protected Expression instantiate(Object oldInstance, Encoder enc) { Object[] args = null; // Set the constructor arguments if any property names exist if (this.propertyNames.length > 0) { // Prepare the property descriptors for finding getter method later BeanInfo info = null; HashMap<String, PropertyDescriptor> proDscMap = null; try { info = Introspector.getBeanInfo(oldInstance.getClass(), Introspector.IGNORE_ALL_BEANINFO); proDscMap = internalAsMap(info.getPropertyDescriptors()); } catch (IntrospectionException ex) { enc.getExceptionListener().exceptionThrown(ex); throw new Error(ex); } // Get the arguments values args = new Object[this.propertyNames.length]; for (int i = 0; i < this.propertyNames.length; i++) { String propertyName = propertyNames[i]; if (null == propertyName || 0 == propertyName.length()) { continue; } // Get the value for each property of the given instance try { args[i] = getPropertyValue(proDscMap, oldInstance, this.propertyNames[i]); } catch (Exception ex) { enc.getExceptionListener().exceptionThrown(ex); } } } return new Expression(oldInstance, oldInstance.getClass(), BeansUtils.NEW, args); }
java
@Override protected Expression instantiate(Object oldInstance, Encoder enc) { Object[] args = null; // Set the constructor arguments if any property names exist if (this.propertyNames.length > 0) { // Prepare the property descriptors for finding getter method later BeanInfo info = null; HashMap<String, PropertyDescriptor> proDscMap = null; try { info = Introspector.getBeanInfo(oldInstance.getClass(), Introspector.IGNORE_ALL_BEANINFO); proDscMap = internalAsMap(info.getPropertyDescriptors()); } catch (IntrospectionException ex) { enc.getExceptionListener().exceptionThrown(ex); throw new Error(ex); } // Get the arguments values args = new Object[this.propertyNames.length]; for (int i = 0; i < this.propertyNames.length; i++) { String propertyName = propertyNames[i]; if (null == propertyName || 0 == propertyName.length()) { continue; } // Get the value for each property of the given instance try { args[i] = getPropertyValue(proDscMap, oldInstance, this.propertyNames[i]); } catch (Exception ex) { enc.getExceptionListener().exceptionThrown(ex); } } } return new Expression(oldInstance, oldInstance.getClass(), BeansUtils.NEW, args); }
[ "@", "Override", "protected", "Expression", "instantiate", "(", "Object", "oldInstance", ",", "Encoder", "enc", ")", "{", "Object", "[", "]", "args", "=", "null", ";", "// Set the constructor arguments if any property names exist", "if", "(", "this", ".", "propertyN...
Returns an expression that represents a call to the bean's constructor. The constructor may take zero or more parameters, as specified when this <code>DefaultPersistenceDelegate</code> is constructed. @param oldInstance the old instance @param enc the encoder that wants to record the old instance @return an expression for instantiating an object of the same type as the old instance
[ "Returns", "an", "expression", "that", "represents", "a", "call", "to", "the", "bean", "s", "constructor", ".", "The", "constructor", "may", "take", "zero", "or", "more", "parameters", "as", "specified", "when", "this", "<code", ">", "DefaultPersistenceDelegate<...
train
https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/com/googlecode/openbeans/DefaultPersistenceDelegate.java#L213-L258
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/CalendarUtil.java
CalendarUtil.addDays
public XMLGregorianCalendar addDays(final XMLGregorianCalendar cal, final int amount) { XMLGregorianCalendar to = buildXMLGregorianCalendarDate(cal); // Add amount of months to.add(addDays(amount)); return to; }
java
public XMLGregorianCalendar addDays(final XMLGregorianCalendar cal, final int amount) { XMLGregorianCalendar to = buildXMLGregorianCalendarDate(cal); // Add amount of months to.add(addDays(amount)); return to; }
[ "public", "XMLGregorianCalendar", "addDays", "(", "final", "XMLGregorianCalendar", "cal", ",", "final", "int", "amount", ")", "{", "XMLGregorianCalendar", "to", "=", "buildXMLGregorianCalendarDate", "(", "cal", ")", ";", "// Add amount of months", "to", ".", "add", ...
Add Days to a Gregorian Calendar. @param cal The XMLGregorianCalendar source @param amount The amount of days. Can be a negative Integer to substract. @return A XMLGregorianCalendar with the new Date
[ "Add", "Days", "to", "a", "Gregorian", "Calendar", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/CalendarUtil.java#L33-L38
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java
OADProfile.onNotificationBlock
private void onNotificationBlock(BluetoothGattCharacteristic characteristic) { int requestedBlock = Convert.twoBytesToInt(characteristic.getValue(), Constants.CC2540_BYTE_ORDER); // Check for First block if (requestedBlock == 0) { Log.i(TAG, String.format("Image accepted (Name: %s) (Size: %s bytes)",currentImage.name(), currentImage.sizeBytes())); blockTransferStarted = System.currentTimeMillis() / 1000L; setState(OADState.BLOCK_XFER); nextBlock = 0; } // Normal BLOCK XFER state logic while (oadState == OADState.BLOCK_XFER && nextBlock <= currentImage.blockCount() - 1 && nextBlock < (requestedBlock + MAX_IN_AIR_BLOCKS)) { // Write the block, tell the OAD Listener writeToCharacteristic(oadBlock, currentImage.block(nextBlock)); oadListener.progress(UploadProgress.create(nextBlock + 1, currentImage.blockCount())); nextBlock++; watchdog.poke(); } // Check for final block requested, for logging purposes only if (requestedBlock == currentImage.blockCount() - 1) { // Calculate throughput long secondsElapsed = System.currentTimeMillis() / 1000L - blockTransferStarted; double KBs = 0; if (secondsElapsed > 0) { KBs = (double) (currentImage.sizeBytes() / secondsElapsed) / 1000; } // Log some stats Log.i(TAG, String.format("Final OAD Block Requested: %s/%s", nextBlock, currentImage.blockCount())); Log.i(TAG, String.format("Sent %d blocks in %d seconds (%.2f KB/s)", currentImage.blockCount(), secondsElapsed, KBs)); } }
java
private void onNotificationBlock(BluetoothGattCharacteristic characteristic) { int requestedBlock = Convert.twoBytesToInt(characteristic.getValue(), Constants.CC2540_BYTE_ORDER); // Check for First block if (requestedBlock == 0) { Log.i(TAG, String.format("Image accepted (Name: %s) (Size: %s bytes)",currentImage.name(), currentImage.sizeBytes())); blockTransferStarted = System.currentTimeMillis() / 1000L; setState(OADState.BLOCK_XFER); nextBlock = 0; } // Normal BLOCK XFER state logic while (oadState == OADState.BLOCK_XFER && nextBlock <= currentImage.blockCount() - 1 && nextBlock < (requestedBlock + MAX_IN_AIR_BLOCKS)) { // Write the block, tell the OAD Listener writeToCharacteristic(oadBlock, currentImage.block(nextBlock)); oadListener.progress(UploadProgress.create(nextBlock + 1, currentImage.blockCount())); nextBlock++; watchdog.poke(); } // Check for final block requested, for logging purposes only if (requestedBlock == currentImage.blockCount() - 1) { // Calculate throughput long secondsElapsed = System.currentTimeMillis() / 1000L - blockTransferStarted; double KBs = 0; if (secondsElapsed > 0) { KBs = (double) (currentImage.sizeBytes() / secondsElapsed) / 1000; } // Log some stats Log.i(TAG, String.format("Final OAD Block Requested: %s/%s", nextBlock, currentImage.blockCount())); Log.i(TAG, String.format("Sent %d blocks in %d seconds (%.2f KB/s)", currentImage.blockCount(), secondsElapsed, KBs)); } }
[ "private", "void", "onNotificationBlock", "(", "BluetoothGattCharacteristic", "characteristic", ")", "{", "int", "requestedBlock", "=", "Convert", ".", "twoBytesToInt", "(", "characteristic", ".", "getValue", "(", ")", ",", "Constants", ".", "CC2540_BYTE_ORDER", ")", ...
Received a notification on Block characteristic A notification to this characteristic means the Bean has accepted the most recent firmware file we have offered, which is stored as `this.currentImage`. It is now time to start sending blocks of FW to the device. @param characteristic BLE characteristic with a value equal to the the block number
[ "Received", "a", "notification", "on", "Block", "characteristic" ]
train
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java#L191-L230
mfornos/humanize
humanize-slim/src/main/java/humanize/Humanize.java
Humanize.pluralizeFormat
public static MessageFormat pluralizeFormat(final String pattern, final String... choices) { double[] indexes = new double[choices.length]; for (int i = 0; i < choices.length; i++) { indexes[i] = i; } ChoiceFormat choiceForm = new ChoiceFormat(indexes, choices); MessageFormat format = (MessageFormat) messageFormat(pattern).clone(); format.setFormat(0, choiceForm); return format; }
java
public static MessageFormat pluralizeFormat(final String pattern, final String... choices) { double[] indexes = new double[choices.length]; for (int i = 0; i < choices.length; i++) { indexes[i] = i; } ChoiceFormat choiceForm = new ChoiceFormat(indexes, choices); MessageFormat format = (MessageFormat) messageFormat(pattern).clone(); format.setFormat(0, choiceForm); return format; }
[ "public", "static", "MessageFormat", "pluralizeFormat", "(", "final", "String", "pattern", ",", "final", "String", "...", "choices", ")", "{", "double", "[", "]", "indexes", "=", "new", "double", "[", "choices", ".", "length", "]", ";", "for", "(", "int", ...
<p> Constructs a message with pluralization logic by the means of ChoiceFormat. </p> @param pattern Base pattern @param choices Values that match the pattern @return Message instance prepared to generate pluralized strings
[ "<p", ">", "Constructs", "a", "message", "with", "pluralization", "logic", "by", "the", "means", "of", "ChoiceFormat", ".", "<", "/", "p", ">" ]
train
https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-slim/src/main/java/humanize/Humanize.java#L2430-L2444
jamesagnew/hapi-fhir
hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/cache/NpmPackage.java
NpmPackage.load
public InputStream load(String folder, String file) throws IOException { if (content.containsKey(folder+"/"+file)) return new ByteArrayInputStream(content.get(folder+"/"+file)); else { File f = new File(Utilities.path(path, folder, file)); if (f.exists()) return new FileInputStream(f); throw new IOException("Unable to find the file "+folder+"/"+file+" in the package "+name()); } }
java
public InputStream load(String folder, String file) throws IOException { if (content.containsKey(folder+"/"+file)) return new ByteArrayInputStream(content.get(folder+"/"+file)); else { File f = new File(Utilities.path(path, folder, file)); if (f.exists()) return new FileInputStream(f); throw new IOException("Unable to find the file "+folder+"/"+file+" in the package "+name()); } }
[ "public", "InputStream", "load", "(", "String", "folder", ",", "String", "file", ")", "throws", "IOException", "{", "if", "(", "content", ".", "containsKey", "(", "folder", "+", "\"/\"", "+", "file", ")", ")", "return", "new", "ByteArrayInputStream", "(", ...
get a stream that contains the contents of one of the files in a folder @param folder @param file @return @throws IOException
[ "get", "a", "stream", "that", "contains", "the", "contents", "of", "one", "of", "the", "files", "in", "a", "folder" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/cache/NpmPackage.java#L173-L182
apereo/cas
support/cas-server-support-surrogate-api/src/main/java/org/apereo/cas/services/SurrogateRegisteredServiceAccessStrategy.java
SurrogateRegisteredServiceAccessStrategy.doPrincipalAttributesAllowSurrogateServiceAccess
protected boolean doPrincipalAttributesAllowSurrogateServiceAccess(final Map<String, Object> principalAttributes) { if (!enoughRequiredAttributesAvailableToProcess(principalAttributes, this.surrogateRequiredAttributes)) { LOGGER.debug("Surrogate access is denied. There are not enough attributes available to satisfy the requirements [{}]", this.surrogateRequiredAttributes); return false; } if (!doRequiredAttributesAllowPrincipalAccess(principalAttributes, this.surrogateRequiredAttributes)) { LOGGER.debug("Surrogate access is denied. The principal does not have the required attributes [{}] specified by this strategy", this.surrogateRequiredAttributes); return false; } return true; }
java
protected boolean doPrincipalAttributesAllowSurrogateServiceAccess(final Map<String, Object> principalAttributes) { if (!enoughRequiredAttributesAvailableToProcess(principalAttributes, this.surrogateRequiredAttributes)) { LOGGER.debug("Surrogate access is denied. There are not enough attributes available to satisfy the requirements [{}]", this.surrogateRequiredAttributes); return false; } if (!doRequiredAttributesAllowPrincipalAccess(principalAttributes, this.surrogateRequiredAttributes)) { LOGGER.debug("Surrogate access is denied. The principal does not have the required attributes [{}] specified by this strategy", this.surrogateRequiredAttributes); return false; } return true; }
[ "protected", "boolean", "doPrincipalAttributesAllowSurrogateServiceAccess", "(", "final", "Map", "<", "String", ",", "Object", ">", "principalAttributes", ")", "{", "if", "(", "!", "enoughRequiredAttributesAvailableToProcess", "(", "principalAttributes", ",", "this", ".",...
Do principal attributes allow surrogate service access?. @param principalAttributes the principal attributes @return the boolean
[ "Do", "principal", "attributes", "allow", "surrogate", "service", "access?", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-surrogate-api/src/main/java/org/apereo/cas/services/SurrogateRegisteredServiceAccessStrategy.java#L47-L59
roboconf/roboconf-platform
core/roboconf-target-docker/src/main/java/net/roboconf/target/docker/internal/DockerUtils.java
DockerUtils.createDockerClient
public static DockerClient createDockerClient( Map<String,String> targetProperties ) throws TargetException { // Validate what needs to be validated. Logger logger = Logger.getLogger( DockerHandler.class.getName()); logger.fine( "Setting the target properties." ); String edpt = targetProperties.get( DockerHandler.ENDPOINT ); if( Utils.isEmptyOrWhitespaces( edpt )) edpt = DockerHandler.DEFAULT_ENDPOINT; // The configuration is straight-forward. Builder config = DefaultDockerClientConfig.createDefaultConfigBuilder() .withDockerHost( edpt ) .withRegistryUsername( targetProperties.get( DockerHandler.USER )) .withRegistryPassword( targetProperties.get( DockerHandler.PASSWORD )) .withRegistryEmail( targetProperties.get( DockerHandler.EMAIL )) .withApiVersion( targetProperties.get( DockerHandler.VERSION )); // Build the client. DockerClientBuilder clientBuilder = DockerClientBuilder.getInstance( config.build()); return clientBuilder.build(); }
java
public static DockerClient createDockerClient( Map<String,String> targetProperties ) throws TargetException { // Validate what needs to be validated. Logger logger = Logger.getLogger( DockerHandler.class.getName()); logger.fine( "Setting the target properties." ); String edpt = targetProperties.get( DockerHandler.ENDPOINT ); if( Utils.isEmptyOrWhitespaces( edpt )) edpt = DockerHandler.DEFAULT_ENDPOINT; // The configuration is straight-forward. Builder config = DefaultDockerClientConfig.createDefaultConfigBuilder() .withDockerHost( edpt ) .withRegistryUsername( targetProperties.get( DockerHandler.USER )) .withRegistryPassword( targetProperties.get( DockerHandler.PASSWORD )) .withRegistryEmail( targetProperties.get( DockerHandler.EMAIL )) .withApiVersion( targetProperties.get( DockerHandler.VERSION )); // Build the client. DockerClientBuilder clientBuilder = DockerClientBuilder.getInstance( config.build()); return clientBuilder.build(); }
[ "public", "static", "DockerClient", "createDockerClient", "(", "Map", "<", "String", ",", "String", ">", "targetProperties", ")", "throws", "TargetException", "{", "// Validate what needs to be validated.", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "Do...
Creates a Docker client from target properties. @param targetProperties a non-null map @return a Docker client @throws TargetException if something went wrong
[ "Creates", "a", "Docker", "client", "from", "target", "properties", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-docker/src/main/java/net/roboconf/target/docker/internal/DockerUtils.java#L71-L94
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CharsetMatch.java
CharsetMatch.getReader
public Reader getReader() { InputStream inputStream = fInputStream; if (inputStream == null) { inputStream = new ByteArrayInputStream(fRawInput, 0, fRawLength); } try { inputStream.reset(); return new InputStreamReader(inputStream, getName()); } catch (IOException e) { return null; } }
java
public Reader getReader() { InputStream inputStream = fInputStream; if (inputStream == null) { inputStream = new ByteArrayInputStream(fRawInput, 0, fRawLength); } try { inputStream.reset(); return new InputStreamReader(inputStream, getName()); } catch (IOException e) { return null; } }
[ "public", "Reader", "getReader", "(", ")", "{", "InputStream", "inputStream", "=", "fInputStream", ";", "if", "(", "inputStream", "==", "null", ")", "{", "inputStream", "=", "new", "ByteArrayInputStream", "(", "fRawInput", ",", "0", ",", "fRawLength", ")", "...
Create a java.io.Reader for reading the Unicode character data corresponding to the original byte data supplied to the Charset detect operation. <p> CAUTION: if the source of the byte data was an InputStream, a Reader can be created for only one matching char set using this method. If more than one charset needs to be tried, the caller will need to reset the InputStream and create InputStreamReaders itself, based on the charset name. @return the Reader for the Unicode character data.
[ "Create", "a", "java", ".", "io", ".", "Reader", "for", "reading", "the", "Unicode", "character", "data", "corresponding", "to", "the", "original", "byte", "data", "supplied", "to", "the", "Charset", "detect", "operation", ".", "<p", ">", "CAUTION", ":", "...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CharsetMatch.java#L46-L59
windup/windup
rules-java-ee/addon/src/main/java/org/jboss/windup/rules/apps/javaee/service/JNDIResourceService.java
JNDIResourceService.createUnique
public synchronized JNDIResourceModel createUnique(Set<ProjectModel> applications, String jndiName) { JNDIResourceModel jndiResourceModel = getUniqueByProperty(JNDIResourceModel.JNDI_LOCATION, jndiName); if (jndiResourceModel == null) { jndiResourceModel = super.create(); jndiResourceModel.setJndiLocation(jndiName); jndiResourceModel.setApplications(applications); } else { for (ProjectModel application : applications) { if (!jndiResourceModel.isAssociatedWithApplication(application)) jndiResourceModel.addApplication(application); } } return jndiResourceModel; }
java
public synchronized JNDIResourceModel createUnique(Set<ProjectModel> applications, String jndiName) { JNDIResourceModel jndiResourceModel = getUniqueByProperty(JNDIResourceModel.JNDI_LOCATION, jndiName); if (jndiResourceModel == null) { jndiResourceModel = super.create(); jndiResourceModel.setJndiLocation(jndiName); jndiResourceModel.setApplications(applications); } else { for (ProjectModel application : applications) { if (!jndiResourceModel.isAssociatedWithApplication(application)) jndiResourceModel.addApplication(application); } } return jndiResourceModel; }
[ "public", "synchronized", "JNDIResourceModel", "createUnique", "(", "Set", "<", "ProjectModel", ">", "applications", ",", "String", "jndiName", ")", "{", "JNDIResourceModel", "jndiResourceModel", "=", "getUniqueByProperty", "(", "JNDIResourceModel", ".", "JNDI_LOCATION", ...
Create unique; if existing convert an existing {@link JNDIResourceModel} if one exists.
[ "Create", "unique", ";", "if", "existing", "convert", "an", "existing", "{" ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-java-ee/addon/src/main/java/org/jboss/windup/rules/apps/javaee/service/JNDIResourceService.java#L31-L49
google/closure-compiler
src/com/google/javascript/jscomp/InlineSimpleMethods.java
InlineSimpleMethods.inlinePropertyReturn
private void inlinePropertyReturn(Node parent, Node call, Node returnedValue) { Node getProp = returnedValue.cloneTree(); replaceThis(getProp, call.getFirstChild().removeFirstChild()); parent.replaceChild(call, getProp); compiler.reportChangeToEnclosingScope(getProp); }
java
private void inlinePropertyReturn(Node parent, Node call, Node returnedValue) { Node getProp = returnedValue.cloneTree(); replaceThis(getProp, call.getFirstChild().removeFirstChild()); parent.replaceChild(call, getProp); compiler.reportChangeToEnclosingScope(getProp); }
[ "private", "void", "inlinePropertyReturn", "(", "Node", "parent", ",", "Node", "call", ",", "Node", "returnedValue", ")", "{", "Node", "getProp", "=", "returnedValue", ".", "cloneTree", "(", ")", ";", "replaceThis", "(", "getProp", ",", "call", ".", "getFirs...
Replace the provided method call with the tree specified in returnedValue Parse tree of a call is name call getprop obj string
[ "Replace", "the", "provided", "method", "call", "with", "the", "tree", "specified", "in", "returnedValue" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/InlineSimpleMethods.java#L220-L225
integration-technology/amazon-mws-orders
src/main/java/com/amazonservices/mws/client/MwsUtl.java
MwsUtl.signParameters
static String signParameters(URI serviceUri, String signatureVersion, String signatureMethod, Map<String, String> parameters, String aswSecretKey) { parameters.put("SignatureVersion", signatureVersion); String algorithm = "HmacSHA1"; String stringToSign = null; if ("0".equals(signatureVersion)) { stringToSign = calculateStringToSignV0(parameters); } else if ("1".equals(signatureVersion)) { stringToSign = calculateStringToSignV1(parameters); } else if ("2".equals(signatureVersion)) { algorithm = signatureMethod; parameters.put("SignatureMethod", algorithm); stringToSign = calculateStringToSignV2(serviceUri, parameters); } else { throw new IllegalArgumentException("Invalid Signature Version specified"); } return sign(stringToSign, aswSecretKey, algorithm); }
java
static String signParameters(URI serviceUri, String signatureVersion, String signatureMethod, Map<String, String> parameters, String aswSecretKey) { parameters.put("SignatureVersion", signatureVersion); String algorithm = "HmacSHA1"; String stringToSign = null; if ("0".equals(signatureVersion)) { stringToSign = calculateStringToSignV0(parameters); } else if ("1".equals(signatureVersion)) { stringToSign = calculateStringToSignV1(parameters); } else if ("2".equals(signatureVersion)) { algorithm = signatureMethod; parameters.put("SignatureMethod", algorithm); stringToSign = calculateStringToSignV2(serviceUri, parameters); } else { throw new IllegalArgumentException("Invalid Signature Version specified"); } return sign(stringToSign, aswSecretKey, algorithm); }
[ "static", "String", "signParameters", "(", "URI", "serviceUri", ",", "String", "signatureVersion", ",", "String", "signatureMethod", ",", "Map", "<", "String", ",", "String", ">", "parameters", ",", "String", "aswSecretKey", ")", "{", "parameters", ".", "put", ...
Computes RFC 2104-compliant HMAC signature for request parameters Implements AWS Signature, as per following spec: If Signature Version is 0, it signs concatenated Action and Timestamp If Signature Version is 1, it performs the following: Sorts all parameters (including SignatureVersion and excluding Signature, the value of which is being created), ignoring case. Iterate over the sorted list and append the parameter name (in original case) and then its value. It will not URL-encode the parameter values before constructing this string. There are no separators. If Signature Version is 2, string to sign is based on following: 1. The HTTP Request Method followed by an ASCII newline (%0A) 2. The HTTP Host header in the form of lowercase host, followed by an ASCII newline. 3. The URL encoded HTTP absolute path component of the URI (up to but not including the query string parameters); if this is empty use a forward '/'. This parameter is followed by an ASCII newline. 4. The concatenation of all query string components (names and values) as UTF-8 characters which are URL encoded as per RFC 3986 (hex characters MUST be uppercase), sorted using lexicographic byte ordering. Parameter names are separated from their values by the '=' character (ASCII character 61), even if the value is empty. Pairs of parameter and values are separated by the '&' character (ASCII code 38). @param serviceUri Including host, port, api name, and api version @param parameters @param signatureVersion @param signatureMethod @param awsSecretKey @return The base64 encoding of the signature.
[ "Computes", "RFC", "2104", "-", "compliant", "HMAC", "signature", "for", "request", "parameters", "Implements", "AWS", "Signature", "as", "per", "following", "spec", ":" ]
train
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsUtl.java#L436-L453
rometools/rome
rome-propono/src/main/java/com/rometools/propono/atom/server/FactoryFinder.java
FactoryFinder.newInstance
private static Object newInstance(final String className, ClassLoader cl, final boolean doFallback) throws ConfigurationError { try { Class<?> providerClass; if (cl == null) { // If classloader is null Use the bootstrap ClassLoader. // Thus Class.forName(String) will use the current // ClassLoader which will be the bootstrap ClassLoader. providerClass = Class.forName(className); } else { try { providerClass = cl.loadClass(className); } catch (final ClassNotFoundException x) { if (doFallback) { // Fall back to current classloader cl = FactoryFinder.class.getClassLoader(); providerClass = cl.loadClass(className); } else { throw x; } } } final Object instance = providerClass.newInstance(); dPrint("created new instance of " + providerClass + " using ClassLoader: " + cl); return instance; } catch (final ClassNotFoundException x) { throw new ConfigurationError("Provider " + className + " not found", x); } catch (final Exception x) { throw new ConfigurationError("Provider " + className + " could not be instantiated: " + x, x); } }
java
private static Object newInstance(final String className, ClassLoader cl, final boolean doFallback) throws ConfigurationError { try { Class<?> providerClass; if (cl == null) { // If classloader is null Use the bootstrap ClassLoader. // Thus Class.forName(String) will use the current // ClassLoader which will be the bootstrap ClassLoader. providerClass = Class.forName(className); } else { try { providerClass = cl.loadClass(className); } catch (final ClassNotFoundException x) { if (doFallback) { // Fall back to current classloader cl = FactoryFinder.class.getClassLoader(); providerClass = cl.loadClass(className); } else { throw x; } } } final Object instance = providerClass.newInstance(); dPrint("created new instance of " + providerClass + " using ClassLoader: " + cl); return instance; } catch (final ClassNotFoundException x) { throw new ConfigurationError("Provider " + className + " not found", x); } catch (final Exception x) { throw new ConfigurationError("Provider " + className + " could not be instantiated: " + x, x); } }
[ "private", "static", "Object", "newInstance", "(", "final", "String", "className", ",", "ClassLoader", "cl", ",", "final", "boolean", "doFallback", ")", "throws", "ConfigurationError", "{", "try", "{", "Class", "<", "?", ">", "providerClass", ";", "if", "(", ...
Create an instance of a class using the specified ClassLoader and optionally fall back to the current ClassLoader if not found. @param className Name of the concrete class corresponding to the service provider @param cl ClassLoader to use to load the class, null means to use the bootstrap ClassLoader @param doFallback true if the current ClassLoader should be tried as a fallback if the class is not found using cl
[ "Create", "an", "instance", "of", "a", "class", "using", "the", "specified", "ClassLoader", "and", "optionally", "fall", "back", "to", "the", "current", "ClassLoader", "if", "not", "found", "." ]
train
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-propono/src/main/java/com/rometools/propono/atom/server/FactoryFinder.java#L58-L89
google/error-prone
check_api/src/main/java/com/google/errorprone/matchers/Matchers.java
Matchers.hasModifier
public static <T extends Tree> Matcher<T> hasModifier(final Modifier modifier) { return new Matcher<T>() { @Override public boolean matches(T tree, VisitorState state) { Symbol sym = ASTHelpers.getSymbol(tree); return sym != null && sym.getModifiers().contains(modifier); } }; }
java
public static <T extends Tree> Matcher<T> hasModifier(final Modifier modifier) { return new Matcher<T>() { @Override public boolean matches(T tree, VisitorState state) { Symbol sym = ASTHelpers.getSymbol(tree); return sym != null && sym.getModifiers().contains(modifier); } }; }
[ "public", "static", "<", "T", "extends", "Tree", ">", "Matcher", "<", "T", ">", "hasModifier", "(", "final", "Modifier", "modifier", ")", "{", "return", "new", "Matcher", "<", "T", ">", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(...
Returns true if the Tree node has the expected {@code Modifier}.
[ "Returns", "true", "if", "the", "Tree", "node", "has", "the", "expected", "{" ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L1151-L1159
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/html/HtmlBuilder.java
HtmlBuilder.simonTypeImg
public T simonTypeImg(SimonType simonType, String rootPath) throws IOException { String image = null; switch (simonType) { case COUNTER: image = "TypeCounter.png"; break; case STOPWATCH: image = "TypeStopwatch.png"; break; case UNKNOWN: image = "TypeUnknown.png"; break; } String label = simonType.name().toLowerCase(); doBegin("img", null, label + " icon"); attr("src", rootPath + "resource/images/" + image); attr("alt", label); writer.write(" />"); return (T) this; }
java
public T simonTypeImg(SimonType simonType, String rootPath) throws IOException { String image = null; switch (simonType) { case COUNTER: image = "TypeCounter.png"; break; case STOPWATCH: image = "TypeStopwatch.png"; break; case UNKNOWN: image = "TypeUnknown.png"; break; } String label = simonType.name().toLowerCase(); doBegin("img", null, label + " icon"); attr("src", rootPath + "resource/images/" + image); attr("alt", label); writer.write(" />"); return (T) this; }
[ "public", "T", "simonTypeImg", "(", "SimonType", "simonType", ",", "String", "rootPath", ")", "throws", "IOException", "{", "String", "image", "=", "null", ";", "switch", "(", "simonType", ")", "{", "case", "COUNTER", ":", "image", "=", "\"TypeCounter.png\"", ...
Icon image representing Simon Type. @param simonType Simon Type @param rootPath Path to root of Simon Console resources
[ "Icon", "image", "representing", "Simon", "Type", "." ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/html/HtmlBuilder.java#L223-L242
interedition/collatex
collatex-core/src/main/java/eu/interedition/collatex/suffixarray/BPR.java
BPR.computeBucketSize2_SaBucket
private void computeBucketSize2_SaBucket(int leftPtr, int rightPtr, int offset, int q) { int suffix1 = suffixArray[leftPtr] + offset; int suffix2 = suffixArray[rightPtr] + offset; while (sufPtrMap[suffix1] == sufPtrMap[suffix2]) { suffix1 += q; suffix2 += q; } if (sufPtrMap[suffix1] > sufPtrMap[suffix2]) { int tmpSwap = suffixArray[leftPtr]; suffixArray[leftPtr] = suffixArray[rightPtr]; suffixArray[rightPtr] = tmpSwap; } sufPtrMap[suffixArray[leftPtr]] = leftPtr; sufPtrMap[suffixArray[rightPtr]] = rightPtr; }
java
private void computeBucketSize2_SaBucket(int leftPtr, int rightPtr, int offset, int q) { int suffix1 = suffixArray[leftPtr] + offset; int suffix2 = suffixArray[rightPtr] + offset; while (sufPtrMap[suffix1] == sufPtrMap[suffix2]) { suffix1 += q; suffix2 += q; } if (sufPtrMap[suffix1] > sufPtrMap[suffix2]) { int tmpSwap = suffixArray[leftPtr]; suffixArray[leftPtr] = suffixArray[rightPtr]; suffixArray[rightPtr] = tmpSwap; } sufPtrMap[suffixArray[leftPtr]] = leftPtr; sufPtrMap[suffixArray[rightPtr]] = rightPtr; }
[ "private", "void", "computeBucketSize2_SaBucket", "(", "int", "leftPtr", ",", "int", "rightPtr", ",", "int", "offset", ",", "int", "q", ")", "{", "int", "suffix1", "=", "suffixArray", "[", "leftPtr", "]", "+", "offset", ";", "int", "suffix2", "=", "suffixA...
Completely sorts buckets of size 2. @param leftPtr points to the leftmost suffix of the current bucket. @param rightPtr points to the rightmost suffix of the current bucket. @param offset is the length of the common prefix of the suffixes rounded down to a multiple of q. @param q is the initial prefix length used for the bucket sort. It also determines the increase of offset.
[ "Completely", "sorts", "buckets", "of", "size", "2", "." ]
train
https://github.com/interedition/collatex/blob/76dd1fcc36047bc66a87d31142e72e98b5347821/collatex-core/src/main/java/eu/interedition/collatex/suffixarray/BPR.java#L523-L538
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.license_plesk_serviceName_upgrade_duration_POST
public OvhOrder license_plesk_serviceName_upgrade_duration_POST(String serviceName, String duration, OvhOrderableAntispamEnum antispam, OvhOrderableAntivirusEnum antivirus, OvhPleskApplicationSetEnum applicationSet, OvhOrderablePleskDomainNumberEnum domainNumber, OvhOrderablePleskLanguagePackEnum languagePackNumber, Boolean powerpack, Boolean resellerManagement, OvhPleskVersionEnum version, Boolean wordpressToolkit) throws IOException { String qPath = "/order/license/plesk/{serviceName}/upgrade/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "antispam", antispam); addBody(o, "antivirus", antivirus); addBody(o, "applicationSet", applicationSet); addBody(o, "domainNumber", domainNumber); addBody(o, "languagePackNumber", languagePackNumber); addBody(o, "powerpack", powerpack); addBody(o, "resellerManagement", resellerManagement); addBody(o, "version", version); addBody(o, "wordpressToolkit", wordpressToolkit); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder license_plesk_serviceName_upgrade_duration_POST(String serviceName, String duration, OvhOrderableAntispamEnum antispam, OvhOrderableAntivirusEnum antivirus, OvhPleskApplicationSetEnum applicationSet, OvhOrderablePleskDomainNumberEnum domainNumber, OvhOrderablePleskLanguagePackEnum languagePackNumber, Boolean powerpack, Boolean resellerManagement, OvhPleskVersionEnum version, Boolean wordpressToolkit) throws IOException { String qPath = "/order/license/plesk/{serviceName}/upgrade/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "antispam", antispam); addBody(o, "antivirus", antivirus); addBody(o, "applicationSet", applicationSet); addBody(o, "domainNumber", domainNumber); addBody(o, "languagePackNumber", languagePackNumber); addBody(o, "powerpack", powerpack); addBody(o, "resellerManagement", resellerManagement); addBody(o, "version", version); addBody(o, "wordpressToolkit", wordpressToolkit); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "license_plesk_serviceName_upgrade_duration_POST", "(", "String", "serviceName", ",", "String", "duration", ",", "OvhOrderableAntispamEnum", "antispam", ",", "OvhOrderableAntivirusEnum", "antivirus", ",", "OvhPleskApplicationSetEnum", "applicationSet", ",", ...
Create order REST: POST /order/license/plesk/{serviceName}/upgrade/{duration} @param antispam [required] The antispam currently enabled on this Plesk License @param resellerManagement [required] Reseller management option activation @param languagePackNumber [required] The amount (between 0 and 5) of language pack numbers to include in this licences @param antivirus [required] The antivirus to enable on this Plesk license @param wordpressToolkit [required] WordpressToolkit option activation @param applicationSet [required] Wanted application set @param domainNumber [required] This license domain number @param powerpack [required] powerpack current activation state on your license @param version [required] This license version @param serviceName [required] The name of your Plesk license @param duration [required] Duration
[ "Create", "order" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L1927-L1942
apereo/cas
api/cas-server-core-api-util/src/main/java/org/apereo/cas/DistributedCacheObject.java
DistributedCacheObject.getProperty
public <T> T getProperty(final String name, final Class<T> clazz) { if (containsProperty(name)) { val item = this.properties.get(name); if (item == null) { return null; } if (!clazz.isAssignableFrom(item.getClass())) { throw new ClassCastException("Object [" + item + " is of type " + item.getClass() + " when we were expecting " + clazz); } return (T) item; } return null; }
java
public <T> T getProperty(final String name, final Class<T> clazz) { if (containsProperty(name)) { val item = this.properties.get(name); if (item == null) { return null; } if (!clazz.isAssignableFrom(item.getClass())) { throw new ClassCastException("Object [" + item + " is of type " + item.getClass() + " when we were expecting " + clazz); } return (T) item; } return null; }
[ "public", "<", "T", ">", "T", "getProperty", "(", "final", "String", "name", ",", "final", "Class", "<", "T", ">", "clazz", ")", "{", "if", "(", "containsProperty", "(", "name", ")", ")", "{", "val", "item", "=", "this", ".", "properties", ".", "ge...
Gets property. @param <T> the type parameter @param name the name @param clazz the clazz @return the property
[ "Gets", "property", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/api/cas-server-core-api-util/src/main/java/org/apereo/cas/DistributedCacheObject.java#L44-L56