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
groupon/robo-remote
RoboRemoteClientCommon/src/main/com/groupon/roboremote/roboremoteclientcommon/QueryBuilder.java
QueryBuilder.genericRequest
private QueryBuilder genericRequest(String type, String value) throws Exception { JSONObject op = new JSONObject(); op.put(type, value); JSONArray operations = (JSONArray) request.get(Constants.REQUEST_OPERATIONS); operations.put(op); request.remove(Constants.REQUEST_OPERATIONS); request.put(Constants.REQUEST_OPERATIONS, operations); return this; }
java
private QueryBuilder genericRequest(String type, String value) throws Exception { JSONObject op = new JSONObject(); op.put(type, value); JSONArray operations = (JSONArray) request.get(Constants.REQUEST_OPERATIONS); operations.put(op); request.remove(Constants.REQUEST_OPERATIONS); request.put(Constants.REQUEST_OPERATIONS, operations); return this; }
[ "private", "QueryBuilder", "genericRequest", "(", "String", "type", ",", "String", "value", ")", "throws", "Exception", "{", "JSONObject", "op", "=", "new", "JSONObject", "(", ")", ";", "op", ".", "put", "(", "type", ",", "value", ")", ";", "JSONArray", ...
Creates a key value request @param type @param value @return @throws Exception
[ "Creates", "a", "key", "value", "request" ]
train
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteClientCommon/src/main/com/groupon/roboremote/roboremoteclientcommon/QueryBuilder.java#L227-L235
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java
FileSystem.toJarURL
@Pure @Inline("toJarURL(($1).toURI().toURL(), ($2))") public static URL toJarURL(File jarFile, String insideFile) throws MalformedURLException { return toJarURL(jarFile.toURI().toURL(), insideFile); }
java
@Pure @Inline("toJarURL(($1).toURI().toURL(), ($2))") public static URL toJarURL(File jarFile, String insideFile) throws MalformedURLException { return toJarURL(jarFile.toURI().toURL(), insideFile); }
[ "@", "Pure", "@", "Inline", "(", "\"toJarURL(($1).toURI().toURL(), ($2))\"", ")", "public", "static", "URL", "toJarURL", "(", "File", "jarFile", ",", "String", "insideFile", ")", "throws", "MalformedURLException", "{", "return", "toJarURL", "(", "jarFile", ".", "t...
Replies the jar-schemed URL composed of the two given components. <p>If the inputs are {@code /path1/archive.jar} and @{code /path2/file}, the output of this function is {@code jar:file:/path1/archive.jar!/path2/file}. @param jarFile is the URL to the jar file. @param insideFile is the name of the file inside the jar. @return the jar-schemed URL. @throws MalformedURLException when the URL is malformed.
[ "Replies", "the", "jar", "-", "schemed", "URL", "composed", "of", "the", "two", "given", "components", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L316-L320
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/TreeUtil.java
TreeUtil.collateVisibles
public static List<ComponentWithContext> collateVisibles(final WComponent comp) { final List<ComponentWithContext> list = new ArrayList<>(); WComponentTreeVisitor visitor = new WComponentTreeVisitor() { @Override public VisitorResult visit(final WComponent comp) { // In traversing the tree, special components like WInvisbleContainer, WRepeatRoot are still traversed // (so ignore them) if (comp.isVisible()) { list.add(new ComponentWithContext(comp, UIContextHolder.getCurrent())); } return VisitorResult.CONTINUE; } }; traverseVisible(comp, visitor); return list; }
java
public static List<ComponentWithContext> collateVisibles(final WComponent comp) { final List<ComponentWithContext> list = new ArrayList<>(); WComponentTreeVisitor visitor = new WComponentTreeVisitor() { @Override public VisitorResult visit(final WComponent comp) { // In traversing the tree, special components like WInvisbleContainer, WRepeatRoot are still traversed // (so ignore them) if (comp.isVisible()) { list.add(new ComponentWithContext(comp, UIContextHolder.getCurrent())); } return VisitorResult.CONTINUE; } }; traverseVisible(comp, visitor); return list; }
[ "public", "static", "List", "<", "ComponentWithContext", ">", "collateVisibles", "(", "final", "WComponent", "comp", ")", "{", "final", "List", "<", "ComponentWithContext", ">", "list", "=", "new", "ArrayList", "<>", "(", ")", ";", "WComponentTreeVisitor", "visi...
Obtains a list of components which are visible in the given tree. Repeated components will be returned multiple times, one for each row which they are visible in. @param comp the root component to search from. @return a list of components which are visible in the given context.
[ "Obtains", "a", "list", "of", "components", "which", "are", "visible", "in", "the", "given", "tree", ".", "Repeated", "components", "will", "be", "returned", "multiple", "times", "one", "for", "each", "row", "which", "they", "are", "visible", "in", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/TreeUtil.java#L45-L63
Red5/red5-io
src/main/java/org/red5/io/mp3/impl/MP3Stream.java
MP3Stream.calculateBitRate
private static int calculateBitRate(int mpegVer, int layer, int code) { int[] arr = null; if (mpegVer == AudioFrame.MPEG_V1) { switch (layer) { case AudioFrame.LAYER_1: arr = BIT_RATE_MPEG1_L1; break; case AudioFrame.LAYER_2: arr = BIT_RATE_MPEG1_L2; break; case AudioFrame.LAYER_3: arr = BIT_RATE_MPEG1_L3; break; } } else { if (layer == AudioFrame.LAYER_1) { arr = BIT_RATE_MPEG2_L1; } else { arr = BIT_RATE_MPEG2_L2; } } return arr[code]; }
java
private static int calculateBitRate(int mpegVer, int layer, int code) { int[] arr = null; if (mpegVer == AudioFrame.MPEG_V1) { switch (layer) { case AudioFrame.LAYER_1: arr = BIT_RATE_MPEG1_L1; break; case AudioFrame.LAYER_2: arr = BIT_RATE_MPEG1_L2; break; case AudioFrame.LAYER_3: arr = BIT_RATE_MPEG1_L3; break; } } else { if (layer == AudioFrame.LAYER_1) { arr = BIT_RATE_MPEG2_L1; } else { arr = BIT_RATE_MPEG2_L2; } } return arr[code]; }
[ "private", "static", "int", "calculateBitRate", "(", "int", "mpegVer", ",", "int", "layer", ",", "int", "code", ")", "{", "int", "[", "]", "arr", "=", "null", ";", "if", "(", "mpegVer", "==", "AudioFrame", ".", "MPEG_V1", ")", "{", "switch", "(", "la...
Calculates the bit rate based on the given parameters. @param mpegVer the MPEG version @param layer the layer @param code the code for the bit rate @return the bit rate in bits per second
[ "Calculates", "the", "bit", "rate", "based", "on", "the", "given", "parameters", "." ]
train
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/mp3/impl/MP3Stream.java#L262-L284
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetExtensionsInner.java
VirtualMachineScaleSetExtensionsInner.createOrUpdate
public VirtualMachineScaleSetExtensionInner createOrUpdate(String resourceGroupName, String vmScaleSetName, String vmssExtensionName, VirtualMachineScaleSetExtensionInner extensionParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters).toBlocking().last().body(); }
java
public VirtualMachineScaleSetExtensionInner createOrUpdate(String resourceGroupName, String vmScaleSetName, String vmssExtensionName, VirtualMachineScaleSetExtensionInner extensionParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters).toBlocking().last().body(); }
[ "public", "VirtualMachineScaleSetExtensionInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ",", "String", "vmssExtensionName", ",", "VirtualMachineScaleSetExtensionInner", "extensionParameters", ")", "{", "return", "createOrUpdateWith...
The operation to create or update an extension. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. @param vmssExtensionName The name of the VM scale set extension. @param extensionParameters Parameters supplied to the Create VM scale set Extension operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VirtualMachineScaleSetExtensionInner object if successful.
[ "The", "operation", "to", "create", "or", "update", "an", "extension", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetExtensionsInner.java#L106-L108
jcuda/jcuda
JCudaJava/src/main/java/jcuda/runtime/JCuda.java
JCuda.cudaGLMapBufferObjectAsync
@Deprecated public static int cudaGLMapBufferObjectAsync(Pointer devPtr, int bufObj, cudaStream_t stream) { return checkResult(cudaGLMapBufferObjectAsyncNative(devPtr, bufObj, stream)); }
java
@Deprecated public static int cudaGLMapBufferObjectAsync(Pointer devPtr, int bufObj, cudaStream_t stream) { return checkResult(cudaGLMapBufferObjectAsyncNative(devPtr, bufObj, stream)); }
[ "@", "Deprecated", "public", "static", "int", "cudaGLMapBufferObjectAsync", "(", "Pointer", "devPtr", ",", "int", "bufObj", ",", "cudaStream_t", "stream", ")", "{", "return", "checkResult", "(", "cudaGLMapBufferObjectAsyncNative", "(", "devPtr", ",", "bufObj", ",", ...
Maps a buffer object for access by CUDA. <pre> cudaError_t cudaGLMapBufferObjectAsync ( void** devPtr, GLuint bufObj, cudaStream_t stream ) </pre> <div> <p>Maps a buffer object for access by CUDA. Deprecated<span>This function is deprecated as of CUDA 3.0.</span>Maps the buffer object of ID <tt>bufObj</tt> into the address space of CUDA and returns in <tt>*devPtr</tt> the base pointer of the resulting mapping. The buffer must have previously been registered by calling cudaGLRegisterBufferObject(). While a buffer is mapped by CUDA, any OpenGL operation which references the buffer will result in undefined behavior. The OpenGL context used to create the buffer, or another context from the same share group, must be bound to the current thread when this is called. </p> <p>Stream /p stream is synchronized with the current GL context. </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param devPtr Returned device pointer to CUDA object @param bufObj Buffer object ID to map @param stream Stream to synchronize @return cudaSuccess, cudaErrorMapBufferObjectFailed @see JCuda#cudaGraphicsMapResources @deprecated Deprecated as of CUDA 3.0
[ "Maps", "a", "buffer", "object", "for", "access", "by", "CUDA", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L10988-L10992
jenkinsci/java-client-api
jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java
JenkinsServer.createView
public JenkinsServer createView(FolderJob folder, String viewName, String viewXml) throws IOException { return createView(folder, viewName, viewXml, false); }
java
public JenkinsServer createView(FolderJob folder, String viewName, String viewXml) throws IOException { return createView(folder, viewName, viewXml, false); }
[ "public", "JenkinsServer", "createView", "(", "FolderJob", "folder", ",", "String", "viewName", ",", "String", "viewXml", ")", "throws", "IOException", "{", "return", "createView", "(", "folder", ",", "viewName", ",", "viewXml", ",", "false", ")", ";", "}" ]
Create a view on the server using the provided xml and in the provided folder. @param folder {@link FolderJob} @param viewName name of the view to be created. @param viewXml The configuration for the view. @throws IOException in case of an error.
[ "Create", "a", "view", "on", "the", "server", "using", "the", "provided", "xml", "and", "in", "the", "provided", "folder", "." ]
train
https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java#L427-L429
tvesalainen/util
util/src/main/java/org/vesalainen/util/stream/Streams.java
Streams.reducingStream
public static final IntStream reducingStream(IntStream stream, ReducingFunction func) { return StreamSupport.intStream(new ReducingSpliterator(stream, func), false); }
java
public static final IntStream reducingStream(IntStream stream, ReducingFunction func) { return StreamSupport.intStream(new ReducingSpliterator(stream, func), false); }
[ "public", "static", "final", "IntStream", "reducingStream", "(", "IntStream", "stream", ",", "ReducingFunction", "func", ")", "{", "return", "StreamSupport", ".", "intStream", "(", "new", "ReducingSpliterator", "(", "stream", ",", "func", ")", ",", "false", ")",...
Converts Stream to Stream where one or more int items are mapped to one int item. Mapping is done by func method. Func must return true after calling consumer method. Otherwise behavior is unpredictable. @param stream @param func @return @throws IllegalStateException if Stream ends when mapping is unfinished. @deprecated This is not tested at all!!!
[ "Converts", "Stream", "to", "Stream", "where", "one", "or", "more", "int", "items", "are", "mapped", "to", "one", "int", "item", ".", "Mapping", "is", "done", "by", "func", "method", ".", "Func", "must", "return", "true", "after", "calling", "consumer", ...
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/stream/Streams.java#L52-L55
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java
AppServicePlansInner.deleteVnetRoute
public void deleteVnetRoute(String resourceGroupName, String name, String vnetName, String routeName) { deleteVnetRouteWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName).toBlocking().single().body(); }
java
public void deleteVnetRoute(String resourceGroupName, String name, String vnetName, String routeName) { deleteVnetRouteWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName).toBlocking().single().body(); }
[ "public", "void", "deleteVnetRoute", "(", "String", "resourceGroupName", ",", "String", "name", ",", "String", "vnetName", ",", "String", "routeName", ")", "{", "deleteVnetRouteWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ",", "vnetName", ",", "...
Delete a Virtual Network route in an App Service plan. Delete a Virtual Network route in an App Service plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @param vnetName Name of the Virtual Network. @param routeName Name of the Virtual Network route. @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
[ "Delete", "a", "Virtual", "Network", "route", "in", "an", "App", "Service", "plan", ".", "Delete", "a", "Virtual", "Network", "route", "in", "an", "App", "Service", "plan", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L3705-L3707
elki-project/elki
elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/data/VectorUtil.java
VectorUtil.cosAngle
public static double cosAngle(NumberVector v1, NumberVector v2) { // Java Hotspot appears to optimize these better than if-then-else: return v1 instanceof SparseNumberVector ? // v2 instanceof SparseNumberVector ? // angleSparse((SparseNumberVector) v1, (SparseNumberVector) v2) : // angleSparseDense((SparseNumberVector) v1, v2) : // v2 instanceof SparseNumberVector ? // angleSparseDense((SparseNumberVector) v2, v1) : // angleDense(v1, v2); }
java
public static double cosAngle(NumberVector v1, NumberVector v2) { // Java Hotspot appears to optimize these better than if-then-else: return v1 instanceof SparseNumberVector ? // v2 instanceof SparseNumberVector ? // angleSparse((SparseNumberVector) v1, (SparseNumberVector) v2) : // angleSparseDense((SparseNumberVector) v1, v2) : // v2 instanceof SparseNumberVector ? // angleSparseDense((SparseNumberVector) v2, v1) : // angleDense(v1, v2); }
[ "public", "static", "double", "cosAngle", "(", "NumberVector", "v1", ",", "NumberVector", "v2", ")", "{", "// Java Hotspot appears to optimize these better than if-then-else:", "return", "v1", "instanceof", "SparseNumberVector", "?", "//", "v2", "instanceof", "SparseNumberV...
Compute the absolute cosine of the angle between two vectors. To convert it to radians, use <code>Math.acos(angle)</code>! @param v1 first vector @param v2 second vector @return Angle
[ "Compute", "the", "absolute", "cosine", "of", "the", "angle", "between", "two", "vectors", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/data/VectorUtil.java#L227-L236
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java
HELM2NotationUtils.section3
private static void section3(List<GroupingNotation> groupings, Map<String, String> mapIds) throws NotationException { for (GroupingNotation grouping : groupings) { GroupEntity groupID = grouping.getGroupID(); if (mapIds.containsKey(groupID.getId())) { groupID = new GroupingNotation(mapIds.get(groupID.getId())).getGroupID(); } String details = grouping.toHELM2().split("\\(")[1].split("\\)")[0]; details = changeIDs(details, mapIds); helm2notation.addGrouping(new GroupingNotation(groupID, details)); } }
java
private static void section3(List<GroupingNotation> groupings, Map<String, String> mapIds) throws NotationException { for (GroupingNotation grouping : groupings) { GroupEntity groupID = grouping.getGroupID(); if (mapIds.containsKey(groupID.getId())) { groupID = new GroupingNotation(mapIds.get(groupID.getId())).getGroupID(); } String details = grouping.toHELM2().split("\\(")[1].split("\\)")[0]; details = changeIDs(details, mapIds); helm2notation.addGrouping(new GroupingNotation(groupID, details)); } }
[ "private", "static", "void", "section3", "(", "List", "<", "GroupingNotation", ">", "groupings", ",", "Map", "<", "String", ",", "String", ">", "mapIds", ")", "throws", "NotationException", "{", "for", "(", "GroupingNotation", "grouping", ":", "groupings", ")"...
method to add groupings to the existent grouping section @param groupings new GroupingNotations @param mapIds map of old and new Ids @throws NotationException if notation is not valid
[ "method", "to", "add", "groupings", "to", "the", "existent", "grouping", "section" ]
train
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L305-L318
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/heartbeat/HeartbeatServices.java
HeartbeatServices.fromConfiguration
public static HeartbeatServices fromConfiguration(Configuration configuration) { long heartbeatInterval = configuration.getLong(HeartbeatManagerOptions.HEARTBEAT_INTERVAL); long heartbeatTimeout = configuration.getLong(HeartbeatManagerOptions.HEARTBEAT_TIMEOUT); return new HeartbeatServices(heartbeatInterval, heartbeatTimeout); }
java
public static HeartbeatServices fromConfiguration(Configuration configuration) { long heartbeatInterval = configuration.getLong(HeartbeatManagerOptions.HEARTBEAT_INTERVAL); long heartbeatTimeout = configuration.getLong(HeartbeatManagerOptions.HEARTBEAT_TIMEOUT); return new HeartbeatServices(heartbeatInterval, heartbeatTimeout); }
[ "public", "static", "HeartbeatServices", "fromConfiguration", "(", "Configuration", "configuration", ")", "{", "long", "heartbeatInterval", "=", "configuration", ".", "getLong", "(", "HeartbeatManagerOptions", ".", "HEARTBEAT_INTERVAL", ")", ";", "long", "heartbeatTimeout...
Creates an HeartbeatServices instance from a {@link Configuration}. @param configuration Configuration to be used for the HeartbeatServices creation @return An HeartbeatServices instance created from the given configuration
[ "Creates", "an", "HeartbeatServices", "instance", "from", "a", "{", "@link", "Configuration", "}", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/heartbeat/HeartbeatServices.java#L110-L116
BlueBrain/bluima
modules/bluima_abbreviations/src/main/java/com/wcohen/ss/abbvGapsHmm/AbbvGapsHmmForwardEvaluator.java
AbbvGapsHmmForwardEvaluator.getPartialEndedWord
protected static String getPartialEndedWord(String str, int pos){ assert(pos < str.length() && pos >= 0); if( posIsAtWord(str, pos) ){ int prevSpace = findLastNonLetterOrDigit(str, pos); return str.substring(prevSpace+1, pos+1); } return null; }
java
protected static String getPartialEndedWord(String str, int pos){ assert(pos < str.length() && pos >= 0); if( posIsAtWord(str, pos) ){ int prevSpace = findLastNonLetterOrDigit(str, pos); return str.substring(prevSpace+1, pos+1); } return null; }
[ "protected", "static", "String", "getPartialEndedWord", "(", "String", "str", ",", "int", "pos", ")", "{", "assert", "(", "pos", "<", "str", ".", "length", "(", ")", "&&", "pos", ">=", "0", ")", ";", "if", "(", "posIsAtWord", "(", "str", ",", "pos", ...
If pos is ending a word in str: returns this word. Else: returns null;
[ "If", "pos", "is", "ending", "a", "word", "in", "str", ":", "returns", "this", "word", ".", "Else", ":", "returns", "null", ";" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_abbreviations/src/main/java/com/wcohen/ss/abbvGapsHmm/AbbvGapsHmmForwardEvaluator.java#L129-L138
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLBuilder.java
JQLBuilder.defineWhereStatement
private static <L extends Annotation> String defineWhereStatement(final SQLiteModelMethod method, final JQL jql, Class<L> annotation, Map<JQLDynamicStatementType, String> dynamicReplace) { StringBuilder builder = new StringBuilder(); String where = AnnotationUtility.extractAsString(method.getElement(), annotation, AnnotationAttributeType.WHERE); if (StringUtils.hasText(where)) jql.annotatedWhere = true; if (StringUtils.hasText(where) || method.hasDynamicWhereConditions()) { builder.append(" " + WHERE_KEYWORD); if (StringUtils.hasText(where)) { jql.staticWhereConditions = true; builder.append(StringUtils.startWithSpace(where)); } if (StringUtils.hasText(method.dynamicWhereParameterName)) { StringBuilder dynamicBuffer = new StringBuilder(); dynamicBuffer.append(" #{" + JQLDynamicStatementType.DYNAMIC_WHERE + "}"); builder.append(" #{" + JQLDynamicStatementType.DYNAMIC_WHERE + "}"); // define replacement string for WHERE dynamicReplace.put(JQLDynamicStatementType.DYNAMIC_WHERE, dynamicBuffer.toString()); } } return builder.toString(); }
java
private static <L extends Annotation> String defineWhereStatement(final SQLiteModelMethod method, final JQL jql, Class<L> annotation, Map<JQLDynamicStatementType, String> dynamicReplace) { StringBuilder builder = new StringBuilder(); String where = AnnotationUtility.extractAsString(method.getElement(), annotation, AnnotationAttributeType.WHERE); if (StringUtils.hasText(where)) jql.annotatedWhere = true; if (StringUtils.hasText(where) || method.hasDynamicWhereConditions()) { builder.append(" " + WHERE_KEYWORD); if (StringUtils.hasText(where)) { jql.staticWhereConditions = true; builder.append(StringUtils.startWithSpace(where)); } if (StringUtils.hasText(method.dynamicWhereParameterName)) { StringBuilder dynamicBuffer = new StringBuilder(); dynamicBuffer.append(" #{" + JQLDynamicStatementType.DYNAMIC_WHERE + "}"); builder.append(" #{" + JQLDynamicStatementType.DYNAMIC_WHERE + "}"); // define replacement string for WHERE dynamicReplace.put(JQLDynamicStatementType.DYNAMIC_WHERE, dynamicBuffer.toString()); } } return builder.toString(); }
[ "private", "static", "<", "L", "extends", "Annotation", ">", "String", "defineWhereStatement", "(", "final", "SQLiteModelMethod", "method", ",", "final", "JQL", "jql", ",", "Class", "<", "L", ">", "annotation", ",", "Map", "<", "JQLDynamicStatementType", ",", ...
Define WHERE statement. @param <L> the generic type @param method the method @param jql the jql @param annotation the annotation @param dynamicReplace the dynamic replace @return the string
[ "Define", "WHERE", "statement", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLBuilder.java#L1033-L1060
Harium/keel
src/main/java/com/harium/keel/catalano/math/distance/Distance.java
Distance.SymmetricChiSquareDivergence
public static double SymmetricChiSquareDivergence(double[] p, double[] q) { double r = 0; for (int i = 0; i < p.length; i++) { double den = p[i] * q[i]; if (den != 0) { double p1 = p[i] - q[i]; double p2 = p[i] + q[i]; r += (p1 * p1 * p2) / den; } } return r; }
java
public static double SymmetricChiSquareDivergence(double[] p, double[] q) { double r = 0; for (int i = 0; i < p.length; i++) { double den = p[i] * q[i]; if (den != 0) { double p1 = p[i] - q[i]; double p2 = p[i] + q[i]; r += (p1 * p1 * p2) / den; } } return r; }
[ "public", "static", "double", "SymmetricChiSquareDivergence", "(", "double", "[", "]", "p", ",", "double", "[", "]", "q", ")", "{", "double", "r", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "p", ".", "length", ";", "i", "++",...
Gets the Symmetric Chi-square divergence. @param p P vector. @param q Q vector. @return The Symmetric chi-square divergence between p and q.
[ "Gets", "the", "Symmetric", "Chi", "-", "square", "divergence", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/distance/Distance.java#L851-L863
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildStepsInner.java
BuildStepsInner.beginCreate
public BuildStepInner beginCreate(String resourceGroupName, String registryName, String buildTaskName, String stepName, BuildStepProperties properties) { return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName, stepName, properties).toBlocking().single().body(); }
java
public BuildStepInner beginCreate(String resourceGroupName, String registryName, String buildTaskName, String stepName, BuildStepProperties properties) { return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName, stepName, properties).toBlocking().single().body(); }
[ "public", "BuildStepInner", "beginCreate", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "buildTaskName", ",", "String", "stepName", ",", "BuildStepProperties", "properties", ")", "{", "return", "beginCreateWithServiceResponseAsync", "(...
Creates a build step for a build task. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param buildTaskName The name of the container registry build task. @param stepName The name of a build step for a container registry build task. @param properties The properties of a build step. @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 BuildStepInner object if successful.
[ "Creates", "a", "build", "step", "for", "a", "build", "task", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildStepsInner.java#L619-L621
the-fascinator/plugin-indexer-solr
src/main/java/com/googlecode/fascinator/indexer/SolrIndexer.java
SolrIndexer.sendIndexToBuffer
public void sendIndexToBuffer(String index, Map<String, List<String>> fields) { String doc = pyUtils.solrDocument(fields); addToBuffer(index, doc); }
java
public void sendIndexToBuffer(String index, Map<String, List<String>> fields) { String doc = pyUtils.solrDocument(fields); addToBuffer(index, doc); }
[ "public", "void", "sendIndexToBuffer", "(", "String", "index", ",", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "fields", ")", "{", "String", "doc", "=", "pyUtils", ".", "solrDocument", "(", "fields", ")", ";", "addToBuffer", "(", "index"...
Send the document to buffer directly @param index @param fields
[ "Send", "the", "document", "to", "buffer", "directly" ]
train
https://github.com/the-fascinator/plugin-indexer-solr/blob/001159b18b78a87daa5d8b2a17ced28694bae156/src/main/java/com/googlecode/fascinator/indexer/SolrIndexer.java#L829-L832
jbundle/webapp
proxy/src/main/java/org/jbundle/util/webapp/proxy/ProxyServlet.java
ProxyServlet.getDataFromClient
public void getDataFromClient(HttpRequestBase httpget, OutputStream streamOut) throws ClientProtocolException, IOException { HttpClient httpclient = new DefaultHttpClient(); // Execute the request HttpResponse response = httpclient.execute(httpget); // Get the response entity HttpEntity entity = response.getEntity(); if (entity != null) { InputStream instream = entity.getContent(); ProxyServlet.transferURLStream(instream, streamOut); // Closing the input stream will trigger connection release instream.close(); // There is probably a less resource intensive way to do this. httpclient.getConnectionManager().shutdown(); } }
java
public void getDataFromClient(HttpRequestBase httpget, OutputStream streamOut) throws ClientProtocolException, IOException { HttpClient httpclient = new DefaultHttpClient(); // Execute the request HttpResponse response = httpclient.execute(httpget); // Get the response entity HttpEntity entity = response.getEntity(); if (entity != null) { InputStream instream = entity.getContent(); ProxyServlet.transferURLStream(instream, streamOut); // Closing the input stream will trigger connection release instream.close(); // There is probably a less resource intensive way to do this. httpclient.getConnectionManager().shutdown(); } }
[ "public", "void", "getDataFromClient", "(", "HttpRequestBase", "httpget", ",", "OutputStream", "streamOut", ")", "throws", "ClientProtocolException", ",", "IOException", "{", "HttpClient", "httpclient", "=", "new", "DefaultHttpClient", "(", ")", ";", "// Execute the req...
Get the data from the proxy and send it to the client. @param httpget @param streamOut @throws IOException @throws ClientProtocolException
[ "Get", "the", "data", "from", "the", "proxy", "and", "send", "it", "to", "the", "client", "." ]
train
https://github.com/jbundle/webapp/blob/af2cf32bd92254073052f1f9b4bcd47c2f76ba7d/proxy/src/main/java/org/jbundle/util/webapp/proxy/ProxyServlet.java#L194-L216
sksamuel/scrimage
scrimage-core/src/main/java/com/sksamuel/scrimage/PixelTools.java
PixelTools.colorMatches
public static boolean colorMatches(Color color, int tolerance, Pixel[] pixels) { if (tolerance < 0 || tolerance > 255) throw new RuntimeException("Tolerance value must be between 0 and 255 inclusive"); if (tolerance == 0) return uniform(color, pixels); else return approx(color, tolerance, pixels); }
java
public static boolean colorMatches(Color color, int tolerance, Pixel[] pixels) { if (tolerance < 0 || tolerance > 255) throw new RuntimeException("Tolerance value must be between 0 and 255 inclusive"); if (tolerance == 0) return uniform(color, pixels); else return approx(color, tolerance, pixels); }
[ "public", "static", "boolean", "colorMatches", "(", "Color", "color", ",", "int", "tolerance", ",", "Pixel", "[", "]", "pixels", ")", "{", "if", "(", "tolerance", "<", "0", "||", "tolerance", ">", "255", ")", "throw", "new", "RuntimeException", "(", "\"T...
Returns true if the colors of all pixels in the array are within the given tolerance compared to the referenced color
[ "Returns", "true", "if", "the", "colors", "of", "all", "pixels", "in", "the", "array", "are", "within", "the", "given", "tolerance", "compared", "to", "the", "referenced", "color" ]
train
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/PixelTools.java#L118-L125
molgenis/molgenis
molgenis-ontology-core/src/main/java/org/molgenis/ontology/core/repository/OntologyTermRepository.java
OntologyTermRepository.getOntologyTermDistance
public int getOntologyTermDistance(OntologyTerm ontologyTerm1, OntologyTerm ontologyTerm2) { String nodePath1 = getOntologyTermNodePath(ontologyTerm1); String nodePath2 = getOntologyTermNodePath(ontologyTerm2); if (StringUtils.isEmpty(nodePath1)) { throw new MolgenisDataAccessException( "The nodePath cannot be null : " + ontologyTerm1.toString()); } if (StringUtils.isEmpty(nodePath2)) { throw new MolgenisDataAccessException( "The nodePath cannot be null : " + ontologyTerm2.toString()); } return calculateNodePathDistance(nodePath1, nodePath2); }
java
public int getOntologyTermDistance(OntologyTerm ontologyTerm1, OntologyTerm ontologyTerm2) { String nodePath1 = getOntologyTermNodePath(ontologyTerm1); String nodePath2 = getOntologyTermNodePath(ontologyTerm2); if (StringUtils.isEmpty(nodePath1)) { throw new MolgenisDataAccessException( "The nodePath cannot be null : " + ontologyTerm1.toString()); } if (StringUtils.isEmpty(nodePath2)) { throw new MolgenisDataAccessException( "The nodePath cannot be null : " + ontologyTerm2.toString()); } return calculateNodePathDistance(nodePath1, nodePath2); }
[ "public", "int", "getOntologyTermDistance", "(", "OntologyTerm", "ontologyTerm1", ",", "OntologyTerm", "ontologyTerm2", ")", "{", "String", "nodePath1", "=", "getOntologyTermNodePath", "(", "ontologyTerm1", ")", ";", "String", "nodePath2", "=", "getOntologyTermNodePath", ...
Calculate the distance between any two ontology terms in the ontology tree structure by calculating the difference in nodePaths. @return the distance between two ontology terms
[ "Calculate", "the", "distance", "between", "any", "two", "ontology", "terms", "in", "the", "ontology", "tree", "structure", "by", "calculating", "the", "difference", "in", "nodePaths", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-ontology-core/src/main/java/org/molgenis/ontology/core/repository/OntologyTermRepository.java#L175-L190
alipay/sofa-rpc
core/api/src/main/java/com/alipay/sofa/rpc/message/MessageBuilder.java
MessageBuilder.buildSofaRequest
@Deprecated public static SofaRequest buildSofaRequest(Class<?> clazz, String method, Class[] argTypes, Object[] args) { SofaRequest request = new SofaRequest(); request.setInterfaceName(clazz.getName()); request.setMethodName(method); request.setMethodArgs(args == null ? CodecUtils.EMPTY_OBJECT_ARRAY : args); request.setMethodArgSigs(ClassTypeUtils.getTypeStrs(argTypes, true)); return request; }
java
@Deprecated public static SofaRequest buildSofaRequest(Class<?> clazz, String method, Class[] argTypes, Object[] args) { SofaRequest request = new SofaRequest(); request.setInterfaceName(clazz.getName()); request.setMethodName(method); request.setMethodArgs(args == null ? CodecUtils.EMPTY_OBJECT_ARRAY : args); request.setMethodArgSigs(ClassTypeUtils.getTypeStrs(argTypes, true)); return request; }
[ "@", "Deprecated", "public", "static", "SofaRequest", "buildSofaRequest", "(", "Class", "<", "?", ">", "clazz", ",", "String", "method", ",", "Class", "[", "]", "argTypes", ",", "Object", "[", "]", "args", ")", "{", "SofaRequest", "request", "=", "new", ...
构建请求,常用于代理类拦截 @param clazz 接口类 @param method 方法名 @param argTypes 方法参数类型 @param args 方法参数值 @return 远程调用请求 @deprecated use {@link #buildSofaRequest(Class, Method, Class[], Object[])}
[ "构建请求,常用于代理类拦截" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/message/MessageBuilder.java#L43-L51
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/Config.java
Config.setMapEventJournalConfigs
public Config setMapEventJournalConfigs(Map<String, EventJournalConfig> eventJournalConfigs) { this.mapEventJournalConfigs.clear(); this.mapEventJournalConfigs.putAll(eventJournalConfigs); for (Entry<String, EventJournalConfig> entry : eventJournalConfigs.entrySet()) { entry.getValue().setMapName(entry.getKey()); } return this; }
java
public Config setMapEventJournalConfigs(Map<String, EventJournalConfig> eventJournalConfigs) { this.mapEventJournalConfigs.clear(); this.mapEventJournalConfigs.putAll(eventJournalConfigs); for (Entry<String, EventJournalConfig> entry : eventJournalConfigs.entrySet()) { entry.getValue().setMapName(entry.getKey()); } return this; }
[ "public", "Config", "setMapEventJournalConfigs", "(", "Map", "<", "String", ",", "EventJournalConfig", ">", "eventJournalConfigs", ")", "{", "this", ".", "mapEventJournalConfigs", ".", "clear", "(", ")", ";", "this", ".", "mapEventJournalConfigs", ".", "putAll", "...
Sets the map of map event journal configurations, mapped by config name. The config name may be a pattern with which the configuration will be obtained in the future. @param eventJournalConfigs the map event journal configuration map to set @return this config instance
[ "Sets", "the", "map", "of", "map", "event", "journal", "configurations", "mapped", "by", "config", "name", ".", "The", "config", "name", "may", "be", "a", "pattern", "with", "which", "the", "configuration", "will", "be", "obtained", "in", "the", "future", ...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L3122-L3129
eclipse/hawkbit
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/util/IpUtil.java
IpUtil.createUri
public static URI createUri(final String scheme, final String host) { final boolean isIpV6 = host.indexOf(':') >= 0 && host.charAt(0) != '['; if (isIpV6) { return URI.create(scheme + SCHEME_SEPERATOR + "[" + host + "]"); } return URI.create(scheme + SCHEME_SEPERATOR + host); }
java
public static URI createUri(final String scheme, final String host) { final boolean isIpV6 = host.indexOf(':') >= 0 && host.charAt(0) != '['; if (isIpV6) { return URI.create(scheme + SCHEME_SEPERATOR + "[" + host + "]"); } return URI.create(scheme + SCHEME_SEPERATOR + host); }
[ "public", "static", "URI", "createUri", "(", "final", "String", "scheme", ",", "final", "String", "host", ")", "{", "final", "boolean", "isIpV6", "=", "host", ".", "indexOf", "(", "'", "'", ")", ">=", "0", "&&", "host", ".", "charAt", "(", "0", ")", ...
Create a {@link URI} with scheme and host. @param scheme the scheme @param host the host @return the {@link URI} @throws IllegalArgumentException If the given string not parsable
[ "Create", "a", "{", "@link", "URI", "}", "with", "scheme", "and", "host", "." ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/util/IpUtil.java#L127-L133
arquillian/arquillian-core
config/impl-base/src/main/java/org/jboss/arquillian/config/impl/extension/PropertiesPropertyResolver.java
PropertiesPropertyResolver.resolveCompositeKey
private String resolveCompositeKey(String key, Properties props) { String value = null; // Look for the comma int comma = key.indexOf(','); if (comma > -1) { // If we have a first part, try resolve it if (comma > 0) { // Check the first part String key1 = key.substring(0, comma); if (props != null) { value = props.getProperty(key1); } else { value = System.getProperty(key1); } } // Check the second part, if there is one and first lookup failed if (value == null && comma < key.length() - 1) { String key2 = key.substring(comma + 1); if (props != null) { value = props.getProperty(key2); } else { value = System.getProperty(key2); } } } // Return whatever we've found or null return value; }
java
private String resolveCompositeKey(String key, Properties props) { String value = null; // Look for the comma int comma = key.indexOf(','); if (comma > -1) { // If we have a first part, try resolve it if (comma > 0) { // Check the first part String key1 = key.substring(0, comma); if (props != null) { value = props.getProperty(key1); } else { value = System.getProperty(key1); } } // Check the second part, if there is one and first lookup failed if (value == null && comma < key.length() - 1) { String key2 = key.substring(comma + 1); if (props != null) { value = props.getProperty(key2); } else { value = System.getProperty(key2); } } } // Return whatever we've found or null return value; }
[ "private", "String", "resolveCompositeKey", "(", "String", "key", ",", "Properties", "props", ")", "{", "String", "value", "=", "null", ";", "// Look for the comma", "int", "comma", "=", "key", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "comma", ...
Try to resolve a "key" from the provided properties by checking if it is actually a "key1,key2", in which case try first "key1", then "key2". If all fails, return null. <p> It also accepts "key1," and ",key2". @param key the key to resolve @param props the properties to use @return the resolved key or null
[ "Try", "to", "resolve", "a", "key", "from", "the", "provided", "properties", "by", "checking", "if", "it", "is", "actually", "a", "key1", "key2", "in", "which", "case", "try", "first", "key1", "then", "key2", ".", "If", "all", "fails", "return", "null", ...
train
https://github.com/arquillian/arquillian-core/blob/a85b91789b80cc77e0f0c2e2abac65c2255c0a81/config/impl-base/src/main/java/org/jboss/arquillian/config/impl/extension/PropertiesPropertyResolver.java#L94-L122
raydac/java-comment-preprocessor
jcp/src/main/java/com/igormaznitsa/jcp/expression/Expression.java
Expression.evalTree
@Nonnull public static Value evalTree(@Nonnull final ExpressionTree tree, @Nonnull final PreprocessorContext context) { final Expression exp = new Expression(context, tree); return exp.eval(context.getPreprocessingState()); }
java
@Nonnull public static Value evalTree(@Nonnull final ExpressionTree tree, @Nonnull final PreprocessorContext context) { final Expression exp = new Expression(context, tree); return exp.eval(context.getPreprocessingState()); }
[ "@", "Nonnull", "public", "static", "Value", "evalTree", "(", "@", "Nonnull", "final", "ExpressionTree", "tree", ",", "@", "Nonnull", "final", "PreprocessorContext", "context", ")", "{", "final", "Expression", "exp", "=", "new", "Expression", "(", "context", "...
Evaluate an expression tree @param tree an expression tree, it must not be null @param context a preprocessor context to be used for expression operations @return the result as a Value object, it can't be null
[ "Evaluate", "an", "expression", "tree" ]
train
https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/jcp/expression/Expression.java#L99-L103
cdk/cdk
base/core/src/main/java/org/openscience/cdk/ringsearch/RingSearch.java
RingSearch.ringFragments
public IAtomContainer ringFragments() { int[] vertices = cyclic(); int n = vertices.length; IAtom[] atoms = new IAtom[n]; List<IBond> bonds = new ArrayList<IBond>(); for (int i = 0; i < vertices.length; i++) { atoms[i] = container.getAtom(vertices[i]); } for (IBond bond : container.bonds()) { IAtom either = bond.getBegin(); IAtom other = bond.getEnd(); int u = container.indexOf(either); int v = container.indexOf(other); // add the bond if the vertex colors match if (searcher.cyclic(u, v)) bonds.add(bond); } IChemObjectBuilder builder = container.getBuilder(); IAtomContainer fragment = builder.newInstance(IAtomContainer.class, 0, 0, 0, 0); fragment.setAtoms(atoms); fragment.setBonds(bonds.toArray(new IBond[bonds.size()])); return fragment; }
java
public IAtomContainer ringFragments() { int[] vertices = cyclic(); int n = vertices.length; IAtom[] atoms = new IAtom[n]; List<IBond> bonds = new ArrayList<IBond>(); for (int i = 0; i < vertices.length; i++) { atoms[i] = container.getAtom(vertices[i]); } for (IBond bond : container.bonds()) { IAtom either = bond.getBegin(); IAtom other = bond.getEnd(); int u = container.indexOf(either); int v = container.indexOf(other); // add the bond if the vertex colors match if (searcher.cyclic(u, v)) bonds.add(bond); } IChemObjectBuilder builder = container.getBuilder(); IAtomContainer fragment = builder.newInstance(IAtomContainer.class, 0, 0, 0, 0); fragment.setAtoms(atoms); fragment.setBonds(bonds.toArray(new IBond[bonds.size()])); return fragment; }
[ "public", "IAtomContainer", "ringFragments", "(", ")", "{", "int", "[", "]", "vertices", "=", "cyclic", "(", ")", ";", "int", "n", "=", "vertices", ".", "length", ";", "IAtom", "[", "]", "atoms", "=", "new", "IAtom", "[", "n", "]", ";", "List", "<"...
Extract the cyclic atom and bond fragments of the container. Bonds which join two different isolated/fused cycles (e.g. biphenyl) are not be included. @return a new container with only the cyclic atoms and bonds @see org.openscience.cdk.graph.SpanningTree#getCyclicFragmentsContainer()
[ "Extract", "the", "cyclic", "atom", "and", "bond", "fragments", "of", "the", "container", ".", "Bonds", "which", "join", "two", "different", "isolated", "/", "fused", "cycles", "(", "e", ".", "g", ".", "biphenyl", ")", "are", "not", "be", "included", "."...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/core/src/main/java/org/openscience/cdk/ringsearch/RingSearch.java#L328-L361
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingEndpointsInner.java
StreamingEndpointsInner.beginCreate
public StreamingEndpointInner beginCreate(String resourceGroupName, String accountName, String streamingEndpointName, StreamingEndpointInner parameters, Boolean autoStart) { return beginCreateWithServiceResponseAsync(resourceGroupName, accountName, streamingEndpointName, parameters, autoStart).toBlocking().single().body(); }
java
public StreamingEndpointInner beginCreate(String resourceGroupName, String accountName, String streamingEndpointName, StreamingEndpointInner parameters, Boolean autoStart) { return beginCreateWithServiceResponseAsync(resourceGroupName, accountName, streamingEndpointName, parameters, autoStart).toBlocking().single().body(); }
[ "public", "StreamingEndpointInner", "beginCreate", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "streamingEndpointName", ",", "StreamingEndpointInner", "parameters", ",", "Boolean", "autoStart", ")", "{", "return", "beginCreateWithService...
Create StreamingEndpoint. Creates a StreamingEndpoint. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param streamingEndpointName The name of the StreamingEndpoint. @param parameters StreamingEndpoint properties needed for creation. @param autoStart The flag indicates if the resource should be automatically started on creation. @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the StreamingEndpointInner object if successful.
[ "Create", "StreamingEndpoint", ".", "Creates", "a", "StreamingEndpoint", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingEndpointsInner.java#L648-L650
Azure/azure-sdk-for-java
datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/TrustedIdProvidersInner.java
TrustedIdProvidersInner.getAsync
public Observable<TrustedIdProviderInner> getAsync(String resourceGroupName, String accountName, String trustedIdProviderName) { return getWithServiceResponseAsync(resourceGroupName, accountName, trustedIdProviderName).map(new Func1<ServiceResponse<TrustedIdProviderInner>, TrustedIdProviderInner>() { @Override public TrustedIdProviderInner call(ServiceResponse<TrustedIdProviderInner> response) { return response.body(); } }); }
java
public Observable<TrustedIdProviderInner> getAsync(String resourceGroupName, String accountName, String trustedIdProviderName) { return getWithServiceResponseAsync(resourceGroupName, accountName, trustedIdProviderName).map(new Func1<ServiceResponse<TrustedIdProviderInner>, TrustedIdProviderInner>() { @Override public TrustedIdProviderInner call(ServiceResponse<TrustedIdProviderInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "TrustedIdProviderInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "trustedIdProviderName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName...
Gets the specified Data Lake Store trusted identity provider. @param resourceGroupName The name of the Azure resource group. @param accountName The name of the Data Lake Store account. @param trustedIdProviderName The name of the trusted identity provider to retrieve. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TrustedIdProviderInner object
[ "Gets", "the", "specified", "Data", "Lake", "Store", "trusted", "identity", "provider", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/TrustedIdProvidersInner.java#L355-L362
alkacon/opencms-core
src/org/opencms/importexport/A_CmsImport.java
A_CmsImport.readPropertiesFromManifest
protected List<CmsProperty> readPropertiesFromManifest(Element parentElement, List<String> ignoredPropertyKeys) { // all imported Cms property objects are collected in map first forfaster access Map<String, CmsProperty> properties = new HashMap<String, CmsProperty>(); CmsProperty property = null; List<Node> propertyElements = parentElement.selectNodes( "./" + A_CmsImport.N_PROPERTIES + "/" + A_CmsImport.N_PROPERTY); Element propertyElement = null; String key = null, value = null; Attribute attrib = null; // iterate over all property elements for (int i = 0, n = propertyElements.size(); i < n; i++) { propertyElement = (Element)propertyElements.get(i); key = getChildElementTextValue(propertyElement, A_CmsImport.N_NAME); if ((key == null) || ignoredPropertyKeys.contains(key)) { // continue if the current property (key) should be ignored or is null continue; } // all Cms properties are collected in a map keyed by their property keys property = properties.get(key); if (property == null) { property = new CmsProperty(); property.setName(key); property.setAutoCreatePropertyDefinition(true); properties.put(key, property); } value = getChildElementTextValue(propertyElement, A_CmsImport.N_VALUE); if (value == null) { value = ""; } attrib = propertyElement.attribute(A_CmsImport.N_PROPERTY_ATTRIB_TYPE); if ((attrib != null) && attrib.getValue().equals(A_CmsImport.N_PROPERTY_ATTRIB_TYPE_SHARED)) { // it is a shared/resource property value property.setResourceValue(value); } else { // it is an individual/structure value property.setStructureValue(value); } } return new ArrayList<CmsProperty>(properties.values()); }
java
protected List<CmsProperty> readPropertiesFromManifest(Element parentElement, List<String> ignoredPropertyKeys) { // all imported Cms property objects are collected in map first forfaster access Map<String, CmsProperty> properties = new HashMap<String, CmsProperty>(); CmsProperty property = null; List<Node> propertyElements = parentElement.selectNodes( "./" + A_CmsImport.N_PROPERTIES + "/" + A_CmsImport.N_PROPERTY); Element propertyElement = null; String key = null, value = null; Attribute attrib = null; // iterate over all property elements for (int i = 0, n = propertyElements.size(); i < n; i++) { propertyElement = (Element)propertyElements.get(i); key = getChildElementTextValue(propertyElement, A_CmsImport.N_NAME); if ((key == null) || ignoredPropertyKeys.contains(key)) { // continue if the current property (key) should be ignored or is null continue; } // all Cms properties are collected in a map keyed by their property keys property = properties.get(key); if (property == null) { property = new CmsProperty(); property.setName(key); property.setAutoCreatePropertyDefinition(true); properties.put(key, property); } value = getChildElementTextValue(propertyElement, A_CmsImport.N_VALUE); if (value == null) { value = ""; } attrib = propertyElement.attribute(A_CmsImport.N_PROPERTY_ATTRIB_TYPE); if ((attrib != null) && attrib.getValue().equals(A_CmsImport.N_PROPERTY_ATTRIB_TYPE_SHARED)) { // it is a shared/resource property value property.setResourceValue(value); } else { // it is an individual/structure value property.setStructureValue(value); } } return new ArrayList<CmsProperty>(properties.values()); }
[ "protected", "List", "<", "CmsProperty", ">", "readPropertiesFromManifest", "(", "Element", "parentElement", ",", "List", "<", "String", ">", "ignoredPropertyKeys", ")", "{", "// all imported Cms property objects are collected in map first forfaster access", "Map", "<", "Stri...
Reads all properties below a specified parent element from the <code>manifest.xml</code>.<p> @param parentElement the current file node @param ignoredPropertyKeys a list of properties to be ignored @return a list with all properties
[ "Reads", "all", "properties", "below", "a", "specified", "parent", "element", "from", "the", "<code", ">", "manifest", ".", "xml<", "/", "code", ">", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/A_CmsImport.java#L979-L1025
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/ScreenField.java
ScreenField.isPrintableControl
public boolean isPrintableControl(ScreenField sField, int iPrintOptions) { if ((sField == null) || (sField == this)) return this.getScreenFieldView().isPrintableControl(iPrintOptions); return sField.isPrintableControl(null, iPrintOptions); }
java
public boolean isPrintableControl(ScreenField sField, int iPrintOptions) { if ((sField == null) || (sField == this)) return this.getScreenFieldView().isPrintableControl(iPrintOptions); return sField.isPrintableControl(null, iPrintOptions); }
[ "public", "boolean", "isPrintableControl", "(", "ScreenField", "sField", ",", "int", "iPrintOptions", ")", "{", "if", "(", "(", "sField", "==", "null", ")", "||", "(", "sField", "==", "this", ")", ")", "return", "this", ".", "getScreenFieldView", "(", ")",...
Display this sub-control in html input format? @param iPrintOptions The view specific print options. @return True if this sub-control is printable.
[ "Display", "this", "sub", "-", "control", "in", "html", "input", "format?" ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/ScreenField.java#L713-L718
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.java
DependencyCheckScanAgent.generateExternalReports
private void generateExternalReports(Engine engine, File outDirectory) throws ScanAgentException { try { engine.writeReports(applicationName, outDirectory, this.reportFormat.name()); } catch (ReportException ex) { LOGGER.debug("Unexpected exception occurred during analysis; please see the verbose error log for more details.", ex); throw new ScanAgentException("Error generating the report", ex); } }
java
private void generateExternalReports(Engine engine, File outDirectory) throws ScanAgentException { try { engine.writeReports(applicationName, outDirectory, this.reportFormat.name()); } catch (ReportException ex) { LOGGER.debug("Unexpected exception occurred during analysis; please see the verbose error log for more details.", ex); throw new ScanAgentException("Error generating the report", ex); } }
[ "private", "void", "generateExternalReports", "(", "Engine", "engine", ",", "File", "outDirectory", ")", "throws", "ScanAgentException", "{", "try", "{", "engine", ".", "writeReports", "(", "applicationName", ",", "outDirectory", ",", "this", ".", "reportFormat", ...
Generates the reports for a given dependency-check engine. @param engine a dependency-check engine @param outDirectory the directory to write the reports to @throws ScanAgentException thrown if there is an error generating the report
[ "Generates", "the", "reports", "for", "a", "given", "dependency", "-", "check", "engine", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.java#L893-L900
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java
DiagnosticsInner.getSiteDetectorSlotWithServiceResponseAsync
public Observable<ServiceResponse<Page<DetectorDefinitionInner>>> getSiteDetectorSlotWithServiceResponseAsync(final String resourceGroupName, final String siteName, final String diagnosticCategory, final String detectorName, final String slot) { return getSiteDetectorSlotSinglePageAsync(resourceGroupName, siteName, diagnosticCategory, detectorName, slot) .concatMap(new Func1<ServiceResponse<Page<DetectorDefinitionInner>>, Observable<ServiceResponse<Page<DetectorDefinitionInner>>>>() { @Override public Observable<ServiceResponse<Page<DetectorDefinitionInner>>> call(ServiceResponse<Page<DetectorDefinitionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(getSiteDetectorSlotNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<DetectorDefinitionInner>>> getSiteDetectorSlotWithServiceResponseAsync(final String resourceGroupName, final String siteName, final String diagnosticCategory, final String detectorName, final String slot) { return getSiteDetectorSlotSinglePageAsync(resourceGroupName, siteName, diagnosticCategory, detectorName, slot) .concatMap(new Func1<ServiceResponse<Page<DetectorDefinitionInner>>, Observable<ServiceResponse<Page<DetectorDefinitionInner>>>>() { @Override public Observable<ServiceResponse<Page<DetectorDefinitionInner>>> call(ServiceResponse<Page<DetectorDefinitionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(getSiteDetectorSlotNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "DetectorDefinitionInner", ">", ">", ">", "getSiteDetectorSlotWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "siteName", ",", "final", "String", "diagnosti...
Get Detector. Get Detector. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Site Name @param diagnosticCategory Diagnostic Category @param detectorName Detector Name @param slot Slot Name @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DetectorDefinitionInner&gt; object
[ "Get", "Detector", ".", "Get", "Detector", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java#L2289-L2301
Crab2died/Excel4J
src/main/java/com/github/crab2died/utils/DateUtils.java
DateUtils.str2DateUnmatch2Null
public static Date str2DateUnmatch2Null(String strDate) { Date date; try { date = str2Date(strDate); } catch (Exception e) { throw new TimeMatchFormatException("[" + strDate + "] date auto parse exception", e); } return date; }
java
public static Date str2DateUnmatch2Null(String strDate) { Date date; try { date = str2Date(strDate); } catch (Exception e) { throw new TimeMatchFormatException("[" + strDate + "] date auto parse exception", e); } return date; }
[ "public", "static", "Date", "str2DateUnmatch2Null", "(", "String", "strDate", ")", "{", "Date", "date", ";", "try", "{", "date", "=", "str2Date", "(", "strDate", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "TimeMatchFormatExcep...
<p>字符串时间转为{@link Date}类型,未找到匹配类型则返NULL</p> <p>支持匹配类型列表:</p> <p>yyyy-MM-dd</p> <p>yyyy/MM/dd</p> <p>HH:mm:ss</p> <p>yyyy-MM-dd HH:mm:ss</p> <p>yyyy-MM-dTHH:mm:ss.SSS</p> <p> author : Crab2Died date : 2017年06月02日 15:21:54 @param strDate 时间字符串 @return Date {@link Date}时间
[ "<p", ">", "字符串时间转为", "{", "@link", "Date", "}", "类型,未找到匹配类型则返NULL<", "/", "p", ">", "<p", ">", "支持匹配类型列表:<", "/", "p", ">", "<p", ">", "yyyy", "-", "MM", "-", "dd<", "/", "p", ">", "<p", ">", "yyyy", "/", "MM", "/", "dd<", "/", "p", ">", "<p...
train
https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/utils/DateUtils.java#L202-L210
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/SpecializedOps_DDRM.java
SpecializedOps_DDRM.pivotMatrix
public static DMatrixRMaj pivotMatrix(DMatrixRMaj ret, int pivots[], int numPivots, boolean transposed ) { if( ret == null ) { ret = new DMatrixRMaj(numPivots, numPivots); } else { if( ret.numCols != numPivots || ret.numRows != numPivots ) throw new IllegalArgumentException("Unexpected matrix dimension"); CommonOps_DDRM.fill(ret, 0); } if( transposed ) { for( int i = 0; i < numPivots; i++ ) { ret.set(pivots[i],i,1); } } else { for( int i = 0; i < numPivots; i++ ) { ret.set(i,pivots[i],1); } } return ret; }
java
public static DMatrixRMaj pivotMatrix(DMatrixRMaj ret, int pivots[], int numPivots, boolean transposed ) { if( ret == null ) { ret = new DMatrixRMaj(numPivots, numPivots); } else { if( ret.numCols != numPivots || ret.numRows != numPivots ) throw new IllegalArgumentException("Unexpected matrix dimension"); CommonOps_DDRM.fill(ret, 0); } if( transposed ) { for( int i = 0; i < numPivots; i++ ) { ret.set(pivots[i],i,1); } } else { for( int i = 0; i < numPivots; i++ ) { ret.set(i,pivots[i],1); } } return ret; }
[ "public", "static", "DMatrixRMaj", "pivotMatrix", "(", "DMatrixRMaj", "ret", ",", "int", "pivots", "[", "]", ",", "int", "numPivots", ",", "boolean", "transposed", ")", "{", "if", "(", "ret", "==", "null", ")", "{", "ret", "=", "new", "DMatrixRMaj", "(",...
<p> Creates a pivot matrix that exchanges the rows in a matrix: <br> A' = P*A<br> </p> <p> For example, if element 0 in 'pivots' is 2 then the first row in A' will be the 3rd row in A. </p> @param ret If null then a new matrix is declared otherwise the results are written to it. Is modified. @param pivots Specifies the new order of rows in a matrix. @param numPivots How many elements in pivots are being used. @param transposed If the transpose of the matrix is returned. @return A pivot matrix.
[ "<p", ">", "Creates", "a", "pivot", "matrix", "that", "exchanges", "the", "rows", "in", "a", "matrix", ":", "<br", ">", "A", "=", "P", "*", "A<br", ">", "<", "/", "p", ">", "<p", ">", "For", "example", "if", "element", "0", "in", "pivots", "is", ...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/SpecializedOps_DDRM.java#L380-L401
alkacon/opencms-core
src/org/opencms/configuration/CmsParameterConfiguration.java
CmsParameterConfiguration.getBoolean
public boolean getBoolean(String key, boolean defaultValue) { Object value = m_configurationObjects.get(key); if (value instanceof Boolean) { return ((Boolean)value).booleanValue(); } else if (value instanceof String) { Boolean b = Boolean.valueOf((String)value); m_configurationObjects.put(key, b); return b.booleanValue(); } else { return defaultValue; } }
java
public boolean getBoolean(String key, boolean defaultValue) { Object value = m_configurationObjects.get(key); if (value instanceof Boolean) { return ((Boolean)value).booleanValue(); } else if (value instanceof String) { Boolean b = Boolean.valueOf((String)value); m_configurationObjects.put(key, b); return b.booleanValue(); } else { return defaultValue; } }
[ "public", "boolean", "getBoolean", "(", "String", "key", ",", "boolean", "defaultValue", ")", "{", "Object", "value", "=", "m_configurationObjects", ".", "get", "(", "key", ")", ";", "if", "(", "value", "instanceof", "Boolean", ")", "{", "return", "(", "("...
Returns the boolean associated with the given parameter, or the default value in case there is no boolean value for this parameter.<p> @param key the parameter to look up the value for @param defaultValue the default value @return the boolean associated with the given parameter, or the default value in case there is no boolean value for this parameter
[ "Returns", "the", "boolean", "associated", "with", "the", "given", "parameter", "or", "the", "default", "value", "in", "case", "there", "is", "no", "boolean", "value", "for", "this", "parameter", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsParameterConfiguration.java#L521-L536
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/volume/GeometryExtrude.java
GeometryExtrude.extractRoof
public static Polygon extractRoof(Polygon polygon, double height) { GeometryFactory factory = polygon.getFactory(); Polygon roofP = (Polygon)polygon.copy(); roofP.apply(new TranslateCoordinateSequenceFilter(height)); final LinearRing shell = factory.createLinearRing(getCounterClockWise(roofP.getExteriorRing()).getCoordinates()); final int nbOfHoles = roofP.getNumInteriorRing(); final LinearRing[] holes = new LinearRing[nbOfHoles]; for (int i = 0; i < nbOfHoles; i++) { holes[i] = factory.createLinearRing(getClockWise( roofP.getInteriorRingN(i)).getCoordinates()); } return factory.createPolygon(shell, holes); }
java
public static Polygon extractRoof(Polygon polygon, double height) { GeometryFactory factory = polygon.getFactory(); Polygon roofP = (Polygon)polygon.copy(); roofP.apply(new TranslateCoordinateSequenceFilter(height)); final LinearRing shell = factory.createLinearRing(getCounterClockWise(roofP.getExteriorRing()).getCoordinates()); final int nbOfHoles = roofP.getNumInteriorRing(); final LinearRing[] holes = new LinearRing[nbOfHoles]; for (int i = 0; i < nbOfHoles; i++) { holes[i] = factory.createLinearRing(getClockWise( roofP.getInteriorRingN(i)).getCoordinates()); } return factory.createPolygon(shell, holes); }
[ "public", "static", "Polygon", "extractRoof", "(", "Polygon", "polygon", ",", "double", "height", ")", "{", "GeometryFactory", "factory", "=", "polygon", ".", "getFactory", "(", ")", ";", "Polygon", "roofP", "=", "(", "Polygon", ")", "polygon", ".", "copy", ...
Extract the roof of a polygon @param polygon @param height @return
[ "Extract", "the", "roof", "of", "a", "polygon" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/volume/GeometryExtrude.java#L150-L162
alkacon/opencms-core
src/org/opencms/xml/containerpage/CmsDynamicFunctionParser.java
CmsDynamicFunctionParser.getMainFormat
protected Format getMainFormat(CmsObject cms, I_CmsXmlContentLocation location, CmsResource functionRes) { I_CmsXmlContentValueLocation jspLoc = location.getSubValue("FunctionProvider"); CmsUUID structureId = jspLoc.asId(cms); I_CmsXmlContentValueLocation containerSettings = location.getSubValue("ContainerSettings"); Map<String, String> parameters = parseParameters(cms, location, "Parameter"); if (containerSettings != null) { String type = getStringValue(cms, containerSettings.getSubValue("Type"), ""); String minWidth = getStringValue(cms, containerSettings.getSubValue("MinWidth"), ""); String maxWidth = getStringValue(cms, containerSettings.getSubValue("MaxWidth"), ""); Format result = new Format(structureId, type, minWidth, maxWidth, parameters); return result; } else { Format result = new Format(structureId, "", "", "", parameters); result.setNoContainerSettings(true); return result; } }
java
protected Format getMainFormat(CmsObject cms, I_CmsXmlContentLocation location, CmsResource functionRes) { I_CmsXmlContentValueLocation jspLoc = location.getSubValue("FunctionProvider"); CmsUUID structureId = jspLoc.asId(cms); I_CmsXmlContentValueLocation containerSettings = location.getSubValue("ContainerSettings"); Map<String, String> parameters = parseParameters(cms, location, "Parameter"); if (containerSettings != null) { String type = getStringValue(cms, containerSettings.getSubValue("Type"), ""); String minWidth = getStringValue(cms, containerSettings.getSubValue("MinWidth"), ""); String maxWidth = getStringValue(cms, containerSettings.getSubValue("MaxWidth"), ""); Format result = new Format(structureId, type, minWidth, maxWidth, parameters); return result; } else { Format result = new Format(structureId, "", "", "", parameters); result.setNoContainerSettings(true); return result; } }
[ "protected", "Format", "getMainFormat", "(", "CmsObject", "cms", ",", "I_CmsXmlContentLocation", "location", ",", "CmsResource", "functionRes", ")", "{", "I_CmsXmlContentValueLocation", "jspLoc", "=", "location", ".", "getSubValue", "(", "\"FunctionProvider\"", ")", ";"...
Parses the main format from the XML content.<p> @param cms the current CMS context @param location the location from which to parse main format @param functionRes the dynamic function resource @return the parsed main format
[ "Parses", "the", "main", "format", "from", "the", "XML", "content", ".", "<p", ">", "@param", "cms", "the", "current", "CMS", "context", "@param", "location", "the", "location", "from", "which", "to", "parse", "main", "format", "@param", "functionRes", "the"...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsDynamicFunctionParser.java#L183-L200
btrplace/scheduler
choco/src/main/java/org/btrplace/scheduler/choco/constraint/mttr/CMinMTTR.java
CMinMTTR.placeVMs
private void placeVMs(Parameters ps, List<AbstractStrategy<?>> strategies, List<VMTransition> actions, OnStableNodeFirst schedHeuristic, Map<IntVar, VM> map) { IntValueSelector rnd = new WorstFit(map, rp, new BiggestDimension()); if (!useResources) { rnd = new RandomVMPlacement(rp, map, true, ps.getRandomSeed()); } IntVar[] hosts = dSlices(actions).map(Slice::getHoster).filter(v -> !v.isInstantiated()).toArray(IntVar[]::new); if (hosts.length > 0) { strategies.add(new IntStrategy(hosts, new HostingVariableSelector(rp.getModel(), schedHeuristic), rnd)); } }
java
private void placeVMs(Parameters ps, List<AbstractStrategy<?>> strategies, List<VMTransition> actions, OnStableNodeFirst schedHeuristic, Map<IntVar, VM> map) { IntValueSelector rnd = new WorstFit(map, rp, new BiggestDimension()); if (!useResources) { rnd = new RandomVMPlacement(rp, map, true, ps.getRandomSeed()); } IntVar[] hosts = dSlices(actions).map(Slice::getHoster).filter(v -> !v.isInstantiated()).toArray(IntVar[]::new); if (hosts.length > 0) { strategies.add(new IntStrategy(hosts, new HostingVariableSelector(rp.getModel(), schedHeuristic), rnd)); } }
[ "private", "void", "placeVMs", "(", "Parameters", "ps", ",", "List", "<", "AbstractStrategy", "<", "?", ">", ">", "strategies", ",", "List", "<", "VMTransition", ">", "actions", ",", "OnStableNodeFirst", "schedHeuristic", ",", "Map", "<", "IntVar", ",", "VM"...
/* Try to place the VMs associated on the actions in a random node while trying first to stay on the current node
[ "/", "*", "Try", "to", "place", "the", "VMs", "associated", "on", "the", "actions", "in", "a", "random", "node", "while", "trying", "first", "to", "stay", "on", "the", "current", "node" ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/constraint/mttr/CMinMTTR.java#L186-L195
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/ant/RepositoryDataTask.java
RepositoryDataTask.readSingleSchemaFile
private Database readSingleSchemaFile(DatabaseIO reader, File schemaFile) { Database model = null; if (!schemaFile.isFile()) { log("Path "+schemaFile.getAbsolutePath()+" does not denote a schema file", Project.MSG_ERR); } else if (!schemaFile.canRead()) { log("Could not read schema file "+schemaFile.getAbsolutePath(), Project.MSG_ERR); } else { try { model = reader.read(schemaFile); log("Read schema file "+schemaFile.getAbsolutePath(), Project.MSG_INFO); } catch (Exception ex) { throw new BuildException("Could not read schema file "+schemaFile.getAbsolutePath()+": "+ex.getLocalizedMessage(), ex); } } return model; }
java
private Database readSingleSchemaFile(DatabaseIO reader, File schemaFile) { Database model = null; if (!schemaFile.isFile()) { log("Path "+schemaFile.getAbsolutePath()+" does not denote a schema file", Project.MSG_ERR); } else if (!schemaFile.canRead()) { log("Could not read schema file "+schemaFile.getAbsolutePath(), Project.MSG_ERR); } else { try { model = reader.read(schemaFile); log("Read schema file "+schemaFile.getAbsolutePath(), Project.MSG_INFO); } catch (Exception ex) { throw new BuildException("Could not read schema file "+schemaFile.getAbsolutePath()+": "+ex.getLocalizedMessage(), ex); } } return model; }
[ "private", "Database", "readSingleSchemaFile", "(", "DatabaseIO", "reader", ",", "File", "schemaFile", ")", "{", "Database", "model", "=", "null", ";", "if", "(", "!", "schemaFile", ".", "isFile", "(", ")", ")", "{", "log", "(", "\"Path \"", "+", "schemaFi...
Reads a single schema file. @param reader The schema reader @param schemaFile The schema file @return The model
[ "Reads", "a", "single", "schema", "file", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/ant/RepositoryDataTask.java#L238-L263
javagl/Common
src/main/java/de/javagl/common/xml/XmlUtils.java
XmlUtils.verifyNode
public static void verifyNode(Node node, String expected) { if (node == null) { throw new XmlException( "Did not find <"+expected+"> node"); } if (!node.getNodeName().equalsIgnoreCase(expected)) { throw new XmlException( "Expected <"+expected+"> tag, " + "but found <"+node.getNodeName()+">"); } }
java
public static void verifyNode(Node node, String expected) { if (node == null) { throw new XmlException( "Did not find <"+expected+"> node"); } if (!node.getNodeName().equalsIgnoreCase(expected)) { throw new XmlException( "Expected <"+expected+"> tag, " + "but found <"+node.getNodeName()+">"); } }
[ "public", "static", "void", "verifyNode", "(", "Node", "node", ",", "String", "expected", ")", "{", "if", "(", "node", "==", "null", ")", "{", "throw", "new", "XmlException", "(", "\"Did not find <\"", "+", "expected", "+", "\"> node\"", ")", ";", "}", "...
Verify that the given node is not <code>null</code>, and that its name matches the expected tag name (ignoring upper/lowercase), and throw an XmlException if this is not the case. @param node The node @param expected The expected tag name @throws XmlException If the node is <code>null</code>, or the node name does not match the expected name
[ "Verify", "that", "the", "given", "node", "is", "not", "<code", ">", "null<", "/", "code", ">", "and", "that", "its", "name", "matches", "the", "expected", "tag", "name", "(", "ignoring", "upper", "/", "lowercase", ")", "and", "throw", "an", "XmlExceptio...
train
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/xml/XmlUtils.java#L438-L451
ModeShape/modeshape
index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/EsIndex.java
EsIndex.putValues
private void putValues(EsRequest doc, EsIndexColumn column, Object[] value) { Object[] columnValue = column.columnValues(value); int[] ln = new int[columnValue.length]; String[] lc = new String[columnValue.length]; String[] uc = new String[columnValue.length]; for (int i = 0; i < columnValue.length; i++) { String stringValue = column.stringValue(columnValue[i]); lc[i] = stringValue.toLowerCase(); uc[i] = stringValue.toUpperCase(); ln[i] = stringValue.length(); } doc.put(column.getName(), columnValue); doc.put(column.getLowerCaseFieldName(), lc); doc.put(column.getUpperCaseFieldName(), uc); doc.put(column.getLengthFieldName(), ln); }
java
private void putValues(EsRequest doc, EsIndexColumn column, Object[] value) { Object[] columnValue = column.columnValues(value); int[] ln = new int[columnValue.length]; String[] lc = new String[columnValue.length]; String[] uc = new String[columnValue.length]; for (int i = 0; i < columnValue.length; i++) { String stringValue = column.stringValue(columnValue[i]); lc[i] = stringValue.toLowerCase(); uc[i] = stringValue.toUpperCase(); ln[i] = stringValue.length(); } doc.put(column.getName(), columnValue); doc.put(column.getLowerCaseFieldName(), lc); doc.put(column.getUpperCaseFieldName(), uc); doc.put(column.getLengthFieldName(), ln); }
[ "private", "void", "putValues", "(", "EsRequest", "doc", ",", "EsIndexColumn", "column", ",", "Object", "[", "]", "value", ")", "{", "Object", "[", "]", "columnValue", "=", "column", ".", "columnValues", "(", "value", ")", ";", "int", "[", "]", "ln", "...
Appends specified values for the given column and related pseudo columns into list of properties. @param doc list of properties in json format @param column colum definition @param value column's value.
[ "Appends", "specified", "values", "for", "the", "given", "column", "and", "related", "pseudo", "columns", "into", "list", "of", "properties", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/EsIndex.java#L228-L245
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java
ComputeNodeOperations.reimageComputeNode
public void reimageComputeNode(String poolId, String nodeId, ComputeNodeReimageOption nodeReimageOption, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { ComputeNodeReimageOptions options = new ComputeNodeReimageOptions(); BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); bhMgr.applyRequestBehaviors(options); this.parentBatchClient.protocolLayer().computeNodes().reimage(poolId, nodeId, nodeReimageOption, options); }
java
public void reimageComputeNode(String poolId, String nodeId, ComputeNodeReimageOption nodeReimageOption, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { ComputeNodeReimageOptions options = new ComputeNodeReimageOptions(); BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); bhMgr.applyRequestBehaviors(options); this.parentBatchClient.protocolLayer().computeNodes().reimage(poolId, nodeId, nodeReimageOption, options); }
[ "public", "void", "reimageComputeNode", "(", "String", "poolId", ",", "String", "nodeId", ",", "ComputeNodeReimageOption", "nodeReimageOption", ",", "Iterable", "<", "BatchClientBehavior", ">", "additionalBehaviors", ")", "throws", "BatchErrorException", ",", "IOException...
Reinstalls the operating system on the specified compute node. <p>You can reimage a compute node only when it is in the {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#IDLE Idle} or {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#RUNNING Running} state.</p> @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node to reimage. @param nodeReimageOption Specifies when to reimage the node and what to do with currently running tasks. @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Reinstalls", "the", "operating", "system", "on", "the", "specified", "compute", "node", ".", "<p", ">", "You", "can", "reimage", "a", "compute", "node", "only", "when", "it", "is", "in", "the", "{", "@link", "com", ".", "microsoft", ".", "azure", ".", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java#L352-L358
alkacon/opencms-core
src/org/opencms/i18n/CmsEncoder.java
CmsEncoder.escape
public static String escape(String source, String encoding) { // the blank is encoded into "+" not "%20" when using standard encode call return CmsStringUtil.substitute(encode(source, encoding), "+", "%20"); }
java
public static String escape(String source, String encoding) { // the blank is encoded into "+" not "%20" when using standard encode call return CmsStringUtil.substitute(encode(source, encoding), "+", "%20"); }
[ "public", "static", "String", "escape", "(", "String", "source", ",", "String", "encoding", ")", "{", "// the blank is encoded into \"+\" not \"%20\" when using standard encode call", "return", "CmsStringUtil", ".", "substitute", "(", "encode", "(", "source", ",", "encodi...
Encodes a String in a way similar to the JavaScript "encodeURIcomponent" function.<p> JavaScript "decodeURIcomponent" can decode Strings that have been encoded using this method, provided "UTF-8" has been used as encoding.<p> <b>Directly exposed for JSP EL<b>, not through {@link org.opencms.jsp.util.CmsJspElFunctions}.<p> @param source The text to be encoded @param encoding the encoding type @return The encoded string
[ "Encodes", "a", "String", "in", "a", "way", "similar", "to", "the", "JavaScript", "encodeURIcomponent", "function", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsEncoder.java#L575-L579
fnklabs/draenei
src/main/java/com/fnklabs/draenei/CassandraClient.java
CassandraClient.executeAsync
public ResultSetFuture executeAsync(@NotNull String keyspace, @NotNull String query) { Timer time = getMetricsFactory().getTimer(MetricsType.CASSANDRA_EXECUTE_ASYNC.name()); getMetricsFactory().getCounter(MetricsType.CASSANDRA_PROCESSING_QUERIES.name()).inc(); ResultSetFuture resultSetFuture = getOrCreateSession(keyspace).executeAsync(query); Futures.addCallback(resultSetFuture, new StatementExecutionCallback(keyspace, query)); monitorFuture(time, resultSetFuture); return resultSetFuture; }
java
public ResultSetFuture executeAsync(@NotNull String keyspace, @NotNull String query) { Timer time = getMetricsFactory().getTimer(MetricsType.CASSANDRA_EXECUTE_ASYNC.name()); getMetricsFactory().getCounter(MetricsType.CASSANDRA_PROCESSING_QUERIES.name()).inc(); ResultSetFuture resultSetFuture = getOrCreateSession(keyspace).executeAsync(query); Futures.addCallback(resultSetFuture, new StatementExecutionCallback(keyspace, query)); monitorFuture(time, resultSetFuture); return resultSetFuture; }
[ "public", "ResultSetFuture", "executeAsync", "(", "@", "NotNull", "String", "keyspace", ",", "@", "NotNull", "String", "query", ")", "{", "Timer", "time", "=", "getMetricsFactory", "(", ")", ".", "getTimer", "(", "MetricsType", ".", "CASSANDRA_EXECUTE_ASYNC", "....
Execute cql query asynchronously @param query CQL query @return ResultSetFuture
[ "Execute", "cql", "query", "asynchronously" ]
train
https://github.com/fnklabs/draenei/blob/0a8cac54f1f635be3e2950375a23291d38453ae8/src/main/java/com/fnklabs/draenei/CassandraClient.java#L274-L286
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/Debug.java
Debug.getInstance
public static Debug getInstance(String option, String prefix) { if (isOn(option)) { Debug d = new Debug(prefix); return d; } else { return null; } }
java
public static Debug getInstance(String option, String prefix) { if (isOn(option)) { Debug d = new Debug(prefix); return d; } else { return null; } }
[ "public", "static", "Debug", "getInstance", "(", "String", "option", ",", "String", "prefix", ")", "{", "if", "(", "isOn", "(", "option", ")", ")", "{", "Debug", "d", "=", "new", "Debug", "(", "prefix", ")", ";", "return", "d", ";", "}", "else", "{...
Get a Debug object corresponding to whether or not the given option is set. Set the prefix to be prefix.
[ "Get", "a", "Debug", "object", "corresponding", "to", "whether", "or", "not", "the", "given", "option", "is", "set", ".", "Set", "the", "prefix", "to", "be", "prefix", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/Debug.java#L117-L125
Terracotta-OSS/offheap-store
src/main/java/org/terracotta/offheapstore/paging/OffHeapStorageArea.java
OffHeapStorageArea.readBuffer
public ByteBuffer readBuffer(long address, int length) { ByteBuffer[] buffers = readBuffers(address, length); if (buffers.length == 1) { return buffers[0]; } else { ByteBuffer copy = ByteBuffer.allocate(length); for (ByteBuffer b : buffers) { copy.put(b); } return ((ByteBuffer) copy.flip()).asReadOnlyBuffer(); } }
java
public ByteBuffer readBuffer(long address, int length) { ByteBuffer[] buffers = readBuffers(address, length); if (buffers.length == 1) { return buffers[0]; } else { ByteBuffer copy = ByteBuffer.allocate(length); for (ByteBuffer b : buffers) { copy.put(b); } return ((ByteBuffer) copy.flip()).asReadOnlyBuffer(); } }
[ "public", "ByteBuffer", "readBuffer", "(", "long", "address", ",", "int", "length", ")", "{", "ByteBuffer", "[", "]", "buffers", "=", "readBuffers", "(", "address", ",", "length", ")", ";", "if", "(", "buffers", ".", "length", "==", "1", ")", "{", "ret...
Read the given range and return the data as a single read-only {@code ByteBuffer}. @param address address to read from @param length number of bytes to read @return a read-only buffer
[ "Read", "the", "given", "range", "and", "return", "the", "data", "as", "a", "single", "read", "-", "only", "{", "@code", "ByteBuffer", "}", "." ]
train
https://github.com/Terracotta-OSS/offheap-store/blob/600486cddb33c0247025c0cb69eff289eb6d7d93/src/main/java/org/terracotta/offheapstore/paging/OffHeapStorageArea.java#L214-L225
kaazing/gateway
resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/uri/URIUtils.java
URIUtils.modifyURIPath
public static String modifyURIPath(String uri, String newPath) { try { URI uriObj = new URI(uri); return uriToString(URLUtils.modifyURIPath(uriObj, newPath)); } catch (URISyntaxException e) { try { return (new NetworkInterfaceURI(uri)).modifyURIPath(newPath); } catch (IllegalArgumentException ne) { throw new IllegalArgumentException(ne.getMessage(), ne); } } }
java
public static String modifyURIPath(String uri, String newPath) { try { URI uriObj = new URI(uri); return uriToString(URLUtils.modifyURIPath(uriObj, newPath)); } catch (URISyntaxException e) { try { return (new NetworkInterfaceURI(uri)).modifyURIPath(newPath); } catch (IllegalArgumentException ne) { throw new IllegalArgumentException(ne.getMessage(), ne); } } }
[ "public", "static", "String", "modifyURIPath", "(", "String", "uri", ",", "String", "newPath", ")", "{", "try", "{", "URI", "uriObj", "=", "new", "URI", "(", "uri", ")", ";", "return", "uriToString", "(", "URLUtils", ".", "modifyURIPath", "(", "uriObj", ...
Helper method for modiffying the URI path @param uri @param newPath @return
[ "Helper", "method", "for", "modiffying", "the", "URI", "path" ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/uri/URIUtils.java#L356-L369
floragunncom/search-guard
src/main/java/com/floragunn/searchguard/support/WildcardMatcher.java
WildcardMatcher.matchAny
public static boolean matchAny(final String pattern, final String[] candidate, boolean ignoreCase) { for (int i = 0; i < candidate.length; i++) { final String string = candidate[i]; if (match(pattern, string, ignoreCase)) { return true; } } return false; }
java
public static boolean matchAny(final String pattern, final String[] candidate, boolean ignoreCase) { for (int i = 0; i < candidate.length; i++) { final String string = candidate[i]; if (match(pattern, string, ignoreCase)) { return true; } } return false; }
[ "public", "static", "boolean", "matchAny", "(", "final", "String", "pattern", ",", "final", "String", "[", "]", "candidate", ",", "boolean", "ignoreCase", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "candidate", ".", "length", ";", "i", ...
return true if at least one candidate matches the given pattern @param pattern @param candidate @param ignoreCase @return
[ "return", "true", "if", "at", "least", "one", "candidate", "matches", "the", "given", "pattern" ]
train
https://github.com/floragunncom/search-guard/blob/f9828004e11dc0e4b6da4dead1fafcf3be8f7f6d/src/main/java/com/floragunn/searchguard/support/WildcardMatcher.java#L168-L178
Hygieia/Hygieia
api-audit/src/main/java/com/capitalone/dashboard/evaluator/CodeReviewEvaluatorLegacy.java
CodeReviewEvaluatorLegacy.getErrorResponse
protected CodeReviewAuditResponse getErrorResponse(CollectorItem repoItem, String scmBranch, String scmUrl) { CodeReviewAuditResponse noPRsCodeReviewAuditResponse = new CodeReviewAuditResponse(); noPRsCodeReviewAuditResponse.addAuditStatus(COLLECTOR_ITEM_ERROR); noPRsCodeReviewAuditResponse.setLastUpdated(repoItem.getLastUpdated()); noPRsCodeReviewAuditResponse.setScmBranch(scmBranch); noPRsCodeReviewAuditResponse.setScmUrl(scmUrl); noPRsCodeReviewAuditResponse.setErrorMessage(repoItem.getErrors().get(0).getErrorMessage()); return noPRsCodeReviewAuditResponse; }
java
protected CodeReviewAuditResponse getErrorResponse(CollectorItem repoItem, String scmBranch, String scmUrl) { CodeReviewAuditResponse noPRsCodeReviewAuditResponse = new CodeReviewAuditResponse(); noPRsCodeReviewAuditResponse.addAuditStatus(COLLECTOR_ITEM_ERROR); noPRsCodeReviewAuditResponse.setLastUpdated(repoItem.getLastUpdated()); noPRsCodeReviewAuditResponse.setScmBranch(scmBranch); noPRsCodeReviewAuditResponse.setScmUrl(scmUrl); noPRsCodeReviewAuditResponse.setErrorMessage(repoItem.getErrors().get(0).getErrorMessage()); return noPRsCodeReviewAuditResponse; }
[ "protected", "CodeReviewAuditResponse", "getErrorResponse", "(", "CollectorItem", "repoItem", ",", "String", "scmBranch", ",", "String", "scmUrl", ")", "{", "CodeReviewAuditResponse", "noPRsCodeReviewAuditResponse", "=", "new", "CodeReviewAuditResponse", "(", ")", ";", "n...
Return an empty response in error situation @param repoItem the repo item @param scmBranch the scrm branch @param scmUrl the scm url @return code review audit response
[ "Return", "an", "empty", "response", "in", "error", "situation" ]
train
https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/api-audit/src/main/java/com/capitalone/dashboard/evaluator/CodeReviewEvaluatorLegacy.java#L69-L78
lessthanoptimal/BoofCV
main/boofcv-types/src/main/java/boofcv/concurrency/BoofConcurrency.java
BoofConcurrency.min
public static Number min(int start , int endExclusive , Class type, IntProducerNumber producer ) { try { return pool.submit(new IntOperatorTask.Min(start,endExclusive,type,producer)).get(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } }
java
public static Number min(int start , int endExclusive , Class type, IntProducerNumber producer ) { try { return pool.submit(new IntOperatorTask.Min(start,endExclusive,type,producer)).get(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } }
[ "public", "static", "Number", "min", "(", "int", "start", ",", "int", "endExclusive", ",", "Class", "type", ",", "IntProducerNumber", "producer", ")", "{", "try", "{", "return", "pool", ".", "submit", "(", "new", "IntOperatorTask", ".", "Min", "(", "start"...
Computes the maximum value @param start First index, inclusive @param endExclusive Last index, exclusive @param type Primtive data type, e.g. int.class, float.class, double.class @param producer Given an integer input produce a Number output @return The sum
[ "Computes", "the", "maximum", "value" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/concurrency/BoofConcurrency.java#L200-L206
Wolfgang-Schuetzelhofer/jcypher
src/main/java/iot/jcypher/domain/DomainAccessFactory.java
DomainAccessFactory.createDomainAccess
public static IDomainAccess createDomainAccess(IDBAccess dbAccess, String domainName) { return IDomainAccessFactory.INSTANCE.createDomainAccess(dbAccess, domainName); }
java
public static IDomainAccess createDomainAccess(IDBAccess dbAccess, String domainName) { return IDomainAccessFactory.INSTANCE.createDomainAccess(dbAccess, domainName); }
[ "public", "static", "IDomainAccess", "createDomainAccess", "(", "IDBAccess", "dbAccess", ",", "String", "domainName", ")", "{", "return", "IDomainAccessFactory", ".", "INSTANCE", ".", "createDomainAccess", "(", "dbAccess", ",", "domainName", ")", ";", "}" ]
Create a domain accessor. @param dbAccess the graph database connection @param domainName @return
[ "Create", "a", "domain", "accessor", "." ]
train
https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/domain/DomainAccessFactory.java#L34-L36
oboehm/jfachwert
src/main/java/de/jfachwert/post/Adresse.java
Adresse.of
public static Adresse of(Ort ort, String strasse) { List<String> splitted = toStrasseHausnummer(strasse); return of(ort, splitted.get(0), splitted.get(1)); }
java
public static Adresse of(Ort ort, String strasse) { List<String> splitted = toStrasseHausnummer(strasse); return of(ort, splitted.get(0), splitted.get(1)); }
[ "public", "static", "Adresse", "of", "(", "Ort", "ort", ",", "String", "strasse", ")", "{", "List", "<", "String", ">", "splitted", "=", "toStrasseHausnummer", "(", "strasse", ")", ";", "return", "of", "(", "ort", ",", "splitted", ".", "get", "(", "0",...
Liefert eine Adresse mit den uebergebenen Parametern. @param ort Ort @param strasse Strasse mit oder ohne Hausnummer @return Adresse
[ "Liefert", "eine", "Adresse", "mit", "den", "uebergebenen", "Parametern", "." ]
train
https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/post/Adresse.java#L142-L145
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/ServletStartedListener.java
ServletStartedListener.setModuleSecurityMetaData
private void setModuleSecurityMetaData(Container moduleContainer, SecurityMetadata securityMetadataFromDD) { try { WebModuleMetaData wmmd = moduleContainer.adapt(WebModuleMetaData.class); wmmd.setSecurityMetaData(securityMetadataFromDD); } catch (UnableToAdaptException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "There was a problem setting the security meta data.", e); } } }
java
private void setModuleSecurityMetaData(Container moduleContainer, SecurityMetadata securityMetadataFromDD) { try { WebModuleMetaData wmmd = moduleContainer.adapt(WebModuleMetaData.class); wmmd.setSecurityMetaData(securityMetadataFromDD); } catch (UnableToAdaptException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "There was a problem setting the security meta data.", e); } } }
[ "private", "void", "setModuleSecurityMetaData", "(", "Container", "moduleContainer", ",", "SecurityMetadata", "securityMetadataFromDD", ")", "{", "try", "{", "WebModuleMetaData", "wmmd", "=", "moduleContainer", ".", "adapt", "(", "WebModuleMetaData", ".", "class", ")", ...
Sets the given security metadata on the deployed module's web module metadata for retrieval later. @param deployedModule the deployed module to get the web module metadata @param securityMetadataFromDD the security metadata processed from the deployment descriptor
[ "Sets", "the", "given", "security", "metadata", "on", "the", "deployed", "module", "s", "web", "module", "metadata", "for", "retrieval", "later", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/ServletStartedListener.java#L460-L469
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/APIClient.java
APIClient.updateApiKey
public JSONObject updateApiKey(String key, List<String> acls) throws AlgoliaException { return this.updateApiKey(key, acls, RequestOptions.empty); }
java
public JSONObject updateApiKey(String key, List<String> acls) throws AlgoliaException { return this.updateApiKey(key, acls, RequestOptions.empty); }
[ "public", "JSONObject", "updateApiKey", "(", "String", "key", ",", "List", "<", "String", ">", "acls", ")", "throws", "AlgoliaException", "{", "return", "this", ".", "updateApiKey", "(", "key", ",", "acls", ",", "RequestOptions", ".", "empty", ")", ";", "}...
Update an api key @param acls the list of ACL for this key. Defined by an array of strings that can contains the following values: - search: allow to search (https and http) - addObject: allows to add/update an object in the index (https only) - deleteObject : allows to delete an existing object (https only) - deleteIndex : allows to delete index content (https only) - settings : allows to get index settings (https only) - editSettings : allows to change index settings (https only)
[ "Update", "an", "api", "key" ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/APIClient.java#L735-L737
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java
GISCoordinates.L3_L4
@Pure public static Point2d L3_L4(double x, double y) { final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y, LAMBERT_3_N, LAMBERT_3_C, LAMBERT_3_XS, LAMBERT_3_YS); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_4_N, LAMBERT_4_C, LAMBERT_4_XS, LAMBERT_4_YS); }
java
@Pure public static Point2d L3_L4(double x, double y) { final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y, LAMBERT_3_N, LAMBERT_3_C, LAMBERT_3_XS, LAMBERT_3_YS); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_4_N, LAMBERT_4_C, LAMBERT_4_XS, LAMBERT_4_YS); }
[ "@", "Pure", "public", "static", "Point2d", "L3_L4", "(", "double", "x", ",", "double", "y", ")", "{", "final", "Point2d", "ntfLambdaPhi", "=", "NTFLambert_NTFLambdaPhi", "(", "x", ",", "y", ",", "LAMBERT_3_N", ",", "LAMBERT_3_C", ",", "LAMBERT_3_XS", ",", ...
This function convert France Lambert III coordinate to France Lambert IV coordinate. @param x is the coordinate in France Lambert III @param y is the coordinate in France Lambert III @return the France Lambert IV coordinate.
[ "This", "function", "convert", "France", "Lambert", "III", "coordinate", "to", "France", "Lambert", "IV", "coordinate", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L628-L641
apiman/apiman
gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/InMemoryRegistry.java
InMemoryRegistry.getApiIndex
private String getApiIndex(String orgId, String apiId, String version) { return "API::" + orgId + "|" + apiId + "|" + version; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ }
java
private String getApiIndex(String orgId, String apiId, String version) { return "API::" + orgId + "|" + apiId + "|" + version; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ }
[ "private", "String", "getApiIndex", "(", "String", "orgId", ",", "String", "apiId", ",", "String", "version", ")", "{", "return", "\"API::\"", "+", "orgId", "+", "\"|\"", "+", "apiId", "+", "\"|\"", "+", "version", ";", "//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$...
Generates an in-memory key for an api, used to index the client for later quick retrieval. @param orgId @param apiId @param version @return a api key
[ "Generates", "an", "in", "-", "memory", "key", "for", "an", "api", "used", "to", "index", "the", "client", "for", "later", "quick", "retrieval", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/InMemoryRegistry.java#L339-L341
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/map/impl/recordstore/BasicRecordStoreLoader.java
BasicRecordStoreLoader.loadValues
@Override public Future<?> loadValues(List<Data> keys, boolean replaceExistingValues) { Callable task = new GivenKeysLoaderTask(keys, replaceExistingValues); return executeTask(MAP_LOADER_EXECUTOR, task); }
java
@Override public Future<?> loadValues(List<Data> keys, boolean replaceExistingValues) { Callable task = new GivenKeysLoaderTask(keys, replaceExistingValues); return executeTask(MAP_LOADER_EXECUTOR, task); }
[ "@", "Override", "public", "Future", "<", "?", ">", "loadValues", "(", "List", "<", "Data", ">", "keys", ",", "boolean", "replaceExistingValues", ")", "{", "Callable", "task", "=", "new", "GivenKeysLoaderTask", "(", "keys", ",", "replaceExistingValues", ")", ...
{@inheritDoc} <p> Offloads the value loading task to the {@link ExecutionService#MAP_LOADER_EXECUTOR} executor.
[ "{" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/recordstore/BasicRecordStoreLoader.java#L73-L77
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java
NameNode.getBlocks
public BlocksWithLocations getBlocks(DatanodeInfo datanode, long size) throws IOException { if(size <= 0) { throw new IllegalArgumentException( "Unexpected not positive size: "+size); } return namesystem.getBlocks(datanode, size); }
java
public BlocksWithLocations getBlocks(DatanodeInfo datanode, long size) throws IOException { if(size <= 0) { throw new IllegalArgumentException( "Unexpected not positive size: "+size); } return namesystem.getBlocks(datanode, size); }
[ "public", "BlocksWithLocations", "getBlocks", "(", "DatanodeInfo", "datanode", ",", "long", "size", ")", "throws", "IOException", "{", "if", "(", "size", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Unexpected not positive size: \"", "+",...
return a list of blocks & their locations on <code>datanode</code> whose total size is <code>size</code> @param datanode on which blocks are located @param size total size of blocks
[ "return", "a", "list", "of", "blocks", "&", "their", "locations", "on", "<code", ">", "datanode<", "/", "code", ">", "whose", "total", "size", "is", "<code", ">", "size<", "/", "code", ">" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java#L750-L758
facebook/fresco
animated-base/src/main/java/com/facebook/fresco/animation/drawable/animator/AnimatedDrawableValueAnimatorHelper.java
AnimatedDrawableValueAnimatorHelper.createValueAnimator
@Nullable public static ValueAnimator createValueAnimator(Drawable drawable, int maxDurationMs) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { return null; } if (drawable instanceof AnimatedDrawable2) { return AnimatedDrawable2ValueAnimatorHelper.createValueAnimator( (AnimatedDrawable2) drawable, maxDurationMs); } return null; }
java
@Nullable public static ValueAnimator createValueAnimator(Drawable drawable, int maxDurationMs) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { return null; } if (drawable instanceof AnimatedDrawable2) { return AnimatedDrawable2ValueAnimatorHelper.createValueAnimator( (AnimatedDrawable2) drawable, maxDurationMs); } return null; }
[ "@", "Nullable", "public", "static", "ValueAnimator", "createValueAnimator", "(", "Drawable", "drawable", ",", "int", "maxDurationMs", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", "<", "Build", ".", "VERSION_CODES", ".", "HONEYCOMB", ")", "{",...
Create a value animator for the given animation drawable and max animation duration in ms. @param drawable the drawable to create the animator for @param maxDurationMs the max duration in ms @return the animator to use
[ "Create", "a", "value", "animator", "for", "the", "given", "animation", "drawable", "and", "max", "animation", "duration", "in", "ms", "." ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/animated-base/src/main/java/com/facebook/fresco/animation/drawable/animator/AnimatedDrawableValueAnimatorHelper.java#L31-L43
OpenLiberty/open-liberty
dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLWriteServiceContext.java
SSLWriteServiceContext.checkForErrors
private IOException checkForErrors(long numBytes, boolean async) { IOException exception = null; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "checkForErrors: numBytes=" + numBytes + " buffers=" + SSLUtils.getBufferTraceInfo(getBuffers())); } // Extract the buffers provided by the calling channel. WsByteBuffer callerBuffers[] = getBuffers(); if (callerBuffers == null || callerBuffers.length == 0) { exception = new IOException("No buffer(s) provided for writing data."); } else if ((numBytes < -1) || (numBytes == 0) && (async)) { // NumBytes requested must be -1 (write all) or positive exception = new IOException("Number of bytes requested, " + numBytes + " is not valid."); } else { // Ensure buffer provided by caller is big enough to contain the number of bytes requested. int bytesAvail = WsByteBufferUtils.lengthOf(callerBuffers); if (bytesAvail < numBytes) { exception = new IOException("Number of bytes requested, " + numBytes + " exceeds space remaining in the buffers provided: " + bytesAvail); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() && exception != null) { Tr.debug(tc, "Found error, exception generated: " + exception); } return exception; }
java
private IOException checkForErrors(long numBytes, boolean async) { IOException exception = null; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "checkForErrors: numBytes=" + numBytes + " buffers=" + SSLUtils.getBufferTraceInfo(getBuffers())); } // Extract the buffers provided by the calling channel. WsByteBuffer callerBuffers[] = getBuffers(); if (callerBuffers == null || callerBuffers.length == 0) { exception = new IOException("No buffer(s) provided for writing data."); } else if ((numBytes < -1) || (numBytes == 0) && (async)) { // NumBytes requested must be -1 (write all) or positive exception = new IOException("Number of bytes requested, " + numBytes + " is not valid."); } else { // Ensure buffer provided by caller is big enough to contain the number of bytes requested. int bytesAvail = WsByteBufferUtils.lengthOf(callerBuffers); if (bytesAvail < numBytes) { exception = new IOException("Number of bytes requested, " + numBytes + " exceeds space remaining in the buffers provided: " + bytesAvail); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() && exception != null) { Tr.debug(tc, "Found error, exception generated: " + exception); } return exception; }
[ "private", "IOException", "checkForErrors", "(", "long", "numBytes", ",", "boolean", "async", ")", "{", "IOException", "exception", "=", "null", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")"...
Check the status of the buffers set by the caller taking into account the JITAllocation size if the buffers are null or verifying there is space available in the the buffers based on the size of data requested. @param numBytes @param async @return IOException if an inconsistency/error is found in the request, null otherwise.
[ "Check", "the", "status", "of", "the", "buffers", "set", "by", "the", "caller", "taking", "into", "account", "the", "JITAllocation", "size", "if", "the", "buffers", "are", "null", "or", "verifying", "there", "is", "space", "available", "in", "the", "the", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLWriteServiceContext.java#L404-L431
apache/flink
flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
SqlValidatorImpl.isValuesWithDefault
private boolean isValuesWithDefault(SqlNode source, int column) { switch (source.getKind()) { case VALUES: for (SqlNode operand : ((SqlCall) source).getOperandList()) { if (!isRowWithDefault(operand, column)) { return false; } } return true; } return false; }
java
private boolean isValuesWithDefault(SqlNode source, int column) { switch (source.getKind()) { case VALUES: for (SqlNode operand : ((SqlCall) source).getOperandList()) { if (!isRowWithDefault(operand, column)) { return false; } } return true; } return false; }
[ "private", "boolean", "isValuesWithDefault", "(", "SqlNode", "source", ",", "int", "column", ")", "{", "switch", "(", "source", ".", "getKind", "(", ")", ")", "{", "case", "VALUES", ":", "for", "(", "SqlNode", "operand", ":", "(", "(", "SqlCall", ")", ...
Returns whether a query uses {@code DEFAULT} to populate a given column.
[ "Returns", "whether", "a", "query", "uses", "{" ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L4407-L4418
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/policy/policyhttpcallout.java
policyhttpcallout.get
public static policyhttpcallout get(nitro_service service, String name) throws Exception{ policyhttpcallout obj = new policyhttpcallout(); obj.set_name(name); policyhttpcallout response = (policyhttpcallout) obj.get_resource(service); return response; }
java
public static policyhttpcallout get(nitro_service service, String name) throws Exception{ policyhttpcallout obj = new policyhttpcallout(); obj.set_name(name); policyhttpcallout response = (policyhttpcallout) obj.get_resource(service); return response; }
[ "public", "static", "policyhttpcallout", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "policyhttpcallout", "obj", "=", "new", "policyhttpcallout", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", ...
Use this API to fetch policyhttpcallout resource of given name .
[ "Use", "this", "API", "to", "fetch", "policyhttpcallout", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/policy/policyhttpcallout.java#L637-L642
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchRunner.java
IdentityPatchRunner.createTask
static PatchingTask createTask(final PatchingTasks.ContentTaskDefinition definition, final PatchContentProvider provider, final IdentityPatchContext.PatchEntry context) { final PatchContentLoader contentLoader = provider.getLoader(definition.getTarget().getPatchId()); final PatchingTaskDescription description = PatchingTaskDescription.create(definition, contentLoader); return PatchingTask.Factory.create(description, context); }
java
static PatchingTask createTask(final PatchingTasks.ContentTaskDefinition definition, final PatchContentProvider provider, final IdentityPatchContext.PatchEntry context) { final PatchContentLoader contentLoader = provider.getLoader(definition.getTarget().getPatchId()); final PatchingTaskDescription description = PatchingTaskDescription.create(definition, contentLoader); return PatchingTask.Factory.create(description, context); }
[ "static", "PatchingTask", "createTask", "(", "final", "PatchingTasks", ".", "ContentTaskDefinition", "definition", ",", "final", "PatchContentProvider", "provider", ",", "final", "IdentityPatchContext", ".", "PatchEntry", "context", ")", "{", "final", "PatchContentLoader"...
Create the patching task based on the definition. @param definition the task description @param provider the content provider @param context the task context @return the created task
[ "Create", "the", "patching", "task", "based", "on", "the", "definition", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchRunner.java#L699-L703
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/server/UTCDateTimeUtils.java
UTCDateTimeUtils.getTimeBoxValue
public static final Long getTimeBoxValue(TimeZone zone, Date date) { if (date == null) return null; // use a Calendar in the specified timezone to figure out the // time which is edited in a format independent of TimeZone. Calendar cal = GregorianCalendar.getInstance(zone); cal.setTime(date); // hh:mm (seconds and milliseconds are generally zero but we // include them as well) int hours = cal.get(Calendar.HOUR_OF_DAY); int minutes = cal.get(Calendar.MINUTE); int seconds = cal.get(Calendar.SECOND); int millis = cal.get(Calendar.MILLISECOND); return (((((hours * 60L) + minutes) * 60L) + seconds) * 1000L) + millis; }
java
public static final Long getTimeBoxValue(TimeZone zone, Date date) { if (date == null) return null; // use a Calendar in the specified timezone to figure out the // time which is edited in a format independent of TimeZone. Calendar cal = GregorianCalendar.getInstance(zone); cal.setTime(date); // hh:mm (seconds and milliseconds are generally zero but we // include them as well) int hours = cal.get(Calendar.HOUR_OF_DAY); int minutes = cal.get(Calendar.MINUTE); int seconds = cal.get(Calendar.SECOND); int millis = cal.get(Calendar.MILLISECOND); return (((((hours * 60L) + minutes) * 60L) + seconds) * 1000L) + millis; }
[ "public", "static", "final", "Long", "getTimeBoxValue", "(", "TimeZone", "zone", ",", "Date", "date", ")", "{", "if", "(", "date", "==", "null", ")", "return", "null", ";", "// use a Calendar in the specified timezone to figure out the", "// time which is edited in a fo...
Returns an appropriate value for the UTCTimeBox for a specified {@link TimeZone} and {@link Date}. @param zone The {@link TimeZone} in which the Date will be rendered. @param date The Date which should be displayed in the UTCTimeBox @return the value for the UTCTimeBox or null if the supplied date is null
[ "Returns", "an", "appropriate", "value", "for", "the", "UTCTimeBox", "for", "a", "specified", "{", "@link", "TimeZone", "}", "and", "{", "@link", "Date", "}", "." ]
train
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/server/UTCDateTimeUtils.java#L48-L65
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/junit/JUnit4Monitor.java
JUnit4Monitor.isOnStack
private static boolean isOnStack(int moreThan, String canonicalName) { StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); int count = 0; for (StackTraceElement element : stackTrace) { if (element.getClassName().startsWith(canonicalName)) { count++; } } return count > moreThan; }
java
private static boolean isOnStack(int moreThan, String canonicalName) { StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); int count = 0; for (StackTraceElement element : stackTrace) { if (element.getClassName().startsWith(canonicalName)) { count++; } } return count > moreThan; }
[ "private", "static", "boolean", "isOnStack", "(", "int", "moreThan", ",", "String", "canonicalName", ")", "{", "StackTraceElement", "[", "]", "stackTrace", "=", "Thread", ".", "currentThread", "(", ")", ".", "getStackTrace", "(", ")", ";", "int", "count", "=...
Checks if the given name is on stack more than the given number of times. This method uses startsWith to check if the given name is on stack, so one can pass a package name too. Intentionally duplicate.
[ "Checks", "if", "the", "given", "name", "is", "on", "stack", "more", "than", "the", "given", "number", "of", "times", ".", "This", "method", "uses", "startsWith", "to", "check", "if", "the", "given", "name", "is", "on", "stack", "so", "one", "can", "pa...
train
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/junit/JUnit4Monitor.java#L72-L81
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuTexRefSetAddressMode
public static int cuTexRefSetAddressMode(CUtexref hTexRef, int dim, int am) { return checkResult(cuTexRefSetAddressModeNative(hTexRef, dim, am)); }
java
public static int cuTexRefSetAddressMode(CUtexref hTexRef, int dim, int am) { return checkResult(cuTexRefSetAddressModeNative(hTexRef, dim, am)); }
[ "public", "static", "int", "cuTexRefSetAddressMode", "(", "CUtexref", "hTexRef", ",", "int", "dim", ",", "int", "am", ")", "{", "return", "checkResult", "(", "cuTexRefSetAddressModeNative", "(", "hTexRef", ",", "dim", ",", "am", ")", ")", ";", "}" ]
Sets the addressing mode for a texture reference. <pre> CUresult cuTexRefSetAddressMode ( CUtexref hTexRef, int dim, CUaddress_mode am ) </pre> <div> <p>Sets the addressing mode for a texture reference. Specifies the addressing mode <tt>am</tt> for the given dimension <tt>dim</tt> of the texture reference <tt>hTexRef</tt>. If <tt>dim</tt> is zero, the addressing mode is applied to the first parameter of the functions used to fetch from the texture; if <tt>dim</tt> is 1, the second, and so on. CUaddress_mode is defined as: <pre> typedef enum CUaddress_mode_enum { CU_TR_ADDRESS_MODE_WRAP = 0, CU_TR_ADDRESS_MODE_CLAMP = 1, CU_TR_ADDRESS_MODE_MIRROR = 2, CU_TR_ADDRESS_MODE_BORDER = 3 } CUaddress_mode;</pre> </p> <p>Note that this call has no effect if <tt>hTexRef</tt> is bound to linear memory. Also, if the flag, CU_TRSF_NORMALIZED_COORDINATES, is not set, the only supported address mode is CU_TR_ADDRESS_MODE_CLAMP. </p> </div> @param hTexRef Texture reference @param dim Dimension @param am Addressing mode to set @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE @see JCudaDriver#cuTexRefSetAddress @see JCudaDriver#cuTexRefSetAddress2D @see JCudaDriver#cuTexRefSetArray @see JCudaDriver#cuTexRefSetFilterMode @see JCudaDriver#cuTexRefSetFlags @see JCudaDriver#cuTexRefSetFormat @see JCudaDriver#cuTexRefGetAddress @see JCudaDriver#cuTexRefGetAddressMode @see JCudaDriver#cuTexRefGetArray @see JCudaDriver#cuTexRefGetFilterMode @see JCudaDriver#cuTexRefGetFlags @see JCudaDriver#cuTexRefGetFormat
[ "Sets", "the", "addressing", "mode", "for", "a", "texture", "reference", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L10012-L10015
eclipse/xtext-core
org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/CompletionPrefixProvider.java
CompletionPrefixProvider.getLastCompleteNodeByOffset
public INode getLastCompleteNodeByOffset(INode node, int offsetPosition, int completionOffset) { return internalGetLastCompleteNodeByOffset(node.getRootNode(), offsetPosition); }
java
public INode getLastCompleteNodeByOffset(INode node, int offsetPosition, int completionOffset) { return internalGetLastCompleteNodeByOffset(node.getRootNode(), offsetPosition); }
[ "public", "INode", "getLastCompleteNodeByOffset", "(", "INode", "node", ",", "int", "offsetPosition", ",", "int", "completionOffset", ")", "{", "return", "internalGetLastCompleteNodeByOffset", "(", "node", ".", "getRootNode", "(", ")", ",", "offsetPosition", ")", ";...
Returns the last node that appears to be part of the prefix. This will be used to determine the current model object that'll be the most special context instance in the proposal provider.
[ "Returns", "the", "last", "node", "that", "appears", "to", "be", "part", "of", "the", "prefix", ".", "This", "will", "be", "used", "to", "determine", "the", "current", "model", "object", "that", "ll", "be", "the", "most", "special", "context", "instance", ...
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/CompletionPrefixProvider.java#L36-L38
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementProxy.java
ElementProxy.setPropertyValue
@Override public void setPropertyValue(PropertyInfo propInfo, Object value) { setPropertyValue(propInfo.getId(), value); }
java
@Override public void setPropertyValue(PropertyInfo propInfo, Object value) { setPropertyValue(propInfo.getId(), value); }
[ "@", "Override", "public", "void", "setPropertyValue", "(", "PropertyInfo", "propInfo", ",", "Object", "value", ")", "{", "setPropertyValue", "(", "propInfo", ".", "getId", "(", ")", ",", "value", ")", ";", "}" ]
Overridden to set property value in proxy's property cache. @see org.carewebframework.shell.property.IPropertyAccessor#setPropertyValue
[ "Overridden", "to", "set", "property", "value", "in", "proxy", "s", "property", "cache", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementProxy.java#L83-L86
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java
SimpleDocTreeVisitor.visitEntity
@Override public R visitEntity(EntityTree node, P p) { return defaultAction(node, p); }
java
@Override public R visitEntity(EntityTree node, P p) { return defaultAction(node, p); }
[ "@", "Override", "public", "R", "visitEntity", "(", "EntityTree", "node", ",", "P", "p", ")", "{", "return", "defaultAction", "(", "node", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation calls {@code defaultAction}. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of {@code defaultAction}
[ "{", "@inheritDoc", "}", "This", "implementation", "calls", "{", "@code", "defaultAction", "}", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L189-L192
mercadopago/dx-java
src/main/java/com/mercadopago/core/MPBase.java
MPBase.processMethod
protected <T extends MPBase> T processMethod(String methodName, Boolean useCache) throws MPException { HashMap<String, String> mapParams = null; T resource = processMethod(this.getClass(), (T)this, methodName, mapParams, useCache); fillResource(resource, this); return (T)this; }
java
protected <T extends MPBase> T processMethod(String methodName, Boolean useCache) throws MPException { HashMap<String, String> mapParams = null; T resource = processMethod(this.getClass(), (T)this, methodName, mapParams, useCache); fillResource(resource, this); return (T)this; }
[ "protected", "<", "T", "extends", "MPBase", ">", "T", "processMethod", "(", "String", "methodName", ",", "Boolean", "useCache", ")", "throws", "MPException", "{", "HashMap", "<", "String", ",", "String", ">", "mapParams", "=", "null", ";", "T", "resource", ...
Process the method to call the api, usually used for create, update and delete methods @param methodName a String with the decorated method to be processed @param useCache a Boolean flag that indicates if the cache must be used @return a resourse obj fill with the api response @throws MPException
[ "Process", "the", "method", "to", "call", "the", "api", "usually", "used", "for", "create", "update", "and", "delete", "methods" ]
train
https://github.com/mercadopago/dx-java/blob/9df65a6bfb4db0c1fddd7699a5b109643961b03f/src/main/java/com/mercadopago/core/MPBase.java#L90-L95
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/QueryRecord.java
QueryRecord.addRelationship
public void addRelationship(int iLinkType, Record recLeft, Record recRight, String ifldLeft1, String ifldRight1) { new TableLink(this, iLinkType, recLeft, recRight, ifldLeft1, ifldRight1, null, null, null, null); }
java
public void addRelationship(int iLinkType, Record recLeft, Record recRight, String ifldLeft1, String ifldRight1) { new TableLink(this, iLinkType, recLeft, recRight, ifldLeft1, ifldRight1, null, null, null, null); }
[ "public", "void", "addRelationship", "(", "int", "iLinkType", ",", "Record", "recLeft", ",", "Record", "recRight", ",", "String", "ifldLeft1", ",", "String", "ifldRight1", ")", "{", "new", "TableLink", "(", "this", ",", "iLinkType", ",", "recLeft", ",", "rec...
Add this table link to this query. Creates a new tablelink and adds it to the link list.
[ "Add", "this", "table", "link", "to", "this", "query", ".", "Creates", "a", "new", "tablelink", "and", "adds", "it", "to", "the", "link", "list", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/QueryRecord.java#L154-L157
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/abst/fiducial/FourPointSyntheticStability.java
FourPointSyntheticStability.setShape
public void setShape(double width , double height ) { points2D3D.get(0).location.set(-width/2,-height/2,0); points2D3D.get(1).location.set(-width/2, height/2,0); points2D3D.get(2).location.set( width/2, height/2,0); points2D3D.get(3).location.set( width/2,-height/2,0); }
java
public void setShape(double width , double height ) { points2D3D.get(0).location.set(-width/2,-height/2,0); points2D3D.get(1).location.set(-width/2, height/2,0); points2D3D.get(2).location.set( width/2, height/2,0); points2D3D.get(3).location.set( width/2,-height/2,0); }
[ "public", "void", "setShape", "(", "double", "width", ",", "double", "height", ")", "{", "points2D3D", ".", "get", "(", "0", ")", ".", "location", ".", "set", "(", "-", "width", "/", "2", ",", "-", "height", "/", "2", ",", "0", ")", ";", "points2...
Specifes how big the fiducial is along two axises @param width Length along x-axis @param height Length along y-axis
[ "Specifes", "how", "big", "the", "fiducial", "is", "along", "two", "axises" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/abst/fiducial/FourPointSyntheticStability.java#L95-L100
Impetus/Kundera
src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/HibernateClient.java
HibernateClient.updateForeignKeys
private void updateForeignKeys(EntityMetadata metadata, Object id, List<RelationHolder> relationHolders) { for (RelationHolder rh : relationHolders) { String linkName = rh.getRelationName(); Object linkValue = rh.getRelationValue(); if (linkName != null && linkValue != null) { // String fieldName = metadata.getFieldName(linkName); String clause = getFromClause(metadata.getSchema(), metadata.getTableName()); // String updateSql = "Update " + // metadata.getEntityClazz().getSimpleName() + " SET " + // fieldName + "= '" + linkValue + "' WHERE " // + ((AbstractAttribute) metadata.getIdAttribute()).getName() + // " = '" + id + "'"; String updateSql = "Update " + clause + " SET " + linkName + "= '" + linkValue + "' WHERE " + ((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName() + " = '" + id + "'"; onNativeUpdate(updateSql, null); } } }
java
private void updateForeignKeys(EntityMetadata metadata, Object id, List<RelationHolder> relationHolders) { for (RelationHolder rh : relationHolders) { String linkName = rh.getRelationName(); Object linkValue = rh.getRelationValue(); if (linkName != null && linkValue != null) { // String fieldName = metadata.getFieldName(linkName); String clause = getFromClause(metadata.getSchema(), metadata.getTableName()); // String updateSql = "Update " + // metadata.getEntityClazz().getSimpleName() + " SET " + // fieldName + "= '" + linkValue + "' WHERE " // + ((AbstractAttribute) metadata.getIdAttribute()).getName() + // " = '" + id + "'"; String updateSql = "Update " + clause + " SET " + linkName + "= '" + linkValue + "' WHERE " + ((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName() + " = '" + id + "'"; onNativeUpdate(updateSql, null); } } }
[ "private", "void", "updateForeignKeys", "(", "EntityMetadata", "metadata", ",", "Object", "id", ",", "List", "<", "RelationHolder", ">", "relationHolders", ")", "{", "for", "(", "RelationHolder", "rh", ":", "relationHolders", ")", "{", "String", "linkName", "=",...
Updates foreign keys into master table. @param metadata the metadata @param id the id @param relationHolders the relation holders
[ "Updates", "foreign", "keys", "into", "master", "table", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/HibernateClient.java#L811-L835
joniles/mpxj
src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java
UniversalProjectReader.readProjectFile
private ProjectFile readProjectFile(ProjectReader reader, File file) throws MPXJException { addListeners(reader); return reader.read(file); }
java
private ProjectFile readProjectFile(ProjectReader reader, File file) throws MPXJException { addListeners(reader); return reader.read(file); }
[ "private", "ProjectFile", "readProjectFile", "(", "ProjectReader", "reader", ",", "File", "file", ")", "throws", "MPXJException", "{", "addListeners", "(", "reader", ")", ";", "return", "reader", ".", "read", "(", "file", ")", ";", "}" ]
Adds listeners and reads from a file. @param reader reader for file type @param file schedule data @return ProjectFile instance
[ "Adds", "listeners", "and", "reads", "from", "a", "file", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java#L366-L370
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/soccom/SoccomClient.java
SoccomClient.call
public static String call(String serverspec, String msg, int timeout, PrintStream log) throws SoccomException { String host; int port; int k = serverspec.indexOf(':'); if (k >= 0) { host = serverspec.substring(0,k); port = Integer.parseInt(serverspec.substring(k+1)); } else { host = serverspec; port = 4001; } SoccomClient soccom = new SoccomClient(host, port, log); String reply; try { soccom.putreq(msg); reply = soccom.getresp(timeout); soccom.close(); } catch (SoccomException e) { soccom.close(); throw e; } return reply; }
java
public static String call(String serverspec, String msg, int timeout, PrintStream log) throws SoccomException { String host; int port; int k = serverspec.indexOf(':'); if (k >= 0) { host = serverspec.substring(0,k); port = Integer.parseInt(serverspec.substring(k+1)); } else { host = serverspec; port = 4001; } SoccomClient soccom = new SoccomClient(host, port, log); String reply; try { soccom.putreq(msg); reply = soccom.getresp(timeout); soccom.close(); } catch (SoccomException e) { soccom.close(); throw e; } return reply; }
[ "public", "static", "String", "call", "(", "String", "serverspec", ",", "String", "msg", ",", "int", "timeout", ",", "PrintStream", "log", ")", "throws", "SoccomException", "{", "String", "host", ";", "int", "port", ";", "int", "k", "=", "serverspec", ".",...
This method is a simple wrapper for synchronous invocation of server's service. It is roughly implemented as: <pre> SoccomClient soccom = new SoccomClient(host,port,log); putreq(msg); return getresp(); soccom.close(); </pre> @param serverspec In the form of host:port. If ':' is missing, assume port is 4001 @param msg The message to be sent. @param timeout Time out in seconds @param log For logging information @return The respose message. @exception SoccomException It passes up any exception encountered along the way.
[ "This", "method", "is", "a", "simple", "wrapper", "for", "synchronous", "invocation", "of", "server", "s", "service", ".", "It", "is", "roughly", "implemented", "as", ":", "<pre", ">", "SoccomClient", "soccom", "=", "new", "SoccomClient", "(", "host", "port"...
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/soccom/SoccomClient.java#L546-L571
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java
AbstractSubCodeBuilderFragment.bindElementDescription
protected void bindElementDescription(BindingFactory factory, CodeElementExtractor.ElementDescription... descriptions) { for (final CodeElementExtractor.ElementDescription description : descriptions) { bindTypeReferences(factory, description.getBuilderInterfaceType(), description.getBuilderImplementationType(), description.getBuilderCustomImplementationType()); } }
java
protected void bindElementDescription(BindingFactory factory, CodeElementExtractor.ElementDescription... descriptions) { for (final CodeElementExtractor.ElementDescription description : descriptions) { bindTypeReferences(factory, description.getBuilderInterfaceType(), description.getBuilderImplementationType(), description.getBuilderCustomImplementationType()); } }
[ "protected", "void", "bindElementDescription", "(", "BindingFactory", "factory", ",", "CodeElementExtractor", ".", "ElementDescription", "...", "descriptions", ")", "{", "for", "(", "final", "CodeElementExtractor", ".", "ElementDescription", "description", ":", "descripti...
Binds the given descriptions according to the standard policy. <p>If an custom implementation is defined, it is binded to. Otherwise, the default implementation is binded. @param factory the binding factory to use for creating the bindings. @param descriptions the descriptions to bind to.
[ "Binds", "the", "given", "descriptions", "according", "to", "the", "standard", "policy", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java#L707-L714
op4j/op4j
src/main/java/org/op4j/functions/FnString.java
FnString.toLong
public static final Function<String,Long> toLong(final RoundingMode roundingMode, final DecimalPoint decimalPoint) { return new ToLong(roundingMode, decimalPoint); }
java
public static final Function<String,Long> toLong(final RoundingMode roundingMode, final DecimalPoint decimalPoint) { return new ToLong(roundingMode, decimalPoint); }
[ "public", "static", "final", "Function", "<", "String", ",", "Long", ">", "toLong", "(", "final", "RoundingMode", "roundingMode", ",", "final", "DecimalPoint", "decimalPoint", ")", "{", "return", "new", "ToLong", "(", "roundingMode", ",", "decimalPoint", ")", ...
<p> Converts a String into a Long, using the specified decimal point configuration ({@link DecimalPoint}). Rounding mode is used for removing the decimal part of the number. The target String should contain no thousand separators. The integer part of the input string must be between {@link Long#MIN_VALUE} and {@link Long#MAX_VALUE} </p> @param roundingMode the rounding mode to be used when setting the scale @param decimalPoint the decimal point being used by the String @return the resulting Long object
[ "<p", ">", "Converts", "a", "String", "into", "a", "Long", "using", "the", "specified", "decimal", "point", "configuration", "(", "{", "@link", "DecimalPoint", "}", ")", ".", "Rounding", "mode", "is", "used", "for", "removing", "the", "decimal", "part", "o...
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnString.java#L789-L791
paypal/SeLion
client/src/main/java/com/paypal/selion/platform/html/Table.java
Table.getValueFromCell
public String getValueFromCell(int row, int column) { if (row < 1 || column < 1) { throw new IllegalArgumentException("Row and column must start from 1"); } List<WebElement> elements = HtmlElementUtils.locateElements(getXPathBase() + "tr"); List<WebElement> cells = elements.get(row - 1).findElements(By.xpath(".//td")); if (cells.size() > 0) { return cells.get(column - 1).getText(); } return null; }
java
public String getValueFromCell(int row, int column) { if (row < 1 || column < 1) { throw new IllegalArgumentException("Row and column must start from 1"); } List<WebElement> elements = HtmlElementUtils.locateElements(getXPathBase() + "tr"); List<WebElement> cells = elements.get(row - 1).findElements(By.xpath(".//td")); if (cells.size() > 0) { return cells.get(column - 1).getText(); } return null; }
[ "public", "String", "getValueFromCell", "(", "int", "row", ",", "int", "column", ")", "{", "if", "(", "row", "<", "1", "||", "column", "<", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Row and column must start from 1\"", ")", ";", "}",...
Finds value of a cell in a table indicated by row and column indices. <br/> <br/> @param row int number of row for cell @param column int number of column for cell @return String value of cell with row and column. Null if cannot be found.
[ "Finds", "value", "of", "a", "cell", "in", "a", "table", "indicated", "by", "row", "and", "column", "indices", ".", "<br", "/", ">", "<br", "/", ">" ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/platform/html/Table.java#L217-L229
googleapis/google-cloud-java
google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceClient.java
KeyManagementServiceClient.asymmetricSign
public final AsymmetricSignResponse asymmetricSign(CryptoKeyVersionName name, Digest digest) { AsymmetricSignRequest request = AsymmetricSignRequest.newBuilder() .setName(name == null ? null : name.toString()) .setDigest(digest) .build(); return asymmetricSign(request); }
java
public final AsymmetricSignResponse asymmetricSign(CryptoKeyVersionName name, Digest digest) { AsymmetricSignRequest request = AsymmetricSignRequest.newBuilder() .setName(name == null ? null : name.toString()) .setDigest(digest) .build(); return asymmetricSign(request); }
[ "public", "final", "AsymmetricSignResponse", "asymmetricSign", "(", "CryptoKeyVersionName", "name", ",", "Digest", "digest", ")", "{", "AsymmetricSignRequest", "request", "=", "AsymmetricSignRequest", ".", "newBuilder", "(", ")", ".", "setName", "(", "name", "==", "...
Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. <p>Sample code: <pre><code> try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) { CryptoKeyVersionName name = CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"); Digest digest = Digest.newBuilder().build(); AsymmetricSignResponse response = keyManagementServiceClient.asymmetricSign(name, digest); } </code></pre> @param name Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing. @param digest Required. The digest of the data to sign. The digest must be produced with the same digest algorithm as specified by the key version's [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm]. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Signs", "data", "using", "a", "[", "CryptoKeyVersion", "]", "[", "google", ".", "cloud", ".", "kms", ".", "v1", ".", "CryptoKeyVersion", "]", "with", "[", "CryptoKey", ".", "purpose", "]", "[", "google", ".", "cloud", ".", "kms", ".", "v1", ".", "Cr...
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceClient.java#L2379-L2387
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/StringConverter.java
StringConverter.byteArrayToBitString
public static String byteArrayToBitString(byte[] bytes, int bitCount) { char[] s = new char[bitCount]; for (int j = 0; j < bitCount; j++) { byte b = bytes[j / 8]; s[j] = BitMap.isSet(b, j % 8) ? '1' : '0'; } return new String(s); }
java
public static String byteArrayToBitString(byte[] bytes, int bitCount) { char[] s = new char[bitCount]; for (int j = 0; j < bitCount; j++) { byte b = bytes[j / 8]; s[j] = BitMap.isSet(b, j % 8) ? '1' : '0'; } return new String(s); }
[ "public", "static", "String", "byteArrayToBitString", "(", "byte", "[", "]", "bytes", ",", "int", "bitCount", ")", "{", "char", "[", "]", "s", "=", "new", "char", "[", "bitCount", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "bitCount...
Converts a byte array into a bit string @param bytes byte array @param bitCount number of bits @return hex string
[ "Converts", "a", "byte", "array", "into", "a", "bit", "string" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/StringConverter.java#L270-L282
coveo/fmt-maven-plugin
src/main/java/com/coveo/FMT.java
FMT.onNonComplyingFile
@Override protected void onNonComplyingFile(File file, String formatted) throws IOException { CharSink sink = Files.asCharSink(file, Charsets.UTF_8); sink.write(formatted); }
java
@Override protected void onNonComplyingFile(File file, String formatted) throws IOException { CharSink sink = Files.asCharSink(file, Charsets.UTF_8); sink.write(formatted); }
[ "@", "Override", "protected", "void", "onNonComplyingFile", "(", "File", "file", ",", "String", "formatted", ")", "throws", "IOException", "{", "CharSink", "sink", "=", "Files", ".", "asCharSink", "(", "file", ",", "Charsets", ".", "UTF_8", ")", ";", "sink",...
Hook called when the processd file is not compliant with the formatter. @param file the file that is not compliant @param formatted the corresponding formatted of the file.
[ "Hook", "called", "when", "the", "processd", "file", "is", "not", "compliant", "with", "the", "formatter", "." ]
train
https://github.com/coveo/fmt-maven-plugin/blob/9368be6985ecc2126c875ff4aabe647c7e57ecca/src/main/java/com/coveo/FMT.java#L26-L30
aws/aws-sdk-java
aws-java-sdk-elasticloadbalancingv2/src/main/java/com/amazonaws/services/elasticloadbalancingv2/model/AuthenticateCognitoActionConfig.java
AuthenticateCognitoActionConfig.withAuthenticationRequestExtraParams
public AuthenticateCognitoActionConfig withAuthenticationRequestExtraParams(java.util.Map<String, String> authenticationRequestExtraParams) { setAuthenticationRequestExtraParams(authenticationRequestExtraParams); return this; }
java
public AuthenticateCognitoActionConfig withAuthenticationRequestExtraParams(java.util.Map<String, String> authenticationRequestExtraParams) { setAuthenticationRequestExtraParams(authenticationRequestExtraParams); return this; }
[ "public", "AuthenticateCognitoActionConfig", "withAuthenticationRequestExtraParams", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "authenticationRequestExtraParams", ")", "{", "setAuthenticationRequestExtraParams", "(", "authenticationRequestExtraPar...
<p> The query parameters (up to 10) to include in the redirect request to the authorization endpoint. </p> @param authenticationRequestExtraParams The query parameters (up to 10) to include in the redirect request to the authorization endpoint. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "query", "parameters", "(", "up", "to", "10", ")", "to", "include", "in", "the", "redirect", "request", "to", "the", "authorization", "endpoint", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-elasticloadbalancingv2/src/main/java/com/amazonaws/services/elasticloadbalancingv2/model/AuthenticateCognitoActionConfig.java#L396-L399
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/elements/MarkedElement.java
MarkedElement.markupBond
public static MarkedElement markupBond(IRenderingElement elem, IBond bond) { assert elem != null; MarkedElement tagElem = markupChemObj(elem, bond); tagElem.aggClass("bond"); return tagElem; }
java
public static MarkedElement markupBond(IRenderingElement elem, IBond bond) { assert elem != null; MarkedElement tagElem = markupChemObj(elem, bond); tagElem.aggClass("bond"); return tagElem; }
[ "public", "static", "MarkedElement", "markupBond", "(", "IRenderingElement", "elem", ",", "IBond", "bond", ")", "{", "assert", "elem", "!=", "null", ";", "MarkedElement", "tagElem", "=", "markupChemObj", "(", "elem", ",", "bond", ")", ";", "tagElem", ".", "a...
Markup a bond with the class 'bond' and optionally the ids/classes from it's properties. @param elem rendering element @param bond bond @return the marked element
[ "Markup", "a", "bond", "with", "the", "class", "bond", "and", "optionally", "the", "ids", "/", "classes", "from", "it", "s", "properties", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/elements/MarkedElement.java#L182-L187
micronaut-projects/micronaut-core
core/src/main/java/io/micronaut/core/util/clhm/ConcurrentLinkedHashMap.java
ConcurrentLinkedHashMap.afterRead
void afterRead(Node<K, V> node) { final int bufferIndex = readBufferIndex(); final long writeCount = recordRead(bufferIndex, node); drainOnReadIfNeeded(bufferIndex, writeCount); notifyListener(); }
java
void afterRead(Node<K, V> node) { final int bufferIndex = readBufferIndex(); final long writeCount = recordRead(bufferIndex, node); drainOnReadIfNeeded(bufferIndex, writeCount); notifyListener(); }
[ "void", "afterRead", "(", "Node", "<", "K", ",", "V", ">", "node", ")", "{", "final", "int", "bufferIndex", "=", "readBufferIndex", "(", ")", ";", "final", "long", "writeCount", "=", "recordRead", "(", "bufferIndex", ",", "node", ")", ";", "drainOnReadIf...
Performs the post-processing work required after a read. @param node the entry in the page replacement policy
[ "Performs", "the", "post", "-", "processing", "work", "required", "after", "a", "read", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/util/clhm/ConcurrentLinkedHashMap.java#L339-L344
dmfs/http-client-interfaces
src/org/dmfs/httpclientinterfaces/HttpStatus.java
HttpStatus.fromStatusCode
public static HttpStatus fromStatusCode(final int statusCode) { if (statusCode < 100 || statusCode > 999) { throw new IllegalArgumentException("Illegal status code " + statusCode); } HttpStatus result = STATUS_CODES.get(statusCode); if (result == null) { return new HttpStatus(statusCode, "Unknown"); } return result; }
java
public static HttpStatus fromStatusCode(final int statusCode) { if (statusCode < 100 || statusCode > 999) { throw new IllegalArgumentException("Illegal status code " + statusCode); } HttpStatus result = STATUS_CODES.get(statusCode); if (result == null) { return new HttpStatus(statusCode, "Unknown"); } return result; }
[ "public", "static", "HttpStatus", "fromStatusCode", "(", "final", "int", "statusCode", ")", "{", "if", "(", "statusCode", "<", "100", "||", "statusCode", ">", "999", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Illegal status code \"", "+", "sta...
Returns the {@link HttpStatus} having the given status code. @param statusCode An HTTP status code integer. @return The {@link HttpStatus} having the given status code.
[ "Returns", "the", "{", "@link", "HttpStatus", "}", "having", "the", "given", "status", "code", "." ]
train
https://github.com/dmfs/http-client-interfaces/blob/10896c71270ccaf32ac4ed5d706dfa0001fd3862/src/org/dmfs/httpclientinterfaces/HttpStatus.java#L405-L418
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/engine/ClassParser.java
ClassParser.readConstant
private Constant readConstant() throws InvalidClassFileFormatException, IOException { int tag = in.readUnsignedByte(); if (tag < 0 || tag >= CONSTANT_FORMAT_MAP.length) { throw new InvalidClassFileFormatException(expectedClassDescriptor, codeBaseEntry); } String format = CONSTANT_FORMAT_MAP[tag]; if (format == null) { throw new InvalidClassFileFormatException(expectedClassDescriptor, codeBaseEntry); } Object[] data = new Object[format.length()]; for (int i = 0; i < format.length(); i++) { char spec = format.charAt(i); switch (spec) { case '8': data[i] = in.readUTF(); break; case 'I': data[i] = in.readInt(); break; case 'F': data[i] = Float.valueOf(in.readFloat()); break; case 'L': data[i] = in.readLong(); break; case 'D': data[i] = Double.valueOf(in.readDouble()); break; case 'i': data[i] = in.readUnsignedShort(); break; case 'b': data[i] = in.readUnsignedByte(); break; default: throw new IllegalStateException(); } } return new Constant(tag, data); }
java
private Constant readConstant() throws InvalidClassFileFormatException, IOException { int tag = in.readUnsignedByte(); if (tag < 0 || tag >= CONSTANT_FORMAT_MAP.length) { throw new InvalidClassFileFormatException(expectedClassDescriptor, codeBaseEntry); } String format = CONSTANT_FORMAT_MAP[tag]; if (format == null) { throw new InvalidClassFileFormatException(expectedClassDescriptor, codeBaseEntry); } Object[] data = new Object[format.length()]; for (int i = 0; i < format.length(); i++) { char spec = format.charAt(i); switch (spec) { case '8': data[i] = in.readUTF(); break; case 'I': data[i] = in.readInt(); break; case 'F': data[i] = Float.valueOf(in.readFloat()); break; case 'L': data[i] = in.readLong(); break; case 'D': data[i] = Double.valueOf(in.readDouble()); break; case 'i': data[i] = in.readUnsignedShort(); break; case 'b': data[i] = in.readUnsignedByte(); break; default: throw new IllegalStateException(); } } return new Constant(tag, data); }
[ "private", "Constant", "readConstant", "(", ")", "throws", "InvalidClassFileFormatException", ",", "IOException", "{", "int", "tag", "=", "in", ".", "readUnsignedByte", "(", ")", ";", "if", "(", "tag", "<", "0", "||", "tag", ">=", "CONSTANT_FORMAT_MAP", ".", ...
Read a constant from the constant pool. Return null for @return a StaticConstant @throws InvalidClassFileFormatException @throws IOException
[ "Read", "a", "constant", "from", "the", "constant", "pool", ".", "Return", "null", "for" ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/engine/ClassParser.java#L243-L284
jbundle/jbundle
base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcTable.java
JdbcTable.doSetHandle
public boolean doSetHandle(Object objectID, int iHandleType) throws DBException { if (iHandleType == DBConstants.OBJECT_ID_HANDLE) { if (objectID instanceof String) // It is okay to pass in a string, but convert it first! { try { objectID = new Integer(Converter.stripNonNumber((String)objectID)); } catch (NumberFormatException ex) { objectID = new StrBuffer((String)objectID); } } iHandleType = DBConstants.BOOKMARK_HANDLE; } if (iHandleType == DBConstants.DATA_SOURCE_HANDLE) iHandleType = DBConstants.BOOKMARK_HANDLE; return super.doSetHandle(objectID, iHandleType); // Same logic (for JDBC) }
java
public boolean doSetHandle(Object objectID, int iHandleType) throws DBException { if (iHandleType == DBConstants.OBJECT_ID_HANDLE) { if (objectID instanceof String) // It is okay to pass in a string, but convert it first! { try { objectID = new Integer(Converter.stripNonNumber((String)objectID)); } catch (NumberFormatException ex) { objectID = new StrBuffer((String)objectID); } } iHandleType = DBConstants.BOOKMARK_HANDLE; } if (iHandleType == DBConstants.DATA_SOURCE_HANDLE) iHandleType = DBConstants.BOOKMARK_HANDLE; return super.doSetHandle(objectID, iHandleType); // Same logic (for JDBC) }
[ "public", "boolean", "doSetHandle", "(", "Object", "objectID", ",", "int", "iHandleType", ")", "throws", "DBException", "{", "if", "(", "iHandleType", "==", "DBConstants", ".", "OBJECT_ID_HANDLE", ")", "{", "if", "(", "objectID", "instanceof", "String", ")", "...
Read the record given the ID to this persistent object. <p />Note: ObjectID and DataSource handles are the same as bookmark handles for SQL. @param objectID java.lang.Object @exception DBException File exception.
[ "Read", "the", "record", "given", "the", "ID", "to", "this", "persistent", "object", ".", "<p", "/", ">", "Note", ":", "ObjectID", "and", "DataSource", "handles", "are", "the", "same", "as", "bookmark", "handles", "for", "SQL", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcTable.java#L707-L724
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/closure/support/Algorithms.java
Algorithms.findFirst
public Object findFirst(Collection collection, Constraint constraint) { return findFirst(collection.iterator(), constraint); }
java
public Object findFirst(Collection collection, Constraint constraint) { return findFirst(collection.iterator(), constraint); }
[ "public", "Object", "findFirst", "(", "Collection", "collection", ",", "Constraint", "constraint", ")", "{", "return", "findFirst", "(", "collection", ".", "iterator", "(", ")", ",", "constraint", ")", ";", "}" ]
Find the first element in the collection matching the specified constraint. @param collection the collection @param constraint the predicate @return The first object match, or null if no match
[ "Find", "the", "first", "element", "in", "the", "collection", "matching", "the", "specified", "constraint", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/closure/support/Algorithms.java#L111-L113
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/validation/SARLValidator.java
SARLValidator.isIgnored
protected boolean isIgnored(String issueCode, EObject currentObject) { final IssueSeverities severities = getIssueSeverities(getContext(), currentObject); return severities.isIgnored(issueCode); }
java
protected boolean isIgnored(String issueCode, EObject currentObject) { final IssueSeverities severities = getIssueSeverities(getContext(), currentObject); return severities.isIgnored(issueCode); }
[ "protected", "boolean", "isIgnored", "(", "String", "issueCode", ",", "EObject", "currentObject", ")", "{", "final", "IssueSeverities", "severities", "=", "getIssueSeverities", "(", "getContext", "(", ")", ",", "currentObject", ")", ";", "return", "severities", "....
Replies if the given issue is ignored for the given object. @param issueCode the code if the issue. @param currentObject the current object. @return <code>true</code> if the issue is ignored. @see #isIgnored(String)
[ "Replies", "if", "the", "given", "issue", "is", "ignored", "for", "the", "given", "object", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/validation/SARLValidator.java#L506-L509
btrplace/scheduler
choco/src/main/java/org/btrplace/scheduler/choco/extensions/pack/VectorPackingHeapDecorator.java
VectorPackingHeapDecorator.loadSlack
private int loadSlack(int dim, int bin) { return p.loads[dim][bin].getUB() - p.loads[dim][bin].getLB(); }
java
private int loadSlack(int dim, int bin) { return p.loads[dim][bin].getUB() - p.loads[dim][bin].getLB(); }
[ "private", "int", "loadSlack", "(", "int", "dim", ",", "int", "bin", ")", "{", "return", "p", ".", "loads", "[", "dim", "]", "[", "bin", "]", ".", "getUB", "(", ")", "-", "p", ".", "loads", "[", "dim", "]", "[", "bin", "]", ".", "getLB", "(",...
compute the load slack of a bin @param dim the dimension @param bin the bin @return the load slack of bin on dimension bin
[ "compute", "the", "load", "slack", "of", "a", "bin" ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/extensions/pack/VectorPackingHeapDecorator.java#L65-L67
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/setting/controller/MsgSettingController.java
MsgSettingController.deleteValidationUrl
@DeleteMapping("/setting/delete/url") public void deleteValidationUrl(HttpServletRequest req, @RequestBody ReqUrl reqUrl) { this.validationSessionComponent.sessionCheck(req); this.msgSettingService.deleteValidationData(reqUrl); }
java
@DeleteMapping("/setting/delete/url") public void deleteValidationUrl(HttpServletRequest req, @RequestBody ReqUrl reqUrl) { this.validationSessionComponent.sessionCheck(req); this.msgSettingService.deleteValidationData(reqUrl); }
[ "@", "DeleteMapping", "(", "\"/setting/delete/url\"", ")", "public", "void", "deleteValidationUrl", "(", "HttpServletRequest", "req", ",", "@", "RequestBody", "ReqUrl", "reqUrl", ")", "{", "this", ".", "validationSessionComponent", ".", "sessionCheck", "(", "req", "...
Delete validation url. @param req the req @param reqUrl the req url
[ "Delete", "validation", "url", "." ]
train
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/setting/controller/MsgSettingController.java#L193-L197
micrometer-metrics/micrometer
micrometer-core/src/main/java/io/micrometer/core/instrument/binder/db/PostgreSQLDatabaseMetrics.java
PostgreSQLDatabaseMetrics.resettableFunctionalCounter
Double resettableFunctionalCounter(String functionalCounterKey, DoubleSupplier function) { Double result = function.getAsDouble(); Double previousResult = previousValueCacheMap.getOrDefault(functionalCounterKey, 0D); Double beforeResetValue = beforeResetValuesCacheMap.getOrDefault(functionalCounterKey, 0D); Double correctedValue = result + beforeResetValue; if (correctedValue < previousResult) { beforeResetValuesCacheMap.put(functionalCounterKey, previousResult); correctedValue = previousResult + result; } previousValueCacheMap.put(functionalCounterKey, correctedValue); return correctedValue; }
java
Double resettableFunctionalCounter(String functionalCounterKey, DoubleSupplier function) { Double result = function.getAsDouble(); Double previousResult = previousValueCacheMap.getOrDefault(functionalCounterKey, 0D); Double beforeResetValue = beforeResetValuesCacheMap.getOrDefault(functionalCounterKey, 0D); Double correctedValue = result + beforeResetValue; if (correctedValue < previousResult) { beforeResetValuesCacheMap.put(functionalCounterKey, previousResult); correctedValue = previousResult + result; } previousValueCacheMap.put(functionalCounterKey, correctedValue); return correctedValue; }
[ "Double", "resettableFunctionalCounter", "(", "String", "functionalCounterKey", ",", "DoubleSupplier", "function", ")", "{", "Double", "result", "=", "function", ".", "getAsDouble", "(", ")", ";", "Double", "previousResult", "=", "previousValueCacheMap", ".", "getOrDe...
Function that makes sure functional counter values survive pg_stat_reset calls.
[ "Function", "that", "makes", "sure", "functional", "counter", "values", "survive", "pg_stat_reset", "calls", "." ]
train
https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/db/PostgreSQLDatabaseMetrics.java#L265-L277
cdapio/tigon
tigon-flow/src/main/java/co/cask/tigon/internal/app/runtime/distributed/AbstractProgramTwillRunnable.java
AbstractProgramTwillRunnable.createProgramArguments
private Arguments createProgramArguments(TwillContext context, Map<String, String> configs) { Map<String, String> args = ImmutableMap.<String, String>builder() .put(ProgramOptionConstants.INSTANCE_ID, Integer.toString(context.getInstanceId())) .put(ProgramOptionConstants.INSTANCES, Integer.toString(context.getInstanceCount())) .put(ProgramOptionConstants.RUN_ID, context.getApplicationRunId().getId()) .putAll(Maps.filterKeys(configs, Predicates.not(Predicates.in(ImmutableSet.of("hConf", "cConf"))))) .build(); return new BasicArguments(args); }
java
private Arguments createProgramArguments(TwillContext context, Map<String, String> configs) { Map<String, String> args = ImmutableMap.<String, String>builder() .put(ProgramOptionConstants.INSTANCE_ID, Integer.toString(context.getInstanceId())) .put(ProgramOptionConstants.INSTANCES, Integer.toString(context.getInstanceCount())) .put(ProgramOptionConstants.RUN_ID, context.getApplicationRunId().getId()) .putAll(Maps.filterKeys(configs, Predicates.not(Predicates.in(ImmutableSet.of("hConf", "cConf"))))) .build(); return new BasicArguments(args); }
[ "private", "Arguments", "createProgramArguments", "(", "TwillContext", "context", ",", "Map", "<", "String", ",", "String", ">", "configs", ")", "{", "Map", "<", "String", ",", "String", ">", "args", "=", "ImmutableMap", ".", "<", "String", ",", "String", ...
Creates program arguments. It includes all configurations from the specification, excluding hConf and cConf.
[ "Creates", "program", "arguments", ".", "It", "includes", "all", "configurations", "from", "the", "specification", "excluding", "hConf", "and", "cConf", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-flow/src/main/java/co/cask/tigon/internal/app/runtime/distributed/AbstractProgramTwillRunnable.java#L276-L285
liferay/com-liferay-commerce
commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListPersistenceImpl.java
CommerceWishListPersistenceImpl.removeByG_U
@Override public void removeByG_U(long groupId, long userId) { for (CommerceWishList commerceWishList : findByG_U(groupId, userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceWishList); } }
java
@Override public void removeByG_U(long groupId, long userId) { for (CommerceWishList commerceWishList : findByG_U(groupId, userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceWishList); } }
[ "@", "Override", "public", "void", "removeByG_U", "(", "long", "groupId", ",", "long", "userId", ")", "{", "for", "(", "CommerceWishList", "commerceWishList", ":", "findByG_U", "(", "groupId", ",", "userId", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ...
Removes all the commerce wish lists where groupId = &#63; and userId = &#63; from the database. @param groupId the group ID @param userId the user ID
[ "Removes", "all", "the", "commerce", "wish", "lists", "where", "groupId", "=", "&#63", ";", "and", "userId", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListPersistenceImpl.java#L2981-L2987
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/ItemsCountDto.java
ItemsCountDto.transformToDto
public static ItemsCountDto transformToDto(int value) { if (value < 0) { throw new WebApplicationException("Items count cannot be negative", Status.INTERNAL_SERVER_ERROR); } ItemsCountDto result = new ItemsCountDto(); result.setValue(value); return result; }
java
public static ItemsCountDto transformToDto(int value) { if (value < 0) { throw new WebApplicationException("Items count cannot be negative", Status.INTERNAL_SERVER_ERROR); } ItemsCountDto result = new ItemsCountDto(); result.setValue(value); return result; }
[ "public", "static", "ItemsCountDto", "transformToDto", "(", "int", "value", ")", "{", "if", "(", "value", "<", "0", ")", "{", "throw", "new", "WebApplicationException", "(", "\"Items count cannot be negative\"", ",", "Status", ".", "INTERNAL_SERVER_ERROR", ")", ";...
Converts an integer to ItemsCountDto instance. @param value The items count. @return An itemsCountDto object. @throws WebApplicationException If an error occurs.
[ "Converts", "an", "integer", "to", "ItemsCountDto", "instance", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/ItemsCountDto.java#L69-L77
opentok/Opentok-Java-SDK
src/main/java/com/opentok/OpenTok.java
OpenTok.listArchives
public ArchiveList listArchives(String sessionId) throws OpenTokException { if (sessionId == null || sessionId.isEmpty() ) { throw new InvalidArgumentException("Session Id cannot be null or empty"); } return listArchives(sessionId, 0, 1000); }
java
public ArchiveList listArchives(String sessionId) throws OpenTokException { if (sessionId == null || sessionId.isEmpty() ) { throw new InvalidArgumentException("Session Id cannot be null or empty"); } return listArchives(sessionId, 0, 1000); }
[ "public", "ArchiveList", "listArchives", "(", "String", "sessionId", ")", "throws", "OpenTokException", "{", "if", "(", "sessionId", "==", "null", "||", "sessionId", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "\"Session ...
Returns a List of {@link Archive} objects, representing archives that are both both completed and in-progress, for your API key. @param sessionId The sessionid of the session which started or automatically enabled archiving. If the session is null or empty it will be omitted. @return A List of {@link Archive} objects.
[ "Returns", "a", "List", "of", "{", "@link", "Archive", "}", "objects", "representing", "archives", "that", "are", "both", "both", "completed", "and", "in", "-", "progress", "for", "your", "API", "key", "." ]
train
https://github.com/opentok/Opentok-Java-SDK/blob/d71b7999facc3131c415aebea874ea55776d477f/src/main/java/com/opentok/OpenTok.java#L368-L373
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCCallableStatement.java
JDBCCallableStatement.getObject
public synchronized Object getObject( int parameterIndex) throws SQLException { checkGetParameterIndex(parameterIndex); Type sourceType = parameterTypes[parameterIndex - 1]; switch (sourceType.typeCode) { case Types.SQL_DATE : return getDate(parameterIndex); case Types.SQL_TIME : case Types.SQL_TIME_WITH_TIME_ZONE : return getTime(parameterIndex); case Types.SQL_TIMESTAMP : case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : return getTimestamp(parameterIndex); case Types.SQL_BINARY : case Types.SQL_VARBINARY : return getBytes(parameterIndex); case Types.OTHER : case Types.JAVA_OBJECT : { Object o = getColumnInType(parameterIndex, sourceType); if (o == null) { return null; } try { return ((JavaObjectData) o).getObject(); } catch (HsqlException e) { throw Util.sqlException(e); } } default : return getColumnInType(parameterIndex, sourceType); } }
java
public synchronized Object getObject( int parameterIndex) throws SQLException { checkGetParameterIndex(parameterIndex); Type sourceType = parameterTypes[parameterIndex - 1]; switch (sourceType.typeCode) { case Types.SQL_DATE : return getDate(parameterIndex); case Types.SQL_TIME : case Types.SQL_TIME_WITH_TIME_ZONE : return getTime(parameterIndex); case Types.SQL_TIMESTAMP : case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : return getTimestamp(parameterIndex); case Types.SQL_BINARY : case Types.SQL_VARBINARY : return getBytes(parameterIndex); case Types.OTHER : case Types.JAVA_OBJECT : { Object o = getColumnInType(parameterIndex, sourceType); if (o == null) { return null; } try { return ((JavaObjectData) o).getObject(); } catch (HsqlException e) { throw Util.sqlException(e); } } default : return getColumnInType(parameterIndex, sourceType); } }
[ "public", "synchronized", "Object", "getObject", "(", "int", "parameterIndex", ")", "throws", "SQLException", "{", "checkGetParameterIndex", "(", "parameterIndex", ")", ";", "Type", "sourceType", "=", "parameterTypes", "[", "parameterIndex", "-", "1", "]", ";", "s...
<!-- start generic documentation --> Retrieves the value of the designated parameter as an <code>Object</code> in the Java programming language. If the value is an SQL <code>NULL</code>, the driver returns a Java <code>null</code>. <p> This method returns a Java object whose type corresponds to the JDBC type that was registered for this parameter using the method <code>registerOutParameter</code>. By registering the target JDBC type as <code>java.sql.Types.OTHER</code>, this method can be used to read database-specific abstract data types. <!-- end generic documentation --> <!-- start release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> HSQLDB supports this feature. <p> </div> <!-- end release-specific documentation --> @param parameterIndex the first parameter is 1, the second is 2, and so on @return A <code>java.lang.Object</code> holding the OUT parameter value @exception SQLException if a database access error occurs or this method is called on a closed <code>CallableStatement</code> @see java.sql.Types @see #setObject
[ "<!", "--", "start", "generic", "documentation", "--", ">" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCCallableStatement.java#L936-L973
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/utils/ValueMap.java
ValueMap.withNumberSet
public ValueMap withNumberSet(String key, Set<BigDecimal> val) { super.put(key, val); return this; }
java
public ValueMap withNumberSet(String key, Set<BigDecimal> val) { super.put(key, val); return this; }
[ "public", "ValueMap", "withNumberSet", "(", "String", "key", ",", "Set", "<", "BigDecimal", ">", "val", ")", "{", "super", ".", "put", "(", "key", ",", "val", ")", ";", "return", "this", ";", "}" ]
Sets the value of the specified key in the current ValueMap to the given value.
[ "Sets", "the", "value", "of", "the", "specified", "key", "in", "the", "current", "ValueMap", "to", "the", "given", "value", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/utils/ValueMap.java#L113-L116
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/type/UnscaledDecimal128Arithmetic.java
UnscaledDecimal128Arithmetic.divideUnsignedMultiPrecision
private static void divideUnsignedMultiPrecision(int[] dividend, int[] divisor, int[] quotient) { checkArgument(dividend.length == NUMBER_OF_INTS * 2 + 1); checkArgument(divisor.length == NUMBER_OF_INTS * 2); checkArgument(quotient.length == NUMBER_OF_INTS * 2); int divisorLength = digitsInIntegerBase(divisor); int dividendLength = digitsInIntegerBase(dividend); if (dividendLength < divisorLength) { return; } if (divisorLength == 1) { int remainder = divideUnsignedMultiPrecision(dividend, dividendLength, divisor[0]); checkState(dividend[dividend.length - 1] == 0); arraycopy(dividend, 0, quotient, 0, quotient.length); fill(dividend, 0); dividend[0] = remainder; return; } // normalize divisor. Most significant divisor word must be > BASE/2 // effectively it can be achieved by shifting divisor left until the leftmost bit is 1 int nlz = Integer.numberOfLeadingZeros(divisor[divisorLength - 1]); shiftLeftMultiPrecision(divisor, divisorLength, nlz); int normalizedDividendLength = Math.min(dividend.length, dividendLength + 1); shiftLeftMultiPrecision(dividend, normalizedDividendLength, nlz); divideKnuthNormalized(dividend, normalizedDividendLength, divisor, divisorLength, quotient); // un-normalize remainder which is stored in dividend shiftRightMultiPrecision(dividend, normalizedDividendLength, nlz); }
java
private static void divideUnsignedMultiPrecision(int[] dividend, int[] divisor, int[] quotient) { checkArgument(dividend.length == NUMBER_OF_INTS * 2 + 1); checkArgument(divisor.length == NUMBER_OF_INTS * 2); checkArgument(quotient.length == NUMBER_OF_INTS * 2); int divisorLength = digitsInIntegerBase(divisor); int dividendLength = digitsInIntegerBase(dividend); if (dividendLength < divisorLength) { return; } if (divisorLength == 1) { int remainder = divideUnsignedMultiPrecision(dividend, dividendLength, divisor[0]); checkState(dividend[dividend.length - 1] == 0); arraycopy(dividend, 0, quotient, 0, quotient.length); fill(dividend, 0); dividend[0] = remainder; return; } // normalize divisor. Most significant divisor word must be > BASE/2 // effectively it can be achieved by shifting divisor left until the leftmost bit is 1 int nlz = Integer.numberOfLeadingZeros(divisor[divisorLength - 1]); shiftLeftMultiPrecision(divisor, divisorLength, nlz); int normalizedDividendLength = Math.min(dividend.length, dividendLength + 1); shiftLeftMultiPrecision(dividend, normalizedDividendLength, nlz); divideKnuthNormalized(dividend, normalizedDividendLength, divisor, divisorLength, quotient); // un-normalize remainder which is stored in dividend shiftRightMultiPrecision(dividend, normalizedDividendLength, nlz); }
[ "private", "static", "void", "divideUnsignedMultiPrecision", "(", "int", "[", "]", "dividend", ",", "int", "[", "]", "divisor", ",", "int", "[", "]", "quotient", ")", "{", "checkArgument", "(", "dividend", ".", "length", "==", "NUMBER_OF_INTS", "*", "2", "...
Divides mutableDividend / mutable divisor Places quotient in first argument and reminder in first argument
[ "Divides", "mutableDividend", "/", "mutable", "divisor", "Places", "quotient", "in", "first", "argument", "and", "reminder", "in", "first", "argument" ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/type/UnscaledDecimal128Arithmetic.java#L1270-L1303
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PropertiesConfigHelper.java
PropertiesConfigHelper.getPropertyAsSet
public Set<String> getPropertyAsSet(String key) { Set<String> propertiesSet = new HashSet<>(); StringTokenizer tk = new StringTokenizer(props.getProperty(prefix + key, ""), ","); while (tk.hasMoreTokens()) propertiesSet.add(tk.nextToken().trim()); return propertiesSet; }
java
public Set<String> getPropertyAsSet(String key) { Set<String> propertiesSet = new HashSet<>(); StringTokenizer tk = new StringTokenizer(props.getProperty(prefix + key, ""), ","); while (tk.hasMoreTokens()) propertiesSet.add(tk.nextToken().trim()); return propertiesSet; }
[ "public", "Set", "<", "String", ">", "getPropertyAsSet", "(", "String", "key", ")", "{", "Set", "<", "String", ">", "propertiesSet", "=", "new", "HashSet", "<>", "(", ")", ";", "StringTokenizer", "tk", "=", "new", "StringTokenizer", "(", "props", ".", "g...
Returns as a set, the comma separated values of a property @param key the key of the property @return a set of the comma separated values of a property
[ "Returns", "as", "a", "set", "the", "comma", "separated", "values", "of", "a", "property" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PropertiesConfigHelper.java#L269-L275