repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
alkacon/opencms-core
src/org/opencms/ade/sitemap/CmsVfsSitemapService.java
CmsVfsSitemapService.readGalleryFolderEntry
private CmsGalleryFolderEntry readGalleryFolderEntry(CmsResource folder, String typeName) throws CmsException { CmsObject cms = getCmsObject(); CmsGalleryFolderEntry folderEntry = new CmsGalleryFolderEntry(); folderEntry.setResourceType(typeName); folderEntry.setSitePath(cms.getSitePath(folder)); folderEntry.setStructureId(folder.getStructureId()); folderEntry.setOwnProperties(getClientProperties(cms, folder, false)); folderEntry.setIconClasses(CmsIconUtil.getIconClasses(typeName, null, false)); return folderEntry; }
java
private CmsGalleryFolderEntry readGalleryFolderEntry(CmsResource folder, String typeName) throws CmsException { CmsObject cms = getCmsObject(); CmsGalleryFolderEntry folderEntry = new CmsGalleryFolderEntry(); folderEntry.setResourceType(typeName); folderEntry.setSitePath(cms.getSitePath(folder)); folderEntry.setStructureId(folder.getStructureId()); folderEntry.setOwnProperties(getClientProperties(cms, folder, false)); folderEntry.setIconClasses(CmsIconUtil.getIconClasses(typeName, null, false)); return folderEntry; }
[ "private", "CmsGalleryFolderEntry", "readGalleryFolderEntry", "(", "CmsResource", "folder", ",", "String", "typeName", ")", "throws", "CmsException", "{", "CmsObject", "cms", "=", "getCmsObject", "(", ")", ";", "CmsGalleryFolderEntry", "folderEntry", "=", "new", "CmsG...
Reads the gallery folder properties.<p> @param folder the folder resource @param typeName the resource type name @return the folder entry data @throws CmsException if the folder properties can not be read
[ "Reads", "the", "gallery", "folder", "properties", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/CmsVfsSitemapService.java#L2943-L2953
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java
CodeBuilderUtil.defineCopyBridges
public static void defineCopyBridges(ClassFile cf, Class leaf) { for (Class c : gatherAllBridgeTypes(new HashSet<Class>(), leaf)) { if (c != Object.class) { defineCopyBridge(cf, leaf, c); } } }
java
public static void defineCopyBridges(ClassFile cf, Class leaf) { for (Class c : gatherAllBridgeTypes(new HashSet<Class>(), leaf)) { if (c != Object.class) { defineCopyBridge(cf, leaf, c); } } }
[ "public", "static", "void", "defineCopyBridges", "(", "ClassFile", "cf", ",", "Class", "leaf", ")", "{", "for", "(", "Class", "c", ":", "gatherAllBridgeTypes", "(", "new", "HashSet", "<", "Class", ">", "(", ")", ",", "leaf", ")", ")", "{", "if", "(", ...
Add copy bridge methods for all classes/interfaces between the leaf (genericised class) and the root (genericised baseclass). @param cf file to which to add the copy bridge @param leaf leaf class
[ "Add", "copy", "bridge", "methods", "for", "all", "classes", "/", "interfaces", "between", "the", "leaf", "(", "genericised", "class", ")", "and", "the", "root", "(", "genericised", "baseclass", ")", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java#L169-L175
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Solo.java
Solo.setSlidingDrawer
@SuppressWarnings("deprecation") public void setSlidingDrawer(SlidingDrawer slidingDrawer, int status){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "setSlidingDrawer("+slidingDrawer+", "+status+")"); } slidingDrawer = (SlidingDrawer) waiter.waitForView(slidingDrawer, Timeout.getSmallTimeout()); setter.setSlidingDrawer(slidingDrawer, status); }
java
@SuppressWarnings("deprecation") public void setSlidingDrawer(SlidingDrawer slidingDrawer, int status){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "setSlidingDrawer("+slidingDrawer+", "+status+")"); } slidingDrawer = (SlidingDrawer) waiter.waitForView(slidingDrawer, Timeout.getSmallTimeout()); setter.setSlidingDrawer(slidingDrawer, status); }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "public", "void", "setSlidingDrawer", "(", "SlidingDrawer", "slidingDrawer", ",", "int", "status", ")", "{", "if", "(", "config", ".", "commandLogging", ")", "{", "Log", ".", "d", "(", "config", ".", "com...
Sets the status of the specified SlidingDrawer. Examples of status are: {@code Solo.CLOSED} and {@code Solo.OPENED}. @param slidingDrawer the {@link SlidingDrawer} @param status the status to set the {@link SlidingDrawer}
[ "Sets", "the", "status", "of", "the", "specified", "SlidingDrawer", ".", "Examples", "of", "status", "are", ":", "{", "@code", "Solo", ".", "CLOSED", "}", "and", "{", "@code", "Solo", ".", "OPENED", "}", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L2647-L2655
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/user/UserCoreDao.java
UserCoreDao.queryForEq
public TResult queryForEq(String fieldName, Object value) { return queryForEq(fieldName, value, null, null, null); }
java
public TResult queryForEq(String fieldName, Object value) { return queryForEq(fieldName, value, null, null, null); }
[ "public", "TResult", "queryForEq", "(", "String", "fieldName", ",", "Object", "value", ")", "{", "return", "queryForEq", "(", "fieldName", ",", "value", ",", "null", ",", "null", ",", "null", ")", ";", "}" ]
Query for the row where the field equals the value @param fieldName field name @param value value @return result
[ "Query", "for", "the", "row", "where", "the", "field", "equals", "the", "value" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/user/UserCoreDao.java#L240-L242
wcm-io/wcm-io-sling
commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java
RequestParam.getDouble
public static double getDouble(@NotNull ServletRequest request, @NotNull String param) { return getDouble(request, param, 0d); }
java
public static double getDouble(@NotNull ServletRequest request, @NotNull String param) { return getDouble(request, param, 0d); }
[ "public", "static", "double", "getDouble", "(", "@", "NotNull", "ServletRequest", "request", ",", "@", "NotNull", "String", "param", ")", "{", "return", "getDouble", "(", "request", ",", "param", ",", "0d", ")", ";", "}" ]
Returns a request parameter as double. @param request Request. @param param Parameter name. @return Parameter value or 0 if it does not exist or is not a number.
[ "Returns", "a", "request", "parameter", "as", "double", "." ]
train
https://github.com/wcm-io/wcm-io-sling/blob/90adbe432469378794b5695c72e9cdfa2b7d36f1/commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java#L211-L213
eclipse/hawkbit
hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/RepositoryApplicationConfiguration.java
RepositoryApplicationConfiguration.eventEntityManager
@Bean @ConditionalOnMissingBean EventEntityManager eventEntityManager(final TenantAware aware, final EntityManager entityManager) { return new JpaEventEntityManager(aware, entityManager); }
java
@Bean @ConditionalOnMissingBean EventEntityManager eventEntityManager(final TenantAware aware, final EntityManager entityManager) { return new JpaEventEntityManager(aware, entityManager); }
[ "@", "Bean", "@", "ConditionalOnMissingBean", "EventEntityManager", "eventEntityManager", "(", "final", "TenantAware", "aware", ",", "final", "EntityManager", "entityManager", ")", "{", "return", "new", "JpaEventEntityManager", "(", "aware", ",", "entityManager", ")", ...
{@link EventEntityManager} bean. @param aware the tenant aware @param entityManager the entitymanager @return a new {@link EventEntityManager}
[ "{", "@link", "EventEntityManager", "}", "bean", "." ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/RepositoryApplicationConfiguration.java#L737-L741
rwl/CSparseJ
src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_util.java
DZcs_util.cs_ndone
public static DZcsn cs_ndone (DZcsn N, DZcs C, int[] w, DZcsa x, boolean ok) { // cs_spfree (C) ; /* free temporary matrix */ // cs_free (w) ; /* free workspace */ // cs_free (x) ; return (ok ? N : null) ; /* return result if OK, else free it */ }
java
public static DZcsn cs_ndone (DZcsn N, DZcs C, int[] w, DZcsa x, boolean ok) { // cs_spfree (C) ; /* free temporary matrix */ // cs_free (w) ; /* free workspace */ // cs_free (x) ; return (ok ? N : null) ; /* return result if OK, else free it */ }
[ "public", "static", "DZcsn", "cs_ndone", "(", "DZcsn", "N", ",", "DZcs", "C", ",", "int", "[", "]", "w", ",", "DZcsa", "x", ",", "boolean", "ok", ")", "{", "//\t cs_spfree (C) ; /* free temporary matrix */\r", "//\t cs_free (w) ; ...
/* free workspace and return a numeric factorization (Cholesky, LU, or QR)
[ "/", "*", "free", "workspace", "and", "return", "a", "numeric", "factorization", "(", "Cholesky", "LU", "or", "QR", ")" ]
train
https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_util.java#L187-L193
leancloud/java-sdk-all
core/src/main/java/cn/leancloud/upload/QiniuAccessor.java
QiniuAccessor.putFileBlocksToQiniu
public QiniuBlockResponseData putFileBlocksToQiniu(QiniuBlockResponseData lastChunk, final int blockOffset, final byte[] currentChunkData, int currentChunkSize, int retry) { try { String endPoint = String.format(QINIU_BRICK_UPLOAD_EP, this.uploadUrl, lastChunk.ctx, lastChunk.offset); Request.Builder builder = new Request.Builder(); builder.url(endPoint); builder.addHeader(HEAD_CONTENT_TYPE, DEFAULT_CONTENT_TYPE); builder.addHeader(HEAD_CONTENT_LENGTH, String.valueOf(currentChunkSize)); builder.addHeader(HEAD_AUTHORIZATION, "UpToken " + this.uploadToken); LOGGER.d("putFileBlocksToQiniu with uploadUrl: " + endPoint); RequestBody requestBody = RequestBody.create(MediaType.parse(DEFAULT_CONTENT_TYPE), currentChunkData, 0, currentChunkSize); builder = builder.post(requestBody); Response response = this.client.newCall(builder.build()).execute(); QiniuBlockResponseData respData = parseQiniuResponse(response, QiniuBlockResponseData.class); validateCrc32Value(respData, currentChunkData, 0, currentChunkSize); return respData; } catch (Exception e) { if (retry-- > 0) { return putFileBlocksToQiniu(lastChunk, blockOffset, currentChunkData, currentChunkSize, retry); } else { LOGGER.w(e); } } return null; }
java
public QiniuBlockResponseData putFileBlocksToQiniu(QiniuBlockResponseData lastChunk, final int blockOffset, final byte[] currentChunkData, int currentChunkSize, int retry) { try { String endPoint = String.format(QINIU_BRICK_UPLOAD_EP, this.uploadUrl, lastChunk.ctx, lastChunk.offset); Request.Builder builder = new Request.Builder(); builder.url(endPoint); builder.addHeader(HEAD_CONTENT_TYPE, DEFAULT_CONTENT_TYPE); builder.addHeader(HEAD_CONTENT_LENGTH, String.valueOf(currentChunkSize)); builder.addHeader(HEAD_AUTHORIZATION, "UpToken " + this.uploadToken); LOGGER.d("putFileBlocksToQiniu with uploadUrl: " + endPoint); RequestBody requestBody = RequestBody.create(MediaType.parse(DEFAULT_CONTENT_TYPE), currentChunkData, 0, currentChunkSize); builder = builder.post(requestBody); Response response = this.client.newCall(builder.build()).execute(); QiniuBlockResponseData respData = parseQiniuResponse(response, QiniuBlockResponseData.class); validateCrc32Value(respData, currentChunkData, 0, currentChunkSize); return respData; } catch (Exception e) { if (retry-- > 0) { return putFileBlocksToQiniu(lastChunk, blockOffset, currentChunkData, currentChunkSize, retry); } else { LOGGER.w(e); } } return null; }
[ "public", "QiniuBlockResponseData", "putFileBlocksToQiniu", "(", "QiniuBlockResponseData", "lastChunk", ",", "final", "int", "blockOffset", ",", "final", "byte", "[", "]", "currentChunkData", ",", "int", "currentChunkSize", ",", "int", "retry", ")", "{", "try", "{",...
REST API: POST /bput/<ctx>/<nextChunkOffset> HTTP/1.1 Host: <UpHost> Content-Type: application/octet-stream Content-Length: <nextChunkSize> Authorization: UpToken <UploadToken> <nextChunkBinary> Request Params: - ctx: 前一次上传返回的块级上传控制信息。 - nextChunkOffset: 当前片在整个块中的起始偏移。 - nextChunkSize: 当前片数据大小 - nextChunkBinary: 当前片数据 Response: { "ctx": "<Ctx string>", "checksum": "<Checksum string>", "crc32": <Crc32 int64>, "offset": <Offset int64>, "host": "<UpHost string>" } @param lastChunk @param blockOffset @param currentChunkData @param currentChunkSize @param retry @return
[ "REST", "API", ":", "POST", "/", "bput", "/", "<ctx", ">", "/", "<nextChunkOffset", ">", "HTTP", "/", "1", ".", "1", "Host", ":", "<UpHost", ">", "Content", "-", "Type", ":", "application", "/", "octet", "-", "stream", "Content", "-", "Length", ":", ...
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/core/src/main/java/cn/leancloud/upload/QiniuAccessor.java#L264-L293
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/structure/ProjectiveStructureByFactorization.java
ProjectiveStructureByFactorization.getFeature3D
public void getFeature3D( int feature , Point4D_F64 out ) { out.x = X.get(0,feature); out.y = X.get(1,feature); out.z = X.get(2,feature); out.w = X.get(3,feature); }
java
public void getFeature3D( int feature , Point4D_F64 out ) { out.x = X.get(0,feature); out.y = X.get(1,feature); out.z = X.get(2,feature); out.w = X.get(3,feature); }
[ "public", "void", "getFeature3D", "(", "int", "feature", ",", "Point4D_F64", "out", ")", "{", "out", ".", "x", "=", "X", ".", "get", "(", "0", ",", "feature", ")", ";", "out", ".", "y", "=", "X", ".", "get", "(", "1", ",", "feature", ")", ";", ...
Returns location of 3D feature for a view @param feature Index of feature to retrieve @param out (Output) Storage for 3D feature. homogenous coordinates
[ "Returns", "location", "of", "3D", "feature", "for", "a", "view" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/structure/ProjectiveStructureByFactorization.java#L234-L239
amzn/ion-java
src/com/amazon/ion/util/IonTextUtils.java
IonTextUtils.printCodePointAsSurrogatePairHexDigits
private static void printCodePointAsSurrogatePairHexDigits(Appendable out, int c) throws IOException { for (final char unit : Character.toChars(c)) { printCodePointAsFourHexDigits(out, unit); } }
java
private static void printCodePointAsSurrogatePairHexDigits(Appendable out, int c) throws IOException { for (final char unit : Character.toChars(c)) { printCodePointAsFourHexDigits(out, unit); } }
[ "private", "static", "void", "printCodePointAsSurrogatePairHexDigits", "(", "Appendable", "out", ",", "int", "c", ")", "throws", "IOException", "{", "for", "(", "final", "char", "unit", ":", "Character", ".", "toChars", "(", "c", ")", ")", "{", "printCodePoint...
Generates a surrogate pair as two four-digit hex escape sequences, {@code "\}{@code u}<i>{@code HHHH}</i>{@code \}{@code u}<i>{@code HHHH}</i>{@code "}, using lower-case for alphabetics. This for necessary for JSON when the code point is outside the BMP.
[ "Generates", "a", "surrogate", "pair", "as", "two", "four", "-", "digit", "hex", "escape", "sequences", "{" ]
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/util/IonTextUtils.java#L384-L390
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java
ExpressRouteCrossConnectionsInner.listRoutesTableSummaryAsync
public Observable<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner> listRoutesTableSummaryAsync(String resourceGroupName, String crossConnectionName, String peeringName, String devicePath) { return listRoutesTableSummaryWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, devicePath).map(new Func1<ServiceResponse<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner>, ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner>() { @Override public ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner call(ServiceResponse<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner> response) { return response.body(); } }); }
java
public Observable<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner> listRoutesTableSummaryAsync(String resourceGroupName, String crossConnectionName, String peeringName, String devicePath) { return listRoutesTableSummaryWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, devicePath).map(new Func1<ServiceResponse<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner>, ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner>() { @Override public ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner call(ServiceResponse<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner", ">", "listRoutesTableSummaryAsync", "(", "String", "resourceGroupName", ",", "String", "crossConnectionName", ",", "String", "peeringName", ",", "String", "devicePath", ")", "{", "re...
Gets the route table summary associated with the express route cross connection in a resource group. @param resourceGroupName The name of the resource group. @param crossConnectionName The name of the ExpressRouteCrossConnection. @param peeringName The name of the peering. @param devicePath The path of the device. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Gets", "the", "route", "table", "summary", "associated", "with", "the", "express", "route", "cross", "connection", "in", "a", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java#L1135-L1142
alkacon/opencms-core
src/org/opencms/i18n/CmsLocaleManager.java
CmsLocaleManager.getLocales
public static List<Locale> getLocales(String localeNames) { if (localeNames == null) { return null; } return getLocales(CmsStringUtil.splitAsList(localeNames, ',')); }
java
public static List<Locale> getLocales(String localeNames) { if (localeNames == null) { return null; } return getLocales(CmsStringUtil.splitAsList(localeNames, ',')); }
[ "public", "static", "List", "<", "Locale", ">", "getLocales", "(", "String", "localeNames", ")", "{", "if", "(", "localeNames", "==", "null", ")", "{", "return", "null", ";", "}", "return", "getLocales", "(", "CmsStringUtil", ".", "splitAsList", "(", "loca...
Returns a List of locales from a comma-separated string of locale names.<p> @param localeNames a comma-separated string of locale names @return a List of locales derived from the given locale names
[ "Returns", "a", "List", "of", "locales", "from", "a", "comma", "-", "separated", "string", "of", "locale", "names", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsLocaleManager.java#L256-L262
adorsys/hbci4java-adorsys
src/main/java/org/kapott/hbci/manager/BankInfo.java
BankInfo.getValue
private static String getValue(String[] cols, int idx) { if (cols == null || idx >= cols.length) return null; return cols[idx]; }
java
private static String getValue(String[] cols, int idx) { if (cols == null || idx >= cols.length) return null; return cols[idx]; }
[ "private", "static", "String", "getValue", "(", "String", "[", "]", "cols", ",", "int", "idx", ")", "{", "if", "(", "cols", "==", "null", "||", "idx", ">=", "cols", ".", "length", ")", "return", "null", ";", "return", "cols", "[", "idx", "]", ";", ...
Liefert den Wert aus der angegebenen Spalte. @param cols die Werte. @param idx die Spalte - beginnend bei 0. @return der Wert der Spalte oder NULL, wenn er nicht existiert. Die Funktion wirft keine {@link ArrayIndexOutOfBoundsException}
[ "Liefert", "den", "Wert", "aus", "der", "angegebenen", "Spalte", "." ]
train
https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/BankInfo.java#L56-L60
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java
SameDiff.execBackwards
public void execBackwards(Map<String,INDArray> placeholders, List<String> variableGradNamesList){ if (getFunction("grad") == null) { createGradFunction(); } log.trace("About to execute backward function"); //Edge case: if no variables, no variable gradients to calculate... if(variableGradNamesList.isEmpty()){ log.warn("Skipping gradient calculation (backward pass) - no variables to be calculated (variableGradNamesList is empty)"); return; } sameDiffFunctionInstances.get("grad").exec(placeholders, variableGradNamesList); }
java
public void execBackwards(Map<String,INDArray> placeholders, List<String> variableGradNamesList){ if (getFunction("grad") == null) { createGradFunction(); } log.trace("About to execute backward function"); //Edge case: if no variables, no variable gradients to calculate... if(variableGradNamesList.isEmpty()){ log.warn("Skipping gradient calculation (backward pass) - no variables to be calculated (variableGradNamesList is empty)"); return; } sameDiffFunctionInstances.get("grad").exec(placeholders, variableGradNamesList); }
[ "public", "void", "execBackwards", "(", "Map", "<", "String", ",", "INDArray", ">", "placeholders", ",", "List", "<", "String", ">", "variableGradNamesList", ")", "{", "if", "(", "getFunction", "(", "\"grad\"", ")", "==", "null", ")", "{", "createGradFunctio...
As per {@link #execBackwards(Map)}, but the set of gradients to calculate can be specified manually.<br> For example, to calculate the gradient for placeholder variable "myPlaceholder", use {@code execBackwards(placeholders, Arrays.asList(myPlaceholder.gradient().getVarName())}. @param placeholders Values for the placeholder variables in the graph. For graphs without placeholders, use null or an empty map @param variableGradNamesList Names of the gradient variables to calculate
[ "As", "per", "{", "@link", "#execBackwards", "(", "Map", ")", "}", "but", "the", "set", "of", "gradients", "to", "calculate", "can", "be", "specified", "manually", ".", "<br", ">", "For", "example", "to", "calculate", "the", "gradient", "for", "placeholder...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L3249-L3263
deeplearning4j/deeplearning4j
nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/v2/transport/impl/AeronUdpTransport.java
AeronUdpTransport.addInterceptor
public <T extends VoidMessage> void addInterceptor(@NonNull Class<T> cls, @NonNull MessageCallable<T> callable) { interceptors.put(cls.getCanonicalName(), callable); }
java
public <T extends VoidMessage> void addInterceptor(@NonNull Class<T> cls, @NonNull MessageCallable<T> callable) { interceptors.put(cls.getCanonicalName(), callable); }
[ "public", "<", "T", "extends", "VoidMessage", ">", "void", "addInterceptor", "(", "@", "NonNull", "Class", "<", "T", ">", "cls", ",", "@", "NonNull", "MessageCallable", "<", "T", ">", "callable", ")", "{", "interceptors", ".", "put", "(", "cls", ".", "...
This method add interceptor for incoming messages. If interceptor is defined for given message class - runnable will be executed instead of processMessage() @param cls @param callable
[ "This", "method", "add", "interceptor", "for", "incoming", "messages", ".", "If", "interceptor", "is", "defined", "for", "given", "message", "class", "-", "runnable", "will", "be", "executed", "instead", "of", "processMessage", "()" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/v2/transport/impl/AeronUdpTransport.java#L531-L533
landawn/AbacusUtil
src/com/landawn/abacus/util/N.java
N.runUninterruptibly
public static void runUninterruptibly(final long timeoutInMillis, final Try.LongConsumer<InterruptedException> cmd) { N.checkArgNotNull(cmd); boolean interrupted = false; try { long remainingMillis = timeoutInMillis; final long sysMillis = System.currentTimeMillis(); final long end = remainingMillis >= Long.MAX_VALUE - sysMillis ? Long.MAX_VALUE : sysMillis + remainingMillis; while (true) { try { cmd.accept(remainingMillis); return; } catch (InterruptedException e) { interrupted = true; remainingMillis = end - System.currentTimeMillis(); } } } finally { if (interrupted) { Thread.currentThread().interrupt(); } } }
java
public static void runUninterruptibly(final long timeoutInMillis, final Try.LongConsumer<InterruptedException> cmd) { N.checkArgNotNull(cmd); boolean interrupted = false; try { long remainingMillis = timeoutInMillis; final long sysMillis = System.currentTimeMillis(); final long end = remainingMillis >= Long.MAX_VALUE - sysMillis ? Long.MAX_VALUE : sysMillis + remainingMillis; while (true) { try { cmd.accept(remainingMillis); return; } catch (InterruptedException e) { interrupted = true; remainingMillis = end - System.currentTimeMillis(); } } } finally { if (interrupted) { Thread.currentThread().interrupt(); } } }
[ "public", "static", "void", "runUninterruptibly", "(", "final", "long", "timeoutInMillis", ",", "final", "Try", ".", "LongConsumer", "<", "InterruptedException", ">", "cmd", ")", "{", "N", ".", "checkArgNotNull", "(", "cmd", ")", ";", "boolean", "interrupted", ...
Note: Copied from Google Guava under Apache License v2.0 <br /> <br /> If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread. @param timeoutInMillis @param cmd
[ "Note", ":", "Copied", "from", "Google", "Guava", "under", "Apache", "License", "v2", ".", "0", "<br", "/", ">", "<br", "/", ">" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L27962-L27986
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/SloppyMath.java
SloppyMath.main
public static void main(String[] args) { if (args.length == 0) { System.err.println("Usage: java edu.stanford.nlp.math.SloppyMath " + "[-logAdd|-fishers k n r m|-binomial r n p"); } else if (args[0].equals("-logAdd")) { System.out.println("Log adds of neg infinity numbers, etc."); System.out.println("(logs) -Inf + -Inf = " + logAdd(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY)); System.out.println("(logs) -Inf + -7 = " + logAdd(Double.NEGATIVE_INFINITY, -7.0)); System.out.println("(logs) -7 + -Inf = " + logAdd(-7.0, Double.NEGATIVE_INFINITY)); System.out.println("(logs) -50 + -7 = " + logAdd(-50.0, -7.0)); System.out.println("(logs) -11 + -7 = " + logAdd(-11.0, -7.0)); System.out.println("(logs) -7 + -11 = " + logAdd(-7.0, -11.0)); System.out.println("real 1/2 + 1/2 = " + logAdd(Math.log(0.5), Math.log(0.5))); } else if (args[0].equals("-fishers")) { int k = Integer.parseInt(args[1]); int n = Integer.parseInt(args[2]); int r = Integer.parseInt(args[3]); int m = Integer.parseInt(args[4]); double ans = SloppyMath.hypergeometric(k, n, r, m); System.out.println("hypg(" + k + "; " + n + ", " + r + ", " + m + ") = " + ans); ans = SloppyMath.oneTailedFishersExact(k, n, r, m); System.out.println("1-tailed Fisher's exact(" + k + "; " + n + ", " + r + ", " + m + ") = " + ans); double ansChi = SloppyMath.chiSquare2by2(k, n, r, m); System.out.println("chiSquare(" + k + "; " + n + ", " + r + ", " + m + ") = " + ansChi); System.out.println("Swapping arguments should give same hypg:"); ans = SloppyMath.hypergeometric(k, n, r, m); System.out.println("hypg(" + k + "; " + n + ", " + m + ", " + r + ") = " + ans); int othrow = n - m; int othcol = n - r; int cell12 = m - k; int cell21 = r - k; int cell22 = othrow - (r - k); ans = SloppyMath.hypergeometric(cell12, n, othcol, m); System.out.println("hypg(" + cell12 + "; " + n + ", " + othcol + ", " + m + ") = " + ans); ans = SloppyMath.hypergeometric(cell21, n, r, othrow); System.out.println("hypg(" + cell21 + "; " + n + ", " + r + ", " + othrow + ") = " + ans); ans = SloppyMath.hypergeometric(cell22, n, othcol, othrow); System.out.println("hypg(" + cell22 + "; " + n + ", " + othcol + ", " + othrow + ") = " + ans); } else if (args[0].equals("-binomial")) { int k = Integer.parseInt(args[1]); int n = Integer.parseInt(args[2]); double p = Double.parseDouble(args[3]); double ans = SloppyMath.exactBinomial(k, n, p); System.out.println("Binomial p(X >= " + k + "; " + n + ", " + p + ") = " + ans); } else { System.err.println("Unknown option: " + args[0]); } }
java
public static void main(String[] args) { if (args.length == 0) { System.err.println("Usage: java edu.stanford.nlp.math.SloppyMath " + "[-logAdd|-fishers k n r m|-binomial r n p"); } else if (args[0].equals("-logAdd")) { System.out.println("Log adds of neg infinity numbers, etc."); System.out.println("(logs) -Inf + -Inf = " + logAdd(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY)); System.out.println("(logs) -Inf + -7 = " + logAdd(Double.NEGATIVE_INFINITY, -7.0)); System.out.println("(logs) -7 + -Inf = " + logAdd(-7.0, Double.NEGATIVE_INFINITY)); System.out.println("(logs) -50 + -7 = " + logAdd(-50.0, -7.0)); System.out.println("(logs) -11 + -7 = " + logAdd(-11.0, -7.0)); System.out.println("(logs) -7 + -11 = " + logAdd(-7.0, -11.0)); System.out.println("real 1/2 + 1/2 = " + logAdd(Math.log(0.5), Math.log(0.5))); } else if (args[0].equals("-fishers")) { int k = Integer.parseInt(args[1]); int n = Integer.parseInt(args[2]); int r = Integer.parseInt(args[3]); int m = Integer.parseInt(args[4]); double ans = SloppyMath.hypergeometric(k, n, r, m); System.out.println("hypg(" + k + "; " + n + ", " + r + ", " + m + ") = " + ans); ans = SloppyMath.oneTailedFishersExact(k, n, r, m); System.out.println("1-tailed Fisher's exact(" + k + "; " + n + ", " + r + ", " + m + ") = " + ans); double ansChi = SloppyMath.chiSquare2by2(k, n, r, m); System.out.println("chiSquare(" + k + "; " + n + ", " + r + ", " + m + ") = " + ansChi); System.out.println("Swapping arguments should give same hypg:"); ans = SloppyMath.hypergeometric(k, n, r, m); System.out.println("hypg(" + k + "; " + n + ", " + m + ", " + r + ") = " + ans); int othrow = n - m; int othcol = n - r; int cell12 = m - k; int cell21 = r - k; int cell22 = othrow - (r - k); ans = SloppyMath.hypergeometric(cell12, n, othcol, m); System.out.println("hypg(" + cell12 + "; " + n + ", " + othcol + ", " + m + ") = " + ans); ans = SloppyMath.hypergeometric(cell21, n, r, othrow); System.out.println("hypg(" + cell21 + "; " + n + ", " + r + ", " + othrow + ") = " + ans); ans = SloppyMath.hypergeometric(cell22, n, othcol, othrow); System.out.println("hypg(" + cell22 + "; " + n + ", " + othcol + ", " + othrow + ") = " + ans); } else if (args[0].equals("-binomial")) { int k = Integer.parseInt(args[1]); int n = Integer.parseInt(args[2]); double p = Double.parseDouble(args[3]); double ans = SloppyMath.exactBinomial(k, n, p); System.out.println("Binomial p(X >= " + k + "; " + n + ", " + p + ") = " + ans); } else { System.err.println("Unknown option: " + args[0]); } }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "if", "(", "args", ".", "length", "==", "0", ")", "{", "System", ".", "err", ".", "println", "(", "\"Usage: java edu.stanford.nlp.math.SloppyMath \"", "+", "\"[-logAdd|-fishers k n ...
Tests the hypergeometric distribution code, or other functions provided in this module. @param args Either none, and the log add rountines are tested, or the following 4 arguments: k (cell), n (total), r (row), m (col)
[ "Tests", "the", "hypergeometric", "distribution", "code", "or", "other", "functions", "provided", "in", "this", "module", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/SloppyMath.java#L651-L698
dhanji/sitebricks
sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlParser.java
HtmlParser.addTextNodeToParent
private void addTextNodeToParent (String text, Element parent, AnnotationNode annotation) { String [] lines = new String[] {text}; if (annotation != null) lines = splitInTwo(text); for (int i = 0; i < lines.length; i++){ TextNode textNode = TextNode.createFromEncoded(lines[i], baseUri); lines(textNode, lines[i]); // apply the annotation and reset it to null if (annotation != null && i == 0) annotation.apply(textNode); // put the text node on the parent parent.appendChild(textNode); } }
java
private void addTextNodeToParent (String text, Element parent, AnnotationNode annotation) { String [] lines = new String[] {text}; if (annotation != null) lines = splitInTwo(text); for (int i = 0; i < lines.length; i++){ TextNode textNode = TextNode.createFromEncoded(lines[i], baseUri); lines(textNode, lines[i]); // apply the annotation and reset it to null if (annotation != null && i == 0) annotation.apply(textNode); // put the text node on the parent parent.appendChild(textNode); } }
[ "private", "void", "addTextNodeToParent", "(", "String", "text", ",", "Element", "parent", ",", "AnnotationNode", "annotation", ")", "{", "String", "[", "]", "lines", "=", "new", "String", "[", "]", "{", "text", "}", ";", "if", "(", "annotation", "!=", "...
Break the text up by the first line delimiter. We only want annotations applied to the first line of a block of text and not to a whole segment. @param text the text to turn into nodes @param parent the parent node @param annotation the current annotation to be applied to the first line of text
[ "Break", "the", "text", "up", "by", "the", "first", "line", "delimiter", ".", "We", "only", "want", "annotations", "applied", "to", "the", "first", "line", "of", "a", "block", "of", "text", "and", "not", "to", "a", "whole", "segment", "." ]
train
https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlParser.java#L330-L347
googleapis/google-cloud-java
google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Key.java
Key.fromUrlSafe
public static Key fromUrlSafe(String urlSafe) { try { String utf8Str = URLDecoder.decode(urlSafe, UTF_8.name()); com.google.datastore.v1.Key.Builder builder = com.google.datastore.v1.Key.newBuilder(); TextFormat.merge(utf8Str, builder); return fromPb(builder.build()); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("Unexpected decoding exception", e); } catch (TextFormat.ParseException e) { throw new IllegalArgumentException("Could not parse key", e); } }
java
public static Key fromUrlSafe(String urlSafe) { try { String utf8Str = URLDecoder.decode(urlSafe, UTF_8.name()); com.google.datastore.v1.Key.Builder builder = com.google.datastore.v1.Key.newBuilder(); TextFormat.merge(utf8Str, builder); return fromPb(builder.build()); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("Unexpected decoding exception", e); } catch (TextFormat.ParseException e) { throw new IllegalArgumentException("Could not parse key", e); } }
[ "public", "static", "Key", "fromUrlSafe", "(", "String", "urlSafe", ")", "{", "try", "{", "String", "utf8Str", "=", "URLDecoder", ".", "decode", "(", "urlSafe", ",", "UTF_8", ".", "name", "(", ")", ")", ";", "com", ".", "google", ".", "datastore", ".",...
Create a {@code Key} given its URL safe encoded form. @throws IllegalArgumentException when decoding fails
[ "Create", "a", "{", "@code", "Key", "}", "given", "its", "URL", "safe", "encoded", "form", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Key.java#L142-L153
linkedin/linkedin-zookeeper
org.linkedin.zookeeper-impl/src/main/java/org/linkedin/zookeeper/client/AbstractZKClient.java
AbstractZKClient.createParents
private void createParents(String path, List<ACL> acl) throws InterruptedException, KeeperException { path = PathUtils.getParentPath(adjustPath(path)); path = PathUtils.removeTrailingSlash(path); List<String> paths = new ArrayList<String>(); while(!path.equals("") && getZk().exists(path, false) == null) { paths.add(path); path = PathUtils.getParentPath(path); path = PathUtils.removeTrailingSlash(path); } Collections.reverse(paths); for(String p : paths) { try { getZk().create(p, null, acl, CreateMode.PERSISTENT); } catch(KeeperException.NodeExistsException e) { // ok we continue... if(log.isDebugEnabled()) log.debug("parent already exists " + p); } } }
java
private void createParents(String path, List<ACL> acl) throws InterruptedException, KeeperException { path = PathUtils.getParentPath(adjustPath(path)); path = PathUtils.removeTrailingSlash(path); List<String> paths = new ArrayList<String>(); while(!path.equals("") && getZk().exists(path, false) == null) { paths.add(path); path = PathUtils.getParentPath(path); path = PathUtils.removeTrailingSlash(path); } Collections.reverse(paths); for(String p : paths) { try { getZk().create(p, null, acl, CreateMode.PERSISTENT); } catch(KeeperException.NodeExistsException e) { // ok we continue... if(log.isDebugEnabled()) log.debug("parent already exists " + p); } } }
[ "private", "void", "createParents", "(", "String", "path", ",", "List", "<", "ACL", ">", "acl", ")", "throws", "InterruptedException", ",", "KeeperException", "{", "path", "=", "PathUtils", ".", "getParentPath", "(", "adjustPath", "(", "path", ")", ")", ";",...
Implementation note: the method adjusts the path and use getZk() directly because in the case where chroot is not null, the chroot path itself may not exist which is why we have to go all the way to the root.
[ "Implementation", "note", ":", "the", "method", "adjusts", "the", "path", "and", "use", "getZk", "()", "directly", "because", "in", "the", "case", "where", "chroot", "is", "not", "null", "the", "chroot", "path", "itself", "may", "not", "exist", "which", "i...
train
https://github.com/linkedin/linkedin-zookeeper/blob/600b1d01318594ed425ede566bbbdc94b026a53e/org.linkedin.zookeeper-impl/src/main/java/org/linkedin/zookeeper/client/AbstractZKClient.java#L280-L315
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/exif/ExifGpsWriter.java
ExifGpsWriter.createNewExifNode
private IIOMetadataNode createNewExifNode( IIOMetadata tiffMetadata, IIOMetadata thumbMeta, BufferedImage thumbnail ) { IIOMetadataNode app1Node = null; ImageWriter tiffWriter = null; try { Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName("tiff"); while( writers.hasNext() ) { tiffWriter = writers.next(); if (tiffWriter.getClass().getName().startsWith("com.sun.media")) { // Break on finding the core provider. break; } } if (tiffWriter == null) { System.out.println("Cannot find core TIFF writer!"); System.exit(0); } ImageWriteParam writeParam = tiffWriter.getDefaultWriteParam(); writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); writeParam.setCompressionType("EXIF JPEG"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); MemoryCacheImageOutputStream app1EXIFOutput = new MemoryCacheImageOutputStream(baos); tiffWriter.setOutput(app1EXIFOutput); // escribir tiffWriter.prepareWriteEmpty(jpegReader.getStreamMetadata(), new ImageTypeSpecifier(image), image.getWidth(), image.getHeight(), tiffMetadata, null, writeParam); tiffWriter.endWriteEmpty(); // Flush data into byte stream. app1EXIFOutput.flush(); // Create APP1 parameter array. byte[] app1Parameters = new byte[6 + baos.size()]; // Add EXIF APP1 ID bytes. app1Parameters[0] = (byte) 'E'; app1Parameters[1] = (byte) 'x'; app1Parameters[2] = (byte) 'i'; app1Parameters[3] = (byte) 'f'; app1Parameters[4] = app1Parameters[5] = (byte) 0; // Append TIFF stream to APP1 parameters. System.arraycopy(baos.toByteArray(), 0, app1Parameters, 6, baos.size()); // Create the APP1 EXIF node to be added to native JPEG image metadata. app1Node = new IIOMetadataNode("unknown"); app1Node.setAttribute("MarkerTag", (new Integer(0xE1)).toString()); app1Node.setUserObject(app1Parameters); } catch (IOException e) { e.printStackTrace(); } finally { if (tiffWriter != null) tiffWriter.dispose(); } return app1Node; }
java
private IIOMetadataNode createNewExifNode( IIOMetadata tiffMetadata, IIOMetadata thumbMeta, BufferedImage thumbnail ) { IIOMetadataNode app1Node = null; ImageWriter tiffWriter = null; try { Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName("tiff"); while( writers.hasNext() ) { tiffWriter = writers.next(); if (tiffWriter.getClass().getName().startsWith("com.sun.media")) { // Break on finding the core provider. break; } } if (tiffWriter == null) { System.out.println("Cannot find core TIFF writer!"); System.exit(0); } ImageWriteParam writeParam = tiffWriter.getDefaultWriteParam(); writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); writeParam.setCompressionType("EXIF JPEG"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); MemoryCacheImageOutputStream app1EXIFOutput = new MemoryCacheImageOutputStream(baos); tiffWriter.setOutput(app1EXIFOutput); // escribir tiffWriter.prepareWriteEmpty(jpegReader.getStreamMetadata(), new ImageTypeSpecifier(image), image.getWidth(), image.getHeight(), tiffMetadata, null, writeParam); tiffWriter.endWriteEmpty(); // Flush data into byte stream. app1EXIFOutput.flush(); // Create APP1 parameter array. byte[] app1Parameters = new byte[6 + baos.size()]; // Add EXIF APP1 ID bytes. app1Parameters[0] = (byte) 'E'; app1Parameters[1] = (byte) 'x'; app1Parameters[2] = (byte) 'i'; app1Parameters[3] = (byte) 'f'; app1Parameters[4] = app1Parameters[5] = (byte) 0; // Append TIFF stream to APP1 parameters. System.arraycopy(baos.toByteArray(), 0, app1Parameters, 6, baos.size()); // Create the APP1 EXIF node to be added to native JPEG image metadata. app1Node = new IIOMetadataNode("unknown"); app1Node.setAttribute("MarkerTag", (new Integer(0xE1)).toString()); app1Node.setUserObject(app1Parameters); } catch (IOException e) { e.printStackTrace(); } finally { if (tiffWriter != null) tiffWriter.dispose(); } return app1Node; }
[ "private", "IIOMetadataNode", "createNewExifNode", "(", "IIOMetadata", "tiffMetadata", ",", "IIOMetadata", "thumbMeta", ",", "BufferedImage", "thumbnail", ")", "{", "IIOMetadataNode", "app1Node", "=", "null", ";", "ImageWriter", "tiffWriter", "=", "null", ";", "try", ...
Private method - creates a copy of the metadata that can be written to @param tiffMetadata - in metadata @return new metadata node that can be written to
[ "Private", "method", "-", "creates", "a", "copy", "of", "the", "metadata", "that", "can", "be", "written", "to" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/exif/ExifGpsWriter.java#L288-L349
samskivert/pythagoras
src/main/java/pythagoras/d/Matrix4.java
Matrix4.setToFrustum
public Matrix4 setToFrustum ( double left, double right, double bottom, double top, double near, double far, IVector3 nearFarNormal) { double rrl = 1f / (right - left); double rtb = 1f / (top - bottom); double rnf = 1f / (near - far); double n2 = 2f * near; double s = (far + near) / (near*nearFarNormal.z() - far*nearFarNormal.z()); return set(n2 * rrl, 0f, (right + left) * rrl, 0f, 0f, n2 * rtb, (top + bottom) * rtb, 0f, s * nearFarNormal.x(), s * nearFarNormal.y(), (far + near) * rnf, n2 * far * rnf, 0f, 0f, -1f, 0f); }
java
public Matrix4 setToFrustum ( double left, double right, double bottom, double top, double near, double far, IVector3 nearFarNormal) { double rrl = 1f / (right - left); double rtb = 1f / (top - bottom); double rnf = 1f / (near - far); double n2 = 2f * near; double s = (far + near) / (near*nearFarNormal.z() - far*nearFarNormal.z()); return set(n2 * rrl, 0f, (right + left) * rrl, 0f, 0f, n2 * rtb, (top + bottom) * rtb, 0f, s * nearFarNormal.x(), s * nearFarNormal.y(), (far + near) * rnf, n2 * far * rnf, 0f, 0f, -1f, 0f); }
[ "public", "Matrix4", "setToFrustum", "(", "double", "left", ",", "double", "right", ",", "double", "bottom", ",", "double", "top", ",", "double", "near", ",", "double", "far", ",", "IVector3", "nearFarNormal", ")", "{", "double", "rrl", "=", "1f", "/", "...
Sets this to a perspective projection matrix. @return a reference to this matrix, for chaining.
[ "Sets", "this", "to", "a", "perspective", "projection", "matrix", "." ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Matrix4.java#L397-L409
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java
ImplicitObjectUtil.loadSharedFlow
public static void loadSharedFlow(ServletRequest request, Map/*<String, SharedFlowController>*/ sharedFlows) { if(sharedFlows != null) request.setAttribute(SHARED_FLOW_IMPLICIT_OBJECT_KEY, sharedFlows); }
java
public static void loadSharedFlow(ServletRequest request, Map/*<String, SharedFlowController>*/ sharedFlows) { if(sharedFlows != null) request.setAttribute(SHARED_FLOW_IMPLICIT_OBJECT_KEY, sharedFlows); }
[ "public", "static", "void", "loadSharedFlow", "(", "ServletRequest", "request", ",", "Map", "/*<String, SharedFlowController>*/", "sharedFlows", ")", "{", "if", "(", "sharedFlows", "!=", "null", ")", "request", ".", "setAttribute", "(", "SHARED_FLOW_IMPLICIT_OBJECT_KEY"...
Load the shared flow into the request. @param request the request @param sharedFlows the current shared flows
[ "Load", "the", "shared", "flow", "into", "the", "request", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java#L136-L139
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric_ca/sdk/HFCAClient.java
HFCAClient.createNewInstance
public static HFCAClient createNewInstance(NetworkConfig.CAInfo caInfo, CryptoSuite cryptoSuite) throws MalformedURLException, InvalidArgumentException { if (null == caInfo) { throw new InvalidArgumentException("The caInfo parameter can not be null."); } if (null == cryptoSuite) { throw new InvalidArgumentException("The cryptoSuite parameter can not be null."); } HFCAClient ret = new HFCAClient(caInfo.getCAName(), caInfo.getUrl(), caInfo.getProperties()); ret.setCryptoSuite(cryptoSuite); return ret; }
java
public static HFCAClient createNewInstance(NetworkConfig.CAInfo caInfo, CryptoSuite cryptoSuite) throws MalformedURLException, InvalidArgumentException { if (null == caInfo) { throw new InvalidArgumentException("The caInfo parameter can not be null."); } if (null == cryptoSuite) { throw new InvalidArgumentException("The cryptoSuite parameter can not be null."); } HFCAClient ret = new HFCAClient(caInfo.getCAName(), caInfo.getUrl(), caInfo.getProperties()); ret.setCryptoSuite(cryptoSuite); return ret; }
[ "public", "static", "HFCAClient", "createNewInstance", "(", "NetworkConfig", ".", "CAInfo", "caInfo", ",", "CryptoSuite", "cryptoSuite", ")", "throws", "MalformedURLException", ",", "InvalidArgumentException", "{", "if", "(", "null", "==", "caInfo", ")", "{", "throw...
Create HFCAClient from a NetworkConfig.CAInfo @param caInfo created from NetworkConfig.getOrganizationInfo("org_name").getCertificateAuthorities() @param cryptoSuite the specific cryptosuite to use. @return HFCAClient @throws MalformedURLException @throws InvalidArgumentException
[ "Create", "HFCAClient", "from", "a", "NetworkConfig", ".", "CAInfo" ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric_ca/sdk/HFCAClient.java#L343-L356
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/returns/PackageUrl.java
PackageUrl.deletePackageUrl
public static MozuUrl deletePackageUrl(String packageId, String returnId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/returns/{returnId}/packages/{packageId}"); formatter.formatUrl("packageId", packageId); formatter.formatUrl("returnId", returnId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl deletePackageUrl(String packageId, String returnId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/returns/{returnId}/packages/{packageId}"); formatter.formatUrl("packageId", packageId); formatter.formatUrl("returnId", returnId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "deletePackageUrl", "(", "String", "packageId", ",", "String", "returnId", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/returns/{returnId}/packages/{packageId}\"", ")", ";", "formatter", ".", "fo...
Get Resource Url for DeletePackage @param packageId Unique identifier of the package for which to retrieve the label. @param returnId Unique identifier of the return whose items you want to get. @return String Resource Url
[ "Get", "Resource", "Url", "for", "DeletePackage" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/returns/PackageUrl.java#L84-L90
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.pack
public static void pack(File sourceDir, File targetZip, NameMapper mapper) { pack(sourceDir, targetZip, mapper, DEFAULT_COMPRESSION_LEVEL); }
java
public static void pack(File sourceDir, File targetZip, NameMapper mapper) { pack(sourceDir, targetZip, mapper, DEFAULT_COMPRESSION_LEVEL); }
[ "public", "static", "void", "pack", "(", "File", "sourceDir", ",", "File", "targetZip", ",", "NameMapper", "mapper", ")", "{", "pack", "(", "sourceDir", ",", "targetZip", ",", "mapper", ",", "DEFAULT_COMPRESSION_LEVEL", ")", ";", "}" ]
Compresses the given directory and all its sub-directories into a ZIP file. <p> The ZIP file must not be a directory and its parent directory must exist. @param sourceDir root directory. @param targetZip ZIP file that will be created or overwritten. @param mapper call-back for renaming the entries.
[ "Compresses", "the", "given", "directory", "and", "all", "its", "sub", "-", "directories", "into", "a", "ZIP", "file", ".", "<p", ">", "The", "ZIP", "file", "must", "not", "be", "a", "directory", "and", "its", "parent", "directory", "must", "exist", "." ...
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L1585-L1587
msteiger/jxmapviewer2
jxmapviewer2/src/main/java/org/jxmapviewer/cache/FileBasedLocalCache.java
FileBasedLocalCache.getLocalFile
public File getLocalFile(URL remoteUri) { StringBuilder sb = new StringBuilder(); String host = remoteUri.getHost(); String query = remoteUri.getQuery(); String path = remoteUri.getPath(); if (host != null) { sb.append(host); } if (path != null) { sb.append(path); } if (query != null) { sb.append('?'); sb.append(query); } String name; final int maxLen = 250; if (sb.length() < maxLen) { name = sb.toString(); } else { name = sb.substring(0, maxLen); } name = name.replace('?', '$'); name = name.replace('*', '$'); name = name.replace(':', '$'); name = name.replace('<', '$'); name = name.replace('>', '$'); name = name.replace('"', '$'); File f = new File(cacheDir, name); return f; }
java
public File getLocalFile(URL remoteUri) { StringBuilder sb = new StringBuilder(); String host = remoteUri.getHost(); String query = remoteUri.getQuery(); String path = remoteUri.getPath(); if (host != null) { sb.append(host); } if (path != null) { sb.append(path); } if (query != null) { sb.append('?'); sb.append(query); } String name; final int maxLen = 250; if (sb.length() < maxLen) { name = sb.toString(); } else { name = sb.substring(0, maxLen); } name = name.replace('?', '$'); name = name.replace('*', '$'); name = name.replace(':', '$'); name = name.replace('<', '$'); name = name.replace('>', '$'); name = name.replace('"', '$'); File f = new File(cacheDir, name); return f; }
[ "public", "File", "getLocalFile", "(", "URL", "remoteUri", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "String", "host", "=", "remoteUri", ".", "getHost", "(", ")", ";", "String", "query", "=", "remoteUri", ".", "getQuery",...
Returns the local File corresponding to the given remote URI. @param remoteUri the remote URI @return the corresponding local file
[ "Returns", "the", "local", "File", "corresponding", "to", "the", "given", "remote", "URI", "." ]
train
https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/cache/FileBasedLocalCache.java#L78-L123
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/extension/properties/PropertiesManagerCore.java
PropertiesManagerCore.addValue
public boolean addValue(String geoPackage, String property, String value) { boolean added = false; PropertiesCoreExtension<T, ?, ?, ?> properties = propertiesMap .get(geoPackage); if (properties != null) { added = properties.addValue(property, value); } return added; }
java
public boolean addValue(String geoPackage, String property, String value) { boolean added = false; PropertiesCoreExtension<T, ?, ?, ?> properties = propertiesMap .get(geoPackage); if (properties != null) { added = properties.addValue(property, value); } return added; }
[ "public", "boolean", "addValue", "(", "String", "geoPackage", ",", "String", "property", ",", "String", "value", ")", "{", "boolean", "added", "=", "false", ";", "PropertiesCoreExtension", "<", "T", ",", "?", ",", "?", ",", "?", ">", "properties", "=", "...
Add a property value to a specified GeoPackage @param geoPackage GeoPackage name @param property property name @param value value @return true if added
[ "Add", "a", "property", "value", "to", "a", "specified", "GeoPackage" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/properties/PropertiesManagerCore.java#L416-L424
dnsjava/dnsjava
org/xbill/DNS/Message.java
Message.findRecord
public boolean findRecord(Record r, int section) { return (sections[section] != null && sections[section].contains(r)); }
java
public boolean findRecord(Record r, int section) { return (sections[section] != null && sections[section].contains(r)); }
[ "public", "boolean", "findRecord", "(", "Record", "r", ",", "int", "section", ")", "{", "return", "(", "sections", "[", "section", "]", "!=", "null", "&&", "sections", "[", "section", "]", ".", "contains", "(", "r", ")", ")", ";", "}" ]
Determines if the given record is already present in the given section. @see Record @see Section
[ "Determines", "if", "the", "given", "record", "is", "already", "present", "in", "the", "given", "section", "." ]
train
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Message.java#L210-L213
maguro/aunit
junit/src/main/java/com/toolazydogs/aunit/internal/Util.java
Util.validatePublicNoArg
@SuppressWarnings({"ThrowableInstanceNeverThrown"}) public static void validatePublicNoArg(Method method, List<Throwable> errors) { if (!Modifier.isPublic(method.getModifiers())) { errors.add(new Exception("Method " + method.getName() + "() should be public")); } if (method.getParameterTypes().length != 0) { errors.add(new Exception("Method " + method.getName() + " should have no parameters")); } }
java
@SuppressWarnings({"ThrowableInstanceNeverThrown"}) public static void validatePublicNoArg(Method method, List<Throwable> errors) { if (!Modifier.isPublic(method.getModifiers())) { errors.add(new Exception("Method " + method.getName() + "() should be public")); } if (method.getParameterTypes().length != 0) { errors.add(new Exception("Method " + method.getName() + " should have no parameters")); } }
[ "@", "SuppressWarnings", "(", "{", "\"ThrowableInstanceNeverThrown\"", "}", ")", "public", "static", "void", "validatePublicNoArg", "(", "Method", "method", ",", "List", "<", "Throwable", ">", "errors", ")", "{", "if", "(", "!", "Modifier", ".", "isPublic", "(...
Validate that a method is public, has no arguments. @param method the method to be tested @param errors a list to place the errors
[ "Validate", "that", "a", "method", "is", "public", "has", "no", "arguments", "." ]
train
https://github.com/maguro/aunit/blob/1f972e35b28327e5e2e7881befc928df0546d74c/junit/src/main/java/com/toolazydogs/aunit/internal/Util.java#L35-L46
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Reaper.java
Reaper.addPath
public void addPath(String path, Mode mode) { PathHolder pathHolder = new PathHolder(path, mode, 0); activePaths.put(path, pathHolder); schedule(pathHolder, reapingThresholdMs); }
java
public void addPath(String path, Mode mode) { PathHolder pathHolder = new PathHolder(path, mode, 0); activePaths.put(path, pathHolder); schedule(pathHolder, reapingThresholdMs); }
[ "public", "void", "addPath", "(", "String", "path", ",", "Mode", "mode", ")", "{", "PathHolder", "pathHolder", "=", "new", "PathHolder", "(", "path", ",", "mode", ",", "0", ")", ";", "activePaths", ".", "put", "(", "path", ",", "pathHolder", ")", ";", ...
Add a path to be checked by the reaper. The path will be checked periodically until the reaper is closed, or until the point specified by the Mode @param path path to check @param mode reaping mode
[ "Add", "a", "path", "to", "be", "checked", "by", "the", "reaper", ".", "The", "path", "will", "be", "checked", "periodically", "until", "the", "reaper", "is", "closed", "or", "until", "the", "point", "specified", "by", "the", "Mode" ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Reaper.java#L205-L210
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java
TypeHandlerUtils.convertSqlXml
public static Object convertSqlXml(Object sqlXml, InputStream input) throws SQLException { return convertSqlXml(sqlXml, toByteArray(input)); }
java
public static Object convertSqlXml(Object sqlXml, InputStream input) throws SQLException { return convertSqlXml(sqlXml, toByteArray(input)); }
[ "public", "static", "Object", "convertSqlXml", "(", "Object", "sqlXml", ",", "InputStream", "input", ")", "throws", "SQLException", "{", "return", "convertSqlXml", "(", "sqlXml", ",", "toByteArray", "(", "input", ")", ")", ";", "}" ]
Transfers data from InputStream into sql.SQLXML <p/> Using default locale. If different locale is required see {@link #convertSqlXml(Object, String)} @param sqlXml sql.SQLXML which would be filled @param input InputStream @return sql.SQLXML from InputStream @throws SQLException
[ "Transfers", "data", "from", "InputStream", "into", "sql", ".", "SQLXML", "<p", "/", ">", "Using", "default", "locale", ".", "If", "different", "locale", "is", "required", "see", "{", "@link", "#convertSqlXml", "(", "Object", "String", ")", "}" ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java#L377-L379
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Search.java
Search.setType
public void setType(String type) throws ApplicationException { if (type == null) return; type = type.toLowerCase().trim(); if (type.equals("simple")) this.type = SearchCollection.SEARCH_TYPE_SIMPLE; else if (type.equals("explicit")) this.type = SearchCollection.SEARCH_TYPE_EXPLICIT; else throw new ApplicationException("attribute type of tag search has an invalid value, valid values are [simple,explicit] now is [" + type + "]"); }
java
public void setType(String type) throws ApplicationException { if (type == null) return; type = type.toLowerCase().trim(); if (type.equals("simple")) this.type = SearchCollection.SEARCH_TYPE_SIMPLE; else if (type.equals("explicit")) this.type = SearchCollection.SEARCH_TYPE_EXPLICIT; else throw new ApplicationException("attribute type of tag search has an invalid value, valid values are [simple,explicit] now is [" + type + "]"); }
[ "public", "void", "setType", "(", "String", "type", ")", "throws", "ApplicationException", "{", "if", "(", "type", "==", "null", ")", "return", ";", "type", "=", "type", ".", "toLowerCase", "(", ")", ".", "trim", "(", ")", ";", "if", "(", "type", "."...
set the value type Specifies the criteria type for the search. @param type value to set @throws ApplicationException
[ "set", "the", "value", "type", "Specifies", "the", "criteria", "type", "for", "the", "search", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Search.java#L119-L126
GoogleCloudPlatform/appengine-mapreduce
java/src/main/java/com/google/appengine/tools/mapreduce/impl/sort/SortWorker.java
SortWorker.writePointer
private void writePointer(int index, ByteBuffer pointer) { int limit = memoryBuffer.limit(); int pos = memoryBuffer.position(); int pointerOffset = computePointerOffset(index); memoryBuffer.limit(pointerOffset + POINTER_SIZE_BYTES); memoryBuffer.position(pointerOffset); memoryBuffer.put(pointer); memoryBuffer.limit(limit); memoryBuffer.position(pos); }
java
private void writePointer(int index, ByteBuffer pointer) { int limit = memoryBuffer.limit(); int pos = memoryBuffer.position(); int pointerOffset = computePointerOffset(index); memoryBuffer.limit(pointerOffset + POINTER_SIZE_BYTES); memoryBuffer.position(pointerOffset); memoryBuffer.put(pointer); memoryBuffer.limit(limit); memoryBuffer.position(pos); }
[ "private", "void", "writePointer", "(", "int", "index", ",", "ByteBuffer", "pointer", ")", "{", "int", "limit", "=", "memoryBuffer", ".", "limit", "(", ")", ";", "int", "pos", "=", "memoryBuffer", ".", "position", "(", ")", ";", "int", "pointerOffset", "...
Write the provided pointer at the specified index. (Assumes limit on buffer is correctly set) (Position of the buffer changed)
[ "Write", "the", "provided", "pointer", "at", "the", "specified", "index", ".", "(", "Assumes", "limit", "on", "buffer", "is", "correctly", "set", ")", "(", "Position", "of", "the", "buffer", "changed", ")" ]
train
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/java/src/main/java/com/google/appengine/tools/mapreduce/impl/sort/SortWorker.java#L307-L316
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/Assert.java
Assert.messageFormat
private static String messageFormat(String message, Object... arguments) { return (arguments == null ? message : MessageFormat.format(message, arguments)); }
java
private static String messageFormat(String message, Object... arguments) { return (arguments == null ? message : MessageFormat.format(message, arguments)); }
[ "private", "static", "String", "messageFormat", "(", "String", "message", ",", "Object", "...", "arguments", ")", "{", "return", "(", "arguments", "==", "null", "?", "message", ":", "MessageFormat", ".", "format", "(", "message", ",", "arguments", ")", ")", ...
Formats the specified {@link String message} containing possible placeholders as defined by {@link MessageFormat}. @param message {@link String} containing the message to format. @param arguments array of {@link Object arguments} used when formatting the {@link String message}. @return the {@link String message} formatted with the {@link Object arguments}. @see java.text.MessageFormat#format(String, Object...)
[ "Formats", "the", "specified", "{", "@link", "String", "message", "}", "containing", "possible", "placeholders", "as", "defined", "by", "{", "@link", "MessageFormat", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/Assert.java#L1507-L1509
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/TransitionsConfig.java
TransitionsConfig.imports
public static Map<Transition, Collection<TileRef>> imports(Media config) { final Xml root = new Xml(config); final Collection<Xml> nodesTransition = root.getChildren(NODE_TRANSITION); final Map<Transition, Collection<TileRef>> transitions = new HashMap<>(nodesTransition.size()); for (final Xml nodeTransition : nodesTransition) { final String groupIn = nodeTransition.readString(ATTRIBUTE_GROUP_IN); final String groupOut = nodeTransition.readString(ATTRIBUTE_GROUP_OUT); final String transitionType = nodeTransition.readString(ATTRIBUTE_TRANSITION_TYPE); final TransitionType type = TransitionType.from(transitionType); final Transition transition = new Transition(type, groupIn, groupOut); final Collection<Xml> nodesTileRef = nodeTransition.getChildren(TileConfig.NODE_TILE); final Collection<TileRef> tilesRef = importTiles(nodesTileRef); transitions.put(transition, tilesRef); } return transitions; }
java
public static Map<Transition, Collection<TileRef>> imports(Media config) { final Xml root = new Xml(config); final Collection<Xml> nodesTransition = root.getChildren(NODE_TRANSITION); final Map<Transition, Collection<TileRef>> transitions = new HashMap<>(nodesTransition.size()); for (final Xml nodeTransition : nodesTransition) { final String groupIn = nodeTransition.readString(ATTRIBUTE_GROUP_IN); final String groupOut = nodeTransition.readString(ATTRIBUTE_GROUP_OUT); final String transitionType = nodeTransition.readString(ATTRIBUTE_TRANSITION_TYPE); final TransitionType type = TransitionType.from(transitionType); final Transition transition = new Transition(type, groupIn, groupOut); final Collection<Xml> nodesTileRef = nodeTransition.getChildren(TileConfig.NODE_TILE); final Collection<TileRef> tilesRef = importTiles(nodesTileRef); transitions.put(transition, tilesRef); } return transitions; }
[ "public", "static", "Map", "<", "Transition", ",", "Collection", "<", "TileRef", ">", ">", "imports", "(", "Media", "config", ")", "{", "final", "Xml", "root", "=", "new", "Xml", "(", "config", ")", ";", "final", "Collection", "<", "Xml", ">", "nodesTr...
Import all transitions from configuration. @param config The transitions media (must not be <code>null</code>). @return The transitions imported with associated tiles. @throws LionEngineException If unable to read data.
[ "Import", "all", "transitions", "from", "configuration", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/TransitionsConfig.java#L64-L85
morimekta/utils
console-util/src/main/java/net/morimekta/console/terminal/LineBuffer.java
LineBuffer.clearLast
public void clearLast(int N) { if (N < 1) { throw new IllegalArgumentException("Unable to clear " + N + " lines"); } if (N > count()) { throw new IllegalArgumentException("Count: " + N + ", Size: " + count()); } if (N == count()) { clear(); return; } terminal.format("\r%s", CURSOR_ERASE); buffer.remove(buffer.size() - 1); for (int i = 1; i < N; ++i) { terminal.format("%s%s", UP, CURSOR_ERASE); buffer.remove(buffer.size() - 1); } terminal.format("%s\r%s", UP, cursorRight(printableWidth(lastLine()))); }
java
public void clearLast(int N) { if (N < 1) { throw new IllegalArgumentException("Unable to clear " + N + " lines"); } if (N > count()) { throw new IllegalArgumentException("Count: " + N + ", Size: " + count()); } if (N == count()) { clear(); return; } terminal.format("\r%s", CURSOR_ERASE); buffer.remove(buffer.size() - 1); for (int i = 1; i < N; ++i) { terminal.format("%s%s", UP, CURSOR_ERASE); buffer.remove(buffer.size() - 1); } terminal.format("%s\r%s", UP, cursorRight(printableWidth(lastLine()))); }
[ "public", "void", "clearLast", "(", "int", "N", ")", "{", "if", "(", "N", "<", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Unable to clear \"", "+", "N", "+", "\" lines\"", ")", ";", "}", "if", "(", "N", ">", "count", "(", ")",...
Clear the last N lines, and move the cursor to the end of the last remaining line. @param N Number of lines to clear.
[ "Clear", "the", "last", "N", "lines", "and", "move", "the", "cursor", "to", "the", "end", "of", "the", "last", "remaining", "line", "." ]
train
https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/console-util/src/main/java/net/morimekta/console/terminal/LineBuffer.java#L167-L189
tvesalainen/util
util/src/main/java/org/vesalainen/math/Catenary.java
Catenary.aForXAndH
public static double aForXAndH(double x, double h) { return MoreMath.solve( (xx,a)->a*Math.cosh(xx/a)-a, x, h, Double.MIN_VALUE, 100); }
java
public static double aForXAndH(double x, double h) { return MoreMath.solve( (xx,a)->a*Math.cosh(xx/a)-a, x, h, Double.MIN_VALUE, 100); }
[ "public", "static", "double", "aForXAndH", "(", "double", "x", ",", "double", "h", ")", "{", "return", "MoreMath", ".", "solve", "(", "(", "xx", ",", "a", ")", "->", "a", "*", "Math", ".", "cosh", "(", "xx", "/", "a", ")", "-", "a", ",", "x", ...
Returns a for a catenary having height h at x. Height is distance from vertex (a) to y. @param x @param h @return
[ "Returns", "a", "for", "a", "catenary", "having", "height", "h", "at", "x", ".", "Height", "is", "distance", "from", "vertex", "(", "a", ")", "to", "y", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/Catenary.java#L80-L88
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/raid/RaidCodec.java
RaidCodec.checkRaidProgress
public boolean checkRaidProgress(INodeFile sourceINode, LightWeightLinkedSet<RaidBlockInfo> raidEncodingTasks, FSNamesystem fs, boolean forceAdd) throws IOException { boolean result = true; BlockInfo[] blocks = sourceINode.getBlocks(); for (int i = 0; i < blocks.length; i += numStripeBlocks) { boolean hasParity = true; if (!forceAdd) { for (int j = 0; j < numParityBlocks; j++) { if (fs.countLiveNodes(blocks[i + j]) < this.parityReplication) { hasParity = false; break; } } } if (!hasParity || forceAdd) { raidEncodingTasks.add(new RaidBlockInfo(blocks[i], parityReplication, i)); result = false; } } return result; }
java
public boolean checkRaidProgress(INodeFile sourceINode, LightWeightLinkedSet<RaidBlockInfo> raidEncodingTasks, FSNamesystem fs, boolean forceAdd) throws IOException { boolean result = true; BlockInfo[] blocks = sourceINode.getBlocks(); for (int i = 0; i < blocks.length; i += numStripeBlocks) { boolean hasParity = true; if (!forceAdd) { for (int j = 0; j < numParityBlocks; j++) { if (fs.countLiveNodes(blocks[i + j]) < this.parityReplication) { hasParity = false; break; } } } if (!hasParity || forceAdd) { raidEncodingTasks.add(new RaidBlockInfo(blocks[i], parityReplication, i)); result = false; } } return result; }
[ "public", "boolean", "checkRaidProgress", "(", "INodeFile", "sourceINode", ",", "LightWeightLinkedSet", "<", "RaidBlockInfo", ">", "raidEncodingTasks", ",", "FSNamesystem", "fs", ",", "boolean", "forceAdd", ")", "throws", "IOException", "{", "boolean", "result", "=", ...
Count the number of live replicas of each parity block in the raided file If any stripe has not enough parity block replicas, add the stripe to raidEncodingTasks to schedule encoding. If forceAdd is true, we always add the stripe to raidEncodingTasks without checking @param sourceINode @param raidTasks @param fs @param forceAdd @return true if all parity blocks of the file have enough replicas @throws IOException
[ "Count", "the", "number", "of", "live", "replicas", "of", "each", "parity", "block", "in", "the", "raided", "file", "If", "any", "stripe", "has", "not", "enough", "parity", "block", "replicas", "add", "the", "stripe", "to", "raidEncodingTasks", "to", "schedu...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/raid/RaidCodec.java#L421-L443
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java
ImageModerationsImpl.matchUrlInputWithServiceResponseAsync
public Observable<ServiceResponse<MatchResponse>> matchUrlInputWithServiceResponseAsync(String contentType, BodyModelModel imageUrl, MatchUrlInputOptionalParameter matchUrlInputOptionalParameter) { if (this.client.baseUrl() == null) { throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null."); } if (contentType == null) { throw new IllegalArgumentException("Parameter contentType is required and cannot be null."); } if (imageUrl == null) { throw new IllegalArgumentException("Parameter imageUrl is required and cannot be null."); } Validator.validate(imageUrl); final String listId = matchUrlInputOptionalParameter != null ? matchUrlInputOptionalParameter.listId() : null; final Boolean cacheImage = matchUrlInputOptionalParameter != null ? matchUrlInputOptionalParameter.cacheImage() : null; return matchUrlInputWithServiceResponseAsync(contentType, imageUrl, listId, cacheImage); }
java
public Observable<ServiceResponse<MatchResponse>> matchUrlInputWithServiceResponseAsync(String contentType, BodyModelModel imageUrl, MatchUrlInputOptionalParameter matchUrlInputOptionalParameter) { if (this.client.baseUrl() == null) { throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null."); } if (contentType == null) { throw new IllegalArgumentException("Parameter contentType is required and cannot be null."); } if (imageUrl == null) { throw new IllegalArgumentException("Parameter imageUrl is required and cannot be null."); } Validator.validate(imageUrl); final String listId = matchUrlInputOptionalParameter != null ? matchUrlInputOptionalParameter.listId() : null; final Boolean cacheImage = matchUrlInputOptionalParameter != null ? matchUrlInputOptionalParameter.cacheImage() : null; return matchUrlInputWithServiceResponseAsync(contentType, imageUrl, listId, cacheImage); }
[ "public", "Observable", "<", "ServiceResponse", "<", "MatchResponse", ">", ">", "matchUrlInputWithServiceResponseAsync", "(", "String", "contentType", ",", "BodyModelModel", "imageUrl", ",", "MatchUrlInputOptionalParameter", "matchUrlInputOptionalParameter", ")", "{", "if", ...
Fuzzily match an image against one of your custom Image Lists. You can create and manage your custom image lists using &lt;a href="/docs/services/578ff44d2703741568569ab9/operations/578ff7b12703741568569abe"&gt;this&lt;/a&gt; API. Returns ID and tags of matching image.&lt;br/&gt; &lt;br/&gt; Note: Refresh Index must be run on the corresponding Image List before additions and removals are reflected in the response. @param contentType The content type. @param imageUrl The image url. @param matchUrlInputOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the MatchResponse object
[ "Fuzzily", "match", "an", "image", "against", "one", "of", "your", "custom", "Image", "Lists", ".", "You", "can", "create", "and", "manage", "your", "custom", "image", "lists", "using", "&lt", ";", "a", "href", "=", "/", "docs", "/", "services", "/", "...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java#L1807-L1822
netty/netty
codec/src/main/java/io/netty/handler/codec/compression/Snappy.java
Snappy.encodeCopy
private static void encodeCopy(ByteBuf out, int offset, int length) { while (length >= 68) { encodeCopyWithOffset(out, offset, 64); length -= 64; } if (length > 64) { encodeCopyWithOffset(out, offset, 60); length -= 60; } encodeCopyWithOffset(out, offset, length); }
java
private static void encodeCopy(ByteBuf out, int offset, int length) { while (length >= 68) { encodeCopyWithOffset(out, offset, 64); length -= 64; } if (length > 64) { encodeCopyWithOffset(out, offset, 60); length -= 60; } encodeCopyWithOffset(out, offset, length); }
[ "private", "static", "void", "encodeCopy", "(", "ByteBuf", "out", ",", "int", "offset", ",", "int", "length", ")", "{", "while", "(", "length", ">=", "68", ")", "{", "encodeCopyWithOffset", "(", "out", ",", "offset", ",", "64", ")", ";", "length", "-="...
Encodes a series of copies, each at most 64 bytes in length. @param out The output buffer to write the copy pointer to @param offset The offset at which the original instance lies @param length The length of the original instance
[ "Encodes", "a", "series", "of", "copies", "each", "at", "most", "64", "bytes", "in", "length", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Snappy.java#L256-L268
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/DefaultCommandRegistry.java
DefaultCommandRegistry.fireCommandRegistered
protected void fireCommandRegistered(AbstractCommand command) { Assert.notNull(command, "command"); if (commandRegistryListeners.isEmpty()) { return; } CommandRegistryEvent event = new CommandRegistryEvent(this, command); for (Iterator i = commandRegistryListeners.iterator(); i.hasNext();) { ((CommandRegistryListener)i.next()).commandRegistered(event); } }
java
protected void fireCommandRegistered(AbstractCommand command) { Assert.notNull(command, "command"); if (commandRegistryListeners.isEmpty()) { return; } CommandRegistryEvent event = new CommandRegistryEvent(this, command); for (Iterator i = commandRegistryListeners.iterator(); i.hasNext();) { ((CommandRegistryListener)i.next()).commandRegistered(event); } }
[ "protected", "void", "fireCommandRegistered", "(", "AbstractCommand", "command", ")", "{", "Assert", ".", "notNull", "(", "command", ",", "\"command\"", ")", ";", "if", "(", "commandRegistryListeners", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", ...
Fires a 'commandRegistered' {@link CommandRegistryEvent} for the given command to all registered listeners. @param command The command that has been registered. Must not be null. @throws IllegalArgumentException if {@code command} is null.
[ "Fires", "a", "commandRegistered", "{", "@link", "CommandRegistryEvent", "}", "for", "the", "given", "command", "to", "all", "registered", "listeners", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/DefaultCommandRegistry.java#L215-L229
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_service_serviceName_changeOfBillingAccount_POST
public void billingAccount_service_serviceName_changeOfBillingAccount_POST(String billingAccount, String serviceName, String billingAccountDestination) throws IOException { String qPath = "/telephony/{billingAccount}/service/{serviceName}/changeOfBillingAccount"; StringBuilder sb = path(qPath, billingAccount, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "billingAccountDestination", billingAccountDestination); exec(qPath, "POST", sb.toString(), o); }
java
public void billingAccount_service_serviceName_changeOfBillingAccount_POST(String billingAccount, String serviceName, String billingAccountDestination) throws IOException { String qPath = "/telephony/{billingAccount}/service/{serviceName}/changeOfBillingAccount"; StringBuilder sb = path(qPath, billingAccount, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "billingAccountDestination", billingAccountDestination); exec(qPath, "POST", sb.toString(), o); }
[ "public", "void", "billingAccount_service_serviceName_changeOfBillingAccount_POST", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "String", "billingAccountDestination", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccoun...
Move a service of billing account. Source and destination nics should be the same. REST: POST /telephony/{billingAccount}/service/{serviceName}/changeOfBillingAccount @param billingAccountDestination [required] Billing account destination target @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Move", "a", "service", "of", "billing", "account", ".", "Source", "and", "destination", "nics", "should", "be", "the", "same", "." ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3705-L3711
codegist/crest
core/src/main/java/org/codegist/crest/CRest.java
CRest.getOAuthInstance
public static CRest getOAuthInstance(String consumerKey, String consumerSecret, String accessToken, String accessTokenSecret, String sessionHandle, String accessTokenRefreshUrl) { return oauth(consumerKey, consumerSecret, accessToken, accessTokenSecret, sessionHandle, accessTokenRefreshUrl).build(); }
java
public static CRest getOAuthInstance(String consumerKey, String consumerSecret, String accessToken, String accessTokenSecret, String sessionHandle, String accessTokenRefreshUrl) { return oauth(consumerKey, consumerSecret, accessToken, accessTokenSecret, sessionHandle, accessTokenRefreshUrl).build(); }
[ "public", "static", "CRest", "getOAuthInstance", "(", "String", "consumerKey", ",", "String", "consumerSecret", ",", "String", "accessToken", ",", "String", "accessTokenSecret", ",", "String", "sessionHandle", ",", "String", "accessTokenRefreshUrl", ")", "{", "return"...
<p>Build a <b>CRest</b> instance that authenticate all request using OAuth.</p> @param consumerKey consumer key to use @param consumerSecret consumer secret to use @param accessToken access token to use @param accessTokenSecret access token secret to use @param sessionHandle session handle to use to refresh an expired access token @param accessTokenRefreshUrl url to use to refresh an expired access token @return a <b>CRest</b> instance @see org.codegist.crest.CRestBuilder#oauth(String, String, String, String, String, String)
[ "<p", ">", "Build", "a", "<b", ">", "CRest<", "/", "b", ">", "instance", "that", "authenticate", "all", "request", "using", "OAuth", ".", "<", "/", "p", ">" ]
train
https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/CRest.java#L115-L117
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/chains/EndPointMgrImpl.java
EndPointMgrImpl.updateEndpointMBean
private EndPointInfoImpl updateEndpointMBean(String name, String host, int port) { EndPointInfoImpl existingEP = endpoints.get(name); existingEP.updateHost(host); existingEP.updatePort(port); return existingEP; }
java
private EndPointInfoImpl updateEndpointMBean(String name, String host, int port) { EndPointInfoImpl existingEP = endpoints.get(name); existingEP.updateHost(host); existingEP.updatePort(port); return existingEP; }
[ "private", "EndPointInfoImpl", "updateEndpointMBean", "(", "String", "name", ",", "String", "host", ",", "int", "port", ")", "{", "EndPointInfoImpl", "existingEP", "=", "endpoints", ".", "get", "(", "name", ")", ";", "existingEP", ".", "updateHost", "(", "host...
Update an existing endpoint MBean, which will emit change notifications. @param name The name of the EndPoint which was updated @param host The current host value (may or may not have changed) @param port The current port value (may or may not have changed)
[ "Update", "an", "existing", "endpoint", "MBean", "which", "will", "emit", "change", "notifications", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/chains/EndPointMgrImpl.java#L145-L150
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java
ClassUtil.getClassName
public static String getClassName(Class<?> clazz, boolean isSimple) { if (null == clazz) { return null; } return isSimple ? clazz.getSimpleName() : clazz.getName(); }
java
public static String getClassName(Class<?> clazz, boolean isSimple) { if (null == clazz) { return null; } return isSimple ? clazz.getSimpleName() : clazz.getName(); }
[ "public", "static", "String", "getClassName", "(", "Class", "<", "?", ">", "clazz", ",", "boolean", "isSimple", ")", "{", "if", "(", "null", "==", "clazz", ")", "{", "return", "null", ";", "}", "return", "isSimple", "?", "clazz", ".", "getSimpleName", ...
获取类名<br> 类名并不包含“.class”这个扩展名<br> 例如:ClassUtil这个类<br> <pre> isSimple为false: "com.xiaoleilu.hutool.util.ClassUtil" isSimple为true: "ClassUtil" </pre> @param clazz 类 @param isSimple 是否简单类名,如果为true,返回不带包名的类名 @return 类名 @since 3.0.7
[ "获取类名<br", ">", "类名并不包含“", ".", "class”这个扩展名<br", ">", "例如:ClassUtil这个类<br", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L104-L109
LearnLib/automatalib
util/src/main/java/net/automatalib/util/automata/minimizer/hopcroft/HopcroftMinimization.java
HopcroftMinimization.minimizeDFA
public static <S, I, A extends DFA<S, I> & InputAlphabetHolder<I>> CompactDFA<I> minimizeDFA(A dfa, PruningMode pruningMode) { return doMinimizeDFA(dfa, dfa.getInputAlphabet(), new CompactDFA.Creator<>(), pruningMode); }
java
public static <S, I, A extends DFA<S, I> & InputAlphabetHolder<I>> CompactDFA<I> minimizeDFA(A dfa, PruningMode pruningMode) { return doMinimizeDFA(dfa, dfa.getInputAlphabet(), new CompactDFA.Creator<>(), pruningMode); }
[ "public", "static", "<", "S", ",", "I", ",", "A", "extends", "DFA", "<", "S", ",", "I", ">", "&", "InputAlphabetHolder", "<", "I", ">", ">", "CompactDFA", "<", "I", ">", "minimizeDFA", "(", "A", "dfa", ",", "PruningMode", "pruningMode", ")", "{", "...
Minimizes the given DFA. The result is returned in the form of a {@link CompactDFA}, using the input alphabet obtained via <code>dfa.{@link InputAlphabetHolder#getInputAlphabet() getInputAlphabet()}</code>. @param dfa the DFA to minimize @param pruningMode the pruning mode (see above) @return a minimized version of the specified DFA
[ "Minimizes", "the", "given", "DFA", ".", "The", "result", "is", "returned", "in", "the", "form", "of", "a", "{", "@link", "CompactDFA", "}", "using", "the", "input", "alphabet", "obtained", "via", "<code", ">", "dfa", ".", "{", "@link", "InputAlphabetHolde...
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/automata/minimizer/hopcroft/HopcroftMinimization.java#L205-L208
lessthanoptimal/ejml
main/ejml-core/src/org/ejml/ops/MatrixFeatures_D.java
MatrixFeatures_D.isIdentical
public static boolean isIdentical(DMatrix a, DMatrix b , double tol ) { if( a.getNumRows() != b.getNumRows() || a.getNumCols() != b.getNumCols() ) { return false; } if( tol < 0 ) throw new IllegalArgumentException("Tolerance must be greater than or equal to zero."); final int numRows = a.getNumRows(); final int numCols = a.getNumCols(); for (int row = 0; row < numRows; row++) { for (int col = 0; col < numCols; col++) { if( !UtilEjml.isIdentical(a.unsafe_get(row,col),b.unsafe_get(row,col), tol)) return false; } } return true; }
java
public static boolean isIdentical(DMatrix a, DMatrix b , double tol ) { if( a.getNumRows() != b.getNumRows() || a.getNumCols() != b.getNumCols() ) { return false; } if( tol < 0 ) throw new IllegalArgumentException("Tolerance must be greater than or equal to zero."); final int numRows = a.getNumRows(); final int numCols = a.getNumCols(); for (int row = 0; row < numRows; row++) { for (int col = 0; col < numCols; col++) { if( !UtilEjml.isIdentical(a.unsafe_get(row,col),b.unsafe_get(row,col), tol)) return false; } } return true; }
[ "public", "static", "boolean", "isIdentical", "(", "DMatrix", "a", ",", "DMatrix", "b", ",", "double", "tol", ")", "{", "if", "(", "a", ".", "getNumRows", "(", ")", "!=", "b", ".", "getNumRows", "(", ")", "||", "a", ".", "getNumCols", "(", ")", "!=...
<p> Checks to see if each corresponding element in the two matrices are within tolerance of each other or have the some symbolic meaning. This can handle NaN and Infinite numbers. <p> <p> If both elements are countable then the following equality test is used:<br> |a<sub>ij</sub> - b<sub>ij</sub>| &le; tol.<br> Otherwise both numbers must both be Double.NaN, Double.POSITIVE_INFINITY, or Double.NEGATIVE_INFINITY to be identical. </p> @param a A matrix. Not modified. @param b A matrix. Not modified. @param tol Tolerance for equality. @return true if identical and false otherwise.
[ "<p", ">", "Checks", "to", "see", "if", "each", "corresponding", "element", "in", "the", "two", "matrices", "are", "within", "tolerance", "of", "each", "other", "or", "have", "the", "some", "symbolic", "meaning", ".", "This", "can", "handle", "NaN", "and",...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/ops/MatrixFeatures_D.java#L81-L98
hawkular/hawkular-inventory
hawkular-inventory-api/src/main/java/org/hawkular/inventory/api/Configuration.java
Configuration.prefixedWith
public Configuration prefixedWith(String... prefixes) { if (prefixes == null || prefixes.length == 0) { return this; } Map<String, String> filteredConfig = implementationConfiguration.entrySet().stream() .filter(e -> Arrays.stream(prefixes).anyMatch(p -> e.getKey() .startsWith(p))).collect(toMap(Map.Entry::getKey, Map.Entry::getValue)); return new Configuration(feedIdStrategy, resultFilter, filteredConfig); }
java
public Configuration prefixedWith(String... prefixes) { if (prefixes == null || prefixes.length == 0) { return this; } Map<String, String> filteredConfig = implementationConfiguration.entrySet().stream() .filter(e -> Arrays.stream(prefixes).anyMatch(p -> e.getKey() .startsWith(p))).collect(toMap(Map.Entry::getKey, Map.Entry::getValue)); return new Configuration(feedIdStrategy, resultFilter, filteredConfig); }
[ "public", "Configuration", "prefixedWith", "(", "String", "...", "prefixes", ")", "{", "if", "(", "prefixes", "==", "null", "||", "prefixes", ".", "length", "==", "0", ")", "{", "return", "this", ";", "}", "Map", "<", "String", ",", "String", ">", "fil...
Filters out all the configuration entries whose keys don't start with any of the white-listed prefixes @param prefixes @return
[ "Filters", "out", "all", "the", "configuration", "entries", "whose", "keys", "don", "t", "start", "with", "any", "of", "the", "white", "-", "listed", "prefixes" ]
train
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-api/src/main/java/org/hawkular/inventory/api/Configuration.java#L121-L129
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teaservlet/TeaServlet.java
TeaServlet.doGet
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (processStatus(request, response)) { return; } if (!isRunning()) { int errorCode = mProperties.getInt("startup.codes.error", 503); response.sendError(errorCode); return; } if (mUseSpiderableRequest) { request = new SpiderableRequest(request, mQuerySeparator, mParameterSeparator, mValueSeparator); } // start transaction TeaServletTransaction tsTrans = getEngine().createTransaction(request, response, true); // load associated request/response ApplicationRequest appRequest = tsTrans.getRequest(); ApplicationResponse appResponse = tsTrans.getResponse(); // process template processTemplate(appRequest, appResponse); appResponse.finish(); // flush the output response.flushBuffer(); }
java
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (processStatus(request, response)) { return; } if (!isRunning()) { int errorCode = mProperties.getInt("startup.codes.error", 503); response.sendError(errorCode); return; } if (mUseSpiderableRequest) { request = new SpiderableRequest(request, mQuerySeparator, mParameterSeparator, mValueSeparator); } // start transaction TeaServletTransaction tsTrans = getEngine().createTransaction(request, response, true); // load associated request/response ApplicationRequest appRequest = tsTrans.getRequest(); ApplicationResponse appResponse = tsTrans.getResponse(); // process template processTemplate(appRequest, appResponse); appResponse.finish(); // flush the output response.flushBuffer(); }
[ "protected", "void", "doGet", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "ServletException", ",", "IOException", "{", "if", "(", "processStatus", "(", "request", ",", "response", ")", ")", "{", "return", ";", "}"...
Process the user's http get request. Process the template that maps to the URI that was hit. @param request the user's http request @param response the user's http response
[ "Process", "the", "user", "s", "http", "get", "request", ".", "Process", "the", "template", "that", "maps", "to", "the", "URI", "that", "was", "hit", "." ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teaservlet/TeaServlet.java#L458-L493
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/TreeDependencyScanner.java
TreeDependencyScanner.visitClass
@Override public Void visitClass(ClassTree node, Set<String> p) { scan(node.getModifiers(), p); scan(node.getTypeParameters(), p); scan(node.getExtendsClause(), p); scan(node.getImplementsClause(), p); scan(node.getMembers(), body); return null; }
java
@Override public Void visitClass(ClassTree node, Set<String> p) { scan(node.getModifiers(), p); scan(node.getTypeParameters(), p); scan(node.getExtendsClause(), p); scan(node.getImplementsClause(), p); scan(node.getMembers(), body); return null; }
[ "@", "Override", "public", "Void", "visitClass", "(", "ClassTree", "node", ",", "Set", "<", "String", ">", "p", ")", "{", "scan", "(", "node", ".", "getModifiers", "(", ")", ",", "p", ")", ";", "scan", "(", "node", ".", "getTypeParameters", "(", ")",...
-- Differentiate declaration references from body references ---
[ "--", "Differentiate", "declaration", "references", "from", "body", "references", "---" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/TreeDependencyScanner.java#L68-L76
meltmedia/cadmium
email/src/main/java/com/meltmedia/cadmium/email/EmailUtil.java
EmailUtil.newAttachmentBodyPart
public static MimeBodyPart newAttachmentBodyPart( URL contentUrl, String contentId ) throws MessagingException { MimeBodyPart mimeBodyPart = new MimeBodyPart(); mimeBodyPart.setDataHandler(new DataHandler(contentUrl)); if( contentId != null ) { mimeBodyPart.setHeader("Content-ID", contentId); } mimeBodyPart.setDisposition(DISPOSITION_ATTACHMENT); String fileName = fileNameForUrl(contentUrl); if( fileName != null ) { mimeBodyPart.setFileName(fileName); } return mimeBodyPart; }
java
public static MimeBodyPart newAttachmentBodyPart( URL contentUrl, String contentId ) throws MessagingException { MimeBodyPart mimeBodyPart = new MimeBodyPart(); mimeBodyPart.setDataHandler(new DataHandler(contentUrl)); if( contentId != null ) { mimeBodyPart.setHeader("Content-ID", contentId); } mimeBodyPart.setDisposition(DISPOSITION_ATTACHMENT); String fileName = fileNameForUrl(contentUrl); if( fileName != null ) { mimeBodyPart.setFileName(fileName); } return mimeBodyPart; }
[ "public", "static", "MimeBodyPart", "newAttachmentBodyPart", "(", "URL", "contentUrl", ",", "String", "contentId", ")", "throws", "MessagingException", "{", "MimeBodyPart", "mimeBodyPart", "=", "new", "MimeBodyPart", "(", ")", ";", "mimeBodyPart", ".", "setDataHandler...
Creates a body part for an attachment that is downloaded by the user.
[ "Creates", "a", "body", "part", "for", "an", "attachment", "that", "is", "downloaded", "by", "the", "user", "." ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/email/src/main/java/com/meltmedia/cadmium/email/EmailUtil.java#L116-L130
looly/hutool
hutool-db/src/main/java/cn/hutool/db/AbstractDb.java
AbstractDb.queryNumber
public Number queryNumber(String sql, Object... params) throws SQLException { return query(sql, new NumberHandler(), params); }
java
public Number queryNumber(String sql, Object... params) throws SQLException { return query(sql, new NumberHandler(), params); }
[ "public", "Number", "queryNumber", "(", "String", "sql", ",", "Object", "...", "params", ")", "throws", "SQLException", "{", "return", "query", "(", "sql", ",", "new", "NumberHandler", "(", ")", ",", "params", ")", ";", "}" ]
查询单条单个字段记录,并将其转换为Number @param sql 查询语句 @param params 参数 @return 结果对象 @throws SQLException SQL执行异常
[ "查询单条单个字段记录", "并将其转换为Number" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L118-L120
junit-team/junit4
src/main/java/org/junit/runner/Description.java
Description.createSuiteDescription
public static Description createSuiteDescription(Class<?> testClass) { return new Description(testClass, testClass.getName(), testClass.getAnnotations()); }
java
public static Description createSuiteDescription(Class<?> testClass) { return new Description(testClass, testClass.getName(), testClass.getAnnotations()); }
[ "public", "static", "Description", "createSuiteDescription", "(", "Class", "<", "?", ">", "testClass", ")", "{", "return", "new", "Description", "(", "testClass", ",", "testClass", ".", "getName", "(", ")", ",", "testClass", ".", "getAnnotations", "(", ")", ...
Create a <code>Description</code> named after <code>testClass</code> @param testClass A {@link Class} containing tests @return a <code>Description</code> of <code>testClass</code>
[ "Create", "a", "<code", ">", "Description<", "/", "code", ">", "named", "after", "<code", ">", "testClass<", "/", "code", ">" ]
train
https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/runner/Description.java#L123-L125
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java
ICUService.getKey
public Object getKey(Key key, String[] actualReturn) { return getKey(key, actualReturn, null); }
java
public Object getKey(Key key, String[] actualReturn) { return getKey(key, actualReturn, null); }
[ "public", "Object", "getKey", "(", "Key", "key", ",", "String", "[", "]", "actualReturn", ")", "{", "return", "getKey", "(", "key", ",", "actualReturn", ",", "null", ")", ";", "}" ]
<p>Given a key, return a service object, and, if actualReturn is not null, the descriptor with which it was found in the first element of actualReturn. If no service object matches this key, return null, and leave actualReturn unchanged.</p> <p>This queries the cache using the key's descriptor, and if no object in the cache matches it, tries the key on each registered factory, in order. If none generates a service object for the key, repeats the process with each fallback of the key, until either one returns a service object, or the key has no fallback.</p> <p>If key is null, just returns null.</p>
[ "<p", ">", "Given", "a", "key", "return", "a", "service", "object", "and", "if", "actualReturn", "is", "not", "null", "the", "descriptor", "with", "which", "it", "was", "found", "in", "the", "first", "element", "of", "actualReturn", ".", "If", "no", "ser...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java#L388-L390
vznet/mongo-jackson-mapper
src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java
JacksonDBCollection.createIndex
public void createIndex(DBObject keys, DBObject options) throws MongoException { dbCollection.createIndex(keys, options); }
java
public void createIndex(DBObject keys, DBObject options) throws MongoException { dbCollection.createIndex(keys, options); }
[ "public", "void", "createIndex", "(", "DBObject", "keys", ",", "DBObject", "options", ")", "throws", "MongoException", "{", "dbCollection", ".", "createIndex", "(", "keys", ",", "options", ")", ";", "}" ]
Forces creation of an index on a set of fields, if one does not already exist. @param keys The keys to index @param options The options @throws MongoException If an error occurred
[ "Forces", "creation", "of", "an", "index", "on", "a", "set", "of", "fields", "if", "one", "does", "not", "already", "exist", "." ]
train
https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java#L680-L682
algolia/instantsearch-android
core/src/main/java/com/algolia/instantsearch/core/helpers/Searcher.java
Searcher.loadMore
@NonNull public Searcher loadMore() { if (!hasMoreHits()) { return this; } query.setPage(++lastRequestPage); final int currentRequestId = ++lastRequestId; EventBus.getDefault().post(new SearchEvent(this, query, currentRequestId)); pendingRequests.put(currentRequestId, triggerSearch(new CompletionHandler() { @Override public void requestCompleted(@NonNull JSONObject content, @Nullable AlgoliaException error) { pendingRequests.remove(currentRequestId); if (error != null) { postError(error, currentRequestId); } else { if (currentRequestId <= lastResponseId) { return; // Hits are for an older query, let's ignore them } if (hasHits(content)) { updateListeners(content, true); updateFacetStats(content); lastResponsePage = lastRequestPage; checkIfLastPage(content); } else { endReached = true; } EventBus.getDefault().post(new ResultEvent(Searcher.this, content, query, currentRequestId)); } } })); return this; }
java
@NonNull public Searcher loadMore() { if (!hasMoreHits()) { return this; } query.setPage(++lastRequestPage); final int currentRequestId = ++lastRequestId; EventBus.getDefault().post(new SearchEvent(this, query, currentRequestId)); pendingRequests.put(currentRequestId, triggerSearch(new CompletionHandler() { @Override public void requestCompleted(@NonNull JSONObject content, @Nullable AlgoliaException error) { pendingRequests.remove(currentRequestId); if (error != null) { postError(error, currentRequestId); } else { if (currentRequestId <= lastResponseId) { return; // Hits are for an older query, let's ignore them } if (hasHits(content)) { updateListeners(content, true); updateFacetStats(content); lastResponsePage = lastRequestPage; checkIfLastPage(content); } else { endReached = true; } EventBus.getDefault().post(new ResultEvent(Searcher.this, content, query, currentRequestId)); } } })); return this; }
[ "@", "NonNull", "public", "Searcher", "loadMore", "(", ")", "{", "if", "(", "!", "hasMoreHits", "(", ")", ")", "{", "return", "this", ";", "}", "query", ".", "setPage", "(", "++", "lastRequestPage", ")", ";", "final", "int", "currentRequestId", "=", "+...
Loads more results with the same query. <p> Note that this method won't do anything if {@link Searcher#hasMoreHits} returns false. @return this {@link Searcher} for chaining.
[ "Loads", "more", "results", "with", "the", "same", "query", ".", "<p", ">", "Note", "that", "this", "method", "won", "t", "do", "anything", "if", "{", "@link", "Searcher#hasMoreHits", "}", "returns", "false", "." ]
train
https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/core/src/main/java/com/algolia/instantsearch/core/helpers/Searcher.java#L404-L437
elki-project/elki
elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/Itemset.java
Itemset.appendTo
public final StringBuilder appendTo(StringBuilder buf, VectorFieldTypeInformation<BitVector> meta) { appendItemsTo(buf, meta); return buf.append(": ").append(support); }
java
public final StringBuilder appendTo(StringBuilder buf, VectorFieldTypeInformation<BitVector> meta) { appendItemsTo(buf, meta); return buf.append(": ").append(support); }
[ "public", "final", "StringBuilder", "appendTo", "(", "StringBuilder", "buf", ",", "VectorFieldTypeInformation", "<", "BitVector", ">", "meta", ")", "{", "appendItemsTo", "(", "buf", ",", "meta", ")", ";", "return", "buf", ".", "append", "(", "\": \"", ")", "...
Append items and support to a string buffer. @param buf Buffer @param meta Relation metadata (for labels) @return String buffer for chaining.
[ "Append", "items", "and", "support", "to", "a", "string", "buffer", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/Itemset.java#L223-L226
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java
HashCodeBuilder.reflectionHashCode
@GwtIncompatible("incompatible method") public static int reflectionHashCode(final int initialNonZeroOddNumber, final int multiplierNonZeroOddNumber, final Object object) { return reflectionHashCode(initialNonZeroOddNumber, multiplierNonZeroOddNumber, object, false, null); }
java
@GwtIncompatible("incompatible method") public static int reflectionHashCode(final int initialNonZeroOddNumber, final int multiplierNonZeroOddNumber, final Object object) { return reflectionHashCode(initialNonZeroOddNumber, multiplierNonZeroOddNumber, object, false, null); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "int", "reflectionHashCode", "(", "final", "int", "initialNonZeroOddNumber", ",", "final", "int", "multiplierNonZeroOddNumber", ",", "final", "Object", "object", ")", "{", "return", "refl...
<p> Uses reflection to build a valid hash code from the fields of {@code object}. </p> <p> It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will throw a security exception if run under a security manager, if the permissions are not set up correctly. It is also not as efficient as testing explicitly. </p> <p> Transient members will be not be used, as they are likely derived fields, and not part of the value of the <code>Object</code>. </p> <p> Static fields will not be tested. Superclass fields will be included. </p> <p> Two randomly chosen, non-zero, odd numbers must be passed in. Ideally these should be different for each class, however this is not vital. Prime numbers are preferred, especially for the multiplier. </p> @param initialNonZeroOddNumber a non-zero, odd number used as the initial value. This will be the returned value if no fields are found to include in the hash code @param multiplierNonZeroOddNumber a non-zero, odd number used as the multiplier @param object the Object to create a <code>hashCode</code> for @return int hash code @throws IllegalArgumentException if the Object is <code>null</code> @throws IllegalArgumentException if the number is zero or even @see HashCodeExclude
[ "<p", ">", "Uses", "reflection", "to", "build", "a", "valid", "hash", "code", "from", "the", "fields", "of", "{", "@code", "object", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java#L260-L263
haifengl/smile
core/src/main/java/smile/classification/NeuralNetwork.java
NeuralNetwork.getOutput
private void getOutput(double[] y) { if (y.length != outputLayer.units) { throw new IllegalArgumentException(String.format("Invalid output vector size: %d, expected: %d", y.length, outputLayer.units)); } System.arraycopy(outputLayer.output, 0, y, 0, outputLayer.units); }
java
private void getOutput(double[] y) { if (y.length != outputLayer.units) { throw new IllegalArgumentException(String.format("Invalid output vector size: %d, expected: %d", y.length, outputLayer.units)); } System.arraycopy(outputLayer.output, 0, y, 0, outputLayer.units); }
[ "private", "void", "getOutput", "(", "double", "[", "]", "y", ")", "{", "if", "(", "y", ".", "length", "!=", "outputLayer", ".", "units", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"Invalid output vector size: ...
Returns the output vector into the given array. @param y the output vector.
[ "Returns", "the", "output", "vector", "into", "the", "given", "array", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/classification/NeuralNetwork.java#L608-L613
apache/flink
flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/KinesisDataFetcher.java
KinesisDataFetcher.registerShardMetrics
private static ShardMetricsReporter registerShardMetrics(MetricGroup metricGroup, KinesisStreamShardState shardState) { ShardMetricsReporter shardMetrics = new ShardMetricsReporter(); MetricGroup streamShardMetricGroup = metricGroup .addGroup( KinesisConsumerMetricConstants.STREAM_METRICS_GROUP, shardState.getStreamShardHandle().getStreamName()) .addGroup( KinesisConsumerMetricConstants.SHARD_METRICS_GROUP, shardState.getStreamShardHandle().getShard().getShardId()); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.MILLIS_BEHIND_LATEST_GAUGE, shardMetrics::getMillisBehindLatest); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.MAX_RECORDS_PER_FETCH, shardMetrics::getMaxNumberOfRecordsPerFetch); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.NUM_AGGREGATED_RECORDS_PER_FETCH, shardMetrics::getNumberOfAggregatedRecords); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.NUM_DEAGGREGATED_RECORDS_PER_FETCH, shardMetrics::getNumberOfDeaggregatedRecords); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.AVG_RECORD_SIZE_BYTES, shardMetrics::getAverageRecordSizeBytes); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.BYTES_PER_READ, shardMetrics::getBytesPerRead); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.RUNTIME_LOOP_NANOS, shardMetrics::getRunLoopTimeNanos); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.LOOP_FREQUENCY_HZ, shardMetrics::getLoopFrequencyHz); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.SLEEP_TIME_MILLIS, shardMetrics::getSleepTimeMillis); return shardMetrics; }
java
private static ShardMetricsReporter registerShardMetrics(MetricGroup metricGroup, KinesisStreamShardState shardState) { ShardMetricsReporter shardMetrics = new ShardMetricsReporter(); MetricGroup streamShardMetricGroup = metricGroup .addGroup( KinesisConsumerMetricConstants.STREAM_METRICS_GROUP, shardState.getStreamShardHandle().getStreamName()) .addGroup( KinesisConsumerMetricConstants.SHARD_METRICS_GROUP, shardState.getStreamShardHandle().getShard().getShardId()); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.MILLIS_BEHIND_LATEST_GAUGE, shardMetrics::getMillisBehindLatest); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.MAX_RECORDS_PER_FETCH, shardMetrics::getMaxNumberOfRecordsPerFetch); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.NUM_AGGREGATED_RECORDS_PER_FETCH, shardMetrics::getNumberOfAggregatedRecords); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.NUM_DEAGGREGATED_RECORDS_PER_FETCH, shardMetrics::getNumberOfDeaggregatedRecords); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.AVG_RECORD_SIZE_BYTES, shardMetrics::getAverageRecordSizeBytes); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.BYTES_PER_READ, shardMetrics::getBytesPerRead); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.RUNTIME_LOOP_NANOS, shardMetrics::getRunLoopTimeNanos); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.LOOP_FREQUENCY_HZ, shardMetrics::getLoopFrequencyHz); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.SLEEP_TIME_MILLIS, shardMetrics::getSleepTimeMillis); return shardMetrics; }
[ "private", "static", "ShardMetricsReporter", "registerShardMetrics", "(", "MetricGroup", "metricGroup", ",", "KinesisStreamShardState", "shardState", ")", "{", "ShardMetricsReporter", "shardMetrics", "=", "new", "ShardMetricsReporter", "(", ")", ";", "MetricGroup", "streamS...
Registers a metric group associated with the shard id of the provided {@link KinesisStreamShardState shardState}. @return a {@link ShardMetricsReporter} that can be used to update metric values
[ "Registers", "a", "metric", "group", "associated", "with", "the", "shard", "id", "of", "the", "provided", "{", "@link", "KinesisStreamShardState", "shardState", "}", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/KinesisDataFetcher.java#L793-L814
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/MapsInner.java
MapsInner.createOrUpdate
public IntegrationAccountMapInner createOrUpdate(String resourceGroupName, String integrationAccountName, String mapName, IntegrationAccountMapInner map) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, mapName, map).toBlocking().single().body(); }
java
public IntegrationAccountMapInner createOrUpdate(String resourceGroupName, String integrationAccountName, String mapName, IntegrationAccountMapInner map) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, mapName, map).toBlocking().single().body(); }
[ "public", "IntegrationAccountMapInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "integrationAccountName", ",", "String", "mapName", ",", "IntegrationAccountMapInner", "map", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resou...
Creates or updates an integration account map. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param mapName The integration account map name. @param map The integration account map. @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 IntegrationAccountMapInner object if successful.
[ "Creates", "or", "updates", "an", "integration", "account", "map", "." ]
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/MapsInner.java#L448-L450
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/dynamic/support/ReflectionUtils.java
ReflectionUtils.invokeMethod
public static Object invokeMethod(Method method, Object target, Object... args) { try { return method.invoke(target, args); } catch (Exception ex) { handleReflectionException(ex); } throw new IllegalStateException("Should never get here"); }
java
public static Object invokeMethod(Method method, Object target, Object... args) { try { return method.invoke(target, args); } catch (Exception ex) { handleReflectionException(ex); } throw new IllegalStateException("Should never get here"); }
[ "public", "static", "Object", "invokeMethod", "(", "Method", "method", ",", "Object", "target", ",", "Object", "...", "args", ")", "{", "try", "{", "return", "method", ".", "invoke", "(", "target", ",", "args", ")", ";", "}", "catch", "(", "Exception", ...
Invoke the specified {@link Method} against the supplied target object with the supplied arguments. The target object can be {@code null} when invoking a static {@link Method}. <p> Thrown exceptions are handled via a call to {@link #handleReflectionException}. @param method the method to invoke @param target the target object to invoke the method on @param args the invocation arguments (may be {@code null}) @return the invocation result, if any
[ "Invoke", "the", "specified", "{", "@link", "Method", "}", "against", "the", "supplied", "target", "object", "with", "the", "supplied", "arguments", ".", "The", "target", "object", "can", "be", "{", "@code", "null", "}", "when", "invoking", "a", "static", ...
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/dynamic/support/ReflectionUtils.java#L122-L129
google/flatbuffers
java/com/google/flatbuffers/Table.java
Table.__has_identifier
protected static boolean __has_identifier(ByteBuffer bb, String ident) { if (ident.length() != FILE_IDENTIFIER_LENGTH) throw new AssertionError("FlatBuffers: file identifier must be length " + FILE_IDENTIFIER_LENGTH); for (int i = 0; i < FILE_IDENTIFIER_LENGTH; i++) { if (ident.charAt(i) != (char)bb.get(bb.position() + SIZEOF_INT + i)) return false; } return true; }
java
protected static boolean __has_identifier(ByteBuffer bb, String ident) { if (ident.length() != FILE_IDENTIFIER_LENGTH) throw new AssertionError("FlatBuffers: file identifier must be length " + FILE_IDENTIFIER_LENGTH); for (int i = 0; i < FILE_IDENTIFIER_LENGTH; i++) { if (ident.charAt(i) != (char)bb.get(bb.position() + SIZEOF_INT + i)) return false; } return true; }
[ "protected", "static", "boolean", "__has_identifier", "(", "ByteBuffer", "bb", ",", "String", "ident", ")", "{", "if", "(", "ident", ".", "length", "(", ")", "!=", "FILE_IDENTIFIER_LENGTH", ")", "throw", "new", "AssertionError", "(", "\"FlatBuffers: file identifie...
Check if a {@link ByteBuffer} contains a file identifier. @param bb A {@code ByteBuffer} to check if it contains the identifier `ident`. @param ident A `String` identifier of the FlatBuffer file. @return True if the buffer contains the file identifier
[ "Check", "if", "a", "{", "@link", "ByteBuffer", "}", "contains", "a", "file", "identifier", "." ]
train
https://github.com/google/flatbuffers/blob/6cc30b3272d79c85db7d4871ac0aa69541dc89de/java/com/google/flatbuffers/Table.java#L188-L196
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java
ArrayFunctions.arrayPut
public static Expression arrayPut(String expression, Expression value) { return arrayPut(x(expression), value); }
java
public static Expression arrayPut(String expression, Expression value) { return arrayPut(x(expression), value); }
[ "public", "static", "Expression", "arrayPut", "(", "String", "expression", ",", "Expression", "value", ")", "{", "return", "arrayPut", "(", "x", "(", "expression", ")", ",", "value", ")", ";", "}" ]
Returned expression results in new array with value appended, if value is not already present, otherwise the unmodified input array.
[ "Returned", "expression", "results", "in", "new", "array", "with", "value", "appended", "if", "value", "is", "not", "already", "present", "otherwise", "the", "unmodified", "input", "array", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java#L312-L314
apache/groovy
src/main/groovy/groovy/util/FactoryBuilderSupport.java
FactoryBuilderSupport.createNode
protected Object createNode(Object name, Map attributes, Object value) { Object node; Factory factory = getProxyBuilder().resolveFactory(name, attributes, value); if (factory == null) { LOG.log(Level.WARNING, "Could not find match for name '" + name + "'"); throw new MissingMethodExceptionNoStack((String) name, Object.class, new Object[]{attributes, value}); //return null; } getProxyBuilder().getContext().put(CURRENT_FACTORY, factory); getProxyBuilder().getContext().put(CURRENT_NAME, String.valueOf(name)); getProxyBuilder().preInstantiate(name, attributes, value); try { node = factory.newInstance(getProxyBuilder().getChildBuilder(), name, value, attributes); if (node == null) { LOG.log(Level.WARNING, "Factory for name '" + name + "' returned null"); return null; } if (LOG.isLoggable(Level.FINE)) { LOG.fine("For name: " + name + " created node: " + node); } } catch (Exception e) { throw new RuntimeException("Failed to create component for '" + name + "' reason: " + e, e); } getProxyBuilder().postInstantiate(name, attributes, node); getProxyBuilder().handleNodeAttributes(node, attributes); return node; }
java
protected Object createNode(Object name, Map attributes, Object value) { Object node; Factory factory = getProxyBuilder().resolveFactory(name, attributes, value); if (factory == null) { LOG.log(Level.WARNING, "Could not find match for name '" + name + "'"); throw new MissingMethodExceptionNoStack((String) name, Object.class, new Object[]{attributes, value}); //return null; } getProxyBuilder().getContext().put(CURRENT_FACTORY, factory); getProxyBuilder().getContext().put(CURRENT_NAME, String.valueOf(name)); getProxyBuilder().preInstantiate(name, attributes, value); try { node = factory.newInstance(getProxyBuilder().getChildBuilder(), name, value, attributes); if (node == null) { LOG.log(Level.WARNING, "Factory for name '" + name + "' returned null"); return null; } if (LOG.isLoggable(Level.FINE)) { LOG.fine("For name: " + name + " created node: " + node); } } catch (Exception e) { throw new RuntimeException("Failed to create component for '" + name + "' reason: " + e, e); } getProxyBuilder().postInstantiate(name, attributes, node); getProxyBuilder().handleNodeAttributes(node, attributes); return node; }
[ "protected", "Object", "createNode", "(", "Object", "name", ",", "Map", "attributes", ",", "Object", "value", ")", "{", "Object", "node", ";", "Factory", "factory", "=", "getProxyBuilder", "(", ")", ".", "resolveFactory", "(", "name", ",", "attributes", ",",...
This method is responsible for instantiating a node and configure its properties. @param name the name of the node @param attributes the attributes for the node @param value the value arguments for the node @return the object return from the factory
[ "This", "method", "is", "responsible", "for", "instantiating", "a", "node", "and", "configure", "its", "properties", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/util/FactoryBuilderSupport.java#L705-L734
linkedin/dexmaker
dexmaker/src/main/java/com/android/dx/Code.java
Code.sput
public <V> void sput(FieldId<?, V> fieldId, Local<? extends V> source) { addInstruction(new ThrowingCstInsn(Rops.opPutStatic(source.type.ropType), sourcePosition, RegisterSpecList.make(source.spec()), catches, fieldId.constant)); }
java
public <V> void sput(FieldId<?, V> fieldId, Local<? extends V> source) { addInstruction(new ThrowingCstInsn(Rops.opPutStatic(source.type.ropType), sourcePosition, RegisterSpecList.make(source.spec()), catches, fieldId.constant)); }
[ "public", "<", "V", ">", "void", "sput", "(", "FieldId", "<", "?", ",", "V", ">", "fieldId", ",", "Local", "<", "?", "extends", "V", ">", "source", ")", "{", "addInstruction", "(", "new", "ThrowingCstInsn", "(", "Rops", ".", "opPutStatic", "(", "sour...
Copies the value in {@code source} to the static field {@code fieldId}.
[ "Copies", "the", "value", "in", "{" ]
train
https://github.com/linkedin/dexmaker/blob/c58ffebcbb2564c7d1fa6fb58b48f351c330296d/dexmaker/src/main/java/com/android/dx/Code.java#L617-L620
Jasig/uPortal
uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/ResourceLoader.java
ResourceLoader.getResourceAsDocument
public static Document getResourceAsDocument(Class<?> requestingClass, String resource) throws ResourceMissingException, IOException, ParserConfigurationException, SAXException { // Default is non-validating... return getResourceAsDocument(requestingClass, resource, false); }
java
public static Document getResourceAsDocument(Class<?> requestingClass, String resource) throws ResourceMissingException, IOException, ParserConfigurationException, SAXException { // Default is non-validating... return getResourceAsDocument(requestingClass, resource, false); }
[ "public", "static", "Document", "getResourceAsDocument", "(", "Class", "<", "?", ">", "requestingClass", ",", "String", "resource", ")", "throws", "ResourceMissingException", ",", "IOException", ",", "ParserConfigurationException", ",", "SAXException", "{", "// Default ...
Get the contents of a URL as an XML Document, first trying to read the Document with validation turned on, and falling back to reading it with validation turned off. @param requestingClass the java.lang.Class object of the class that is attempting to load the resource @param resource a String describing the full or partial URL of the resource whose contents to load @return the actual contents of the resource as an XML Document @throws ResourceMissingException @throws java.io.IOException @throws javax.xml.parsers.ParserConfigurationException @throws org.xml.sax.SAXException
[ "Get", "the", "contents", "of", "a", "URL", "as", "an", "XML", "Document", "first", "trying", "to", "read", "the", "Document", "with", "validation", "turned", "on", "and", "falling", "back", "to", "reading", "it", "with", "validation", "turned", "off", "."...
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/ResourceLoader.java#L293-L299
VoltDB/voltdb
third_party/java/src/org/apache/commons_voltpatches/cli/Options.java
Options.addOption
public Options addOption(String opt, boolean hasArg, String description) { addOption(opt, null, hasArg, description); return this; }
java
public Options addOption(String opt, boolean hasArg, String description) { addOption(opt, null, hasArg, description); return this; }
[ "public", "Options", "addOption", "(", "String", "opt", ",", "boolean", "hasArg", ",", "String", "description", ")", "{", "addOption", "(", "opt", ",", "null", ",", "hasArg", ",", "description", ")", ";", "return", "this", ";", "}" ]
Add an option that only contains a short-name. It may be specified as requiring an argument. @param opt Short single-character name of the option. @param hasArg flag signally if an argument is required after this option @param description Self-documenting description @return the resulting Options instance
[ "Add", "an", "option", "that", "only", "contains", "a", "short", "-", "name", ".", "It", "may", "be", "specified", "as", "requiring", "an", "argument", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/commons_voltpatches/cli/Options.java#L124-L128
groupon/odo
proxylib/src/main/java/com/groupon/odo/proxylib/ScriptService.java
ScriptService.updateName
public Script updateName(int id, String name) throws Exception { PreparedStatement statement = null; try (Connection sqlConnection = SQLService.getInstance().getConnection()) { statement = sqlConnection.prepareStatement( "UPDATE " + Constants.DB_TABLE_SCRIPT + " SET " + Constants.SCRIPT_NAME + " = ? " + " WHERE " + Constants.GENERIC_ID + " = ?" ); statement.setString(1, name); statement.setInt(2, id); statement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } return this.getScript(id); }
java
public Script updateName(int id, String name) throws Exception { PreparedStatement statement = null; try (Connection sqlConnection = SQLService.getInstance().getConnection()) { statement = sqlConnection.prepareStatement( "UPDATE " + Constants.DB_TABLE_SCRIPT + " SET " + Constants.SCRIPT_NAME + " = ? " + " WHERE " + Constants.GENERIC_ID + " = ?" ); statement.setString(1, name); statement.setInt(2, id); statement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } return this.getScript(id); }
[ "public", "Script", "updateName", "(", "int", "id", ",", "String", "name", ")", "throws", "Exception", "{", "PreparedStatement", "statement", "=", "null", ";", "try", "(", "Connection", "sqlConnection", "=", "SQLService", ".", "getInstance", "(", ")", ".", "...
Update the name of a script @param id ID of script @param name new name @return updated script @throws Exception exception
[ "Update", "the", "name", "of", "a", "script" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/ScriptService.java#L218-L242
cdk/cdk
tool/formula/src/main/java/org/openscience/cdk/tools/manipulator/MolecularFormulaManipulator.java
MolecularFormulaManipulator.getElementCount
public static int getElementCount(IMolecularFormula formula, String symbol) { return getElementCount(formula, formula.getBuilder().newInstance(IElement.class, symbol)); }
java
public static int getElementCount(IMolecularFormula formula, String symbol) { return getElementCount(formula, formula.getBuilder().newInstance(IElement.class, symbol)); }
[ "public", "static", "int", "getElementCount", "(", "IMolecularFormula", "formula", ",", "String", "symbol", ")", "{", "return", "getElementCount", "(", "formula", ",", "formula", ".", "getBuilder", "(", ")", ".", "newInstance", "(", "IElement", ".", "class", "...
Occurrences of a given element in a molecular formula. @param formula the formula @param symbol element symbol (e.g. C for carbon) @return number of the times the element occurs @see #getElementCount(IMolecularFormula, IElement)
[ "Occurrences", "of", "a", "given", "element", "in", "a", "molecular", "formula", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/formula/src/main/java/org/openscience/cdk/tools/manipulator/MolecularFormulaManipulator.java#L156-L158
kurbatov/firmata4j
src/main/java/org/firmata4j/ssd1306/MonochromeCanvas.java
MonochromeCanvas.drawImage
public void drawImage(int x, int y, BufferedImage image, boolean opaque, boolean invert) { drawBitmap(x, y, convertToBitmap(image, invert), opaque); }
java
public void drawImage(int x, int y, BufferedImage image, boolean opaque, boolean invert) { drawBitmap(x, y, convertToBitmap(image, invert), opaque); }
[ "public", "void", "drawImage", "(", "int", "x", ",", "int", "y", ",", "BufferedImage", "image", ",", "boolean", "opaque", ",", "boolean", "invert", ")", "{", "drawBitmap", "(", "x", ",", "y", ",", "convertToBitmap", "(", "image", ",", "invert", ")", ",...
Draws an image. The image is grayscalled before drawing. @param x @param y @param image an image to draw @param opaque if true, 0 - bits is drawn in background color, if false - the color of corresponding pixel doesn't change @param invert true to make dark pixels of the image be drawn as bright pixels on screen
[ "Draws", "an", "image", ".", "The", "image", "is", "grayscalled", "before", "drawing", "." ]
train
https://github.com/kurbatov/firmata4j/blob/1bf75cd7f4f8d11dc2a91cf2bc6808f583d9a4ea/src/main/java/org/firmata4j/ssd1306/MonochromeCanvas.java#L566-L568
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/AcroFields.java
AcroFields.regenerateField
public boolean regenerateField(String name) throws IOException, DocumentException { String value = getField(name); return setField(name, value, value); }
java
public boolean regenerateField(String name) throws IOException, DocumentException { String value = getField(name); return setField(name, value, value); }
[ "public", "boolean", "regenerateField", "(", "String", "name", ")", "throws", "IOException", ",", "DocumentException", "{", "String", "value", "=", "getField", "(", "name", ")", ";", "return", "setField", "(", "name", ",", "value", ",", "value", ")", ";", ...
Regenerates the field appearance. This is useful when you change a field property, but not its value, for instance form.setFieldProperty("f", "bgcolor", Color.BLUE, null); This won't have any effect, unless you use regenerateField("f") after changing the property. @param name the fully qualified field name or the partial name in the case of XFA forms @throws IOException on error @throws DocumentException on error @return <CODE>true</CODE> if the field was found and changed, <CODE>false</CODE> otherwise
[ "Regenerates", "the", "field", "appearance", ".", "This", "is", "useful", "when", "you", "change", "a", "field", "property", "but", "not", "its", "value", "for", "instance", "form", ".", "setFieldProperty", "(", "f", "bgcolor", "Color", ".", "BLUE", "null", ...
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/AcroFields.java#L1263-L1266
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/AbstractRenderer.java
AbstractRenderer.setupTransformToFit
void setupTransformToFit(Rectangle2D screenBounds, Rectangle2D modelBounds, boolean reset) { double scale = rendererModel.getParameter(Scale.class).getValue(); if (screenBounds == null) return; setDrawCenter(screenBounds.getCenterX(), screenBounds.getCenterY()); double drawWidth = screenBounds.getWidth(); double drawHeight = screenBounds.getHeight(); double diagramWidth = modelBounds.getWidth() * scale; double diagramHeight = modelBounds.getHeight() * scale; setZoomToFit(drawWidth, drawHeight, diagramWidth, diagramHeight); // this controls whether editing a molecule causes it to re-center // with each change or not if (reset || rendererModel.getParameter(FitToScreen.class).getValue()) { setModelCenter(modelBounds.getCenterX(), modelBounds.getCenterY()); } setup(); }
java
void setupTransformToFit(Rectangle2D screenBounds, Rectangle2D modelBounds, boolean reset) { double scale = rendererModel.getParameter(Scale.class).getValue(); if (screenBounds == null) return; setDrawCenter(screenBounds.getCenterX(), screenBounds.getCenterY()); double drawWidth = screenBounds.getWidth(); double drawHeight = screenBounds.getHeight(); double diagramWidth = modelBounds.getWidth() * scale; double diagramHeight = modelBounds.getHeight() * scale; setZoomToFit(drawWidth, drawHeight, diagramWidth, diagramHeight); // this controls whether editing a molecule causes it to re-center // with each change or not if (reset || rendererModel.getParameter(FitToScreen.class).getValue()) { setModelCenter(modelBounds.getCenterX(), modelBounds.getCenterY()); } setup(); }
[ "void", "setupTransformToFit", "(", "Rectangle2D", "screenBounds", ",", "Rectangle2D", "modelBounds", ",", "boolean", "reset", ")", "{", "double", "scale", "=", "rendererModel", ".", "getParameter", "(", "Scale", ".", "class", ")", ".", "getValue", "(", ")", "...
Sets the transformation needed to draw the model on the canvas when the diagram needs to fit the screen. @param screenBounds the bounding box of the draw area @param modelBounds the bounding box of the model @param reset if true, model center will be set to the modelBounds center and the scale will be re-calculated
[ "Sets", "the", "transformation", "needed", "to", "draw", "the", "model", "on", "the", "canvas", "when", "the", "diagram", "needs", "to", "fit", "the", "screen", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/AbstractRenderer.java#L448-L471
alkacon/opencms-core
src/org/opencms/ui/CmsUserIconHelper.java
CmsUserIconHelper.handleImageUpload
public boolean handleImageUpload(CmsObject cms, CmsUser user, String uploadedFile) { boolean result = false; try { setUserImage(cms, user, uploadedFile); result = true; } catch (CmsException e) { LOG.error("Error setting user image.", e); } try { cms.lockResource(uploadedFile); cms.deleteResource(uploadedFile, CmsResource.DELETE_REMOVE_SIBLINGS); } catch (CmsException e) { LOG.error("Error deleting user image temp file.", e); } return result; }
java
public boolean handleImageUpload(CmsObject cms, CmsUser user, String uploadedFile) { boolean result = false; try { setUserImage(cms, user, uploadedFile); result = true; } catch (CmsException e) { LOG.error("Error setting user image.", e); } try { cms.lockResource(uploadedFile); cms.deleteResource(uploadedFile, CmsResource.DELETE_REMOVE_SIBLINGS); } catch (CmsException e) { LOG.error("Error deleting user image temp file.", e); } return result; }
[ "public", "boolean", "handleImageUpload", "(", "CmsObject", "cms", ",", "CmsUser", "user", ",", "String", "uploadedFile", ")", "{", "boolean", "result", "=", "false", ";", "try", "{", "setUserImage", "(", "cms", ",", "user", ",", "uploadedFile", ")", ";", ...
Handles a user image upload. The uploaded file will be scaled and save as a new file beneath /system/userimages/, the original file will be deleted.<p> @param cms the cms context @param user the user @param uploadedFile the uploaded file @return <code>true</code> in case the image was set successfully
[ "Handles", "a", "user", "image", "upload", ".", "The", "uploaded", "file", "will", "be", "scaled", "and", "save", "as", "a", "new", "file", "beneath", "/", "system", "/", "userimages", "/", "the", "original", "file", "will", "be", "deleted", ".", "<p", ...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsUserIconHelper.java#L259-L275
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/spec_store/FSSpecStore.java
FSSpecStore.getPathForURI
protected Path getPathForURI(Path fsSpecStoreDirPath, URI uri, String version) { return PathUtils.addExtension(PathUtils.mergePaths(fsSpecStoreDirPath, new Path(uri)), version); }
java
protected Path getPathForURI(Path fsSpecStoreDirPath, URI uri, String version) { return PathUtils.addExtension(PathUtils.mergePaths(fsSpecStoreDirPath, new Path(uri)), version); }
[ "protected", "Path", "getPathForURI", "(", "Path", "fsSpecStoreDirPath", ",", "URI", "uri", ",", "String", "version", ")", "{", "return", "PathUtils", ".", "addExtension", "(", "PathUtils", ".", "mergePaths", "(", "fsSpecStoreDirPath", ",", "new", "Path", "(", ...
Construct a file path given URI and version of a spec. @param fsSpecStoreDirPath The directory path for specs. @param uri Uri as the identifier of JobSpec @return
[ "Construct", "a", "file", "path", "given", "URI", "and", "version", "of", "a", "spec", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/spec_store/FSSpecStore.java#L332-L334
axibase/atsd-api-java
src/main/java/com/axibase/tsd/model/data/series/Sample.java
Sample.ofTimeText
public static Sample ofTimeText(long time, String textValue) { return new Sample(time, null, null, textValue); }
java
public static Sample ofTimeText(long time, String textValue) { return new Sample(time, null, null, textValue); }
[ "public", "static", "Sample", "ofTimeText", "(", "long", "time", ",", "String", "textValue", ")", "{", "return", "new", "Sample", "(", "time", ",", "null", ",", "null", ",", "textValue", ")", ";", "}" ]
Creates a new {@link Sample} with time and text value specified @param time time in milliseconds from 1970-01-01 00:00:00 @param textValue the text value of the sample @return the Sample with specified fields
[ "Creates", "a", "new", "{", "@link", "Sample", "}", "with", "time", "and", "text", "value", "specified" ]
train
https://github.com/axibase/atsd-api-java/blob/63a0767d08b202dad2ebef4372ff947d6fba0246/src/main/java/com/axibase/tsd/model/data/series/Sample.java#L118-L120
phax/ph-oton
ph-oton-security/src/main/java/com/helger/photon/security/token/accesstoken/AccessToken.java
AccessToken.createAccessTokenValidFromNow
@Nonnull public static AccessToken createAccessTokenValidFromNow (@Nullable final String sTokenString) { // Length 66 so that the Base64 encoding does not add the "==" signs // Length must be dividable by 3 final String sRealTokenString = StringHelper.hasText (sTokenString) ? sTokenString : createNewTokenString (66); return new AccessToken (sRealTokenString, PDTFactory.getCurrentLocalDateTime (), null, new RevocationStatus ()); }
java
@Nonnull public static AccessToken createAccessTokenValidFromNow (@Nullable final String sTokenString) { // Length 66 so that the Base64 encoding does not add the "==" signs // Length must be dividable by 3 final String sRealTokenString = StringHelper.hasText (sTokenString) ? sTokenString : createNewTokenString (66); return new AccessToken (sRealTokenString, PDTFactory.getCurrentLocalDateTime (), null, new RevocationStatus ()); }
[ "@", "Nonnull", "public", "static", "AccessToken", "createAccessTokenValidFromNow", "(", "@", "Nullable", "final", "String", "sTokenString", ")", "{", "// Length 66 so that the Base64 encoding does not add the \"==\" signs", "// Length must be dividable by 3", "final", "String", ...
Create a new access token that is valid from now on for an infinite amount of time. @param sTokenString The existing token string. May be <code>null</code> in which case a new token string is created. @return Never <code>null</code>.
[ "Create", "a", "new", "access", "token", "that", "is", "valid", "from", "now", "on", "for", "an", "infinite", "amount", "of", "time", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/token/accesstoken/AccessToken.java#L154-L161
AltBeacon/android-beacon-library
lib/src/main/java/org/altbeacon/beacon/service/ScanHelper.java
ScanHelper.getScanCallbackIntent
PendingIntent getScanCallbackIntent() { Intent intent = new Intent(mContext, StartupBroadcastReceiver.class); intent.putExtra("o-scan", true); return PendingIntent.getBroadcast(mContext,0, intent, PendingIntent.FLAG_UPDATE_CURRENT); }
java
PendingIntent getScanCallbackIntent() { Intent intent = new Intent(mContext, StartupBroadcastReceiver.class); intent.putExtra("o-scan", true); return PendingIntent.getBroadcast(mContext,0, intent, PendingIntent.FLAG_UPDATE_CURRENT); }
[ "PendingIntent", "getScanCallbackIntent", "(", ")", "{", "Intent", "intent", "=", "new", "Intent", "(", "mContext", ",", "StartupBroadcastReceiver", ".", "class", ")", ";", "intent", ".", "putExtra", "(", "\"o-scan\"", ",", "true", ")", ";", "return", "Pending...
Low power scan results in the background will be delivered via Intent
[ "Low", "power", "scan", "results", "in", "the", "background", "will", "be", "delivered", "via", "Intent" ]
train
https://github.com/AltBeacon/android-beacon-library/blob/f7f3a323ea7415d53e7bd695ff6a01f1501d5dc3/lib/src/main/java/org/altbeacon/beacon/service/ScanHelper.java#L250-L254
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/CategoryGraph.java
CategoryGraph.getLCS
public Category getLCS(int categoryPageId1, int categoryPageId2) throws WikiApiException { int lcsid = getLCSId(categoryPageId1, categoryPageId2); return lcsid>-1?wiki.getCategory(getLCSId(categoryPageId1, categoryPageId2)):null; }
java
public Category getLCS(int categoryPageId1, int categoryPageId2) throws WikiApiException { int lcsid = getLCSId(categoryPageId1, categoryPageId2); return lcsid>-1?wiki.getCategory(getLCSId(categoryPageId1, categoryPageId2)):null; }
[ "public", "Category", "getLCS", "(", "int", "categoryPageId1", ",", "int", "categoryPageId2", ")", "throws", "WikiApiException", "{", "int", "lcsid", "=", "getLCSId", "(", "categoryPageId1", ",", "categoryPageId2", ")", ";", "return", "lcsid", ">", "-", "1", "...
Gets the lowest common subsumer (LCS) of two nodes. The LCS of two nodes is first node on the path to the root, that has both nodes as sons. Nodes that are not in the same connected component as the root node are defined to have no LCS. @param categoryPageId1 The pageid of the first category node. @param categoryPageId2 The pageid of the second category node. @return The lowest common subsumer of the two nodes, or null if there is no LCS.
[ "Gets", "the", "lowest", "common", "subsumer", "(", "LCS", ")", "of", "two", "nodes", ".", "The", "LCS", "of", "two", "nodes", "is", "first", "node", "on", "the", "path", "to", "the", "root", "that", "has", "both", "nodes", "as", "sons", ".", "Nodes"...
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/CategoryGraph.java#L465-L468
podio/podio-java
src/main/java/com/podio/tag/TagAPI.java
TagAPI.createTags
public void createTags(Reference reference, Collection<String> tags) { getResourceFactory() .getApiResource("/tag/" + reference.toURLFragment()) .entity(tags, MediaType.APPLICATION_JSON_TYPE).post(); }
java
public void createTags(Reference reference, Collection<String> tags) { getResourceFactory() .getApiResource("/tag/" + reference.toURLFragment()) .entity(tags, MediaType.APPLICATION_JSON_TYPE).post(); }
[ "public", "void", "createTags", "(", "Reference", "reference", ",", "Collection", "<", "String", ">", "tags", ")", "{", "getResourceFactory", "(", ")", ".", "getApiResource", "(", "\"/tag/\"", "+", "reference", ".", "toURLFragment", "(", ")", ")", ".", "enti...
Add a new set of tags to the object. If a tag with the same text is already present, the tag will be ignored. @param reference The object the tags should be added to @param tags The tags that should be added
[ "Add", "a", "new", "set", "of", "tags", "to", "the", "object", ".", "If", "a", "tag", "with", "the", "same", "text", "is", "already", "present", "the", "tag", "will", "be", "ignored", "." ]
train
https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/tag/TagAPI.java#L38-L42
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/formatting2/SARLFormatter.java
SARLFormatter._format
protected void _format(SarlCapacityUses capacityUses, IFormattableDocument document) { final ISemanticRegionsFinder regionFor = this.textRegionExtensions.regionFor(capacityUses); document.append(regionFor.keyword(this.keywords.getUsesKeyword()), ONE_SPACE); formatCommaSeparatedList(capacityUses.getCapacities(), document); document.prepend(regionFor.keyword(this.keywords.getSemicolonKeyword()), NO_SPACE); }
java
protected void _format(SarlCapacityUses capacityUses, IFormattableDocument document) { final ISemanticRegionsFinder regionFor = this.textRegionExtensions.regionFor(capacityUses); document.append(regionFor.keyword(this.keywords.getUsesKeyword()), ONE_SPACE); formatCommaSeparatedList(capacityUses.getCapacities(), document); document.prepend(regionFor.keyword(this.keywords.getSemicolonKeyword()), NO_SPACE); }
[ "protected", "void", "_format", "(", "SarlCapacityUses", "capacityUses", ",", "IFormattableDocument", "document", ")", "{", "final", "ISemanticRegionsFinder", "regionFor", "=", "this", ".", "textRegionExtensions", ".", "regionFor", "(", "capacityUses", ")", ";", "docu...
Format a capacity use. @param capacityUses the capacity uses. @param document the document.
[ "Format", "a", "capacity", "use", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/formatting2/SARLFormatter.java#L475-L480
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java
ContentSpecParser.parseFileMetaData
protected File parseFileMetaData(final String line, final int lineNumber) throws ParsingException { final File file; if (line.matches(ProcessorConstants.FILE_ID_REGEX)) { file = new File(Integer.parseInt(line)); } else if (FILE_ID_LONG_PATTERN.matcher(line).matches()) { final Matcher matcher = FILE_ID_LONG_PATTERN.matcher(line); matcher.find(); final String id = matcher.group("ID"); final String title = matcher.group("Title"); final String rev = matcher.group("REV"); file = new File(title.trim(), Integer.parseInt(id)); if (rev != null) { file.setRevision(Integer.parseInt(rev)); } } else { throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_FILE_MSG, lineNumber)); } return file; }
java
protected File parseFileMetaData(final String line, final int lineNumber) throws ParsingException { final File file; if (line.matches(ProcessorConstants.FILE_ID_REGEX)) { file = new File(Integer.parseInt(line)); } else if (FILE_ID_LONG_PATTERN.matcher(line).matches()) { final Matcher matcher = FILE_ID_LONG_PATTERN.matcher(line); matcher.find(); final String id = matcher.group("ID"); final String title = matcher.group("Title"); final String rev = matcher.group("REV"); file = new File(title.trim(), Integer.parseInt(id)); if (rev != null) { file.setRevision(Integer.parseInt(rev)); } } else { throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_FILE_MSG, lineNumber)); } return file; }
[ "protected", "File", "parseFileMetaData", "(", "final", "String", "line", ",", "final", "int", "lineNumber", ")", "throws", "ParsingException", "{", "final", "File", "file", ";", "if", "(", "line", ".", "matches", "(", "ProcessorConstants", ".", "FILE_ID_REGEX",...
Parse a File MetaData component into a {@link org.jboss.pressgang.ccms.contentspec.File} object. @param line The line to be parsed. @param lineNumber The line number of the line being parsed. @return A file object initialised with the data from the line. @throws ParsingException Thrown if the line contains invalid content and couldn't be parsed.
[ "Parse", "a", "File", "MetaData", "component", "into", "a", "{", "@link", "org", ".", "jboss", ".", "pressgang", ".", "ccms", ".", "contentspec", ".", "File", "}", "object", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java#L888-L909
alrocar/POIProxy
es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/proxy/POIProxy.java
POIProxy.getFeatures
public ArrayList<JTSFeature> getFeatures(String id, int z, int x, int y, List<Param> optionalParams) throws Exception { DescribeService describeService = getDescribeServiceByID(id); Extent e1 = TileConversor.tileOSMMercatorBounds(x, y, z); double[] minXY = ConversionCoords.reproject(e1.getMinX(), e1.getMinY(), CRSFactory.getCRS(MERCATOR_SRS), CRSFactory.getCRS(GEODETIC_SRS)); double[] maxXY = ConversionCoords.reproject(e1.getMaxX(), e1.getMaxY(), CRSFactory.getCRS(MERCATOR_SRS), CRSFactory.getCRS(GEODETIC_SRS)); return getFeatures(id, optionalParams, describeService, minXY[0], minXY[1], maxXY[0], maxXY[1], 0, 0); }
java
public ArrayList<JTSFeature> getFeatures(String id, int z, int x, int y, List<Param> optionalParams) throws Exception { DescribeService describeService = getDescribeServiceByID(id); Extent e1 = TileConversor.tileOSMMercatorBounds(x, y, z); double[] minXY = ConversionCoords.reproject(e1.getMinX(), e1.getMinY(), CRSFactory.getCRS(MERCATOR_SRS), CRSFactory.getCRS(GEODETIC_SRS)); double[] maxXY = ConversionCoords.reproject(e1.getMaxX(), e1.getMaxY(), CRSFactory.getCRS(MERCATOR_SRS), CRSFactory.getCRS(GEODETIC_SRS)); return getFeatures(id, optionalParams, describeService, minXY[0], minXY[1], maxXY[0], maxXY[1], 0, 0); }
[ "public", "ArrayList", "<", "JTSFeature", ">", "getFeatures", "(", "String", "id", ",", "int", "z", ",", "int", "x", ",", "int", "y", ",", "List", "<", "Param", ">", "optionalParams", ")", "throws", "Exception", "{", "DescribeService", "describeService", "...
This method is used to get the pois from a service and return a list of {@link JTSFeature} document with the data retrieved given a Z/X/Y tile. @param id The id of the service @param z The zoom level @param x The x tile @param y The y tile @return a list of {@link JTSFeature}
[ "This", "method", "is", "used", "to", "get", "the", "pois", "from", "a", "service", "and", "return", "a", "list", "of", "{", "@link", "JTSFeature", "}", "document", "with", "the", "data", "retrieved", "given", "a", "Z", "/", "X", "/", "Y", "tile", "....
train
https://github.com/alrocar/POIProxy/blob/e1dabe738a862478b2580e90d5fc4209a2997868/es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/proxy/POIProxy.java#L255-L267
arnaudroger/SimpleFlatMapper
sfm-jdbc/src/main/java/org/simpleflatmapper/jdbc/JdbcMapperFactory.java
JdbcMapperFactory.addCustomFieldMapper
public JdbcMapperFactory addCustomFieldMapper(String key, FieldMapper<ResultSet, ?> fieldMapper) { return addColumnDefinition(key, FieldMapperColumnDefinition.<JdbcColumnKey>customFieldMapperDefinition(fieldMapper)); }
java
public JdbcMapperFactory addCustomFieldMapper(String key, FieldMapper<ResultSet, ?> fieldMapper) { return addColumnDefinition(key, FieldMapperColumnDefinition.<JdbcColumnKey>customFieldMapperDefinition(fieldMapper)); }
[ "public", "JdbcMapperFactory", "addCustomFieldMapper", "(", "String", "key", ",", "FieldMapper", "<", "ResultSet", ",", "?", ">", "fieldMapper", ")", "{", "return", "addColumnDefinition", "(", "key", ",", "FieldMapperColumnDefinition", ".", "<", "JdbcColumnKey", ">"...
Associate the specified FieldMapper for the specified property. @param key the property @param fieldMapper the fieldMapper @return the current factory
[ "Associate", "the", "specified", "FieldMapper", "for", "the", "specified", "property", "." ]
train
https://github.com/arnaudroger/SimpleFlatMapper/blob/93435438c18f26c87963d5e0f3ebf0f264dcd8c2/sfm-jdbc/src/main/java/org/simpleflatmapper/jdbc/JdbcMapperFactory.java#L110-L112
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-zoo/src/main/java/org/deeplearning4j/zoo/util/BaseLabels.java
BaseLabels.getResourceFile
protected File getResourceFile(){ URL url = getURL(); String urlString = url.toString(); String filename = urlString.substring(urlString.lastIndexOf('/')+1); File resourceDir = DL4JResources.getDirectory(ResourceType.RESOURCE, resourceName()); File localFile = new File(resourceDir, filename); String expMD5 = resourceMD5(); if(localFile.exists()){ try{ if(Downloader.checkMD5OfFile(expMD5, localFile)){ return localFile; } } catch (IOException e){ //Ignore } //MD5 failed localFile.delete(); } //Download try { Downloader.download(resourceName(), url, localFile, expMD5, 3); } catch (IOException e){ throw new RuntimeException("Error downloading labels",e); } return localFile; }
java
protected File getResourceFile(){ URL url = getURL(); String urlString = url.toString(); String filename = urlString.substring(urlString.lastIndexOf('/')+1); File resourceDir = DL4JResources.getDirectory(ResourceType.RESOURCE, resourceName()); File localFile = new File(resourceDir, filename); String expMD5 = resourceMD5(); if(localFile.exists()){ try{ if(Downloader.checkMD5OfFile(expMD5, localFile)){ return localFile; } } catch (IOException e){ //Ignore } //MD5 failed localFile.delete(); } //Download try { Downloader.download(resourceName(), url, localFile, expMD5, 3); } catch (IOException e){ throw new RuntimeException("Error downloading labels",e); } return localFile; }
[ "protected", "File", "getResourceFile", "(", ")", "{", "URL", "url", "=", "getURL", "(", ")", ";", "String", "urlString", "=", "url", ".", "toString", "(", ")", ";", "String", "filename", "=", "urlString", ".", "substring", "(", "urlString", ".", "lastIn...
Download the resource at getURL() to the local resource directory, and return the local copy as a File @return File of the local resource
[ "Download", "the", "resource", "at", "getURL", "()", "to", "the", "local", "resource", "directory", "and", "return", "the", "local", "copy", "as", "a", "File" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-zoo/src/main/java/org/deeplearning4j/zoo/util/BaseLabels.java#L137-L166
Azure/azure-sdk-for-java
notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java
NotificationHubsInner.getPnsCredentialsAsync
public Observable<PnsCredentialsResourceInner> getPnsCredentialsAsync(String resourceGroupName, String namespaceName, String notificationHubName) { return getPnsCredentialsWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName).map(new Func1<ServiceResponse<PnsCredentialsResourceInner>, PnsCredentialsResourceInner>() { @Override public PnsCredentialsResourceInner call(ServiceResponse<PnsCredentialsResourceInner> response) { return response.body(); } }); }
java
public Observable<PnsCredentialsResourceInner> getPnsCredentialsAsync(String resourceGroupName, String namespaceName, String notificationHubName) { return getPnsCredentialsWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName).map(new Func1<ServiceResponse<PnsCredentialsResourceInner>, PnsCredentialsResourceInner>() { @Override public PnsCredentialsResourceInner call(ServiceResponse<PnsCredentialsResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "PnsCredentialsResourceInner", ">", "getPnsCredentialsAsync", "(", "String", "resourceGroupName", ",", "String", "namespaceName", ",", "String", "notificationHubName", ")", "{", "return", "getPnsCredentialsWithServiceResponseAsync", "(", "resource...
Lists the PNS Credentials associated with a notification hub . @param resourceGroupName The name of the resource group. @param namespaceName The namespace name. @param notificationHubName The notification hub name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PnsCredentialsResourceInner object
[ "Lists", "the", "PNS", "Credentials", "associated", "with", "a", "notification", "hub", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java#L1792-L1799
Chorus-bdd/Chorus
interpreter/chorus-config/src/main/java/org/chorusbdd/chorus/config/CommandLineParser.java
CommandLineParser.parseProperties
public Map<ExecutionProperty, List<String>> parseProperties(Map<ExecutionProperty, List<String>> propertyMap, String... args) throws InterpreterPropertyException { //if some command line switches were specified if ( args.length > 0 ) { //easiest to build the args back up into a single string then split by - StringBuilder allArgs = new StringBuilder(); for (String s : args) { allArgs.append(s).append(" "); } String allargs = allArgs.toString(); if ( allargs.trim().length() > 0 && ! allargs.startsWith("-")) { throw new InterpreterPropertyException("arguments must start with a switch, e.g. -f"); } //having checked the first char is a -, we now have to strip it //otherwise end up with a first "" token following the split - not sure that's correct behaviour from split allargs = allargs.substring(1); //hyphens may exist within paths so only split by those which have preceding empty space String[] splitParameterList = allargs.split(" -"); for ( String parameterList : splitParameterList) { //tokenize, first token will be the property name, rest will be the values StringTokenizer st = new StringTokenizer(parameterList, " "); //find the property ExecutionProperty property = getProperty(parameterList, st); //add its values addPropertyValues(propertyMap, st, property); } } return propertyMap; }
java
public Map<ExecutionProperty, List<String>> parseProperties(Map<ExecutionProperty, List<String>> propertyMap, String... args) throws InterpreterPropertyException { //if some command line switches were specified if ( args.length > 0 ) { //easiest to build the args back up into a single string then split by - StringBuilder allArgs = new StringBuilder(); for (String s : args) { allArgs.append(s).append(" "); } String allargs = allArgs.toString(); if ( allargs.trim().length() > 0 && ! allargs.startsWith("-")) { throw new InterpreterPropertyException("arguments must start with a switch, e.g. -f"); } //having checked the first char is a -, we now have to strip it //otherwise end up with a first "" token following the split - not sure that's correct behaviour from split allargs = allargs.substring(1); //hyphens may exist within paths so only split by those which have preceding empty space String[] splitParameterList = allargs.split(" -"); for ( String parameterList : splitParameterList) { //tokenize, first token will be the property name, rest will be the values StringTokenizer st = new StringTokenizer(parameterList, " "); //find the property ExecutionProperty property = getProperty(parameterList, st); //add its values addPropertyValues(propertyMap, st, property); } } return propertyMap; }
[ "public", "Map", "<", "ExecutionProperty", ",", "List", "<", "String", ">", ">", "parseProperties", "(", "Map", "<", "ExecutionProperty", ",", "List", "<", "String", ">", ">", "propertyMap", ",", "String", "...", "args", ")", "throws", "InterpreterPropertyExce...
Add to the provided propertyMap any properties available from this source Where the map already contains property values under a given key, extra property values should be appended to the List @return propertyMap, with parsed properties added
[ "Add", "to", "the", "provided", "propertyMap", "any", "properties", "available", "from", "this", "source" ]
train
https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-config/src/main/java/org/chorusbdd/chorus/config/CommandLineParser.java#L50-L84
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/api/Table.java
Table.rollWithRows
public void rollWithRows(Consumer<Row[]> rowConsumer, int n) { if (isEmpty()) { return; } Row[] rows = new Row[n]; for (int i = 0; i < n; i++) { rows[i] = new Row(this); } int max = rowCount() - (n - 2); for (int i = 1; i < max; i++) { for (int r = 0; r < n; r++) { rows[r].at(i + r - 1); } rowConsumer.accept(rows); } }
java
public void rollWithRows(Consumer<Row[]> rowConsumer, int n) { if (isEmpty()) { return; } Row[] rows = new Row[n]; for (int i = 0; i < n; i++) { rows[i] = new Row(this); } int max = rowCount() - (n - 2); for (int i = 1; i < max; i++) { for (int r = 0; r < n; r++) { rows[r].at(i + r - 1); } rowConsumer.accept(rows); } }
[ "public", "void", "rollWithRows", "(", "Consumer", "<", "Row", "[", "]", ">", "rowConsumer", ",", "int", "n", ")", "{", "if", "(", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "Row", "[", "]", "rows", "=", "new", "Row", "[", "n", "]", ";"...
Applies the function in {@code rowConsumer} to each group of contiguous rows of size n in the table This can be used, for example, to calculate a running average of in rows
[ "Applies", "the", "function", "in", "{" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/api/Table.java#L1084-L1100
alibaba/Tangram-Android
tangram/src/main/java/com/tmall/wireless/tangram3/DefaultResolverRegistry.java
DefaultResolverRegistry.registerCard
public void registerCard(String type, Class<? extends Card> cardClz) { mDefaultCardResolver.register(type, cardClz); }
java
public void registerCard(String type, Class<? extends Card> cardClz) { mDefaultCardResolver.register(type, cardClz); }
[ "public", "void", "registerCard", "(", "String", "type", ",", "Class", "<", "?", "extends", "Card", ">", "cardClz", ")", "{", "mDefaultCardResolver", ".", "register", "(", "type", ",", "cardClz", ")", ";", "}" ]
register card with type and card class @param type @param cardClz
[ "register", "card", "with", "type", "and", "card", "class" ]
train
https://github.com/alibaba/Tangram-Android/blob/caa57f54e009c8dacd34a2322d5761956ebed321/tangram/src/main/java/com/tmall/wireless/tangram3/DefaultResolverRegistry.java#L82-L84
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/DiagnosticsInner.java
DiagnosticsInner.listSiteDetectorResponsesSlotAsync
public Observable<Page<DetectorResponseInner>> listSiteDetectorResponsesSlotAsync(final String resourceGroupName, final String siteName, final String slot) { return listSiteDetectorResponsesSlotWithServiceResponseAsync(resourceGroupName, siteName, slot) .map(new Func1<ServiceResponse<Page<DetectorResponseInner>>, Page<DetectorResponseInner>>() { @Override public Page<DetectorResponseInner> call(ServiceResponse<Page<DetectorResponseInner>> response) { return response.body(); } }); }
java
public Observable<Page<DetectorResponseInner>> listSiteDetectorResponsesSlotAsync(final String resourceGroupName, final String siteName, final String slot) { return listSiteDetectorResponsesSlotWithServiceResponseAsync(resourceGroupName, siteName, slot) .map(new Func1<ServiceResponse<Page<DetectorResponseInner>>, Page<DetectorResponseInner>>() { @Override public Page<DetectorResponseInner> call(ServiceResponse<Page<DetectorResponseInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "DetectorResponseInner", ">", ">", "listSiteDetectorResponsesSlotAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "siteName", ",", "final", "String", "slot", ")", "{", "return", "listSiteDetectorRes...
List Site Detector Responses. List Site Detector Responses. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Site Name @param slot Slot Name @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DetectorResponseInner&gt; object
[ "List", "Site", "Detector", "Responses", ".", "List", "Site", "Detector", "Responses", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/DiagnosticsInner.java#L2088-L2096
kaazing/gateway
security/src/main/java/org/kaazing/gateway/security/auth/context/DefaultLoginContextFactory.java
DefaultLoginContextFactory.createLoginContext
protected LoginContext createLoginContext(Subject subject, CallbackHandler handler, DefaultLoginResult loginResult) throws LoginException { return new ResultAwareLoginContext(name, subject, handler, configuration, loginResult); }
java
protected LoginContext createLoginContext(Subject subject, CallbackHandler handler, DefaultLoginResult loginResult) throws LoginException { return new ResultAwareLoginContext(name, subject, handler, configuration, loginResult); }
[ "protected", "LoginContext", "createLoginContext", "(", "Subject", "subject", ",", "CallbackHandler", "handler", ",", "DefaultLoginResult", "loginResult", ")", "throws", "LoginException", "{", "return", "new", "ResultAwareLoginContext", "(", "name", ",", "subject", ",",...
For login context providers that can abstract their tokens into a subject and a CallbackHandler that understands their token, this is a utility method that can be called to construct a create login. @param subject the subject that has been created for the user, or <code>null</code> if none has been created. @param handler the callback handler that can understand @param loginResult the login result object capturing the result of the login call. @return a login context @throws LoginException when a login context cannot be created
[ "For", "login", "context", "providers", "that", "can", "abstract", "their", "tokens", "into", "a", "subject", "and", "a", "CallbackHandler", "that", "understands", "their", "token", "this", "is", "a", "utility", "method", "that", "can", "be", "called", "to", ...
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/security/src/main/java/org/kaazing/gateway/security/auth/context/DefaultLoginContextFactory.java#L192-L195
aws/aws-sdk-java
jmespath-java/src/main/java/com/amazonaws/jmespath/JmesPathEvaluationVisitor.java
JmesPathEvaluationVisitor.visit
@Override public JsonNode visit(JmesPathFunction function, JsonNode input) throws InvalidTypeException { List<JsonNode> evaluatedArguments = new ArrayList<JsonNode>(); List<JmesPathExpression> arguments = function.getExpressions(); for (JmesPathExpression arg : arguments) { evaluatedArguments.add(arg.accept(this, input)); } return function.evaluate(evaluatedArguments); }
java
@Override public JsonNode visit(JmesPathFunction function, JsonNode input) throws InvalidTypeException { List<JsonNode> evaluatedArguments = new ArrayList<JsonNode>(); List<JmesPathExpression> arguments = function.getExpressions(); for (JmesPathExpression arg : arguments) { evaluatedArguments.add(arg.accept(this, input)); } return function.evaluate(evaluatedArguments); }
[ "@", "Override", "public", "JsonNode", "visit", "(", "JmesPathFunction", "function", ",", "JsonNode", "input", ")", "throws", "InvalidTypeException", "{", "List", "<", "JsonNode", ">", "evaluatedArguments", "=", "new", "ArrayList", "<", "JsonNode", ">", "(", ")"...
Evaluates function expression in applicative order. Each argument is an expression, each argument expression is evaluated before evaluating the function. The function is then called with the evaluated function arguments. The result of the function-expression is the result returned by the function call. @param function JmesPath function type @param input Input json node against which evaluation is done @return Result of the function evaluation @throws InvalidTypeException
[ "Evaluates", "function", "expression", "in", "applicative", "order", ".", "Each", "argument", "is", "an", "expression", "each", "argument", "expression", "is", "evaluated", "before", "evaluating", "the", "function", ".", "The", "function", "is", "then", "called", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/jmespath-java/src/main/java/com/amazonaws/jmespath/JmesPathEvaluationVisitor.java#L193-L201
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java
ForkJoinPool.tryRelease
private boolean tryRelease(long c, WorkQueue v, long inc) { int sp = (int)c, ns = sp & ~UNSIGNALLED; if (v != null) { int vs = v.scanState; long nc = (v.stackPred & SP_MASK) | (UC_MASK & (c + inc)); if (sp == vs && U.compareAndSwapLong(this, CTL, c, nc)) { v.scanState = ns; LockSupport.unpark(v.parker); return true; } } return false; }
java
private boolean tryRelease(long c, WorkQueue v, long inc) { int sp = (int)c, ns = sp & ~UNSIGNALLED; if (v != null) { int vs = v.scanState; long nc = (v.stackPred & SP_MASK) | (UC_MASK & (c + inc)); if (sp == vs && U.compareAndSwapLong(this, CTL, c, nc)) { v.scanState = ns; LockSupport.unpark(v.parker); return true; } } return false; }
[ "private", "boolean", "tryRelease", "(", "long", "c", ",", "WorkQueue", "v", ",", "long", "inc", ")", "{", "int", "sp", "=", "(", "int", ")", "c", ",", "ns", "=", "sp", "&", "~", "UNSIGNALLED", ";", "if", "(", "v", "!=", "null", ")", "{", "int"...
Signals and releases worker v if it is top of idle worker stack. This performs a one-shot version of signalWork only if there is (apparently) at least one idle worker. @param c incoming ctl value @param v if non-null, a worker @param inc the increment to active count (zero when compensating) @return true if successful
[ "Signals", "and", "releases", "worker", "v", "if", "it", "is", "top", "of", "idle", "worker", "stack", ".", "This", "performs", "a", "one", "-", "shot", "version", "of", "signalWork", "only", "if", "there", "is", "(", "apparently", ")", "at", "least", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java#L1729-L1741
maven-nar/nar-maven-plugin
src/main/java/com/github/maven_nar/cpptasks/apple/XcodeProjectWriter.java
XcodeProjectWriter.createPBXFileReference
private static PBXObjectRef createPBXFileReference(final String sourceTree, final String baseDir, final File file) { final Map map = new HashMap(); map.put("isa", "PBXFileReference"); final String relPath = CUtil.toUnixPath(CUtil.getRelativePath(baseDir, file)); map.put("path", relPath); map.put("name", file.getName()); map.put("sourceTree", sourceTree); return new PBXObjectRef(map); }
java
private static PBXObjectRef createPBXFileReference(final String sourceTree, final String baseDir, final File file) { final Map map = new HashMap(); map.put("isa", "PBXFileReference"); final String relPath = CUtil.toUnixPath(CUtil.getRelativePath(baseDir, file)); map.put("path", relPath); map.put("name", file.getName()); map.put("sourceTree", sourceTree); return new PBXObjectRef(map); }
[ "private", "static", "PBXObjectRef", "createPBXFileReference", "(", "final", "String", "sourceTree", ",", "final", "String", "baseDir", ",", "final", "File", "file", ")", "{", "final", "Map", "map", "=", "new", "HashMap", "(", ")", ";", "map", ".", "put", ...
Create PBXFileReference. @param sourceTree source tree. @param baseDir base directory. @param file file. @return PBXFileReference object.
[ "Create", "PBXFileReference", "." ]
train
https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/apple/XcodeProjectWriter.java#L202-L211
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/registry/NotificationHandlerNodeRegistry.java
NotificationHandlerNodeRegistry.registerEntry
void registerEntry(ListIterator<PathElement> iterator, ConcreteNotificationHandlerRegistration.NotificationHandlerEntry entry) { if (!iterator.hasNext()) { // leaf node, register the entry here entries.add(entry); return; } PathElement element = iterator.next(); NotificationHandlerNodeSubregistry subregistry = getOrCreateSubregistry(element.getKey()); subregistry.registerEntry(iterator, element.getValue(), entry); }
java
void registerEntry(ListIterator<PathElement> iterator, ConcreteNotificationHandlerRegistration.NotificationHandlerEntry entry) { if (!iterator.hasNext()) { // leaf node, register the entry here entries.add(entry); return; } PathElement element = iterator.next(); NotificationHandlerNodeSubregistry subregistry = getOrCreateSubregistry(element.getKey()); subregistry.registerEntry(iterator, element.getValue(), entry); }
[ "void", "registerEntry", "(", "ListIterator", "<", "PathElement", ">", "iterator", ",", "ConcreteNotificationHandlerRegistration", ".", "NotificationHandlerEntry", "entry", ")", "{", "if", "(", "!", "iterator", ".", "hasNext", "(", ")", ")", "{", "// leaf node, regi...
Register the entry here (if the registry is the leaf node) or continue to traverse the tree
[ "Register", "the", "entry", "here", "(", "if", "the", "registry", "is", "the", "leaf", "node", ")", "or", "continue", "to", "traverse", "the", "tree" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/registry/NotificationHandlerNodeRegistry.java#L71-L80
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Solo.java
Solo.initializeTimeout
@SuppressWarnings({ "rawtypes", "unchecked" }) private static int initializeTimeout(String property, int defaultValue) { try { Class clazz = Class.forName("android.os.SystemProperties"); Method method = clazz.getDeclaredMethod("get", String.class); String value = (String) method.invoke(null, property); return Integer.parseInt(value); } catch (Exception e) { return defaultValue; } }
java
@SuppressWarnings({ "rawtypes", "unchecked" }) private static int initializeTimeout(String property, int defaultValue) { try { Class clazz = Class.forName("android.os.SystemProperties"); Method method = clazz.getDeclaredMethod("get", String.class); String value = (String) method.invoke(null, property); return Integer.parseInt(value); } catch (Exception e) { return defaultValue; } }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "private", "static", "int", "initializeTimeout", "(", "String", "property", ",", "int", "defaultValue", ")", "{", "try", "{", "Class", "clazz", "=", "Class", ".", "forName", "...
Parse a timeout value set using adb shell. There are two options to set the timeout. Set it using adb shell (requires root access): <br><br> 'adb shell setprop solo_large_timeout milliseconds' <br> 'adb shell setprop solo_small_timeout milliseconds' <br> Example: adb shell setprop solo_small_timeout 10000 <br><br> Set the values directly using setLargeTimeout() and setSmallTimeout @param property name of the property to read the timeout from @param defaultValue default value for the timeout @return timeout in milliseconds
[ "Parse", "a", "timeout", "value", "set", "using", "adb", "shell", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L3989-L4000
ACRA/acra
acra-core/src/main/java/org/acra/builder/ReportExecutor.java
ReportExecutor.saveCrashReportFile
private void saveCrashReportFile(@NonNull File file, @NonNull CrashReportData crashData) { try { if (ACRA.DEV_LOGGING) ACRA.log.d(LOG_TAG, "Writing crash report file " + file); final CrashReportPersister persister = new CrashReportPersister(); persister.store(crashData, file); } catch (Exception e) { ACRA.log.e(LOG_TAG, "An error occurred while writing the report file...", e); } }
java
private void saveCrashReportFile(@NonNull File file, @NonNull CrashReportData crashData) { try { if (ACRA.DEV_LOGGING) ACRA.log.d(LOG_TAG, "Writing crash report file " + file); final CrashReportPersister persister = new CrashReportPersister(); persister.store(crashData, file); } catch (Exception e) { ACRA.log.e(LOG_TAG, "An error occurred while writing the report file...", e); } }
[ "private", "void", "saveCrashReportFile", "(", "@", "NonNull", "File", "file", ",", "@", "NonNull", "CrashReportData", "crashData", ")", "{", "try", "{", "if", "(", "ACRA", ".", "DEV_LOGGING", ")", "ACRA", ".", "log", ".", "d", "(", "LOG_TAG", ",", "\"Wr...
Store a report @param file the file to store in @param crashData the content
[ "Store", "a", "report" ]
train
https://github.com/ACRA/acra/blob/bfa3235ab110328c5ab2f792ddf8ee87be4a32d1/acra-core/src/main/java/org/acra/builder/ReportExecutor.java#L269-L277
nutzam/nutzboot
nutzboot-starter/nutzboot-starter-tio-websocket/src/main/java/org/nutz/boot/starter/tio/websocketbean/TioWebsocketMsgHandler.java
TioWebsocketMsgHandler.onAfterHandshaked
@Override public void onAfterHandshaked(HttpRequest httpRequest, HttpResponse httpResponse, ChannelContext channelContext) throws Exception { log.debug("onAfterHandshaked"); TioWebsocketMethodMapper onAfterHandshaked = methods.getOnAfterHandshaked(); if (onAfterHandshaked != null) { onAfterHandshaked.getMethod().invoke(onAfterHandshaked.getInstance(), httpRequest, httpResponse, channelContext); } }
java
@Override public void onAfterHandshaked(HttpRequest httpRequest, HttpResponse httpResponse, ChannelContext channelContext) throws Exception { log.debug("onAfterHandshaked"); TioWebsocketMethodMapper onAfterHandshaked = methods.getOnAfterHandshaked(); if (onAfterHandshaked != null) { onAfterHandshaked.getMethod().invoke(onAfterHandshaked.getInstance(), httpRequest, httpResponse, channelContext); } }
[ "@", "Override", "public", "void", "onAfterHandshaked", "(", "HttpRequest", "httpRequest", ",", "HttpResponse", "httpResponse", ",", "ChannelContext", "channelContext", ")", "throws", "Exception", "{", "log", ".", "debug", "(", "\"onAfterHandshaked\"", ")", ";", "Ti...
afterHandshaked @param httpRequest httpRequest @param httpResponse httpResponse @param channelContext channelContext @throws Exception e
[ "afterHandshaked" ]
train
https://github.com/nutzam/nutzboot/blob/fd33fd4fdce058eab594f28e4d3202f997e3c66a/nutzboot-starter/nutzboot-starter-tio-websocket/src/main/java/org/nutz/boot/starter/tio/websocketbean/TioWebsocketMsgHandler.java#L56-L63
mikepenz/Android-Iconics
library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java
IconicsDrawable.paddingDp
@NonNull public IconicsDrawable paddingDp(@Dimension(unit = DP) int sizeDp) { return paddingPx(Utils.convertDpToPx(mContext, sizeDp)); }
java
@NonNull public IconicsDrawable paddingDp(@Dimension(unit = DP) int sizeDp) { return paddingPx(Utils.convertDpToPx(mContext, sizeDp)); }
[ "@", "NonNull", "public", "IconicsDrawable", "paddingDp", "(", "@", "Dimension", "(", "unit", "=", "DP", ")", "int", "sizeDp", ")", "{", "return", "paddingPx", "(", "Utils", ".", "convertDpToPx", "(", "mContext", ",", "sizeDp", ")", ")", ";", "}" ]
Set the padding in dp for the drawable @return The current IconicsDrawable for chaining.
[ "Set", "the", "padding", "in", "dp", "for", "the", "drawable" ]
train
https://github.com/mikepenz/Android-Iconics/blob/0b2c8f7d07b6d2715a417563c66311e7e1fcc7d8/library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java#L591-L594