repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java
BigDecimalUtil.roundDown
private static double roundDown(final double n, final int p) { double retval; if (Double.isNaN(n) || Double.isInfinite(n)) { retval = Double.NaN; } else { if (p != 0) { final double temp = Math.pow(10, p); retval = sign(n) * Math.round(Math.abs(n) * temp - ROUNDING_UP_FLOAT) / temp; } else { retval = (long) n; } } return retval; }
java
private static double roundDown(final double n, final int p) { double retval; if (Double.isNaN(n) || Double.isInfinite(n)) { retval = Double.NaN; } else { if (p != 0) { final double temp = Math.pow(10, p); retval = sign(n) * Math.round(Math.abs(n) * temp - ROUNDING_UP_FLOAT) / temp; } else { retval = (long) n; } } return retval; }
[ "private", "static", "double", "roundDown", "(", "final", "double", "n", ",", "final", "int", "p", ")", "{", "double", "retval", ";", "if", "(", "Double", ".", "isNaN", "(", "n", ")", "||", "Double", ".", "isInfinite", "(", "n", ")", ")", "{", "ret...
Returns a value rounded to p digits after decimal. If p is negative, then the number is rounded to places to the left of the decimal point. eg. 10.23 rounded to -1 will give: 10. If p is zero, the returned value is rounded to the nearest integral value. <p>If n is negative, the resulting value is obtained as the round-up value of absolute value of n multiplied by the sign value of n (@see MathX.sign(double d)). Thus, -0.8 rounded-down to p=0 will give 0 not -1. <p>If n is NaN, returned value is NaN. @param n @param p @return
[ "Returns", "a", "value", "rounded", "to", "p", "digits", "after", "decimal", ".", "If", "p", "is", "negative", "then", "the", "number", "is", "rounded", "to", "places", "to", "the", "left", "of", "the", "decimal", "point", ".", "eg", ".", "10", ".", ...
train
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L601-L616
jenkinsci/jenkins
core/src/main/java/hudson/model/Descriptor.java
Descriptor.findByDescribableClassName
public static @CheckForNull <T extends Descriptor> T findByDescribableClassName(Collection<? extends T> list, String className) { for (T d : list) { if(d.clazz.getName().equals(className)) return d; } return null; }
java
public static @CheckForNull <T extends Descriptor> T findByDescribableClassName(Collection<? extends T> list, String className) { for (T d : list) { if(d.clazz.getName().equals(className)) return d; } return null; }
[ "public", "static", "@", "CheckForNull", "<", "T", "extends", "Descriptor", ">", "T", "findByDescribableClassName", "(", "Collection", "<", "?", "extends", "T", ">", "list", ",", "String", "className", ")", "{", "for", "(", "T", "d", ":", "list", ")", "{...
Finds a descriptor from a collection by the class name of the {@link Describable} it describes. @param className should match {@link Class#getName} of a {@link #clazz} @since 1.610
[ "Finds", "a", "descriptor", "from", "a", "collection", "by", "the", "class", "name", "of", "the", "{" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Descriptor.java#L1099-L1105
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/WaveformPreviewComponent.java
WaveformPreviewComponent.setWaveformPreview
public void setWaveformPreview(WaveformPreview preview, int duration, CueList cueList) { updateWaveform(preview); this.duration.set(duration); this.cueList.set(cueList); clearPlaybackState(); repaint(); }
java
public void setWaveformPreview(WaveformPreview preview, int duration, CueList cueList) { updateWaveform(preview); this.duration.set(duration); this.cueList.set(cueList); clearPlaybackState(); repaint(); }
[ "public", "void", "setWaveformPreview", "(", "WaveformPreview", "preview", ",", "int", "duration", ",", "CueList", "cueList", ")", "{", "updateWaveform", "(", "preview", ")", ";", "this", ".", "duration", ".", "set", "(", "duration", ")", ";", "this", ".", ...
Change the waveform preview being drawn. This will be quickly overruled if a player is being monitored, but can be used in other contexts. @param preview the waveform preview to display @param duration the playback duration, in seconds, of the track whose waveform we are drawing, so we can translate times into positions @param cueList the hot cues and memory points stored for the track, if any, so we can draw them
[ "Change", "the", "waveform", "preview", "being", "drawn", ".", "This", "will", "be", "quickly", "overruled", "if", "a", "player", "is", "being", "monitored", "but", "can", "be", "used", "in", "other", "contexts", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformPreviewComponent.java#L466-L472
liferay/com-liferay-commerce
commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountOrganizationRelPersistenceImpl.java
CommerceAccountOrganizationRelPersistenceImpl.findAll
@Override public List<CommerceAccountOrganizationRel> findAll(int start, int end) { return findAll(start, end, null); }
java
@Override public List<CommerceAccountOrganizationRel> findAll(int start, int end) { return findAll(start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceAccountOrganizationRel", ">", "findAll", "(", "int", "start", ",", "int", "end", ")", "{", "return", "findAll", "(", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the commerce account organization rels. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceAccountOrganizationRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param start the lower bound of the range of commerce account organization rels @param end the upper bound of the range of commerce account organization rels (not inclusive) @return the range of commerce account organization rels
[ "Returns", "a", "range", "of", "all", "the", "commerce", "account", "organization", "rels", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountOrganizationRelPersistenceImpl.java#L1639-L1642
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/locale/LocaleUtils.java
LocaleUtils.getAvailableLocaleSuffixesForBundle
public static List<String> getAvailableLocaleSuffixesForBundle(String messageBundlePath, ServletContext servletContext) { return getAvailableLocaleSuffixesForBundle(messageBundlePath, MSG_RESOURCE_BUNDLE_SUFFIX, servletContext); }
java
public static List<String> getAvailableLocaleSuffixesForBundle(String messageBundlePath, ServletContext servletContext) { return getAvailableLocaleSuffixesForBundle(messageBundlePath, MSG_RESOURCE_BUNDLE_SUFFIX, servletContext); }
[ "public", "static", "List", "<", "String", ">", "getAvailableLocaleSuffixesForBundle", "(", "String", "messageBundlePath", ",", "ServletContext", "servletContext", ")", "{", "return", "getAvailableLocaleSuffixesForBundle", "(", "messageBundlePath", ",", "MSG_RESOURCE_BUNDLE_S...
Returns the list of available locale suffixes for a message resource bundle @param messageBundlePath the resource bundle path @param servletContext the servlet context @return the list of available locale suffixes for a message resource bundle
[ "Returns", "the", "list", "of", "available", "locale", "suffixes", "for", "a", "message", "resource", "bundle" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/locale/LocaleUtils.java#L112-L116
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java
FaceListsImpl.addFaceFromUrlAsync
public Observable<PersistedFace> addFaceFromUrlAsync(String faceListId, String url, AddFaceFromUrlOptionalParameter addFaceFromUrlOptionalParameter) { return addFaceFromUrlWithServiceResponseAsync(faceListId, url, addFaceFromUrlOptionalParameter).map(new Func1<ServiceResponse<PersistedFace>, PersistedFace>() { @Override public PersistedFace call(ServiceResponse<PersistedFace> response) { return response.body(); } }); }
java
public Observable<PersistedFace> addFaceFromUrlAsync(String faceListId, String url, AddFaceFromUrlOptionalParameter addFaceFromUrlOptionalParameter) { return addFaceFromUrlWithServiceResponseAsync(faceListId, url, addFaceFromUrlOptionalParameter).map(new Func1<ServiceResponse<PersistedFace>, PersistedFace>() { @Override public PersistedFace call(ServiceResponse<PersistedFace> response) { return response.body(); } }); }
[ "public", "Observable", "<", "PersistedFace", ">", "addFaceFromUrlAsync", "(", "String", "faceListId", ",", "String", "url", ",", "AddFaceFromUrlOptionalParameter", "addFaceFromUrlOptionalParameter", ")", "{", "return", "addFaceFromUrlWithServiceResponseAsync", "(", "faceList...
Add a face to a face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. @param faceListId Id referencing a particular face list. @param url Publicly reachable URL of an image @param addFaceFromUrlOptionalParameter 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 PersistedFace object
[ "Add", "a", "face", "to", "a", "face", "list", ".", "The", "input", "face", "is", "specified", "as", "an", "image", "with", "a", "targetFace", "rectangle", ".", "It", "returns", "a", "persistedFaceId", "representing", "the", "added", "face", "and", "persis...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java#L778-L785
josueeduardo/snappy
plugin-parent/snappy-loader/src/main/java/io/joshworks/snappy/loader/LaunchedURLClassLoader.java
LaunchedURLClassLoader.definePackageForFindClass
private void definePackageForFindClass(final String name, final String packageName) { try { AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { @Override public Object run() { String path = name.replace('.', '/').concat(".class"); for (URL url : getURLs()) { try { if (url.getContent() instanceof JarFile) { JarFile jarFile = (JarFile) url.getContent(); // Check the jar entry data before needlessly creating the // manifest if (jarFile.getJarEntryData(path) != null && jarFile.getManifest() != null) { definePackage(packageName, jarFile.getManifest(), url); return null; } } } catch (IOException ex) { // Ignore } } return null; } }, AccessController.getContext()); } catch (java.security.PrivilegedActionException ex) { // Ignore } }
java
private void definePackageForFindClass(final String name, final String packageName) { try { AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { @Override public Object run() { String path = name.replace('.', '/').concat(".class"); for (URL url : getURLs()) { try { if (url.getContent() instanceof JarFile) { JarFile jarFile = (JarFile) url.getContent(); // Check the jar entry data before needlessly creating the // manifest if (jarFile.getJarEntryData(path) != null && jarFile.getManifest() != null) { definePackage(packageName, jarFile.getManifest(), url); return null; } } } catch (IOException ex) { // Ignore } } return null; } }, AccessController.getContext()); } catch (java.security.PrivilegedActionException ex) { // Ignore } }
[ "private", "void", "definePackageForFindClass", "(", "final", "String", "name", ",", "final", "String", "packageName", ")", "{", "try", "{", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedExceptionAction", "<", "Object", ">", "(", ")", "{", "@",...
Define a package before a {@code findClass} call is made. This is necessary to ensure that the appropriate manifest for nested JARs associated with the package. @param name the class name being found @param packageName the package
[ "Define", "a", "package", "before", "a", "{", "@code", "findClass", "}", "call", "is", "made", ".", "This", "is", "necessary", "to", "ensure", "that", "the", "appropriate", "manifest", "for", "nested", "JARs", "associated", "with", "the", "package", "." ]
train
https://github.com/josueeduardo/snappy/blob/d95a9e811eda3c24a5e53086369208819884fa49/plugin-parent/snappy-loader/src/main/java/io/joshworks/snappy/loader/LaunchedURLClassLoader.java#L205-L235
netty/netty
buffer/src/main/java/io/netty/buffer/Unpooled.java
Unpooled.copiedBuffer
public static ByteBuf copiedBuffer(byte[] array, int offset, int length) { if (length == 0) { return EMPTY_BUFFER; } byte[] copy = PlatformDependent.allocateUninitializedArray(length); System.arraycopy(array, offset, copy, 0, length); return wrappedBuffer(copy); }
java
public static ByteBuf copiedBuffer(byte[] array, int offset, int length) { if (length == 0) { return EMPTY_BUFFER; } byte[] copy = PlatformDependent.allocateUninitializedArray(length); System.arraycopy(array, offset, copy, 0, length); return wrappedBuffer(copy); }
[ "public", "static", "ByteBuf", "copiedBuffer", "(", "byte", "[", "]", "array", ",", "int", "offset", ",", "int", "length", ")", "{", "if", "(", "length", "==", "0", ")", "{", "return", "EMPTY_BUFFER", ";", "}", "byte", "[", "]", "copy", "=", "Platfor...
Creates a new big-endian buffer whose content is a copy of the specified {@code array}'s sub-region. The new buffer's {@code readerIndex} and {@code writerIndex} are {@code 0} and the specified {@code length} respectively.
[ "Creates", "a", "new", "big", "-", "endian", "buffer", "whose", "content", "is", "a", "copy", "of", "the", "specified", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/Unpooled.java#L372-L379
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/StorageUtil.java
StorageUtil.setDateTime
public void setDateTime(Element el, String key, DateTime value) { if (value != null) { String str = value.castToString(null); if (str != null) el.setAttribute(key, str); } }
java
public void setDateTime(Element el, String key, DateTime value) { if (value != null) { String str = value.castToString(null); if (str != null) el.setAttribute(key, str); } }
[ "public", "void", "setDateTime", "(", "Element", "el", ",", "String", "key", ",", "DateTime", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "String", "str", "=", "value", ".", "castToString", "(", "null", ")", ";", "if", "(", "str", ...
sets a datetime value to a XML Element @param el Element to set value on it @param key key to set @param value value to set
[ "sets", "a", "datetime", "value", "to", "a", "XML", "Element" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L412-L417
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java
ExcelWriter.writeRow
@SuppressWarnings({ "unchecked", "rawtypes" }) public ExcelWriter writeRow(Object rowBean, boolean isWriteKeyAsHead) { if (rowBean instanceof Iterable) { return writeRow((Iterable<?>) rowBean); } Map rowMap = null; if (rowBean instanceof Map) { if (MapUtil.isNotEmpty(this.headerAlias)) { rowMap = MapUtil.newTreeMap((Map) rowBean, getInitedAliasComparator()); } else { rowMap = (Map) rowBean; } } else if (BeanUtil.isBean(rowBean.getClass())) { if (MapUtil.isEmpty(this.headerAlias)) { rowMap = BeanUtil.beanToMap(rowBean, new LinkedHashMap<String, Object>(), false, false); } else { // 别名存在情况下按照别名的添加顺序排序Bean数据 rowMap = BeanUtil.beanToMap(rowBean, new TreeMap<String, Object>(getInitedAliasComparator()), false, false); } } else { // 其它转为字符串默认输出 return writeRow(CollUtil.newArrayList(rowBean), isWriteKeyAsHead); } return writeRow(rowMap, isWriteKeyAsHead); }
java
@SuppressWarnings({ "unchecked", "rawtypes" }) public ExcelWriter writeRow(Object rowBean, boolean isWriteKeyAsHead) { if (rowBean instanceof Iterable) { return writeRow((Iterable<?>) rowBean); } Map rowMap = null; if (rowBean instanceof Map) { if (MapUtil.isNotEmpty(this.headerAlias)) { rowMap = MapUtil.newTreeMap((Map) rowBean, getInitedAliasComparator()); } else { rowMap = (Map) rowBean; } } else if (BeanUtil.isBean(rowBean.getClass())) { if (MapUtil.isEmpty(this.headerAlias)) { rowMap = BeanUtil.beanToMap(rowBean, new LinkedHashMap<String, Object>(), false, false); } else { // 别名存在情况下按照别名的添加顺序排序Bean数据 rowMap = BeanUtil.beanToMap(rowBean, new TreeMap<String, Object>(getInitedAliasComparator()), false, false); } } else { // 其它转为字符串默认输出 return writeRow(CollUtil.newArrayList(rowBean), isWriteKeyAsHead); } return writeRow(rowMap, isWriteKeyAsHead); }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "public", "ExcelWriter", "writeRow", "(", "Object", "rowBean", ",", "boolean", "isWriteKeyAsHead", ")", "{", "if", "(", "rowBean", "instanceof", "Iterable", ")", "{", "return", ...
写出一行,根据rowBean数据类型不同,写出情况如下: <pre> 1、如果为Iterable,直接写出一行 2、如果为Map,isWriteKeyAsHead为true写出两行,Map的keys做为一行,values做为第二行,否则只写出一行values 3、如果为Bean,转为Map写出,isWriteKeyAsHead为true写出两行,Map的keys做为一行,values做为第二行,否则只写出一行values </pre> @param rowBean 写出的Bean @param isWriteKeyAsHead 为true写出两行,Map的keys做为一行,values做为第二行,否则只写出一行values @return this @see #writeRow(Iterable) @see #writeRow(Map, boolean) @since 4.1.5
[ "写出一行,根据rowBean数据类型不同,写出情况如下:" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java#L677-L701
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java
ServerDnsAliasesInner.acquireAsync
public Observable<Void> acquireAsync(String resourceGroupName, String serverName, String dnsAliasName, String oldServerDnsAliasId) { return acquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName, oldServerDnsAliasId).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> acquireAsync(String resourceGroupName, String serverName, String dnsAliasName, String oldServerDnsAliasId) { return acquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName, oldServerDnsAliasId).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "acquireAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "dnsAliasName", ",", "String", "oldServerDnsAliasId", ")", "{", "return", "acquireWithServiceResponseAsync", "(", "resourceGroupName...
Acquires server DNS alias from another server. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server that the alias is pointing to. @param dnsAliasName The name of the server dns alias. @param oldServerDnsAliasId The id of the server alias that will be acquired to point to this server instead. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Acquires", "server", "DNS", "alias", "from", "another", "server", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java#L776-L783
outbrain/ob1k
ob1k-http/src/main/java/com/outbrain/ob1k/http/utils/UrlUtils.java
UrlUtils.replacePathParam
public static String replacePathParam(final String url, final String param, final String value) throws EncoderException { final String pathParam = param.startsWith("{") ? param : "{" + param + "}"; final String encodedValue = encode(value); return StringUtils.replace(url, pathParam, encodedValue); }
java
public static String replacePathParam(final String url, final String param, final String value) throws EncoderException { final String pathParam = param.startsWith("{") ? param : "{" + param + "}"; final String encodedValue = encode(value); return StringUtils.replace(url, pathParam, encodedValue); }
[ "public", "static", "String", "replacePathParam", "(", "final", "String", "url", ",", "final", "String", "param", ",", "final", "String", "value", ")", "throws", "EncoderException", "{", "final", "String", "pathParam", "=", "param", ".", "startsWith", "(", "\"...
Replaces path param in uri to a valid, encoded value @param url url to replace in (path params should be in the uri within curly braces) @param param name of the path param (not inside curly braces) @param value value to encode @return url with path param replaced to the value @throws EncoderException
[ "Replaces", "path", "param", "in", "uri", "to", "a", "valid", "encoded", "value" ]
train
https://github.com/outbrain/ob1k/blob/9e43ab39230c5787065053da0f766d822d0fe4e7/ob1k-http/src/main/java/com/outbrain/ob1k/http/utils/UrlUtils.java#L38-L43
Netflix/astyanax
astyanax-cql/src/main/java/com/netflix/astyanax/cql/reads/CFRowKeysQueryGen.java
CFRowKeysQueryGen.getQueryStatement
public BoundStatement getQueryStatement(CqlRowSliceQueryImpl<?,?> rowSliceQuery, boolean useCaching) { switch (rowSliceQuery.getColQueryType()) { case AllColumns: return SelectAllColumnsForRowKeys.getBoundStatement(rowSliceQuery, useCaching); case ColumnSet: return SelectColumnSetForRowKeys.getBoundStatement(rowSliceQuery, useCaching); case ColumnRange: if (isCompositeColumn) { return SelectCompositeColumnRangeForRowKeys.getBoundStatement(rowSliceQuery, useCaching); } else { return SelectColumnRangeForRowKeys.getBoundStatement(rowSliceQuery, useCaching); } default : throw new RuntimeException("RowSliceQuery with row keys use case not supported."); } }
java
public BoundStatement getQueryStatement(CqlRowSliceQueryImpl<?,?> rowSliceQuery, boolean useCaching) { switch (rowSliceQuery.getColQueryType()) { case AllColumns: return SelectAllColumnsForRowKeys.getBoundStatement(rowSliceQuery, useCaching); case ColumnSet: return SelectColumnSetForRowKeys.getBoundStatement(rowSliceQuery, useCaching); case ColumnRange: if (isCompositeColumn) { return SelectCompositeColumnRangeForRowKeys.getBoundStatement(rowSliceQuery, useCaching); } else { return SelectColumnRangeForRowKeys.getBoundStatement(rowSliceQuery, useCaching); } default : throw new RuntimeException("RowSliceQuery with row keys use case not supported."); } }
[ "public", "BoundStatement", "getQueryStatement", "(", "CqlRowSliceQueryImpl", "<", "?", ",", "?", ">", "rowSliceQuery", ",", "boolean", "useCaching", ")", "{", "switch", "(", "rowSliceQuery", ".", "getColQueryType", "(", ")", ")", "{", "case", "AllColumns", ":",...
Main method that is used to generate the java driver statement from the given Astyanax row slice query. Note that the method allows the caller to specify whether to use caching or not. If caching is disabled, then the PreparedStatement is generated every time If caching is enabled, then the cached PreparedStatement is used for the given Astyanax RowSliceQuery. In this case if the PreparedStatement is missing, then it is constructed from the Astyanax query and used to init the cached reference and hence can be used by other subsequent Astayanx RowSliceQuery operations with the same signature (that opt in for caching) @param rowSliceQuery @param useCaching @return
[ "Main", "method", "that", "is", "used", "to", "generate", "the", "java", "driver", "statement", "from", "the", "given", "Astyanax", "row", "slice", "query", ".", "Note", "that", "the", "method", "allows", "the", "caller", "to", "specify", "whether", "to", ...
train
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-cql/src/main/java/com/netflix/astyanax/cql/reads/CFRowKeysQueryGen.java#L266-L283
jbundle/jbundle
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/KeyAreaInfo.java
KeyAreaInfo.reverseKeyBuffer
public void reverseKeyBuffer(BaseBuffer bufferSource, int iAreaDesc) // Move these keys back to the record { int iKeyFields = this.getKeyFields(); for (int iKeyFieldSeq = Constants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFields + Constants.MAIN_KEY_FIELD; iKeyFieldSeq++) { this.getField(iKeyFieldSeq).setData(m_rgobjTempData != null ? m_rgobjTempData[iKeyFieldSeq] : null); } }
java
public void reverseKeyBuffer(BaseBuffer bufferSource, int iAreaDesc) // Move these keys back to the record { int iKeyFields = this.getKeyFields(); for (int iKeyFieldSeq = Constants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFields + Constants.MAIN_KEY_FIELD; iKeyFieldSeq++) { this.getField(iKeyFieldSeq).setData(m_rgobjTempData != null ? m_rgobjTempData[iKeyFieldSeq] : null); } }
[ "public", "void", "reverseKeyBuffer", "(", "BaseBuffer", "bufferSource", ",", "int", "iAreaDesc", ")", "// Move these keys back to the record", "{", "int", "iKeyFields", "=", "this", ".", "getKeyFields", "(", ")", ";", "for", "(", "int", "iKeyFieldSeq", "=", "Cons...
Move the key area to the record. @param destBuffer A BaseBuffer to fill with data (ignored for thin). @param iAreaDesc The (optional) temporary area to copy the current fields to ().
[ "Move", "the", "key", "area", "to", "the", "record", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/KeyAreaInfo.java#L221-L228
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/com/send/ComQuery.java
ComQuery.sendDirect
public static void sendDirect(final PacketOutputStream pos, byte[] sqlBytes) throws IOException { pos.startPacket(0); pos.write(Packet.COM_QUERY); pos.write(sqlBytes); pos.flush(); }
java
public static void sendDirect(final PacketOutputStream pos, byte[] sqlBytes) throws IOException { pos.startPacket(0); pos.write(Packet.COM_QUERY); pos.write(sqlBytes); pos.flush(); }
[ "public", "static", "void", "sendDirect", "(", "final", "PacketOutputStream", "pos", ",", "byte", "[", "]", "sqlBytes", ")", "throws", "IOException", "{", "pos", ".", "startPacket", "(", "0", ")", ";", "pos", ".", "write", "(", "Packet", ".", "COM_QUERY", ...
Send directly to socket the sql data. @param pos output stream @param sqlBytes the query in UTF-8 bytes @throws IOException if connection error occur
[ "Send", "directly", "to", "socket", "the", "sql", "data", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/send/ComQuery.java#L298-L303
morimekta/utils
console-util/src/main/java/net/morimekta/console/args/SubCommandSet.java
SubCommandSet.printUsage
public void printUsage(OutputStream out, String name, boolean showHidden) { printUsage(new PrintWriter(new OutputStreamWriter(out, UTF_8)), name, showHidden); }
java
public void printUsage(OutputStream out, String name, boolean showHidden) { printUsage(new PrintWriter(new OutputStreamWriter(out, UTF_8)), name, showHidden); }
[ "public", "void", "printUsage", "(", "OutputStream", "out", ",", "String", "name", ",", "boolean", "showHidden", ")", "{", "printUsage", "(", "new", "PrintWriter", "(", "new", "OutputStreamWriter", "(", "out", ",", "UTF_8", ")", ")", ",", "name", ",", "sho...
Print the option usage list for the command. @param out The output stream. @param name The sub-command to print help for. @param showHidden If hidden sub-commands should be shown.
[ "Print", "the", "option", "usage", "list", "for", "the", "command", "." ]
train
https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/console-util/src/main/java/net/morimekta/console/args/SubCommandSet.java#L214-L216
zaproxy/zaproxy
src/org/zaproxy/zap/spider/filters/HttpPrefixFetchFilter.java
HttpPrefixFetchFilter.isDefaultHttpOrHttpsPort
private static boolean isDefaultHttpOrHttpsPort(String scheme, int port) { if (port == DEFAULT_HTTP_PORT && isHttp(scheme)) { return true; } if (port == DEFAULT_HTTPS_PORT && isHttps(scheme)) { return true; } return false; }
java
private static boolean isDefaultHttpOrHttpsPort(String scheme, int port) { if (port == DEFAULT_HTTP_PORT && isHttp(scheme)) { return true; } if (port == DEFAULT_HTTPS_PORT && isHttps(scheme)) { return true; } return false; }
[ "private", "static", "boolean", "isDefaultHttpOrHttpsPort", "(", "String", "scheme", ",", "int", "port", ")", "{", "if", "(", "port", "==", "DEFAULT_HTTP_PORT", "&&", "isHttp", "(", "scheme", ")", ")", "{", "return", "true", ";", "}", "if", "(", "port", ...
Tells whether or not the given {@code port} is the default for the given {@code scheme}. <p> The method returns always {@code false} for non HTTP or HTTPS schemes. @param scheme the scheme of a URI, might be {@code null} @param port the port of a URI @return {@code true} if the {@code port} is the default for the given {@code scheme}, {@code false} otherwise
[ "Tells", "whether", "or", "not", "the", "given", "{", "@code", "port", "}", "is", "the", "default", "for", "the", "given", "{", "@code", "scheme", "}", ".", "<p", ">", "The", "method", "returns", "always", "{", "@code", "false", "}", "for", "non", "H...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/spider/filters/HttpPrefixFetchFilter.java#L230-L238
craigwblake/redline
src/main/java/org/redline_rpm/Builder.java
Builder.addDependencyLess
public void addDependencyLess( final CharSequence name, final CharSequence version) { int flag = LESS | EQUAL; if (name.toString().startsWith("rpmlib(")){ flag = flag | RPMLIB; } addDependency( name, version, flag); }
java
public void addDependencyLess( final CharSequence name, final CharSequence version) { int flag = LESS | EQUAL; if (name.toString().startsWith("rpmlib(")){ flag = flag | RPMLIB; } addDependency( name, version, flag); }
[ "public", "void", "addDependencyLess", "(", "final", "CharSequence", "name", ",", "final", "CharSequence", "version", ")", "{", "int", "flag", "=", "LESS", "|", "EQUAL", ";", "if", "(", "name", ".", "toString", "(", ")", ".", "startsWith", "(", "\"rpmlib(\...
Adds a dependency to the RPM package. This dependency version will be marked as the maximum allowed, and the package will require the named dependency with this version or lower at install time. @param name the name of the dependency. @param version the version identifier.
[ "Adds", "a", "dependency", "to", "the", "RPM", "package", ".", "This", "dependency", "version", "will", "be", "marked", "as", "the", "maximum", "allowed", "and", "the", "package", "will", "require", "the", "named", "dependency", "with", "this", "version", "o...
train
https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L181-L187
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/MonetizationApi.java
MonetizationApi.getThePricingTiers
public DeviceTypePricingTiersEnvelope getThePricingTiers(String dtid, Integer version) throws ApiException { ApiResponse<DeviceTypePricingTiersEnvelope> resp = getThePricingTiersWithHttpInfo(dtid, version); return resp.getData(); }
java
public DeviceTypePricingTiersEnvelope getThePricingTiers(String dtid, Integer version) throws ApiException { ApiResponse<DeviceTypePricingTiersEnvelope> resp = getThePricingTiersWithHttpInfo(dtid, version); return resp.getData(); }
[ "public", "DeviceTypePricingTiersEnvelope", "getThePricingTiers", "(", "String", "dtid", ",", "Integer", "version", ")", "throws", "ApiException", "{", "ApiResponse", "<", "DeviceTypePricingTiersEnvelope", ">", "resp", "=", "getThePricingTiersWithHttpInfo", "(", "dtid", "...
Get devicetype&#39;s pricing tiers. Get devicetype&#39;s pricing tiers. @param dtid DeviceType ID (required) @param version Version (required) @return DeviceTypePricingTiersEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "devicetype&#39", ";", "s", "pricing", "tiers", ".", "Get", "devicetype&#39", ";", "s", "pricing", "tiers", "." ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/MonetizationApi.java#L387-L390
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/UpdateInstanceRequest.java
UpdateInstanceRequest.setAllLabels
@SuppressWarnings("WeakerAccess") public UpdateInstanceRequest setAllLabels(@Nonnull Map<String, String> labels) { Preconditions.checkNotNull(labels, "labels can't be null"); builder.getInstanceBuilder().clearLabels(); builder.getInstanceBuilder().putAllLabels(labels); updateFieldMask(Instance.LABELS_FIELD_NUMBER); return this; }
java
@SuppressWarnings("WeakerAccess") public UpdateInstanceRequest setAllLabels(@Nonnull Map<String, String> labels) { Preconditions.checkNotNull(labels, "labels can't be null"); builder.getInstanceBuilder().clearLabels(); builder.getInstanceBuilder().putAllLabels(labels); updateFieldMask(Instance.LABELS_FIELD_NUMBER); return this; }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "UpdateInstanceRequest", "setAllLabels", "(", "@", "Nonnull", "Map", "<", "String", ",", "String", ">", "labels", ")", "{", "Preconditions", ".", "checkNotNull", "(", "labels", ",", "\"labels can't b...
Replaces the labels associated with the instance. @see <a href="https://cloud.google.com/bigtable/docs/creating-managing-labels">For more details</a>
[ "Replaces", "the", "labels", "associated", "with", "the", "instance", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/UpdateInstanceRequest.java#L79-L87
minio/minio-java
api/src/main/java/io/minio/MinioClient.java
MinioClient.executePost
private HttpResponse executePost(String bucketName, String objectName, Map<String,String> headerMap, Map<String,String> queryParamMap, Object data) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException { return execute(Method.POST, getRegion(bucketName), bucketName, objectName, headerMap, queryParamMap, data, 0); }
java
private HttpResponse executePost(String bucketName, String objectName, Map<String,String> headerMap, Map<String,String> queryParamMap, Object data) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException { return execute(Method.POST, getRegion(bucketName), bucketName, objectName, headerMap, queryParamMap, data, 0); }
[ "private", "HttpResponse", "executePost", "(", "String", "bucketName", ",", "String", "objectName", ",", "Map", "<", "String", ",", "String", ">", "headerMap", ",", "Map", "<", "String", ",", "String", ">", "queryParamMap", ",", "Object", "data", ")", "throw...
Executes POST method for given request parameters. @param bucketName Bucket name. @param objectName Object name in the bucket. @param headerMap Map of HTTP headers for the request. @param queryParamMap Map of HTTP query parameters of the request. @param data HTTP request body data.
[ "Executes", "POST", "method", "for", "given", "request", "parameters", "." ]
train
https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L1363-L1369
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java
WriteFileExtensions.storeByteArrayToFile
public static void storeByteArrayToFile(final byte[] data, final File file) throws IOException { try (FileOutputStream fos = new FileOutputStream(file); BufferedOutputStream bos = new BufferedOutputStream(fos);) { bos.write(data); bos.flush(); } }
java
public static void storeByteArrayToFile(final byte[] data, final File file) throws IOException { try (FileOutputStream fos = new FileOutputStream(file); BufferedOutputStream bos = new BufferedOutputStream(fos);) { bos.write(data); bos.flush(); } }
[ "public", "static", "void", "storeByteArrayToFile", "(", "final", "byte", "[", "]", "data", ",", "final", "File", "file", ")", "throws", "IOException", "{", "try", "(", "FileOutputStream", "fos", "=", "new", "FileOutputStream", "(", "file", ")", ";", "Buffer...
Saves a byte array to the given file. @param data The byte array to be saved. @param file The file to save the byte array. @throws IOException Signals that an I/O exception has occurred.
[ "Saves", "a", "byte", "array", "to", "the", "given", "file", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java#L369-L377
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/WorkspacesApi.java
WorkspacesApi.getWorkspaceFile
public void getWorkspaceFile(String accountId, String workspaceId, String folderId, String fileId, WorkspacesApi.GetWorkspaceFileOptions options) throws ApiException { Object localVarPostBody = "{}"; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling getWorkspaceFile"); } // verify the required parameter 'workspaceId' is set if (workspaceId == null) { throw new ApiException(400, "Missing the required parameter 'workspaceId' when calling getWorkspaceFile"); } // verify the required parameter 'folderId' is set if (folderId == null) { throw new ApiException(400, "Missing the required parameter 'folderId' when calling getWorkspaceFile"); } // verify the required parameter 'fileId' is set if (fileId == null) { throw new ApiException(400, "Missing the required parameter 'fileId' when calling getWorkspaceFile"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/workspaces/{workspaceId}/folders/{folderId}/files/{fileId}".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())) .replaceAll("\\{" + "workspaceId" + "\\}", apiClient.escapeString(workspaceId.toString())) .replaceAll("\\{" + "folderId" + "\\}", apiClient.escapeString(folderId.toString())) .replaceAll("\\{" + "fileId" + "\\}", apiClient.escapeString(fileId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "is_download", options.isDownload)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "pdf_version", options.pdfVersion)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); }
java
public void getWorkspaceFile(String accountId, String workspaceId, String folderId, String fileId, WorkspacesApi.GetWorkspaceFileOptions options) throws ApiException { Object localVarPostBody = "{}"; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling getWorkspaceFile"); } // verify the required parameter 'workspaceId' is set if (workspaceId == null) { throw new ApiException(400, "Missing the required parameter 'workspaceId' when calling getWorkspaceFile"); } // verify the required parameter 'folderId' is set if (folderId == null) { throw new ApiException(400, "Missing the required parameter 'folderId' when calling getWorkspaceFile"); } // verify the required parameter 'fileId' is set if (fileId == null) { throw new ApiException(400, "Missing the required parameter 'fileId' when calling getWorkspaceFile"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/workspaces/{workspaceId}/folders/{folderId}/files/{fileId}".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())) .replaceAll("\\{" + "workspaceId" + "\\}", apiClient.escapeString(workspaceId.toString())) .replaceAll("\\{" + "folderId" + "\\}", apiClient.escapeString(folderId.toString())) .replaceAll("\\{" + "fileId" + "\\}", apiClient.escapeString(fileId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "is_download", options.isDownload)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "pdf_version", options.pdfVersion)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); }
[ "public", "void", "getWorkspaceFile", "(", "String", "accountId", ",", "String", "workspaceId", ",", "String", "folderId", ",", "String", "fileId", ",", "WorkspacesApi", ".", "GetWorkspaceFileOptions", "options", ")", "throws", "ApiException", "{", "Object", "localV...
Get Workspace File Retrieves a workspace file (the binary). @param accountId The external account number (int) or account ID Guid. (required) @param workspaceId Specifies the workspace ID GUID. (required) @param folderId The ID of the folder being accessed. (required) @param fileId Specifies the room file ID GUID. (required) @param options for modifying the method behavior. @throws ApiException if fails to make API call
[ "Get", "Workspace", "File", "Retrieves", "a", "workspace", "file", "(", "the", "binary", ")", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/WorkspacesApi.java#L350-L405
sirthias/parboiled
parboiled-core/src/main/java/org/parboiled/common/Utils.java
Utils.findConstructor
public static Constructor findConstructor(Class<?> type, Object[] args) { outer: for (Constructor constructor : type.getConstructors()) { Class<?>[] paramTypes = constructor.getParameterTypes(); if (paramTypes.length != args.length) continue; for (int i = 0; i < args.length; i++) { Object arg = args[i]; if (arg != null && !paramTypes[i].isAssignableFrom(arg.getClass()) && !isBoxedType(paramTypes[i], arg.getClass())) continue outer; if (arg == null && paramTypes[i].isPrimitive()) continue outer; } return constructor; } throw new GrammarException("No constructor found for %s and the given %s arguments", type, args.length); }
java
public static Constructor findConstructor(Class<?> type, Object[] args) { outer: for (Constructor constructor : type.getConstructors()) { Class<?>[] paramTypes = constructor.getParameterTypes(); if (paramTypes.length != args.length) continue; for (int i = 0; i < args.length; i++) { Object arg = args[i]; if (arg != null && !paramTypes[i].isAssignableFrom(arg.getClass()) && !isBoxedType(paramTypes[i], arg.getClass())) continue outer; if (arg == null && paramTypes[i].isPrimitive()) continue outer; } return constructor; } throw new GrammarException("No constructor found for %s and the given %s arguments", type, args.length); }
[ "public", "static", "Constructor", "findConstructor", "(", "Class", "<", "?", ">", "type", ",", "Object", "[", "]", "args", ")", "{", "outer", ":", "for", "(", "Constructor", "constructor", ":", "type", ".", "getConstructors", "(", ")", ")", "{", "Class"...
Finds the constructor of the given class that is compatible with the given arguments. @param type the class to find the constructor of @param args the arguments @return the constructor
[ "Finds", "the", "constructor", "of", "the", "given", "class", "that", "is", "compatible", "with", "the", "given", "arguments", "." ]
train
https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/common/Utils.java#L301-L314
wcm-io/wcm-io-handler
media/src/main/java/io/wcm/handler/mediasource/dam/AssetRendition.java
AssetRendition.getDimensionFromRenditionMetadata
private static @Nullable Dimension getDimensionFromRenditionMetadata(@NotNull Rendition rendition) { Asset asset = rendition.getAsset(); String metadataPath = JCR_CONTENT + "/" + NN_RENDITIONS_METADATA + "/" + rendition.getName(); Resource metadataResource = AdaptTo.notNull(asset, Resource.class).getChild(metadataPath); if (metadataResource != null) { ValueMap props = metadataResource.getValueMap(); long width = props.get(PN_IMAGE_WIDTH, 0L); long height = props.get(PN_IMAGE_HEIGHT, 0L); return toDimension(width, height); } return null; }
java
private static @Nullable Dimension getDimensionFromRenditionMetadata(@NotNull Rendition rendition) { Asset asset = rendition.getAsset(); String metadataPath = JCR_CONTENT + "/" + NN_RENDITIONS_METADATA + "/" + rendition.getName(); Resource metadataResource = AdaptTo.notNull(asset, Resource.class).getChild(metadataPath); if (metadataResource != null) { ValueMap props = metadataResource.getValueMap(); long width = props.get(PN_IMAGE_WIDTH, 0L); long height = props.get(PN_IMAGE_HEIGHT, 0L); return toDimension(width, height); } return null; }
[ "private", "static", "@", "Nullable", "Dimension", "getDimensionFromRenditionMetadata", "(", "@", "NotNull", "Rendition", "rendition", ")", "{", "Asset", "asset", "=", "rendition", ".", "getAsset", "(", ")", ";", "String", "metadataPath", "=", "JCR_CONTENT", "+", ...
Read dimension for non-original rendition from renditions metadata generated by "DamRenditionMetadataService". @param rendition Rendition @return Dimension or null
[ "Read", "dimension", "for", "non", "-", "original", "rendition", "from", "renditions", "metadata", "generated", "by", "DamRenditionMetadataService", "." ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/dam/AssetRendition.java#L158-L169
assertthat/selenium-shutterbug
src/main/java/com/assertthat/selenium_shutterbug/core/Shutterbug.java
Shutterbug.shootElement
public static ElementSnapshot shootElement(WebDriver driver, WebElement element) { return shootElement(driver,element,false); }
java
public static ElementSnapshot shootElement(WebDriver driver, WebElement element) { return shootElement(driver,element,false); }
[ "public", "static", "ElementSnapshot", "shootElement", "(", "WebDriver", "driver", ",", "WebElement", "element", ")", "{", "return", "shootElement", "(", "driver", ",", "element", ",", "false", ")", ";", "}" ]
To be used when need to screenshot particular element. @param driver WebDriver instance @param element WebElement instance to be screenshotted @return ElementSnapshot instance
[ "To", "be", "used", "when", "need", "to", "screenshot", "particular", "element", "." ]
train
https://github.com/assertthat/selenium-shutterbug/blob/770d9b92423200d262c9ab70e40405921d81e262/src/main/java/com/assertthat/selenium_shutterbug/core/Shutterbug.java#L123-L125
apache/incubator-heron
heron/uploaders/src/java/org/apache/heron/uploader/s3/S3Uploader.java
S3Uploader.generateS3Path
private String generateS3Path(String pathPrefixParent, String topologyName, String filename) { List<String> pathParts = new ArrayList<>(Arrays.asList(pathPrefixParent.split("/"))); pathParts.add(topologyName); pathParts.add(filename); return String.join("/", pathParts); }
java
private String generateS3Path(String pathPrefixParent, String topologyName, String filename) { List<String> pathParts = new ArrayList<>(Arrays.asList(pathPrefixParent.split("/"))); pathParts.add(topologyName); pathParts.add(filename); return String.join("/", pathParts); }
[ "private", "String", "generateS3Path", "(", "String", "pathPrefixParent", ",", "String", "topologyName", ",", "String", "filename", ")", "{", "List", "<", "String", ">", "pathParts", "=", "new", "ArrayList", "<>", "(", "Arrays", ".", "asList", "(", "pathPrefix...
Generate the path to a file in s3 given a prefix, topologyName, and filename @param pathPrefixParent designates any parent folders that should be prefixed to the resulting path @param topologyName the name of the topology that we are uploaded @param filename the name of the resulting file that is going to be uploaded @return the full path of the package under the bucket. The bucket is not included in this path as it is a separate argument that is passed to the putObject call in the s3 sdk.
[ "Generate", "the", "path", "to", "a", "file", "in", "s3", "given", "a", "prefix", "topologyName", "and", "filename" ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/uploaders/src/java/org/apache/heron/uploader/s3/S3Uploader.java#L217-L223
sualeh/magnetictrackparser
src/main/java/us/fatehi/magnetictrack/bankcard/Track2.java
Track2.from
public static Track2 from(final String rawTrackData) { final Matcher matcher = track2Pattern.matcher(trimToEmpty(rawTrackData)); final String rawTrack2Data; final AccountNumber pan; final ExpirationDate expirationDate; final ServiceCode serviceCode; final String discretionaryData; if (matcher.matches()) { rawTrack2Data = getGroup(matcher, 1); pan = new AccountNumber(getGroup(matcher, 2)); expirationDate = new ExpirationDate(getGroup(matcher, 3)); serviceCode = new ServiceCode(getGroup(matcher, 4)); discretionaryData = getGroup(matcher, 5); } else { rawTrack2Data = null; pan = new AccountNumber(); expirationDate = new ExpirationDate(); serviceCode = new ServiceCode(); discretionaryData = ""; } return new Track2(rawTrack2Data, pan, expirationDate, serviceCode, discretionaryData); }
java
public static Track2 from(final String rawTrackData) { final Matcher matcher = track2Pattern.matcher(trimToEmpty(rawTrackData)); final String rawTrack2Data; final AccountNumber pan; final ExpirationDate expirationDate; final ServiceCode serviceCode; final String discretionaryData; if (matcher.matches()) { rawTrack2Data = getGroup(matcher, 1); pan = new AccountNumber(getGroup(matcher, 2)); expirationDate = new ExpirationDate(getGroup(matcher, 3)); serviceCode = new ServiceCode(getGroup(matcher, 4)); discretionaryData = getGroup(matcher, 5); } else { rawTrack2Data = null; pan = new AccountNumber(); expirationDate = new ExpirationDate(); serviceCode = new ServiceCode(); discretionaryData = ""; } return new Track2(rawTrack2Data, pan, expirationDate, serviceCode, discretionaryData); }
[ "public", "static", "Track2", "from", "(", "final", "String", "rawTrackData", ")", "{", "final", "Matcher", "matcher", "=", "track2Pattern", ".", "matcher", "(", "trimToEmpty", "(", "rawTrackData", ")", ")", ";", "final", "String", "rawTrack2Data", ";", "final...
Parses magnetic track 2 data into a Track2 object. @param rawTrackData Raw track data as a string. Can include newlines, and other tracks as well. @return A Track2 instance, corresponding to the parsed data.
[ "Parses", "magnetic", "track", "2", "data", "into", "a", "Track2", "object", "." ]
train
https://github.com/sualeh/magnetictrackparser/blob/1da8ff20ac6269b1d523875157278978ba71d260/src/main/java/us/fatehi/magnetictrack/bankcard/Track2.java#L72-L104
upwork/java-upwork
src/com/Upwork/api/Routers/Messages.java
Messages.getRoomByApplication
public JSONObject getRoomByApplication(String company, String applicationId, HashMap<String, String> params) throws JSONException { return oClient.get("/messages/v3/" + company + "/rooms/appications/" + applicationId, params); }
java
public JSONObject getRoomByApplication(String company, String applicationId, HashMap<String, String> params) throws JSONException { return oClient.get("/messages/v3/" + company + "/rooms/appications/" + applicationId, params); }
[ "public", "JSONObject", "getRoomByApplication", "(", "String", "company", ",", "String", "applicationId", ",", "HashMap", "<", "String", ",", "String", ">", "params", ")", "throws", "JSONException", "{", "return", "oClient", ".", "get", "(", "\"/messages/v3/\"", ...
Get a specific room by application ID @param company Company ID @param applicationId Application ID @param params Parameters @throws JSONException If error occurred @return {@link JSONObject}
[ "Get", "a", "specific", "room", "by", "application", "ID" ]
train
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Messages.java#L88-L90
dropbox/dropbox-sdk-java
src/main/java/com/dropbox/core/DbxWebAuth.java
DbxWebAuth.finishFromCode
public DbxAuthFinish finishFromCode(String code, String redirectUri) throws DbxException { return finish(code, redirectUri, null); }
java
public DbxAuthFinish finishFromCode(String code, String redirectUri) throws DbxException { return finish(code, redirectUri, null); }
[ "public", "DbxAuthFinish", "finishFromCode", "(", "String", "code", ",", "String", "redirectUri", ")", "throws", "DbxException", "{", "return", "finish", "(", "code", ",", "redirectUri", ",", "null", ")", ";", "}" ]
Call this after the user has visited the authorizaton URL with a redirectUrl and copy/pasted the authorization code that Dropbox gave them. @param code The authorization code shown to the user when they clicked "Allow" on the authorization, page on the Dropbox website, never {@code null}. @param redirectUri The original redirect URI used by {@link #authorize}, never {@code null}. @throws DbxException if an error occurs communicating with Dropbox.
[ "Call", "this", "after", "the", "user", "has", "visited", "the", "authorizaton", "URL", "with", "a", "redirectUrl", "and", "copy", "/", "pasted", "the", "authorization", "code", "that", "Dropbox", "gave", "them", "." ]
train
https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/DbxWebAuth.java#L325-L327
XiaoMi/chronos
chronos-client/src/main/java/com/xiaomi/infra/chronos/client/ChronosClientWatcher.java
ChronosClientWatcher.getTimestamps
public long getTimestamps(int range) throws IOException { long timestamp; try { timestamp = client.getTimestamps(range); } catch (TException e) { LOG.info("Can't get timestamp, try to connect the active chronos server"); try { reconnectChronosServer(); return client.getTimestamps(range); } catch (Exception e1) { LOG.info("Can't connect chronos server, try to connect ZooKeeper firstly"); try { reconnectZooKeeper(); reconnectChronosServer(); return client.getTimestamps(range); } catch (Exception e2) { throw new IOException("Error to get timestamp after reconnecting ZooKeeper and chronos server", e2); } } } return timestamp; }
java
public long getTimestamps(int range) throws IOException { long timestamp; try { timestamp = client.getTimestamps(range); } catch (TException e) { LOG.info("Can't get timestamp, try to connect the active chronos server"); try { reconnectChronosServer(); return client.getTimestamps(range); } catch (Exception e1) { LOG.info("Can't connect chronos server, try to connect ZooKeeper firstly"); try { reconnectZooKeeper(); reconnectChronosServer(); return client.getTimestamps(range); } catch (Exception e2) { throw new IOException("Error to get timestamp after reconnecting ZooKeeper and chronos server", e2); } } } return timestamp; }
[ "public", "long", "getTimestamps", "(", "int", "range", ")", "throws", "IOException", "{", "long", "timestamp", ";", "try", "{", "timestamp", "=", "client", ".", "getTimestamps", "(", "range", ")", ";", "}", "catch", "(", "TException", "e", ")", "{", "LO...
Send RPC request to get timestamp from ChronosServer. Use lazy strategy to detect failure. If request fails, reconnect ChronosServer. If request fails again, reconnect ZooKeeper. @param range the number of timestamps @return the first timestamp to use @throws IOException when error to connect ChronosServer or ZooKeeper
[ "Send", "RPC", "request", "to", "get", "timestamp", "from", "ChronosServer", ".", "Use", "lazy", "strategy", "to", "detect", "failure", ".", "If", "request", "fails", "reconnect", "ChronosServer", ".", "If", "request", "fails", "again", "reconnect", "ZooKeeper",...
train
https://github.com/XiaoMi/chronos/blob/92e4a30c98947e87aba47ea88c944a56505a4ec0/chronos-client/src/main/java/com/xiaomi/infra/chronos/client/ChronosClientWatcher.java#L140-L161
tvesalainen/util
util/src/main/java/org/vesalainen/util/CharSequences.java
CharSequences.endsWith
public static boolean endsWith(CharSequence seq, CharSequence pattern) { return endsWith(seq, pattern, Funcs::same); }
java
public static boolean endsWith(CharSequence seq, CharSequence pattern) { return endsWith(seq, pattern, Funcs::same); }
[ "public", "static", "boolean", "endsWith", "(", "CharSequence", "seq", ",", "CharSequence", "pattern", ")", "{", "return", "endsWith", "(", "seq", ",", "pattern", ",", "Funcs", "::", "same", ")", ";", "}" ]
Return true if seq end match pattern exactly. @param seq @param pattern @return
[ "Return", "true", "if", "seq", "end", "match", "pattern", "exactly", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/CharSequences.java#L103-L106
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/model/LatLong.java
LatLong.fromString
public static LatLong fromString(String latLonString) { String[] split = latLonString.split("[,;:\\s]"); if (split.length != 2) throw new IllegalArgumentException("cannot read coordinate, not a valid format"); double latitude = Double.parseDouble(split[0]); double longitude = Double.parseDouble(split[1]); return new LatLong(latitude, longitude); }
java
public static LatLong fromString(String latLonString) { String[] split = latLonString.split("[,;:\\s]"); if (split.length != 2) throw new IllegalArgumentException("cannot read coordinate, not a valid format"); double latitude = Double.parseDouble(split[0]); double longitude = Double.parseDouble(split[1]); return new LatLong(latitude, longitude); }
[ "public", "static", "LatLong", "fromString", "(", "String", "latLonString", ")", "{", "String", "[", "]", "split", "=", "latLonString", ".", "split", "(", "\"[,;:\\\\s]\"", ")", ";", "if", "(", "split", ".", "length", "!=", "2", ")", "throw", "new", "Ill...
Constructs a new LatLong from a comma-separated String containing latitude and longitude values (also ';', ':' and whitespace work as separator). Latitude and longitude are interpreted as measured in degrees. @param latLonString the String containing the latitude and longitude values @return the LatLong @throws IllegalArgumentException if the latLonString could not be interpreted as a coordinate
[ "Constructs", "a", "new", "LatLong", "from", "a", "comma", "-", "separated", "String", "containing", "latitude", "and", "longitude", "values", "(", "also", ";", ":", "and", "whitespace", "work", "as", "separator", ")", ".", "Latitude", "and", "longitude", "a...
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/model/LatLong.java#L150-L157
alibaba/ARouter
arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java
Postcard.withChar
public Postcard withChar(@Nullable String key, char value) { mBundle.putChar(key, value); return this; }
java
public Postcard withChar(@Nullable String key, char value) { mBundle.putChar(key, value); return this; }
[ "public", "Postcard", "withChar", "(", "@", "Nullable", "String", "key", ",", "char", "value", ")", "{", "mBundle", ".", "putChar", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts a char value into the mapping of this Bundle, replacing any existing value for the given key. @param key a String, or null @param value a char @return current
[ "Inserts", "a", "char", "value", "into", "the", "mapping", "of", "this", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", "." ]
train
https://github.com/alibaba/ARouter/blob/1a06912a6e14a57112db1204b43f81c43d721732/arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java#L335-L338
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java
DateUtil.betweenYear
public static long betweenYear(Date beginDate, Date endDate, boolean isReset) { return new DateBetween(beginDate, endDate).betweenYear(isReset); }
java
public static long betweenYear(Date beginDate, Date endDate, boolean isReset) { return new DateBetween(beginDate, endDate).betweenYear(isReset); }
[ "public", "static", "long", "betweenYear", "(", "Date", "beginDate", ",", "Date", "endDate", ",", "boolean", "isReset", ")", "{", "return", "new", "DateBetween", "(", "beginDate", ",", "endDate", ")", ".", "betweenYear", "(", "isReset", ")", ";", "}" ]
计算两个日期相差年数<br> 在非重置情况下,如果起始日期的月小于结束日期的月,年数要少算1(不足1年) @param beginDate 起始日期 @param endDate 结束日期 @param isReset 是否重置时间为起始时间(重置月天时分秒) @return 相差年数 @since 3.0.8
[ "计算两个日期相差年数<br", ">", "在非重置情况下,如果起始日期的月小于结束日期的月,年数要少算1(不足1年)" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L1306-L1308
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/servlet/RendererRequestUtils.java
RendererRequestUtils.isRequestGzippable
public static boolean isRequestGzippable(HttpServletRequest req, JawrConfig jawrConfig) { boolean rets; // If gzip is completely off, return false. if (!jawrConfig.isGzipResourcesModeOn()) rets = false; else if (req.getHeader("Accept-Encoding") != null && req.getHeader("Accept-Encoding").contains("gzip")) { // If gzip for IE6 or less is off, the user agent is checked to // avoid compression. if (!jawrConfig.isGzipResourcesForIESixOn() && isIE6orLess(req)) { rets = false; if (LOGGER.isDebugEnabled()) { LOGGER.debug("Gzip enablement for IE executed, with result:" + rets); } } else rets = true; } else rets = false; return rets; }
java
public static boolean isRequestGzippable(HttpServletRequest req, JawrConfig jawrConfig) { boolean rets; // If gzip is completely off, return false. if (!jawrConfig.isGzipResourcesModeOn()) rets = false; else if (req.getHeader("Accept-Encoding") != null && req.getHeader("Accept-Encoding").contains("gzip")) { // If gzip for IE6 or less is off, the user agent is checked to // avoid compression. if (!jawrConfig.isGzipResourcesForIESixOn() && isIE6orLess(req)) { rets = false; if (LOGGER.isDebugEnabled()) { LOGGER.debug("Gzip enablement for IE executed, with result:" + rets); } } else rets = true; } else rets = false; return rets; }
[ "public", "static", "boolean", "isRequestGzippable", "(", "HttpServletRequest", "req", ",", "JawrConfig", "jawrConfig", ")", "{", "boolean", "rets", ";", "// If gzip is completely off, return false.", "if", "(", "!", "jawrConfig", ".", "isGzipResourcesModeOn", "(", ")",...
Determines whether gzip is suitable for the current request given the current config. @param req @param jawrConfig @return
[ "Determines", "whether", "gzip", "is", "suitable", "for", "the", "current", "request", "given", "the", "current", "config", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/servlet/RendererRequestUtils.java#L157-L176
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/content/CmsPropertyDelete.java
CmsPropertyDelete.buildResourceList
public String buildResourceList() throws CmsException { List resourcesWithProperty = getCms().readResourcesWithProperty(getParamPropertyName()); return buildResourceList(resourcesWithProperty, false); }
java
public String buildResourceList() throws CmsException { List resourcesWithProperty = getCms().readResourcesWithProperty(getParamPropertyName()); return buildResourceList(resourcesWithProperty, false); }
[ "public", "String", "buildResourceList", "(", ")", "throws", "CmsException", "{", "List", "resourcesWithProperty", "=", "getCms", "(", ")", ".", "readResourcesWithProperty", "(", "getParamPropertyName", "(", ")", ")", ";", "return", "buildResourceList", "(", "resour...
Builds a HTML list of Resources that use the specified property.<p> @throws CmsException if operation was not successful @return the HTML String for the Resource list
[ "Builds", "a", "HTML", "list", "of", "Resources", "that", "use", "the", "specified", "property", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/content/CmsPropertyDelete.java#L192-L197
gitblit/fathom
fathom-x509/src/main/java/fathom/x509/X509Utils.java
X509Utils.verifyChain
public static PKIXCertPathBuilderResult verifyChain(X509Certificate testCert, X509Certificate... additionalCerts) { try { // Check for self-signed certificate if (isSelfSigned(testCert)) { throw new RuntimeException("The certificate is self-signed. Nothing to verify."); } // Prepare a set of all certificates // chain builder must have all certs, including cert to validate // http://stackoverflow.com/a/10788392 Set<X509Certificate> certs = new HashSet<X509Certificate>(); certs.add(testCert); certs.addAll(Arrays.asList(additionalCerts)); // Attempt to build the certification chain and verify it // Create the selector that specifies the starting certificate X509CertSelector selector = new X509CertSelector(); selector.setCertificate(testCert); // Create the trust anchors (set of root CA certificates) Set<TrustAnchor> trustAnchors = new HashSet<TrustAnchor>(); for (X509Certificate cert : additionalCerts) { if (isSelfSigned(cert)) { trustAnchors.add(new TrustAnchor(cert, null)); } } // Configure the PKIX certificate builder PKIXBuilderParameters pkixParams = new PKIXBuilderParameters(trustAnchors, selector); pkixParams.setRevocationEnabled(false); pkixParams.addCertStore(CertStore.getInstance("Collection", new CollectionCertStoreParameters(certs), BC)); // Build and verify the certification chain CertPathBuilder builder = CertPathBuilder.getInstance("PKIX", BC); PKIXCertPathBuilderResult verifiedCertChain = (PKIXCertPathBuilderResult) builder.build(pkixParams); // The chain is built and verified return verifiedCertChain; } catch (CertPathBuilderException e) { throw new RuntimeException("Error building certification path: " + testCert.getSubjectX500Principal(), e); } catch (Exception e) { throw new RuntimeException("Error verifying the certificate: " + testCert.getSubjectX500Principal(), e); } }
java
public static PKIXCertPathBuilderResult verifyChain(X509Certificate testCert, X509Certificate... additionalCerts) { try { // Check for self-signed certificate if (isSelfSigned(testCert)) { throw new RuntimeException("The certificate is self-signed. Nothing to verify."); } // Prepare a set of all certificates // chain builder must have all certs, including cert to validate // http://stackoverflow.com/a/10788392 Set<X509Certificate> certs = new HashSet<X509Certificate>(); certs.add(testCert); certs.addAll(Arrays.asList(additionalCerts)); // Attempt to build the certification chain and verify it // Create the selector that specifies the starting certificate X509CertSelector selector = new X509CertSelector(); selector.setCertificate(testCert); // Create the trust anchors (set of root CA certificates) Set<TrustAnchor> trustAnchors = new HashSet<TrustAnchor>(); for (X509Certificate cert : additionalCerts) { if (isSelfSigned(cert)) { trustAnchors.add(new TrustAnchor(cert, null)); } } // Configure the PKIX certificate builder PKIXBuilderParameters pkixParams = new PKIXBuilderParameters(trustAnchors, selector); pkixParams.setRevocationEnabled(false); pkixParams.addCertStore(CertStore.getInstance("Collection", new CollectionCertStoreParameters(certs), BC)); // Build and verify the certification chain CertPathBuilder builder = CertPathBuilder.getInstance("PKIX", BC); PKIXCertPathBuilderResult verifiedCertChain = (PKIXCertPathBuilderResult) builder.build(pkixParams); // The chain is built and verified return verifiedCertChain; } catch (CertPathBuilderException e) { throw new RuntimeException("Error building certification path: " + testCert.getSubjectX500Principal(), e); } catch (Exception e) { throw new RuntimeException("Error verifying the certificate: " + testCert.getSubjectX500Principal(), e); } }
[ "public", "static", "PKIXCertPathBuilderResult", "verifyChain", "(", "X509Certificate", "testCert", ",", "X509Certificate", "...", "additionalCerts", ")", "{", "try", "{", "// Check for self-signed certificate", "if", "(", "isSelfSigned", "(", "testCert", ")", ")", "{",...
Verifies a certificate's chain to ensure that it will function properly. @param testCert @param additionalCerts @return
[ "Verifies", "a", "certificate", "s", "chain", "to", "ensure", "that", "it", "will", "function", "properly", "." ]
train
https://github.com/gitblit/fathom/blob/f2f820eb16e9fea1e36ad4eda4ed51b35f056538/fathom-x509/src/main/java/fathom/x509/X509Utils.java#L832-L875
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JavaSrcTextBuffer.java
JavaSrcTextBuffer.printf
public JavaSrcTextBuffer printf(final String text, final Object... args) { this.buffer.append(String.format(text, args)); return this; }
java
public JavaSrcTextBuffer printf(final String text, final Object... args) { this.buffer.append(String.format(text, args)); return this; }
[ "public", "JavaSrcTextBuffer", "printf", "(", "final", "String", "text", ",", "final", "Object", "...", "args", ")", "{", "this", ".", "buffer", ".", "append", "(", "String", ".", "format", "(", "text", ",", "args", ")", ")", ";", "return", "this", ";"...
Formatted print. @param text format string @param args arguments for formatted string @return this instance @see String#format(String, Object...)
[ "Formatted", "print", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JavaSrcTextBuffer.java#L98-L101
JavaMoney/jsr354-ri-bp
src/main/java/org/javamoney/moneta/spi/base/BaseMonetaryCurrenciesSingletonSpi.java
BaseMonetaryCurrenciesSingletonSpi.getCurrency
public CurrencyUnit getCurrency(Locale country, String... providers) { Collection<CurrencyUnit> found = getCurrencies(CurrencyQueryBuilder.of().setCountries(country).setProviderNames(providers).build()); if (found.isEmpty()) { throw new MonetaryException("No currency unit found for locale: " + country); } if (found.size() > 1) { throw new MonetaryException("Ambiguous CurrencyUnit for locale: " + country + ": " + found); } return found.iterator().next(); }
java
public CurrencyUnit getCurrency(Locale country, String... providers) { Collection<CurrencyUnit> found = getCurrencies(CurrencyQueryBuilder.of().setCountries(country).setProviderNames(providers).build()); if (found.isEmpty()) { throw new MonetaryException("No currency unit found for locale: " + country); } if (found.size() > 1) { throw new MonetaryException("Ambiguous CurrencyUnit for locale: " + country + ": " + found); } return found.iterator().next(); }
[ "public", "CurrencyUnit", "getCurrency", "(", "Locale", "country", ",", "String", "...", "providers", ")", "{", "Collection", "<", "CurrencyUnit", ">", "found", "=", "getCurrencies", "(", "CurrencyQueryBuilder", ".", "of", "(", ")", ".", "setCountries", "(", "...
Access a new instance based on the currency code. Currencies are available as provided by {@link javax.money.spi.CurrencyProviderSpi} instances registered with the {@link javax.money.spi.Bootstrap}. @param country the ISO currency's country, not {@code null}. @param providers the (optional) specification of providers to consider. If not set (empty) the providers as defined by #getDefaultRoundingProviderChain() should be used. @return the corresponding {@link javax.money.CurrencyUnit} instance. @throws javax.money.UnknownCurrencyException if no such currency exists.
[ "Access", "a", "new", "instance", "based", "on", "the", "currency", "code", ".", "Currencies", "are", "available", "as", "provided", "by", "{", "@link", "javax", ".", "money", ".", "spi", ".", "CurrencyProviderSpi", "}", "instances", "registered", "with", "t...
train
https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/spi/base/BaseMonetaryCurrenciesSingletonSpi.java#L72-L82
classgraph/classgraph
src/main/java/nonapi/io/github/classgraph/utils/LogNode.java
LogNode.addChild
private LogNode addChild(final String sortKey, final String msg, final long elapsedTimeNanos, final Throwable exception) { final String newSortKey = sortKeyPrefix + "\t" + (sortKey == null ? "" : sortKey) + "\t" + String.format("%09d", sortKeyUniqueSuffix.getAndIncrement()); final LogNode newChild = new LogNode(newSortKey, msg, elapsedTimeNanos, exception); newChild.parent = this; // Make the sort key unique, so that log entries are not clobbered if keys are reused; increment unique // suffix with each new log entry, so that ties are broken in chronological order. children.put(newSortKey, newChild); return newChild; }
java
private LogNode addChild(final String sortKey, final String msg, final long elapsedTimeNanos, final Throwable exception) { final String newSortKey = sortKeyPrefix + "\t" + (sortKey == null ? "" : sortKey) + "\t" + String.format("%09d", sortKeyUniqueSuffix.getAndIncrement()); final LogNode newChild = new LogNode(newSortKey, msg, elapsedTimeNanos, exception); newChild.parent = this; // Make the sort key unique, so that log entries are not clobbered if keys are reused; increment unique // suffix with each new log entry, so that ties are broken in chronological order. children.put(newSortKey, newChild); return newChild; }
[ "private", "LogNode", "addChild", "(", "final", "String", "sortKey", ",", "final", "String", "msg", ",", "final", "long", "elapsedTimeNanos", ",", "final", "Throwable", "exception", ")", "{", "final", "String", "newSortKey", "=", "sortKeyPrefix", "+", "\"\\t\"",...
Add a child log node. @param sortKey the sort key @param msg the log message @param elapsedTimeNanos the elapsed time in nanos @param exception the exception that was thrown @return the log node
[ "Add", "a", "child", "log", "node", "." ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/utils/LogNode.java#L261-L271
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/preview/util/CmsRectangle.java
CmsRectangle.fromPoints
public static CmsRectangle fromPoints(CmsPoint topLeft, CmsPoint bottomRight) { CmsRectangle result = new CmsRectangle(); result.m_left = topLeft.getX(); result.m_top = topLeft.getY(); result.m_width = bottomRight.getX() - topLeft.getX(); result.m_height = bottomRight.getY() - topLeft.getY(); return result; }
java
public static CmsRectangle fromPoints(CmsPoint topLeft, CmsPoint bottomRight) { CmsRectangle result = new CmsRectangle(); result.m_left = topLeft.getX(); result.m_top = topLeft.getY(); result.m_width = bottomRight.getX() - topLeft.getX(); result.m_height = bottomRight.getY() - topLeft.getY(); return result; }
[ "public", "static", "CmsRectangle", "fromPoints", "(", "CmsPoint", "topLeft", ",", "CmsPoint", "bottomRight", ")", "{", "CmsRectangle", "result", "=", "new", "CmsRectangle", "(", ")", ";", "result", ".", "m_left", "=", "topLeft", ".", "getX", "(", ")", ";", ...
Creates a new rectangle from its top left and bottom right corner points.<p> @param topLeft the top left corner @param bottomRight the bottom right corner @return the new rectangle
[ "Creates", "a", "new", "rectangle", "from", "its", "top", "left", "and", "bottom", "right", "corner", "points", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/util/CmsRectangle.java#L83-L91
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/locale/message/BundleStringJsonifier.java
BundleStringJsonifier.addValuedKey
private void addValuedKey(final StringBuffer sb, String key, String fullKey) { sb.append(getJsonKey(key)).append(":").append(FUNC) .append(JavascriptStringUtil.quote(bundleValues.get(fullKey).toString())); }
java
private void addValuedKey(final StringBuffer sb, String key, String fullKey) { sb.append(getJsonKey(key)).append(":").append(FUNC) .append(JavascriptStringUtil.quote(bundleValues.get(fullKey).toString())); }
[ "private", "void", "addValuedKey", "(", "final", "StringBuffer", "sb", ",", "String", "key", ",", "String", "fullKey", ")", "{", "sb", ".", "append", "(", "getJsonKey", "(", "key", ")", ")", ".", "append", "(", "\":\"", ")", ".", "append", "(", "FUNC",...
Add a key and its value to the object literal. @param sb @param key @param fullKey
[ "Add", "a", "key", "and", "its", "value", "to", "the", "object", "literal", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/locale/message/BundleStringJsonifier.java#L179-L183
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/SSOAuthenticator.java
SSOAuthenticator.handleJwtSSO
private AuthenticationResult handleJwtSSO(HttpServletRequest req, HttpServletResponse res) { String jwtCookieName = JwtSSOTokenHelper.getJwtCookieName(); if (jwtCookieName == null) { // jwtsso feature not active return null; } String encodedjwtssotoken = ssoCookieHelper.getJwtSsoTokenFromCookies(req, jwtCookieName); if (encodedjwtssotoken == null) { //jwt sso cookie is missing, look at the auth header encodedjwtssotoken = getJwtBearerToken(req); } if (encodedjwtssotoken == null) { return null; } else { if (LoggedOutJwtSsoCookieCache.contains(encodedjwtssotoken)) { String LoggedOutMsg = "JWT_ALREADY_LOGGED_OUT"; if (req.getAttribute(LoggedOutMsg) == null) { Tr.audit(tc, LoggedOutMsg, new Object[] {}); req.setAttribute(LoggedOutMsg, "true"); } return new AuthenticationResult(AuthResult.FAILURE, Tr.formatMessage(tc, LoggedOutMsg)); } return authenticateWithJwt(req, res, encodedjwtssotoken); } }
java
private AuthenticationResult handleJwtSSO(HttpServletRequest req, HttpServletResponse res) { String jwtCookieName = JwtSSOTokenHelper.getJwtCookieName(); if (jwtCookieName == null) { // jwtsso feature not active return null; } String encodedjwtssotoken = ssoCookieHelper.getJwtSsoTokenFromCookies(req, jwtCookieName); if (encodedjwtssotoken == null) { //jwt sso cookie is missing, look at the auth header encodedjwtssotoken = getJwtBearerToken(req); } if (encodedjwtssotoken == null) { return null; } else { if (LoggedOutJwtSsoCookieCache.contains(encodedjwtssotoken)) { String LoggedOutMsg = "JWT_ALREADY_LOGGED_OUT"; if (req.getAttribute(LoggedOutMsg) == null) { Tr.audit(tc, LoggedOutMsg, new Object[] {}); req.setAttribute(LoggedOutMsg, "true"); } return new AuthenticationResult(AuthResult.FAILURE, Tr.formatMessage(tc, LoggedOutMsg)); } return authenticateWithJwt(req, res, encodedjwtssotoken); } }
[ "private", "AuthenticationResult", "handleJwtSSO", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ")", "{", "String", "jwtCookieName", "=", "JwtSSOTokenHelper", ".", "getJwtCookieName", "(", ")", ";", "if", "(", "jwtCookieName", "==", "null", "...
If there is no jwtSSOToken, we will return null. Otherwise, we will AuthenticationResult. @param cookies @return
[ "If", "there", "is", "no", "jwtSSOToken", "we", "will", "return", "null", ".", "Otherwise", "we", "will", "AuthenticationResult", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/SSOAuthenticator.java#L168-L193
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/ChangedByHandler.java
ChangedByHandler.init
public void init(BaseField field, String iMainFilesField) { super.init(field); m_iMainFilesFieldSeq = iMainFilesField; m_bReadMove = false; // Don't move on read! }
java
public void init(BaseField field, String iMainFilesField) { super.init(field); m_iMainFilesFieldSeq = iMainFilesField; m_bReadMove = false; // Don't move on read! }
[ "public", "void", "init", "(", "BaseField", "field", ",", "String", "iMainFilesField", ")", "{", "super", ".", "init", "(", "field", ")", ";", "m_iMainFilesFieldSeq", "=", "iMainFilesField", ";", "m_bReadMove", "=", "false", ";", "// Don't move on read!", "}" ]
Constructor. @param field The basefield owner of this listener (usually null and set on setOwner()). param iMainFilesField The field sequence of the "changed by" field in this field's record.
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/ChangedByHandler.java#L53-L58
baratine/baratine
core/src/main/java/com/caucho/v5/loader/EnvLoader.java
EnvLoader.setAttribute
public static Object setAttribute(String name, Object value) { ClassLoader loader = Thread.currentThread().getContextClassLoader(); return setAttribute(name, value, loader); }
java
public static Object setAttribute(String name, Object value) { ClassLoader loader = Thread.currentThread().getContextClassLoader(); return setAttribute(name, value, loader); }
[ "public", "static", "Object", "setAttribute", "(", "String", "name", ",", "Object", "value", ")", "{", "ClassLoader", "loader", "=", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ";", "return", "setAttribute", "(", "name", ...
Sets a local variable for the current environment. @param name the attribute name @param value the new attribute value @return the old attribute value
[ "Sets", "a", "local", "variable", "for", "the", "current", "environment", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/loader/EnvLoader.java#L636-L641
jenkinsci/jenkins
core/src/main/java/jenkins/model/Jenkins.java
Jenkins.doDefaultJDKCheck
public FormValidation doDefaultJDKCheck(StaplerRequest request, @QueryParameter String value) { if(!JDK.isDefaultName(value)) // assume the user configured named ones properly in system config --- // or else system config should have reported form field validation errors. return FormValidation.ok(); // default JDK selected. Does such java really exist? if(JDK.isDefaultJDKValid(Jenkins.this)) return FormValidation.ok(); else return FormValidation.errorWithMarkup(Messages.Hudson_NoJavaInPath(request.getContextPath())); }
java
public FormValidation doDefaultJDKCheck(StaplerRequest request, @QueryParameter String value) { if(!JDK.isDefaultName(value)) // assume the user configured named ones properly in system config --- // or else system config should have reported form field validation errors. return FormValidation.ok(); // default JDK selected. Does such java really exist? if(JDK.isDefaultJDKValid(Jenkins.this)) return FormValidation.ok(); else return FormValidation.errorWithMarkup(Messages.Hudson_NoJavaInPath(request.getContextPath())); }
[ "public", "FormValidation", "doDefaultJDKCheck", "(", "StaplerRequest", "request", ",", "@", "QueryParameter", "String", "value", ")", "{", "if", "(", "!", "JDK", ".", "isDefaultName", "(", "value", ")", ")", "// assume the user configured named ones properly in system ...
If the user chose the default JDK, make sure we got 'java' in PATH.
[ "If", "the", "user", "chose", "the", "default", "JDK", "make", "sure", "we", "got", "java", "in", "PATH", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/Jenkins.java#L4512-L4523
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/attribute/ReflectiveAttribute.java
ReflectiveAttribute.printClientConfig
@Override public final void printClientConfig(final JSONWriter json, final Template template) throws JSONException { try { Set<Class> printed = new HashSet<>(); final Value exampleValue = createValue(template); json.key(JSON_NAME).value(this.configName); json.key(JSON_ATTRIBUTE_TYPE).value(getValueType().getSimpleName()); final Class<?> valueType = exampleValue.getClass(); json.key(JSON_CLIENT_PARAMS); json.object(); printClientConfigForType(json, exampleValue, valueType, this.defaults, printed); json.endObject(); Optional<JSONObject> clientOptions = getClientInfo(); clientOptions.ifPresent(jsonObject -> json.key(JSON_CLIENT_INFO).value(jsonObject)); } catch (Throwable e) { // Note: If this test fails and you just added a new attribute, make // sure to set defaults in AbstractMapfishSpringTest.configureAttributeForTesting throw new Error("Error printing the clientConfig of: " + getValueType().getName(), e); } }
java
@Override public final void printClientConfig(final JSONWriter json, final Template template) throws JSONException { try { Set<Class> printed = new HashSet<>(); final Value exampleValue = createValue(template); json.key(JSON_NAME).value(this.configName); json.key(JSON_ATTRIBUTE_TYPE).value(getValueType().getSimpleName()); final Class<?> valueType = exampleValue.getClass(); json.key(JSON_CLIENT_PARAMS); json.object(); printClientConfigForType(json, exampleValue, valueType, this.defaults, printed); json.endObject(); Optional<JSONObject> clientOptions = getClientInfo(); clientOptions.ifPresent(jsonObject -> json.key(JSON_CLIENT_INFO).value(jsonObject)); } catch (Throwable e) { // Note: If this test fails and you just added a new attribute, make // sure to set defaults in AbstractMapfishSpringTest.configureAttributeForTesting throw new Error("Error printing the clientConfig of: " + getValueType().getName(), e); } }
[ "@", "Override", "public", "final", "void", "printClientConfig", "(", "final", "JSONWriter", "json", ",", "final", "Template", "template", ")", "throws", "JSONException", "{", "try", "{", "Set", "<", "Class", ">", "printed", "=", "new", "HashSet", "<>", "(",...
Uses reflection on the object created by {@link #createValue(Template)} to create the options. <p></p> The public final fields are written as the field name as the key and the value as the value. <p></p> The public (non-final) mandatory fields are written as part of clientParams and are written with the field name as the key and the field type as the value. <p></p> The public (non-final) {@link HasDefaultValue} fields are written as part of clientOptions and are written with the field name as the key and an object as a value with a type property with the type and a default property containing the default value. @param json the json writer to write to @param template the template that this attribute is part of @throws JSONException
[ "Uses", "reflection", "on", "the", "object", "created", "by", "{", "@link", "#createValue", "(", "Template", ")", "}", "to", "create", "the", "options", ".", "<p", ">", "<", "/", "p", ">", "The", "public", "final", "fields", "are", "written", "as", "th...
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/attribute/ReflectiveAttribute.java#L239-L260
op4j/op4j
src/main/java/org/op4j/functions/FnString.java
FnString.toBigInteger
public static final Function<String,BigInteger> toBigInteger(final RoundingMode roundingMode, final DecimalPoint decimalPoint) { return new ToBigInteger(roundingMode, decimalPoint); }
java
public static final Function<String,BigInteger> toBigInteger(final RoundingMode roundingMode, final DecimalPoint decimalPoint) { return new ToBigInteger(roundingMode, decimalPoint); }
[ "public", "static", "final", "Function", "<", "String", ",", "BigInteger", ">", "toBigInteger", "(", "final", "RoundingMode", "roundingMode", ",", "final", "DecimalPoint", "decimalPoint", ")", "{", "return", "new", "ToBigInteger", "(", "roundingMode", ",", "decima...
<p> Converts a String into a BigInteger, using the specified decimal point configuration ({@link DecimalPoint}). Rounding mode is used for removing the decimal part of the number. The target String should contain no thousand separators. Any fractional part of the input String will be removed. </p> @param roundingMode the rounding mode to be used when setting the scale @param decimalPoint the decimal point being used by the String @return the resulting BigInteger object
[ "<p", ">", "Converts", "a", "String", "into", "a", "BigInteger", "using", "the", "specified", "decimal", "point", "configuration", "(", "{", "@link", "DecimalPoint", "}", ")", ".", "Rounding", "mode", "is", "used", "for", "removing", "the", "decimal", "part"...
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnString.java#L366-L368
jtmelton/appsensor
analysis-engines/appsensor-analysis-rules/src/main/java/org/owasp/appsensor/analysis/AggregateEventAnalysisEngine.java
AggregateEventAnalysisEngine.checkClause
protected boolean checkClause(Clause clause, Queue<Notification> notifications) { Collection<DetectionPoint> windowDetectionPoints = new HashSet<DetectionPoint>(); for (Notification notification : notifications) { windowDetectionPoints.add(notification.getMonitorPoint()); } for (DetectionPoint detectionPoint : clause.getMonitorPoints()) { if (!windowDetectionPoints.contains(detectionPoint)) { return false; } } return true; }
java
protected boolean checkClause(Clause clause, Queue<Notification> notifications) { Collection<DetectionPoint> windowDetectionPoints = new HashSet<DetectionPoint>(); for (Notification notification : notifications) { windowDetectionPoints.add(notification.getMonitorPoint()); } for (DetectionPoint detectionPoint : clause.getMonitorPoints()) { if (!windowDetectionPoints.contains(detectionPoint)) { return false; } } return true; }
[ "protected", "boolean", "checkClause", "(", "Clause", "clause", ",", "Queue", "<", "Notification", ">", "notifications", ")", "{", "Collection", "<", "DetectionPoint", ">", "windowDetectionPoints", "=", "new", "HashSet", "<", "DetectionPoint", ">", "(", ")", ";"...
Evaluates a {@link Clause}'s logic by checking if each {@link MonitorPoint} within the {@link Clause} is in the current "sliding window". Equivalent to checking "AND" logic between {@link RuleDetectionPoint}s. @param clause the {@link Clause} being evaluated @param notifications the {@link Notification}s in the current "sliding window" @return the boolean evaluation of the {@link Clause}
[ "Evaluates", "a", "{", "@link", "Clause", "}", "s", "logic", "by", "checking", "if", "each", "{", "@link", "MonitorPoint", "}", "within", "the", "{", "@link", "Clause", "}", "is", "in", "the", "current", "sliding", "window", "." ]
train
https://github.com/jtmelton/appsensor/blob/c3b4e9ada50fdee974e0d618ec4bdfabc2163798/analysis-engines/appsensor-analysis-rules/src/main/java/org/owasp/appsensor/analysis/AggregateEventAnalysisEngine.java#L139-L153
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java
XDSRepositoryAuditor.auditRetrieveDocumentEvent
public void auditRetrieveDocumentEvent( RFC3881EventOutcomeCodes eventOutcome, String consumerIpAddress, String userName, String repositoryRetrieveUri, String documentUniqueId) { if (!isAuditorEnabled()) { return; } ExportEvent exportEvent = new ExportEvent(true, eventOutcome, new IHETransactionEventTypeCodes.RetrieveDocument(), null); exportEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); exportEvent.addSourceActiveParticipant(repositoryRetrieveUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(repositoryRetrieveUri, false), false); if (!EventUtils.isEmptyOrNull(userName)) { exportEvent.addHumanRequestorActiveParticipant(userName, null, userName, (List<CodedValueType>) null); } exportEvent.addDestinationActiveParticipant(consumerIpAddress, null, null, consumerIpAddress, true); //exportEvent.addPatientParticipantObject(patientId); exportEvent.addDocumentUriParticipantObject(repositoryRetrieveUri, documentUniqueId); audit(exportEvent); }
java
public void auditRetrieveDocumentEvent( RFC3881EventOutcomeCodes eventOutcome, String consumerIpAddress, String userName, String repositoryRetrieveUri, String documentUniqueId) { if (!isAuditorEnabled()) { return; } ExportEvent exportEvent = new ExportEvent(true, eventOutcome, new IHETransactionEventTypeCodes.RetrieveDocument(), null); exportEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); exportEvent.addSourceActiveParticipant(repositoryRetrieveUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(repositoryRetrieveUri, false), false); if (!EventUtils.isEmptyOrNull(userName)) { exportEvent.addHumanRequestorActiveParticipant(userName, null, userName, (List<CodedValueType>) null); } exportEvent.addDestinationActiveParticipant(consumerIpAddress, null, null, consumerIpAddress, true); //exportEvent.addPatientParticipantObject(patientId); exportEvent.addDocumentUriParticipantObject(repositoryRetrieveUri, documentUniqueId); audit(exportEvent); }
[ "public", "void", "auditRetrieveDocumentEvent", "(", "RFC3881EventOutcomeCodes", "eventOutcome", ",", "String", "consumerIpAddress", ",", "String", "userName", ",", "String", "repositoryRetrieveUri", ",", "String", "documentUniqueId", ")", "{", "if", "(", "!", "isAudito...
Audits an ITI-17 Retrieve Document event for XDS.a Document Repository actors. @param eventOutcome The event outcome indicator @param consumerIpAddress The IP address of the document consumer that initiated the transaction @param repositoryRetrieveUri The URI that was used to retrieve the document @param documentUniqueId The Document Entry Unique ID of the document being retrieved (if known)
[ "Audits", "an", "ITI", "-", "17", "Retrieve", "Document", "event", "for", "XDS", ".", "a", "Document", "Repository", "actors", "." ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java#L196-L215
h2oai/h2o-2
src/main/java/hex/singlenoderf/VariableImportance.java
VariableImportance.collectVotes
public static TreeVotes[] collectVotes(int trees, int nclasses, Frame f, int ncols, float rate, int variable, SpeeDRFModel model, Vec resp) { return new VariableImportance(trees, nclasses, ncols, rate, variable, model, f, resp).doAll(f).resultVotes(); }
java
public static TreeVotes[] collectVotes(int trees, int nclasses, Frame f, int ncols, float rate, int variable, SpeeDRFModel model, Vec resp) { return new VariableImportance(trees, nclasses, ncols, rate, variable, model, f, resp).doAll(f).resultVotes(); }
[ "public", "static", "TreeVotes", "[", "]", "collectVotes", "(", "int", "trees", ",", "int", "nclasses", ",", "Frame", "f", ",", "int", "ncols", ",", "float", "rate", ",", "int", "variable", ",", "SpeeDRFModel", "model", ",", "Vec", "resp", ")", "{", "r...
VariableImportance(int trees, int nclasses, int ncols, float rate, int variable, SpeeDRFModel model)
[ "VariableImportance", "(", "int", "trees", "int", "nclasses", "int", "ncols", "float", "rate", "int", "variable", "SpeeDRFModel", "model", ")" ]
train
https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/singlenoderf/VariableImportance.java#L246-L248
vdmeer/skb-java-base
src/main/java/de/vandermeer/skb/base/managers/MessageRenderer.java
MessageRenderer.validateSTG
protected void validateSTG(){ if(this.stg==null){ throw new IllegalArgumentException("stg is null"); } STGroupValidator stgv = new STGroupValidator(this.stg, MessageRenderer.STG_CHUNKS); if(stgv.getValidationErrors().hasErrors()){ throw new IllegalArgumentException(stgv.getValidationErrors().render()); } }
java
protected void validateSTG(){ if(this.stg==null){ throw new IllegalArgumentException("stg is null"); } STGroupValidator stgv = new STGroupValidator(this.stg, MessageRenderer.STG_CHUNKS); if(stgv.getValidationErrors().hasErrors()){ throw new IllegalArgumentException(stgv.getValidationErrors().render()); } }
[ "protected", "void", "validateSTG", "(", ")", "{", "if", "(", "this", ".", "stg", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"stg is null\"", ")", ";", "}", "STGroupValidator", "stgv", "=", "new", "STGroupValidator", "(", "thi...
Validates the local STGroup @throws IllegalArgumentException if the local STGroup was null or not valid
[ "Validates", "the", "local", "STGroup" ]
train
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/managers/MessageRenderer.java#L111-L120
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java
ElementsExceptionsFactory.newIllegalTypeException
public static IllegalTypeException newIllegalTypeException(String message, Object... args) { return newIllegalTypeException(null, message, args); }
java
public static IllegalTypeException newIllegalTypeException(String message, Object... args) { return newIllegalTypeException(null, message, args); }
[ "public", "static", "IllegalTypeException", "newIllegalTypeException", "(", "String", "message", ",", "Object", "...", "args", ")", "{", "return", "newIllegalTypeException", "(", "null", ",", "message", ",", "args", ")", ";", "}" ]
Constructs and initializes a new {@link IllegalTypeException} with the given {@link String message} formatted with the given {@link Object[] arguments}. @param message {@link String} describing the {@link IllegalTypeException exception}. @param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}. @return a new {@link IllegalTypeException} with the given {@link String message}. @see #newIllegalTypeException(Throwable, String, Object...) @see org.cp.elements.lang.IllegalTypeException
[ "Constructs", "and", "initializes", "a", "new", "{", "@link", "IllegalTypeException", "}", "with", "the", "given", "{", "@link", "String", "message", "}", "formatted", "with", "the", "given", "{", "@link", "Object", "[]", "arguments", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L383-L385
stevespringett/Alpine
example/src/main/java/com/example/resources/v1/LoginResource.java
LoginResource.validateCredentials
@POST @Produces(MediaType.TEXT_PLAIN) @ApiOperation( value = "Assert login credentials", notes = "Upon a successful login, a JWT will be returned in the response. This functionality requires authentication to be enabled.", response = String.class ) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success"), @ApiResponse(code = 401, message = "Unauthorized") }) @AuthenticationNotRequired public Response validateCredentials(@FormParam("username") String username, @FormParam("password") String password) { final Authenticator auth = new Authenticator(username, password); try { final Principal principal = auth.authenticate(); if (principal != null) { LOGGER.info(SecurityMarkers.SECURITY_AUDIT, "Login succeeded (username: " + username + " / ip address: " + super.getRemoteAddress() + " / agent: " + super.getUserAgent() + ")"); final JsonWebToken jwt = new JsonWebToken(); final String token = jwt.createToken(principal); return Response.ok(token).build(); } } catch (AuthenticationException e) { LOGGER.warn(SecurityMarkers.SECURITY_AUDIT, "Unauthorized login attempt (username: " + username + " / ip address: " + super.getRemoteAddress() + " / agent: " + super.getUserAgent() + ")"); } return Response.status(Response.Status.UNAUTHORIZED).build(); }
java
@POST @Produces(MediaType.TEXT_PLAIN) @ApiOperation( value = "Assert login credentials", notes = "Upon a successful login, a JWT will be returned in the response. This functionality requires authentication to be enabled.", response = String.class ) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success"), @ApiResponse(code = 401, message = "Unauthorized") }) @AuthenticationNotRequired public Response validateCredentials(@FormParam("username") String username, @FormParam("password") String password) { final Authenticator auth = new Authenticator(username, password); try { final Principal principal = auth.authenticate(); if (principal != null) { LOGGER.info(SecurityMarkers.SECURITY_AUDIT, "Login succeeded (username: " + username + " / ip address: " + super.getRemoteAddress() + " / agent: " + super.getUserAgent() + ")"); final JsonWebToken jwt = new JsonWebToken(); final String token = jwt.createToken(principal); return Response.ok(token).build(); } } catch (AuthenticationException e) { LOGGER.warn(SecurityMarkers.SECURITY_AUDIT, "Unauthorized login attempt (username: " + username + " / ip address: " + super.getRemoteAddress() + " / agent: " + super.getUserAgent() + ")"); } return Response.status(Response.Status.UNAUTHORIZED).build(); }
[ "@", "POST", "@", "Produces", "(", "MediaType", ".", "TEXT_PLAIN", ")", "@", "ApiOperation", "(", "value", "=", "\"Assert login credentials\"", ",", "notes", "=", "\"Upon a successful login, a JWT will be returned in the response. This functionality requires authentication to be ...
Processes login requests. @param username the asserted username @param password the asserted password @return a Response
[ "Processes", "login", "requests", "." ]
train
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/example/src/main/java/com/example/resources/v1/LoginResource.java#L56-L87
TheHortonMachine/hortonmachine
apps/src/main/java/org/hortonmachine/nww/utils/selection/ScreenSelector.java
ScreenSelector.limitPointToWorldWindow
protected Point limitPointToWorldWindow( Point point ) { Rectangle viewport = this.getWwd().getView().getViewport(); int x = point.x; if (x < viewport.x) x = viewport.x; if (x > viewport.x + viewport.width) x = viewport.x + viewport.width; int y = point.y; if (y < viewport.y) y = viewport.y; if (y > viewport.y + viewport.height) y = viewport.y + viewport.height; return new Point(x, y); }
java
protected Point limitPointToWorldWindow( Point point ) { Rectangle viewport = this.getWwd().getView().getViewport(); int x = point.x; if (x < viewport.x) x = viewport.x; if (x > viewport.x + viewport.width) x = viewport.x + viewport.width; int y = point.y; if (y < viewport.y) y = viewport.y; if (y > viewport.y + viewport.height) y = viewport.y + viewport.height; return new Point(x, y); }
[ "protected", "Point", "limitPointToWorldWindow", "(", "Point", "point", ")", "{", "Rectangle", "viewport", "=", "this", ".", "getWwd", "(", ")", ".", "getView", "(", ")", ".", "getViewport", "(", ")", ";", "int", "x", "=", "point", ".", "x", ";", "if",...
Limits the specified point's x and y coordinates to the World Window's viewport, and returns a new point with the limited coordinates. For example, if the World Window's viewport rectangle is x=0, y=0, width=100, height=100 and the point's coordinates are x=50, y=200 this returns a new point with coordinates x=50, y=100. If the specified point is already inside the World Window's viewport, this returns a new point with the same x and y coordinates as the specified point. @param point the point to limit. @return a new Point representing the specified point limited to the World Window's viewport rectangle.
[ "Limits", "the", "specified", "point", "s", "x", "and", "y", "coordinates", "to", "the", "World", "Window", "s", "viewport", "and", "returns", "a", "new", "point", "with", "the", "limited", "coordinates", ".", "For", "example", "if", "the", "World", "Windo...
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/apps/src/main/java/org/hortonmachine/nww/utils/selection/ScreenSelector.java#L591-L607
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/ArchUtils.java
ArchUtils.addProcessors
private static void addProcessors(final Processor processor, final String... keys) throws IllegalStateException { for (final String key : keys) { addProcessor(key, processor); } }
java
private static void addProcessors(final Processor processor, final String... keys) throws IllegalStateException { for (final String key : keys) { addProcessor(key, processor); } }
[ "private", "static", "void", "addProcessors", "(", "final", "Processor", "processor", ",", "final", "String", "...", "keys", ")", "throws", "IllegalStateException", "{", "for", "(", "final", "String", "key", ":", "keys", ")", "{", "addProcessor", "(", "key", ...
Adds the given {@link Processor} with the given keys to the map. @param keys The keys. @param processor The {@link Processor} to add. @throws IllegalStateException If the key already exists.
[ "Adds", "the", "given", "{", "@link", "Processor", "}", "with", "the", "given", "keys", "to", "the", "map", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ArchUtils.java#L107-L111
eyp/serfj
src/main/java/net/sf/serfj/UrlInspector.java
UrlInspector.getStandardAction
private String getStandardAction(String id, HttpMethod requestMethod) { String action = null; if (requestMethod == HttpMethod.GET) { if (id == null) { action = INDEX_ACTION; } else { action = SHOW_ACTION; } } else if (requestMethod == HttpMethod.POST) { action = CREATE_ACTION; } else if (requestMethod == HttpMethod.DELETE) { action = DESTROY_ACTION; } else if (requestMethod.equals(HttpMethod.PUT)) { action = UPDATE_ACTION; } return action; }
java
private String getStandardAction(String id, HttpMethod requestMethod) { String action = null; if (requestMethod == HttpMethod.GET) { if (id == null) { action = INDEX_ACTION; } else { action = SHOW_ACTION; } } else if (requestMethod == HttpMethod.POST) { action = CREATE_ACTION; } else if (requestMethod == HttpMethod.DELETE) { action = DESTROY_ACTION; } else if (requestMethod.equals(HttpMethod.PUT)) { action = UPDATE_ACTION; } return action; }
[ "private", "String", "getStandardAction", "(", "String", "id", ",", "HttpMethod", "requestMethod", ")", "{", "String", "action", "=", "null", ";", "if", "(", "requestMethod", "==", "HttpMethod", ".", "GET", ")", "{", "if", "(", "id", "==", "null", ")", "...
Deduces the action invoked when there isn't action in the URL. The action is deduced by the HTTP_METHOD used. If method is GET, it also has in count the ID, because it depends on it to know if action is 'show' or 'index'.<br/> <br/> GET: with ID => show, without ID => index.<br/> POST: create.<br/> DELETE: delete.<br/> PUT: update.<br/> <br/> @param id Identifier, if any. @param requestMethod HTTP METHOD (GET, POST, PUT, DELETE). @return an action.
[ "Deduces", "the", "action", "invoked", "when", "there", "isn", "t", "action", "in", "the", "URL", ".", "The", "action", "is", "deduced", "by", "the", "HTTP_METHOD", "used", ".", "If", "method", "is", "GET", "it", "also", "has", "in", "count", "the", "I...
train
https://github.com/eyp/serfj/blob/e617592af6f24e59ea58443f2785c44aa2312189/src/main/java/net/sf/serfj/UrlInspector.java#L166-L182
rubenlagus/TelegramBots
telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/InputFile.java
InputFile.setMedia
public InputFile setMedia(File mediaFile, String fileName) { this.newMediaFile = mediaFile; this.mediaName = fileName; this.attachName = "attach://" + fileName; this.isNew = true; return this; }
java
public InputFile setMedia(File mediaFile, String fileName) { this.newMediaFile = mediaFile; this.mediaName = fileName; this.attachName = "attach://" + fileName; this.isNew = true; return this; }
[ "public", "InputFile", "setMedia", "(", "File", "mediaFile", ",", "String", "fileName", ")", "{", "this", ".", "newMediaFile", "=", "mediaFile", ";", "this", ".", "mediaName", "=", "fileName", ";", "this", ".", "attachName", "=", "\"attach://\"", "+", "fileN...
Use this setter to send new file. @param mediaFile File to send @param fileName Name of the file @return This object
[ "Use", "this", "setter", "to", "send", "new", "file", "." ]
train
https://github.com/rubenlagus/TelegramBots/blob/d62354915d7664597a40fd9858f16bce67ef1478/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/InputFile.java#L70-L76
geomajas/geomajas-project-server
impl/src/main/java/org/geomajas/spring/DependencyCheckPostProcessor.java
DependencyCheckPostProcessor.checkVersion
String checkVersion(String pluginName, String dependency, String requestedVersion, String availableVersion) { if (null == availableVersion) { return "Dependency " + dependency + " not found for " + pluginName + ", version " + requestedVersion + " or higher needed.\n"; } if (requestedVersion.startsWith(EXPR_START) || availableVersion.startsWith(EXPR_START)) { return ""; } Version requested = new Version(requestedVersion); Version available = new Version(availableVersion); if (requested.getMajor() != available.getMajor()) { return "Dependency " + dependency + " is provided in a incompatible API version for plug-in " + pluginName + ", which requests version " + requestedVersion + ", but version " + availableVersion + " supplied.\n"; } if (requested.after(available)) { return "Dependency " + dependency + " too old for " + pluginName + ", version " + requestedVersion + " or higher needed, but version " + availableVersion + " supplied.\n"; } return ""; }
java
String checkVersion(String pluginName, String dependency, String requestedVersion, String availableVersion) { if (null == availableVersion) { return "Dependency " + dependency + " not found for " + pluginName + ", version " + requestedVersion + " or higher needed.\n"; } if (requestedVersion.startsWith(EXPR_START) || availableVersion.startsWith(EXPR_START)) { return ""; } Version requested = new Version(requestedVersion); Version available = new Version(availableVersion); if (requested.getMajor() != available.getMajor()) { return "Dependency " + dependency + " is provided in a incompatible API version for plug-in " + pluginName + ", which requests version " + requestedVersion + ", but version " + availableVersion + " supplied.\n"; } if (requested.after(available)) { return "Dependency " + dependency + " too old for " + pluginName + ", version " + requestedVersion + " or higher needed, but version " + availableVersion + " supplied.\n"; } return ""; }
[ "String", "checkVersion", "(", "String", "pluginName", ",", "String", "dependency", ",", "String", "requestedVersion", ",", "String", "availableVersion", ")", "{", "if", "(", "null", "==", "availableVersion", ")", "{", "return", "\"Dependency \"", "+", "dependency...
Check the version to assure it is allowed. @param pluginName plugin name which needs the dependency @param dependency dependency which needs to be verified @param requestedVersion requested/minimum version @param availableVersion available version @return version check problem or empty string when all is fine
[ "Check", "the", "version", "to", "assure", "it", "is", "allowed", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/spring/DependencyCheckPostProcessor.java#L128-L148
samskivert/samskivert
src/main/java/com/samskivert/util/PropertiesUtil.java
PropertiesUtil.requireProperty
public static String requireProperty (Properties props, String key) { return requireProperty(props, key, "Missing required property '" + key + "'."); }
java
public static String requireProperty (Properties props, String key) { return requireProperty(props, key, "Missing required property '" + key + "'."); }
[ "public", "static", "String", "requireProperty", "(", "Properties", "props", ",", "String", "key", ")", "{", "return", "requireProperty", "(", "props", ",", "key", ",", "\"Missing required property '\"", "+", "key", "+", "\"'.\"", ")", ";", "}" ]
Returns the specified property from the supplied properties object. @throws MissingPropertyException with the text "Missing required property '<code>key</code>'." if the property does not exist or is the empty string.
[ "Returns", "the", "specified", "property", "from", "the", "supplied", "properties", "object", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/PropertiesUtil.java#L212-L215
jenkinsci/jenkins
core/src/main/java/hudson/console/ConsoleLogFilter.java
ConsoleLogFilter.decorateLogger
public OutputStream decorateLogger(AbstractBuild build, OutputStream logger) throws IOException, InterruptedException { if (Util.isOverridden(ConsoleLogFilter.class, getClass(), "decorateLogger", Run.class, OutputStream.class)) { // old client calling newer implementation. forward the call. return decorateLogger((Run) build, logger); } else { // happens only if the subtype fails to override neither decorateLogger method throw new AssertionError("The plugin '" + this.getClass().getName() + "' still uses " + "deprecated decorateLogger(AbstractBuild,OutputStream) method. " + "Update the plugin to use setUp(Run,OutputStream) instead."); } }
java
public OutputStream decorateLogger(AbstractBuild build, OutputStream logger) throws IOException, InterruptedException { if (Util.isOverridden(ConsoleLogFilter.class, getClass(), "decorateLogger", Run.class, OutputStream.class)) { // old client calling newer implementation. forward the call. return decorateLogger((Run) build, logger); } else { // happens only if the subtype fails to override neither decorateLogger method throw new AssertionError("The plugin '" + this.getClass().getName() + "' still uses " + "deprecated decorateLogger(AbstractBuild,OutputStream) method. " + "Update the plugin to use setUp(Run,OutputStream) instead."); } }
[ "public", "OutputStream", "decorateLogger", "(", "AbstractBuild", "build", ",", "OutputStream", "logger", ")", "throws", "IOException", ",", "InterruptedException", "{", "if", "(", "Util", ".", "isOverridden", "(", "ConsoleLogFilter", ".", "class", ",", "getClass", ...
Called on the start of each build, giving extensions a chance to intercept the data that is written to the log. @deprecated as of 1.632. Use {@link #decorateLogger(Run, OutputStream)}
[ "Called", "on", "the", "start", "of", "each", "build", "giving", "extensions", "a", "chance", "to", "intercept", "the", "data", "that", "is", "written", "to", "the", "log", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/console/ConsoleLogFilter.java#L63-L73
census-instrumentation/opencensus-java
contrib/exemplar_util/src/main/java/io/opencensus/contrib/exemplar/util/ExemplarUtils.java
ExemplarUtils.putSpanContextAttachments
public static void putSpanContextAttachments(MeasureMap measureMap, SpanContext spanContext) { checkNotNull(measureMap, "measureMap"); checkNotNull(spanContext, "spanContext"); measureMap.putAttachment( ATTACHMENT_KEY_SPAN_CONTEXT, AttachmentValueSpanContext.create(spanContext)); }
java
public static void putSpanContextAttachments(MeasureMap measureMap, SpanContext spanContext) { checkNotNull(measureMap, "measureMap"); checkNotNull(spanContext, "spanContext"); measureMap.putAttachment( ATTACHMENT_KEY_SPAN_CONTEXT, AttachmentValueSpanContext.create(spanContext)); }
[ "public", "static", "void", "putSpanContextAttachments", "(", "MeasureMap", "measureMap", ",", "SpanContext", "spanContext", ")", "{", "checkNotNull", "(", "measureMap", ",", "\"measureMap\"", ")", ";", "checkNotNull", "(", "spanContext", ",", "\"spanContext\"", ")", ...
Puts a {@link SpanContext} into the attachments of the given {@link MeasureMap}. @param measureMap the {@code MeasureMap}. @param spanContext the {@code SpanContext} to be put as attachments. @since 0.16
[ "Puts", "a", "{", "@link", "SpanContext", "}", "into", "the", "attachments", "of", "the", "given", "{", "@link", "MeasureMap", "}", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/contrib/exemplar_util/src/main/java/io/opencensus/contrib/exemplar/util/ExemplarUtils.java#L45-L50
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.getTaggedImageCount
public int getTaggedImageCount(UUID projectId, GetTaggedImageCountOptionalParameter getTaggedImageCountOptionalParameter) { return getTaggedImageCountWithServiceResponseAsync(projectId, getTaggedImageCountOptionalParameter).toBlocking().single().body(); }
java
public int getTaggedImageCount(UUID projectId, GetTaggedImageCountOptionalParameter getTaggedImageCountOptionalParameter) { return getTaggedImageCountWithServiceResponseAsync(projectId, getTaggedImageCountOptionalParameter).toBlocking().single().body(); }
[ "public", "int", "getTaggedImageCount", "(", "UUID", "projectId", ",", "GetTaggedImageCountOptionalParameter", "getTaggedImageCountOptionalParameter", ")", "{", "return", "getTaggedImageCountWithServiceResponseAsync", "(", "projectId", ",", "getTaggedImageCountOptionalParameter", "...
Gets the number of images tagged with the provided {tagIds}. The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and "Cat" tags, then only images tagged with Dog and/or Cat will be returned. @param projectId The project id @param getTaggedImageCountOptionalParameter the object representing the optional parameters to be set before calling this API @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 int object if successful.
[ "Gets", "the", "number", "of", "images", "tagged", "with", "the", "provided", "{", "tagIds", "}", ".", "The", "filtering", "is", "on", "an", "and", "/", "or", "relationship", ".", "For", "example", "if", "the", "provided", "tag", "ids", "are", "for", "...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L4614-L4616
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/http/SslListener.java
SslListener.customizeRequest
protected void customizeRequest(Socket socket, HttpRequest request) { super.customizeRequest(socket, request); if (!(socket instanceof javax.net.ssl.SSLSocket)) return; // I'm tempted to let it throw an // exception... try { SSLSocket sslSocket = (SSLSocket) socket; SSLSession sslSession = sslSocket.getSession(); String cipherSuite = sslSession.getCipherSuite(); Integer keySize; X509Certificate[] certs; CachedInfo cachedInfo = (CachedInfo) sslSession.getValue(CACHED_INFO_ATTR); if (cachedInfo != null) { keySize = cachedInfo.getKeySize(); certs = cachedInfo.getCerts(); } else { keySize = new Integer(ServletSSL.deduceKeyLength(cipherSuite)); certs = getCertChain(sslSession); cachedInfo = new CachedInfo(keySize, certs); sslSession.putValue(CACHED_INFO_ATTR, cachedInfo); } if (certs != null) request.setAttribute("javax.servlet.request.X509Certificate", certs); else if (_needClientAuth) // Sanity check throw new HttpException(HttpResponse.__403_Forbidden); request.setAttribute("javax.servlet.request.cipher_suite", cipherSuite); request.setAttribute("javax.servlet.request.key_size", keySize); } catch (Exception e) { log.warn(LogSupport.EXCEPTION, e); } }
java
protected void customizeRequest(Socket socket, HttpRequest request) { super.customizeRequest(socket, request); if (!(socket instanceof javax.net.ssl.SSLSocket)) return; // I'm tempted to let it throw an // exception... try { SSLSocket sslSocket = (SSLSocket) socket; SSLSession sslSession = sslSocket.getSession(); String cipherSuite = sslSession.getCipherSuite(); Integer keySize; X509Certificate[] certs; CachedInfo cachedInfo = (CachedInfo) sslSession.getValue(CACHED_INFO_ATTR); if (cachedInfo != null) { keySize = cachedInfo.getKeySize(); certs = cachedInfo.getCerts(); } else { keySize = new Integer(ServletSSL.deduceKeyLength(cipherSuite)); certs = getCertChain(sslSession); cachedInfo = new CachedInfo(keySize, certs); sslSession.putValue(CACHED_INFO_ATTR, cachedInfo); } if (certs != null) request.setAttribute("javax.servlet.request.X509Certificate", certs); else if (_needClientAuth) // Sanity check throw new HttpException(HttpResponse.__403_Forbidden); request.setAttribute("javax.servlet.request.cipher_suite", cipherSuite); request.setAttribute("javax.servlet.request.key_size", keySize); } catch (Exception e) { log.warn(LogSupport.EXCEPTION, e); } }
[ "protected", "void", "customizeRequest", "(", "Socket", "socket", ",", "HttpRequest", "request", ")", "{", "super", ".", "customizeRequest", "(", "socket", ",", "request", ")", ";", "if", "(", "!", "(", "socket", "instanceof", "javax", ".", "net", ".", "ss...
Allow the Listener a chance to customise the request. before the server does its stuff. <br> This allows the required attributes to be set for SSL requests. <br> The requirements of the Servlet specs are: <ul> <li>an attribute named "javax.servlet.request.cipher_suite" of type String.</li> <li>an attribute named "javax.servlet.request.key_size" of type Integer.</li> <li>an attribute named "javax.servlet.request.X509Certificate" of type java.security.cert.X509Certificate[]. This is an array of objects of type X509Certificate, the order of this array is defined as being in ascending order of trust. The first certificate in the chain is the one set by the client, the next is the one used to authenticate the first, and so on.</li> </ul> @param socket The Socket the request arrived on. This should be a javax.net.ssl.SSLSocket. @param request HttpRequest to be customised.
[ "Allow", "the", "Listener", "a", "chance", "to", "customise", "the", "request", ".", "before", "the", "server", "does", "its", "stuff", ".", "<br", ">", "This", "allows", "the", "required", "attributes", "to", "be", "set", "for", "SSL", "requests", ".", ...
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/http/SslListener.java#L357-L398
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/RowCell.java
RowCell.compareByNative
public static Comparator<RowCell> compareByNative() { return new Comparator<RowCell>() { @Override public int compare(RowCell c1, RowCell c2) { return ComparisonChain.start() .compare(c1.getFamily(), c2.getFamily()) .compare(c1.getQualifier(), c2.getQualifier(), ByteStringComparator.INSTANCE) .compare(c2.getTimestamp(), c1.getTimestamp()) .result(); } }; }
java
public static Comparator<RowCell> compareByNative() { return new Comparator<RowCell>() { @Override public int compare(RowCell c1, RowCell c2) { return ComparisonChain.start() .compare(c1.getFamily(), c2.getFamily()) .compare(c1.getQualifier(), c2.getQualifier(), ByteStringComparator.INSTANCE) .compare(c2.getTimestamp(), c1.getTimestamp()) .result(); } }; }
[ "public", "static", "Comparator", "<", "RowCell", ">", "compareByNative", "(", ")", "{", "return", "new", "Comparator", "<", "RowCell", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "RowCell", "c1", ",", "RowCell", "c2", ")", "{",...
A comparator that compares the cells by Bigtable native ordering: <ul> <li>Family lexicographically ascending <li>Qualifier lexicographically ascending <li>Timestamp in reverse chronological order </ul> <p>Labels and values are not included in the comparison.
[ "A", "comparator", "that", "compares", "the", "cells", "by", "Bigtable", "native", "ordering", ":" ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/RowCell.java#L44-L55
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementImagesImpl.java
ListManagementImagesImpl.addImageFileInput
public Image addImageFileInput(String listId, byte[] imageStream, AddImageFileInputOptionalParameter addImageFileInputOptionalParameter) { return addImageFileInputWithServiceResponseAsync(listId, imageStream, addImageFileInputOptionalParameter).toBlocking().single().body(); }
java
public Image addImageFileInput(String listId, byte[] imageStream, AddImageFileInputOptionalParameter addImageFileInputOptionalParameter) { return addImageFileInputWithServiceResponseAsync(listId, imageStream, addImageFileInputOptionalParameter).toBlocking().single().body(); }
[ "public", "Image", "addImageFileInput", "(", "String", "listId", ",", "byte", "[", "]", "imageStream", ",", "AddImageFileInputOptionalParameter", "addImageFileInputOptionalParameter", ")", "{", "return", "addImageFileInputWithServiceResponseAsync", "(", "listId", ",", "imag...
Add an image to the list with list Id equal to list Id passed. @param listId List Id of the image list. @param imageStream The image file. @param addImageFileInputOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws APIErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the Image object if successful.
[ "Add", "an", "image", "to", "the", "list", "with", "list", "Id", "equal", "to", "list", "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/ListManagementImagesImpl.java#L702-L704
ops4j/org.ops4j.pax.logging
pax-logging-log4j2/src/main/java/org/ops4j/pax/logging/log4j2/appender/PaxOsgiAppender.java
PaxOsgiAppender.createAppender
@PluginFactory public static PaxOsgiAppender createAppender( // @formatter:off @PluginAttribute("name") final String name, @PluginAttribute("filter") final String filter, @PluginConfiguration final Configuration config) { // @formatter:on if (name == null) { StatusLogger.getLogger().error("No name provided for PaxOsgiAppender"); return null; } return new PaxOsgiAppender(name, filter); }
java
@PluginFactory public static PaxOsgiAppender createAppender( // @formatter:off @PluginAttribute("name") final String name, @PluginAttribute("filter") final String filter, @PluginConfiguration final Configuration config) { // @formatter:on if (name == null) { StatusLogger.getLogger().error("No name provided for PaxOsgiAppender"); return null; } return new PaxOsgiAppender(name, filter); }
[ "@", "PluginFactory", "public", "static", "PaxOsgiAppender", "createAppender", "(", "// @formatter:off", "@", "PluginAttribute", "(", "\"name\"", ")", "final", "String", "name", ",", "@", "PluginAttribute", "(", "\"filter\"", ")", "final", "String", "filter", ",", ...
Create a Pax Osgi Appender. @param name The name of the Appender. @param filter defaults to "*", can be any string that works as a value in {@link org.osgi.framework.Filter} @param config The Configuration @return The FileAppender.
[ "Create", "a", "Pax", "Osgi", "Appender", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-log4j2/src/main/java/org/ops4j/pax/logging/log4j2/appender/PaxOsgiAppender.java#L93-L106
Alluxio/alluxio
core/common/src/main/java/alluxio/util/io/ByteIOUtils.java
ByteIOUtils.readLong
public static long readLong(byte[] buf, int pos) { checkBoundary(buf, pos, 8); return (((long) (buf[pos++] & 0xff) << 56) | ((long) (buf[pos++] & 0xff) << 48) | ((long) (buf[pos++] & 0xff) << 40) | ((long) (buf[pos++] & 0xff) << 32) | ((long) (buf[pos++] & 0xff) << 24) | ((long) (buf[pos++] & 0xff) << 16) | ((long) (buf[pos++] & 0xff) << 8) | ((long) (buf[pos] & 0xff))); }
java
public static long readLong(byte[] buf, int pos) { checkBoundary(buf, pos, 8); return (((long) (buf[pos++] & 0xff) << 56) | ((long) (buf[pos++] & 0xff) << 48) | ((long) (buf[pos++] & 0xff) << 40) | ((long) (buf[pos++] & 0xff) << 32) | ((long) (buf[pos++] & 0xff) << 24) | ((long) (buf[pos++] & 0xff) << 16) | ((long) (buf[pos++] & 0xff) << 8) | ((long) (buf[pos] & 0xff))); }
[ "public", "static", "long", "readLong", "(", "byte", "[", "]", "buf", ",", "int", "pos", ")", "{", "checkBoundary", "(", "buf", ",", "pos", ",", "8", ")", ";", "return", "(", "(", "(", "long", ")", "(", "buf", "[", "pos", "++", "]", "&", "0xff"...
Reads a specific long byte value (8 bytes) from the input byte array at the given offset. @param buf input byte buffer @param pos offset into the byte buffer to read @return the long value read
[ "Reads", "a", "specific", "long", "byte", "value", "(", "8", "bytes", ")", "from", "the", "input", "byte", "array", "at", "the", "given", "offset", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/io/ByteIOUtils.java#L95-L101
wdullaer/SwipeActionAdapter
library/src/main/java/com/wdullaer/swipeactionadapter/SwipeActionAdapter.java
SwipeActionAdapter.onAction
@Override public void onAction(ListView listView, int[] position, SwipeDirection[] direction){ if(mSwipeActionListener != null) mSwipeActionListener.onSwipe(position, direction); }
java
@Override public void onAction(ListView listView, int[] position, SwipeDirection[] direction){ if(mSwipeActionListener != null) mSwipeActionListener.onSwipe(position, direction); }
[ "@", "Override", "public", "void", "onAction", "(", "ListView", "listView", ",", "int", "[", "]", "position", ",", "SwipeDirection", "[", "]", "direction", ")", "{", "if", "(", "mSwipeActionListener", "!=", "null", ")", "mSwipeActionListener", ".", "onSwipe", ...
SwipeActionTouchListener.ActionCallbacks callback We just link it through to our own interface @param listView The originating {@link ListView}. @param position The positions to perform the action on, sorted in descending order for convenience. @param direction The type of swipe that triggered the action.
[ "SwipeActionTouchListener", ".", "ActionCallbacks", "callback", "We", "just", "link", "it", "through", "to", "our", "own", "interface" ]
train
https://github.com/wdullaer/SwipeActionAdapter/blob/24a7e2ed953ac11ea0d8875d375bba571ffeba55/library/src/main/java/com/wdullaer/swipeactionadapter/SwipeActionAdapter.java#L105-L108
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/buffer/BufferUtil.java
BufferUtil.cardinalityInBitmapWordRange
@Deprecated private static int cardinalityInBitmapWordRange(LongBuffer bitmap, int start, int end) { if (isBackedBySimpleArray(bitmap)) { return Util.cardinalityInBitmapWordRange(bitmap.array(), start, end); } if (start >= end) { return 0; } int firstword = start / 64; int endword = (end - 1) / 64; int answer = 0; for (int i = firstword; i <= endword; i++) { answer += Long.bitCount(bitmap.get(i)); } return answer; }
java
@Deprecated private static int cardinalityInBitmapWordRange(LongBuffer bitmap, int start, int end) { if (isBackedBySimpleArray(bitmap)) { return Util.cardinalityInBitmapWordRange(bitmap.array(), start, end); } if (start >= end) { return 0; } int firstword = start / 64; int endword = (end - 1) / 64; int answer = 0; for (int i = firstword; i <= endword; i++) { answer += Long.bitCount(bitmap.get(i)); } return answer; }
[ "@", "Deprecated", "private", "static", "int", "cardinalityInBitmapWordRange", "(", "LongBuffer", "bitmap", ",", "int", "start", ",", "int", "end", ")", "{", "if", "(", "isBackedBySimpleArray", "(", "bitmap", ")", ")", "{", "return", "Util", ".", "cardinalityI...
Hamming weight of the 64-bit words involved in the range start, start+1,..., end-1 that is, it will compute the cardinality of the bitset from index (floor(start/64) to floor((end-1)/64)) inclusively. @param bitmap array of words representing a bitset @param start first index (inclusive) @param end last index (exclusive) @return the hamming weight of the corresponding words
[ "Hamming", "weight", "of", "the", "64", "-", "bit", "words", "involved", "in", "the", "range", "start", "start", "+", "1", "...", "end", "-", "1", "that", "is", "it", "will", "compute", "the", "cardinality", "of", "the", "bitset", "from", "index", "(",...
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/buffer/BufferUtil.java#L376-L391
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getMovieInfoImdb
public MovieInfo getMovieInfoImdb(String imdbId, String language, String... appendToResponse) throws MovieDbException { return tmdbMovies.getMovieInfoImdb(imdbId, language, appendToResponse); }
java
public MovieInfo getMovieInfoImdb(String imdbId, String language, String... appendToResponse) throws MovieDbException { return tmdbMovies.getMovieInfoImdb(imdbId, language, appendToResponse); }
[ "public", "MovieInfo", "getMovieInfoImdb", "(", "String", "imdbId", ",", "String", "language", ",", "String", "...", "appendToResponse", ")", "throws", "MovieDbException", "{", "return", "tmdbMovies", ".", "getMovieInfoImdb", "(", "imdbId", ",", "language", ",", "...
This method is used to retrieve all of the basic movie information. It will return the single highest rated poster and backdrop. ApiExceptionType.MOVIE_ID_NOT_FOUND will be thrown if there are no movies found. @param imdbId imdbId @param language language @param appendToResponse appendToResponse @return @throws MovieDbException exception
[ "This", "method", "is", "used", "to", "retrieve", "all", "of", "the", "basic", "movie", "information", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L868-L870
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java
SDVariable.lte
public SDVariable lte(String name, SDVariable other){ return sameDiff.lte(name, this, other); }
java
public SDVariable lte(String name, SDVariable other){ return sameDiff.lte(name, this, other); }
[ "public", "SDVariable", "lte", "(", "String", "name", ",", "SDVariable", "other", ")", "{", "return", "sameDiff", ".", "lte", "(", "name", ",", "this", ",", "other", ")", ";", "}" ]
Less than or equal to operation: elementwise {@code this <= y}<br> If x and y arrays have equal shape, the output shape is the same as the inputs.<br> Supports broadcasting: if x and y have different shapes and are broadcastable, the output shape is broadcast.<br> Returns an array with values 1 where condition is satisfied, or value 0 otherwise. @param name Name of the output variable @param other Variable to compare values against @return Output SDVariable with values 0 (not satisfied) and 1 (where the condition is satisfied)
[ "Less", "than", "or", "equal", "to", "operation", ":", "elementwise", "{", "@code", "this", "<", "=", "y", "}", "<br", ">", "If", "x", "and", "y", "arrays", "have", "equal", "shape", "the", "output", "shape", "is", "the", "same", "as", "the", "inputs...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java#L525-L527
structurizr/java
structurizr-client/src/com/structurizr/util/WorkspaceUtils.java
WorkspaceUtils.toJson
public static String toJson(Workspace workspace, boolean indentOutput) throws Exception { if (workspace == null) { throw new IllegalArgumentException("A workspace must be provided."); } JsonWriter jsonWriter = new JsonWriter(indentOutput); StringWriter stringWriter = new StringWriter(); jsonWriter.write(workspace, stringWriter); stringWriter.flush(); stringWriter.close(); return stringWriter.toString(); }
java
public static String toJson(Workspace workspace, boolean indentOutput) throws Exception { if (workspace == null) { throw new IllegalArgumentException("A workspace must be provided."); } JsonWriter jsonWriter = new JsonWriter(indentOutput); StringWriter stringWriter = new StringWriter(); jsonWriter.write(workspace, stringWriter); stringWriter.flush(); stringWriter.close(); return stringWriter.toString(); }
[ "public", "static", "String", "toJson", "(", "Workspace", "workspace", ",", "boolean", "indentOutput", ")", "throws", "Exception", "{", "if", "(", "workspace", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"A workspace must be provided.\...
Serializes the specified workspace to a JSON string. @param workspace a Workspace instance @param indentOutput whether to indent the output (prettify) @return a JSON string @throws Exception if something goes wrong
[ "Serializes", "the", "specified", "workspace", "to", "a", "JSON", "string", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-client/src/com/structurizr/util/WorkspaceUtils.java#L77-L89
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/StorageUtil.java
StorageUtil.loadFile
public void loadFile(Resource res, String resourcePath) throws IOException { res.createFile(true); InputStream is = InfoImpl.class.getResourceAsStream(resourcePath); IOUtil.copy(is, res, true); }
java
public void loadFile(Resource res, String resourcePath) throws IOException { res.createFile(true); InputStream is = InfoImpl.class.getResourceAsStream(resourcePath); IOUtil.copy(is, res, true); }
[ "public", "void", "loadFile", "(", "Resource", "res", ",", "String", "resourcePath", ")", "throws", "IOException", "{", "res", ".", "createFile", "(", "true", ")", ";", "InputStream", "is", "=", "InfoImpl", ".", "class", ".", "getResourceAsStream", "(", "res...
create xml file from a resource definition @param res @param resourcePath @throws IOException
[ "create", "xml", "file", "from", "a", "resource", "definition" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L74-L78
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/HybridRunbookWorkerGroupsInner.java
HybridRunbookWorkerGroupsInner.updateAsync
public Observable<HybridRunbookWorkerGroupInner> updateAsync(String resourceGroupName, String automationAccountName, String hybridRunbookWorkerGroupName, RunAsCredentialAssociationProperty credential) { return updateWithServiceResponseAsync(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, credential).map(new Func1<ServiceResponse<HybridRunbookWorkerGroupInner>, HybridRunbookWorkerGroupInner>() { @Override public HybridRunbookWorkerGroupInner call(ServiceResponse<HybridRunbookWorkerGroupInner> response) { return response.body(); } }); }
java
public Observable<HybridRunbookWorkerGroupInner> updateAsync(String resourceGroupName, String automationAccountName, String hybridRunbookWorkerGroupName, RunAsCredentialAssociationProperty credential) { return updateWithServiceResponseAsync(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, credential).map(new Func1<ServiceResponse<HybridRunbookWorkerGroupInner>, HybridRunbookWorkerGroupInner>() { @Override public HybridRunbookWorkerGroupInner call(ServiceResponse<HybridRunbookWorkerGroupInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "HybridRunbookWorkerGroupInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "hybridRunbookWorkerGroupName", ",", "RunAsCredentialAssociationProperty", "credential", ")", "{", "ret...
Update a hybrid runbook worker group. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param hybridRunbookWorkerGroupName The hybrid runbook worker group name @param credential Sets the credential of a worker group. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the HybridRunbookWorkerGroupInner object
[ "Update", "a", "hybrid", "runbook", "worker", "group", "." ]
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/HybridRunbookWorkerGroupsInner.java#L397-L404
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java
XFactory.createXMethod
public static XMethod createXMethod(JavaClass javaClass, Method method) { if (method == null) { throw new NullPointerException("method must not be null"); } XMethod xmethod = createXMethod(javaClass.getClassName(), method); assert xmethod.isResolved(); return xmethod; }
java
public static XMethod createXMethod(JavaClass javaClass, Method method) { if (method == null) { throw new NullPointerException("method must not be null"); } XMethod xmethod = createXMethod(javaClass.getClassName(), method); assert xmethod.isResolved(); return xmethod; }
[ "public", "static", "XMethod", "createXMethod", "(", "JavaClass", "javaClass", ",", "Method", "method", ")", "{", "if", "(", "method", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"method must not be null\"", ")", ";", "}", "XMethod", ...
Create an XMethod object from a BCEL Method. @param javaClass the class to which the Method belongs @param method the Method @return an XMethod representing the Method
[ "Create", "an", "XMethod", "object", "from", "a", "BCEL", "Method", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java#L280-L287
Nexmo/nexmo-java
src/main/java/com/nexmo/client/auth/MD5Util.java
MD5Util.calculateMd5
public static String calculateMd5(String input, String encoding) throws NoSuchAlgorithmException, UnsupportedEncodingException { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(input.getBytes(encoding)); byte digest[] = md.digest(); final StringBuilder hexString = new StringBuilder(); for (byte element : digest) { int z = 0xFF & element; if (z < 16) hexString.append("0"); hexString.append(Integer.toHexString(z)); } return hexString.toString(); }
java
public static String calculateMd5(String input, String encoding) throws NoSuchAlgorithmException, UnsupportedEncodingException { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(input.getBytes(encoding)); byte digest[] = md.digest(); final StringBuilder hexString = new StringBuilder(); for (byte element : digest) { int z = 0xFF & element; if (z < 16) hexString.append("0"); hexString.append(Integer.toHexString(z)); } return hexString.toString(); }
[ "public", "static", "String", "calculateMd5", "(", "String", "input", ",", "String", "encoding", ")", "throws", "NoSuchAlgorithmException", ",", "UnsupportedEncodingException", "{", "MessageDigest", "md", "=", "MessageDigest", ".", "getInstance", "(", "\"MD5\"", ")", ...
Calculates MD5 hash for string. @param input string which is going to be encoded into MD5 format @param encoding character encoding of the string which is going to be encoded into MD5 format @return MD5 representation of the input string @throws NoSuchAlgorithmException if the MD5 algorithm is not available. @throws UnsupportedEncodingException if the specified encoding is unavailable.
[ "Calculates", "MD5", "hash", "for", "string", "." ]
train
https://github.com/Nexmo/nexmo-java/blob/7427eff6d6baa5a5bd9197fa096bcf2564191cf5/src/main/java/com/nexmo/client/auth/MD5Util.java#L58-L72
greenmail-mail-test/greenmail
greenmail-core/src/main/java/com/icegreen/greenmail/util/GreenMailUtil.java
GreenMailUtil.getSession
public static Session getSession(final ServerSetup setup, Properties mailProps) { Properties props = setup.configureJavaMailSessionProperties(mailProps, false); log.debug("Mail session properties are {}", props); return Session.getInstance(props, null); }
java
public static Session getSession(final ServerSetup setup, Properties mailProps) { Properties props = setup.configureJavaMailSessionProperties(mailProps, false); log.debug("Mail session properties are {}", props); return Session.getInstance(props, null); }
[ "public", "static", "Session", "getSession", "(", "final", "ServerSetup", "setup", ",", "Properties", "mailProps", ")", "{", "Properties", "props", "=", "setup", ".", "configureJavaMailSessionProperties", "(", "mailProps", ",", "false", ")", ";", "log", ".", "de...
Gets a JavaMail Session for given server type such as IMAP and additional props for JavaMail. @param setup the setup type, such as <code>ServerSetup.IMAP</code> @param mailProps additional mail properties. @return the JavaMail session.
[ "Gets", "a", "JavaMail", "Session", "for", "given", "server", "type", "such", "as", "IMAP", "and", "additional", "props", "for", "JavaMail", "." ]
train
https://github.com/greenmail-mail-test/greenmail/blob/6d19a62233d1ef6fedbbd1f6fdde2d28e713834a/greenmail-core/src/main/java/com/icegreen/greenmail/util/GreenMailUtil.java#L377-L383
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java
WatchMonitor.create
public static WatchMonitor create(File file, int maxDepth, WatchEvent.Kind<?>... events){ return create(file.toPath(), maxDepth, events); }
java
public static WatchMonitor create(File file, int maxDepth, WatchEvent.Kind<?>... events){ return create(file.toPath(), maxDepth, events); }
[ "public", "static", "WatchMonitor", "create", "(", "File", "file", ",", "int", "maxDepth", ",", "WatchEvent", ".", "Kind", "<", "?", ">", "...", "events", ")", "{", "return", "create", "(", "file", ".", "toPath", "(", ")", ",", "maxDepth", ",", "events...
创建并初始化监听 @param file 文件 @param events 监听的事件列表 @param maxDepth 当监听目录时,监听目录的最大深度,当设置值为1(或小于1)时,表示不递归监听子目录 @return 监听对象
[ "创建并初始化监听" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java#L141-L143
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCharacterProperty.java
UCharacterProperty.getAdditional
public int getAdditional(int codepoint, int column) { assert column >= 0; if (column >= m_additionalColumnsCount_) { return 0; } return m_additionalVectors_[m_additionalTrie_.get(codepoint) + column]; }
java
public int getAdditional(int codepoint, int column) { assert column >= 0; if (column >= m_additionalColumnsCount_) { return 0; } return m_additionalVectors_[m_additionalTrie_.get(codepoint) + column]; }
[ "public", "int", "getAdditional", "(", "int", "codepoint", ",", "int", "column", ")", "{", "assert", "column", ">=", "0", ";", "if", "(", "column", ">=", "m_additionalColumnsCount_", ")", "{", "return", "0", ";", "}", "return", "m_additionalVectors_", "[", ...
Gets the unicode additional properties. Java version of C u_getUnicodeProperties(). @param codepoint codepoint whose additional properties is to be retrieved @param column The column index. @return unicode properties
[ "Gets", "the", "unicode", "additional", "properties", ".", "Java", "version", "of", "C", "u_getUnicodeProperties", "()", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCharacterProperty.java#L130-L136
Netflix/ribbon
ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/reactive/ExecutionContextListenerInvoker.java
ExecutionContextListenerInvoker.onExecutionSuccess
public void onExecutionSuccess(ExecutionContext<I> context, O response, ExecutionInfo info) { for (ExecutionListener<I, O> listener: listeners) { try { if (!isListenerDisabled(listener)) { listener.onExecutionSuccess(context.getChildContext(listener), response, info); } } catch (Throwable e) { logger.error("Error invoking listener " + listener, e); } } }
java
public void onExecutionSuccess(ExecutionContext<I> context, O response, ExecutionInfo info) { for (ExecutionListener<I, O> listener: listeners) { try { if (!isListenerDisabled(listener)) { listener.onExecutionSuccess(context.getChildContext(listener), response, info); } } catch (Throwable e) { logger.error("Error invoking listener " + listener, e); } } }
[ "public", "void", "onExecutionSuccess", "(", "ExecutionContext", "<", "I", ">", "context", ",", "O", "response", ",", "ExecutionInfo", "info", ")", "{", "for", "(", "ExecutionListener", "<", "I", ",", "O", ">", "listener", ":", "listeners", ")", "{", "try"...
Called when the request is executed successfully on the server @param response Object received from the execution
[ "Called", "when", "the", "request", "is", "executed", "successfully", "on", "the", "server" ]
train
https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/reactive/ExecutionContextListenerInvoker.java#L139-L149
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_easyHunting_serviceName_hunting_agent_agentId_DELETE
public void billingAccount_easyHunting_serviceName_hunting_agent_agentId_DELETE(String billingAccount, String serviceName, Long agentId) throws IOException { String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/hunting/agent/{agentId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, agentId); exec(qPath, "DELETE", sb.toString(), null); }
java
public void billingAccount_easyHunting_serviceName_hunting_agent_agentId_DELETE(String billingAccount, String serviceName, Long agentId) throws IOException { String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/hunting/agent/{agentId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, agentId); exec(qPath, "DELETE", sb.toString(), null); }
[ "public", "void", "billingAccount_easyHunting_serviceName_hunting_agent_agentId_DELETE", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "agentId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/easyHunting/...
Delete the given agent REST: DELETE /telephony/{billingAccount}/easyHunting/{serviceName}/hunting/agent/{agentId} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param agentId [required]
[ "Delete", "the", "given", "agent" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L2388-L2392
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTableRenderer.java
WTableRenderer.paintPaginationDetails
private void paintPaginationDetails(final WTable table, final XmlStringBuilder xml) { TableModel model = table.getTableModel(); xml.appendTagOpen("ui:pagination"); xml.appendAttribute("rows", model.getRowCount()); xml.appendOptionalAttribute("rowsPerPage", table.getRowsPerPage() > 0, table. getRowsPerPage()); xml.appendAttribute("currentPage", table.getCurrentPage()); switch (table.getPaginationMode()) { case CLIENT: xml.appendAttribute("mode", "client"); break; case DYNAMIC: xml.appendAttribute("mode", "dynamic"); break; case NONE: break; default: throw new SystemException("Unknown pagination mode: " + table. getPaginationMode()); } if (table.getPaginationLocation() != WTable.PaginationLocation.AUTO) { switch (table.getPaginationLocation()) { case TOP: xml.appendAttribute("controls", "top"); break; case BOTTOM: xml.appendAttribute("controls", "bottom"); break; case BOTH: xml.appendAttribute("controls", "both"); break; default: throw new SystemException("Unknown pagination control location: " + table.getPaginationLocation()); } } xml.appendClose(); // Rows per page options if (table.getRowsPerPageOptions() != null) { xml.appendTag("ui:rowsselect"); for (Integer option : table.getRowsPerPageOptions()) { xml.appendTagOpen("ui:option"); xml.appendAttribute("value", option); xml.appendEnd(); } xml.appendEndTag("ui:rowsselect"); } xml.appendEndTag("ui:pagination"); }
java
private void paintPaginationDetails(final WTable table, final XmlStringBuilder xml) { TableModel model = table.getTableModel(); xml.appendTagOpen("ui:pagination"); xml.appendAttribute("rows", model.getRowCount()); xml.appendOptionalAttribute("rowsPerPage", table.getRowsPerPage() > 0, table. getRowsPerPage()); xml.appendAttribute("currentPage", table.getCurrentPage()); switch (table.getPaginationMode()) { case CLIENT: xml.appendAttribute("mode", "client"); break; case DYNAMIC: xml.appendAttribute("mode", "dynamic"); break; case NONE: break; default: throw new SystemException("Unknown pagination mode: " + table. getPaginationMode()); } if (table.getPaginationLocation() != WTable.PaginationLocation.AUTO) { switch (table.getPaginationLocation()) { case TOP: xml.appendAttribute("controls", "top"); break; case BOTTOM: xml.appendAttribute("controls", "bottom"); break; case BOTH: xml.appendAttribute("controls", "both"); break; default: throw new SystemException("Unknown pagination control location: " + table.getPaginationLocation()); } } xml.appendClose(); // Rows per page options if (table.getRowsPerPageOptions() != null) { xml.appendTag("ui:rowsselect"); for (Integer option : table.getRowsPerPageOptions()) { xml.appendTagOpen("ui:option"); xml.appendAttribute("value", option); xml.appendEnd(); } xml.appendEndTag("ui:rowsselect"); } xml.appendEndTag("ui:pagination"); }
[ "private", "void", "paintPaginationDetails", "(", "final", "WTable", "table", ",", "final", "XmlStringBuilder", "xml", ")", "{", "TableModel", "model", "=", "table", ".", "getTableModel", "(", ")", ";", "xml", ".", "appendTagOpen", "(", "\"ui:pagination\"", ")",...
Paint the pagination aspects of the table. @param table the WDataTable being rendered @param xml the string builder in use
[ "Paint", "the", "pagination", "aspects", "of", "the", "table", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTableRenderer.java#L126-L178
grails/grails-core
grails-bootstrap/src/main/groovy/org/grails/build/parsing/CommandLineParser.java
CommandLineParser.parseString
public CommandLine parseString(String commandName, String args) { // Steal ants implementation for argument splitting. Handles quoted arguments with " or '. // Doesn't handle escape sequences with \ String[] argArray = translateCommandline(args); DefaultCommandLine cl = createCommandLine(); cl.setCommandName(commandName); parseInternal(cl, argArray, false); return cl; }
java
public CommandLine parseString(String commandName, String args) { // Steal ants implementation for argument splitting. Handles quoted arguments with " or '. // Doesn't handle escape sequences with \ String[] argArray = translateCommandline(args); DefaultCommandLine cl = createCommandLine(); cl.setCommandName(commandName); parseInternal(cl, argArray, false); return cl; }
[ "public", "CommandLine", "parseString", "(", "String", "commandName", ",", "String", "args", ")", "{", "// Steal ants implementation for argument splitting. Handles quoted arguments with \" or '.", "// Doesn't handle escape sequences with \\", "String", "[", "]", "argArray", "=", ...
Parses a string of all the command line options converting them into an array of arguments to pass to #parse(String..args) @param commandName The command name @param args The string @return The command line
[ "Parses", "a", "string", "of", "all", "the", "command", "line", "options", "converting", "them", "into", "an", "array", "of", "arguments", "to", "pass", "to", "#parse", "(", "String", "..", "args", ")" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-bootstrap/src/main/groovy/org/grails/build/parsing/CommandLineParser.java#L159-L167
ldapchai/ldapchai
src/main/java/com/novell/ldapchai/provider/ChaiProviderFactory.java
ChaiProviderFactory.newProvider
public ChaiProvider newProvider( final String ldapURL, final String bindDN, final String password ) throws ChaiUnavailableException { final ChaiConfiguration chaiConfig = ChaiConfiguration.builder( ldapURL, bindDN, password ).build(); return newProvider( chaiConfig ); }
java
public ChaiProvider newProvider( final String ldapURL, final String bindDN, final String password ) throws ChaiUnavailableException { final ChaiConfiguration chaiConfig = ChaiConfiguration.builder( ldapURL, bindDN, password ).build(); return newProvider( chaiConfig ); }
[ "public", "ChaiProvider", "newProvider", "(", "final", "String", "ldapURL", ",", "final", "String", "bindDN", ",", "final", "String", "password", ")", "throws", "ChaiUnavailableException", "{", "final", "ChaiConfiguration", "chaiConfig", "=", "ChaiConfiguration", ".",...
Create a {@code ChaiProvider} using a standard (default) JNDI ChaiProvider. @param bindDN ldap bind DN, in ldap fully qualified syntax. Also used as the DN of the returned ChaiUser. @param password password for the bind DN. @param ldapURL ldap server and port in url format, example: <i>ldap://127.0.0.1:389</i> @return A ChaiProvider with an active connection to the ldap directory @throws ChaiUnavailableException If the directory server(s) are not reachable.
[ "Create", "a", "{", "@code", "ChaiProvider", "}", "using", "a", "standard", "(", "default", ")", "JNDI", "ChaiProvider", "." ]
train
https://github.com/ldapchai/ldapchai/blob/a6d4b5dbfa4e270db0ce70892512cbe39e64b874/src/main/java/com/novell/ldapchai/provider/ChaiProviderFactory.java#L136-L141
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/content/PropertyTypeUrl.java
PropertyTypeUrl.getPropertyTypesUrl
public static MozuUrl getPropertyTypesUrl(Integer pageSize, String responseFields, Integer startIndex) { UrlFormatter formatter = new UrlFormatter("/api/content/propertytypes/?pageSize={pageSize}&startIndex={startIndex}&responseFields={responseFields}"); formatter.formatUrl("pageSize", pageSize); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("startIndex", startIndex); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getPropertyTypesUrl(Integer pageSize, String responseFields, Integer startIndex) { UrlFormatter formatter = new UrlFormatter("/api/content/propertytypes/?pageSize={pageSize}&startIndex={startIndex}&responseFields={responseFields}"); formatter.formatUrl("pageSize", pageSize); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("startIndex", startIndex); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getPropertyTypesUrl", "(", "Integer", "pageSize", ",", "String", "responseFields", ",", "Integer", "startIndex", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/content/propertytypes/?pageSize={pageSize}&startI...
Get Resource Url for GetPropertyTypes @param pageSize When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with this parameter set to 25, to get the 51st through the 75th items, set startIndex to 50. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param startIndex When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with pageSize set to 25, to get the 51st through the 75th items, set this parameter to 50. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetPropertyTypes" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/content/PropertyTypeUrl.java#L23-L30
hawkular/hawkular-apm
client/collector/src/main/java/org/hawkular/apm/client/collector/internal/FragmentBuilder.java
FragmentBuilder.setState
public void setState(Object context, String name, Object value) { StateInformation si = stateInformation.get(name); if (si == null) { si = new StateInformation(); stateInformation.put(name, si); } si.set(context, value); }
java
public void setState(Object context, String name, Object value) { StateInformation si = stateInformation.get(name); if (si == null) { si = new StateInformation(); stateInformation.put(name, si); } si.set(context, value); }
[ "public", "void", "setState", "(", "Object", "context", ",", "String", "name", ",", "Object", "value", ")", "{", "StateInformation", "si", "=", "stateInformation", ".", "get", "(", "name", ")", ";", "if", "(", "si", "==", "null", ")", "{", "si", "=", ...
This method stores state information associated with the name and optional context. @param context The optional context @param name The name @param value The value
[ "This", "method", "stores", "state", "information", "associated", "with", "the", "name", "and", "optional", "context", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/collector/src/main/java/org/hawkular/apm/client/collector/internal/FragmentBuilder.java#L598-L605
ontop/ontop
core/model/src/main/java/it/unibz/inf/ontop/dbschema/RelationID.java
RelationID.createRelationIdFromDatabaseRecord
public static RelationID createRelationIdFromDatabaseRecord(QuotedIDFactory idfac, String schema, String table) { // both IDs are as though they are quoted -- DB stores names as is return new RelationID(QuotedID.createIdFromDatabaseRecord(idfac, schema), QuotedID.createIdFromDatabaseRecord(idfac, table)); }
java
public static RelationID createRelationIdFromDatabaseRecord(QuotedIDFactory idfac, String schema, String table) { // both IDs are as though they are quoted -- DB stores names as is return new RelationID(QuotedID.createIdFromDatabaseRecord(idfac, schema), QuotedID.createIdFromDatabaseRecord(idfac, table)); }
[ "public", "static", "RelationID", "createRelationIdFromDatabaseRecord", "(", "QuotedIDFactory", "idfac", ",", "String", "schema", ",", "String", "table", ")", "{", "// both IDs are as though they are quoted -- DB stores names as is ", "return", "new", "RelationID", "(", "Quot...
creates relation id from the database record (as though it is quoted) @param schema as is in DB (possibly null) @param table as is in DB @return
[ "creates", "relation", "id", "from", "the", "database", "record", "(", "as", "though", "it", "is", "quoted", ")" ]
train
https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/core/model/src/main/java/it/unibz/inf/ontop/dbschema/RelationID.java#L58-L62
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Request.java
Request.mandatoryParamAsLong
public long mandatoryParamAsLong(String key) { String s = mandatoryParam(key); return parseLong(key, s); }
java
public long mandatoryParamAsLong(String key) { String s = mandatoryParam(key); return parseLong(key, s); }
[ "public", "long", "mandatoryParamAsLong", "(", "String", "key", ")", "{", "String", "s", "=", "mandatoryParam", "(", "key", ")", ";", "return", "parseLong", "(", "key", ",", "s", ")", ";", "}" ]
Returns a long value. To be used when parameter is required or has a default value. @throws java.lang.IllegalArgumentException is value is null or blank
[ "Returns", "a", "long", "value", ".", "To", "be", "used", "when", "parameter", "is", "required", "or", "has", "a", "default", "value", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Request.java#L109-L112
agmip/agmip-common-functions
src/main/java/org/agmip/functions/WeatherHelper.java
WeatherHelper.getWthData
protected static HashMap getWthData(HashMap data) { if (data.containsKey("weather")) { return getObjectOr(data, "weather", new HashMap()); } else { return data; } }
java
protected static HashMap getWthData(HashMap data) { if (data.containsKey("weather")) { return getObjectOr(data, "weather", new HashMap()); } else { return data; } }
[ "protected", "static", "HashMap", "getWthData", "(", "HashMap", "data", ")", "{", "if", "(", "data", ".", "containsKey", "(", "\"weather\"", ")", ")", "{", "return", "getObjectOr", "(", "data", ",", "\"weather\"", ",", "new", "HashMap", "(", ")", ")", ";...
Get weather station data set from data holder. @param data The experiment data holder @return The weather station data set
[ "Get", "weather", "station", "data", "set", "from", "data", "holder", "." ]
train
https://github.com/agmip/agmip-common-functions/blob/4efa3042178841b026ca6fba9c96da02fbfb9a8e/src/main/java/org/agmip/functions/WeatherHelper.java#L168-L174
UrielCh/ovh-java-sdk
ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java
ApiOvhPackxdsl.packName_GET
public OvhPackAdsl packName_GET(String packName) throws IOException { String qPath = "/pack/xdsl/{packName}"; StringBuilder sb = path(qPath, packName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPackAdsl.class); }
java
public OvhPackAdsl packName_GET(String packName) throws IOException { String qPath = "/pack/xdsl/{packName}"; StringBuilder sb = path(qPath, packName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPackAdsl.class); }
[ "public", "OvhPackAdsl", "packName_GET", "(", "String", "packName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/pack/xdsl/{packName}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "packName", ")", ";", "String", "resp", "=", ...
Get this object properties REST: GET /pack/xdsl/{packName} @param packName [required] The internal name of your pack
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L472-L477
LableOrg/java-uniqueid
uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/ResourceClaim.java
ResourceClaim.grabTicket
static boolean grabTicket(ZooKeeper zookeeper, String lockNode, String ticket) throws InterruptedException, KeeperException { try { zookeeper.create(lockNode + "/" + ticket, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL); } catch (KeeperException e) { if (e.code() == KeeperException.Code.NODEEXISTS) { // It is possible that two processes try to grab the exact same ticket at the same time. // This is common for the locking ticket. logger.debug("Failed to claim ticket {}.", ticket); return false; } else { throw e; } } logger.debug("Claimed ticket {}.", ticket); return true; }
java
static boolean grabTicket(ZooKeeper zookeeper, String lockNode, String ticket) throws InterruptedException, KeeperException { try { zookeeper.create(lockNode + "/" + ticket, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL); } catch (KeeperException e) { if (e.code() == KeeperException.Code.NODEEXISTS) { // It is possible that two processes try to grab the exact same ticket at the same time. // This is common for the locking ticket. logger.debug("Failed to claim ticket {}.", ticket); return false; } else { throw e; } } logger.debug("Claimed ticket {}.", ticket); return true; }
[ "static", "boolean", "grabTicket", "(", "ZooKeeper", "zookeeper", ",", "String", "lockNode", ",", "String", "ticket", ")", "throws", "InterruptedException", ",", "KeeperException", "{", "try", "{", "zookeeper", ".", "create", "(", "lockNode", "+", "\"/\"", "+", ...
Grab a ticket in the queue. @param zookeeper ZooKeeper connection to use. @param lockNode Path to the znode representing the locking queue. @param ticket Name of the ticket to attempt to grab. @return True on success, false if the ticket was already grabbed by another process.
[ "Grab", "a", "ticket", "in", "the", "queue", "." ]
train
https://github.com/LableOrg/java-uniqueid/blob/554e30b2277765f365e7c7f598108de0ab5744f4/uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/ResourceClaim.java#L302-L318
JCTools/JCTools
jctools-build/src/main/java/org/jctools/queues/atomic/JavaParsingAtomicQueueGenerator.java
JavaParsingAtomicQueueGenerator.fieldUpdaterCompareAndSet
protected BlockStmt fieldUpdaterCompareAndSet(String fieldUpdaterFieldName, String expectedValueName, String newValueName) { BlockStmt body = new BlockStmt(); body.addStatement(new ReturnStmt(methodCallExpr(fieldUpdaterFieldName, "compareAndSet", new ThisExpr(), new NameExpr(expectedValueName), new NameExpr(newValueName)))); return body; }
java
protected BlockStmt fieldUpdaterCompareAndSet(String fieldUpdaterFieldName, String expectedValueName, String newValueName) { BlockStmt body = new BlockStmt(); body.addStatement(new ReturnStmt(methodCallExpr(fieldUpdaterFieldName, "compareAndSet", new ThisExpr(), new NameExpr(expectedValueName), new NameExpr(newValueName)))); return body; }
[ "protected", "BlockStmt", "fieldUpdaterCompareAndSet", "(", "String", "fieldUpdaterFieldName", ",", "String", "expectedValueName", ",", "String", "newValueName", ")", "{", "BlockStmt", "body", "=", "new", "BlockStmt", "(", ")", ";", "body", ".", "addStatement", "(",...
Generates something like <code>return P_INDEX_UPDATER.compareAndSet(this, expectedValue, newValue)</code> @param fieldUpdaterFieldName @param expectedValueName @param newValueName @return
[ "Generates", "something", "like", "<code", ">", "return", "P_INDEX_UPDATER", ".", "compareAndSet", "(", "this", "expectedValue", "newValue", ")", "<", "/", "code", ">" ]
train
https://github.com/JCTools/JCTools/blob/9250fe316ec84209cbba0a41682f341256df781e/jctools-build/src/main/java/org/jctools/queues/atomic/JavaParsingAtomicQueueGenerator.java#L189-L195
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousSetOfCollections.java
DubiousSetOfCollections.isImplementationOf
private boolean isImplementationOf(@SlashedClassName String clsName, JavaClass inf) { try { if (clsName.startsWith("java/lang/")) { return false; } JavaClass cls = Repository.lookupClass(clsName); return isImplementationOf(cls, inf); } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } return false; }
java
private boolean isImplementationOf(@SlashedClassName String clsName, JavaClass inf) { try { if (clsName.startsWith("java/lang/")) { return false; } JavaClass cls = Repository.lookupClass(clsName); return isImplementationOf(cls, inf); } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } return false; }
[ "private", "boolean", "isImplementationOf", "(", "@", "SlashedClassName", "String", "clsName", ",", "JavaClass", "inf", ")", "{", "try", "{", "if", "(", "clsName", ".", "startsWith", "(", "\"java/lang/\"", ")", ")", "{", "return", "false", ";", "}", "JavaCla...
returns whether the class implements the interface @param clsName the name of the class @param inf the interface to check @return if the class implements the interface
[ "returns", "whether", "the", "class", "implements", "the", "interface" ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousSetOfCollections.java#L153-L166
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/images/ImageUtilities.java
ImageUtilities.makeColorTransparent
public static BufferedImage makeColorTransparent( BufferedImage bufferedImageToProcess, final Color colorToMakeTransparent ) { ImageFilter filter = new RGBImageFilter(){ public int markerRGB = colorToMakeTransparent.getRGB() | 0xFF000000; public final int filterRGB( int x, int y, int rgb ) { if ((rgb | 0xFF000000) == markerRGB) { // Mark the alpha bits as zero - transparent return 0x00FFFFFF & rgb; } else { return rgb; } } }; ImageProducer ip = new FilteredImageSource(bufferedImageToProcess.getSource(), filter); Image image = Toolkit.getDefaultToolkit().createImage(ip); BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = bufferedImage.createGraphics(); g2.drawImage(image, 0, 0, null); g2.dispose(); return bufferedImage; }
java
public static BufferedImage makeColorTransparent( BufferedImage bufferedImageToProcess, final Color colorToMakeTransparent ) { ImageFilter filter = new RGBImageFilter(){ public int markerRGB = colorToMakeTransparent.getRGB() | 0xFF000000; public final int filterRGB( int x, int y, int rgb ) { if ((rgb | 0xFF000000) == markerRGB) { // Mark the alpha bits as zero - transparent return 0x00FFFFFF & rgb; } else { return rgb; } } }; ImageProducer ip = new FilteredImageSource(bufferedImageToProcess.getSource(), filter); Image image = Toolkit.getDefaultToolkit().createImage(ip); BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = bufferedImage.createGraphics(); g2.drawImage(image, 0, 0, null); g2.dispose(); return bufferedImage; }
[ "public", "static", "BufferedImage", "makeColorTransparent", "(", "BufferedImage", "bufferedImageToProcess", ",", "final", "Color", "colorToMakeTransparent", ")", "{", "ImageFilter", "filter", "=", "new", "RGBImageFilter", "(", ")", "{", "public", "int", "markerRGB", ...
Make a color of the image transparent. @param bufferedImageToProcess the image to extract the color from. @param colorToMakeTransparent the color to make transparent. @return the new image.
[ "Make", "a", "color", "of", "the", "image", "transparent", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/images/ImageUtilities.java#L175-L194
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/SecretKeyFactory.java
SecretKeyFactory.getKeySpec
public final KeySpec getKeySpec(SecretKey key, Class<?> keySpec) throws InvalidKeySpecException { if (serviceIterator == null) { return spi.engineGetKeySpec(key, keySpec); } Exception failure = null; SecretKeyFactorySpi mySpi = spi; do { try { return mySpi.engineGetKeySpec(key, keySpec); } catch (Exception e) { if (failure == null) { failure = e; } mySpi = nextSpi(mySpi); } } while (mySpi != null); if (failure instanceof InvalidKeySpecException) { throw (InvalidKeySpecException)failure; } throw new InvalidKeySpecException ("Could not get key spec", failure); }
java
public final KeySpec getKeySpec(SecretKey key, Class<?> keySpec) throws InvalidKeySpecException { if (serviceIterator == null) { return spi.engineGetKeySpec(key, keySpec); } Exception failure = null; SecretKeyFactorySpi mySpi = spi; do { try { return mySpi.engineGetKeySpec(key, keySpec); } catch (Exception e) { if (failure == null) { failure = e; } mySpi = nextSpi(mySpi); } } while (mySpi != null); if (failure instanceof InvalidKeySpecException) { throw (InvalidKeySpecException)failure; } throw new InvalidKeySpecException ("Could not get key spec", failure); }
[ "public", "final", "KeySpec", "getKeySpec", "(", "SecretKey", "key", ",", "Class", "<", "?", ">", "keySpec", ")", "throws", "InvalidKeySpecException", "{", "if", "(", "serviceIterator", "==", "null", ")", "{", "return", "spi", ".", "engineGetKeySpec", "(", "...
Returns a specification (key material) of the given key object in the requested format. @param key the key @param keySpec the requested format in which the key material shall be returned @return the underlying key specification (key material) in the requested format @exception InvalidKeySpecException if the requested key specification is inappropriate for the given key (e.g., the algorithms associated with <code>key</code> and <code>keySpec</code> do not match, or <code>key</code> references a key on a cryptographic hardware device whereas <code>keySpec</code> is the specification of a software-based key), or the given key cannot be dealt with (e.g., the given key has an algorithm or format not supported by this secret-key factory).
[ "Returns", "a", "specification", "(", "key", "material", ")", "of", "the", "given", "key", "object", "in", "the", "requested", "format", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/SecretKeyFactory.java#L555-L577
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.writeProjectLastModified
public void writeProjectLastModified(CmsResource resource, CmsProject project) throws CmsException { m_securityManager.writeResourceProjectLastModified(getRequestContext(), resource, project); }
java
public void writeProjectLastModified(CmsResource resource, CmsProject project) throws CmsException { m_securityManager.writeResourceProjectLastModified(getRequestContext(), resource, project); }
[ "public", "void", "writeProjectLastModified", "(", "CmsResource", "resource", ",", "CmsProject", "project", ")", "throws", "CmsException", "{", "m_securityManager", ".", "writeResourceProjectLastModified", "(", "getRequestContext", "(", ")", ",", "resource", ",", "proje...
Writes the 'projectlastmodified' field of a resource record.<p> @param resource the resource which should be modified @param project the project whose id should be written into the resource record @throws CmsException if something goes wrong
[ "Writes", "the", "projectlastmodified", "field", "of", "a", "resource", "record", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L4055-L4058
JavaMoney/jsr354-ri-bp
src/main/java/org/javamoney/moneta/spi/base/BaseMonetaryFormatsSingletonSpi.java
BaseMonetaryFormatsSingletonSpi.getAmountFormat
public MonetaryAmountFormat getAmountFormat(String formatName, String... providers) { return getAmountFormat(AmountFormatQueryBuilder.of(formatName).setProviderNames(providers).build()); }
java
public MonetaryAmountFormat getAmountFormat(String formatName, String... providers) { return getAmountFormat(AmountFormatQueryBuilder.of(formatName).setProviderNames(providers).build()); }
[ "public", "MonetaryAmountFormat", "getAmountFormat", "(", "String", "formatName", ",", "String", "...", "providers", ")", "{", "return", "getAmountFormat", "(", "AmountFormatQueryBuilder", ".", "of", "(", "formatName", ")", ".", "setProviderNames", "(", "providers", ...
Access the default {@link javax.money.format.MonetaryAmountFormat} given a {@link java.util.Locale}. @param formatName the target format name, not {@code null}. @param providers The (optional) providers to be used, ordered correspondingly. @return the matching {@link javax.money.format.MonetaryAmountFormat} @throws javax.money.MonetaryException if no registered {@link javax.money.spi.MonetaryAmountFormatProviderSpi} can provide a corresponding {@link javax.money.format.MonetaryAmountFormat} instance.
[ "Access", "the", "default", "{", "@link", "javax", ".", "money", ".", "format", ".", "MonetaryAmountFormat", "}", "given", "a", "{", "@link", "java", ".", "util", ".", "Locale", "}", "." ]
train
https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/spi/base/BaseMonetaryFormatsSingletonSpi.java#L92-L94
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/table/support/GlazedTableModel.java
GlazedTableModel.isEditable
protected boolean isEditable(Object row, int column) { beanWrapper.setWrappedInstance(row); return beanWrapper.isWritableProperty(columnPropertyNames[column]); }
java
protected boolean isEditable(Object row, int column) { beanWrapper.setWrappedInstance(row); return beanWrapper.isWritableProperty(columnPropertyNames[column]); }
[ "protected", "boolean", "isEditable", "(", "Object", "row", ",", "int", "column", ")", "{", "beanWrapper", ".", "setWrappedInstance", "(", "row", ")", ";", "return", "beanWrapper", ".", "isWritableProperty", "(", "columnPropertyNames", "[", "column", "]", ")", ...
May be overridden to achieve control over editable columns. @param row the current row @param column the column @return editable
[ "May", "be", "overridden", "to", "achieve", "control", "over", "editable", "columns", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/table/support/GlazedTableModel.java#L149-L152