repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
dbracewell/hermes
hermes-core/src/main/java/com/davidbracewell/hermes/AnnotatorCache.java
AnnotatorCache.setAnnotator
public void setAnnotator(@NonNull AnnotationType annotationType, @NonNull Language language, @NonNull Annotator annotator) { """ Manually caches an annotator for an annotation type / language pair. Note that this will not be safe in a distributed environment like Spark or Map Reduce, but is useful for testing annotators. @param annotationType the annotation type @param language the language @param annotator the annotator """ Preconditions.checkArgument(annotator.satisfies().contains(annotationType), "Attempting to register " + annotator.getClass() .getName() + " for " + annotationType.name() + " which it does not provide"); cache.put(createKey(annotationType, language), annotator); if (language == Language.UNKNOWN) { Config.setProperty("Annotator" + annotationType.name() + ".annotator", "CACHED"); } else { Config.setProperty("Annotator" + annotationType.name() + ".annotator." + language, "CACHED"); } assert cache.containsKey(createKey(annotationType, language)); }
java
public void setAnnotator(@NonNull AnnotationType annotationType, @NonNull Language language, @NonNull Annotator annotator) { Preconditions.checkArgument(annotator.satisfies().contains(annotationType), "Attempting to register " + annotator.getClass() .getName() + " for " + annotationType.name() + " which it does not provide"); cache.put(createKey(annotationType, language), annotator); if (language == Language.UNKNOWN) { Config.setProperty("Annotator" + annotationType.name() + ".annotator", "CACHED"); } else { Config.setProperty("Annotator" + annotationType.name() + ".annotator." + language, "CACHED"); } assert cache.containsKey(createKey(annotationType, language)); }
[ "public", "void", "setAnnotator", "(", "@", "NonNull", "AnnotationType", "annotationType", ",", "@", "NonNull", "Language", "language", ",", "@", "NonNull", "Annotator", "annotator", ")", "{", "Preconditions", ".", "checkArgument", "(", "annotator", ".", "satisfie...
Manually caches an annotator for an annotation type / language pair. Note that this will not be safe in a distributed environment like Spark or Map Reduce, but is useful for testing annotators. @param annotationType the annotation type @param language the language @param annotator the annotator
[ "Manually", "caches", "an", "annotator", "for", "an", "annotation", "type", "/", "language", "pair", ".", "Note", "that", "this", "will", "not", "be", "safe", "in", "a", "distributed", "environment", "like", "Spark", "or", "Map", "Reduce", "but", "is", "us...
train
https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-core/src/main/java/com/davidbracewell/hermes/AnnotatorCache.java#L116-L129
pravega/pravega
common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java
BTreeIndex.get
public CompletableFuture<ByteArraySegment> get(@NonNull ByteArraySegment key, @NonNull Duration timeout) { """ Looks up the value of a single key. @param key A ByteArraySegment representing the key to look up. @param timeout Timeout for the operation. @return A CompletableFuture that, when completed normally, will contain the value associated with the given key. If no value is associated with this key, the Future will complete with null. If the operation failed, the Future will be completed with the appropriate exception. """ ensureInitialized(); TimeoutTimer timer = new TimeoutTimer(timeout); // Lookup the page where the Key should exist (if at all). PageCollection pageCollection = new PageCollection(this.state.get().length); return locatePage(key, pageCollection, timer) .thenApplyAsync(page -> page.getPage().searchExact(key), this.executor); }
java
public CompletableFuture<ByteArraySegment> get(@NonNull ByteArraySegment key, @NonNull Duration timeout) { ensureInitialized(); TimeoutTimer timer = new TimeoutTimer(timeout); // Lookup the page where the Key should exist (if at all). PageCollection pageCollection = new PageCollection(this.state.get().length); return locatePage(key, pageCollection, timer) .thenApplyAsync(page -> page.getPage().searchExact(key), this.executor); }
[ "public", "CompletableFuture", "<", "ByteArraySegment", ">", "get", "(", "@", "NonNull", "ByteArraySegment", "key", ",", "@", "NonNull", "Duration", "timeout", ")", "{", "ensureInitialized", "(", ")", ";", "TimeoutTimer", "timer", "=", "new", "TimeoutTimer", "("...
Looks up the value of a single key. @param key A ByteArraySegment representing the key to look up. @param timeout Timeout for the operation. @return A CompletableFuture that, when completed normally, will contain the value associated with the given key. If no value is associated with this key, the Future will complete with null. If the operation failed, the Future will be completed with the appropriate exception.
[ "Looks", "up", "the", "value", "of", "a", "single", "key", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java#L231-L239
Erudika/para
para-core/src/main/java/com/erudika/para/utils/Utils.java
Utils.getMaxImgSize
public static int[] getMaxImgSize(int h, int w) { """ Returns the adjusted size of an image (doesn't do any resizing). @param h an image height @param w an image width @return the adjusted width and height if they are larger than {@link Config#MAX_IMG_SIZE_PX}. @see Config#MAX_IMG_SIZE_PX """ int[] size = {h, w}; int max = Config.MAX_IMG_SIZE_PX; if (w == h) { size[0] = Math.min(h, max); size[1] = Math.min(w, max); } else if (Math.max(h, w) > max) { int ratio = (100 * max) / Math.max(h, w); if (h > w) { size[0] = max; size[1] = (w * ratio) / 100; } else { size[0] = (h * ratio) / 100; size[1] = max; } } return size; }
java
public static int[] getMaxImgSize(int h, int w) { int[] size = {h, w}; int max = Config.MAX_IMG_SIZE_PX; if (w == h) { size[0] = Math.min(h, max); size[1] = Math.min(w, max); } else if (Math.max(h, w) > max) { int ratio = (100 * max) / Math.max(h, w); if (h > w) { size[0] = max; size[1] = (w * ratio) / 100; } else { size[0] = (h * ratio) / 100; size[1] = max; } } return size; }
[ "public", "static", "int", "[", "]", "getMaxImgSize", "(", "int", "h", ",", "int", "w", ")", "{", "int", "[", "]", "size", "=", "{", "h", ",", "w", "}", ";", "int", "max", "=", "Config", ".", "MAX_IMG_SIZE_PX", ";", "if", "(", "w", "==", "h", ...
Returns the adjusted size of an image (doesn't do any resizing). @param h an image height @param w an image width @return the adjusted width and height if they are larger than {@link Config#MAX_IMG_SIZE_PX}. @see Config#MAX_IMG_SIZE_PX
[ "Returns", "the", "adjusted", "size", "of", "an", "image", "(", "doesn", "t", "do", "any", "resizing", ")", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/utils/Utils.java#L729-L746
dashorst/wicket-stuff-markup-validator
jing/src/main/java/com/thaiopensource/validate/nvdl/NvdlSchemaReceiverFactory.java
NvdlSchemaReceiverFactory.createSchemaReceiver
public SchemaReceiver createSchemaReceiver(String namespaceUri, PropertyMap properties) { """ Checks if the namespace is the NVDL namespace and if yes then it creates a schema receiver, otherwise returns null. """ if (!SchemaImpl.NVDL_URI.equals(namespaceUri)) return null; return new SchemaReceiverImpl(properties); }
java
public SchemaReceiver createSchemaReceiver(String namespaceUri, PropertyMap properties) { if (!SchemaImpl.NVDL_URI.equals(namespaceUri)) return null; return new SchemaReceiverImpl(properties); }
[ "public", "SchemaReceiver", "createSchemaReceiver", "(", "String", "namespaceUri", ",", "PropertyMap", "properties", ")", "{", "if", "(", "!", "SchemaImpl", ".", "NVDL_URI", ".", "equals", "(", "namespaceUri", ")", ")", "return", "null", ";", "return", "new", ...
Checks if the namespace is the NVDL namespace and if yes then it creates a schema receiver, otherwise returns null.
[ "Checks", "if", "the", "namespace", "is", "the", "NVDL", "namespace", "and", "if", "yes", "then", "it", "creates", "a", "schema", "receiver", "otherwise", "returns", "null", "." ]
train
https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/validate/nvdl/NvdlSchemaReceiverFactory.java#L16-L20
denisneuling/apitrary.jar
apitrary-api-client/src/main/java/com/apitrary/api/client/util/ClassUtil.java
ClassUtil.getClassAnnotationValue
@SuppressWarnings( { """ <p> getClassAnnotationValue. </p> @param source a {@link java.lang.Class} object. @param annotation a {@link java.lang.Class} object. @param attributeName a {@link java.lang.String} object. @param expected a {@link java.lang.Class} object. @param <T> a T object. @return a T object. """ "rawtypes", "unchecked" }) public static <T> T getClassAnnotationValue(Class source, Class annotation, String attributeName, Class<T> expected) { Annotation instance = source.getAnnotation(annotation); T value = null; if (instance != null) { try { value = (T) instance.annotationType().getMethod(attributeName).invoke(instance); } catch (Exception ex) { log.warning(ex.getClass().getSimpleName() + ": " + ex.getMessage()); } } return value; }
java
@SuppressWarnings({ "rawtypes", "unchecked" }) public static <T> T getClassAnnotationValue(Class source, Class annotation, String attributeName, Class<T> expected) { Annotation instance = source.getAnnotation(annotation); T value = null; if (instance != null) { try { value = (T) instance.annotationType().getMethod(attributeName).invoke(instance); } catch (Exception ex) { log.warning(ex.getClass().getSimpleName() + ": " + ex.getMessage()); } } return value; }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "static", "<", "T", ">", "T", "getClassAnnotationValue", "(", "Class", "source", ",", "Class", "annotation", ",", "String", "attributeName", ",", "Class", "<", "T", ...
<p> getClassAnnotationValue. </p> @param source a {@link java.lang.Class} object. @param annotation a {@link java.lang.Class} object. @param attributeName a {@link java.lang.String} object. @param expected a {@link java.lang.Class} object. @param <T> a T object. @return a T object.
[ "<p", ">", "getClassAnnotationValue", ".", "<", "/", "p", ">" ]
train
https://github.com/denisneuling/apitrary.jar/blob/b7f639a1e735c60ba2b1b62851926757f5de8628/apitrary-api-client/src/main/java/com/apitrary/api/client/util/ClassUtil.java#L55-L67
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/BuildTasksInner.java
BuildTasksInner.beginCreate
public BuildTaskInner beginCreate(String resourceGroupName, String registryName, String buildTaskName, BuildTaskInner buildTaskCreateParameters) { """ Creates a build task for a container registry with the specified parameters. @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 buildTaskCreateParameters The parameters for creating a build task. @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 BuildTaskInner object if successful. """ return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName, buildTaskCreateParameters).toBlocking().single().body(); }
java
public BuildTaskInner beginCreate(String resourceGroupName, String registryName, String buildTaskName, BuildTaskInner buildTaskCreateParameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName, buildTaskCreateParameters).toBlocking().single().body(); }
[ "public", "BuildTaskInner", "beginCreate", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "buildTaskName", ",", "BuildTaskInner", "buildTaskCreateParameters", ")", "{", "return", "beginCreateWithServiceResponseAsync", "(", "resourceGroupName...
Creates a build task for a container registry with the specified parameters. @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 buildTaskCreateParameters The parameters for creating a build task. @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 BuildTaskInner object if successful.
[ "Creates", "a", "build", "task", "for", "a", "container", "registry", "with", "the", "specified", "parameters", "." ]
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/BuildTasksInner.java#L541-L543
jbundle/jbundle
base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java
BaseHttpTask.getRealPath
public String getRealPath(HttpServletRequest request, String path) { """ Get the physical path for this internet path. @param request The request """ if (m_servlet != null) return m_servlet.getRealPath(request, path); return path; }
java
public String getRealPath(HttpServletRequest request, String path) { if (m_servlet != null) return m_servlet.getRealPath(request, path); return path; }
[ "public", "String", "getRealPath", "(", "HttpServletRequest", "request", ",", "String", "path", ")", "{", "if", "(", "m_servlet", "!=", "null", ")", "return", "m_servlet", ".", "getRealPath", "(", "request", ",", "path", ")", ";", "return", "path", ";", "}...
Get the physical path for this internet path. @param request The request
[ "Get", "the", "physical", "path", "for", "this", "internet", "path", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java#L901-L906
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/subdoc/LookupInBuilder.java
LookupInBuilder.getCount
public LookupInBuilder getCount(String path, SubdocOptionsBuilder optionsBuilder) { """ Get a count of values inside the JSON document. This method is only available with Couchbase Server 5.0 and later. @param path the paths inside the document where to get the count from. @param optionsBuilder {@link SubdocOptionsBuilder} @return this builder for chaining. """ this.async.getCount(path, optionsBuilder); return this; }
java
public LookupInBuilder getCount(String path, SubdocOptionsBuilder optionsBuilder) { this.async.getCount(path, optionsBuilder); return this; }
[ "public", "LookupInBuilder", "getCount", "(", "String", "path", ",", "SubdocOptionsBuilder", "optionsBuilder", ")", "{", "this", ".", "async", ".", "getCount", "(", "path", ",", "optionsBuilder", ")", ";", "return", "this", ";", "}" ]
Get a count of values inside the JSON document. This method is only available with Couchbase Server 5.0 and later. @param path the paths inside the document where to get the count from. @param optionsBuilder {@link SubdocOptionsBuilder} @return this builder for chaining.
[ "Get", "a", "count", "of", "values", "inside", "the", "JSON", "document", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/LookupInBuilder.java#L278-L281
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/protocol/BlockListAsLongs.java
BlockListAsLongs.setBlock
void setBlock(final int index, final Block b) { """ Set the indexTh block @param index - the index of the block to set @param b - the block is set to the value of the this block """ blockList[index2BlockId(index)] = b.getBlockId(); blockList[index2BlockLen(index)] = b.getNumBytes(); blockList[index2BlockGenStamp(index)] = b.getGenerationStamp(); }
java
void setBlock(final int index, final Block b) { blockList[index2BlockId(index)] = b.getBlockId(); blockList[index2BlockLen(index)] = b.getNumBytes(); blockList[index2BlockGenStamp(index)] = b.getGenerationStamp(); }
[ "void", "setBlock", "(", "final", "int", "index", ",", "final", "Block", "b", ")", "{", "blockList", "[", "index2BlockId", "(", "index", ")", "]", "=", "b", ".", "getBlockId", "(", ")", ";", "blockList", "[", "index2BlockLen", "(", "index", ")", "]", ...
Set the indexTh block @param index - the index of the block to set @param b - the block is set to the value of the this block
[ "Set", "the", "indexTh", "block" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/protocol/BlockListAsLongs.java#L138-L142
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java
ComputerVisionImpl.analyzeImageWithServiceResponseAsync
public Observable<ServiceResponse<ImageAnalysis>> analyzeImageWithServiceResponseAsync(String url, AnalyzeImageOptionalParameter analyzeImageOptionalParameter) { """ This operation extracts a rich set of visual features based on the image content. Two input methods are supported -- (1) Uploading an image or (2) specifying an image URL. Within your request, there is an optional parameter to allow you to choose which features to return. By default, image categories are returned in the response. @param url Publicly reachable URL of an image @param analyzeImageOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ImageAnalysis object """ if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } final List<VisualFeatureTypes> visualFeatures = analyzeImageOptionalParameter != null ? analyzeImageOptionalParameter.visualFeatures() : null; final List<Details> details = analyzeImageOptionalParameter != null ? analyzeImageOptionalParameter.details() : null; final String language = analyzeImageOptionalParameter != null ? analyzeImageOptionalParameter.language() : null; return analyzeImageWithServiceResponseAsync(url, visualFeatures, details, language); }
java
public Observable<ServiceResponse<ImageAnalysis>> analyzeImageWithServiceResponseAsync(String url, AnalyzeImageOptionalParameter analyzeImageOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } final List<VisualFeatureTypes> visualFeatures = analyzeImageOptionalParameter != null ? analyzeImageOptionalParameter.visualFeatures() : null; final List<Details> details = analyzeImageOptionalParameter != null ? analyzeImageOptionalParameter.details() : null; final String language = analyzeImageOptionalParameter != null ? analyzeImageOptionalParameter.language() : null; return analyzeImageWithServiceResponseAsync(url, visualFeatures, details, language); }
[ "public", "Observable", "<", "ServiceResponse", "<", "ImageAnalysis", ">", ">", "analyzeImageWithServiceResponseAsync", "(", "String", "url", ",", "AnalyzeImageOptionalParameter", "analyzeImageOptionalParameter", ")", "{", "if", "(", "this", ".", "client", ".", "endpoin...
This operation extracts a rich set of visual features based on the image content. Two input methods are supported -- (1) Uploading an image or (2) specifying an image URL. Within your request, there is an optional parameter to allow you to choose which features to return. By default, image categories are returned in the response. @param url Publicly reachable URL of an image @param analyzeImageOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ImageAnalysis object
[ "This", "operation", "extracts", "a", "rich", "set", "of", "visual", "features", "based", "on", "the", "image", "content", ".", "Two", "input", "methods", "are", "supported", "--", "(", "1", ")", "Uploading", "an", "image", "or", "(", "2", ")", "specifyi...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L2283-L2295
rwl/CSparseJ
src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_fkeep.java
Dcs_fkeep.cs_fkeep
public static int cs_fkeep(Dcs A, Dcs_ifkeep fkeep, Object other) { """ Drops entries from a sparse matrix; @param A column-compressed matrix @param fkeep drop aij if fkeep.fkeep(i,j,aij,other) is false @param other optional parameter to fkeep @return nz, new number of entries in A, -1 on error """ int j, p, nz = 0, n, Ap[], Ai[]; double Ax[]; if (!Dcs_util.CS_CSC(A)) return (-1); /* check inputs */ n = A.n; Ap = A.p; Ai = A.i; Ax = A.x; for (j = 0; j < n; j++) { p = Ap[j]; /* get current location of col j */ Ap[j] = nz; /* record new location of col j */ for (; p < Ap[j + 1]; p++) { if (fkeep.fkeep(Ai[p], j, Ax != null ? Ax[p] : 1, other)) { if (Ax != null) Ax[nz] = Ax[p]; /* keep A(i,j) */ Ai[nz++] = Ai[p]; } } } Ap[n] = nz; /* finalize A */ Dcs_util.cs_sprealloc(A, 0); /* remove extra space from A */ return (nz); }
java
public static int cs_fkeep(Dcs A, Dcs_ifkeep fkeep, Object other) { int j, p, nz = 0, n, Ap[], Ai[]; double Ax[]; if (!Dcs_util.CS_CSC(A)) return (-1); /* check inputs */ n = A.n; Ap = A.p; Ai = A.i; Ax = A.x; for (j = 0; j < n; j++) { p = Ap[j]; /* get current location of col j */ Ap[j] = nz; /* record new location of col j */ for (; p < Ap[j + 1]; p++) { if (fkeep.fkeep(Ai[p], j, Ax != null ? Ax[p] : 1, other)) { if (Ax != null) Ax[nz] = Ax[p]; /* keep A(i,j) */ Ai[nz++] = Ai[p]; } } } Ap[n] = nz; /* finalize A */ Dcs_util.cs_sprealloc(A, 0); /* remove extra space from A */ return (nz); }
[ "public", "static", "int", "cs_fkeep", "(", "Dcs", "A", ",", "Dcs_ifkeep", "fkeep", ",", "Object", "other", ")", "{", "int", "j", ",", "p", ",", "nz", "=", "0", ",", "n", ",", "Ap", "[", "]", ",", "Ai", "[", "]", ";", "double", "Ax", "[", "]"...
Drops entries from a sparse matrix; @param A column-compressed matrix @param fkeep drop aij if fkeep.fkeep(i,j,aij,other) is false @param other optional parameter to fkeep @return nz, new number of entries in A, -1 on error
[ "Drops", "entries", "from", "a", "sparse", "matrix", ";" ]
train
https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_fkeep.java#L48-L71
playn/playn
scene/src/playn/scene/LayerUtil.java
LayerUtil.bind
public static void bind (Layer layer, final Signal<Clock> paint, final Slot<Clock> onPaint) { """ Automatically connects {@code onPaint} to {@code paint} when {@code layer} is added to a scene graph, and disconnects it when {@code layer} is removed. """ layer.state.connectNotify(new Slot<Layer.State>() { public void onEmit (Layer.State state) { _pcon = Closeable.Util.close(_pcon); if (state == Layer.State.ADDED) _pcon = paint.connect(onPaint); } private Closeable _pcon = Closeable.Util.NOOP; }); }
java
public static void bind (Layer layer, final Signal<Clock> paint, final Slot<Clock> onPaint) { layer.state.connectNotify(new Slot<Layer.State>() { public void onEmit (Layer.State state) { _pcon = Closeable.Util.close(_pcon); if (state == Layer.State.ADDED) _pcon = paint.connect(onPaint); } private Closeable _pcon = Closeable.Util.NOOP; }); }
[ "public", "static", "void", "bind", "(", "Layer", "layer", ",", "final", "Signal", "<", "Clock", ">", "paint", ",", "final", "Slot", "<", "Clock", ">", "onPaint", ")", "{", "layer", ".", "state", ".", "connectNotify", "(", "new", "Slot", "<", "Layer", ...
Automatically connects {@code onPaint} to {@code paint} when {@code layer} is added to a scene graph, and disconnects it when {@code layer} is removed.
[ "Automatically", "connects", "{" ]
train
https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/scene/src/playn/scene/LayerUtil.java#L183-L191
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java
LayoutParser.getTag
private Tag getTag(Element node, Tag... tags) { """ Return and validate the tag type, throwing an exception if the tag is unknown or among the allowable types. @param node The DOM node. @param tags The allowable tag types. @return The tag type. """ String name = node.getTagName(); String error = null; try { Tag tag = Tag.valueOf(name.toUpperCase()); int i = ArrayUtils.indexOf(tags, tag); if (i < 0) { error = "Tag '%s' is not valid at this location"; } else { if (!tag.allowMultiple) { tags[i] = null; } return tag; } } catch (IllegalArgumentException e) { error = "Unrecognized tag '%s' in layout"; } throw new IllegalArgumentException(getInvalidTagError(error, name, tags)); }
java
private Tag getTag(Element node, Tag... tags) { String name = node.getTagName(); String error = null; try { Tag tag = Tag.valueOf(name.toUpperCase()); int i = ArrayUtils.indexOf(tags, tag); if (i < 0) { error = "Tag '%s' is not valid at this location"; } else { if (!tag.allowMultiple) { tags[i] = null; } return tag; } } catch (IllegalArgumentException e) { error = "Unrecognized tag '%s' in layout"; } throw new IllegalArgumentException(getInvalidTagError(error, name, tags)); }
[ "private", "Tag", "getTag", "(", "Element", "node", ",", "Tag", "...", "tags", ")", "{", "String", "name", "=", "node", ".", "getTagName", "(", ")", ";", "String", "error", "=", "null", ";", "try", "{", "Tag", "tag", "=", "Tag", ".", "valueOf", "("...
Return and validate the tag type, throwing an exception if the tag is unknown or among the allowable types. @param node The DOM node. @param tags The allowable tag types. @return The tag type.
[ "Return", "and", "validate", "the", "tag", "type", "throwing", "an", "exception", "if", "the", "tag", "is", "unknown", "or", "among", "the", "allowable", "types", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java#L336-L358
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLTemplates.java
SQLTemplates.serializeModifiers
protected void serializeModifiers(QueryMetadata metadata, SQLSerializer context) { """ template method for LIMIT and OFFSET serialization @param metadata @param context """ QueryModifiers mod = metadata.getModifiers(); if (mod.getLimit() != null) { context.handle(limitTemplate, mod.getLimit()); } else if (limitRequired) { context.handle(limitTemplate, maxLimit); } if (mod.getOffset() != null) { context.handle(offsetTemplate, mod.getOffset()); } }
java
protected void serializeModifiers(QueryMetadata metadata, SQLSerializer context) { QueryModifiers mod = metadata.getModifiers(); if (mod.getLimit() != null) { context.handle(limitTemplate, mod.getLimit()); } else if (limitRequired) { context.handle(limitTemplate, maxLimit); } if (mod.getOffset() != null) { context.handle(offsetTemplate, mod.getOffset()); } }
[ "protected", "void", "serializeModifiers", "(", "QueryMetadata", "metadata", ",", "SQLSerializer", "context", ")", "{", "QueryModifiers", "mod", "=", "metadata", ".", "getModifiers", "(", ")", ";", "if", "(", "mod", ".", "getLimit", "(", ")", "!=", "null", "...
template method for LIMIT and OFFSET serialization @param metadata @param context
[ "template", "method", "for", "LIMIT", "and", "OFFSET", "serialization" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLTemplates.java#L967-L977
op4j/op4j
src/main/java/org/op4j/functions/FnNumber.java
FnNumber.roundFloat
public static final Function<Float,Float> roundFloat(final int scale, final RoundingMode roundingMode) { """ <p> It rounds the target with the specified scale and rounding mode </p> @param scale the scale to be used @param roundingMode the {@link RoundingMode} to round the input with @return the {@link Float} """ return new RoundFloat(scale, roundingMode); }
java
public static final Function<Float,Float> roundFloat(final int scale, final RoundingMode roundingMode) { return new RoundFloat(scale, roundingMode); }
[ "public", "static", "final", "Function", "<", "Float", ",", "Float", ">", "roundFloat", "(", "final", "int", "scale", ",", "final", "RoundingMode", "roundingMode", ")", "{", "return", "new", "RoundFloat", "(", "scale", ",", "roundingMode", ")", ";", "}" ]
<p> It rounds the target with the specified scale and rounding mode </p> @param scale the scale to be used @param roundingMode the {@link RoundingMode} to round the input with @return the {@link Float}
[ "<p", ">", "It", "rounds", "the", "target", "with", "the", "specified", "scale", "and", "rounding", "mode", "<", "/", "p", ">" ]
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnNumber.java#L292-L294
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security.feature/src/com/ibm/ws/webcontainer/security/feature/internal/FeatureAuthorizationTable.java
FeatureAuthorizationTable.processConfigProps
private void processConfigProps(Map<String, Object> props) { """ Process the sytemRole properties from the server.xml. @param props """ if (props == null || props.isEmpty()) return; id = (String) props.get(CFG_KEY_ID); if (id == null) { Tr.error(tc, "AUTHZ_ROLE_ID_IS_NULL"); return; } rolePids = (String[]) props.get(CFG_KEY_ROLE); // if (rolePids == null || rolePids.length < 1) // return; processRolePids(); }
java
private void processConfigProps(Map<String, Object> props) { if (props == null || props.isEmpty()) return; id = (String) props.get(CFG_KEY_ID); if (id == null) { Tr.error(tc, "AUTHZ_ROLE_ID_IS_NULL"); return; } rolePids = (String[]) props.get(CFG_KEY_ROLE); // if (rolePids == null || rolePids.length < 1) // return; processRolePids(); }
[ "private", "void", "processConfigProps", "(", "Map", "<", "String", ",", "Object", ">", "props", ")", "{", "if", "(", "props", "==", "null", "||", "props", ".", "isEmpty", "(", ")", ")", "return", ";", "id", "=", "(", "String", ")", "props", ".", "...
Process the sytemRole properties from the server.xml. @param props
[ "Process", "the", "sytemRole", "properties", "from", "the", "server", ".", "xml", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security.feature/src/com/ibm/ws/webcontainer/security/feature/internal/FeatureAuthorizationTable.java#L107-L119
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_udp_frontend_POST
public OvhFrontendUdp serviceName_udp_frontend_POST(String serviceName, String[] dedicatedIpfo, Long defaultFarmId, Boolean disabled, String displayName, String port, String zone) throws IOException { """ Add a new UDP frontend on your IP Load Balancing REST: POST /ipLoadbalancing/{serviceName}/udp/frontend @param zone [required] Zone of your frontend. Use "all" for all owned zone. @param dedicatedIpfo [required] Only attach frontend on these ip. No restriction if null @param disabled [required] Disable your frontend. Default: 'false' @param displayName [required] Human readable name for your frontend, this field is for you @param defaultFarmId [required] Default UDP Farm of your frontend @param port [required] Port(s) attached to your frontend. Supports single port (numerical value), range (2 dash-delimited increasing ports) and comma-separated list of 'single port' and/or 'range'. Each port must be in the [1;49151] range. @param serviceName [required] The internal name of your IP load balancing API beta """ String qPath = "/ipLoadbalancing/{serviceName}/udp/frontend"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "dedicatedIpfo", dedicatedIpfo); addBody(o, "defaultFarmId", defaultFarmId); addBody(o, "disabled", disabled); addBody(o, "displayName", displayName); addBody(o, "port", port); addBody(o, "zone", zone); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhFrontendUdp.class); }
java
public OvhFrontendUdp serviceName_udp_frontend_POST(String serviceName, String[] dedicatedIpfo, Long defaultFarmId, Boolean disabled, String displayName, String port, String zone) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/udp/frontend"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "dedicatedIpfo", dedicatedIpfo); addBody(o, "defaultFarmId", defaultFarmId); addBody(o, "disabled", disabled); addBody(o, "displayName", displayName); addBody(o, "port", port); addBody(o, "zone", zone); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhFrontendUdp.class); }
[ "public", "OvhFrontendUdp", "serviceName_udp_frontend_POST", "(", "String", "serviceName", ",", "String", "[", "]", "dedicatedIpfo", ",", "Long", "defaultFarmId", ",", "Boolean", "disabled", ",", "String", "displayName", ",", "String", "port", ",", "String", "zone",...
Add a new UDP frontend on your IP Load Balancing REST: POST /ipLoadbalancing/{serviceName}/udp/frontend @param zone [required] Zone of your frontend. Use "all" for all owned zone. @param dedicatedIpfo [required] Only attach frontend on these ip. No restriction if null @param disabled [required] Disable your frontend. Default: 'false' @param displayName [required] Human readable name for your frontend, this field is for you @param defaultFarmId [required] Default UDP Farm of your frontend @param port [required] Port(s) attached to your frontend. Supports single port (numerical value), range (2 dash-delimited increasing ports) and comma-separated list of 'single port' and/or 'range'. Each port must be in the [1;49151] range. @param serviceName [required] The internal name of your IP load balancing API beta
[ "Add", "a", "new", "UDP", "frontend", "on", "your", "IP", "Load", "Balancing" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L829-L841
riversun/string-grabber
src/main/java/org/riversun/string_grabber/StringCropper.java
StringCropper.getStringEnclosedInFirst
public String getStringEnclosedInFirst(String srcStr, String startToken, String endToken) { """ returns the first one that enclosed in specific tokens found in the source string. @param srcStr @param startToken @param endToken @return """ return getStringEnclosedInFirstWithDetails(srcStr, startToken, endToken).str; }
java
public String getStringEnclosedInFirst(String srcStr, String startToken, String endToken) { return getStringEnclosedInFirstWithDetails(srcStr, startToken, endToken).str; }
[ "public", "String", "getStringEnclosedInFirst", "(", "String", "srcStr", ",", "String", "startToken", ",", "String", "endToken", ")", "{", "return", "getStringEnclosedInFirstWithDetails", "(", "srcStr", ",", "startToken", ",", "endToken", ")", ".", "str", ";", "}"...
returns the first one that enclosed in specific tokens found in the source string. @param srcStr @param startToken @param endToken @return
[ "returns", "the", "first", "one", "that", "enclosed", "in", "specific", "tokens", "found", "in", "the", "source", "string", "." ]
train
https://github.com/riversun/string-grabber/blob/b5aadc21fe15f50d35392188dec6ab81dcf8d464/src/main/java/org/riversun/string_grabber/StringCropper.java#L133-L135
Azure/azure-sdk-for-java
applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ComponentAvailableFeaturesInner.java
ComponentAvailableFeaturesInner.getAsync
public Observable<ApplicationInsightsComponentAvailableFeaturesInner> getAsync(String resourceGroupName, String resourceName) { """ Returns all available features of the application insights component. @param resourceGroupName The name of the resource group. @param resourceName The name of the Application Insights component resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ApplicationInsightsComponentAvailableFeaturesInner object """ return getWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<ApplicationInsightsComponentAvailableFeaturesInner>, ApplicationInsightsComponentAvailableFeaturesInner>() { @Override public ApplicationInsightsComponentAvailableFeaturesInner call(ServiceResponse<ApplicationInsightsComponentAvailableFeaturesInner> response) { return response.body(); } }); }
java
public Observable<ApplicationInsightsComponentAvailableFeaturesInner> getAsync(String resourceGroupName, String resourceName) { return getWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<ApplicationInsightsComponentAvailableFeaturesInner>, ApplicationInsightsComponentAvailableFeaturesInner>() { @Override public ApplicationInsightsComponentAvailableFeaturesInner call(ServiceResponse<ApplicationInsightsComponentAvailableFeaturesInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ApplicationInsightsComponentAvailableFeaturesInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ")", ".",...
Returns all available features of the application insights component. @param resourceGroupName The name of the resource group. @param resourceName The name of the Application Insights component resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ApplicationInsightsComponentAvailableFeaturesInner object
[ "Returns", "all", "available", "features", "of", "the", "application", "insights", "component", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ComponentAvailableFeaturesInner.java#L95-L102
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/fieldaccessor/FieldAccessor.java
FieldAccessor.setArrayPosition
public void setArrayPosition(final Object targetObj, final CellPosition position, final int index) { """ {@link XlsArrayColumns}フィールド用の位置情報を設定します。 <p>位置情報を保持するフィールドがない場合は、処理はスキップされます。</p> @param targetObj フィールドが定義されているクラスのインスタンス @param position 位置情報 @param index インデックスのキー。0以上を指定します。 @throws IllegalArgumentException {@literal targetObj == null or position == null} @throws IllegalArgumentException {@literal index < 0} """ ArgUtils.notNull(targetObj, "targetObj"); ArgUtils.notNull(position, "position"); ArgUtils.notMin(index, 0, "index"); arrayPositionSetter.ifPresent(setter -> setter.set(targetObj, position, index)); }
java
public void setArrayPosition(final Object targetObj, final CellPosition position, final int index) { ArgUtils.notNull(targetObj, "targetObj"); ArgUtils.notNull(position, "position"); ArgUtils.notMin(index, 0, "index"); arrayPositionSetter.ifPresent(setter -> setter.set(targetObj, position, index)); }
[ "public", "void", "setArrayPosition", "(", "final", "Object", "targetObj", ",", "final", "CellPosition", "position", ",", "final", "int", "index", ")", "{", "ArgUtils", ".", "notNull", "(", "targetObj", ",", "\"targetObj\"", ")", ";", "ArgUtils", ".", "notNull...
{@link XlsArrayColumns}フィールド用の位置情報を設定します。 <p>位置情報を保持するフィールドがない場合は、処理はスキップされます。</p> @param targetObj フィールドが定義されているクラスのインスタンス @param position 位置情報 @param index インデックスのキー。0以上を指定します。 @throws IllegalArgumentException {@literal targetObj == null or position == null} @throws IllegalArgumentException {@literal index < 0}
[ "{", "@link", "XlsArrayColumns", "}", "フィールド用の位置情報を設定します。", "<p", ">", "位置情報を保持するフィールドがない場合は、処理はスキップされます。<", "/", "p", ">" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/fieldaccessor/FieldAccessor.java#L405-L413
getsentry/sentry-java
sentry/src/main/java/io/sentry/SentryClient.java
SentryClient.setExtra
public void setExtra(Map<String, Object> extra) { """ Set the extra data that will be sent with all future {@link Event}s. @param extra Map of extra data """ if (extra == null) { this.extra = new HashMap<>(); } else { this.extra = extra; } }
java
public void setExtra(Map<String, Object> extra) { if (extra == null) { this.extra = new HashMap<>(); } else { this.extra = extra; } }
[ "public", "void", "setExtra", "(", "Map", "<", "String", ",", "Object", ">", "extra", ")", "{", "if", "(", "extra", "==", "null", ")", "{", "this", ".", "extra", "=", "new", "HashMap", "<>", "(", ")", ";", "}", "else", "{", "this", ".", "extra", ...
Set the extra data that will be sent with all future {@link Event}s. @param extra Map of extra data
[ "Set", "the", "extra", "data", "that", "will", "be", "sent", "with", "all", "future", "{", "@link", "Event", "}", "s", "." ]
train
https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry/src/main/java/io/sentry/SentryClient.java#L382-L388
elki-project/elki
elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/DWOF.java
DWOF.updateSizes
private int updateSizes(DBIDs ids, WritableDataStore<ModifiableDBIDs> labels, WritableIntegerDataStore newSizes) { """ This method updates each object's cluster size after the clustering step. @param ids Object IDs to process @param labels references for each object's cluster @param newSizes the sizes container to be updated @return the number of unclustered objects """ // to count the unclustered all over int countUnmerged = 0; for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { // checking the point's new cluster size after the clustering step int newClusterSize = labels.get(iter).size(); newSizes.putInt(iter, newClusterSize); // the point is alone in the cluster --> not merged with other points if(newClusterSize == 1) { countUnmerged++; } } return countUnmerged; }
java
private int updateSizes(DBIDs ids, WritableDataStore<ModifiableDBIDs> labels, WritableIntegerDataStore newSizes) { // to count the unclustered all over int countUnmerged = 0; for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { // checking the point's new cluster size after the clustering step int newClusterSize = labels.get(iter).size(); newSizes.putInt(iter, newClusterSize); // the point is alone in the cluster --> not merged with other points if(newClusterSize == 1) { countUnmerged++; } } return countUnmerged; }
[ "private", "int", "updateSizes", "(", "DBIDs", "ids", ",", "WritableDataStore", "<", "ModifiableDBIDs", ">", "labels", ",", "WritableIntegerDataStore", "newSizes", ")", "{", "// to count the unclustered all over", "int", "countUnmerged", "=", "0", ";", "for", "(", "...
This method updates each object's cluster size after the clustering step. @param ids Object IDs to process @param labels references for each object's cluster @param newSizes the sizes container to be updated @return the number of unclustered objects
[ "This", "method", "updates", "each", "object", "s", "cluster", "size", "after", "the", "clustering", "step", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/DWOF.java#L293-L306
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/utils/SdkUtils.java
SdkUtils.setInitialsThumb
public static void setInitialsThumb(Context context, TextView initialsView, String fullName) { """ Helper method used to display initials into a given textview. @param context current context @param initialsView TextView used to set initials into. @param fullName The user's full name to create initials for. """ char initial1 = '\u0000'; char initial2 = '\u0000'; if (fullName != null) { String[] nameParts = fullName.split(" "); if (nameParts[0].length() > 0) { initial1 = nameParts[0].charAt(0); } if (nameParts.length > 1) { initial2 = nameParts[nameParts.length - 1].charAt(0); } } setColorForInitialsThumb(initialsView, initial1 + initial2); initialsView.setText(initial1 + "" + initial2); initialsView.setTextColor(Color.WHITE); }
java
public static void setInitialsThumb(Context context, TextView initialsView, String fullName) { char initial1 = '\u0000'; char initial2 = '\u0000'; if (fullName != null) { String[] nameParts = fullName.split(" "); if (nameParts[0].length() > 0) { initial1 = nameParts[0].charAt(0); } if (nameParts.length > 1) { initial2 = nameParts[nameParts.length - 1].charAt(0); } } setColorForInitialsThumb(initialsView, initial1 + initial2); initialsView.setText(initial1 + "" + initial2); initialsView.setTextColor(Color.WHITE); }
[ "public", "static", "void", "setInitialsThumb", "(", "Context", "context", ",", "TextView", "initialsView", ",", "String", "fullName", ")", "{", "char", "initial1", "=", "'", "'", ";", "char", "initial2", "=", "'", "'", ";", "if", "(", "fullName", "!=", ...
Helper method used to display initials into a given textview. @param context current context @param initialsView TextView used to set initials into. @param fullName The user's full name to create initials for.
[ "Helper", "method", "used", "to", "display", "initials", "into", "a", "given", "textview", "." ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/utils/SdkUtils.java#L551-L566
JodaOrg/joda-time
src/main/java/org/joda/time/YearMonth.java
YearMonth.readResolve
private Object readResolve() { """ Handle broken serialization from other tools. @return the resolved object, not null """ if (DateTimeZone.UTC.equals(getChronology().getZone()) == false) { return new YearMonth(this, getChronology().withUTC()); } return this; }
java
private Object readResolve() { if (DateTimeZone.UTC.equals(getChronology().getZone()) == false) { return new YearMonth(this, getChronology().withUTC()); } return this; }
[ "private", "Object", "readResolve", "(", ")", "{", "if", "(", "DateTimeZone", ".", "UTC", ".", "equals", "(", "getChronology", "(", ")", ".", "getZone", "(", ")", ")", "==", "false", ")", "{", "return", "new", "YearMonth", "(", "this", ",", "getChronol...
Handle broken serialization from other tools. @return the resolved object, not null
[ "Handle", "broken", "serialization", "from", "other", "tools", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/YearMonth.java#L371-L376
sailthru/sailthru-java-client
src/main/com/sailthru/client/AbstractSailthruClient.java
AbstractSailthruClient.apiPost
public JsonResponse apiPost(ApiParams data, ApiFileParams fileParams) throws IOException { """ HTTP POST Request with Interface implementation of ApiParams and ApiFileParams @param data @param fileParams @throws IOException """ return httpRequestJson(HttpRequestMethod.POST, data, fileParams); }
java
public JsonResponse apiPost(ApiParams data, ApiFileParams fileParams) throws IOException { return httpRequestJson(HttpRequestMethod.POST, data, fileParams); }
[ "public", "JsonResponse", "apiPost", "(", "ApiParams", "data", ",", "ApiFileParams", "fileParams", ")", "throws", "IOException", "{", "return", "httpRequestJson", "(", "HttpRequestMethod", ".", "POST", ",", "data", ",", "fileParams", ")", ";", "}" ]
HTTP POST Request with Interface implementation of ApiParams and ApiFileParams @param data @param fileParams @throws IOException
[ "HTTP", "POST", "Request", "with", "Interface", "implementation", "of", "ApiParams", "and", "ApiFileParams" ]
train
https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/AbstractSailthruClient.java#L291-L293
googleapis/google-http-java-client
google-http-client/src/main/java/com/google/api/client/json/JsonFactory.java
JsonFactory.fromReader
public final <T> T fromReader(Reader reader, Class<T> destinationClass) throws IOException { """ Parse and close a reader as a JSON object, array, or value into a new instance of the given destination class using {@link JsonParser#parseAndClose(Class)}. @param reader JSON value in a reader @param destinationClass destination class that has an accessible default constructor to use to create a new instance @return new instance of the parsed destination class @since 1.7 """ return createJsonParser(reader).parseAndClose(destinationClass); }
java
public final <T> T fromReader(Reader reader, Class<T> destinationClass) throws IOException { return createJsonParser(reader).parseAndClose(destinationClass); }
[ "public", "final", "<", "T", ">", "T", "fromReader", "(", "Reader", "reader", ",", "Class", "<", "T", ">", "destinationClass", ")", "throws", "IOException", "{", "return", "createJsonParser", "(", "reader", ")", ".", "parseAndClose", "(", "destinationClass", ...
Parse and close a reader as a JSON object, array, or value into a new instance of the given destination class using {@link JsonParser#parseAndClose(Class)}. @param reader JSON value in a reader @param destinationClass destination class that has an accessible default constructor to use to create a new instance @return new instance of the parsed destination class @since 1.7
[ "Parse", "and", "close", "a", "reader", "as", "a", "JSON", "object", "array", "or", "value", "into", "a", "new", "instance", "of", "the", "given", "destination", "class", "using", "{", "@link", "JsonParser#parseAndClose", "(", "Class", ")", "}", "." ]
train
https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/json/JsonFactory.java#L228-L230
ehcache/ehcache3
impl/src/main/java/org/ehcache/impl/internal/resilience/RobustLoaderWriterResilienceStrategy.java
RobustLoaderWriterResilienceStrategy.removeFailure
@Override public boolean removeFailure(K key, V value, StoreAccessException e) { """ Delete the key from the loader-writer if it is found with a matching value. Note that the load and write pair is not atomic. This atomicity, if needed, should be handled by the something else. @param key the key being removed @param value the value being removed @param e the triggered failure @return if the value was removed """ try { V loadedValue; try { loadedValue = loaderWriter.load(key); } catch (Exception e1) { throw ExceptionFactory.newCacheLoadingException(e1, e); } if (loadedValue == null) { return false; } if (!loadedValue.equals(value)) { return false; } try { loaderWriter.delete(key); } catch (Exception e1) { throw ExceptionFactory.newCacheWritingException(e1, e); } return true; } finally { cleanup(key, e); } }
java
@Override public boolean removeFailure(K key, V value, StoreAccessException e) { try { V loadedValue; try { loadedValue = loaderWriter.load(key); } catch (Exception e1) { throw ExceptionFactory.newCacheLoadingException(e1, e); } if (loadedValue == null) { return false; } if (!loadedValue.equals(value)) { return false; } try { loaderWriter.delete(key); } catch (Exception e1) { throw ExceptionFactory.newCacheWritingException(e1, e); } return true; } finally { cleanup(key, e); } }
[ "@", "Override", "public", "boolean", "removeFailure", "(", "K", "key", ",", "V", "value", ",", "StoreAccessException", "e", ")", "{", "try", "{", "V", "loadedValue", ";", "try", "{", "loadedValue", "=", "loaderWriter", ".", "load", "(", "key", ")", ";",...
Delete the key from the loader-writer if it is found with a matching value. Note that the load and write pair is not atomic. This atomicity, if needed, should be handled by the something else. @param key the key being removed @param value the value being removed @param e the triggered failure @return if the value was removed
[ "Delete", "the", "key", "from", "the", "loader", "-", "writer", "if", "it", "is", "found", "with", "a", "matching", "value", ".", "Note", "that", "the", "load", "and", "write", "pair", "is", "not", "atomic", ".", "This", "atomicity", "if", "needed", "s...
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/internal/resilience/RobustLoaderWriterResilienceStrategy.java#L165-L192
hankcs/HanLP
src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java
MDAG.simplify
public void simplify() { """ 固化自己<br> Creates a space-saving version of the MDAG in the form of an array. Once the MDAG is simplified, Strings can no longer be added to or removed from it. """ if (sourceNode != null) { mdagDataArray = new SimpleMDAGNode[transitionCount]; createSimpleMDAGTransitionSet(sourceNode, mdagDataArray, 0); simplifiedSourceNode = new SimpleMDAGNode('\0', false, sourceNode.getOutgoingTransitionCount()); //Mark the previous MDAG data structure and equivalenceClassMDAGNodeHashMap //for garbage collection since they are no longer needed. sourceNode = null; equivalenceClassMDAGNodeHashMap = null; ///// } }
java
public void simplify() { if (sourceNode != null) { mdagDataArray = new SimpleMDAGNode[transitionCount]; createSimpleMDAGTransitionSet(sourceNode, mdagDataArray, 0); simplifiedSourceNode = new SimpleMDAGNode('\0', false, sourceNode.getOutgoingTransitionCount()); //Mark the previous MDAG data structure and equivalenceClassMDAGNodeHashMap //for garbage collection since they are no longer needed. sourceNode = null; equivalenceClassMDAGNodeHashMap = null; ///// } }
[ "public", "void", "simplify", "(", ")", "{", "if", "(", "sourceNode", "!=", "null", ")", "{", "mdagDataArray", "=", "new", "SimpleMDAGNode", "[", "transitionCount", "]", ";", "createSimpleMDAGTransitionSet", "(", "sourceNode", ",", "mdagDataArray", ",", "0", "...
固化自己<br> Creates a space-saving version of the MDAG in the form of an array. Once the MDAG is simplified, Strings can no longer be added to or removed from it.
[ "固化自己<br", ">", "Creates", "a", "space", "-", "saving", "version", "of", "the", "MDAG", "in", "the", "form", "of", "an", "array", ".", "Once", "the", "MDAG", "is", "simplified", "Strings", "can", "no", "longer", "be", "added", "to", "or", "removed", "f...
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java#L760-L774
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/process/WordShapeClassifier.java
WordShapeClassifier.wordShape
public static String wordShape(String inStr, int wordShaper, Collection<String> knownLCWords) { """ Specify the string and the int identifying which word shaper to use and this returns the result of using that wordshaper on the String. @param inStr String to calculate word shape of @param wordShaper Constant for which shaping formula to use @param knownLCWords A Collection of known lowercase words, which some shapers use to decide the class of capitalized words. <i>Note: while this code works with any Collection, you should provide a Set for decent performance.</i> If this parameter is null or empty, then this option is not used (capitalized words are treated the same, regardless of whether the lowercased version of the String has been seen). @return The wordshape String """ // this first bit is for backwards compatibility with how things were first // implemented, where the word shaper name encodes whether to useLC. // If the shaper is in the old compatibility list, then a specified // list of knownLCwords is ignored if (knownLCWords != null && dontUseLC(wordShaper)) { knownLCWords = null; } switch (wordShaper) { case NOWORDSHAPE: return inStr; case WORDSHAPEDAN1: return wordShapeDan1(inStr); case WORDSHAPECHRIS1: return wordShapeChris1(inStr); case WORDSHAPEDAN2: return wordShapeDan2(inStr, knownLCWords); case WORDSHAPEDAN2USELC: return wordShapeDan2(inStr, knownLCWords); case WORDSHAPEDAN2BIO: return wordShapeDan2Bio(inStr, knownLCWords); case WORDSHAPEDAN2BIOUSELC: return wordShapeDan2Bio(inStr, knownLCWords); case WORDSHAPEJENNY1: return wordShapeJenny1(inStr, knownLCWords); case WORDSHAPEJENNY1USELC: return wordShapeJenny1(inStr, knownLCWords); case WORDSHAPECHRIS2: return wordShapeChris2(inStr, false, knownLCWords); case WORDSHAPECHRIS2USELC: return wordShapeChris2(inStr, false, knownLCWords); case WORDSHAPECHRIS3: return wordShapeChris2(inStr, true, knownLCWords); case WORDSHAPECHRIS3USELC: return wordShapeChris2(inStr, true, knownLCWords); case WORDSHAPECHRIS4: return wordShapeChris4(inStr, false, knownLCWords); case WORDSHAPEDIGITS: return wordShapeDigits(inStr); default: throw new IllegalStateException("Bad WordShapeClassifier"); } }
java
public static String wordShape(String inStr, int wordShaper, Collection<String> knownLCWords) { // this first bit is for backwards compatibility with how things were first // implemented, where the word shaper name encodes whether to useLC. // If the shaper is in the old compatibility list, then a specified // list of knownLCwords is ignored if (knownLCWords != null && dontUseLC(wordShaper)) { knownLCWords = null; } switch (wordShaper) { case NOWORDSHAPE: return inStr; case WORDSHAPEDAN1: return wordShapeDan1(inStr); case WORDSHAPECHRIS1: return wordShapeChris1(inStr); case WORDSHAPEDAN2: return wordShapeDan2(inStr, knownLCWords); case WORDSHAPEDAN2USELC: return wordShapeDan2(inStr, knownLCWords); case WORDSHAPEDAN2BIO: return wordShapeDan2Bio(inStr, knownLCWords); case WORDSHAPEDAN2BIOUSELC: return wordShapeDan2Bio(inStr, knownLCWords); case WORDSHAPEJENNY1: return wordShapeJenny1(inStr, knownLCWords); case WORDSHAPEJENNY1USELC: return wordShapeJenny1(inStr, knownLCWords); case WORDSHAPECHRIS2: return wordShapeChris2(inStr, false, knownLCWords); case WORDSHAPECHRIS2USELC: return wordShapeChris2(inStr, false, knownLCWords); case WORDSHAPECHRIS3: return wordShapeChris2(inStr, true, knownLCWords); case WORDSHAPECHRIS3USELC: return wordShapeChris2(inStr, true, knownLCWords); case WORDSHAPECHRIS4: return wordShapeChris4(inStr, false, knownLCWords); case WORDSHAPEDIGITS: return wordShapeDigits(inStr); default: throw new IllegalStateException("Bad WordShapeClassifier"); } }
[ "public", "static", "String", "wordShape", "(", "String", "inStr", ",", "int", "wordShaper", ",", "Collection", "<", "String", ">", "knownLCWords", ")", "{", "// this first bit is for backwards compatibility with how things were first\r", "// implemented, where the word shaper ...
Specify the string and the int identifying which word shaper to use and this returns the result of using that wordshaper on the String. @param inStr String to calculate word shape of @param wordShaper Constant for which shaping formula to use @param knownLCWords A Collection of known lowercase words, which some shapers use to decide the class of capitalized words. <i>Note: while this code works with any Collection, you should provide a Set for decent performance.</i> If this parameter is null or empty, then this option is not used (capitalized words are treated the same, regardless of whether the lowercased version of the String has been seen). @return The wordshape String
[ "Specify", "the", "string", "and", "the", "int", "identifying", "which", "word", "shaper", "to", "use", "and", "this", "returns", "the", "result", "of", "using", "that", "wordshaper", "on", "the", "String", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/process/WordShapeClassifier.java#L136-L178
onelogin/onelogin-java-sdk
src/main/java/com/onelogin/sdk/conn/Client.java
Client.sendInviteLink
public Boolean sendInviteLink(String email, String personalEmail) throws OAuthSystemException, OAuthProblemException, URISyntaxException { """ Sends an invite link to a user that you have already created in your OneLogin account. @param email Set to the email address of the user that you want to send an invite link for. @param personalEmail If you want to send the invite email to an email other than the one provided in email, provide it here. The invite link will be sent to this address instead. @return True if the mail with the link was sent @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/invite-links/send-invite-link">Send Invite Link documentation</a> """ cleanError(); prepareToken(); OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient(); OAuthClient oAuthClient = new OAuthClient(httpClient); URIBuilder url = new URIBuilder(settings.getURL(Constants.SEND_INVITE_LINK_URL)); OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString()) .buildHeaderMessage(); Map<String, String> headers = getAuthorizedHeader(); bearerRequest.setHeaders(headers); Map<String, Object> params = new HashMap<String, Object>(); params.put("email", email); if (personalEmail != null) { params.put("personal_email", personalEmail); } String body = JSONUtils.buildJSON(params); bearerRequest.setBody(body); Boolean sent = false; OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.POST, OneloginOAuthJSONResourceResponse.class); if (oAuthResponse.getResponseCode() == 200) { if (oAuthResponse.getType().equals("success")) { sent = true; } } else { error = oAuthResponse.getError(); errorDescription = oAuthResponse.getErrorDescription(); } return sent; }
java
public Boolean sendInviteLink(String email, String personalEmail) throws OAuthSystemException, OAuthProblemException, URISyntaxException { cleanError(); prepareToken(); OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient(); OAuthClient oAuthClient = new OAuthClient(httpClient); URIBuilder url = new URIBuilder(settings.getURL(Constants.SEND_INVITE_LINK_URL)); OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString()) .buildHeaderMessage(); Map<String, String> headers = getAuthorizedHeader(); bearerRequest.setHeaders(headers); Map<String, Object> params = new HashMap<String, Object>(); params.put("email", email); if (personalEmail != null) { params.put("personal_email", personalEmail); } String body = JSONUtils.buildJSON(params); bearerRequest.setBody(body); Boolean sent = false; OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.POST, OneloginOAuthJSONResourceResponse.class); if (oAuthResponse.getResponseCode() == 200) { if (oAuthResponse.getType().equals("success")) { sent = true; } } else { error = oAuthResponse.getError(); errorDescription = oAuthResponse.getErrorDescription(); } return sent; }
[ "public", "Boolean", "sendInviteLink", "(", "String", "email", ",", "String", "personalEmail", ")", "throws", "OAuthSystemException", ",", "OAuthProblemException", ",", "URISyntaxException", "{", "cleanError", "(", ")", ";", "prepareToken", "(", ")", ";", "OneloginU...
Sends an invite link to a user that you have already created in your OneLogin account. @param email Set to the email address of the user that you want to send an invite link for. @param personalEmail If you want to send the invite email to an email other than the one provided in email, provide it here. The invite link will be sent to this address instead. @return True if the mail with the link was sent @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/invite-links/send-invite-link">Send Invite Link documentation</a>
[ "Sends", "an", "invite", "link", "to", "a", "user", "that", "you", "have", "already", "created", "in", "your", "OneLogin", "account", "." ]
train
https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L3036-L3070
netplex/json-smart-v2
json-smart/src/main/java/net/minidev/json/parser/JSONParserInputStream.java
JSONParserInputStream.parse
public Object parse(InputStream in) throws ParseException, UnsupportedEncodingException { """ use to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory @throws UnsupportedEncodingException """ InputStreamReader i2 = new InputStreamReader(in, "utf8"); return super.parse(i2); }
java
public Object parse(InputStream in) throws ParseException, UnsupportedEncodingException { InputStreamReader i2 = new InputStreamReader(in, "utf8"); return super.parse(i2); }
[ "public", "Object", "parse", "(", "InputStream", "in", ")", "throws", "ParseException", ",", "UnsupportedEncodingException", "{", "InputStreamReader", "i2", "=", "new", "InputStreamReader", "(", "in", ",", "\"utf8\"", ")", ";", "return", "super", ".", "parse", "...
use to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory @throws UnsupportedEncodingException
[ "use", "to", "return", "Primitive", "Type", "or", "String", "Or", "JsonObject", "or", "JsonArray", "generated", "by", "a", "ContainerFactory" ]
train
https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/json-smart/src/main/java/net/minidev/json/parser/JSONParserInputStream.java#L41-L44
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java
ReviewsImpl.getReviewAsync
public Observable<Review> getReviewAsync(String teamName, String reviewId) { """ Returns review details for the review Id passed. @param teamName Your Team Name. @param reviewId Id of the review. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the Review object """ return getReviewWithServiceResponseAsync(teamName, reviewId).map(new Func1<ServiceResponse<Review>, Review>() { @Override public Review call(ServiceResponse<Review> response) { return response.body(); } }); }
java
public Observable<Review> getReviewAsync(String teamName, String reviewId) { return getReviewWithServiceResponseAsync(teamName, reviewId).map(new Func1<ServiceResponse<Review>, Review>() { @Override public Review call(ServiceResponse<Review> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Review", ">", "getReviewAsync", "(", "String", "teamName", ",", "String", "reviewId", ")", "{", "return", "getReviewWithServiceResponseAsync", "(", "teamName", ",", "reviewId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResp...
Returns review details for the review Id passed. @param teamName Your Team Name. @param reviewId Id of the review. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the Review object
[ "Returns", "review", "details", "for", "the", "review", "Id", "passed", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java#L166-L173
respoke/respoke-sdk-android
respokeSDK/src/main/java/com/digium/respokesdk/RespokeEndpoint.java
RespokeEndpoint.didSendMessage
public void didSendMessage(final String message, final Date timestamp) { """ Process a sent message. This is used internally to the SDK and should not be called directly by your client application. @param message The body of the message @param timestamp The message timestamp """ new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { if (null != listenerReference) { Listener listener = listenerReference.get(); if (null != listener) { listener.onMessage(message, timestamp, RespokeEndpoint.this, true); } } } }); }
java
public void didSendMessage(final String message, final Date timestamp) { new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { if (null != listenerReference) { Listener listener = listenerReference.get(); if (null != listener) { listener.onMessage(message, timestamp, RespokeEndpoint.this, true); } } } }); }
[ "public", "void", "didSendMessage", "(", "final", "String", "message", ",", "final", "Date", "timestamp", ")", "{", "new", "Handler", "(", "Looper", ".", "getMainLooper", "(", ")", ")", ".", "post", "(", "new", "Runnable", "(", ")", "{", "@", "Override",...
Process a sent message. This is used internally to the SDK and should not be called directly by your client application. @param message The body of the message @param timestamp The message timestamp
[ "Process", "a", "sent", "message", ".", "This", "is", "used", "internally", "to", "the", "SDK", "and", "should", "not", "be", "called", "directly", "by", "your", "client", "application", "." ]
train
https://github.com/respoke/respoke-sdk-android/blob/34a15f0558d29b1f1bc8481bbc5c505e855e05ef/respokeSDK/src/main/java/com/digium/respokesdk/RespokeEndpoint.java#L233-L245
michel-kraemer/bson4jackson
src/main/java/de/undercouch/bson4jackson/BsonGenerator.java
BsonGenerator.writeJavaScript
public void writeJavaScript(JavaScript javaScript, SerializerProvider provider) throws IOException { """ Write a BSON JavaScript object @param javaScript The javaScript to write @param provider The serializer provider, for serializing the scope @throws IOException If an error occurred in the stream while writing """ _writeArrayFieldNameIfNeeded(); _verifyValueWrite("write javascript"); if (javaScript.getScope() == null) { _buffer.putByte(_typeMarker, BsonConstants.TYPE_JAVASCRIPT); _writeString(javaScript.getCode()); } else { _buffer.putByte(_typeMarker, BsonConstants.TYPE_JAVASCRIPT_WITH_SCOPE); // reserve space for the entire structure size int p = _buffer.size(); _buffer.putInt(0); // write the code _writeString(javaScript.getCode()); nextObjectIsEmbeddedInValue = true; // write the document provider.findValueSerializer(Map.class, null).serialize(javaScript.getScope(), this, provider); // write the length if (!isEnabled(Feature.ENABLE_STREAMING)) { int l = _buffer.size() - p; _buffer.putInt(p, l); } } flushBuffer(); }
java
public void writeJavaScript(JavaScript javaScript, SerializerProvider provider) throws IOException { _writeArrayFieldNameIfNeeded(); _verifyValueWrite("write javascript"); if (javaScript.getScope() == null) { _buffer.putByte(_typeMarker, BsonConstants.TYPE_JAVASCRIPT); _writeString(javaScript.getCode()); } else { _buffer.putByte(_typeMarker, BsonConstants.TYPE_JAVASCRIPT_WITH_SCOPE); // reserve space for the entire structure size int p = _buffer.size(); _buffer.putInt(0); // write the code _writeString(javaScript.getCode()); nextObjectIsEmbeddedInValue = true; // write the document provider.findValueSerializer(Map.class, null).serialize(javaScript.getScope(), this, provider); // write the length if (!isEnabled(Feature.ENABLE_STREAMING)) { int l = _buffer.size() - p; _buffer.putInt(p, l); } } flushBuffer(); }
[ "public", "void", "writeJavaScript", "(", "JavaScript", "javaScript", ",", "SerializerProvider", "provider", ")", "throws", "IOException", "{", "_writeArrayFieldNameIfNeeded", "(", ")", ";", "_verifyValueWrite", "(", "\"write javascript\"", ")", ";", "if", "(", "javaS...
Write a BSON JavaScript object @param javaScript The javaScript to write @param provider The serializer provider, for serializing the scope @throws IOException If an error occurred in the stream while writing
[ "Write", "a", "BSON", "JavaScript", "object" ]
train
https://github.com/michel-kraemer/bson4jackson/blob/32d2ab3c516b3c07490fdfcf0c5e4ed0a2ee3979/src/main/java/de/undercouch/bson4jackson/BsonGenerator.java#L747-L772
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.deleteCertificateIssuer
public IssuerBundle deleteCertificateIssuer(String vaultBaseUrl, String issuerName) { """ Deletes the specified certificate issuer. The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from the vault. This operation requires the certificates/manageissuers/deleteissuers permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param issuerName The name of the issuer. @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the IssuerBundle object if successful. """ return deleteCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName).toBlocking().single().body(); }
java
public IssuerBundle deleteCertificateIssuer(String vaultBaseUrl, String issuerName) { return deleteCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName).toBlocking().single().body(); }
[ "public", "IssuerBundle", "deleteCertificateIssuer", "(", "String", "vaultBaseUrl", ",", "String", "issuerName", ")", "{", "return", "deleteCertificateIssuerWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "issuerName", ")", ".", "toBlocking", "(", ")", ".", "single...
Deletes the specified certificate issuer. The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from the vault. This operation requires the certificates/manageissuers/deleteissuers permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param issuerName The name of the issuer. @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the IssuerBundle object if successful.
[ "Deletes", "the", "specified", "certificate", "issuer", ".", "The", "DeleteCertificateIssuer", "operation", "permanently", "removes", "the", "specified", "certificate", "issuer", "from", "the", "vault", ".", "This", "operation", "requires", "the", "certificates", "/",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L6400-L6402
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/transform/OpPredicate.java
OpPredicate.classEquals
public static OpPredicate classEquals(final Class<?> c) { """ Return true if the operation class is equal to the specified class """ return new OpPredicate() { @Override public boolean matches(SameDiff sameDiff, DifferentialFunction function) { return function.getClass() == c; } }; }
java
public static OpPredicate classEquals(final Class<?> c){ return new OpPredicate() { @Override public boolean matches(SameDiff sameDiff, DifferentialFunction function) { return function.getClass() == c; } }; }
[ "public", "static", "OpPredicate", "classEquals", "(", "final", "Class", "<", "?", ">", "c", ")", "{", "return", "new", "OpPredicate", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(", "SameDiff", "sameDiff", ",", "DifferentialFunction", "...
Return true if the operation class is equal to the specified class
[ "Return", "true", "if", "the", "operation", "class", "is", "equal", "to", "the", "specified", "class" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/transform/OpPredicate.java#L90-L97
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.checkSystemLocks
protected void checkSystemLocks(CmsDbContext dbc, CmsResource resource) throws CmsException { """ Checks if the given resource contains a resource that has a system lock.<p> @param dbc the current database context @param resource the resource to check @throws CmsException in case there is a system lock contained in the given resource """ if (m_lockManager.hasSystemLocks(dbc, resource)) { throw new CmsLockException( Messages.get().container( Messages.ERR_RESOURCE_SYSTEM_LOCKED_1, dbc.removeSiteRoot(resource.getRootPath()))); } }
java
protected void checkSystemLocks(CmsDbContext dbc, CmsResource resource) throws CmsException { if (m_lockManager.hasSystemLocks(dbc, resource)) { throw new CmsLockException( Messages.get().container( Messages.ERR_RESOURCE_SYSTEM_LOCKED_1, dbc.removeSiteRoot(resource.getRootPath()))); } }
[ "protected", "void", "checkSystemLocks", "(", "CmsDbContext", "dbc", ",", "CmsResource", "resource", ")", "throws", "CmsException", "{", "if", "(", "m_lockManager", ".", "hasSystemLocks", "(", "dbc", ",", "resource", ")", ")", "{", "throw", "new", "CmsLockExcept...
Checks if the given resource contains a resource that has a system lock.<p> @param dbc the current database context @param resource the resource to check @throws CmsException in case there is a system lock contained in the given resource
[ "Checks", "if", "the", "given", "resource", "contains", "a", "resource", "that", "has", "a", "system", "lock", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L7123-L7131
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.zone_zoneName_dynHost_login_login_changePassword_POST
public void zone_zoneName_dynHost_login_login_changePassword_POST(String zoneName, String login, String password) throws IOException { """ Change password of the DynHost login REST: POST /domain/zone/{zoneName}/dynHost/login/{login}/changePassword @param password [required] New password of the DynHost login @param zoneName [required] The internal name of your zone @param login [required] Login """ String qPath = "/domain/zone/{zoneName}/dynHost/login/{login}/changePassword"; StringBuilder sb = path(qPath, zoneName, login); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "password", password); exec(qPath, "POST", sb.toString(), o); }
java
public void zone_zoneName_dynHost_login_login_changePassword_POST(String zoneName, String login, String password) throws IOException { String qPath = "/domain/zone/{zoneName}/dynHost/login/{login}/changePassword"; StringBuilder sb = path(qPath, zoneName, login); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "password", password); exec(qPath, "POST", sb.toString(), o); }
[ "public", "void", "zone_zoneName_dynHost_login_login_changePassword_POST", "(", "String", "zoneName", ",", "String", "login", ",", "String", "password", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/zone/{zoneName}/dynHost/login/{login}/changePassword\""...
Change password of the DynHost login REST: POST /domain/zone/{zoneName}/dynHost/login/{login}/changePassword @param password [required] New password of the DynHost login @param zoneName [required] The internal name of your zone @param login [required] Login
[ "Change", "password", "of", "the", "DynHost", "login" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L480-L486
aequologica/geppaequo
geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java
MethodUtils.cacheMethod
private static void cacheMethod(MethodDescriptor md, Method method) { """ Add a method to the cache. @param md The method descriptor @param method The method to cache """ if (CACHE_METHODS) { if (method != null) { cache.put(md, new WeakReference<Method>(method)); } } }
java
private static void cacheMethod(MethodDescriptor md, Method method) { if (CACHE_METHODS) { if (method != null) { cache.put(md, new WeakReference<Method>(method)); } } }
[ "private", "static", "void", "cacheMethod", "(", "MethodDescriptor", "md", ",", "Method", "method", ")", "{", "if", "(", "CACHE_METHODS", ")", "{", "if", "(", "method", "!=", "null", ")", "{", "cache", ".", "put", "(", "md", ",", "new", "WeakReference", ...
Add a method to the cache. @param md The method descriptor @param method The method to cache
[ "Add", "a", "method", "to", "the", "cache", "." ]
train
https://github.com/aequologica/geppaequo/blob/b72e5f6356535fd045a931f8c544d4a8ea6e35a2/geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java#L1301-L1307
zeroturnaround/zt-exec
src/main/java/org/zeroturnaround/exec/stream/CallerLoggerUtil.java
CallerLoggerUtil.getName
public static String getName(String name, int level) { """ Returns full name for the caller class' logger. @param name name of the logger. In case of full name (it contains dots) same value is just returned. In case of short names (no dots) the given name is prefixed by caller's class name and a dot. In case of <code>null</code> the caller's class name is just returned. @param level no of call stack levels to get the caller (0 means the caller of this method). @return full name for the caller class' logger. """ level++; String fullName; if (name == null) fullName = getCallerClassName(level); else if (name.contains(".")) fullName = name; else fullName = getCallerClassName(level) + "." + name; return fullName; }
java
public static String getName(String name, int level) { level++; String fullName; if (name == null) fullName = getCallerClassName(level); else if (name.contains(".")) fullName = name; else fullName = getCallerClassName(level) + "." + name; return fullName; }
[ "public", "static", "String", "getName", "(", "String", "name", ",", "int", "level", ")", "{", "level", "++", ";", "String", "fullName", ";", "if", "(", "name", "==", "null", ")", "fullName", "=", "getCallerClassName", "(", "level", ")", ";", "else", "...
Returns full name for the caller class' logger. @param name name of the logger. In case of full name (it contains dots) same value is just returned. In case of short names (no dots) the given name is prefixed by caller's class name and a dot. In case of <code>null</code> the caller's class name is just returned. @param level no of call stack levels to get the caller (0 means the caller of this method). @return full name for the caller class' logger.
[ "Returns", "full", "name", "for", "the", "caller", "class", "logger", "." ]
train
https://github.com/zeroturnaround/zt-exec/blob/6c3b93b99bf3c69c9f41d6350bf7707005b6a4cd/src/main/java/org/zeroturnaround/exec/stream/CallerLoggerUtil.java#L48-L58
Impetus/Kundera
src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java
MongoDBClient.onFlushCollection
private void onFlushCollection(Map<String, List<DBObject>> collections) { """ On collections flush. @param collections collection containing records to be inserted in mongo db. """ for (String tableName : collections.keySet()) { DBCollection dbCollection = mongoDb.getCollection(tableName); KunderaCoreUtils.printQuery("Persist collection:" + tableName, showQuery); try { dbCollection.insert(collections.get(tableName).toArray(new DBObject[0]), getWriteConcern(), encoder); } catch (MongoException ex) { throw new KunderaException("document is not inserted in " + dbCollection.getFullName() + " collection. Caused By:", ex); } } }
java
private void onFlushCollection(Map<String, List<DBObject>> collections) { for (String tableName : collections.keySet()) { DBCollection dbCollection = mongoDb.getCollection(tableName); KunderaCoreUtils.printQuery("Persist collection:" + tableName, showQuery); try { dbCollection.insert(collections.get(tableName).toArray(new DBObject[0]), getWriteConcern(), encoder); } catch (MongoException ex) { throw new KunderaException("document is not inserted in " + dbCollection.getFullName() + " collection. Caused By:", ex); } } }
[ "private", "void", "onFlushCollection", "(", "Map", "<", "String", ",", "List", "<", "DBObject", ">", ">", "collections", ")", "{", "for", "(", "String", "tableName", ":", "collections", ".", "keySet", "(", ")", ")", "{", "DBCollection", "dbCollection", "=...
On collections flush. @param collections collection containing records to be inserted in mongo db.
[ "On", "collections", "flush", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java#L1360-L1377
lucee/Lucee
core/src/main/java/lucee/runtime/converter/WDDXConverter.java
WDDXConverter._serializeList
private String _serializeList(List list, Set<Object> done) throws ConverterException { """ serialize a List (as Array) @param list List to serialize @param done @return serialized list @throws ConverterException """ StringBuilder sb = new StringBuilder(goIn() + "<array length=" + del + list.size() + del + ">"); ListIterator it = list.listIterator(); while (it.hasNext()) { sb.append(_serialize(it.next(), done)); } sb.append(goIn() + "</array>"); return sb.toString(); }
java
private String _serializeList(List list, Set<Object> done) throws ConverterException { StringBuilder sb = new StringBuilder(goIn() + "<array length=" + del + list.size() + del + ">"); ListIterator it = list.listIterator(); while (it.hasNext()) { sb.append(_serialize(it.next(), done)); } sb.append(goIn() + "</array>"); return sb.toString(); }
[ "private", "String", "_serializeList", "(", "List", "list", ",", "Set", "<", "Object", ">", "done", ")", "throws", "ConverterException", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "goIn", "(", ")", "+", "\"<array length=\"", "+", "del", "+...
serialize a List (as Array) @param list List to serialize @param done @return serialized list @throws ConverterException
[ "serialize", "a", "List", "(", "as", "Array", ")" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/WDDXConverter.java#L189-L199
groupon/odo
client/src/main/java/com/groupon/odo/client/Client.java
Client.deleteServerMapping
public List<ServerRedirect> deleteServerMapping(int serverMappingId) { """ Remove a server mapping from current profile by ID @param serverMappingId server mapping ID @return Collection of updated ServerRedirects """ ArrayList<ServerRedirect> servers = new ArrayList<ServerRedirect>(); try { JSONArray serverArray = new JSONArray(doDelete(BASE_SERVER + "/" + serverMappingId, null)); for (int i = 0; i < serverArray.length(); i++) { JSONObject jsonServer = serverArray.getJSONObject(i); ServerRedirect server = getServerRedirectFromJSON(jsonServer); if (server != null) { servers.add(server); } } } catch (Exception e) { e.printStackTrace(); return null; } return servers; }
java
public List<ServerRedirect> deleteServerMapping(int serverMappingId) { ArrayList<ServerRedirect> servers = new ArrayList<ServerRedirect>(); try { JSONArray serverArray = new JSONArray(doDelete(BASE_SERVER + "/" + serverMappingId, null)); for (int i = 0; i < serverArray.length(); i++) { JSONObject jsonServer = serverArray.getJSONObject(i); ServerRedirect server = getServerRedirectFromJSON(jsonServer); if (server != null) { servers.add(server); } } } catch (Exception e) { e.printStackTrace(); return null; } return servers; }
[ "public", "List", "<", "ServerRedirect", ">", "deleteServerMapping", "(", "int", "serverMappingId", ")", "{", "ArrayList", "<", "ServerRedirect", ">", "servers", "=", "new", "ArrayList", "<", "ServerRedirect", ">", "(", ")", ";", "try", "{", "JSONArray", "serv...
Remove a server mapping from current profile by ID @param serverMappingId server mapping ID @return Collection of updated ServerRedirects
[ "Remove", "a", "server", "mapping", "from", "current", "profile", "by", "ID" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/client/src/main/java/com/groupon/odo/client/Client.java#L1039-L1056
kohsuke/args4j
args4j/src/org/kohsuke/args4j/OptionHandlerRegistry.java
OptionHandlerRegistry.registerHandler
public void registerHandler( Class valueType, Class<? extends OptionHandler> handlerClass ) { """ Registers a user-defined {@link OptionHandler} class with args4j. <p> This method allows users to extend the behavior of args4j by writing their own {@link OptionHandler} implementation. @param valueType The specified handler is used when the field/method annotated by {@link Option} is of this type. @param handlerClass This class must have the constructor that has the same signature as {@link OptionHandler#OptionHandler(CmdLineParser, OptionDef, Setter)} @throws NullPointerException if {@code valueType} or {@code handlerClass} is {@code null}. @throws IllegalArgumentException if {@code handlerClass} is not a subtype of {@code OptionHandler}. """ checkNonNull(valueType, "valueType"); checkNonNull(handlerClass, "handlerClass"); if(!OptionHandler.class.isAssignableFrom(handlerClass)) throw new IllegalArgumentException(Messages.NO_OPTIONHANDLER.format()); handlers.put(valueType, new DefaultConstructorHandlerFactory(handlerClass)); }
java
public void registerHandler( Class valueType, Class<? extends OptionHandler> handlerClass ) { checkNonNull(valueType, "valueType"); checkNonNull(handlerClass, "handlerClass"); if(!OptionHandler.class.isAssignableFrom(handlerClass)) throw new IllegalArgumentException(Messages.NO_OPTIONHANDLER.format()); handlers.put(valueType, new DefaultConstructorHandlerFactory(handlerClass)); }
[ "public", "void", "registerHandler", "(", "Class", "valueType", ",", "Class", "<", "?", "extends", "OptionHandler", ">", "handlerClass", ")", "{", "checkNonNull", "(", "valueType", ",", "\"valueType\"", ")", ";", "checkNonNull", "(", "handlerClass", ",", "\"hand...
Registers a user-defined {@link OptionHandler} class with args4j. <p> This method allows users to extend the behavior of args4j by writing their own {@link OptionHandler} implementation. @param valueType The specified handler is used when the field/method annotated by {@link Option} is of this type. @param handlerClass This class must have the constructor that has the same signature as {@link OptionHandler#OptionHandler(CmdLineParser, OptionDef, Setter)} @throws NullPointerException if {@code valueType} or {@code handlerClass} is {@code null}. @throws IllegalArgumentException if {@code handlerClass} is not a subtype of {@code OptionHandler}.
[ "Registers", "a", "user", "-", "defined", "{", "@link", "OptionHandler", "}", "class", "with", "args4j", "." ]
train
https://github.com/kohsuke/args4j/blob/dc2e7e265caf15a1a146e3389c1f16a8781f06cf/args4j/src/org/kohsuke/args4j/OptionHandlerRegistry.java#L131-L139
google/closure-templates
java/src/com/google/template/soy/jbcsrc/restricted/TypeInfo.java
TypeInfo.innerClass
public final TypeInfo innerClass(String simpleName) { """ Returns a new {@link TypeInfo} for an inner class of this class. """ checkArgument( simpleName.indexOf('$') == -1, "Simple names shouldn't contain '$': %s", simpleName); String className = className() + '$' + simpleName; String internalName = internalName() + '$' + simpleName; Type type = Type.getObjectType(internalName); return new AutoValue_TypeInfo(className, simpleName, internalName, type); }
java
public final TypeInfo innerClass(String simpleName) { checkArgument( simpleName.indexOf('$') == -1, "Simple names shouldn't contain '$': %s", simpleName); String className = className() + '$' + simpleName; String internalName = internalName() + '$' + simpleName; Type type = Type.getObjectType(internalName); return new AutoValue_TypeInfo(className, simpleName, internalName, type); }
[ "public", "final", "TypeInfo", "innerClass", "(", "String", "simpleName", ")", "{", "checkArgument", "(", "simpleName", ".", "indexOf", "(", "'", "'", ")", "==", "-", "1", ",", "\"Simple names shouldn't contain '$': %s\"", ",", "simpleName", ")", ";", "String", ...
Returns a new {@link TypeInfo} for an inner class of this class.
[ "Returns", "a", "new", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/TypeInfo.java#L57-L64
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/view/zml/ZScreenField.java
ZScreenField.addHiddenParam
public void addHiddenParam(PrintWriter out, String strParam, String strValue) { """ Add this hidden param to the output stream. @param out The html output stream. @param strParam The parameter. @param strValue The param's value. """ // Override this (if you don't want straight XML written) out.print("<param name=\"" + strParam + "\">"); if (strValue != null) out.print(strValue); out.println(Utility.endTag("param")); }
java
public void addHiddenParam(PrintWriter out, String strParam, String strValue) { // Override this (if you don't want straight XML written) out.print("<param name=\"" + strParam + "\">"); if (strValue != null) out.print(strValue); out.println(Utility.endTag("param")); }
[ "public", "void", "addHiddenParam", "(", "PrintWriter", "out", ",", "String", "strParam", ",", "String", "strValue", ")", "{", "// Override this (if you don't want straight XML written)", "out", ".", "print", "(", "\"<param name=\\\"\"", "+", "strParam", "+", "\"\\\">\"...
Add this hidden param to the output stream. @param out The html output stream. @param strParam The parameter. @param strValue The param's value.
[ "Add", "this", "hidden", "param", "to", "the", "output", "stream", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/view/zml/ZScreenField.java#L346-L353
geomajas/geomajas-project-hammer-gwt
hammer-gwt/src/main/java/org/geomajas/hammergwt/client/HammerGwt.java
HammerGwt.off
public static void off(HammerTime hammerTime, EventType eventType, NativeHammmerHandler callback) { """ Unregister hammer event. @param hammerTime {@link HammerTime} hammer gwt instance. @param eventType {@link org.geomajas.hammergwt.client.event.EventType} @param callback {@link org.geomajas.hammergwt.client.handler.NativeHammmerHandler} of the event that needs to be unregistered. """ off(hammerTime, callback, eventType.getText()); }
java
public static void off(HammerTime hammerTime, EventType eventType, NativeHammmerHandler callback) { off(hammerTime, callback, eventType.getText()); }
[ "public", "static", "void", "off", "(", "HammerTime", "hammerTime", ",", "EventType", "eventType", ",", "NativeHammmerHandler", "callback", ")", "{", "off", "(", "hammerTime", ",", "callback", ",", "eventType", ".", "getText", "(", ")", ")", ";", "}" ]
Unregister hammer event. @param hammerTime {@link HammerTime} hammer gwt instance. @param eventType {@link org.geomajas.hammergwt.client.event.EventType} @param callback {@link org.geomajas.hammergwt.client.handler.NativeHammmerHandler} of the event that needs to be unregistered.
[ "Unregister", "hammer", "event", "." ]
train
https://github.com/geomajas/geomajas-project-hammer-gwt/blob/bc764171bed55e5a9eced72f0078ec22b8105b62/hammer-gwt/src/main/java/org/geomajas/hammergwt/client/HammerGwt.java#L58-L60
threerings/nenya
core/src/main/java/com/threerings/media/util/PerformanceMonitor.java
PerformanceMonitor.unregister
public static void unregister (PerformanceObserver obs, String name) { """ Un-register the named action associated with the given observer. @param obs the action observer. @param name the action name. """ // get the observer's action hashtable Map<String, PerformanceAction> actions = _observers.get(obs); if (actions == null) { log.warning("Attempt to unregister by unknown observer " + "[observer=" + obs + ", name=" + name + "]."); return; } // attempt to remove the specified action PerformanceAction action = actions.remove(name); if (action == null) { log.warning("Attempt to unregister unknown action " + "[observer=" + obs + ", name=" + name + "]."); return; } // if the observer has no actions left, remove the observer's action // hash in its entirety if (actions.size() == 0) { _observers.remove(obs); } }
java
public static void unregister (PerformanceObserver obs, String name) { // get the observer's action hashtable Map<String, PerformanceAction> actions = _observers.get(obs); if (actions == null) { log.warning("Attempt to unregister by unknown observer " + "[observer=" + obs + ", name=" + name + "]."); return; } // attempt to remove the specified action PerformanceAction action = actions.remove(name); if (action == null) { log.warning("Attempt to unregister unknown action " + "[observer=" + obs + ", name=" + name + "]."); return; } // if the observer has no actions left, remove the observer's action // hash in its entirety if (actions.size() == 0) { _observers.remove(obs); } }
[ "public", "static", "void", "unregister", "(", "PerformanceObserver", "obs", ",", "String", "name", ")", "{", "// get the observer's action hashtable", "Map", "<", "String", ",", "PerformanceAction", ">", "actions", "=", "_observers", ".", "get", "(", "obs", ")", ...
Un-register the named action associated with the given observer. @param obs the action observer. @param name the action name.
[ "Un", "-", "register", "the", "named", "action", "associated", "with", "the", "given", "observer", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/util/PerformanceMonitor.java#L77-L100
agmip/dome
src/main/java/org/agmip/dome/Command.java
Command.getPathOr
public static String getPathOr(String var, String def) { """ Get a valid path from the pathfiner, or if not found, a user-specified path. """ String path = AcePathfinder.INSTANCE.getPath(var); if (path == null) { path = def; } return path; }
java
public static String getPathOr(String var, String def) { String path = AcePathfinder.INSTANCE.getPath(var); if (path == null) { path = def; } return path; }
[ "public", "static", "String", "getPathOr", "(", "String", "var", ",", "String", "def", ")", "{", "String", "path", "=", "AcePathfinder", ".", "INSTANCE", ".", "getPath", "(", "var", ")", ";", "if", "(", "path", "==", "null", ")", "{", "path", "=", "d...
Get a valid path from the pathfiner, or if not found, a user-specified path.
[ "Get", "a", "valid", "path", "from", "the", "pathfiner", "or", "if", "not", "found", "a", "user", "-", "specified", "path", "." ]
train
https://github.com/agmip/dome/blob/ca7c15bf2bae09bb7e8d51160e77592bbda9343d/src/main/java/org/agmip/dome/Command.java#L115-L121
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Bridge.java
Bridge.getBridgeCalls
public List<Call> getBridgeCalls() throws Exception { """ Gets list of calls that are on the bridge @return list of calls @throws IOException unexpected error. """ final String callsPath = StringUtils.join(new String[]{ getUri(), "calls" }, '/'); final JSONArray jsonArray = toJSONArray(client.get(callsPath, null)); final List<Call> callList = new ArrayList<Call>(); for (final Object obj : jsonArray) { callList.add(new Call(client, (JSONObject) obj)); } return callList; }
java
public List<Call> getBridgeCalls() throws Exception { final String callsPath = StringUtils.join(new String[]{ getUri(), "calls" }, '/'); final JSONArray jsonArray = toJSONArray(client.get(callsPath, null)); final List<Call> callList = new ArrayList<Call>(); for (final Object obj : jsonArray) { callList.add(new Call(client, (JSONObject) obj)); } return callList; }
[ "public", "List", "<", "Call", ">", "getBridgeCalls", "(", ")", "throws", "Exception", "{", "final", "String", "callsPath", "=", "StringUtils", ".", "join", "(", "new", "String", "[", "]", "{", "getUri", "(", ")", ",", "\"calls\"", "}", ",", "'", "'", ...
Gets list of calls that are on the bridge @return list of calls @throws IOException unexpected error.
[ "Gets", "list", "of", "calls", "that", "are", "on", "the", "bridge" ]
train
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Bridge.java#L213-L225
Harium/keel
src/main/java/com/harium/keel/catalano/math/Tools.java
Tools.Clamp
public static double Clamp(double x, double min, double max) { """ Clamp values. @param x Value. @param min Minimum value. @param max Maximum value. @return Value. """ if (x < min) return min; if (x > max) return max; return x; }
java
public static double Clamp(double x, double min, double max) { if (x < min) return min; if (x > max) return max; return x; }
[ "public", "static", "double", "Clamp", "(", "double", "x", ",", "double", "min", ",", "double", "max", ")", "{", "if", "(", "x", "<", "min", ")", "return", "min", ";", "if", "(", "x", ">", "max", ")", "return", "max", ";", "return", "x", ";", "...
Clamp values. @param x Value. @param min Minimum value. @param max Maximum value. @return Value.
[ "Clamp", "values", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/Tools.java#L157-L163
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.beginCreateOrUpdateAsync
public Observable<AppServicePlanInner> beginCreateOrUpdateAsync(String resourceGroupName, String name, AppServicePlanInner appServicePlan) { """ Creates or updates an App Service Plan. Creates or updates 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 appServicePlan Details of the App Service plan. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AppServicePlanInner object """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, name, appServicePlan).map(new Func1<ServiceResponse<AppServicePlanInner>, AppServicePlanInner>() { @Override public AppServicePlanInner call(ServiceResponse<AppServicePlanInner> response) { return response.body(); } }); }
java
public Observable<AppServicePlanInner> beginCreateOrUpdateAsync(String resourceGroupName, String name, AppServicePlanInner appServicePlan) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, name, appServicePlan).map(new Func1<ServiceResponse<AppServicePlanInner>, AppServicePlanInner>() { @Override public AppServicePlanInner call(ServiceResponse<AppServicePlanInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AppServicePlanInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "name", ",", "AppServicePlanInner", "appServicePlan", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroup...
Creates or updates an App Service Plan. Creates or updates 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 appServicePlan Details of the App Service plan. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AppServicePlanInner object
[ "Creates", "or", "updates", "an", "App", "Service", "Plan", ".", "Creates", "or", "updates", "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#L785-L792
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getMovieAccountState
public MediaState getMovieAccountState(int movieId, String sessionId) throws MovieDbException { """ This method lets a user get the status of whether or not the movie has been rated or added to their favourite or movie watch list. A valid session id is required. @param movieId movieId @param sessionId sessionId @return @throws MovieDbException exception """ return tmdbMovies.getMovieAccountState(movieId, sessionId); }
java
public MediaState getMovieAccountState(int movieId, String sessionId) throws MovieDbException { return tmdbMovies.getMovieAccountState(movieId, sessionId); }
[ "public", "MediaState", "getMovieAccountState", "(", "int", "movieId", ",", "String", "sessionId", ")", "throws", "MovieDbException", "{", "return", "tmdbMovies", ".", "getMovieAccountState", "(", "movieId", ",", "sessionId", ")", ";", "}" ]
This method lets a user get the status of whether or not the movie has been rated or added to their favourite or movie watch list. A valid session id is required. @param movieId movieId @param sessionId sessionId @return @throws MovieDbException exception
[ "This", "method", "lets", "a", "user", "get", "the", "status", "of", "whether", "or", "not", "the", "movie", "has", "been", "rated", "or", "added", "to", "their", "favourite", "or", "movie", "watch", "list", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L883-L885
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/VertexDescription.java
VertexDescription.isDefaultValue
public static boolean isDefaultValue(int semantics, double v) { """ Checks if the given value is the default one. The simple equality test with GetDefaultValue does not work due to the use of NaNs as default value for some parameters. """ return NumberUtils.doubleToInt64Bits(_defaultValues[semantics]) == NumberUtils .doubleToInt64Bits(v); }
java
public static boolean isDefaultValue(int semantics, double v) { return NumberUtils.doubleToInt64Bits(_defaultValues[semantics]) == NumberUtils .doubleToInt64Bits(v); }
[ "public", "static", "boolean", "isDefaultValue", "(", "int", "semantics", ",", "double", "v", ")", "{", "return", "NumberUtils", ".", "doubleToInt64Bits", "(", "_defaultValues", "[", "semantics", "]", ")", "==", "NumberUtils", ".", "doubleToInt64Bits", "(", "v",...
Checks if the given value is the default one. The simple equality test with GetDefaultValue does not work due to the use of NaNs as default value for some parameters.
[ "Checks", "if", "the", "given", "value", "is", "the", "default", "one", ".", "The", "simple", "equality", "test", "with", "GetDefaultValue", "does", "not", "work", "due", "to", "the", "use", "of", "NaNs", "as", "default", "value", "for", "some", "parameter...
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/VertexDescription.java#L257-L260
Azure/azure-sdk-for-java
policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/implementation/PolicySetDefinitionsInner.java
PolicySetDefinitionsInner.createOrUpdate
public PolicySetDefinitionInner createOrUpdate(String policySetDefinitionName, PolicySetDefinitionInner parameters) { """ Creates or updates a policy set definition. This operation creates or updates a policy set definition in the given subscription with the given name. @param policySetDefinitionName The name of the policy set definition to create. @param parameters The policy set definition properties. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PolicySetDefinitionInner object if successful. """ return createOrUpdateWithServiceResponseAsync(policySetDefinitionName, parameters).toBlocking().single().body(); }
java
public PolicySetDefinitionInner createOrUpdate(String policySetDefinitionName, PolicySetDefinitionInner parameters) { return createOrUpdateWithServiceResponseAsync(policySetDefinitionName, parameters).toBlocking().single().body(); }
[ "public", "PolicySetDefinitionInner", "createOrUpdate", "(", "String", "policySetDefinitionName", ",", "PolicySetDefinitionInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "policySetDefinitionName", ",", "parameters", ")", ".", "toBlockin...
Creates or updates a policy set definition. This operation creates or updates a policy set definition in the given subscription with the given name. @param policySetDefinitionName The name of the policy set definition to create. @param parameters The policy set definition properties. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PolicySetDefinitionInner object if successful.
[ "Creates", "or", "updates", "a", "policy", "set", "definition", ".", "This", "operation", "creates", "or", "updates", "a", "policy", "set", "definition", "in", "the", "given", "subscription", "with", "the", "given", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/implementation/PolicySetDefinitionsInner.java#L129-L131
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/sax/Excel07SaxReader.java
Excel07SaxReader.read
public Excel07SaxReader read(OPCPackage opcPackage, int sheetIndex) throws POIException { """ 开始读取Excel,Sheet编号从0开始计数 @param opcPackage {@link OPCPackage},Excel包 @param sheetIndex Excel中的sheet编号,如果为-1处理所有编号的sheet @return this @throws POIException POI异常 """ InputStream sheetInputStream = null; try { final XSSFReader xssfReader = new XSSFReader(opcPackage); // 获取共享样式表 stylesTable = xssfReader.getStylesTable(); // 获取共享字符串表 this.sharedStringsTable = xssfReader.getSharedStringsTable(); if (sheetIndex > -1) { this.sheetIndex = sheetIndex; // 根据 rId# 或 rSheet# 查找sheet sheetInputStream = xssfReader.getSheet(RID_PREFIX + (sheetIndex + 1)); parse(sheetInputStream); } else { this.sheetIndex = -1; // 遍历所有sheet final Iterator<InputStream> sheetInputStreams = xssfReader.getSheetsData(); while (sheetInputStreams.hasNext()) { // 重新读取一个sheet时行归零 curRow = 0; this.sheetIndex++; sheetInputStream = sheetInputStreams.next(); parse(sheetInputStream); } } } catch (DependencyException e) { throw e; } catch (Exception e) { throw ExceptionUtil.wrap(e, POIException.class); } finally { IoUtil.close(sheetInputStream); } return this; }
java
public Excel07SaxReader read(OPCPackage opcPackage, int sheetIndex) throws POIException { InputStream sheetInputStream = null; try { final XSSFReader xssfReader = new XSSFReader(opcPackage); // 获取共享样式表 stylesTable = xssfReader.getStylesTable(); // 获取共享字符串表 this.sharedStringsTable = xssfReader.getSharedStringsTable(); if (sheetIndex > -1) { this.sheetIndex = sheetIndex; // 根据 rId# 或 rSheet# 查找sheet sheetInputStream = xssfReader.getSheet(RID_PREFIX + (sheetIndex + 1)); parse(sheetInputStream); } else { this.sheetIndex = -1; // 遍历所有sheet final Iterator<InputStream> sheetInputStreams = xssfReader.getSheetsData(); while (sheetInputStreams.hasNext()) { // 重新读取一个sheet时行归零 curRow = 0; this.sheetIndex++; sheetInputStream = sheetInputStreams.next(); parse(sheetInputStream); } } } catch (DependencyException e) { throw e; } catch (Exception e) { throw ExceptionUtil.wrap(e, POIException.class); } finally { IoUtil.close(sheetInputStream); } return this; }
[ "public", "Excel07SaxReader", "read", "(", "OPCPackage", "opcPackage", ",", "int", "sheetIndex", ")", "throws", "POIException", "{", "InputStream", "sheetInputStream", "=", "null", ";", "try", "{", "final", "XSSFReader", "xssfReader", "=", "new", "XSSFReader", "("...
开始读取Excel,Sheet编号从0开始计数 @param opcPackage {@link OPCPackage},Excel包 @param sheetIndex Excel中的sheet编号,如果为-1处理所有编号的sheet @return this @throws POIException POI异常
[ "开始读取Excel,Sheet编号从0开始计数" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/sax/Excel07SaxReader.java#L138-L173
landawn/AbacusUtil
src/com/landawn/abacus/util/N.java
N.mapToLong
public static <T, E extends Exception> LongList mapToLong(final T[] a, final int fromIndex, final int toIndex, final Try.ToLongFunction<? super T, E> func) throws E { """ Mostly it's designed for one-step operation to complete the operation in one step. <code>java.util.stream.Stream</code> is preferred for multiple phases operation. @param a @param fromIndex @param toIndex @param func @return """ checkFromToIndex(fromIndex, toIndex, len(a)); N.checkArgNotNull(func); if (N.isNullOrEmpty(a)) { return new LongList(); } final LongList result = new LongList(toIndex - fromIndex); for (int i = fromIndex; i < toIndex; i++) { result.add(func.applyAsLong(a[i])); } return result; }
java
public static <T, E extends Exception> LongList mapToLong(final T[] a, final int fromIndex, final int toIndex, final Try.ToLongFunction<? super T, E> func) throws E { checkFromToIndex(fromIndex, toIndex, len(a)); N.checkArgNotNull(func); if (N.isNullOrEmpty(a)) { return new LongList(); } final LongList result = new LongList(toIndex - fromIndex); for (int i = fromIndex; i < toIndex; i++) { result.add(func.applyAsLong(a[i])); } return result; }
[ "public", "static", "<", "T", ",", "E", "extends", "Exception", ">", "LongList", "mapToLong", "(", "final", "T", "[", "]", "a", ",", "final", "int", "fromIndex", ",", "final", "int", "toIndex", ",", "final", "Try", ".", "ToLongFunction", "<", "?", "sup...
Mostly it's designed for one-step operation to complete the operation in one step. <code>java.util.stream.Stream</code> is preferred for multiple phases operation. @param a @param fromIndex @param toIndex @param func @return
[ "Mostly", "it", "s", "designed", "for", "one", "-", "step", "operation", "to", "complete", "the", "operation", "in", "one", "step", ".", "<code", ">", "java", ".", "util", ".", "stream", ".", "Stream<", "/", "code", ">", "is", "preferred", "for", "mult...
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L14977-L14993
hazelcast/hazelcast
hazelcast-client/src/main/java/com/hazelcast/client/config/ClientAliasedDiscoveryConfigUtils.java
ClientAliasedDiscoveryConfigUtils.getConfigByTag
public static AliasedDiscoveryConfig getConfigByTag(ClientNetworkConfig config, String tag) { """ Gets the {@link AliasedDiscoveryConfig} from {@code config} by {@code tag}. """ if ("aws".equals(tag)) { return config.getAwsConfig(); } else if ("gcp".equals(tag)) { return config.getGcpConfig(); } else if ("azure".equals(tag)) { return config.getAzureConfig(); } else if ("kubernetes".equals(tag)) { return config.getKubernetesConfig(); } else if ("eureka".equals(tag)) { return config.getEurekaConfig(); } else { throw new InvalidConfigurationException(String.format("Invalid configuration tag: '%s'", tag)); } }
java
public static AliasedDiscoveryConfig getConfigByTag(ClientNetworkConfig config, String tag) { if ("aws".equals(tag)) { return config.getAwsConfig(); } else if ("gcp".equals(tag)) { return config.getGcpConfig(); } else if ("azure".equals(tag)) { return config.getAzureConfig(); } else if ("kubernetes".equals(tag)) { return config.getKubernetesConfig(); } else if ("eureka".equals(tag)) { return config.getEurekaConfig(); } else { throw new InvalidConfigurationException(String.format("Invalid configuration tag: '%s'", tag)); } }
[ "public", "static", "AliasedDiscoveryConfig", "getConfigByTag", "(", "ClientNetworkConfig", "config", ",", "String", "tag", ")", "{", "if", "(", "\"aws\"", ".", "equals", "(", "tag", ")", ")", "{", "return", "config", ".", "getAwsConfig", "(", ")", ";", "}",...
Gets the {@link AliasedDiscoveryConfig} from {@code config} by {@code tag}.
[ "Gets", "the", "{" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast-client/src/main/java/com/hazelcast/client/config/ClientAliasedDiscoveryConfigUtils.java#L46-L60
GerdHolz/TOVAL
src/de/invation/code/toval/file/FileWriter.java
FileWriter.checkPath
private synchronized void checkPath(String logPath) throws ParameterException { """ Sets the path for the file writer where output files are put in. @param logPath Desired log path. @throws ParameterException if the given path is <code>null</null> or not a directory. """ Validate.notNull(path); File cPath = new File(logPath); if(!cPath.exists()) cPath.mkdirs(); if(!cPath.isDirectory()) throw new ParameterException(ErrorCode.INCOMPATIBILITY, logPath + " is not a valid path!"); }
java
private synchronized void checkPath(String logPath) throws ParameterException { Validate.notNull(path); File cPath = new File(logPath); if(!cPath.exists()) cPath.mkdirs(); if(!cPath.isDirectory()) throw new ParameterException(ErrorCode.INCOMPATIBILITY, logPath + " is not a valid path!"); }
[ "private", "synchronized", "void", "checkPath", "(", "String", "logPath", ")", "throws", "ParameterException", "{", "Validate", ".", "notNull", "(", "path", ")", ";", "File", "cPath", "=", "new", "File", "(", "logPath", ")", ";", "if", "(", "!", "cPath", ...
Sets the path for the file writer where output files are put in. @param logPath Desired log path. @throws ParameterException if the given path is <code>null</null> or not a directory.
[ "Sets", "the", "path", "for", "the", "file", "writer", "where", "output", "files", "are", "put", "in", "." ]
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/file/FileWriter.java#L302-L309
junit-team/junit4
src/main/java/org/junit/runners/ParentRunner.java
ParentRunner.withAfterClasses
protected Statement withAfterClasses(Statement statement) { """ Returns a {@link Statement}: run all non-overridden {@code @AfterClass} methods on this class and superclasses after executing {@code statement}; all AfterClass methods are always executed: exceptions thrown by previous steps are combined, if necessary, with exceptions from AfterClass methods into a {@link org.junit.runners.model.MultipleFailureException}. """ List<FrameworkMethod> afters = testClass .getAnnotatedMethods(AfterClass.class); return afters.isEmpty() ? statement : new RunAfters(statement, afters, null); }
java
protected Statement withAfterClasses(Statement statement) { List<FrameworkMethod> afters = testClass .getAnnotatedMethods(AfterClass.class); return afters.isEmpty() ? statement : new RunAfters(statement, afters, null); }
[ "protected", "Statement", "withAfterClasses", "(", "Statement", "statement", ")", "{", "List", "<", "FrameworkMethod", ">", "afters", "=", "testClass", ".", "getAnnotatedMethods", "(", "AfterClass", ".", "class", ")", ";", "return", "afters", ".", "isEmpty", "("...
Returns a {@link Statement}: run all non-overridden {@code @AfterClass} methods on this class and superclasses after executing {@code statement}; all AfterClass methods are always executed: exceptions thrown by previous steps are combined, if necessary, with exceptions from AfterClass methods into a {@link org.junit.runners.model.MultipleFailureException}.
[ "Returns", "a", "{" ]
train
https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/runners/ParentRunner.java#L250-L255
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/Base64.java
Base64.encodeBytes
public static String encodeBytes( byte[] source, int off, int len ) { """ Encodes a byte array into Base64 notation. @param source The data to convert @param off Offset in array where conversion should begin @param len Length of data to convert @since 1.4 """ return encodeBytes( source, off, len, true ); }
java
public static String encodeBytes( byte[] source, int off, int len ) { return encodeBytes( source, off, len, true ); }
[ "public", "static", "String", "encodeBytes", "(", "byte", "[", "]", "source", ",", "int", "off", ",", "int", "len", ")", "{", "return", "encodeBytes", "(", "source", ",", "off", ",", "len", ",", "true", ")", ";", "}" ]
Encodes a byte array into Base64 notation. @param source The data to convert @param off Offset in array where conversion should begin @param len Length of data to convert @since 1.4
[ "Encodes", "a", "byte", "array", "into", "Base64", "notation", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/Base64.java#L498-L501
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java
NetworkInterfacesInner.getVirtualMachineScaleSetNetworkInterface
public NetworkInterfaceInner getVirtualMachineScaleSetNetworkInterface(String resourceGroupName, String virtualMachineScaleSetName, String virtualmachineIndex, String networkInterfaceName, String expand) { """ Get the specified network interface in a virtual machine scale set. @param resourceGroupName The name of the resource group. @param virtualMachineScaleSetName The name of the virtual machine scale set. @param virtualmachineIndex The virtual machine index. @param networkInterfaceName The name of the network interface. @param expand Expands referenced resources. @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 NetworkInterfaceInner object if successful. """ return getVirtualMachineScaleSetNetworkInterfaceWithServiceResponseAsync(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, expand).toBlocking().single().body(); }
java
public NetworkInterfaceInner getVirtualMachineScaleSetNetworkInterface(String resourceGroupName, String virtualMachineScaleSetName, String virtualmachineIndex, String networkInterfaceName, String expand) { return getVirtualMachineScaleSetNetworkInterfaceWithServiceResponseAsync(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, expand).toBlocking().single().body(); }
[ "public", "NetworkInterfaceInner", "getVirtualMachineScaleSetNetworkInterface", "(", "String", "resourceGroupName", ",", "String", "virtualMachineScaleSetName", ",", "String", "virtualmachineIndex", ",", "String", "networkInterfaceName", ",", "String", "expand", ")", "{", "re...
Get the specified network interface in a virtual machine scale set. @param resourceGroupName The name of the resource group. @param virtualMachineScaleSetName The name of the virtual machine scale set. @param virtualmachineIndex The virtual machine index. @param networkInterfaceName The name of the network interface. @param expand Expands referenced resources. @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 NetworkInterfaceInner object if successful.
[ "Get", "the", "specified", "network", "interface", "in", "a", "virtual", "machine", "scale", "set", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java#L1841-L1843
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Reflector.java
Reflector.getSetter
public static MethodInstance getSetter(Object obj, String prop, Object value, MethodInstance defaultValue) { """ to invoke a setter Method of a Object @param obj Object to invoke method from @param prop Name of the Method without get @param value Value to set to the Method @return MethodInstance """ prop = "set" + StringUtil.ucFirst(prop); MethodInstance mi = getMethodInstanceEL(obj, obj.getClass(), KeyImpl.getInstance(prop), new Object[] { value }); if (mi == null) return defaultValue; Method m = mi.getMethod(); if (m.getReturnType() != void.class) return defaultValue; return mi; }
java
public static MethodInstance getSetter(Object obj, String prop, Object value, MethodInstance defaultValue) { prop = "set" + StringUtil.ucFirst(prop); MethodInstance mi = getMethodInstanceEL(obj, obj.getClass(), KeyImpl.getInstance(prop), new Object[] { value }); if (mi == null) return defaultValue; Method m = mi.getMethod(); if (m.getReturnType() != void.class) return defaultValue; return mi; }
[ "public", "static", "MethodInstance", "getSetter", "(", "Object", "obj", ",", "String", "prop", ",", "Object", "value", ",", "MethodInstance", "defaultValue", ")", "{", "prop", "=", "\"set\"", "+", "StringUtil", ".", "ucFirst", "(", "prop", ")", ";", "Method...
to invoke a setter Method of a Object @param obj Object to invoke method from @param prop Name of the Method without get @param value Value to set to the Method @return MethodInstance
[ "to", "invoke", "a", "setter", "Method", "of", "a", "Object" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L1056-L1064
dkharrat/NexusDialog
nexusdialog/src/main/java/com/github/dkharrat/nexusdialog/controllers/FormSectionController.java
FormSectionController.addElement
public FormElementController addElement(FormElementController element, int position) { """ Adds a form element to this section. Note that sub-sections are not supported. @param element the form element to add @param position the position at which to insert the element @return the same instance of the form element that was added to support method chaining """ if (element instanceof FormSectionController) { throw new IllegalArgumentException("Sub-sections are not supported"); } if (elements.containsKey(element.getName())) { throw new IllegalArgumentException("Element with that name already exists"); } else { elements.put(element.getName(), element); orderedElements.add(position, element); return element; } }
java
public FormElementController addElement(FormElementController element, int position) { if (element instanceof FormSectionController) { throw new IllegalArgumentException("Sub-sections are not supported"); } if (elements.containsKey(element.getName())) { throw new IllegalArgumentException("Element with that name already exists"); } else { elements.put(element.getName(), element); orderedElements.add(position, element); return element; } }
[ "public", "FormElementController", "addElement", "(", "FormElementController", "element", ",", "int", "position", ")", "{", "if", "(", "element", "instanceof", "FormSectionController", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Sub-sections are not supp...
Adds a form element to this section. Note that sub-sections are not supported. @param element the form element to add @param position the position at which to insert the element @return the same instance of the form element that was added to support method chaining
[ "Adds", "a", "form", "element", "to", "this", "section", ".", "Note", "that", "sub", "-", "sections", "are", "not", "supported", "." ]
train
https://github.com/dkharrat/NexusDialog/blob/f43a6a07940cced12286c622140f3a8ae3d178a1/nexusdialog/src/main/java/com/github/dkharrat/nexusdialog/controllers/FormSectionController.java#L75-L87
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/registry/NotificationHandlerNodeSubregistry.java
NotificationHandlerNodeSubregistry.findHandlers
void findHandlers(ListIterator<PathElement> iterator, String value, Notification notification, Collection<NotificationHandler> handlers) { """ Get the registry child for the given {@code elementValue} and traverse it to collect the handlers that match the notifications. If the subregistry has a children for the {@link org.jboss.as.controller.PathElement#WILDCARD_VALUE}, it is also traversed. """ NotificationHandlerNodeRegistry registry = childRegistries.get(value); if (registry != null) { registry.findEntries(iterator, handlers, notification); } // if a child registry exists for the wildcard, we traverse it too NotificationHandlerNodeRegistry wildCardRegistry = childRegistries.get(WILDCARD_VALUE); if (wildCardRegistry != null) { wildCardRegistry.findEntries(iterator, handlers, notification); } }
java
void findHandlers(ListIterator<PathElement> iterator, String value, Notification notification, Collection<NotificationHandler> handlers) { NotificationHandlerNodeRegistry registry = childRegistries.get(value); if (registry != null) { registry.findEntries(iterator, handlers, notification); } // if a child registry exists for the wildcard, we traverse it too NotificationHandlerNodeRegistry wildCardRegistry = childRegistries.get(WILDCARD_VALUE); if (wildCardRegistry != null) { wildCardRegistry.findEntries(iterator, handlers, notification); } }
[ "void", "findHandlers", "(", "ListIterator", "<", "PathElement", ">", "iterator", ",", "String", "value", ",", "Notification", "notification", ",", "Collection", "<", "NotificationHandler", ">", "handlers", ")", "{", "NotificationHandlerNodeRegistry", "registry", "=",...
Get the registry child for the given {@code elementValue} and traverse it to collect the handlers that match the notifications. If the subregistry has a children for the {@link org.jboss.as.controller.PathElement#WILDCARD_VALUE}, it is also traversed.
[ "Get", "the", "registry", "child", "for", "the", "given", "{" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/registry/NotificationHandlerNodeSubregistry.java#L94-L104
alkacon/opencms-core
src/org/opencms/xml/content/CmsMappingResolutionContext.java
CmsMappingResolutionContext.addUrlNameMapping
void addUrlNameMapping(String name, Locale locale, CmsUUID structureId) { """ Adds an URL name mapping which should be written to the database later.<p> @param name the mapping name @param locale the locale @param structureId the structure ID """ m_urlNameMappingEntries.add(new InternalUrlNameMappingEntry(structureId, name, locale)); }
java
void addUrlNameMapping(String name, Locale locale, CmsUUID structureId) { m_urlNameMappingEntries.add(new InternalUrlNameMappingEntry(structureId, name, locale)); }
[ "void", "addUrlNameMapping", "(", "String", "name", ",", "Locale", "locale", ",", "CmsUUID", "structureId", ")", "{", "m_urlNameMappingEntries", ".", "add", "(", "new", "InternalUrlNameMappingEntry", "(", "structureId", ",", "name", ",", "locale", ")", ")", ";",...
Adds an URL name mapping which should be written to the database later.<p> @param name the mapping name @param locale the locale @param structureId the structure ID
[ "Adds", "an", "URL", "name", "mapping", "which", "should", "be", "written", "to", "the", "database", "later", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsMappingResolutionContext.java#L201-L204
spotbugs/spotbugs
eclipsePlugin/src/de/tobject/findbugs/builder/ResourceUtils.java
ResourceUtils.mapResource
private static void mapResource(WorkItem resource, Map<IProject, List<WorkItem>> projectsMap, boolean checkJavaProject) { """ Maps the resource into its project @param resource @param projectsMap """ IProject project = resource.getProject(); if (checkJavaProject && !ProjectUtilities.isJavaProject(project)) { // non java projects: can happen only for changesets return; } List<WorkItem> resources = projectsMap.get(project); if (resources == null) { resources = new ArrayList<>(); projectsMap.put(project, resources); } // do not need to check for duplicates, cause user cannot select // the same element twice if (!containsParents(resources, resource)) { resources.add(resource); } }
java
private static void mapResource(WorkItem resource, Map<IProject, List<WorkItem>> projectsMap, boolean checkJavaProject) { IProject project = resource.getProject(); if (checkJavaProject && !ProjectUtilities.isJavaProject(project)) { // non java projects: can happen only for changesets return; } List<WorkItem> resources = projectsMap.get(project); if (resources == null) { resources = new ArrayList<>(); projectsMap.put(project, resources); } // do not need to check for duplicates, cause user cannot select // the same element twice if (!containsParents(resources, resource)) { resources.add(resource); } }
[ "private", "static", "void", "mapResource", "(", "WorkItem", "resource", ",", "Map", "<", "IProject", ",", "List", "<", "WorkItem", ">", ">", "projectsMap", ",", "boolean", "checkJavaProject", ")", "{", "IProject", "project", "=", "resource", ".", "getProject"...
Maps the resource into its project @param resource @param projectsMap
[ "Maps", "the", "resource", "into", "its", "project" ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/builder/ResourceUtils.java#L257-L274
haifengl/smile
core/src/main/java/smile/classification/NeuralNetwork.java
NeuralNetwork.learn
public void learn(double[][] x, int[] y) { """ Trains the neural network with the given dataset for one epoch by stochastic gradient descent. @param x training instances. @param y training labels in [0, k), where k is the number of classes. """ int n = x.length; int[] index = Math.permutate(n); for (int i = 0; i < n; i++) { learn(x[index[i]], y[index[i]]); } }
java
public void learn(double[][] x, int[] y) { int n = x.length; int[] index = Math.permutate(n); for (int i = 0; i < n; i++) { learn(x[index[i]], y[index[i]]); } }
[ "public", "void", "learn", "(", "double", "[", "]", "[", "]", "x", ",", "int", "[", "]", "y", ")", "{", "int", "n", "=", "x", ".", "length", ";", "int", "[", "]", "index", "=", "Math", ".", "permutate", "(", "n", ")", ";", "for", "(", "int"...
Trains the neural network with the given dataset for one epoch by stochastic gradient descent. @param x training instances. @param y training labels in [0, k), where k is the number of classes.
[ "Trains", "the", "neural", "network", "with", "the", "given", "dataset", "for", "one", "epoch", "by", "stochastic", "gradient", "descent", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/classification/NeuralNetwork.java#L931-L937
Harium/keel
src/main/java/com/harium/keel/catalano/math/function/Gabor.java
Gabor.RealFunction2D
public static double RealFunction2D(int x, int y, double wavelength, double orientation, double phaseOffset, double gaussVariance, double aspectRatio) { """ 2-D Gabor function. compute only real part. @param x X axis coordinate. @param y Y axis coordinate. @param wavelength Wavelength. @param orientation Orientation. @param phaseOffset Phase offset. @param gaussVariance Gaussian variance. @param aspectRatio Aspect ratio. @return Gabor response. """ double X = x * Math.cos(orientation) + y * Math.sin(orientation); double Y = -x * Math.sin(orientation) + y * Math.cos(orientation); double envelope = Math.exp(-((X * X + aspectRatio * aspectRatio * Y * Y) / (2 * gaussVariance * gaussVariance))); double carrier = Math.cos(2 * Math.PI * (X / wavelength) + phaseOffset); return envelope * carrier; }
java
public static double RealFunction2D(int x, int y, double wavelength, double orientation, double phaseOffset, double gaussVariance, double aspectRatio) { double X = x * Math.cos(orientation) + y * Math.sin(orientation); double Y = -x * Math.sin(orientation) + y * Math.cos(orientation); double envelope = Math.exp(-((X * X + aspectRatio * aspectRatio * Y * Y) / (2 * gaussVariance * gaussVariance))); double carrier = Math.cos(2 * Math.PI * (X / wavelength) + phaseOffset); return envelope * carrier; }
[ "public", "static", "double", "RealFunction2D", "(", "int", "x", ",", "int", "y", ",", "double", "wavelength", ",", "double", "orientation", ",", "double", "phaseOffset", ",", "double", "gaussVariance", ",", "double", "aspectRatio", ")", "{", "double", "X", ...
2-D Gabor function. compute only real part. @param x X axis coordinate. @param y Y axis coordinate. @param wavelength Wavelength. @param orientation Orientation. @param phaseOffset Phase offset. @param gaussVariance Gaussian variance. @param aspectRatio Aspect ratio. @return Gabor response.
[ "2", "-", "D", "Gabor", "function", ".", "compute", "only", "real", "part", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/function/Gabor.java#L121-L130
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/tools/manipulator/AtomContainerManipulator.java
AtomContainerManipulator.getIntersection
public static IAtomContainer getIntersection(IAtomContainer container1, IAtomContainer container2) { """ Compares this AtomContainer with another given AtomContainer and returns the Intersection between them. <p> <b>Important Note</b> : This is not the maximum common substructure. @param container1 an AtomContainer object @param container2 an AtomContainer object @return An AtomContainer containing the intersection between container1 and container2 """ IAtomContainer intersection = container1.getBuilder().newInstance(IAtomContainer.class); for (int i = 0; i < container1.getAtomCount(); i++) { if (container2.contains(container1.getAtom(i))) { intersection.addAtom(container1.getAtom(i)); } } for (int i = 0; i < container1.getElectronContainerCount(); i++) { if (container2.contains(container1.getElectronContainer(i))) { intersection.addElectronContainer(container1.getElectronContainer(i)); } } return intersection; }
java
public static IAtomContainer getIntersection(IAtomContainer container1, IAtomContainer container2) { IAtomContainer intersection = container1.getBuilder().newInstance(IAtomContainer.class); for (int i = 0; i < container1.getAtomCount(); i++) { if (container2.contains(container1.getAtom(i))) { intersection.addAtom(container1.getAtom(i)); } } for (int i = 0; i < container1.getElectronContainerCount(); i++) { if (container2.contains(container1.getElectronContainer(i))) { intersection.addElectronContainer(container1.getElectronContainer(i)); } } return intersection; }
[ "public", "static", "IAtomContainer", "getIntersection", "(", "IAtomContainer", "container1", ",", "IAtomContainer", "container2", ")", "{", "IAtomContainer", "intersection", "=", "container1", ".", "getBuilder", "(", ")", ".", "newInstance", "(", "IAtomContainer", "....
Compares this AtomContainer with another given AtomContainer and returns the Intersection between them. <p> <b>Important Note</b> : This is not the maximum common substructure. @param container1 an AtomContainer object @param container2 an AtomContainer object @return An AtomContainer containing the intersection between container1 and container2
[ "Compares", "this", "AtomContainer", "with", "another", "given", "AtomContainer", "and", "returns", "the", "Intersection", "between", "them", ".", "<p", ">" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/tools/manipulator/AtomContainerManipulator.java#L1408-L1422
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/SlotReference.java
SlotReference.getSlotReference
@SuppressWarnings("WeakerAccess") public static synchronized SlotReference getSlotReference(int player, CdjStatus.TrackSourceSlot slot) { """ Get a unique reference to a media slot on the network from which tracks can be loaded. @param player the player in which the slot is found @param slot the specific type of the slot @return the instance that will always represent the specified slot @throws NullPointerException if {@code slot} is {@code null} """ Map<CdjStatus.TrackSourceSlot, SlotReference> playerMap = instances.get(player); if (playerMap == null) { playerMap = new HashMap<CdjStatus.TrackSourceSlot, SlotReference>(); instances.put(player, playerMap); } SlotReference result = playerMap.get(slot); if (result == null) { result = new SlotReference(player, slot); playerMap.put(slot, result); } return result; }
java
@SuppressWarnings("WeakerAccess") public static synchronized SlotReference getSlotReference(int player, CdjStatus.TrackSourceSlot slot) { Map<CdjStatus.TrackSourceSlot, SlotReference> playerMap = instances.get(player); if (playerMap == null) { playerMap = new HashMap<CdjStatus.TrackSourceSlot, SlotReference>(); instances.put(player, playerMap); } SlotReference result = playerMap.get(slot); if (result == null) { result = new SlotReference(player, slot); playerMap.put(slot, result); } return result; }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "static", "synchronized", "SlotReference", "getSlotReference", "(", "int", "player", ",", "CdjStatus", ".", "TrackSourceSlot", "slot", ")", "{", "Map", "<", "CdjStatus", ".", "TrackSourceSlot", ",", ...
Get a unique reference to a media slot on the network from which tracks can be loaded. @param player the player in which the slot is found @param slot the specific type of the slot @return the instance that will always represent the specified slot @throws NullPointerException if {@code slot} is {@code null}
[ "Get", "a", "unique", "reference", "to", "a", "media", "slot", "on", "the", "network", "from", "which", "tracks", "can", "be", "loaded", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/SlotReference.java#L56-L69
haraldk/TwelveMonkeys
common/common-image/src/main/java/com/twelvemonkeys/image/CopyDither.java
CopyDither.filter
public final BufferedImage filter(BufferedImage pSource, BufferedImage pDest) { """ Performs a single-input/single-output dither operation, applying basic Floyd-Steinberg error-diffusion to the image. @param pSource the source image @param pDest the destiantion image @return the destination image, or a new image, if {@code pDest} was {@code null}. """ // Create destination image, if none provided if (pDest == null) { pDest = createCompatibleDestImage(pSource, getICM(pSource)); } else if (!(pDest.getColorModel() instanceof IndexColorModel)) { throw new ImageFilterException("Only IndexColorModel allowed."); } // Filter rasters filter(pSource.getRaster(), pDest.getRaster(), (IndexColorModel) pDest.getColorModel()); return pDest; }
java
public final BufferedImage filter(BufferedImage pSource, BufferedImage pDest) { // Create destination image, if none provided if (pDest == null) { pDest = createCompatibleDestImage(pSource, getICM(pSource)); } else if (!(pDest.getColorModel() instanceof IndexColorModel)) { throw new ImageFilterException("Only IndexColorModel allowed."); } // Filter rasters filter(pSource.getRaster(), pDest.getRaster(), (IndexColorModel) pDest.getColorModel()); return pDest; }
[ "public", "final", "BufferedImage", "filter", "(", "BufferedImage", "pSource", ",", "BufferedImage", "pDest", ")", "{", "// Create destination image, if none provided\r", "if", "(", "pDest", "==", "null", ")", "{", "pDest", "=", "createCompatibleDestImage", "(", "pSou...
Performs a single-input/single-output dither operation, applying basic Floyd-Steinberg error-diffusion to the image. @param pSource the source image @param pDest the destiantion image @return the destination image, or a new image, if {@code pDest} was {@code null}.
[ "Performs", "a", "single", "-", "input", "/", "single", "-", "output", "dither", "operation", "applying", "basic", "Floyd", "-", "Steinberg", "error", "-", "diffusion", "to", "the", "image", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-image/src/main/java/com/twelvemonkeys/image/CopyDither.java#L195-L208
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/string/Betner.java
Betner.asMap
public Map<Integer, String> asMap() { """ Returns the substring results in given range as a map, left position number as key, substring as value @return """ initializePosition(); final Map<Integer, String> results = Maps.newHashMap(); Mapper.from(positions.get()).entryLoop(new Decisional<Map.Entry<Integer, Pair<Integer,Integer>>>() { @Override protected void decision(Entry<Integer, Pair<Integer, Integer>> input) { results.put(input.getKey(), doSubstring(input.getValue())); } }); return results; }
java
public Map<Integer, String> asMap() { initializePosition(); final Map<Integer, String> results = Maps.newHashMap(); Mapper.from(positions.get()).entryLoop(new Decisional<Map.Entry<Integer, Pair<Integer,Integer>>>() { @Override protected void decision(Entry<Integer, Pair<Integer, Integer>> input) { results.put(input.getKey(), doSubstring(input.getValue())); } }); return results; }
[ "public", "Map", "<", "Integer", ",", "String", ">", "asMap", "(", ")", "{", "initializePosition", "(", ")", ";", "final", "Map", "<", "Integer", ",", "String", ">", "results", "=", "Maps", ".", "newHashMap", "(", ")", ";", "Mapper", ".", "from", "("...
Returns the substring results in given range as a map, left position number as key, substring as value @return
[ "Returns", "the", "substring", "results", "in", "given", "range", "as", "a", "map", "left", "position", "number", "as", "key", "substring", "as", "value" ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Betner.java#L259-L271
cdk/cdk
base/silent/src/main/java/org/openscience/cdk/silent/BioPolymer.java
BioPolymer.getMonomer
@Override public IMonomer getMonomer(String monName, String strandName) { """ Retrieves a Monomer object by specifying its name. [You have to specify the strand to enable monomers with the same name in different strands. There is at least one such case: every strand contains a monomer called "".] @param monName The name of the monomer to look for @return The Monomer object which was asked for """ Strand strand = (Strand) strands.get(strandName); if (strand != null) { return (Monomer) strand.getMonomer(monName); } else { return null; } }
java
@Override public IMonomer getMonomer(String monName, String strandName) { Strand strand = (Strand) strands.get(strandName); if (strand != null) { return (Monomer) strand.getMonomer(monName); } else { return null; } }
[ "@", "Override", "public", "IMonomer", "getMonomer", "(", "String", "monName", ",", "String", "strandName", ")", "{", "Strand", "strand", "=", "(", "Strand", ")", "strands", ".", "get", "(", "strandName", ")", ";", "if", "(", "strand", "!=", "null", ")",...
Retrieves a Monomer object by specifying its name. [You have to specify the strand to enable monomers with the same name in different strands. There is at least one such case: every strand contains a monomer called "".] @param monName The name of the monomer to look for @return The Monomer object which was asked for
[ "Retrieves", "a", "Monomer", "object", "by", "specifying", "its", "name", ".", "[", "You", "have", "to", "specify", "the", "strand", "to", "enable", "monomers", "with", "the", "same", "name", "in", "different", "strands", ".", "There", "is", "at", "least",...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/silent/src/main/java/org/openscience/cdk/silent/BioPolymer.java#L163-L172
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java
SourceLineAnnotation.forEntireMethod
public static SourceLineAnnotation forEntireMethod(@DottedClassName String className, String sourceFile, LineNumberTable lineNumberTable, int codeSize) { """ Create a SourceLineAnnotation covering an entire method. @param className name of the class the method is in @param sourceFile source file containing the method @param lineNumberTable the method's LineNumberTable @param codeSize size in bytes of the method's code @return a SourceLineAnnotation covering the entire method """ LineNumber[] table = lineNumberTable.getLineNumberTable(); if (table != null && table.length > 0) { LineNumber first = table[0]; LineNumber last = table[table.length - 1]; return new SourceLineAnnotation(className, sourceFile, first.getLineNumber(), last.getLineNumber(), 0, codeSize - 1); } else { return createUnknown(className, sourceFile, 0, codeSize - 1); } }
java
public static SourceLineAnnotation forEntireMethod(@DottedClassName String className, String sourceFile, LineNumberTable lineNumberTable, int codeSize) { LineNumber[] table = lineNumberTable.getLineNumberTable(); if (table != null && table.length > 0) { LineNumber first = table[0]; LineNumber last = table[table.length - 1]; return new SourceLineAnnotation(className, sourceFile, first.getLineNumber(), last.getLineNumber(), 0, codeSize - 1); } else { return createUnknown(className, sourceFile, 0, codeSize - 1); } }
[ "public", "static", "SourceLineAnnotation", "forEntireMethod", "(", "@", "DottedClassName", "String", "className", ",", "String", "sourceFile", ",", "LineNumberTable", "lineNumberTable", ",", "int", "codeSize", ")", "{", "LineNumber", "[", "]", "table", "=", "lineNu...
Create a SourceLineAnnotation covering an entire method. @param className name of the class the method is in @param sourceFile source file containing the method @param lineNumberTable the method's LineNumberTable @param codeSize size in bytes of the method's code @return a SourceLineAnnotation covering the entire method
[ "Create", "a", "SourceLineAnnotation", "covering", "an", "entire", "method", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java#L260-L270
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.ovhAccount_ovhAccountId_GET
public OvhOvhAccount ovhAccount_ovhAccountId_GET(String ovhAccountId) throws IOException { """ Get this object properties REST: GET /me/ovhAccount/{ovhAccountId} @param ovhAccountId [required] """ String qPath = "/me/ovhAccount/{ovhAccountId}"; StringBuilder sb = path(qPath, ovhAccountId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhAccount.class); }
java
public OvhOvhAccount ovhAccount_ovhAccountId_GET(String ovhAccountId) throws IOException { String qPath = "/me/ovhAccount/{ovhAccountId}"; StringBuilder sb = path(qPath, ovhAccountId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhAccount.class); }
[ "public", "OvhOvhAccount", "ovhAccount_ovhAccountId_GET", "(", "String", "ovhAccountId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/ovhAccount/{ovhAccountId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "ovhAccountId", ")", ";...
Get this object properties REST: GET /me/ovhAccount/{ovhAccountId} @param ovhAccountId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L3378-L3383
rundeck/rundeck
rundeck-storage/rundeck-storage-data/src/main/java/org/rundeck/storage/data/DataUtil.java
DataUtil.lazyStream
public static HasInputStream lazyStream(final InputStream data) { """ Lazy mechanism for stream loading @param data file @return lazy stream """ return new HasInputStream() { @Override public InputStream getInputStream() throws IOException { return data; } @Override public long writeContent(OutputStream outputStream) throws IOException { return copyStream(data, outputStream); } }; }
java
public static HasInputStream lazyStream(final InputStream data) { return new HasInputStream() { @Override public InputStream getInputStream() throws IOException { return data; } @Override public long writeContent(OutputStream outputStream) throws IOException { return copyStream(data, outputStream); } }; }
[ "public", "static", "HasInputStream", "lazyStream", "(", "final", "InputStream", "data", ")", "{", "return", "new", "HasInputStream", "(", ")", "{", "@", "Override", "public", "InputStream", "getInputStream", "(", ")", "throws", "IOException", "{", "return", "da...
Lazy mechanism for stream loading @param data file @return lazy stream
[ "Lazy", "mechanism", "for", "stream", "loading" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/rundeck-storage/rundeck-storage-data/src/main/java/org/rundeck/storage/data/DataUtil.java#L113-L125
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/base64/Base64.java
Base64.safeDecode
@Nullable @ReturnsMutableCopy public static byte [] safeDecode (@Nullable final byte [] aEncodedBytes, final int nOptions) { """ Decode the byte array. @param aEncodedBytes The encoded byte array. @param nOptions Decoding options. @return <code>null</code> if decoding failed. """ if (aEncodedBytes != null) return safeDecode (aEncodedBytes, 0, aEncodedBytes.length, nOptions); return null; }
java
@Nullable @ReturnsMutableCopy public static byte [] safeDecode (@Nullable final byte [] aEncodedBytes, final int nOptions) { if (aEncodedBytes != null) return safeDecode (aEncodedBytes, 0, aEncodedBytes.length, nOptions); return null; }
[ "@", "Nullable", "@", "ReturnsMutableCopy", "public", "static", "byte", "[", "]", "safeDecode", "(", "@", "Nullable", "final", "byte", "[", "]", "aEncodedBytes", ",", "final", "int", "nOptions", ")", "{", "if", "(", "aEncodedBytes", "!=", "null", ")", "ret...
Decode the byte array. @param aEncodedBytes The encoded byte array. @param nOptions Decoding options. @return <code>null</code> if decoding failed.
[ "Decode", "the", "byte", "array", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/base64/Base64.java#L2594-L2601
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/HFClient.java
HFClient.newOrderer
public Orderer newOrderer(String name, String grpcURL, Properties properties) throws InvalidArgumentException { """ Create a new orderer. @param name name of Orderer. @param grpcURL url location of orderer grpc or grpcs protocol. @param properties <p> Supported properties <ul> <li>pemFile - File location for x509 pem certificate for SSL.</li> <li>pemBytes - byte array for x509 pem certificates for SSL</li> <li>trustServerCertificate - boolean(true/false) override CN to match pemFile certificate -- for development only. If the pemFile has the target server's certificate (instead of a CA Root certificate), instruct the TLS client to trust the CN value of the certificate in the pemFile, useful in development to get past default server hostname verification during TLS handshake, when the server host name does not match the certificate. </li> <li>clientKeyFile - File location for private key pem for mutual TLS</li> <li>clientCertFile - File location for x509 pem certificate for mutual TLS</li> <li>clientKeyBytes - Private key pem bytes for mutual TLS</li> <li>clientCertBytes - x509 pem certificate bytes for mutual TLS</li> <li>sslProvider - Specify the SSL provider, openSSL or JDK.</li> <li>negotiationType - Specify the type of negotiation, TLS or plainText.</li> <li>hostnameOverride - Specify the certificates CN -- for development only. If the pemFile does not represent the server certificate, use this property to specify the URI authority (a.k.a hostname) expected in the target server's certificate. This is required to get past default server hostname verifications during TLS handshake. </li> <li> grpc.NettyChannelBuilderOption.&lt;methodName&gt; where methodName is any method on grpc ManagedChannelBuilder. If more than one argument to the method is needed then the parameters need to be supplied in an array of Objects. </li> <li> ordererWaitTimeMilliSecs Time to wait in milliseconds for the Orderer to accept requests before timing out. The default is two seconds. </li> </ul> @return The orderer. @throws InvalidArgumentException """ clientCheck(); return Orderer.createNewInstance(name, grpcURL, properties); }
java
public Orderer newOrderer(String name, String grpcURL, Properties properties) throws InvalidArgumentException { clientCheck(); return Orderer.createNewInstance(name, grpcURL, properties); }
[ "public", "Orderer", "newOrderer", "(", "String", "name", ",", "String", "grpcURL", ",", "Properties", "properties", ")", "throws", "InvalidArgumentException", "{", "clientCheck", "(", ")", ";", "return", "Orderer", ".", "createNewInstance", "(", "name", ",", "g...
Create a new orderer. @param name name of Orderer. @param grpcURL url location of orderer grpc or grpcs protocol. @param properties <p> Supported properties <ul> <li>pemFile - File location for x509 pem certificate for SSL.</li> <li>pemBytes - byte array for x509 pem certificates for SSL</li> <li>trustServerCertificate - boolean(true/false) override CN to match pemFile certificate -- for development only. If the pemFile has the target server's certificate (instead of a CA Root certificate), instruct the TLS client to trust the CN value of the certificate in the pemFile, useful in development to get past default server hostname verification during TLS handshake, when the server host name does not match the certificate. </li> <li>clientKeyFile - File location for private key pem for mutual TLS</li> <li>clientCertFile - File location for x509 pem certificate for mutual TLS</li> <li>clientKeyBytes - Private key pem bytes for mutual TLS</li> <li>clientCertBytes - x509 pem certificate bytes for mutual TLS</li> <li>sslProvider - Specify the SSL provider, openSSL or JDK.</li> <li>negotiationType - Specify the type of negotiation, TLS or plainText.</li> <li>hostnameOverride - Specify the certificates CN -- for development only. If the pemFile does not represent the server certificate, use this property to specify the URI authority (a.k.a hostname) expected in the target server's certificate. This is required to get past default server hostname verifications during TLS handshake. </li> <li> grpc.NettyChannelBuilderOption.&lt;methodName&gt; where methodName is any method on grpc ManagedChannelBuilder. If more than one argument to the method is needed then the parameters need to be supplied in an array of Objects. </li> <li> ordererWaitTimeMilliSecs Time to wait in milliseconds for the Orderer to accept requests before timing out. The default is two seconds. </li> </ul> @return The orderer. @throws InvalidArgumentException
[ "Create", "a", "new", "orderer", "." ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/HFClient.java#L740-L743
Falydoor/limesurvey-rc
src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java
LimesurveyRC.isSurveyActive
public boolean isSurveyActive(int surveyId) throws LimesurveyRCException { """ Check if a survey is active. @param surveyId the survey id of the survey you want to check @return true if the survey is active @throws LimesurveyRCException the limesurvey rc exception """ LsApiBody.LsApiParams params = getParamsWithKey(surveyId); List<String> surveySettings = new ArrayList<>(); surveySettings.add("active"); params.setSurveySettings(surveySettings); return "Y".equals(callRC(new LsApiBody("get_survey_properties", params)).getAsJsonObject().get("active").getAsString()); }
java
public boolean isSurveyActive(int surveyId) throws LimesurveyRCException { LsApiBody.LsApiParams params = getParamsWithKey(surveyId); List<String> surveySettings = new ArrayList<>(); surveySettings.add("active"); params.setSurveySettings(surveySettings); return "Y".equals(callRC(new LsApiBody("get_survey_properties", params)).getAsJsonObject().get("active").getAsString()); }
[ "public", "boolean", "isSurveyActive", "(", "int", "surveyId", ")", "throws", "LimesurveyRCException", "{", "LsApiBody", ".", "LsApiParams", "params", "=", "getParamsWithKey", "(", "surveyId", ")", ";", "List", "<", "String", ">", "surveySettings", "=", "new", "...
Check if a survey is active. @param surveyId the survey id of the survey you want to check @return true if the survey is active @throws LimesurveyRCException the limesurvey rc exception
[ "Check", "if", "a", "survey", "is", "active", "." ]
train
https://github.com/Falydoor/limesurvey-rc/blob/b8d573389086395e46a0bdeeddeef4d1c2c0a488/src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java#L289-L296
wuman/orientdb-android
commons/src/main/java/com/orientechnologies/common/synch/OSynchEventAdapter.java
OSynchEventAdapter.getValue
public synchronized RESPONSE_TYPE getValue(final RESOURCE_TYPE iResource, final long iTimeout) { """ Wait until the requested resource is unlocked. Put the current thread in sleep until timeout or is waked up by an unlock. """ if (OLogManager.instance().isDebugEnabled()) OLogManager.instance().debug( this, "Thread [" + Thread.currentThread().getId() + "] is waiting for the resource " + iResource + (iTimeout <= 0 ? " forever" : " until " + iTimeout + "ms")); synchronized (iResource) { try { iResource.wait(iTimeout); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new OLockException("Thread interrupted while waiting for resource '" + iResource + "'"); } } Object[] value = queue.remove(iResource); return (RESPONSE_TYPE) (value != null ? value[1] : null); }
java
public synchronized RESPONSE_TYPE getValue(final RESOURCE_TYPE iResource, final long iTimeout) { if (OLogManager.instance().isDebugEnabled()) OLogManager.instance().debug( this, "Thread [" + Thread.currentThread().getId() + "] is waiting for the resource " + iResource + (iTimeout <= 0 ? " forever" : " until " + iTimeout + "ms")); synchronized (iResource) { try { iResource.wait(iTimeout); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new OLockException("Thread interrupted while waiting for resource '" + iResource + "'"); } } Object[] value = queue.remove(iResource); return (RESPONSE_TYPE) (value != null ? value[1] : null); }
[ "public", "synchronized", "RESPONSE_TYPE", "getValue", "(", "final", "RESOURCE_TYPE", "iResource", ",", "final", "long", "iTimeout", ")", "{", "if", "(", "OLogManager", ".", "instance", "(", ")", ".", "isDebugEnabled", "(", ")", ")", "OLogManager", ".", "insta...
Wait until the requested resource is unlocked. Put the current thread in sleep until timeout or is waked up by an unlock.
[ "Wait", "until", "the", "requested", "resource", "is", "unlocked", ".", "Put", "the", "current", "thread", "in", "sleep", "until", "timeout", "or", "is", "waked", "up", "by", "an", "unlock", "." ]
train
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/commons/src/main/java/com/orientechnologies/common/synch/OSynchEventAdapter.java#L32-L51
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/CredentialsInner.java
CredentialsInner.listByAutomationAccountAsync
public Observable<Page<CredentialInner>> listByAutomationAccountAsync(final String resourceGroupName, final String automationAccountName) { """ Retrieve a list of credentials. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;CredentialInner&gt; object """ return listByAutomationAccountWithServiceResponseAsync(resourceGroupName, automationAccountName) .map(new Func1<ServiceResponse<Page<CredentialInner>>, Page<CredentialInner>>() { @Override public Page<CredentialInner> call(ServiceResponse<Page<CredentialInner>> response) { return response.body(); } }); }
java
public Observable<Page<CredentialInner>> listByAutomationAccountAsync(final String resourceGroupName, final String automationAccountName) { return listByAutomationAccountWithServiceResponseAsync(resourceGroupName, automationAccountName) .map(new Func1<ServiceResponse<Page<CredentialInner>>, Page<CredentialInner>>() { @Override public Page<CredentialInner> call(ServiceResponse<Page<CredentialInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "CredentialInner", ">", ">", "listByAutomationAccountAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "automationAccountName", ")", "{", "return", "listByAutomationAccountWithServiceResponseAsync", "(", ...
Retrieve a list of credentials. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;CredentialInner&gt; object
[ "Retrieve", "a", "list", "of", "credentials", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/CredentialsInner.java#L523-L531
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java
NetworkWatchersInner.beginGetNextHopAsync
public Observable<NextHopResultInner> beginGetNextHopAsync(String resourceGroupName, String networkWatcherName, NextHopParameters parameters) { """ Gets the next hop from the specified VM. @param resourceGroupName The name of the resource group. @param networkWatcherName The name of the network watcher. @param parameters Parameters that define the source and destination endpoint. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the NextHopResultInner object """ return beginGetNextHopWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<NextHopResultInner>, NextHopResultInner>() { @Override public NextHopResultInner call(ServiceResponse<NextHopResultInner> response) { return response.body(); } }); }
java
public Observable<NextHopResultInner> beginGetNextHopAsync(String resourceGroupName, String networkWatcherName, NextHopParameters parameters) { return beginGetNextHopWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<NextHopResultInner>, NextHopResultInner>() { @Override public NextHopResultInner call(ServiceResponse<NextHopResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "NextHopResultInner", ">", "beginGetNextHopAsync", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "NextHopParameters", "parameters", ")", "{", "return", "beginGetNextHopWithServiceResponseAsync", "(", "resourceGroupN...
Gets the next hop from the specified VM. @param resourceGroupName The name of the resource group. @param networkWatcherName The name of the network watcher. @param parameters Parameters that define the source and destination endpoint. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the NextHopResultInner object
[ "Gets", "the", "next", "hop", "from", "the", "specified", "VM", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L1228-L1235
duracloud/duracloud
storageprovider/src/main/java/org/duracloud/storage/util/StorageProviderUtil.java
StorageProviderUtil.compareChecksum
public static String compareChecksum(String providerChecksum, String spaceId, String contentId, String checksum) throws ChecksumMismatchException { """ Determines if two checksum values are equal @param providerChecksum The checksum provided by the StorageProvider @param spaceId The Space in which the content was stored @param contentId The Id of the content @param checksum The content checksum, either provided or computed @throws ChecksumMismatchException if the included checksum does not match the storage provider generated checksum @returns the validated checksum value from the provider """ if (!providerChecksum.equals(checksum)) { String err = "Content " + contentId + " was added to space " + spaceId + " but the checksum, either provided or computed " + "enroute, (" + checksum + ") does not match the checksum " + "computed by the storage provider (" + providerChecksum + "). This content should be retransmitted."; log.warn(err); throw new ChecksumMismatchException(err, NO_RETRY); } return providerChecksum; }
java
public static String compareChecksum(String providerChecksum, String spaceId, String contentId, String checksum) throws ChecksumMismatchException { if (!providerChecksum.equals(checksum)) { String err = "Content " + contentId + " was added to space " + spaceId + " but the checksum, either provided or computed " + "enroute, (" + checksum + ") does not match the checksum " + "computed by the storage provider (" + providerChecksum + "). This content should be retransmitted."; log.warn(err); throw new ChecksumMismatchException(err, NO_RETRY); } return providerChecksum; }
[ "public", "static", "String", "compareChecksum", "(", "String", "providerChecksum", ",", "String", "spaceId", ",", "String", "contentId", ",", "String", "checksum", ")", "throws", "ChecksumMismatchException", "{", "if", "(", "!", "providerChecksum", ".", "equals", ...
Determines if two checksum values are equal @param providerChecksum The checksum provided by the StorageProvider @param spaceId The Space in which the content was stored @param contentId The Id of the content @param checksum The content checksum, either provided or computed @throws ChecksumMismatchException if the included checksum does not match the storage provider generated checksum @returns the validated checksum value from the provider
[ "Determines", "if", "two", "checksum", "values", "are", "equal" ]
train
https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/storageprovider/src/main/java/org/duracloud/storage/util/StorageProviderUtil.java#L139-L154
Backendless/Android-SDK
src/com/backendless/Media.java
Media.startStream
private void startStream( RtspClient rtspClient, String streamName, String params ) throws BackendlessException { """ Connects/disconnects to the RTSP server and starts/stops the stream """ if( rtspClient.isStreaming() ) { throw new BackendlessException( "Rtsp client is working on other stream" ); } rtspClient.setServerAddress( WOWZA_SERVER_IP, WOWZA_SERVER_PORT ); rtspClient.setStreamPath( "/" + WOWZA_SERVER_LIVE_APP_NAME + "/" + streamName + params ); rtspClient.startStream(); }
java
private void startStream( RtspClient rtspClient, String streamName, String params ) throws BackendlessException { if( rtspClient.isStreaming() ) { throw new BackendlessException( "Rtsp client is working on other stream" ); } rtspClient.setServerAddress( WOWZA_SERVER_IP, WOWZA_SERVER_PORT ); rtspClient.setStreamPath( "/" + WOWZA_SERVER_LIVE_APP_NAME + "/" + streamName + params ); rtspClient.startStream(); }
[ "private", "void", "startStream", "(", "RtspClient", "rtspClient", ",", "String", "streamName", ",", "String", "params", ")", "throws", "BackendlessException", "{", "if", "(", "rtspClient", ".", "isStreaming", "(", ")", ")", "{", "throw", "new", "BackendlessExce...
Connects/disconnects to the RTSP server and starts/stops the stream
[ "Connects", "/", "disconnects", "to", "the", "RTSP", "server", "and", "starts", "/", "stops", "the", "stream" ]
train
https://github.com/Backendless/Android-SDK/blob/3af1e9a378f19d890db28a833f7fc8595b924cc3/src/com/backendless/Media.java#L395-L404
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.copyAccessControlEntries
public void copyAccessControlEntries(CmsRequestContext context, CmsResource source, CmsResource destination) throws CmsException, CmsSecurityException { """ Copies the access control entries of a given resource to a destination resource.<p> Already existing access control entries of the destination resource are removed.<p> @param context the current request context @param source the resource to copy the access control entries from @param destination the resource to which the access control entries are copied @throws CmsException if something goes wrong @throws CmsSecurityException if the user has insufficient permission for the given resource ({@link CmsPermissionSet#ACCESS_CONTROL} required) """ CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkOfflineProject(dbc); checkPermissions(dbc, source, CmsPermissionSet.ACCESS_READ, true, CmsResourceFilter.ALL); checkPermissions(dbc, destination, CmsPermissionSet.ACCESS_CONTROL, true, CmsResourceFilter.ALL); m_driverManager.copyAccessControlEntries(dbc, source, destination, true); } catch (Exception e) { CmsRequestContext rc = context; dbc.report( null, Messages.get().container( Messages.ERR_COPY_ACE_2, rc.removeSiteRoot(source.getRootPath()), rc.removeSiteRoot(destination.getRootPath())), e); } finally { dbc.clear(); } }
java
public void copyAccessControlEntries(CmsRequestContext context, CmsResource source, CmsResource destination) throws CmsException, CmsSecurityException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkOfflineProject(dbc); checkPermissions(dbc, source, CmsPermissionSet.ACCESS_READ, true, CmsResourceFilter.ALL); checkPermissions(dbc, destination, CmsPermissionSet.ACCESS_CONTROL, true, CmsResourceFilter.ALL); m_driverManager.copyAccessControlEntries(dbc, source, destination, true); } catch (Exception e) { CmsRequestContext rc = context; dbc.report( null, Messages.get().container( Messages.ERR_COPY_ACE_2, rc.removeSiteRoot(source.getRootPath()), rc.removeSiteRoot(destination.getRootPath())), e); } finally { dbc.clear(); } }
[ "public", "void", "copyAccessControlEntries", "(", "CmsRequestContext", "context", ",", "CmsResource", "source", ",", "CmsResource", "destination", ")", "throws", "CmsException", ",", "CmsSecurityException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "g...
Copies the access control entries of a given resource to a destination resource.<p> Already existing access control entries of the destination resource are removed.<p> @param context the current request context @param source the resource to copy the access control entries from @param destination the resource to which the access control entries are copied @throws CmsException if something goes wrong @throws CmsSecurityException if the user has insufficient permission for the given resource ({@link CmsPermissionSet#ACCESS_CONTROL} required)
[ "Copies", "the", "access", "control", "entries", "of", "a", "given", "resource", "to", "a", "destination", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L723-L744
voldemort/voldemort
src/java/voldemort/tools/admin/AdminToolUtils.java
AdminToolUtils.assertServerInNormalState
public static void assertServerInNormalState(AdminClient adminClient, Integer nodeId) { """ Utility function that checks the execution state of the server by checking the state of {@link VoldemortState} <br> This function checks if a node is in normal state ( {@link VoldemortState#NORMAL_SERVER}). @param adminClient An instance of AdminClient points to given cluster @param nodeId Node id to be checked @throws VoldemortException if any node is not in normal state """ assertServerInNormalState(adminClient, Lists.newArrayList(new Integer[]{nodeId})); }
java
public static void assertServerInNormalState(AdminClient adminClient, Integer nodeId) { assertServerInNormalState(adminClient, Lists.newArrayList(new Integer[]{nodeId})); }
[ "public", "static", "void", "assertServerInNormalState", "(", "AdminClient", "adminClient", ",", "Integer", "nodeId", ")", "{", "assertServerInNormalState", "(", "adminClient", ",", "Lists", ".", "newArrayList", "(", "new", "Integer", "[", "]", "{", "nodeId", "}",...
Utility function that checks the execution state of the server by checking the state of {@link VoldemortState} <br> This function checks if a node is in normal state ( {@link VoldemortState#NORMAL_SERVER}). @param adminClient An instance of AdminClient points to given cluster @param nodeId Node id to be checked @throws VoldemortException if any node is not in normal state
[ "Utility", "function", "that", "checks", "the", "execution", "state", "of", "the", "server", "by", "checking", "the", "state", "of", "{", "@link", "VoldemortState", "}", "<br", ">" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminToolUtils.java#L354-L356
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/SerializationUtils.java
SerializationUtils.serializeState
public static <T extends State> void serializeState(FileSystem fs, Path jobStateFilePath, T state, short replication) throws IOException { """ Serialize a {@link State} instance to a file. @param fs the {@link FileSystem} instance for creating the file @param jobStateFilePath the path to the file @param state the {@link State} to serialize @param replication replication of the serialized file. @param <T> the {@link State} object type @throws IOException if it fails to serialize the {@link State} instance """ try (DataOutputStream dataOutputStream = new DataOutputStream(fs.create(jobStateFilePath, replication))) { state.write(dataOutputStream); } }
java
public static <T extends State> void serializeState(FileSystem fs, Path jobStateFilePath, T state, short replication) throws IOException { try (DataOutputStream dataOutputStream = new DataOutputStream(fs.create(jobStateFilePath, replication))) { state.write(dataOutputStream); } }
[ "public", "static", "<", "T", "extends", "State", ">", "void", "serializeState", "(", "FileSystem", "fs", ",", "Path", "jobStateFilePath", ",", "T", "state", ",", "short", "replication", ")", "throws", "IOException", "{", "try", "(", "DataOutputStream", "dataO...
Serialize a {@link State} instance to a file. @param fs the {@link FileSystem} instance for creating the file @param jobStateFilePath the path to the file @param state the {@link State} to serialize @param replication replication of the serialized file. @param <T> the {@link State} object type @throws IOException if it fails to serialize the {@link State} instance
[ "Serialize", "a", "{", "@link", "State", "}", "instance", "to", "a", "file", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/SerializationUtils.java#L156-L162
belaban/JGroups
src/org/jgroups/protocols/pbcast/ServerGmsImpl.java
ServerGmsImpl.handleMergeRequest
public void handleMergeRequest(Address sender, MergeId merge_id, Collection<? extends Address> mbrs) { """ Get the view and digest and send back both (MergeData) in the form of a MERGE_RSP to the sender. If a merge is already in progress, send back a MergeData with the merge_rejected field set to true. @param sender The address of the merge leader @param merge_id The merge ID @param mbrs The set of members from which we expect responses """ merger.handleMergeRequest(sender, merge_id, mbrs); }
java
public void handleMergeRequest(Address sender, MergeId merge_id, Collection<? extends Address> mbrs) { merger.handleMergeRequest(sender, merge_id, mbrs); }
[ "public", "void", "handleMergeRequest", "(", "Address", "sender", ",", "MergeId", "merge_id", ",", "Collection", "<", "?", "extends", "Address", ">", "mbrs", ")", "{", "merger", ".", "handleMergeRequest", "(", "sender", ",", "merge_id", ",", "mbrs", ")", ";"...
Get the view and digest and send back both (MergeData) in the form of a MERGE_RSP to the sender. If a merge is already in progress, send back a MergeData with the merge_rejected field set to true. @param sender The address of the merge leader @param merge_id The merge ID @param mbrs The set of members from which we expect responses
[ "Get", "the", "view", "and", "digest", "and", "send", "back", "both", "(", "MergeData", ")", "in", "the", "form", "of", "a", "MERGE_RSP", "to", "the", "sender", ".", "If", "a", "merge", "is", "already", "in", "progress", "send", "back", "a", "MergeData...
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/ServerGmsImpl.java#L46-L48
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/io/socket/SharedMemorySocket.java
SharedMemorySocket.lockMutex
private HANDLE lockMutex() throws IOException { """ /* Create a mutex to synchronize login. Without mutex, different connections that are created at about the same time, could get the same connection number. Note, that this mutex, or any synchronization does not exist in in either C or .NET connectors (i.e they are racy) """ PointerByReference securityDescriptor = new PointerByReference(); Advapi32.INSTANCE .ConvertStringSecurityDescriptorToSecurityDescriptor(EVERYONE_SYNCHRONIZE_SDDL, 1, securityDescriptor, null); Advapi32.SECURITY_ATTRIBUTES sa = new Advapi32.SECURITY_ATTRIBUTES(); sa.nLength = sa.size(); sa.lpSecurityDescriptor = securityDescriptor.getValue(); sa.bInheritHandle = false; HANDLE mutex = Kernel32.INSTANCE.CreateMutex(sa, false, memoryName + "_CONNECT_MUTEX"); Kernel32.INSTANCE.LocalFree(securityDescriptor.getValue()); if (Kernel32.INSTANCE.WaitForSingleObject(mutex, timeout) == -1) { Kernel32.INSTANCE.CloseHandle(mutex); throw new IOException( "wait failed (timeout, last error = " + Kernel32.INSTANCE.GetLastError()); } return mutex; }
java
private HANDLE lockMutex() throws IOException { PointerByReference securityDescriptor = new PointerByReference(); Advapi32.INSTANCE .ConvertStringSecurityDescriptorToSecurityDescriptor(EVERYONE_SYNCHRONIZE_SDDL, 1, securityDescriptor, null); Advapi32.SECURITY_ATTRIBUTES sa = new Advapi32.SECURITY_ATTRIBUTES(); sa.nLength = sa.size(); sa.lpSecurityDescriptor = securityDescriptor.getValue(); sa.bInheritHandle = false; HANDLE mutex = Kernel32.INSTANCE.CreateMutex(sa, false, memoryName + "_CONNECT_MUTEX"); Kernel32.INSTANCE.LocalFree(securityDescriptor.getValue()); if (Kernel32.INSTANCE.WaitForSingleObject(mutex, timeout) == -1) { Kernel32.INSTANCE.CloseHandle(mutex); throw new IOException( "wait failed (timeout, last error = " + Kernel32.INSTANCE.GetLastError()); } return mutex; }
[ "private", "HANDLE", "lockMutex", "(", ")", "throws", "IOException", "{", "PointerByReference", "securityDescriptor", "=", "new", "PointerByReference", "(", ")", ";", "Advapi32", ".", "INSTANCE", ".", "ConvertStringSecurityDescriptorToSecurityDescriptor", "(", "EVERYONE_S...
/* Create a mutex to synchronize login. Without mutex, different connections that are created at about the same time, could get the same connection number. Note, that this mutex, or any synchronization does not exist in in either C or .NET connectors (i.e they are racy)
[ "/", "*", "Create", "a", "mutex", "to", "synchronize", "login", ".", "Without", "mutex", "different", "connections", "that", "are", "created", "at", "about", "the", "same", "time", "could", "get", "the", "same", "connection", "number", ".", "Note", "that", ...
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/io/socket/SharedMemorySocket.java#L146-L163
javagl/CommonUI
src/main/java/de/javagl/common/ui/layout/AspectLayout.java
AspectLayout.computeGridSize
private static Point computeGridSize( Container container, int numComponents, double aspect) { """ Compute a grid size for the given container, for the given number of components with the specified aspect ratio, optimizing the number of rows/columns so that the space is used optimally. @param container The container @param numComponents The number of components @param aspect The aspect ratio of the components @return A point (x,y) storing the (columns,rows) that the grid should have in order to waste as little space as possible """ double containerSizeX = container.getWidth(); double containerSizeY = container.getHeight(); double minTotalWastedSpace = Double.MAX_VALUE; int minWasteGridSizeX = -1; for (int gridSizeX = 1; gridSizeX <= numComponents; gridSizeX++) { int gridSizeY = numComponents / gridSizeX; if (gridSizeX * gridSizeY < numComponents) { gridSizeY++; } double cellSizeX = containerSizeX / gridSizeX; double cellSizeY = containerSizeY / gridSizeY; double wastedSpace = computeWastedSpace(cellSizeX, cellSizeY, aspect); double totalWastedSpace = gridSizeX * gridSizeY * wastedSpace; if (totalWastedSpace < minTotalWastedSpace) { minTotalWastedSpace = totalWastedSpace; minWasteGridSizeX = gridSizeX; } } int gridSizeX = minWasteGridSizeX; int gridSizeY = numComponents / gridSizeX; if (gridSizeX * gridSizeY < numComponents) { gridSizeY++; } return new Point(gridSizeX, gridSizeY); }
java
private static Point computeGridSize( Container container, int numComponents, double aspect) { double containerSizeX = container.getWidth(); double containerSizeY = container.getHeight(); double minTotalWastedSpace = Double.MAX_VALUE; int minWasteGridSizeX = -1; for (int gridSizeX = 1; gridSizeX <= numComponents; gridSizeX++) { int gridSizeY = numComponents / gridSizeX; if (gridSizeX * gridSizeY < numComponents) { gridSizeY++; } double cellSizeX = containerSizeX / gridSizeX; double cellSizeY = containerSizeY / gridSizeY; double wastedSpace = computeWastedSpace(cellSizeX, cellSizeY, aspect); double totalWastedSpace = gridSizeX * gridSizeY * wastedSpace; if (totalWastedSpace < minTotalWastedSpace) { minTotalWastedSpace = totalWastedSpace; minWasteGridSizeX = gridSizeX; } } int gridSizeX = minWasteGridSizeX; int gridSizeY = numComponents / gridSizeX; if (gridSizeX * gridSizeY < numComponents) { gridSizeY++; } return new Point(gridSizeX, gridSizeY); }
[ "private", "static", "Point", "computeGridSize", "(", "Container", "container", ",", "int", "numComponents", ",", "double", "aspect", ")", "{", "double", "containerSizeX", "=", "container", ".", "getWidth", "(", ")", ";", "double", "containerSizeY", "=", "contai...
Compute a grid size for the given container, for the given number of components with the specified aspect ratio, optimizing the number of rows/columns so that the space is used optimally. @param container The container @param numComponents The number of components @param aspect The aspect ratio of the components @return A point (x,y) storing the (columns,rows) that the grid should have in order to waste as little space as possible
[ "Compute", "a", "grid", "size", "for", "the", "given", "container", "for", "the", "given", "number", "of", "components", "with", "the", "specified", "aspect", "ratio", "optimizing", "the", "number", "of", "rows", "/", "columns", "so", "that", "the", "space",...
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/layout/AspectLayout.java#L175-L207
aws/aws-sdk-java
aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/CreateConnectorDefinitionRequest.java
CreateConnectorDefinitionRequest.withTags
public CreateConnectorDefinitionRequest withTags(java.util.Map<String, String> tags) { """ Tag(s) to add to the new resource @param tags Tag(s) to add to the new resource @return Returns a reference to this object so that method calls can be chained together. """ setTags(tags); return this; }
java
public CreateConnectorDefinitionRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "CreateConnectorDefinitionRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
Tag(s) to add to the new resource @param tags Tag(s) to add to the new resource @return Returns a reference to this object so that method calls can be chained together.
[ "Tag", "(", "s", ")", "to", "add", "to", "the", "new", "resource" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/CreateConnectorDefinitionRequest.java#L168-L171
apereo/cas
support/cas-server-support-couchdb-core/src/main/java/org/apereo/cas/couchdb/core/CouchDbProfileDocument.java
CouchDbProfileDocument.setAttribute
@JsonIgnore public void setAttribute(final String key, final Object value) { """ Sets a single attribute. @param key the attribute key to set @param value the value to be set """ attributes.put(key, CollectionUtils.toCollection(value, ArrayList.class)); }
java
@JsonIgnore public void setAttribute(final String key, final Object value) { attributes.put(key, CollectionUtils.toCollection(value, ArrayList.class)); }
[ "@", "JsonIgnore", "public", "void", "setAttribute", "(", "final", "String", "key", ",", "final", "Object", "value", ")", "{", "attributes", ".", "put", "(", "key", ",", "CollectionUtils", ".", "toCollection", "(", "value", ",", "ArrayList", ".", "class", ...
Sets a single attribute. @param key the attribute key to set @param value the value to be set
[ "Sets", "a", "single", "attribute", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-couchdb-core/src/main/java/org/apereo/cas/couchdb/core/CouchDbProfileDocument.java#L73-L76
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/formatting2/SARLFormatter.java
SARLFormatter._format
protected void _format(SarlRequiredCapacity requiredCapacity, IFormattableDocument document) { """ Format a required capacity. @param requiredCapacity the element ot format. @param document the document. """ final ISemanticRegionsFinder regionFor = this.textRegionExtensions.regionFor(requiredCapacity); document.append(regionFor.keyword(this.keywords.getRequiresKeyword()), ONE_SPACE); formatCommaSeparatedList(requiredCapacity.getCapacities(), document); document.prepend(regionFor.keyword(this.keywords.getSemicolonKeyword()), NO_SPACE); }
java
protected void _format(SarlRequiredCapacity requiredCapacity, IFormattableDocument document) { final ISemanticRegionsFinder regionFor = this.textRegionExtensions.regionFor(requiredCapacity); document.append(regionFor.keyword(this.keywords.getRequiresKeyword()), ONE_SPACE); formatCommaSeparatedList(requiredCapacity.getCapacities(), document); document.prepend(regionFor.keyword(this.keywords.getSemicolonKeyword()), NO_SPACE); }
[ "protected", "void", "_format", "(", "SarlRequiredCapacity", "requiredCapacity", ",", "IFormattableDocument", "document", ")", "{", "final", "ISemanticRegionsFinder", "regionFor", "=", "this", ".", "textRegionExtensions", ".", "regionFor", "(", "requiredCapacity", ")", ...
Format a required capacity. @param requiredCapacity the element ot format. @param document the document.
[ "Format", "a", "required", "capacity", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/formatting2/SARLFormatter.java#L487-L492
Labs64/swid-generator
src/main/java/com/labs64/utils/swid/processor/DefaultSwidProcessor.java
DefaultSwidProcessor.setTagCreator
public DefaultSwidProcessor setTagCreator(final String tagCreatorName, final String tagCreatorRegId) { """ <p> Identifies the tag creator (tag: tag_creator). </p> <p> Example data format: <i>“regid.2010-04.com.labs64,NLIC”</i> where: <ul> <li>regid = registered id</li> <li>2010-04 = the year and first month the domain was registered (yyyy-mm)</li> <li>com = the upper level domain</li> <li>labs64 = the domain name</li> <li>NLIC = the name of the business unit (BU) that created the SWID tag</li> </ul> <p> Note that everything after the comma ‘,’ is optional and only required if a software title is specific </p> @param tagCreatorName tag creator name @param tagCreatorRegId tag creator registration ID @return a reference to this object. """ swidTag.setTagCreator( new EntityComplexType( new Token(tagCreatorName, idGenerator.nextId()), new RegistrationId(tagCreatorRegId, idGenerator.nextId()), idGenerator.nextId())); return this; }
java
public DefaultSwidProcessor setTagCreator(final String tagCreatorName, final String tagCreatorRegId) { swidTag.setTagCreator( new EntityComplexType( new Token(tagCreatorName, idGenerator.nextId()), new RegistrationId(tagCreatorRegId, idGenerator.nextId()), idGenerator.nextId())); return this; }
[ "public", "DefaultSwidProcessor", "setTagCreator", "(", "final", "String", "tagCreatorName", ",", "final", "String", "tagCreatorRegId", ")", "{", "swidTag", ".", "setTagCreator", "(", "new", "EntityComplexType", "(", "new", "Token", "(", "tagCreatorName", ",", "idGe...
<p> Identifies the tag creator (tag: tag_creator). </p> <p> Example data format: <i>“regid.2010-04.com.labs64,NLIC”</i> where: <ul> <li>regid = registered id</li> <li>2010-04 = the year and first month the domain was registered (yyyy-mm)</li> <li>com = the upper level domain</li> <li>labs64 = the domain name</li> <li>NLIC = the name of the business unit (BU) that created the SWID tag</li> </ul> <p> Note that everything after the comma ‘,’ is optional and only required if a software title is specific </p> @param tagCreatorName tag creator name @param tagCreatorRegId tag creator registration ID @return a reference to this object.
[ "<p", ">", "Identifies", "the", "tag", "creator", "(", "tag", ":", "tag_creator", ")", ".", "<", "/", "p", ">", "<p", ">", "Example", "data", "format", ":", "<i", ">", "“regid", ".", "2010", "-", "04", ".", "com", ".", "labs64", "NLIC”<", "/", "i...
train
https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/processor/DefaultSwidProcessor.java#L206-L213
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java
AbstractBeanDefinition.containsProperties
@SuppressWarnings("unused") @Internal @UsedByGeneratedCode protected final boolean containsProperties(BeanResolutionContext resolutionContext, BeanContext context) { """ If this bean is a {@link ConfigurationProperties} bean return whether any properties for it are configured within the context. @param resolutionContext the resolution context @param context The context @return True if it does """ return containsProperties(resolutionContext, context, null); }
java
@SuppressWarnings("unused") @Internal @UsedByGeneratedCode protected final boolean containsProperties(BeanResolutionContext resolutionContext, BeanContext context) { return containsProperties(resolutionContext, context, null); }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "@", "Internal", "@", "UsedByGeneratedCode", "protected", "final", "boolean", "containsProperties", "(", "BeanResolutionContext", "resolutionContext", ",", "BeanContext", "context", ")", "{", "return", "containsProperties",...
If this bean is a {@link ConfigurationProperties} bean return whether any properties for it are configured within the context. @param resolutionContext the resolution context @param context The context @return True if it does
[ "If", "this", "bean", "is", "a", "{", "@link", "ConfigurationProperties", "}", "bean", "return", "whether", "any", "properties", "for", "it", "are", "configured", "within", "the", "context", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java#L1270-L1275
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/RotationAxisAligner.java
RotationAxisAligner.calcPrincipalRotationVector
private void calcPrincipalRotationVector() { """ Returns a vector along the principal rotation axis for the alignment of structures along the z-axis @return principal rotation vector """ Rotation rotation = rotationGroup.getRotation(0); // the rotation around the principal axis is the first rotation AxisAngle4d axisAngle = rotation.getAxisAngle(); principalRotationVector = new Vector3d(axisAngle.x, axisAngle.y, axisAngle.z); }
java
private void calcPrincipalRotationVector() { Rotation rotation = rotationGroup.getRotation(0); // the rotation around the principal axis is the first rotation AxisAngle4d axisAngle = rotation.getAxisAngle(); principalRotationVector = new Vector3d(axisAngle.x, axisAngle.y, axisAngle.z); }
[ "private", "void", "calcPrincipalRotationVector", "(", ")", "{", "Rotation", "rotation", "=", "rotationGroup", ".", "getRotation", "(", "0", ")", ";", "// the rotation around the principal axis is the first rotation", "AxisAngle4d", "axisAngle", "=", "rotation", ".", "get...
Returns a vector along the principal rotation axis for the alignment of structures along the z-axis @return principal rotation vector
[ "Returns", "a", "vector", "along", "the", "principal", "rotation", "axis", "for", "the", "alignment", "of", "structures", "along", "the", "z", "-", "axis" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/RotationAxisAligner.java#L661-L665
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/DoubleStream.java
DoubleStream.mapToLong
@NotNull public LongStream mapToLong(@NotNull final DoubleToLongFunction mapper) { """ Returns an {@code LongStream} consisting of the results of applying the given function to the elements of this stream. <p> This is an intermediate operation. @param mapper the mapper function used to apply to each element @return the new {@code LongStream} """ return new LongStream(params, new DoubleMapToLong(iterator, mapper)); }
java
@NotNull public LongStream mapToLong(@NotNull final DoubleToLongFunction mapper) { return new LongStream(params, new DoubleMapToLong(iterator, mapper)); }
[ "@", "NotNull", "public", "LongStream", "mapToLong", "(", "@", "NotNull", "final", "DoubleToLongFunction", "mapper", ")", "{", "return", "new", "LongStream", "(", "params", ",", "new", "DoubleMapToLong", "(", "iterator", ",", "mapper", ")", ")", ";", "}" ]
Returns an {@code LongStream} consisting of the results of applying the given function to the elements of this stream. <p> This is an intermediate operation. @param mapper the mapper function used to apply to each element @return the new {@code LongStream}
[ "Returns", "an", "{", "@code", "LongStream", "}", "consisting", "of", "the", "results", "of", "applying", "the", "given", "function", "to", "the", "elements", "of", "this", "stream", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/DoubleStream.java#L504-L507
andrehertwig/admintool
admin-tools-core/src/main/java/de/chandre/admintool/core/utils/AdminToolMenuUtils.java
AdminToolMenuUtils.getMenuName
public String getMenuName(HttpServletRequest request, String overrideName) { """ retuns the menu name for given requestUrl or the overrideName if set. @param request @param overrideName (optional) @return """ if (!StringUtils.isEmpty(overrideName)) { return overrideName; } String name = request.getRequestURI().replaceFirst(AdminTool.ROOTCONTEXT, ""); if (!StringUtils.isEmpty(request.getContextPath())) { name = name.replaceFirst(request.getContextPath(), ""); } if (name.startsWith("/")) { name = name.substring(1, name.length()); } return name; }
java
public String getMenuName(HttpServletRequest request, String overrideName) { if (!StringUtils.isEmpty(overrideName)) { return overrideName; } String name = request.getRequestURI().replaceFirst(AdminTool.ROOTCONTEXT, ""); if (!StringUtils.isEmpty(request.getContextPath())) { name = name.replaceFirst(request.getContextPath(), ""); } if (name.startsWith("/")) { name = name.substring(1, name.length()); } return name; }
[ "public", "String", "getMenuName", "(", "HttpServletRequest", "request", ",", "String", "overrideName", ")", "{", "if", "(", "!", "StringUtils", ".", "isEmpty", "(", "overrideName", ")", ")", "{", "return", "overrideName", ";", "}", "String", "name", "=", "r...
retuns the menu name for given requestUrl or the overrideName if set. @param request @param overrideName (optional) @return
[ "retuns", "the", "menu", "name", "for", "given", "requestUrl", "or", "the", "overrideName", "if", "set", "." ]
train
https://github.com/andrehertwig/admintool/blob/6d391e2d26969b70e3ccabfc34202abe8d915080/admin-tools-core/src/main/java/de/chandre/admintool/core/utils/AdminToolMenuUtils.java#L77-L89
liyiorg/weixin-popular
src/main/java/weixin/popular/api/MaterialAPI.java
MaterialAPI.batchget_material
public static MaterialBatchgetResult batchget_material(String access_token,String type,int offset,int count) { """ 获取素材列表 @param access_token access_token @param type 素材的类型,图片(image)、视频(video)、语音 (voice)、图文(news) @param offset 从全部素材的该偏移位置开始返回,0表示从第一个素材 返回 @param count 返回素材的数量,取值在1到20之间 @return MaterialBatchgetResult """ HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI+"/cgi-bin/material/batchget_material") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity("{\"type\":\""+type+"\",\"offset\":"+offset+",\"count\":"+count+"}",Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest,MaterialBatchgetResult.class); }
java
public static MaterialBatchgetResult batchget_material(String access_token,String type,int offset,int count){ HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI+"/cgi-bin/material/batchget_material") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity("{\"type\":\""+type+"\",\"offset\":"+offset+",\"count\":"+count+"}",Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest,MaterialBatchgetResult.class); }
[ "public", "static", "MaterialBatchgetResult", "batchget_material", "(", "String", "access_token", ",", "String", "type", ",", "int", "offset", ",", "int", "count", ")", "{", "HttpUriRequest", "httpUriRequest", "=", "RequestBuilder", ".", "post", "(", ")", ".", "...
获取素材列表 @param access_token access_token @param type 素材的类型,图片(image)、视频(video)、语音 (voice)、图文(news) @param offset 从全部素材的该偏移位置开始返回,0表示从第一个素材 返回 @param count 返回素材的数量,取值在1到20之间 @return MaterialBatchgetResult
[ "获取素材列表" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/MaterialAPI.java#L261-L269