repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
ThreeTen/threetenbp
src/main/java/org/threeten/bp/chrono/JapaneseChronology.java
JapaneseChronology.dateYearDay
@Override public JapaneseDate dateYearDay(Era era, int yearOfEra, int dayOfYear) { if (era instanceof JapaneseEra == false) { throw new ClassCastException("Era must be JapaneseEra"); } return JapaneseDate.ofYearDay((JapaneseEra) era, yearOfEra, dayOfYear); }
java
@Override public JapaneseDate dateYearDay(Era era, int yearOfEra, int dayOfYear) { if (era instanceof JapaneseEra == false) { throw new ClassCastException("Era must be JapaneseEra"); } return JapaneseDate.ofYearDay((JapaneseEra) era, yearOfEra, dayOfYear); }
[ "@", "Override", "public", "JapaneseDate", "dateYearDay", "(", "Era", "era", ",", "int", "yearOfEra", ",", "int", "dayOfYear", ")", "{", "if", "(", "era", "instanceof", "JapaneseEra", "==", "false", ")", "{", "throw", "new", "ClassCastException", "(", "\"Era...
Obtains a local date in Japanese calendar system from the era, year-of-era and day-of-year fields. <p> The day-of-year in this factory is expressed relative to the start of the year-of-era. This definition changes the normal meaning of day-of-year only in those years where the year-of-era is reset to one due to a change in the era. For example: <pre> 6th Jan Showa 64 = day-of-year 6 7th Jan Showa 64 = day-of-year 7 8th Jan Heisei 1 = day-of-year 1 9th Jan Heisei 1 = day-of-year 2 </pre> @param era the Japanese era, not null @param yearOfEra the year-of-era @param dayOfYear the day-of-year @return the Japanese local date, not null @throws DateTimeException if unable to create the date @throws ClassCastException if the {@code era} is not a {@code JapaneseEra}
[ "Obtains", "a", "local", "date", "in", "Japanese", "calendar", "system", "from", "the", "era", "year", "-", "of", "-", "era", "and", "day", "-", "of", "-", "year", "fields", ".", "<p", ">", "The", "day", "-", "of", "-", "year", "in", "this", "facto...
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/chrono/JapaneseChronology.java#L235-L241
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/authentication/authenticationradiuspolicy_binding.java
authenticationradiuspolicy_binding.get
public static authenticationradiuspolicy_binding get(nitro_service service, String name) throws Exception{ authenticationradiuspolicy_binding obj = new authenticationradiuspolicy_binding(); obj.set_name(name); authenticationradiuspolicy_binding response = (authenticationradiuspolicy_binding) obj.get_resource(service); return response; }
java
public static authenticationradiuspolicy_binding get(nitro_service service, String name) throws Exception{ authenticationradiuspolicy_binding obj = new authenticationradiuspolicy_binding(); obj.set_name(name); authenticationradiuspolicy_binding response = (authenticationradiuspolicy_binding) obj.get_resource(service); return response; }
[ "public", "static", "authenticationradiuspolicy_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "authenticationradiuspolicy_binding", "obj", "=", "new", "authenticationradiuspolicy_binding", "(", ")", ";", "obj", ...
Use this API to fetch authenticationradiuspolicy_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "authenticationradiuspolicy_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/authentication/authenticationradiuspolicy_binding.java#L136-L141
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscConfigurationsInner.java
DscConfigurationsInner.listByAutomationAccountAsync
public Observable<Page<DscConfigurationInner>> listByAutomationAccountAsync(final String resourceGroupName, final String automationAccountName) { return listByAutomationAccountWithServiceResponseAsync(resourceGroupName, automationAccountName) .map(new Func1<ServiceResponse<Page<DscConfigurationInner>>, Page<DscConfigurationInner>>() { @Override public Page<DscConfigurationInner> call(ServiceResponse<Page<DscConfigurationInner>> response) { return response.body(); } }); }
java
public Observable<Page<DscConfigurationInner>> listByAutomationAccountAsync(final String resourceGroupName, final String automationAccountName) { return listByAutomationAccountWithServiceResponseAsync(resourceGroupName, automationAccountName) .map(new Func1<ServiceResponse<Page<DscConfigurationInner>>, Page<DscConfigurationInner>>() { @Override public Page<DscConfigurationInner> call(ServiceResponse<Page<DscConfigurationInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "DscConfigurationInner", ">", ">", "listByAutomationAccountAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "automationAccountName", ")", "{", "return", "listByAutomationAccountWithServiceResponseAsync", ...
Retrieve a list of configurations. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DscConfigurationInner&gt; object
[ "Retrieve", "a", "list", "of", "configurations", "." ]
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/DscConfigurationsInner.java#L700-L708
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowControllerFactory.java
FlowControllerFactory.getPageFlow
public static PageFlowController getPageFlow( String pageFlowClassName, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext ) { try { return get( servletContext ).createPageFlow( new RequestContext( request, response ), pageFlowClassName ); } catch ( ClassNotFoundException e) { LOG.error( "Requested page flow class " + pageFlowClassName + " not found." ); return null; } catch ( InstantiationException e ) { LOG.error( "Could not instantiate PageFlowController of type " + pageFlowClassName, e ); return null; } catch ( IllegalAccessException e ) { LOG.error( "Could not instantiate PageFlowController of type " + pageFlowClassName, e ); return null; } }
java
public static PageFlowController getPageFlow( String pageFlowClassName, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext ) { try { return get( servletContext ).createPageFlow( new RequestContext( request, response ), pageFlowClassName ); } catch ( ClassNotFoundException e) { LOG.error( "Requested page flow class " + pageFlowClassName + " not found." ); return null; } catch ( InstantiationException e ) { LOG.error( "Could not instantiate PageFlowController of type " + pageFlowClassName, e ); return null; } catch ( IllegalAccessException e ) { LOG.error( "Could not instantiate PageFlowController of type " + pageFlowClassName, e ); return null; } }
[ "public", "static", "PageFlowController", "getPageFlow", "(", "String", "pageFlowClassName", ",", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "ServletContext", "servletContext", ")", "{", "try", "{", "return", "get", "(", "servletContex...
Create a page flow of the given type. The page flow stack (for nesting) will be cleared or pushed, and the new instance will be stored as the current page flow. @deprecated Use {@link #createPageFlow(RequestContext, String)} instead. @param request the current HttpServletRequest. @param response the current HttpServletResponse. @param pageFlowClassName the type name of the desired page flow. @param servletContext the current ServletContext. @return the newly-created {@link PageFlowController}, or <code>null</code> if none was found.
[ "Create", "a", "page", "flow", "of", "the", "given", "type", ".", "The", "page", "flow", "stack", "(", "for", "nesting", ")", "will", "be", "cleared", "or", "pushed", "and", "the", "new", "instance", "will", "be", "stored", "as", "the", "current", "pag...
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowControllerFactory.java#L640-L664
JoeKerouac/utils
src/main/java/com/joe/utils/serialize/xml/XmlParser.java
XmlParser.toXml
public String toXml(Object source, String rootName, boolean hasNull) { if (source == null) { log.warn("传入的source为null,返回null"); return null; } if (rootName == null) { XmlNode xmlNode = source.getClass().getDeclaredAnnotation(XmlNode.class); rootName = xmlNode == null ? null : xmlNode.name(); } if (rootName == null) { rootName = DEFAULT_ROOT; } Long start = System.currentTimeMillis(); Element root = DocumentHelper.createElement(rootName); buildDocument(root, source, source.getClass(), !hasNull); Long end = System.currentTimeMillis(); log.debug("解析xml用时" + (end - start) + "ms"); return root.asXML(); }
java
public String toXml(Object source, String rootName, boolean hasNull) { if (source == null) { log.warn("传入的source为null,返回null"); return null; } if (rootName == null) { XmlNode xmlNode = source.getClass().getDeclaredAnnotation(XmlNode.class); rootName = xmlNode == null ? null : xmlNode.name(); } if (rootName == null) { rootName = DEFAULT_ROOT; } Long start = System.currentTimeMillis(); Element root = DocumentHelper.createElement(rootName); buildDocument(root, source, source.getClass(), !hasNull); Long end = System.currentTimeMillis(); log.debug("解析xml用时" + (end - start) + "ms"); return root.asXML(); }
[ "public", "String", "toXml", "(", "Object", "source", ",", "String", "rootName", ",", "boolean", "hasNull", ")", "{", "if", "(", "source", "==", "null", ")", "{", "log", ".", "warn", "(", "\"传入的source为null,返回null\");", "", "", "return", "null", ";", "}",...
将Object解析为xml,暂时只能解析基本类型(可以正确解析list、map) @param source bean @param rootName 根节点名称,如果为null则会尝试使用默认值 @param hasNull 是否包含null元素(true:包含) @return 解析结果
[ "将Object解析为xml,暂时只能解析基本类型(可以正确解析list、map)" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/serialize/xml/XmlParser.java#L332-L353
shrinkwrap/resolver
maven/impl-maven/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/PostResolutionFilterApplicator.java
PostResolutionFilterApplicator.postFilter
static Collection<MavenResolvedArtifact> postFilter(final Collection<MavenResolvedArtifact> artifactResults) { final MavenResolutionFilter postResolutionFilter = RestrictPomArtifactFilter.INSTANCE; final Collection<MavenResolvedArtifact> filteredArtifacts = new ArrayList<MavenResolvedArtifact>(); final List<MavenDependency> emptyList = Collections.emptyList(); for (final MavenResolvedArtifact artifact : artifactResults) { final MavenDependency dependency = MavenDependencies.createDependency(artifact.getCoordinate(), ScopeType.COMPILE, false); // Empty lists OK here because we know the RestrictPOM Filter doesn't consult them if (postResolutionFilter.accepts(dependency, emptyList, emptyList)) { filteredArtifacts.add(artifact); } } return Collections.unmodifiableCollection(filteredArtifacts); }
java
static Collection<MavenResolvedArtifact> postFilter(final Collection<MavenResolvedArtifact> artifactResults) { final MavenResolutionFilter postResolutionFilter = RestrictPomArtifactFilter.INSTANCE; final Collection<MavenResolvedArtifact> filteredArtifacts = new ArrayList<MavenResolvedArtifact>(); final List<MavenDependency> emptyList = Collections.emptyList(); for (final MavenResolvedArtifact artifact : artifactResults) { final MavenDependency dependency = MavenDependencies.createDependency(artifact.getCoordinate(), ScopeType.COMPILE, false); // Empty lists OK here because we know the RestrictPOM Filter doesn't consult them if (postResolutionFilter.accepts(dependency, emptyList, emptyList)) { filteredArtifacts.add(artifact); } } return Collections.unmodifiableCollection(filteredArtifacts); }
[ "static", "Collection", "<", "MavenResolvedArtifact", ">", "postFilter", "(", "final", "Collection", "<", "MavenResolvedArtifact", ">", "artifactResults", ")", "{", "final", "MavenResolutionFilter", "postResolutionFilter", "=", "RestrictPomArtifactFilter", ".", "INSTANCE", ...
Run post-resolution filtering to weed out POMs. @param artifactResults The original list of resolved artifacts @return List of modified artifactResults
[ "Run", "post", "-", "resolution", "filtering", "to", "weed", "out", "POMs", "." ]
train
https://github.com/shrinkwrap/resolver/blob/e881a84b8cff5b0a014f2a5ebf612be3eb9db01f/maven/impl-maven/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/PostResolutionFilterApplicator.java#L49-L64
Alluxio/alluxio
core/common/src/main/java/alluxio/metrics/Metric.java
Metric.getMetricNameWithTags
public static String getMetricNameWithTags(String name, String... tags) { Preconditions.checkArgument(tags.length % 2 == 0, "The tag arguments should be tag name and tag value pairs"); StringBuilder sb = new StringBuilder(); sb.append(name); for (int i = 0; i < tags.length; i += 2) { sb.append('.').append(tags[i]).append(TAG_SEPARATOR).append(tags[i + 1]); } return sb.toString(); }
java
public static String getMetricNameWithTags(String name, String... tags) { Preconditions.checkArgument(tags.length % 2 == 0, "The tag arguments should be tag name and tag value pairs"); StringBuilder sb = new StringBuilder(); sb.append(name); for (int i = 0; i < tags.length; i += 2) { sb.append('.').append(tags[i]).append(TAG_SEPARATOR).append(tags[i + 1]); } return sb.toString(); }
[ "public", "static", "String", "getMetricNameWithTags", "(", "String", "name", ",", "String", "...", "tags", ")", "{", "Preconditions", ".", "checkArgument", "(", "tags", ".", "length", "%", "2", "==", "0", ",", "\"The tag arguments should be tag name and tag value p...
Gets the metric name with the appendix of tags. The returned name is of the pattern name[.tagName:tagValue]*. @param name the metric name @param tags the tag name and tag value pairs @return the name with the tags appended
[ "Gets", "the", "metric", "name", "with", "the", "appendix", "of", "tags", ".", "The", "returned", "name", "is", "of", "the", "pattern", "name", "[", ".", "tagName", ":", "tagValue", "]", "*", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/metrics/Metric.java#L205-L214
google/jimfs
jimfs/src/main/java/com/google/common/jimfs/WindowsPathType.java
WindowsPathType.parseUncRoot
private String parseUncRoot(String path, String original) { Matcher uncMatcher = UNC_ROOT.matcher(path); if (uncMatcher.find()) { String host = uncMatcher.group(2); if (host == null) { throw new InvalidPathException(original, "UNC path is missing hostname"); } String share = uncMatcher.group(3); if (share == null) { throw new InvalidPathException(original, "UNC path is missing sharename"); } return path.substring(uncMatcher.start(), uncMatcher.end()); } else { // probably shouldn't ever reach this throw new InvalidPathException(original, "Invalid UNC path"); } }
java
private String parseUncRoot(String path, String original) { Matcher uncMatcher = UNC_ROOT.matcher(path); if (uncMatcher.find()) { String host = uncMatcher.group(2); if (host == null) { throw new InvalidPathException(original, "UNC path is missing hostname"); } String share = uncMatcher.group(3); if (share == null) { throw new InvalidPathException(original, "UNC path is missing sharename"); } return path.substring(uncMatcher.start(), uncMatcher.end()); } else { // probably shouldn't ever reach this throw new InvalidPathException(original, "Invalid UNC path"); } }
[ "private", "String", "parseUncRoot", "(", "String", "path", ",", "String", "original", ")", "{", "Matcher", "uncMatcher", "=", "UNC_ROOT", ".", "matcher", "(", "path", ")", ";", "if", "(", "uncMatcher", ".", "find", "(", ")", ")", "{", "String", "host", ...
Parse the root of a UNC-style path, throwing an exception if the path does not start with a valid UNC root.
[ "Parse", "the", "root", "of", "a", "UNC", "-", "style", "path", "throwing", "an", "exception", "if", "the", "path", "does", "not", "start", "with", "a", "valid", "UNC", "root", "." ]
train
https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/WindowsPathType.java#L114-L131
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
ResourceGroovyMethods.eachDirRecurse
public static void eachDirRecurse(final File self, @ClosureParams(value = SimpleType.class, options = "java.io.File") final Closure closure) throws FileNotFoundException, IllegalArgumentException { eachFileRecurse(self, FileType.DIRECTORIES, closure); }
java
public static void eachDirRecurse(final File self, @ClosureParams(value = SimpleType.class, options = "java.io.File") final Closure closure) throws FileNotFoundException, IllegalArgumentException { eachFileRecurse(self, FileType.DIRECTORIES, closure); }
[ "public", "static", "void", "eachDirRecurse", "(", "final", "File", "self", ",", "@", "ClosureParams", "(", "value", "=", "SimpleType", ".", "class", ",", "options", "=", "\"java.io.File\"", ")", "final", "Closure", "closure", ")", "throws", "FileNotFoundExcepti...
Recursively processes each descendant subdirectory in this directory. Processing consists of calling <code>closure</code> passing it the current subdirectory and then recursively processing that subdirectory. Regular files are ignored during traversal. @param self a File (that happens to be a folder/directory) @param closure a closure @throws FileNotFoundException if the given directory does not exist @throws IllegalArgumentException if the provided File object does not represent a directory @see #eachFileRecurse(java.io.File, groovy.io.FileType, groovy.lang.Closure) @since 1.5.0
[ "Recursively", "processes", "each", "descendant", "subdirectory", "in", "this", "directory", ".", "Processing", "consists", "of", "calling", "<code", ">", "closure<", "/", "code", ">", "passing", "it", "the", "current", "subdirectory", "and", "then", "recursively"...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L1500-L1502
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java
JSONHelpers.putDefault
public static <P extends Enum<P>> JSONObject putDefault(JSONObject json, P e, PointF defPoint) { return putDefault(json, e, defPoint, true); }
java
public static <P extends Enum<P>> JSONObject putDefault(JSONObject json, P e, PointF defPoint) { return putDefault(json, e, defPoint, true); }
[ "public", "static", "<", "P", "extends", "Enum", "<", "P", ">", ">", "JSONObject", "putDefault", "(", "JSONObject", "json", ",", "P", "e", ",", "PointF", "defPoint", ")", "{", "return", "putDefault", "(", "json", ",", "e", ",", "defPoint", ",", "true",...
Checks the supplied {@link JSONObject} for a value mapped by an enum; if it does not exist, or is not an object value, the specified default value will be mapped to the enum. If the value does exist, but either 'x' or 'y' field is missing, the missing field(s) will be set using {@code defPoint}. However, if the value exists and is a {@link Number}, it is interpreted as implicitly defining both the 'x' and 'y' fields, and the value is left as-is. @param json {@code JSONObject} to check for value @param e {@link Enum} mapping the value to check @param defPoint The value to use as default @return The {@code JSONObject} passed as '{@code json}', for call-chaining.
[ "Checks", "the", "supplied", "{", "@link", "JSONObject", "}", "for", "a", "value", "mapped", "by", "an", "enum", ";", "if", "it", "does", "not", "exist", "or", "is", "not", "an", "object", "value", "the", "specified", "default", "value", "will", "be", ...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java#L645-L647
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/persistent/OnDiskArrayPageFile.java
OnDiskArrayPageFile.writePage
@Override public void writePage(int pageID, P page) { if (page.isDirty()) { try { countWrite(); byte[] array = pageToByteArray(page); file.getRecordBuffer(pageID).put(array); page.setDirty(false); } catch (IOException e) { throw new RuntimeException(e); } } }
java
@Override public void writePage(int pageID, P page) { if (page.isDirty()) { try { countWrite(); byte[] array = pageToByteArray(page); file.getRecordBuffer(pageID).put(array); page.setDirty(false); } catch (IOException e) { throw new RuntimeException(e); } } }
[ "@", "Override", "public", "void", "writePage", "(", "int", "pageID", ",", "P", "page", ")", "{", "if", "(", "page", ".", "isDirty", "(", ")", ")", "{", "try", "{", "countWrite", "(", ")", ";", "byte", "[", "]", "array", "=", "pageToByteArray", "("...
Write page to disk. @param pageID page id @param page the page which has to be written to disk
[ "Write", "page", "to", "disk", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/persistent/OnDiskArrayPageFile.java#L144-L156
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java
HashtableOnDisk.doRehash
private void doRehash(int new_table_size) throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { // // Acquire the lock to prevent iteration while doubling // iterationLock.p(); // // Step 0: // This should be our only exposure = for a short time we // will have allocated the new table but not stored its location // anywhere. If we crash here we leak that storage permanently. // long new_table = 0; header.setRehashFlag(1); new_table = filemgr.allocateAndClear(new_table_size * DWORDSIZE); header.initNewTable(new_table_size, new_table); PrimitiveArrayPool.PoolEntry longPoolEntry = this.htoddc.longArrayPool.allocate(new_table_size); new_htindex = (long[]) longPoolEntry.getArray(); //new_htindex = new long[new_table_size]; Rehash rehash = new Rehash(this, new_table, new_table_size); Thread t = new Thread(rehash); t.start(); }
java
private void doRehash(int new_table_size) throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { // // Acquire the lock to prevent iteration while doubling // iterationLock.p(); // // Step 0: // This should be our only exposure = for a short time we // will have allocated the new table but not stored its location // anywhere. If we crash here we leak that storage permanently. // long new_table = 0; header.setRehashFlag(1); new_table = filemgr.allocateAndClear(new_table_size * DWORDSIZE); header.initNewTable(new_table_size, new_table); PrimitiveArrayPool.PoolEntry longPoolEntry = this.htoddc.longArrayPool.allocate(new_table_size); new_htindex = (long[]) longPoolEntry.getArray(); //new_htindex = new long[new_table_size]; Rehash rehash = new Rehash(this, new_table, new_table_size); Thread t = new Thread(rehash); t.start(); }
[ "private", "void", "doRehash", "(", "int", "new_table_size", ")", "throws", "IOException", ",", "EOFException", ",", "FileManagerException", ",", "ClassNotFoundException", ",", "HashtableOnDiskException", "{", "//", "// Acquire the lock to prevent iteration while doubling", "...
Double the size of the hash table - The variable rehashInProgress is set to non-0 on disk to indicate that rehashing is in progress. We use rehashInProgress to temporarily hold the hash bucket in the new table while chaining the old one in. So rehashInProgress is either 0 (rehash done), 1 (rehash in progress), or something else (rehash in progress, points to hash bucket in new table). The algorithm is this: 1. Allocate a new hashtable and set rehashInProgress to 1. 2. For each entry in the old table (OT), calculate its new hash in the new table. If the bucket is not empty, save its value in the rehashInProgress pointer. Now place the pointer to the entry in the new table. If the entry has a "next" entry. 3. Set the bucket pointer in OT to point to it. 4. Set the "next" pointer in the entry to the saved value from 2. 5. Set rehashInProgress to 1.
[ "Double", "the", "size", "of", "the", "hash", "table", "-" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java#L2768-L2799
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NFRule.java
NFRule.prefixLength
private int prefixLength(String str, String prefix) { // if we're looking for an empty prefix, it obviously matches // zero characters. Just go ahead and return 0. if (prefix.length() == 0) { return 0; } RbnfLenientScanner scanner = formatter.getLenientScanner(); if (scanner != null) { return scanner.prefixLength(str, prefix); } // If lenient parsing is turned off, forget all that crap above. // Just use String.startsWith() and be done with it. if (str.startsWith(prefix)) { return prefix.length(); } return 0; }
java
private int prefixLength(String str, String prefix) { // if we're looking for an empty prefix, it obviously matches // zero characters. Just go ahead and return 0. if (prefix.length() == 0) { return 0; } RbnfLenientScanner scanner = formatter.getLenientScanner(); if (scanner != null) { return scanner.prefixLength(str, prefix); } // If lenient parsing is turned off, forget all that crap above. // Just use String.startsWith() and be done with it. if (str.startsWith(prefix)) { return prefix.length(); } return 0; }
[ "private", "int", "prefixLength", "(", "String", "str", ",", "String", "prefix", ")", "{", "// if we're looking for an empty prefix, it obviously matches", "// zero characters. Just go ahead and return 0.", "if", "(", "prefix", ".", "length", "(", ")", "==", "0", ")", ...
Used by stripPrefix() to match characters. If lenient parse mode is off, this just calls startsWith(). If lenient parse mode is on, this function uses CollationElementIterators to match characters in the strings (only primary-order differences are significant in determining whether there's a match). @param str The string being tested @param prefix The text we're hoping to see at the beginning of "str" @return If "prefix" is found at the beginning of "str", this is the number of characters in "str" that were matched (this isn't necessarily the same as the length of "prefix" when matching text with a collator). If there's no match, this is 0.
[ "Used", "by", "stripPrefix", "()", "to", "match", "characters", ".", "If", "lenient", "parse", "mode", "is", "off", "this", "just", "calls", "startsWith", "()", ".", "If", "lenient", "parse", "mode", "is", "on", "this", "function", "uses", "CollationElementI...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NFRule.java#L1234-L1252
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/serialization/IntuitResponseDeserializerHelper.java
IntuitResponseDeserializerHelper.invokeFeature
protected void invokeFeature(String featureSwitch, Feature feature ) { if(Config.getBooleanProperty(featureSwitch,true)) { feature.execute(); } }
java
protected void invokeFeature(String featureSwitch, Feature feature ) { if(Config.getBooleanProperty(featureSwitch,true)) { feature.execute(); } }
[ "protected", "void", "invokeFeature", "(", "String", "featureSwitch", ",", "Feature", "feature", ")", "{", "if", "(", "Config", ".", "getBooleanProperty", "(", "featureSwitch", ",", "true", ")", ")", "{", "feature", ".", "execute", "(", ")", ";", "}", "}" ...
Executes feature if switch setting is on @param featureSwitch @param feature
[ "Executes", "feature", "if", "switch", "setting", "is", "on" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/serialization/IntuitResponseDeserializerHelper.java#L52-L56
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/sequences/FeatureFactory.java
FeatureFactory.addAllInterningAndSuffixing
@SuppressWarnings({"MethodMayBeStatic"}) protected void addAllInterningAndSuffixing(Collection<String> accumulator, Collection<String> addend, String suffix) { boolean nonNullSuffix = suffix != null && ! "".equals(suffix); if (nonNullSuffix) { suffix = '|' + suffix; } // boolean intern2 = flags.intern2; for (String feat : addend) { if (nonNullSuffix) { feat = feat.concat(suffix); } // if (intern2) { // feat = feat.intern(); // } accumulator.add(feat); } }
java
@SuppressWarnings({"MethodMayBeStatic"}) protected void addAllInterningAndSuffixing(Collection<String> accumulator, Collection<String> addend, String suffix) { boolean nonNullSuffix = suffix != null && ! "".equals(suffix); if (nonNullSuffix) { suffix = '|' + suffix; } // boolean intern2 = flags.intern2; for (String feat : addend) { if (nonNullSuffix) { feat = feat.concat(suffix); } // if (intern2) { // feat = feat.intern(); // } accumulator.add(feat); } }
[ "@", "SuppressWarnings", "(", "{", "\"MethodMayBeStatic\"", "}", ")", "protected", "void", "addAllInterningAndSuffixing", "(", "Collection", "<", "String", ">", "accumulator", ",", "Collection", "<", "String", ">", "addend", ",", "String", "suffix", ")", "{", "b...
Makes more complete feature names out of partial feature names, by adding a suffix to the String feature name, adding results to an accumulator @param accumulator The output features are added here @param addend The base set of features @param suffix The suffix added to each feature in the addend set
[ "Makes", "more", "complete", "feature", "names", "out", "of", "partial", "feature", "names", "by", "adding", "a", "suffix", "to", "the", "String", "feature", "name", "adding", "results", "to", "an", "accumulator" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/sequences/FeatureFactory.java#L92-L108
Azure/azure-sdk-for-java
applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/AnnotationsInner.java
AnnotationsInner.listAsync
public Observable<List<AnnotationInner>> listAsync(String resourceGroupName, String resourceName, String start, String end) { return listWithServiceResponseAsync(resourceGroupName, resourceName, start, end).map(new Func1<ServiceResponse<List<AnnotationInner>>, List<AnnotationInner>>() { @Override public List<AnnotationInner> call(ServiceResponse<List<AnnotationInner>> response) { return response.body(); } }); }
java
public Observable<List<AnnotationInner>> listAsync(String resourceGroupName, String resourceName, String start, String end) { return listWithServiceResponseAsync(resourceGroupName, resourceName, start, end).map(new Func1<ServiceResponse<List<AnnotationInner>>, List<AnnotationInner>>() { @Override public List<AnnotationInner> call(ServiceResponse<List<AnnotationInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "AnnotationInner", ">", ">", "listAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "String", "start", ",", "String", "end", ")", "{", "return", "listWithServiceResponseAsync", "(", "resourceG...
Gets the list of annotations for a component for given time range. @param resourceGroupName The name of the resource group. @param resourceName The name of the Application Insights component resource. @param start The start time to query from for annotations, cannot be older than 90 days from current date. @param end The end time to query for annotations. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;AnnotationInner&gt; object
[ "Gets", "the", "list", "of", "annotations", "for", "a", "component", "for", "given", "time", "range", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/AnnotationsInner.java#L119-L126
vkostyukov/la4j
src/main/java/org/la4j/Matrix.java
Matrix.setColumn
public void setColumn(int j, Vector column) { if (rows != column.length()) { fail("Wrong vector length: " + column.length() + ". Should be: " + rows + "."); } for (int i = 0; i < column.length(); i++) { set(i, j, column.get(i)); } }
java
public void setColumn(int j, Vector column) { if (rows != column.length()) { fail("Wrong vector length: " + column.length() + ". Should be: " + rows + "."); } for (int i = 0; i < column.length(); i++) { set(i, j, column.get(i)); } }
[ "public", "void", "setColumn", "(", "int", "j", ",", "Vector", "column", ")", "{", "if", "(", "rows", "!=", "column", ".", "length", "(", ")", ")", "{", "fail", "(", "\"Wrong vector length: \"", "+", "column", ".", "length", "(", ")", "+", "\". Should ...
Copies given {@code column} into the specified column of this matrix. @param j the column index @param column the column represented as vector
[ "Copies", "given", "{", "@code", "column", "}", "into", "the", "specified", "column", "of", "this", "matrix", "." ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L1030-L1038
percolate/caffeine
caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java
ViewUtils.appendText
public static void appendText(TextView view, String toAppend) { String currentText = getText(view); view.setText(currentText + toAppend); }
java
public static void appendText(TextView view, String toAppend) { String currentText = getText(view); view.setText(currentText + toAppend); }
[ "public", "static", "void", "appendText", "(", "TextView", "view", ",", "String", "toAppend", ")", "{", "String", "currentText", "=", "getText", "(", "view", ")", ";", "view", ".", "setText", "(", "currentText", "+", "toAppend", ")", ";", "}" ]
Append given text String to the provided view (one of TextView or EditText). @param view View to update. @param toAppend String text.
[ "Append", "given", "text", "String", "to", "the", "provided", "view", "(", "one", "of", "TextView", "or", "EditText", ")", "." ]
train
https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java#L130-L133
Crab2died/Excel4J
src/main/java/com/github/crab2died/ExcelUtils.java
ExcelUtils.readExcel2Objects
public <T> List<T> readExcel2Objects(String excelPath, Class<T> clazz, int offsetLine, int sheetIndex) throws Excel4JException, IOException, InvalidFormatException { return readExcel2Objects(excelPath, clazz, offsetLine, Integer.MAX_VALUE, sheetIndex); }
java
public <T> List<T> readExcel2Objects(String excelPath, Class<T> clazz, int offsetLine, int sheetIndex) throws Excel4JException, IOException, InvalidFormatException { return readExcel2Objects(excelPath, clazz, offsetLine, Integer.MAX_VALUE, sheetIndex); }
[ "public", "<", "T", ">", "List", "<", "T", ">", "readExcel2Objects", "(", "String", "excelPath", ",", "Class", "<", "T", ">", "clazz", ",", "int", "offsetLine", ",", "int", "sheetIndex", ")", "throws", "Excel4JException", ",", "IOException", ",", "InvalidF...
读取Excel操作基于注解映射成绑定的java对象 @param excelPath 待导出Excel的路径 @param clazz 待绑定的类(绑定属性注解{@link com.github.crab2died.annotation.ExcelField}) @param offsetLine Excel表头行(默认是0) @param sheetIndex Sheet索引(默认0) @param <T> 绑定的数据类 @return 返回转换为设置绑定的java对象集合 @throws Excel4JException 异常 @throws IOException 异常 @throws InvalidFormatException 异常 @author Crab2Died
[ "读取Excel操作基于注解映射成绑定的java对象" ]
train
https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L173-L176
KayLerch/alexa-skills-kit-tellask-java
src/main/java/io/klerch/alexa/tellask/model/AlexaInput.java
AlexaInput.hasSlotIsDoubleMetaphoneEqual
public boolean hasSlotIsDoubleMetaphoneEqual(final String slotName, final String value) { final String slotValue = getSlotValue(slotName); return hasSlotNotBlank(slotName) && value != null && new DoubleMetaphone().isDoubleMetaphoneEqual(slotValue, value); }
java
public boolean hasSlotIsDoubleMetaphoneEqual(final String slotName, final String value) { final String slotValue = getSlotValue(slotName); return hasSlotNotBlank(slotName) && value != null && new DoubleMetaphone().isDoubleMetaphoneEqual(slotValue, value); }
[ "public", "boolean", "hasSlotIsDoubleMetaphoneEqual", "(", "final", "String", "slotName", ",", "final", "String", "value", ")", "{", "final", "String", "slotValue", "=", "getSlotValue", "(", "slotName", ")", ";", "return", "hasSlotNotBlank", "(", "slotName", ")", ...
Checks if a slot is contained in the intent request and has a value which is a phonetic sibling of the string given to this method. Double metaphone algorithm is optimized for English language and in this case is used to match slot value with value given to this method. @param slotName name of the slot to look after @param value the value @return True, if slot value and given value are phonetically equal with Double metaphone algorithm
[ "Checks", "if", "a", "slot", "is", "contained", "in", "the", "intent", "request", "and", "has", "a", "value", "which", "is", "a", "phonetic", "sibling", "of", "the", "string", "given", "to", "this", "method", ".", "Double", "metaphone", "algorithm", "is", ...
train
https://github.com/KayLerch/alexa-skills-kit-tellask-java/blob/2c19028e775c2512dd4649d12962c0b48bf7f2bc/src/main/java/io/klerch/alexa/tellask/model/AlexaInput.java#L138-L142
lucidworks/spark-solr
src/main/java/com/lucidworks/spark/query/SolrTermVector.java
SolrTermVector.newInstance
public static SolrTermVector newInstance(String docId, HashingTF hashingTF, NamedList<Object> termList) { int termCount = termList.size(); int[] indices = new int[termCount]; double[] weights = new double[termCount]; String[] terms = new String[termCount]; Iterator<Map.Entry<String,Object>> termsIter = termList.iterator(); int idx = -1; while (termsIter.hasNext()) { Map.Entry<String,Object> termEntry = termsIter.next(); double weight = 0d; Object termVal = termEntry.getValue(); if (termVal instanceof NamedList) { Object w = ((NamedList)termVal).get("tf-idf"); if (w != null) { weight = (w instanceof Number) ? ((Number)w).doubleValue() : Double.parseDouble(w.toString()); } } ++idx; String term = termEntry.getKey(); terms[idx] = term; indices[idx] = hashingTF.indexOf(term); weights[idx] = weight; } return new SolrTermVector(docId, terms, hashingTF.numFeatures(), indices, weights); }
java
public static SolrTermVector newInstance(String docId, HashingTF hashingTF, NamedList<Object> termList) { int termCount = termList.size(); int[] indices = new int[termCount]; double[] weights = new double[termCount]; String[] terms = new String[termCount]; Iterator<Map.Entry<String,Object>> termsIter = termList.iterator(); int idx = -1; while (termsIter.hasNext()) { Map.Entry<String,Object> termEntry = termsIter.next(); double weight = 0d; Object termVal = termEntry.getValue(); if (termVal instanceof NamedList) { Object w = ((NamedList)termVal).get("tf-idf"); if (w != null) { weight = (w instanceof Number) ? ((Number)w).doubleValue() : Double.parseDouble(w.toString()); } } ++idx; String term = termEntry.getKey(); terms[idx] = term; indices[idx] = hashingTF.indexOf(term); weights[idx] = weight; } return new SolrTermVector(docId, terms, hashingTF.numFeatures(), indices, weights); }
[ "public", "static", "SolrTermVector", "newInstance", "(", "String", "docId", ",", "HashingTF", "hashingTF", ",", "NamedList", "<", "Object", ">", "termList", ")", "{", "int", "termCount", "=", "termList", ".", "size", "(", ")", ";", "int", "[", "]", "indic...
Converts doc-level term vector information the Solr QueryResponse into a SolrTermVector.
[ "Converts", "doc", "-", "level", "term", "vector", "information", "the", "Solr", "QueryResponse", "into", "a", "SolrTermVector", "." ]
train
https://github.com/lucidworks/spark-solr/blob/8ff1b3cdd99041be6070077c18ec9c1cd7257cc3/src/main/java/com/lucidworks/spark/query/SolrTermVector.java#L31-L58
nobuoka/android-lib-ZXingCaptureActivity
src/main/java/info/vividcode/android/zxing/CaptureActivityIntents.java
CaptureActivityIntents.setResultDisplayDurationInMs
public static void setResultDisplayDurationInMs(Intent intent, long duration) { intent.putExtra(Intents.Scan.RESULT_DISPLAY_DURATION_MS, duration); }
java
public static void setResultDisplayDurationInMs(Intent intent, long duration) { intent.putExtra(Intents.Scan.RESULT_DISPLAY_DURATION_MS, duration); }
[ "public", "static", "void", "setResultDisplayDurationInMs", "(", "Intent", "intent", ",", "long", "duration", ")", "{", "intent", ".", "putExtra", "(", "Intents", ".", "Scan", ".", "RESULT_DISPLAY_DURATION_MS", ",", "duration", ")", ";", "}" ]
Set desired duration for which to pause after a successful scan to {@code Intent}. @param intent Target intent. @param duration Desired duration in milliseconds.
[ "Set", "desired", "duration", "for", "which", "to", "pause", "after", "a", "successful", "scan", "to", "{" ]
train
https://github.com/nobuoka/android-lib-ZXingCaptureActivity/blob/17aaa7cf75520d3f2e03db9796b7e8c1d1f1b1e6/src/main/java/info/vividcode/android/zxing/CaptureActivityIntents.java#L194-L196
codeprimate-software/cp-elements
src/main/java/org/cp/elements/process/ProcessAdapter.java
ProcessAdapter.newProcessAdapter
public static ProcessAdapter newProcessAdapter(Process process) { return newProcessAdapter(process, newProcessContext(process).ranBy(SystemUtils.USERNAME) .ranIn(FileSystemUtils.WORKING_DIRECTORY).usingEnvironmentVariables()); }
java
public static ProcessAdapter newProcessAdapter(Process process) { return newProcessAdapter(process, newProcessContext(process).ranBy(SystemUtils.USERNAME) .ranIn(FileSystemUtils.WORKING_DIRECTORY).usingEnvironmentVariables()); }
[ "public", "static", "ProcessAdapter", "newProcessAdapter", "(", "Process", "process", ")", "{", "return", "newProcessAdapter", "(", "process", ",", "newProcessContext", "(", "process", ")", ".", "ranBy", "(", "SystemUtils", ".", "USERNAME", ")", ".", "ranIn", "(...
Factory method used to construct an instance of {@link ProcessAdapter} initialized with the given {@link Process}. @param process {@link Process} object to adapt/wrap with an instance of {@link ProcessAdapter}. @return a newly constructed {@link ProcessAdapter} adapting/wrapping the given {@link Process}. @throws IllegalArgumentException if {@link Process} is {@literal null}. @see #newProcessAdapter(Process, ProcessContext) @see java.lang.Process
[ "Factory", "method", "used", "to", "construct", "an", "instance", "of", "{", "@link", "ProcessAdapter", "}", "initialized", "with", "the", "given", "{", "@link", "Process", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/process/ProcessAdapter.java#L96-L99
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/spatial/geometry/GeometryFactory.java
GeometryFactory.createPolygon
public Polygon createPolygon(Bbox bbox) { Coordinate tl = new Coordinate(bbox.getX(), bbox.getY()); Coordinate tr = new Coordinate(bbox.getX() + bbox.getWidth(), bbox.getY()); Coordinate br = new Coordinate(bbox.getX() + bbox.getWidth(), bbox.getY() + bbox.getHeight()); Coordinate bl = new Coordinate(bbox.getX(), bbox.getY() + bbox.getHeight()); return new Polygon(srid, precision, new LinearRing(srid, precision, new Coordinate[] { tl, tr, br, bl, tl }), null); }
java
public Polygon createPolygon(Bbox bbox) { Coordinate tl = new Coordinate(bbox.getX(), bbox.getY()); Coordinate tr = new Coordinate(bbox.getX() + bbox.getWidth(), bbox.getY()); Coordinate br = new Coordinate(bbox.getX() + bbox.getWidth(), bbox.getY() + bbox.getHeight()); Coordinate bl = new Coordinate(bbox.getX(), bbox.getY() + bbox.getHeight()); return new Polygon(srid, precision, new LinearRing(srid, precision, new Coordinate[] { tl, tr, br, bl, tl }), null); }
[ "public", "Polygon", "createPolygon", "(", "Bbox", "bbox", ")", "{", "Coordinate", "tl", "=", "new", "Coordinate", "(", "bbox", ".", "getX", "(", ")", ",", "bbox", ".", "getY", "(", ")", ")", ";", "Coordinate", "tr", "=", "new", "Coordinate", "(", "b...
Create a new {@link Polygon} from a {@link Bbox}. @param bbox Bounding box to convert into a {@link Polygon}. @return Returns a {@link Polygon} object.
[ "Create", "a", "new", "{", "@link", "Polygon", "}", "from", "a", "{", "@link", "Bbox", "}", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/GeometryFactory.java#L196-L203
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/ModulesInner.java
ModulesInner.updateAsync
public Observable<ModuleInner> updateAsync(String resourceGroupName, String automationAccountName, String moduleName, ModuleUpdateParameters parameters) { return updateWithServiceResponseAsync(resourceGroupName, automationAccountName, moduleName, parameters).map(new Func1<ServiceResponse<ModuleInner>, ModuleInner>() { @Override public ModuleInner call(ServiceResponse<ModuleInner> response) { return response.body(); } }); }
java
public Observable<ModuleInner> updateAsync(String resourceGroupName, String automationAccountName, String moduleName, ModuleUpdateParameters parameters) { return updateWithServiceResponseAsync(resourceGroupName, automationAccountName, moduleName, parameters).map(new Func1<ServiceResponse<ModuleInner>, ModuleInner>() { @Override public ModuleInner call(ServiceResponse<ModuleInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ModuleInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "moduleName", ",", "ModuleUpdateParameters", "parameters", ")", "{", "return", "updateWithServiceResponseAsync", "(",...
Update the module identified by module name. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param moduleName The name of module. @param parameters The update parameters for module. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ModuleInner object
[ "Update", "the", "module", "identified", "by", "module", "name", "." ]
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/ModulesInner.java#L415-L422
lastaflute/lasta-di
src/main/java/org/lastaflute/di/util/LdiSrl.java
LdiSrl.initBeansProp
public static String initBeansProp(String capitalizedName) { // according to Java Beans rule assertObjectNotNull("capitalizedName", capitalizedName); if (is_Null_or_TrimmedEmpty(capitalizedName)) { return capitalizedName; } if (isInitTwoUpperCase(capitalizedName)) { // for example, 'EMecha' return capitalizedName; } return initUncap(capitalizedName); }
java
public static String initBeansProp(String capitalizedName) { // according to Java Beans rule assertObjectNotNull("capitalizedName", capitalizedName); if (is_Null_or_TrimmedEmpty(capitalizedName)) { return capitalizedName; } if (isInitTwoUpperCase(capitalizedName)) { // for example, 'EMecha' return capitalizedName; } return initUncap(capitalizedName); }
[ "public", "static", "String", "initBeansProp", "(", "String", "capitalizedName", ")", "{", "// according to Java Beans rule", "assertObjectNotNull", "(", "\"capitalizedName\"", ",", "capitalizedName", ")", ";", "if", "(", "is_Null_or_TrimmedEmpty", "(", "capitalizedName", ...
Adjust initial character(s) as beans property. <br> Basically same as initUncap() method except only when it starts with two upper case character, for example, 'EMecha' @param capitalizedName The capitalized name for beans property. (NotNull) @return The name as beans property that initial is adjusted. (NotNull)
[ "Adjust", "initial", "character", "(", "s", ")", "as", "beans", "property", ".", "<br", ">", "Basically", "same", "as", "initUncap", "()", "method", "except", "only", "when", "it", "starts", "with", "two", "upper", "case", "character", "for", "example", "E...
train
https://github.com/lastaflute/lasta-di/blob/c4e123610c53a04cc836c5e456660e32d613447b/src/main/java/org/lastaflute/di/util/LdiSrl.java#L2051-L2060
vtatai/srec
core/src/main/java/com/github/srec/command/method/MethodCommand.java
MethodCommand.asString
protected String asString(String name, Map<String, Value> params, ExecutionContext context) { return coerceToString(params.get(name), context); }
java
protected String asString(String name, Map<String, Value> params, ExecutionContext context) { return coerceToString(params.get(name), context); }
[ "protected", "String", "asString", "(", "String", "name", ",", "Map", "<", "String", ",", "Value", ">", "params", ",", "ExecutionContext", "context", ")", "{", "return", "coerceToString", "(", "params", ".", "get", "(", "name", ")", ",", "context", ")", ...
Gets a parameter value as a Java String. @param name The parameter name @param params The parameters @param context The EC @return The String
[ "Gets", "a", "parameter", "value", "as", "a", "Java", "String", "." ]
train
https://github.com/vtatai/srec/blob/87fa6754a6a5f8569ef628db4d149eea04062568/core/src/main/java/com/github/srec/command/method/MethodCommand.java#L163-L165
gocd/gocd
config/config-api/src/main/java/com/thoughtworks/go/config/PathFromAncestor.java
PathFromAncestor.getDirectParentName
public CaseInsensitiveString getDirectParentName() { String stringPath = path(); if (stringPath == null) { return null; } int index = stringPath.lastIndexOf(DELIMITER); return index == -1 ? path : new CaseInsensitiveString(stringPath.substring(index + 1, stringPath.length())); }
java
public CaseInsensitiveString getDirectParentName() { String stringPath = path(); if (stringPath == null) { return null; } int index = stringPath.lastIndexOf(DELIMITER); return index == -1 ? path : new CaseInsensitiveString(stringPath.substring(index + 1, stringPath.length())); }
[ "public", "CaseInsensitiveString", "getDirectParentName", "(", ")", "{", "String", "stringPath", "=", "path", "(", ")", ";", "if", "(", "stringPath", "==", "null", ")", "{", "return", "null", ";", "}", "int", "index", "=", "stringPath", ".", "lastIndexOf", ...
cache parent name if required (like ancestor). currently used only for UI.
[ "cache", "parent", "name", "if", "required", "(", "like", "ancestor", ")", ".", "currently", "used", "only", "for", "UI", "." ]
train
https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/config/config-api/src/main/java/com/thoughtworks/go/config/PathFromAncestor.java#L75-L82
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/utils/ResourceUtils.java
ResourceUtils.findInstanceResourcesDirectory
public static File findInstanceResourcesDirectory( File applicationFilesDirectory, Component component ) { File root = new File( applicationFilesDirectory, Constants.PROJECT_DIR_GRAPH ); File result = new File( "No recipe directory." ); Set<Component> alreadyChecked = new HashSet<> (); for( Component c = component; c != null; c = c.getExtendedComponent()) { // Prevent infinite loops for exotic cases if( alreadyChecked.contains( c )) break; alreadyChecked.add( c ); if(( result = new File( root, c.getName())).exists()) break; } return result; }
java
public static File findInstanceResourcesDirectory( File applicationFilesDirectory, Component component ) { File root = new File( applicationFilesDirectory, Constants.PROJECT_DIR_GRAPH ); File result = new File( "No recipe directory." ); Set<Component> alreadyChecked = new HashSet<> (); for( Component c = component; c != null; c = c.getExtendedComponent()) { // Prevent infinite loops for exotic cases if( alreadyChecked.contains( c )) break; alreadyChecked.add( c ); if(( result = new File( root, c.getName())).exists()) break; } return result; }
[ "public", "static", "File", "findInstanceResourcesDirectory", "(", "File", "applicationFilesDirectory", ",", "Component", "component", ")", "{", "File", "root", "=", "new", "File", "(", "applicationFilesDirectory", ",", "Constants", ".", "PROJECT_DIR_GRAPH", ")", ";",...
Finds the resource directory for an instance. <p> The resource directory may be the one of another component. This is the case when a component extends another component. </p> <p> An extending component can override the resource directory. </p> @param applicationFilesDirectory the application's directory @param component a component (may be null) @return a non-null file (that may not exist)
[ "Finds", "the", "resource", "directory", "for", "an", "instance", ".", "<p", ">", "The", "resource", "directory", "may", "be", "the", "one", "of", "another", "component", ".", "This", "is", "the", "case", "when", "a", "component", "extends", "another", "co...
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/ResourceUtils.java#L135-L151
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java
TaskExecutor.onStop
@Override public CompletableFuture<Void> onStop() { log.info("Stopping TaskExecutor {}.", getAddress()); Throwable throwable = null; if (resourceManagerConnection != null) { resourceManagerConnection.close(); } for (JobManagerConnection jobManagerConnection : jobManagerConnections.values()) { try { disassociateFromJobManager(jobManagerConnection, new FlinkException("The TaskExecutor is shutting down.")); } catch (Throwable t) { throwable = ExceptionUtils.firstOrSuppressed(t, throwable); } } jobManagerHeartbeatManager.stop(); resourceManagerHeartbeatManager.stop(); try { stopTaskExecutorServices(); } catch (Exception e) { throwable = ExceptionUtils.firstOrSuppressed(e, throwable); } if (throwable != null) { return FutureUtils.completedExceptionally(new FlinkException("Error while shutting the TaskExecutor down.", throwable)); } else { log.info("Stopped TaskExecutor {}.", getAddress()); return CompletableFuture.completedFuture(null); } }
java
@Override public CompletableFuture<Void> onStop() { log.info("Stopping TaskExecutor {}.", getAddress()); Throwable throwable = null; if (resourceManagerConnection != null) { resourceManagerConnection.close(); } for (JobManagerConnection jobManagerConnection : jobManagerConnections.values()) { try { disassociateFromJobManager(jobManagerConnection, new FlinkException("The TaskExecutor is shutting down.")); } catch (Throwable t) { throwable = ExceptionUtils.firstOrSuppressed(t, throwable); } } jobManagerHeartbeatManager.stop(); resourceManagerHeartbeatManager.stop(); try { stopTaskExecutorServices(); } catch (Exception e) { throwable = ExceptionUtils.firstOrSuppressed(e, throwable); } if (throwable != null) { return FutureUtils.completedExceptionally(new FlinkException("Error while shutting the TaskExecutor down.", throwable)); } else { log.info("Stopped TaskExecutor {}.", getAddress()); return CompletableFuture.completedFuture(null); } }
[ "@", "Override", "public", "CompletableFuture", "<", "Void", ">", "onStop", "(", ")", "{", "log", ".", "info", "(", "\"Stopping TaskExecutor {}.\"", ",", "getAddress", "(", ")", ")", ";", "Throwable", "throwable", "=", "null", ";", "if", "(", "resourceManage...
Called to shut down the TaskManager. The method closes all TaskManager services.
[ "Called", "to", "shut", "down", "the", "TaskManager", ".", "The", "method", "closes", "all", "TaskManager", "services", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java#L328-L362
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/style/marker/PrettyMarkers.java
PrettyMarkers.plotUncolored
protected void plotUncolored(SVGPlot plot, Element parent, double x, double y, double size) { Element marker = plot.svgCircle(x, y, size * .5); SVGUtil.setStyle(marker, SVGConstants.CSS_FILL_PROPERTY + ":" + dotcolor); parent.appendChild(marker); }
java
protected void plotUncolored(SVGPlot plot, Element parent, double x, double y, double size) { Element marker = plot.svgCircle(x, y, size * .5); SVGUtil.setStyle(marker, SVGConstants.CSS_FILL_PROPERTY + ":" + dotcolor); parent.appendChild(marker); }
[ "protected", "void", "plotUncolored", "(", "SVGPlot", "plot", ",", "Element", "parent", ",", "double", "x", ",", "double", "y", ",", "double", "size", ")", "{", "Element", "marker", "=", "plot", ".", "svgCircle", "(", "x", ",", "y", ",", "size", "*", ...
Plot a replacement marker when no color is set; usually black @param plot Plot to draw to @param parent Parent element @param x X position @param y Y position @param size Size
[ "Plot", "a", "replacement", "marker", "when", "no", "color", "is", "set", ";", "usually", "black" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/style/marker/PrettyMarkers.java#L266-L270
h2oai/h2o-3
h2o-core/src/main/java/jsr166y/ForkJoinTask.java
ForkJoinTask.compareAndSetForkJoinTaskTag
public final boolean compareAndSetForkJoinTaskTag(short e, short tag) { for (int s;;) { if ((short)(s = status) != e) return false; if (U.compareAndSwapInt(this, STATUS, s, (s & ~SMASK) | (tag & SMASK))) return true; } }
java
public final boolean compareAndSetForkJoinTaskTag(short e, short tag) { for (int s;;) { if ((short)(s = status) != e) return false; if (U.compareAndSwapInt(this, STATUS, s, (s & ~SMASK) | (tag & SMASK))) return true; } }
[ "public", "final", "boolean", "compareAndSetForkJoinTaskTag", "(", "short", "e", ",", "short", "tag", ")", "{", "for", "(", "int", "s", ";", ";", ")", "{", "if", "(", "(", "short", ")", "(", "s", "=", "status", ")", "!=", "e", ")", "return", "false...
Atomically conditionally sets the tag value for this task. Among other applications, tags can be used as visit markers in tasks operating on graphs, as in methods that check: {@code if (task.compareAndSetForkJoinTaskTag((short)0, (short)1))} before processing, otherwise exiting because the node has already been visited. @param e the expected tag value @param tag the new tag value @return true if successful; i.e., the current value was equal to e and is now tag. @since 1.8
[ "Atomically", "conditionally", "sets", "the", "tag", "value", "for", "this", "task", ".", "Among", "other", "applications", "tags", "can", "be", "used", "as", "visit", "markers", "in", "tasks", "operating", "on", "graphs", "as", "in", "methods", "that", "che...
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/jsr166y/ForkJoinTask.java#L1383-L1391
apache/groovy
src/main/groovy/groovy/lang/MetaClassImpl.java
MetaClassImpl.getAttribute
public Object getAttribute(Class sender, Object object, String attribute, boolean useSuper, boolean fromInsideClass) { checkInitalised(); boolean isStatic = theClass != Class.class && object instanceof Class; if (isStatic && object != theClass) { MetaClass mc = registry.getMetaClass((Class) object); return mc.getAttribute(sender, object, attribute, useSuper); } MetaProperty mp = getMetaProperty(sender, attribute, useSuper, isStatic); if (mp != null) { if (mp instanceof MetaBeanProperty) { MetaBeanProperty mbp = (MetaBeanProperty) mp; mp = mbp.getField(); } try { // delegate the get operation to the metaproperty if (mp != null) return mp.getProperty(object); } catch (Exception e) { throw new GroovyRuntimeException("Cannot read field: " + attribute, e); } } throw new MissingFieldException(attribute, theClass); }
java
public Object getAttribute(Class sender, Object object, String attribute, boolean useSuper, boolean fromInsideClass) { checkInitalised(); boolean isStatic = theClass != Class.class && object instanceof Class; if (isStatic && object != theClass) { MetaClass mc = registry.getMetaClass((Class) object); return mc.getAttribute(sender, object, attribute, useSuper); } MetaProperty mp = getMetaProperty(sender, attribute, useSuper, isStatic); if (mp != null) { if (mp instanceof MetaBeanProperty) { MetaBeanProperty mbp = (MetaBeanProperty) mp; mp = mbp.getField(); } try { // delegate the get operation to the metaproperty if (mp != null) return mp.getProperty(object); } catch (Exception e) { throw new GroovyRuntimeException("Cannot read field: " + attribute, e); } } throw new MissingFieldException(attribute, theClass); }
[ "public", "Object", "getAttribute", "(", "Class", "sender", ",", "Object", "object", ",", "String", "attribute", ",", "boolean", "useSuper", ",", "boolean", "fromInsideClass", ")", "{", "checkInitalised", "(", ")", ";", "boolean", "isStatic", "=", "theClass", ...
Retrieves the value of an attribute (field). This method is to support the Groovy runtime and not for general client API usage. @param sender The class of the object that requested the attribute @param object The instance the attribute is to be retrieved from @param attribute The name of the attribute @param useSuper Whether to look-up on the super class or not @param fromInsideClass Whether the call was invoked from the inside or the outside of the class. @return The attribute value
[ "Retrieves", "the", "value", "of", "an", "attribute", "(", "field", ")", ".", "This", "method", "is", "to", "support", "the", "Groovy", "runtime", "and", "not", "for", "general", "client", "API", "usage", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/MetaClassImpl.java#L2912-L2937
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/cash/ParameterizationFunction.java
ParameterizationFunction.sinusProduct
public static double sinusProduct(int start, int end, double[] alpha) { double result = 1; for(int j = start; j < end; j++) { result *= FastMath.sin(alpha[j]); } return result; }
java
public static double sinusProduct(int start, int end, double[] alpha) { double result = 1; for(int j = start; j < end; j++) { result *= FastMath.sin(alpha[j]); } return result; }
[ "public", "static", "double", "sinusProduct", "(", "int", "start", ",", "int", "end", ",", "double", "[", "]", "alpha", ")", "{", "double", "result", "=", "1", ";", "for", "(", "int", "j", "=", "start", ";", "j", "<", "end", ";", "j", "++", ")", ...
Computes the product of all sinus values of the specified angles from start to end index. @param start the index to start @param end the index to end @param alpha the array of angles @return the product of all sinus values of the specified angles from start to end index
[ "Computes", "the", "product", "of", "all", "sinus", "values", "of", "the", "specified", "angles", "from", "start", "to", "end", "index", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/cash/ParameterizationFunction.java#L428-L434
Azure/azure-sdk-for-java
recoveryservices/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/v2016_06_01/implementation/VaultsInner.java
VaultsInner.getByResourceGroupAsync
public Observable<VaultInner> getByResourceGroupAsync(String resourceGroupName, String vaultName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, vaultName).map(new Func1<ServiceResponse<VaultInner>, VaultInner>() { @Override public VaultInner call(ServiceResponse<VaultInner> response) { return response.body(); } }); }
java
public Observable<VaultInner> getByResourceGroupAsync(String resourceGroupName, String vaultName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, vaultName).map(new Func1<ServiceResponse<VaultInner>, VaultInner>() { @Override public VaultInner call(ServiceResponse<VaultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VaultInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "vaultName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "vaultName", ")", ".", "map", "(",...
Get the Vault details. @param resourceGroupName The name of the resource group where the recovery services vault is present. @param vaultName The name of the recovery services vault. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VaultInner object
[ "Get", "the", "Vault", "details", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/v2016_06_01/implementation/VaultsInner.java#L360-L367
opencb/biodata
biodata-tools/src/main/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataUtils.java
VariantMetadataUtils.readVariantFileMetadata
public static VariantFileMetadata readVariantFileMetadata(Path path, VariantFileMetadata fileMetadata) throws IOException { Objects.requireNonNull(path); try (InputStream is = FileUtils.newInputStream(path)) { return readVariantFileMetadata(new VariantVcfHtsjdkReader(is, fileMetadata.toVariantStudyMetadata("")), fileMetadata); } }
java
public static VariantFileMetadata readVariantFileMetadata(Path path, VariantFileMetadata fileMetadata) throws IOException { Objects.requireNonNull(path); try (InputStream is = FileUtils.newInputStream(path)) { return readVariantFileMetadata(new VariantVcfHtsjdkReader(is, fileMetadata.toVariantStudyMetadata("")), fileMetadata); } }
[ "public", "static", "VariantFileMetadata", "readVariantFileMetadata", "(", "Path", "path", ",", "VariantFileMetadata", "fileMetadata", ")", "throws", "IOException", "{", "Objects", ".", "requireNonNull", "(", "path", ")", ";", "try", "(", "InputStream", "is", "=", ...
Reads the VariantSource from a Vcf file given a file Path @param path Path to the Vcf file @param fileMetadata Optional fileMetadata to fill up @return The read variant fileMetadata @throws IOException if an I/O error occurs
[ "Reads", "the", "VariantSource", "from", "a", "Vcf", "file", "given", "a", "file", "Path" ]
train
https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataUtils.java#L61-L66
apache/incubator-gobblin
gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinHelixDistributeJobExecutionLauncher.java
GobblinHelixDistributeJobExecutionLauncher.submitJobToHelix
private void submitJobToHelix(String jobName, String jobId, JobConfig.Builder jobConfigBuilder) throws Exception { TaskDriver taskDriver = new TaskDriver(this.planningJobHelixManager); HelixUtils.submitJobToWorkFlow(jobConfigBuilder, jobName, jobId, taskDriver, this.planningJobHelixManager, this.workFlowExpiryTimeSeconds); this.jobSubmitted = true; }
java
private void submitJobToHelix(String jobName, String jobId, JobConfig.Builder jobConfigBuilder) throws Exception { TaskDriver taskDriver = new TaskDriver(this.planningJobHelixManager); HelixUtils.submitJobToWorkFlow(jobConfigBuilder, jobName, jobId, taskDriver, this.planningJobHelixManager, this.workFlowExpiryTimeSeconds); this.jobSubmitted = true; }
[ "private", "void", "submitJobToHelix", "(", "String", "jobName", ",", "String", "jobId", ",", "JobConfig", ".", "Builder", "jobConfigBuilder", ")", "throws", "Exception", "{", "TaskDriver", "taskDriver", "=", "new", "TaskDriver", "(", "this", ".", "planningJobHeli...
Submit a planning job to helix so that it can launched from a remote node. @param jobName A planning job name which has prefix {@link GobblinClusterConfigurationKeys#PLANNING_JOB_NAME_PREFIX}. @param jobId A planning job id created by {@link GobblinHelixDistributeJobExecutionLauncher#getPlanningJobId}. @param jobConfigBuilder A job config builder which contains a single task.
[ "Submit", "a", "planning", "job", "to", "helix", "so", "that", "it", "can", "launched", "from", "a", "remote", "node", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinHelixDistributeJobExecutionLauncher.java#L252-L261
meltmedia/cadmium
cli/src/main/java/com/meltmedia/cadmium/cli/BranchCreator.java
BranchCreator.createNewBranch
private void createNewBranch(String prefix, String basename, boolean empty, Logger log) throws Exception { String currentBranch = clonedRemote.getBranchName(); String newBranchName = (StringUtils.isNotBlank(prefix)?prefix.trim()+"-":"")+basename.trim(); String oldBranchName = (StringUtils.isNotBlank(prefix)?prefix.trim()+"-":"")+currentBranch; try { if(!empty) { log.info("Switching to {}", oldBranchName); clonedRemote.switchBranch(oldBranchName); log.info("Creating new branch {}", newBranchName); clonedRemote.newRemoteBranch(newBranchName); } else { log.info("Creating new empty branch {}", newBranchName); clonedRemote.newEmtpyRemoteBranch(newBranchName); } } finally { if(!empty) { log.info("Switching back to {}", currentBranch); clonedRemote.switchBranch(currentBranch); } } }
java
private void createNewBranch(String prefix, String basename, boolean empty, Logger log) throws Exception { String currentBranch = clonedRemote.getBranchName(); String newBranchName = (StringUtils.isNotBlank(prefix)?prefix.trim()+"-":"")+basename.trim(); String oldBranchName = (StringUtils.isNotBlank(prefix)?prefix.trim()+"-":"")+currentBranch; try { if(!empty) { log.info("Switching to {}", oldBranchName); clonedRemote.switchBranch(oldBranchName); log.info("Creating new branch {}", newBranchName); clonedRemote.newRemoteBranch(newBranchName); } else { log.info("Creating new empty branch {}", newBranchName); clonedRemote.newEmtpyRemoteBranch(newBranchName); } } finally { if(!empty) { log.info("Switching back to {}", currentBranch); clonedRemote.switchBranch(currentBranch); } } }
[ "private", "void", "createNewBranch", "(", "String", "prefix", ",", "String", "basename", ",", "boolean", "empty", ",", "Logger", "log", ")", "throws", "Exception", "{", "String", "currentBranch", "=", "clonedRemote", ".", "getBranchName", "(", ")", ";", "Stri...
Creates a new branch with the name formatted as <i>prefix</i>-<i>basename</i> if prefix is null then just the basename is used. If empty is true then the new branch will be empty otherwise it will created from a branch with the same formatted name but a basename of master. @param prefix @param basename @param empty @param log @throws Exception
[ "Creates", "a", "new", "branch", "with", "the", "name", "formatted", "as", "<i", ">", "prefix<", "/", "i", ">", "-", "<i", ">", "basename<", "/", "i", ">", "if", "prefix", "is", "null", "then", "just", "the", "basename", "is", "used", ".", "If", "e...
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/cli/src/main/java/com/meltmedia/cadmium/cli/BranchCreator.java#L96-L116
JodaOrg/joda-beans
src/main/java/org/joda/beans/ser/json/AbstractJsonReader.java
AbstractJsonReader.parseRoot
<T> T parseRoot(JsonInput input, Class<T> declaredType) throws Exception { this.input = input; Object parsed = parseObject(input.acceptEvent(JsonEvent.OBJECT), declaredType, null, null, null, true); return declaredType.cast(parsed); }
java
<T> T parseRoot(JsonInput input, Class<T> declaredType) throws Exception { this.input = input; Object parsed = parseObject(input.acceptEvent(JsonEvent.OBJECT), declaredType, null, null, null, true); return declaredType.cast(parsed); }
[ "<", "T", ">", "T", "parseRoot", "(", "JsonInput", "input", ",", "Class", "<", "T", ">", "declaredType", ")", "throws", "Exception", "{", "this", ".", "input", "=", "input", ";", "Object", "parsed", "=", "parseObject", "(", "input", ".", "acceptEvent", ...
Parses the root bean. @param input the JSON input @param declaredType the declared type, not null @return the bean, not null @throws Exception if an error occurs
[ "Parses", "the", "root", "bean", "." ]
train
https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/ser/json/AbstractJsonReader.java#L84-L88
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.addSummaryComment
public void addSummaryComment(Doc doc, Content htmltree) { addSummaryComment(doc, doc.firstSentenceTags(), htmltree); }
java
public void addSummaryComment(Doc doc, Content htmltree) { addSummaryComment(doc, doc.firstSentenceTags(), htmltree); }
[ "public", "void", "addSummaryComment", "(", "Doc", "doc", ",", "Content", "htmltree", ")", "{", "addSummaryComment", "(", "doc", ",", "doc", ".", "firstSentenceTags", "(", ")", ",", "htmltree", ")", ";", "}" ]
Adds the summary content. @param doc the doc for which the summary will be generated @param htmltree the documentation tree to which the summary will be added
[ "Adds", "the", "summary", "content", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L1440-L1442
czyzby/gdx-lml
lml/src/main/java/com/github/czyzby/lml/parser/impl/tag/Dtd.java
Dtd.getDtdSchema
public void getDtdSchema(final LmlParser parser, final Appendable builder) throws IOException { appendActorTags(builder, parser); appendActorAttributes(parser, builder); appendMacroTags(builder, parser); appendMacroAttributes(parser, builder); }
java
public void getDtdSchema(final LmlParser parser, final Appendable builder) throws IOException { appendActorTags(builder, parser); appendActorAttributes(parser, builder); appendMacroTags(builder, parser); appendMacroAttributes(parser, builder); }
[ "public", "void", "getDtdSchema", "(", "final", "LmlParser", "parser", ",", "final", "Appendable", "builder", ")", "throws", "IOException", "{", "appendActorTags", "(", "builder", ",", "parser", ")", ";", "appendActorAttributes", "(", "parser", ",", "builder", "...
Creates DTD schema file containing all possible tags and their attributes. Any problems with the generation will be logged. This is a relatively heavy operation and should be done only during development. @param parser contains parsing data. Used to create mock-up actors. The skin MUST be fully loaded and contain all used actors' styles for the generator to work properly. @param builder values will be appended to this object. @throws IOException when unable to append.
[ "Creates", "DTD", "schema", "file", "containing", "all", "possible", "tags", "and", "their", "attributes", ".", "Any", "problems", "with", "the", "generation", "will", "be", "logged", ".", "This", "is", "a", "relatively", "heavy", "operation", "and", "should",...
train
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/lml/src/main/java/com/github/czyzby/lml/parser/impl/tag/Dtd.java#L108-L113
m-m-m/util
pojo/src/main/java/net/sf/mmm/util/pojo/descriptor/impl/PojoMethodIntrospectorImpl.java
PojoMethodIntrospectorImpl.collectInterfaces
private static void collectInterfaces(Class<?> type, Set<Class<?>> interfaceSet, Set<Class<?>> excludeSet) { for (Class<?> interfaceClass : type.getInterfaces()) { if ((excludeSet == null) || (!excludeSet.contains(interfaceClass))) { interfaceSet.add(interfaceClass); } collectInterfaces(interfaceClass, interfaceSet, excludeSet); } }
java
private static void collectInterfaces(Class<?> type, Set<Class<?>> interfaceSet, Set<Class<?>> excludeSet) { for (Class<?> interfaceClass : type.getInterfaces()) { if ((excludeSet == null) || (!excludeSet.contains(interfaceClass))) { interfaceSet.add(interfaceClass); } collectInterfaces(interfaceClass, interfaceSet, excludeSet); } }
[ "private", "static", "void", "collectInterfaces", "(", "Class", "<", "?", ">", "type", ",", "Set", "<", "Class", "<", "?", ">", ">", "interfaceSet", ",", "Set", "<", "Class", "<", "?", ">", ">", "excludeSet", ")", "{", "for", "(", "Class", "<", "?"...
Recursively collects all {@link Class#getInterfaces() interfaces} starting from the given {@code type}. @param type is the {@link Class} for which all {@link Class#getInterfaces() interfaces} shall be collected. @param interfaceSet is the {@link Set} where the {@link Class#getInterfaces() interfaces} will be {@link Set#add(Object) added}. @param excludeSet is a {@link Set} with {@link Class}es (interfaces) to omit. May be {@code null} for none.
[ "Recursively", "collects", "all", "{", "@link", "Class#getInterfaces", "()", "interfaces", "}", "starting", "from", "the", "given", "{", "@code", "type", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/pojo/src/main/java/net/sf/mmm/util/pojo/descriptor/impl/PojoMethodIntrospectorImpl.java#L57-L65
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java
SpecTopic.getClosestTopic
public SpecTopic getClosestTopic(final SpecTopic topic, final boolean checkParentNode) { /* * Check this topic to see if it is the topic we are looking for */ if (this == topic || getId().equals(topic.getId())) return this; /* * If we still haven't found the closest node then check this nodes parents. */ if (getParent() != null) { if (getParent() instanceof Level) { return ((Level) getParent()).getClosestTopic(topic, checkParentNode); } else if (getParent() instanceof KeyValueNode) { return ((KeyValueNode) getParent()).getParent().getBaseLevel().getClosestTopic(topic, checkParentNode); } } return null; }
java
public SpecTopic getClosestTopic(final SpecTopic topic, final boolean checkParentNode) { /* * Check this topic to see if it is the topic we are looking for */ if (this == topic || getId().equals(topic.getId())) return this; /* * If we still haven't found the closest node then check this nodes parents. */ if (getParent() != null) { if (getParent() instanceof Level) { return ((Level) getParent()).getClosestTopic(topic, checkParentNode); } else if (getParent() instanceof KeyValueNode) { return ((KeyValueNode) getParent()).getParent().getBaseLevel().getClosestTopic(topic, checkParentNode); } } return null; }
[ "public", "SpecTopic", "getClosestTopic", "(", "final", "SpecTopic", "topic", ",", "final", "boolean", "checkParentNode", ")", "{", "/*\n * Check this topic to see if it is the topic we are looking for\n */", "if", "(", "this", "==", "topic", "||", "getId", ...
Finds the closest node in the contents of a level @param topic The node we need to find the closest match for @return
[ "Finds", "the", "closest", "node", "in", "the", "contents", "of", "a", "level" ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java#L529-L547
spring-projects/spring-ldap
core/src/main/java/org/springframework/ldap/core/support/SingleContextSource.java
SingleContextSource.doWithSingleContext
public static <T> T doWithSingleContext(ContextSource contextSource, LdapOperationsCallback<T> callback) { return doWithSingleContext(contextSource, callback, DONT_USE_READ_ONLY, DONT_IGNORE_PARTIAL_RESULT, DONT_IGNORE_NAME_NOT_FOUND); }
java
public static <T> T doWithSingleContext(ContextSource contextSource, LdapOperationsCallback<T> callback) { return doWithSingleContext(contextSource, callback, DONT_USE_READ_ONLY, DONT_IGNORE_PARTIAL_RESULT, DONT_IGNORE_NAME_NOT_FOUND); }
[ "public", "static", "<", "T", ">", "T", "doWithSingleContext", "(", "ContextSource", "contextSource", ",", "LdapOperationsCallback", "<", "T", ">", "callback", ")", "{", "return", "doWithSingleContext", "(", "contextSource", ",", "callback", ",", "DONT_USE_READ_ONLY...
Construct a SingleContextSource and execute the LdapOperationsCallback using the created instance. This makes sure the same connection will be used for all operations inside the LdapOperationsCallback, which is particularly useful when working with e.g. Paged Results as these typically require the exact same connection to be used for all requests involving the same cookie. The SingleContextSource instance will be properly disposed of once the operation has been completed. <p>By default, the {@link org.springframework.ldap.core.ContextSource#getReadWriteContext()} method will be used to create the DirContext instance to operate on.</p> @param contextSource The target ContextSource to retrieve a DirContext from. @param callback the callback to perform the Ldap operations. @return the result returned from the callback. @see #doWithSingleContext(org.springframework.ldap.core.ContextSource, LdapOperationsCallback, boolean, boolean, boolean) @since 2.0
[ "Construct", "a", "SingleContextSource", "and", "execute", "the", "LdapOperationsCallback", "using", "the", "created", "instance", ".", "This", "makes", "sure", "the", "same", "connection", "will", "be", "used", "for", "all", "operations", "inside", "the", "LdapOp...
train
https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/support/SingleContextSource.java#L114-L117
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/host/controller/discovery/S3Discovery.java
S3Discovery.writeToFile
private void writeToFile(List<DomainControllerData> data, String domainName) throws IOException { if(domainName == null || data == null) { return; } if (conn == null) { init(); } try { String key = S3Util.sanitize(domainName) + "/" + S3Util.sanitize(DC_FILE_NAME); byte[] buf = S3Util.domainControllerDataToByteBuffer(data); S3Object val = new S3Object(buf, null); if (usingPreSignedUrls()) { Map headers = new TreeMap(); headers.put("x-amz-acl", Arrays.asList("public-read")); conn.put(pre_signed_put_url, val, headers).connection.getResponseMessage(); } else { Map headers = new TreeMap(); headers.put("Content-Type", Arrays.asList("text/plain")); conn.put(location, key, val, headers).connection.getResponseMessage(); } } catch(Exception e) { throw HostControllerLogger.ROOT_LOGGER.cannotWriteToS3File(e.getLocalizedMessage()); } }
java
private void writeToFile(List<DomainControllerData> data, String domainName) throws IOException { if(domainName == null || data == null) { return; } if (conn == null) { init(); } try { String key = S3Util.sanitize(domainName) + "/" + S3Util.sanitize(DC_FILE_NAME); byte[] buf = S3Util.domainControllerDataToByteBuffer(data); S3Object val = new S3Object(buf, null); if (usingPreSignedUrls()) { Map headers = new TreeMap(); headers.put("x-amz-acl", Arrays.asList("public-read")); conn.put(pre_signed_put_url, val, headers).connection.getResponseMessage(); } else { Map headers = new TreeMap(); headers.put("Content-Type", Arrays.asList("text/plain")); conn.put(location, key, val, headers).connection.getResponseMessage(); } } catch(Exception e) { throw HostControllerLogger.ROOT_LOGGER.cannotWriteToS3File(e.getLocalizedMessage()); } }
[ "private", "void", "writeToFile", "(", "List", "<", "DomainControllerData", ">", "data", ",", "String", "domainName", ")", "throws", "IOException", "{", "if", "(", "domainName", "==", "null", "||", "data", "==", "null", ")", "{", "return", ";", "}", "if", ...
Write the domain controller data to an S3 file. @param data the domain controller data @param domainName the name of the directory in the bucket to write the S3 file to @throws IOException
[ "Write", "the", "domain", "controller", "data", "to", "an", "S3", "file", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/discovery/S3Discovery.java#L293-L319
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLTemplates.java
SQLTemplates.serialize
public void serialize(QueryMetadata metadata, boolean forCountRow, SQLSerializer context) { context.serializeForQuery(metadata, forCountRow); if (!metadata.getFlags().isEmpty()) { context.serialize(Position.END, metadata.getFlags()); } }
java
public void serialize(QueryMetadata metadata, boolean forCountRow, SQLSerializer context) { context.serializeForQuery(metadata, forCountRow); if (!metadata.getFlags().isEmpty()) { context.serialize(Position.END, metadata.getFlags()); } }
[ "public", "void", "serialize", "(", "QueryMetadata", "metadata", ",", "boolean", "forCountRow", ",", "SQLSerializer", "context", ")", "{", "context", ".", "serializeForQuery", "(", "metadata", ",", "forCountRow", ")", ";", "if", "(", "!", "metadata", ".", "get...
template method for SELECT serialization @param metadata @param forCountRow @param context
[ "template", "method", "for", "SELECT", "serialization" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLTemplates.java#L854-L860
zaproxy/zaproxy
src/org/zaproxy/zap/extension/ascan/ChallengeCallbackAPI.java
ChallengeCallbackAPI.registerCallback
public void registerCallback(String challenge, ChallengeCallbackPlugin plugin, HttpMessage attack) { // Maybe we'va a lot of dirty entries cleanExpiredCallbacks(); // Already synchronized (no need for a monitor) regCallbacks.put(challenge, new RegisteredCallback(plugin, attack)); }
java
public void registerCallback(String challenge, ChallengeCallbackPlugin plugin, HttpMessage attack) { // Maybe we'va a lot of dirty entries cleanExpiredCallbacks(); // Already synchronized (no need for a monitor) regCallbacks.put(challenge, new RegisteredCallback(plugin, attack)); }
[ "public", "void", "registerCallback", "(", "String", "challenge", ",", "ChallengeCallbackPlugin", "plugin", ",", "HttpMessage", "attack", ")", "{", "// Maybe we'va a lot of dirty entries", "cleanExpiredCallbacks", "(", ")", ";", "// Already synchronized (no need for a monitor)"...
Registers a new ZAP API challenge. @param challenge the challenge @param plugin the plugin that will be notified if the challenge is requested @param attack the message that contains the attack that reproduces the issue
[ "Registers", "a", "new", "ZAP", "API", "challenge", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/ascan/ChallengeCallbackAPI.java#L172-L178
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDisjointUnionAxiomImpl_CustomFieldSerializer.java
OWLDisjointUnionAxiomImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLDisjointUnionAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLDisjointUnionAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLDisjointUnionAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamWriter", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDisjointUnionAxiomImpl_CustomFieldSerializer.java#L76-L79
Alluxio/alluxio
core/common/src/main/java/alluxio/util/network/NettyUtils.java
NettyUtils.getChannelType
private static ChannelType getChannelType(PropertyKey key, AlluxioConfiguration conf) { if (!isNettyEpollAvailable()) { return ChannelType.NIO; } return conf.getEnum(key, ChannelType.class); }
java
private static ChannelType getChannelType(PropertyKey key, AlluxioConfiguration conf) { if (!isNettyEpollAvailable()) { return ChannelType.NIO; } return conf.getEnum(key, ChannelType.class); }
[ "private", "static", "ChannelType", "getChannelType", "(", "PropertyKey", "key", ",", "AlluxioConfiguration", "conf", ")", "{", "if", "(", "!", "isNettyEpollAvailable", "(", ")", ")", "{", "return", "ChannelType", ".", "NIO", ";", "}", "return", "conf", ".", ...
Get the proper channel type. Always returns {@link ChannelType} NIO if EPOLL is not available. @param key the property key for looking up the configured channel type @return the channel type to use
[ "Get", "the", "proper", "channel", "type", ".", "Always", "returns", "{", "@link", "ChannelType", "}", "NIO", "if", "EPOLL", "is", "not", "available", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/network/NettyUtils.java#L220-L225
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/AccountFiltersInner.java
AccountFiltersInner.updateAsync
public Observable<AccountFilterInner> updateAsync(String resourceGroupName, String accountName, String filterName, AccountFilterInner parameters) { return updateWithServiceResponseAsync(resourceGroupName, accountName, filterName, parameters).map(new Func1<ServiceResponse<AccountFilterInner>, AccountFilterInner>() { @Override public AccountFilterInner call(ServiceResponse<AccountFilterInner> response) { return response.body(); } }); }
java
public Observable<AccountFilterInner> updateAsync(String resourceGroupName, String accountName, String filterName, AccountFilterInner parameters) { return updateWithServiceResponseAsync(resourceGroupName, accountName, filterName, parameters).map(new Func1<ServiceResponse<AccountFilterInner>, AccountFilterInner>() { @Override public AccountFilterInner call(ServiceResponse<AccountFilterInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AccountFilterInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "filterName", ",", "AccountFilterInner", "parameters", ")", "{", "return", "updateWithServiceResponseAsync", "(", "res...
Update an Account Filter. Updates an existing Account Filter in the Media Services account. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param filterName The Account Filter name @param parameters The request parameters @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AccountFilterInner object
[ "Update", "an", "Account", "Filter", ".", "Updates", "an", "existing", "Account", "Filter", "in", "the", "Media", "Services", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/AccountFiltersInner.java#L564-L571
kaazing/java.client
transport/src/main/java/org/kaazing/gateway/client/transport/ws/WsFrameEncodingSupport.java
WsFrameEncodingSupport.rfc6455Encode
public static ByteBuffer rfc6455Encode(WsMessage message, int maskValue) { final boolean mask = true; boolean fin = true; // TODO continued frames? ByteBuffer buf = message.getBytes(); int remaining = buf.remaining(); int offset = 2 + (mask ? 4 : 0) + calculateLengthSize(remaining); ByteBuffer b = ByteBuffer.allocate(offset + remaining); int start = b.position(); byte b1 = (byte) (fin ? 0x80 : 0x00); byte b2 = (byte) (mask ? 0x80 : 0x00); b1 = doEncodeOpcode(b1, message); b2 |= lenBits(remaining); b.put(b1).put(b2); doEncodeLength(b, remaining); if (mask) { b.putInt(maskValue); } //put message data b.put(buf); if ( mask ) { b.position(offset); mask(b, maskValue); } b.limit(b.position()); b.position(start); return b; }
java
public static ByteBuffer rfc6455Encode(WsMessage message, int maskValue) { final boolean mask = true; boolean fin = true; // TODO continued frames? ByteBuffer buf = message.getBytes(); int remaining = buf.remaining(); int offset = 2 + (mask ? 4 : 0) + calculateLengthSize(remaining); ByteBuffer b = ByteBuffer.allocate(offset + remaining); int start = b.position(); byte b1 = (byte) (fin ? 0x80 : 0x00); byte b2 = (byte) (mask ? 0x80 : 0x00); b1 = doEncodeOpcode(b1, message); b2 |= lenBits(remaining); b.put(b1).put(b2); doEncodeLength(b, remaining); if (mask) { b.putInt(maskValue); } //put message data b.put(buf); if ( mask ) { b.position(offset); mask(b, maskValue); } b.limit(b.position()); b.position(start); return b; }
[ "public", "static", "ByteBuffer", "rfc6455Encode", "(", "WsMessage", "message", ",", "int", "maskValue", ")", "{", "final", "boolean", "mask", "=", "true", ";", "boolean", "fin", "=", "true", ";", "// TODO continued frames?", "ByteBuffer", "buf", "=", "message",...
Encode WebSocket message as a single frame, with the provided masking value applied.
[ "Encode", "WebSocket", "message", "as", "a", "single", "frame", "with", "the", "provided", "masking", "value", "applied", "." ]
train
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/transport/src/main/java/org/kaazing/gateway/client/transport/ws/WsFrameEncodingSupport.java#L26-L65
schallee/alib4j
osgi/core/src/main/java/net/darkmist/alib/osgi/MiscUtil.java
MiscUtil.castOrNull
public static <T> T castOrNull(Object o, Class<T> cls) { if(o == null) return null; if(cls.isInstance(o)) return cls.cast(o); return null; }
java
public static <T> T castOrNull(Object o, Class<T> cls) { if(o == null) return null; if(cls.isInstance(o)) return cls.cast(o); return null; }
[ "public", "static", "<", "T", ">", "T", "castOrNull", "(", "Object", "o", ",", "Class", "<", "T", ">", "cls", ")", "{", "if", "(", "o", "==", "null", ")", "return", "null", ";", "if", "(", "cls", ".", "isInstance", "(", "o", ")", ")", "return",...
Cast object to class or return null. @param o The object to cast @param cls The class to cast o to @return o cast as cls. null if o is null or not a instance of cls.
[ "Cast", "object", "to", "class", "or", "return", "null", "." ]
train
https://github.com/schallee/alib4j/blob/0e0718aee574bbb62268e1cf58e99286529ce529/osgi/core/src/main/java/net/darkmist/alib/osgi/MiscUtil.java#L57-L64
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/InternalCache2kBuilder.java
InternalCache2kBuilder.configureViaSettersDirect
@SuppressWarnings("unchecked") private void configureViaSettersDirect(HeapCache<K,V> c) { if (config.getLoader() != null) { Object obj = c.createCustomization(config.getLoader()); if (obj instanceof CacheLoader) { final CacheLoader<K,V> _loader = (CacheLoader) obj; c.setAdvancedLoader(new AdvancedCacheLoader<K, V>() { @Override public V load(final K key, final long currentTime, final CacheEntry<K, V> currentEntry) throws Exception { return _loader.load(key); } }); } else { final FunctionalCacheLoader<K,V> _loader = (FunctionalCacheLoader) obj; c.setAdvancedLoader(new AdvancedCacheLoader<K, V>() { @Override public V load(final K key, final long currentTime, final CacheEntry<K, V> currentEntry) throws Exception { return _loader.load(key); } }); } } if (config.getAdvancedLoader() != null) { final AdvancedCacheLoader<K,V> _loader = c.createCustomization(config.getAdvancedLoader()); AdvancedCacheLoader<K,V> _wrappedLoader = new WrappedAdvancedCacheLoader<K, V>(c, _loader); c.setAdvancedLoader(_wrappedLoader); } if (config.getExceptionPropagator() != null) { c.setExceptionPropagator(c.createCustomization(config.getExceptionPropagator())); } c.setCacheConfig(config); }
java
@SuppressWarnings("unchecked") private void configureViaSettersDirect(HeapCache<K,V> c) { if (config.getLoader() != null) { Object obj = c.createCustomization(config.getLoader()); if (obj instanceof CacheLoader) { final CacheLoader<K,V> _loader = (CacheLoader) obj; c.setAdvancedLoader(new AdvancedCacheLoader<K, V>() { @Override public V load(final K key, final long currentTime, final CacheEntry<K, V> currentEntry) throws Exception { return _loader.load(key); } }); } else { final FunctionalCacheLoader<K,V> _loader = (FunctionalCacheLoader) obj; c.setAdvancedLoader(new AdvancedCacheLoader<K, V>() { @Override public V load(final K key, final long currentTime, final CacheEntry<K, V> currentEntry) throws Exception { return _loader.load(key); } }); } } if (config.getAdvancedLoader() != null) { final AdvancedCacheLoader<K,V> _loader = c.createCustomization(config.getAdvancedLoader()); AdvancedCacheLoader<K,V> _wrappedLoader = new WrappedAdvancedCacheLoader<K, V>(c, _loader); c.setAdvancedLoader(_wrappedLoader); } if (config.getExceptionPropagator() != null) { c.setExceptionPropagator(c.createCustomization(config.getExceptionPropagator())); } c.setCacheConfig(config); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "configureViaSettersDirect", "(", "HeapCache", "<", "K", ",", "V", ">", "c", ")", "{", "if", "(", "config", ".", "getLoader", "(", ")", "!=", "null", ")", "{", "Object", "obj", "=", ...
The generic wiring code is not working on android. Explicitly call the wiring methods.
[ "The", "generic", "wiring", "code", "is", "not", "working", "on", "android", ".", "Explicitly", "call", "the", "wiring", "methods", "." ]
train
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/InternalCache2kBuilder.java#L111-L142
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java
DestinationManager.createTemporaryDestination
protected SIDestinationAddress createTemporaryDestination(Distribution distribution, String destinationPrefix) throws SIResourceException, SIMPDestinationAlreadyExistsException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createTemporaryDestination", new Object[] { destinationPrefix, distribution }); String name = createNewTemporaryDestinationName(destinationPrefix, messageProcessor.getMessagingEngineUuid(), distribution); DestinationType destinationType = DestinationType.QUEUE; if (distribution == Distribution.ALL) { destinationType = DestinationType.TOPICSPACE; } // Get destination definition and set specific attributes DestinationDefinition tempDestDefinition = messageProcessor.createDestinationDefinition(destinationType, name); // Set destination attributes applicable to temporary destinations tempDestDefinition.setMaxReliability(Reliability.RELIABLE_NONPERSISTENT); tempDestDefinition.setDefaultReliability(Reliability.RELIABLE_NONPERSISTENT); tempDestDefinition.setUUID(new SIBUuid12()); // If the temporary destination name exists, then this is an error situation and // an exception is thrown. if (destinationExists(name, messageProcessor.getMessagingEngineBus())) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createTemporaryDestination", "Destination with name " + name + " already exists"); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.DestinationManager", "1:2120:1.508.1.7" }); throw new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.DestinationManager", "1:2125:1.508.1.7" }, null)); } // Create the new SIDestinationAddress SIDestinationAddress address = ( (SIDestinationAddressFactory) MessageProcessor.getSingletonInstance( SIMPConstants.SI_DESTINATION_ADDRESS_FACTORY)).createSIDestinationAddress( name, true); ((JsDestinationAddress) address).setBusName(messageProcessor.getMessagingEngineBus()); ((JsDestinationAddress) address).setME(messageProcessor.getMessagingEngineUuid()); Set<String> destinationLocalizingSet = new HashSet<String>(); destinationLocalizingSet.add(messageProcessor.getMessagingEngineUuid().toString()); LocalizationDefinition localizationDefinition = messageProcessor.createLocalizationDefinition(tempDestDefinition.getName()); localizationDefinition.setDestinationHighMsgs(messageProcessor.getHighMessageThreshold()); createDestinationLocalization( tempDestDefinition, localizationDefinition, destinationLocalizingSet, true); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createTemporaryDestination", address); return address; }
java
protected SIDestinationAddress createTemporaryDestination(Distribution distribution, String destinationPrefix) throws SIResourceException, SIMPDestinationAlreadyExistsException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createTemporaryDestination", new Object[] { destinationPrefix, distribution }); String name = createNewTemporaryDestinationName(destinationPrefix, messageProcessor.getMessagingEngineUuid(), distribution); DestinationType destinationType = DestinationType.QUEUE; if (distribution == Distribution.ALL) { destinationType = DestinationType.TOPICSPACE; } // Get destination definition and set specific attributes DestinationDefinition tempDestDefinition = messageProcessor.createDestinationDefinition(destinationType, name); // Set destination attributes applicable to temporary destinations tempDestDefinition.setMaxReliability(Reliability.RELIABLE_NONPERSISTENT); tempDestDefinition.setDefaultReliability(Reliability.RELIABLE_NONPERSISTENT); tempDestDefinition.setUUID(new SIBUuid12()); // If the temporary destination name exists, then this is an error situation and // an exception is thrown. if (destinationExists(name, messageProcessor.getMessagingEngineBus())) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createTemporaryDestination", "Destination with name " + name + " already exists"); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.DestinationManager", "1:2120:1.508.1.7" }); throw new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.DestinationManager", "1:2125:1.508.1.7" }, null)); } // Create the new SIDestinationAddress SIDestinationAddress address = ( (SIDestinationAddressFactory) MessageProcessor.getSingletonInstance( SIMPConstants.SI_DESTINATION_ADDRESS_FACTORY)).createSIDestinationAddress( name, true); ((JsDestinationAddress) address).setBusName(messageProcessor.getMessagingEngineBus()); ((JsDestinationAddress) address).setME(messageProcessor.getMessagingEngineUuid()); Set<String> destinationLocalizingSet = new HashSet<String>(); destinationLocalizingSet.add(messageProcessor.getMessagingEngineUuid().toString()); LocalizationDefinition localizationDefinition = messageProcessor.createLocalizationDefinition(tempDestDefinition.getName()); localizationDefinition.setDestinationHighMsgs(messageProcessor.getHighMessageThreshold()); createDestinationLocalization( tempDestDefinition, localizationDefinition, destinationLocalizingSet, true); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createTemporaryDestination", address); return address; }
[ "protected", "SIDestinationAddress", "createTemporaryDestination", "(", "Distribution", "distribution", ",", "String", "destinationPrefix", ")", "throws", "SIResourceException", ",", "SIMPDestinationAlreadyExistsException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEn...
The Temporary Destination Name that is created is of the form _T<User prefix>_<MEId>_<TempDestId> for Topicspace Destinations or _Q<User prefix>_<MEId>_<TempDestId> for Queue Destinations Where the User prefix is limited to 12 characters (others are ignored) The MEId is the ME Uuid which will is a SIBUuid8 The TempDestId is a count value in hex eg _TSAMPLENAME_702CD771-5262B260_00016AE4 @param modelDestinationName The distribution (ONE or ALL) @param destinationPrefix The destination prefic, user specified When the maximum value for the tempDestCount is reached (Integer.MAX_VALUE), we FFDC and throw an SIException to indicate that destinations may no longer be unique. An SIException is also thrown if the temporary destination name already exists. The algorithm used should not generate the same named Temporary destination. (Unless the tempDestCount has wrapped) @return
[ "The", "Temporary", "Destination", "Name", "that", "is", "created", "is", "of", "the", "form", "_T<User", "prefix", ">", "_<MEId", ">", "_<TempDestId", ">", "for", "Topicspace", "Destinations", "or", "_Q<User", "prefix", ">", "_<MEId", ">", "_<TempDestId", ">"...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L1976-L2042
ihaolin/session
session-api/src/main/java/me/hao0/session/core/HttpServletRequest2.java
HttpServletRequest2.buildSession
private HttpSession2 buildSession(String id, boolean refresh) { HttpSession2 session = new HttpSession2(id, sessionManager, request.getServletContext()); session.setMaxInactiveInterval(maxInactiveInterval); if (refresh) { WebUtil.addCookie(this, response, getSessionCookieName(), id, getCookieDomain(), getCookieContextPath(), cookieMaxAge, true); } return session; }
java
private HttpSession2 buildSession(String id, boolean refresh) { HttpSession2 session = new HttpSession2(id, sessionManager, request.getServletContext()); session.setMaxInactiveInterval(maxInactiveInterval); if (refresh) { WebUtil.addCookie(this, response, getSessionCookieName(), id, getCookieDomain(), getCookieContextPath(), cookieMaxAge, true); } return session; }
[ "private", "HttpSession2", "buildSession", "(", "String", "id", ",", "boolean", "refresh", ")", "{", "HttpSession2", "session", "=", "new", "HttpSession2", "(", "id", ",", "sessionManager", ",", "request", ".", "getServletContext", "(", ")", ")", ";", "session...
build a new session from session id @param id session id @param refresh refresh cookie or not @return session
[ "build", "a", "new", "session", "from", "session", "id" ]
train
https://github.com/ihaolin/session/blob/322c3a9f47b305a39345135fa8163dd7e065b4f8/session-api/src/main/java/me/hao0/session/core/HttpServletRequest2.java#L155-L163
vznet/mongo-jackson-mapper
src/main/java/net/vz/mongodb/jackson/DBUpdate.java
DBUpdate.pullAll
public static Builder pullAll(String field, List<?> values) { return new Builder().pullAll(field, values); }
java
public static Builder pullAll(String field, List<?> values) { return new Builder().pullAll(field, values); }
[ "public", "static", "Builder", "pullAll", "(", "String", "field", ",", "List", "<", "?", ">", "values", ")", "{", "return", "new", "Builder", "(", ")", ".", "pullAll", "(", "field", ",", "values", ")", ";", "}" ]
Remove all occurances of the values from the array at field @param field The field to remove the values from @param values The values to remove @return this object
[ "Remove", "all", "occurances", "of", "the", "values", "from", "the", "array", "at", "field" ]
train
https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/DBUpdate.java#L198-L200
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderService.java
SpiderService.shardedLinkTermRowKey
public static String shardedLinkTermRowKey(FieldDefinition linkDef, String objID, int shardNumber) { assert linkDef.isLinkField() && linkDef.isSharded() && shardNumber > 0; StringBuilder shardPrefix = new StringBuilder(); shardPrefix.append(shardNumber); shardPrefix.append("/"); shardPrefix.append(linkColumnName(linkDef, objID)); return shardPrefix.toString(); }
java
public static String shardedLinkTermRowKey(FieldDefinition linkDef, String objID, int shardNumber) { assert linkDef.isLinkField() && linkDef.isSharded() && shardNumber > 0; StringBuilder shardPrefix = new StringBuilder(); shardPrefix.append(shardNumber); shardPrefix.append("/"); shardPrefix.append(linkColumnName(linkDef, objID)); return shardPrefix.toString(); }
[ "public", "static", "String", "shardedLinkTermRowKey", "(", "FieldDefinition", "linkDef", ",", "String", "objID", ",", "int", "shardNumber", ")", "{", "assert", "linkDef", ".", "isLinkField", "(", ")", "&&", "linkDef", ".", "isSharded", "(", ")", "&&", "shardN...
Return the row key for the Terms record that represents a link shard record for the given link, owned by the given object ID, referencing target objects in the given shard. The key format is: <pre> {shard number}/{link name}/{object ID} </pre> @param linkDef {@link FieldDefinition} of a sharded link. @param objID ID of object that owns link field. @param shardNumber Shard number in the link's extent table. @return
[ "Return", "the", "row", "key", "for", "the", "Terms", "record", "that", "represents", "a", "link", "shard", "record", "for", "the", "given", "link", "owned", "by", "the", "given", "object", "ID", "referencing", "target", "objects", "in", "the", "given", "s...
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderService.java#L362-L369
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMultiFileWidget.java
WMultiFileWidget.selectionsEqual
private boolean selectionsEqual(final List<?> list1, final List<?> list2) { return (list1 == null || list1.isEmpty()) && (list2 == null || list2.isEmpty()) || (list1 != null && list2 != null && list1.size() == list2.size() && list1. containsAll(list2)); }
java
private boolean selectionsEqual(final List<?> list1, final List<?> list2) { return (list1 == null || list1.isEmpty()) && (list2 == null || list2.isEmpty()) || (list1 != null && list2 != null && list1.size() == list2.size() && list1. containsAll(list2)); }
[ "private", "boolean", "selectionsEqual", "(", "final", "List", "<", "?", ">", "list1", ",", "final", "List", "<", "?", ">", "list2", ")", "{", "return", "(", "list1", "==", "null", "||", "list1", ".", "isEmpty", "(", ")", ")", "&&", "(", "list2", "...
Selection lists are considered equal if they have the same items (order is not important). An empty list is considered equal to a null list. @param list1 the first list to check. @param list2 the second list to check. @return true if the lists are equal, false otherwise.
[ "Selection", "lists", "are", "considered", "equal", "if", "they", "have", "the", "same", "items", "(", "order", "is", "not", "important", ")", ".", "An", "empty", "list", "is", "considered", "equal", "to", "a", "null", "list", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMultiFileWidget.java#L931-L935
voldemort/voldemort
src/java/voldemort/store/slop/HintedHandoff.java
HintedHandoff.sendHintParallel
public void sendHintParallel(Node failedNode, Version version, Slop slop) { List<Node> nodes = new LinkedList<Node>(); nodes.addAll(handoffStrategy.routeHint(failedNode)); if(logger.isDebugEnabled()) { List<Integer> nodeIds = new ArrayList<Integer>(); for(Node node: nodes) { nodeIds.add(node.getId()); } logger.debug("Hint preference list: " + nodeIds.toString()); } sendOneAsyncHint(slop.makeKey(), new Versioned<byte[]>(slopSerializer.toBytes(slop), version), nodes); }
java
public void sendHintParallel(Node failedNode, Version version, Slop slop) { List<Node> nodes = new LinkedList<Node>(); nodes.addAll(handoffStrategy.routeHint(failedNode)); if(logger.isDebugEnabled()) { List<Integer> nodeIds = new ArrayList<Integer>(); for(Node node: nodes) { nodeIds.add(node.getId()); } logger.debug("Hint preference list: " + nodeIds.toString()); } sendOneAsyncHint(slop.makeKey(), new Versioned<byte[]>(slopSerializer.toBytes(slop), version), nodes); }
[ "public", "void", "sendHintParallel", "(", "Node", "failedNode", ",", "Version", "version", ",", "Slop", "slop", ")", "{", "List", "<", "Node", ">", "nodes", "=", "new", "LinkedList", "<", "Node", ">", "(", ")", ";", "nodes", ".", "addAll", "(", "hando...
Like {@link #sendHintSerial(voldemort.cluster.Node, voldemort.versioning.Version, Slop)} , but doesn't block the pipeline. Intended for handling prolonged failures without incurring a performance cost. @see #sendHintSerial(voldemort.cluster.Node, voldemort.versioning.Version, Slop)
[ "Like", "{", "@link", "#sendHintSerial", "(", "voldemort", ".", "cluster", ".", "Node", "voldemort", ".", "versioning", ".", "Version", "Slop", ")", "}", "but", "doesn", "t", "block", "the", "pipeline", ".", "Intended", "for", "handling", "prolonged", "failu...
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/slop/HintedHandoff.java#L103-L115
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java
SameDiff.saveWithTrainingConfig
public void saveWithTrainingConfig(TrainingConfig trainingConfig,OutputStream outputStream) throws IOException { ObjectMapper objectMapper = ObjectMapperHolder.getJsonMapper(); String configJson = objectMapper.writeValueAsString(trainingConfig); ZipOutputStream zipfile = new ZipOutputStream(new CloseShieldOutputStream(outputStream)); ZipEntry config = new ZipEntry(TRAINING_CONFIG_JSON_ZIP_ENTRY_NAME); zipfile.putNextEntry(config); zipfile.write(configJson.getBytes()); ZipEntry sameDiff = new ZipEntry(SAMEDIFF_FILE_ENTRY_NAME); zipfile.putNextEntry(sameDiff); val fb = asFlatBuffers(); val offset = fb.position(); val array = fb.array(); try (BufferedOutputStream zipFileOutputStream = new BufferedOutputStream(zipfile); val dos = new DataOutputStream(zipFileOutputStream)) { dos.write(array, offset, array.length - offset); } }
java
public void saveWithTrainingConfig(TrainingConfig trainingConfig,OutputStream outputStream) throws IOException { ObjectMapper objectMapper = ObjectMapperHolder.getJsonMapper(); String configJson = objectMapper.writeValueAsString(trainingConfig); ZipOutputStream zipfile = new ZipOutputStream(new CloseShieldOutputStream(outputStream)); ZipEntry config = new ZipEntry(TRAINING_CONFIG_JSON_ZIP_ENTRY_NAME); zipfile.putNextEntry(config); zipfile.write(configJson.getBytes()); ZipEntry sameDiff = new ZipEntry(SAMEDIFF_FILE_ENTRY_NAME); zipfile.putNextEntry(sameDiff); val fb = asFlatBuffers(); val offset = fb.position(); val array = fb.array(); try (BufferedOutputStream zipFileOutputStream = new BufferedOutputStream(zipfile); val dos = new DataOutputStream(zipFileOutputStream)) { dos.write(array, offset, array.length - offset); } }
[ "public", "void", "saveWithTrainingConfig", "(", "TrainingConfig", "trainingConfig", ",", "OutputStream", "outputStream", ")", "throws", "IOException", "{", "ObjectMapper", "objectMapper", "=", "ObjectMapperHolder", ".", "getJsonMapper", "(", ")", ";", "String", "config...
Save this samediff instance as a zip file with the training configuration @param trainingConfig the training configuration to save @param outputStream the output stream to write to @throws IOException
[ "Save", "this", "samediff", "instance", "as", "a", "zip", "file", "with", "the", "training", "configuration" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L4416-L4436
aggregateknowledge/java-hll
src/main/java/net/agkn/hll/util/NumberUtil.java
NumberUtil.toHex
public static String toHex(final byte[] bytes, final int offset, final int count) { if(offset >= bytes.length) throw new IllegalArgumentException("Offset is greater than the length (" + offset + " >= " + bytes.length + ").")/*by contract*/; final int byteCount = Math.min( (bytes.length - offset), count); final int upperBound = byteCount + offset; final char[] chars = new char[byteCount * 2/*two chars per byte*/]; int charIndex = 0; for(int i=offset; i<upperBound; i++) { final byte value = bytes[i]; chars[charIndex++] = HEX[(value >>> 4) & 0x0F]; chars[charIndex++] = HEX[value & 0x0F]; } return new String(chars); }
java
public static String toHex(final byte[] bytes, final int offset, final int count) { if(offset >= bytes.length) throw new IllegalArgumentException("Offset is greater than the length (" + offset + " >= " + bytes.length + ").")/*by contract*/; final int byteCount = Math.min( (bytes.length - offset), count); final int upperBound = byteCount + offset; final char[] chars = new char[byteCount * 2/*two chars per byte*/]; int charIndex = 0; for(int i=offset; i<upperBound; i++) { final byte value = bytes[i]; chars[charIndex++] = HEX[(value >>> 4) & 0x0F]; chars[charIndex++] = HEX[value & 0x0F]; } return new String(chars); }
[ "public", "static", "String", "toHex", "(", "final", "byte", "[", "]", "bytes", ",", "final", "int", "offset", ",", "final", "int", "count", ")", "{", "if", "(", "offset", ">=", "bytes", ".", "length", ")", "throw", "new", "IllegalArgumentException", "("...
Converts the specified array of <code>byte</code>s into a string of hex characters (low <code>byte</code> first). @param bytes the array of <code>byte</code>s that are to be converted. This cannot be <code>null</code> though it may be empty. @param offset the offset in <code>bytes</code> at which the bytes will be taken. This cannot be negative and must be less than <code>bytes.length - 1</code>. @param count the number of bytes to be retrieved from the specified array. This cannot be negative. If greater than <code>bytes.length - offset</code> then that value is used. @return a string of at most <code>count</code> characters that represents the specified byte array in hex. This will never be <code>null</code> though it may be empty if <code>bytes</code> is empty or <code>count</code> is zero. @throws IllegalArgumentException if <code>offset</code> is greater than or equal to <code>bytes.length</code>. @see #fromHex(String, int, int)
[ "Converts", "the", "specified", "array", "of", "<code", ">", "byte<", "/", "code", ">", "s", "into", "a", "string", "of", "hex", "characters", "(", "low", "<code", ">", "byte<", "/", "code", ">", "first", ")", "." ]
train
https://github.com/aggregateknowledge/java-hll/blob/1f4126e79a85b79581460c75bf1c1634b8a7402d/src/main/java/net/agkn/hll/util/NumberUtil.java#L67-L81
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
ResourceGroovyMethods.setBytes
public static void setBytes(File file, byte[] bytes) throws IOException { IOGroovyMethods.setBytes(new FileOutputStream(file), bytes); }
java
public static void setBytes(File file, byte[] bytes) throws IOException { IOGroovyMethods.setBytes(new FileOutputStream(file), bytes); }
[ "public", "static", "void", "setBytes", "(", "File", "file", ",", "byte", "[", "]", "bytes", ")", "throws", "IOException", "{", "IOGroovyMethods", ".", "setBytes", "(", "new", "FileOutputStream", "(", "file", ")", ",", "bytes", ")", ";", "}" ]
Write the bytes from the byte array to the File. @param file the file to write to @param bytes the byte[] to write to the file @throws IOException if an IOException occurs. @since 1.7.1
[ "Write", "the", "bytes", "from", "the", "byte", "array", "to", "the", "File", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L717-L719
jenkinsci/jenkins
core/src/main/java/hudson/model/Items.java
Items.findNearest
public static @CheckForNull <T extends Item> T findNearest(Class<T> type, String name, ItemGroup context) { List<String> names = new ArrayList<>(); for (T item: Jenkins.getInstance().allItems(type)) { names.add(item.getRelativeNameFrom(context)); } String nearest = EditDistance.findNearest(name, names); return Jenkins.getInstance().getItem(nearest, context, type); }
java
public static @CheckForNull <T extends Item> T findNearest(Class<T> type, String name, ItemGroup context) { List<String> names = new ArrayList<>(); for (T item: Jenkins.getInstance().allItems(type)) { names.add(item.getRelativeNameFrom(context)); } String nearest = EditDistance.findNearest(name, names); return Jenkins.getInstance().getItem(nearest, context, type); }
[ "public", "static", "@", "CheckForNull", "<", "T", "extends", "Item", ">", "T", "findNearest", "(", "Class", "<", "T", ">", "type", ",", "String", "name", ",", "ItemGroup", "context", ")", "{", "List", "<", "String", ">", "names", "=", "new", "ArrayLis...
Finds an item whose name (when referenced from the specified context) is closest to the given name. @param <T> the type of item being considered @param type same as {@code T} @param name the supplied name @param context a context to start from (used to compute relative names) @return the closest available item @since 1.538
[ "Finds", "an", "item", "whose", "name", "(", "when", "referenced", "from", "the", "specified", "context", ")", "is", "closest", "to", "the", "given", "name", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Items.java#L467-L474
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java
JScreen.addScreenComponent
public void addScreenComponent(Container parent, Converter fieldInfo, JComponent component) { String strName = fieldInfo.getFieldName(); // Almost always if (strName != null) component.setName(strName); component.addFocusListener(this); // todo(don) Note: I never remove this focus listener. this.setComponentConstraints(component); parent.add(component); fieldInfo.addComponent(component); }
java
public void addScreenComponent(Container parent, Converter fieldInfo, JComponent component) { String strName = fieldInfo.getFieldName(); // Almost always if (strName != null) component.setName(strName); component.addFocusListener(this); // todo(don) Note: I never remove this focus listener. this.setComponentConstraints(component); parent.add(component); fieldInfo.addComponent(component); }
[ "public", "void", "addScreenComponent", "(", "Container", "parent", ",", "Converter", "fieldInfo", ",", "JComponent", "component", ")", "{", "String", "strName", "=", "fieldInfo", ".", "getFieldName", "(", ")", ";", "// Almost always", "if", "(", "strName", "!="...
Add the screen controls to the second column of the grid. @param parent The container to add the control(s) to. @param fieldInfo the field to add a control for. @param component The component to add. @param gridbag The screen layout. @param c The constraint to use.
[ "Add", "the", "screen", "controls", "to", "the", "second", "column", "of", "the", "grid", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java#L334-L344
BellaDati/belladati-sdk-java
src/main/java/com/belladati/sdk/impl/BellaDatiClient.java
BellaDatiClient.readObject
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); try { Field client = getClass().getDeclaredField("client"); client.setAccessible(true); client.set(this, buildClient(trustSelfSigned)); } catch (NoSuchFieldException e) { throw new InternalConfigurationException("Failed to set client fields", e); } catch (IllegalAccessException e) { throw new InternalConfigurationException("Failed to set client fields", e); } catch (SecurityException e) { throw new InternalConfigurationException("Failed to set client fields", e); } catch (IllegalArgumentException e) { throw new InternalConfigurationException("Failed to set client fields", e); } }
java
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); try { Field client = getClass().getDeclaredField("client"); client.setAccessible(true); client.set(this, buildClient(trustSelfSigned)); } catch (NoSuchFieldException e) { throw new InternalConfigurationException("Failed to set client fields", e); } catch (IllegalAccessException e) { throw new InternalConfigurationException("Failed to set client fields", e); } catch (SecurityException e) { throw new InternalConfigurationException("Failed to set client fields", e); } catch (IllegalArgumentException e) { throw new InternalConfigurationException("Failed to set client fields", e); } }
[ "private", "void", "readObject", "(", "ObjectInputStream", "in", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "in", ".", "defaultReadObject", "(", ")", ";", "try", "{", "Field", "client", "=", "getClass", "(", ")", ".", "getDeclaredField", ...
Deserialization. Sets up an HTTP client instance. @param in Input stream of object to be de-serialized @throws IOException Thrown if IO error occurs during class reading @throws ClassNotFoundException Thrown if desired class does not exist
[ "Deserialization", ".", "Sets", "up", "an", "HTTP", "client", "instance", "." ]
train
https://github.com/BellaDati/belladati-sdk-java/blob/1a732a57ebc825ddf47ce405723cc958adb1a43f/src/main/java/com/belladati/sdk/impl/BellaDatiClient.java#L413-L428
samskivert/samskivert
src/main/java/com/samskivert/net/HttpPostUtil.java
HttpPostUtil.httpPost
public static String httpPost (URL url, String submission, int timeout) throws IOException, ServiceWaiter.TimeoutException { return httpPost(url, submission, timeout, Collections.singletonMap("Content-Type", "application/x-www-form-urlencoded")); }
java
public static String httpPost (URL url, String submission, int timeout) throws IOException, ServiceWaiter.TimeoutException { return httpPost(url, submission, timeout, Collections.singletonMap("Content-Type", "application/x-www-form-urlencoded")); }
[ "public", "static", "String", "httpPost", "(", "URL", "url", ",", "String", "submission", ",", "int", "timeout", ")", "throws", "IOException", ",", "ServiceWaiter", ".", "TimeoutException", "{", "return", "httpPost", "(", "url", ",", "submission", ",", "timeou...
Return the results of a form post. Note that the http request takes place on another thread, but this thread blocks until the results are returned or it times out. This overload sets a single request property of <code>"Content-Type" = "application/x-www-form-urlencoded"</code>. @param url from which to make the request. @param submission the entire submission eg {@code foo=bar&baz=boo&futz=foo}. @param timeout time to wait for the response, in seconds, or -1 for forever.
[ "Return", "the", "results", "of", "a", "form", "post", ".", "Note", "that", "the", "http", "request", "takes", "place", "on", "another", "thread", "but", "this", "thread", "blocks", "until", "the", "results", "are", "returned", "or", "it", "times", "out", ...
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/net/HttpPostUtil.java#L36-L41
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Mail.java
Mail.setMimeattach
public void setMimeattach(String strMimeattach, String fileName, String type, String disposition, String contentID, boolean removeAfterSend) throws PageException { Resource file = ResourceUtil.toResourceNotExisting(pageContext, strMimeattach); pageContext.getConfig().getSecurityManager().checkFileLocation(file); if (!file.exists()) throw new ApplicationException("can't attach file " + strMimeattach + ", this file doesn't exist"); smtp.addAttachment(file, fileName, type, disposition, contentID, removeAfterSend); }
java
public void setMimeattach(String strMimeattach, String fileName, String type, String disposition, String contentID, boolean removeAfterSend) throws PageException { Resource file = ResourceUtil.toResourceNotExisting(pageContext, strMimeattach); pageContext.getConfig().getSecurityManager().checkFileLocation(file); if (!file.exists()) throw new ApplicationException("can't attach file " + strMimeattach + ", this file doesn't exist"); smtp.addAttachment(file, fileName, type, disposition, contentID, removeAfterSend); }
[ "public", "void", "setMimeattach", "(", "String", "strMimeattach", ",", "String", "fileName", ",", "String", "type", ",", "String", "disposition", ",", "String", "contentID", ",", "boolean", "removeAfterSend", ")", "throws", "PageException", "{", "Resource", "file...
set the value mimeattach Specifies the path of the file to be attached to the e-mail message. An attached file is MIME-encoded. @param strMimeattach value to set @param type mimetype of the file @param contentID @param disposition @throws PageException
[ "set", "the", "value", "mimeattach", "Specifies", "the", "path", "of", "the", "file", "to", "be", "attached", "to", "the", "e", "-", "mail", "message", ".", "An", "attached", "file", "is", "MIME", "-", "encoded", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Mail.java#L322-L329
google/closure-compiler
src/com/google/javascript/jscomp/CrossChunkReferenceCollector.java
CrossChunkReferenceCollector.process
@Override public void process(Node externs, Node root) { checkState(topLevelStatements.isEmpty(), "process() called more than once"); NodeTraversal t = new NodeTraversal(compiler, this, scopeCreator); t.traverseRoots(externs, root); }
java
@Override public void process(Node externs, Node root) { checkState(topLevelStatements.isEmpty(), "process() called more than once"); NodeTraversal t = new NodeTraversal(compiler, this, scopeCreator); t.traverseRoots(externs, root); }
[ "@", "Override", "public", "void", "process", "(", "Node", "externs", ",", "Node", "root", ")", "{", "checkState", "(", "topLevelStatements", ".", "isEmpty", "(", ")", ",", "\"process() called more than once\"", ")", ";", "NodeTraversal", "t", "=", "new", "Nod...
Convenience method for running this pass over a tree with this class as a callback.
[ "Convenience", "method", "for", "running", "this", "pass", "over", "a", "tree", "with", "this", "class", "as", "a", "callback", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CrossChunkReferenceCollector.java#L75-L80
apiman/apiman
gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/BasicAuthenticationPolicy.java
BasicAuthenticationPolicy.sendAuthFailure
protected void sendAuthFailure(IPolicyContext context, IPolicyChain<?> chain, BasicAuthenticationConfig config, int reason) { IPolicyFailureFactoryComponent pff = context.getComponent(IPolicyFailureFactoryComponent.class); PolicyFailure failure = pff.createFailure(PolicyFailureType.Authentication, reason, Messages.i18n.format("BasicAuthenticationPolicy.AuthenticationFailed")); //$NON-NLS-1$ String realm = config.getRealm(); if (realm == null || realm.trim().isEmpty()) { realm = "Apiman"; //$NON-NLS-1$ } failure.getHeaders().put("WWW-Authenticate", String.format("Basic realm=\"%1$s\"", realm)); //$NON-NLS-1$ //$NON-NLS-2$ chain.doFailure(failure); }
java
protected void sendAuthFailure(IPolicyContext context, IPolicyChain<?> chain, BasicAuthenticationConfig config, int reason) { IPolicyFailureFactoryComponent pff = context.getComponent(IPolicyFailureFactoryComponent.class); PolicyFailure failure = pff.createFailure(PolicyFailureType.Authentication, reason, Messages.i18n.format("BasicAuthenticationPolicy.AuthenticationFailed")); //$NON-NLS-1$ String realm = config.getRealm(); if (realm == null || realm.trim().isEmpty()) { realm = "Apiman"; //$NON-NLS-1$ } failure.getHeaders().put("WWW-Authenticate", String.format("Basic realm=\"%1$s\"", realm)); //$NON-NLS-1$ //$NON-NLS-2$ chain.doFailure(failure); }
[ "protected", "void", "sendAuthFailure", "(", "IPolicyContext", "context", ",", "IPolicyChain", "<", "?", ">", "chain", ",", "BasicAuthenticationConfig", "config", ",", "int", "reason", ")", "{", "IPolicyFailureFactoryComponent", "pff", "=", "context", ".", "getCompo...
Sends the 'unauthenticated' response as a policy failure. @param context @param chain @param config @param reason
[ "Sends", "the", "unauthenticated", "response", "as", "a", "policy", "failure", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/BasicAuthenticationPolicy.java#L182-L191
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/AliasedDiscoveryConfigUtils.java
AliasedDiscoveryConfigUtils.getConfigByTag
public static AliasedDiscoveryConfig getConfigByTag(JoinConfig config, String tag) { if ("aws".equals(tag)) { return config.getAwsConfig(); } else if ("gcp".equals(tag)) { return config.getGcpConfig(); } else if ("azure".equals(tag)) { return config.getAzureConfig(); } else if ("kubernetes".equals(tag)) { return config.getKubernetesConfig(); } else if ("eureka".equals(tag)) { return config.getEurekaConfig(); } else { throw new IllegalArgumentException(String.format("Invalid tag: '%s'", tag)); } }
java
public static AliasedDiscoveryConfig getConfigByTag(JoinConfig config, String tag) { if ("aws".equals(tag)) { return config.getAwsConfig(); } else if ("gcp".equals(tag)) { return config.getGcpConfig(); } else if ("azure".equals(tag)) { return config.getAzureConfig(); } else if ("kubernetes".equals(tag)) { return config.getKubernetesConfig(); } else if ("eureka".equals(tag)) { return config.getEurekaConfig(); } else { throw new IllegalArgumentException(String.format("Invalid tag: '%s'", tag)); } }
[ "public", "static", "AliasedDiscoveryConfig", "getConfigByTag", "(", "JoinConfig", "config", ",", "String", "tag", ")", "{", "if", "(", "\"aws\"", ".", "equals", "(", "tag", ")", ")", "{", "return", "config", ".", "getAwsConfig", "(", ")", ";", "}", "else"...
Gets the {@link AliasedDiscoveryConfig} from {@code config} by {@code tag}.
[ "Gets", "the", "{" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/AliasedDiscoveryConfigUtils.java#L115-L129
jenkinsci/jenkins
core/src/main/java/hudson/XmlFile.java
XmlFile.readRaw
public Reader readRaw() throws IOException { try { InputStream fileInputStream = Files.newInputStream(file.toPath()); try { return new InputStreamReader(fileInputStream, sniffEncoding()); } catch (IOException ex) { // Exception may happen if we fail to find encoding or if this encoding is unsupported. // In such case we close the underlying stream and rethrow. Util.closeAndLogFailures(fileInputStream, LOGGER, "FileInputStream", file.toString()); throw ex; } } catch (InvalidPathException e) { throw new IOException(e); } }
java
public Reader readRaw() throws IOException { try { InputStream fileInputStream = Files.newInputStream(file.toPath()); try { return new InputStreamReader(fileInputStream, sniffEncoding()); } catch (IOException ex) { // Exception may happen if we fail to find encoding or if this encoding is unsupported. // In such case we close the underlying stream and rethrow. Util.closeAndLogFailures(fileInputStream, LOGGER, "FileInputStream", file.toString()); throw ex; } } catch (InvalidPathException e) { throw new IOException(e); } }
[ "public", "Reader", "readRaw", "(", ")", "throws", "IOException", "{", "try", "{", "InputStream", "fileInputStream", "=", "Files", ".", "newInputStream", "(", "file", ".", "toPath", "(", ")", ")", ";", "try", "{", "return", "new", "InputStreamReader", "(", ...
Opens a {@link Reader} that loads XML. This method uses {@link #sniffEncoding() the right encoding}, not just the system default encoding. @throws IOException Encoding issues @return Reader for the file. should be close externally once read.
[ "Opens", "a", "{" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/XmlFile.java#L251-L265
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java
SegmentsUtil.bitSet
public static void bitSet(MemorySegment[] segments, int baseOffset, int index) { if (segments.length == 1) { int offset = baseOffset + ((index & BIT_BYTE_POSITION_MASK) >>> 3); MemorySegment segment = segments[0]; byte current = segment.get(offset); current |= (1 << (index & BIT_BYTE_INDEX_MASK)); segment.put(offset, current); } else { bitSetMultiSegments(segments, baseOffset, index); } }
java
public static void bitSet(MemorySegment[] segments, int baseOffset, int index) { if (segments.length == 1) { int offset = baseOffset + ((index & BIT_BYTE_POSITION_MASK) >>> 3); MemorySegment segment = segments[0]; byte current = segment.get(offset); current |= (1 << (index & BIT_BYTE_INDEX_MASK)); segment.put(offset, current); } else { bitSetMultiSegments(segments, baseOffset, index); } }
[ "public", "static", "void", "bitSet", "(", "MemorySegment", "[", "]", "segments", ",", "int", "baseOffset", ",", "int", "index", ")", "{", "if", "(", "segments", ".", "length", "==", "1", ")", "{", "int", "offset", "=", "baseOffset", "+", "(", "(", "...
set bit from segments. @param segments target segments. @param baseOffset bits base offset. @param index bit index from base offset.
[ "set", "bit", "from", "segments", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L491-L501
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/Environment.java
Environment.doHttpPut
public void doHttpPut(String url, String templateName, Object model, HttpResponse result) { doHttpPut(url, templateName, model, result, null, XmlHttpResponse.CONTENT_TYPE_XML_TEXT_UTF8); }
java
public void doHttpPut(String url, String templateName, Object model, HttpResponse result) { doHttpPut(url, templateName, model, result, null, XmlHttpResponse.CONTENT_TYPE_XML_TEXT_UTF8); }
[ "public", "void", "doHttpPut", "(", "String", "url", ",", "String", "templateName", ",", "Object", "model", ",", "HttpResponse", "result", ")", "{", "doHttpPut", "(", "url", ",", "templateName", ",", "model", ",", "result", ",", "null", ",", "XmlHttpResponse...
Performs PUT to supplied url of result of applying template with model. @param url url to put to. @param templateName name of template to use. @param model model for template. @param result result to populate with response.
[ "Performs", "PUT", "to", "supplied", "url", "of", "result", "of", "applying", "template", "with", "model", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/Environment.java#L318-L320
enioka/jqm
jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/Cl.java
Cl.map
static Cl map(ResultSet rs, int colShift) { Cl tmp = new Cl(); try { tmp.id = rs.getInt(1 + colShift); tmp.name = rs.getString(2 + colShift); tmp.childFirst = rs.getBoolean(3 + colShift); tmp.hiddenClasses = rs.getString(4 + colShift); tmp.tracingEnabled = rs.getBoolean(5 + colShift); tmp.persistent = rs.getBoolean(6 + colShift); tmp.allowedRunners = rs.getString(7 + colShift); } catch (SQLException e) { throw new DatabaseException(e); } return tmp; }
java
static Cl map(ResultSet rs, int colShift) { Cl tmp = new Cl(); try { tmp.id = rs.getInt(1 + colShift); tmp.name = rs.getString(2 + colShift); tmp.childFirst = rs.getBoolean(3 + colShift); tmp.hiddenClasses = rs.getString(4 + colShift); tmp.tracingEnabled = rs.getBoolean(5 + colShift); tmp.persistent = rs.getBoolean(6 + colShift); tmp.allowedRunners = rs.getString(7 + colShift); } catch (SQLException e) { throw new DatabaseException(e); } return tmp; }
[ "static", "Cl", "map", "(", "ResultSet", "rs", ",", "int", "colShift", ")", "{", "Cl", "tmp", "=", "new", "Cl", "(", ")", ";", "try", "{", "tmp", ".", "id", "=", "rs", ".", "getInt", "(", "1", "+", "colShift", ")", ";", "tmp", ".", "name", "=...
ResultSet is not modified (no rs.next called). @param rs @return
[ "ResultSet", "is", "not", "modified", "(", "no", "rs", ".", "next", "called", ")", "." ]
train
https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/Cl.java#L171-L190
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java
GlobalUsersInner.getPersonalPreferences
public GetPersonalPreferencesResponseInner getPersonalPreferences(String userName, PersonalPreferencesOperationsPayload personalPreferencesOperationsPayload) { return getPersonalPreferencesWithServiceResponseAsync(userName, personalPreferencesOperationsPayload).toBlocking().single().body(); }
java
public GetPersonalPreferencesResponseInner getPersonalPreferences(String userName, PersonalPreferencesOperationsPayload personalPreferencesOperationsPayload) { return getPersonalPreferencesWithServiceResponseAsync(userName, personalPreferencesOperationsPayload).toBlocking().single().body(); }
[ "public", "GetPersonalPreferencesResponseInner", "getPersonalPreferences", "(", "String", "userName", ",", "PersonalPreferencesOperationsPayload", "personalPreferencesOperationsPayload", ")", "{", "return", "getPersonalPreferencesWithServiceResponseAsync", "(", "userName", ",", "pers...
Get personal preferences for a user. @param userName The name of the user. @param personalPreferencesOperationsPayload Represents payload for any Environment operations like get, start, stop, connect @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 GetPersonalPreferencesResponseInner object if successful.
[ "Get", "personal", "preferences", "for", "a", "user", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java#L467-L469
GenesysPureEngage/provisioning-client-java
src/main/java/com/genesys/internal/provisioning/api/UsersApi.java
UsersApi.getUserWithHttpInfo
public ApiResponse<GetUsersSuccessResponse> getUserWithHttpInfo(String dbid) throws ApiException { com.squareup.okhttp.Call call = getUserValidateBeforeCall(dbid, null, null); Type localVarReturnType = new TypeToken<GetUsersSuccessResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
public ApiResponse<GetUsersSuccessResponse> getUserWithHttpInfo(String dbid) throws ApiException { com.squareup.okhttp.Call call = getUserValidateBeforeCall(dbid, null, null); Type localVarReturnType = new TypeToken<GetUsersSuccessResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
[ "public", "ApiResponse", "<", "GetUsersSuccessResponse", ">", "getUserWithHttpInfo", "(", "String", "dbid", ")", "throws", "ApiException", "{", "com", ".", "squareup", ".", "okhttp", ".", "Call", "call", "=", "getUserValidateBeforeCall", "(", "dbid", ",", "null", ...
Get a user. Get the specified [CfgPerson](https://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/CfgPerson) object. @param dbid The user&#39;s DBID. (required) @return ApiResponse&lt;GetUsersSuccessResponse&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "a", "user", ".", "Get", "the", "specified", "[", "CfgPerson", "]", "(", "https", ":", "//", "docs", ".", "genesys", ".", "com", "/", "Documentation", "/", "PSDK", "/", "latest", "/", "ConfigLayerRef", "/", "CfgPerson", ")", "object", "." ]
train
https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/UsersApi.java#L509-L513
lightblue-platform/lightblue-client
core/src/main/java/com/redhat/lightblue/client/Query.java
Query.withStrings
public static Query withStrings(String field, String[] values, boolean caseInsensitive) { if (caseInsensitive) { List<Query> regexList = new ArrayList<Query>(); for (String value : values) { regexList.add(withString(field, value, true)); } return Query.or(regexList); } else { return Query.withValues(field, Query.in, Literal.values(values)); } }
java
public static Query withStrings(String field, String[] values, boolean caseInsensitive) { if (caseInsensitive) { List<Query> regexList = new ArrayList<Query>(); for (String value : values) { regexList.add(withString(field, value, true)); } return Query.or(regexList); } else { return Query.withValues(field, Query.in, Literal.values(values)); } }
[ "public", "static", "Query", "withStrings", "(", "String", "field", ",", "String", "[", "]", "values", ",", "boolean", "caseInsensitive", ")", "{", "if", "(", "caseInsensitive", ")", "{", "List", "<", "Query", ">", "regexList", "=", "new", "ArrayList", "<"...
<pre> { "$or": [{ field: <field>, regex: <^string$>, caseInsensitive: <caseInsensitive>, ... }, ... ]} </pre>
[ "<pre", ">", "{", "$or", ":", "[", "{", "field", ":", "<field", ">", "regex", ":", "<^string$", ">", "caseInsensitive", ":", "<caseInsensitive", ">", "...", "}", "...", "]", "}", "<", "/", "pre", ">" ]
train
https://github.com/lightblue-platform/lightblue-client/blob/03790aff34e90d3889f60fd6c603c21a21dc1a40/core/src/main/java/com/redhat/lightblue/client/Query.java#L220-L230
micronaut-projects/micronaut-core
core/src/main/java/io/micronaut/core/util/StringUtils.java
StringUtils.tokenizeToStringArray
public static String[] tokenizeToStringArray(String str, String delimiters) { return tokenizeToStringArray(str, delimiters, true, true); }
java
public static String[] tokenizeToStringArray(String str, String delimiters) { return tokenizeToStringArray(str, delimiters, true, true); }
[ "public", "static", "String", "[", "]", "tokenizeToStringArray", "(", "String", "str", ",", "String", "delimiters", ")", "{", "return", "tokenizeToStringArray", "(", "str", ",", "delimiters", ",", "true", ",", "true", ")", ";", "}" ]
Tokenize the given String into a String array via a StringTokenizer. Trims tokens and omits empty tokens. <p>The given delimiters string is supposed to consist of any number of delimiter characters. Each of those characters can be used to separate tokens. A delimiter is always a single character; for multi-character delimiters, consider using <code>delimitedListToStringArray</code> <p/> <p>Copied from the Spring Framework while retaining all license, copyright and author information. @param str the String to tokenize @param delimiters the delimiter characters, assembled as String (each of those characters is individually considered as delimiter). @return an array of the tokens @see java.util.StringTokenizer @see java.lang.String#trim()
[ "Tokenize", "the", "given", "String", "into", "a", "String", "array", "via", "a", "StringTokenizer", ".", "Trims", "tokens", "and", "omits", "empty", "tokens", ".", "<p", ">", "The", "given", "delimiters", "string", "is", "supposed", "to", "consist", "of", ...
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/util/StringUtils.java#L169-L171
Azure/azure-sdk-for-java
cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountsInner.java
CognitiveServicesAccountsInner.regenerateKeyAsync
public Observable<CognitiveServicesAccountKeysInner> regenerateKeyAsync(String resourceGroupName, String accountName) { return regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<CognitiveServicesAccountKeysInner>, CognitiveServicesAccountKeysInner>() { @Override public CognitiveServicesAccountKeysInner call(ServiceResponse<CognitiveServicesAccountKeysInner> response) { return response.body(); } }); }
java
public Observable<CognitiveServicesAccountKeysInner> regenerateKeyAsync(String resourceGroupName, String accountName) { return regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<CognitiveServicesAccountKeysInner>, CognitiveServicesAccountKeysInner>() { @Override public CognitiveServicesAccountKeysInner call(ServiceResponse<CognitiveServicesAccountKeysInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "CognitiveServicesAccountKeysInner", ">", "regenerateKeyAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ")", "{", "return", "regenerateKeyWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ")", "."...
Regenerates the specified account key for the specified Cognitive Services account. @param resourceGroupName The name of the resource group within the user's subscription. @param accountName The name of the cognitive services account within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the CognitiveServicesAccountKeysInner object
[ "Regenerates", "the", "specified", "account", "key", "for", "the", "specified", "Cognitive", "Services", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountsInner.java#L850-L857
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithoutPath.java
PactDslRequestWithoutPath.matchPath
public PactDslRequestWithPath matchPath(String pathRegex, String path) { requestMatchers.addCategory("path").addRule(new RegexMatcher(pathRegex)); return new PactDslRequestWithPath(consumerPactBuilder, consumerName, providerName, pactDslWithState.state, description, path, requestMethod, requestHeaders, query, requestBody, requestMatchers, requestGenerators, defaultRequestValues, defaultResponseValues); }
java
public PactDslRequestWithPath matchPath(String pathRegex, String path) { requestMatchers.addCategory("path").addRule(new RegexMatcher(pathRegex)); return new PactDslRequestWithPath(consumerPactBuilder, consumerName, providerName, pactDslWithState.state, description, path, requestMethod, requestHeaders, query, requestBody, requestMatchers, requestGenerators, defaultRequestValues, defaultResponseValues); }
[ "public", "PactDslRequestWithPath", "matchPath", "(", "String", "pathRegex", ",", "String", "path", ")", "{", "requestMatchers", ".", "addCategory", "(", "\"path\"", ")", ".", "addRule", "(", "new", "RegexMatcher", "(", "pathRegex", ")", ")", ";", "return", "n...
The path of the request @param path string path to use when generating requests @param pathRegex regular expression to use to match paths
[ "The", "path", "of", "the", "request" ]
train
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithoutPath.java#L270-L275
jenkinsci/github-plugin
src/main/java/org/jenkinsci/plugins/github/webhook/WebhookManager.java
WebhookManager.createWebhook
protected Function<GHRepository, GHHook> createWebhook(final URL url, final Set<GHEvent> events) { return new NullSafeFunction<GHRepository, GHHook>() { protected GHHook applyNullSafe(@Nonnull GHRepository repo) { try { final HashMap<String, String> config = new HashMap<>(); config.put("url", url.toExternalForm()); config.put("content_type", "json"); final Secret secret = GitHubPlugin.configuration().getHookSecretConfig().getHookSecret(); if (secret != null) { config.put("secret", secret.getPlainText()); } return repo.createHook("web", config, events, true); } catch (IOException e) { throw new GHException("Failed to create hook", e); } } }; }
java
protected Function<GHRepository, GHHook> createWebhook(final URL url, final Set<GHEvent> events) { return new NullSafeFunction<GHRepository, GHHook>() { protected GHHook applyNullSafe(@Nonnull GHRepository repo) { try { final HashMap<String, String> config = new HashMap<>(); config.put("url", url.toExternalForm()); config.put("content_type", "json"); final Secret secret = GitHubPlugin.configuration().getHookSecretConfig().getHookSecret(); if (secret != null) { config.put("secret", secret.getPlainText()); } return repo.createHook("web", config, events, true); } catch (IOException e) { throw new GHException("Failed to create hook", e); } } }; }
[ "protected", "Function", "<", "GHRepository", ",", "GHHook", ">", "createWebhook", "(", "final", "URL", "url", ",", "final", "Set", "<", "GHEvent", ">", "events", ")", "{", "return", "new", "NullSafeFunction", "<", "GHRepository", ",", "GHHook", ">", "(", ...
@param url jenkins endpoint url @param events list of GH events jenkins interested in @return converter to create GH hook for given url with given events
[ "@param", "url", "jenkins", "endpoint", "url", "@param", "events", "list", "of", "GH", "events", "jenkins", "interested", "in" ]
train
https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/webhook/WebhookManager.java#L315-L335
box/box-java-sdk
src/main/java/com/box/sdk/BoxUser.java
BoxUser.createAppUser
public static BoxUser.Info createAppUser(BoxAPIConnection api, String name) { return createAppUser(api, name, new CreateUserParams()); }
java
public static BoxUser.Info createAppUser(BoxAPIConnection api, String name) { return createAppUser(api, name, new CreateUserParams()); }
[ "public", "static", "BoxUser", ".", "Info", "createAppUser", "(", "BoxAPIConnection", "api", ",", "String", "name", ")", "{", "return", "createAppUser", "(", "api", ",", "name", ",", "new", "CreateUserParams", "(", ")", ")", ";", "}" ]
Provisions a new app user in an enterprise using Box Developer Edition. @param api the API connection to be used by the created user. @param name the name of the user. @return the created user's info.
[ "Provisions", "a", "new", "app", "user", "in", "an", "enterprise", "using", "Box", "Developer", "Edition", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxUser.java#L83-L85
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/CFEndPointImpl.java
CFEndPointImpl.assignPort
private void assignPort(String portString, String listenPortString) throws ChannelFrameworkException, NumberFormatException { if (portString != null) { // Found a port string. Convert it to an int. port = Integer.parseInt(portString); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Port set from regular tcp port: " + port); } } else { // Port String not found so try the backup listening port. if (listenPortString != null) { // Found a listening port string. Convert it to an int. port = Integer.parseInt(listenPortString); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Port set from tcp listening port: " + port); } } else { // Listening port not found either. throw new ChannelFrameworkException("Port not available in TCP channel properties."); } } }
java
private void assignPort(String portString, String listenPortString) throws ChannelFrameworkException, NumberFormatException { if (portString != null) { // Found a port string. Convert it to an int. port = Integer.parseInt(portString); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Port set from regular tcp port: " + port); } } else { // Port String not found so try the backup listening port. if (listenPortString != null) { // Found a listening port string. Convert it to an int. port = Integer.parseInt(listenPortString); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Port set from tcp listening port: " + port); } } else { // Listening port not found either. throw new ChannelFrameworkException("Port not available in TCP channel properties."); } } }
[ "private", "void", "assignPort", "(", "String", "portString", ",", "String", "listenPortString", ")", "throws", "ChannelFrameworkException", ",", "NumberFormatException", "{", "if", "(", "portString", "!=", "null", ")", "{", "// Found a port string. Convert it to an int."...
Assign the value of port based on the parameters. If the first parameter is null, the second/backup will be used. @param portString @param listenPortString @throws ChannelFrameworkException @throws NumberFormatException - format of port string is not valid
[ "Assign", "the", "value", "of", "port", "based", "on", "the", "parameters", ".", "If", "the", "first", "parameter", "is", "null", "the", "second", "/", "backup", "will", "be", "used", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/CFEndPointImpl.java#L273-L293
aoindustries/aocode-public
src/main/java/com/aoindustries/io/LoggingProxy.java
LoggingProxy.log
private static void log(File logFile, long connectionId, char separator, String line) { synchronized(logFile) { try { try (Writer out = new FileWriter(logFile, true)) { out.write(Long.toString(connectionId)); out.write(separator); out.write(' '); out.write(line); out.write('\n'); } } catch(IOException e) { e.printStackTrace(System.err); } } }
java
private static void log(File logFile, long connectionId, char separator, String line) { synchronized(logFile) { try { try (Writer out = new FileWriter(logFile, true)) { out.write(Long.toString(connectionId)); out.write(separator); out.write(' '); out.write(line); out.write('\n'); } } catch(IOException e) { e.printStackTrace(System.err); } } }
[ "private", "static", "void", "log", "(", "File", "logFile", ",", "long", "connectionId", ",", "char", "separator", ",", "String", "line", ")", "{", "synchronized", "(", "logFile", ")", "{", "try", "{", "try", "(", "Writer", "out", "=", "new", "FileWriter...
Writes one line to the given file, synchronizes on the file object.
[ "Writes", "one", "line", "to", "the", "given", "file", "synchronizes", "on", "the", "file", "object", "." ]
train
https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/io/LoggingProxy.java#L52-L66
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/LocaleData.java
LocaleData.getChar
public static final char getChar(Locale locale, String key) { ResourceBundle bundle = ResourceBundle.getBundle(LocaleData.class.getName(), locale); return (bundle.getString(key).charAt(0)); }
java
public static final char getChar(Locale locale, String key) { ResourceBundle bundle = ResourceBundle.getBundle(LocaleData.class.getName(), locale); return (bundle.getString(key).charAt(0)); }
[ "public", "static", "final", "char", "getChar", "(", "Locale", "locale", ",", "String", "key", ")", "{", "ResourceBundle", "bundle", "=", "ResourceBundle", ".", "getBundle", "(", "LocaleData", ".", "class", ".", "getName", "(", ")", ",", "locale", ")", ";"...
Convenience method for retrieving a char resource. @param locale locale identifier @param key resource key @return resource value
[ "Convenience", "method", "for", "retrieving", "a", "char", "resource", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/LocaleData.java#L138-L142
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/AbstractRepositoryClient.java
AbstractRepositoryClient.getAssets
@Override public Collection<Asset> getAssets(final Collection<ResourceType> types, final Collection<String> productIds, final Visibility visibility, final Collection<String> productVersions) throws IOException, RequestFailureException { return getFilteredAssets(types, productIds, visibility, productVersions, false); }
java
@Override public Collection<Asset> getAssets(final Collection<ResourceType> types, final Collection<String> productIds, final Visibility visibility, final Collection<String> productVersions) throws IOException, RequestFailureException { return getFilteredAssets(types, productIds, visibility, productVersions, false); }
[ "@", "Override", "public", "Collection", "<", "Asset", ">", "getAssets", "(", "final", "Collection", "<", "ResourceType", ">", "types", ",", "final", "Collection", "<", "String", ">", "productIds", ",", "final", "Visibility", "visibility", ",", "final", "Colle...
This method will return all of the assets matching specific filters in Massive. It will just return a summary of each asset and not include any {@link Attachment}s. @param types The types to look for or <code>null</code> will return all types @param productIds The product IDs to look for. Should not be <code>null</code> although supplying this will return assets for any product ID @param visibility The visibility to look for or <code>null</code> will return all visibility values (or none) @param productVersions The values of the minimum version in the appliesToFilterInfo to look for @return A collection of the assets of that type @throws IOException @throws RequestFailureException
[ "This", "method", "will", "return", "all", "of", "the", "assets", "matching", "specific", "filters", "in", "Massive", ".", "It", "will", "just", "return", "a", "summary", "of", "each", "asset", "and", "not", "include", "any", "{", "@link", "Attachment", "}...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/AbstractRepositoryClient.java#L49-L53
line/centraldogma
server/src/main/java/com/linecorp/centraldogma/server/internal/api/HttpApiUtil.java
HttpApiUtil.newResponse
public static HttpResponse newResponse(RequestContext ctx, HttpStatus status, Throwable cause) { requireNonNull(ctx, "ctx"); requireNonNull(status, "status"); requireNonNull(cause, "cause"); return newResponse0(ctx, status, cause, null); }
java
public static HttpResponse newResponse(RequestContext ctx, HttpStatus status, Throwable cause) { requireNonNull(ctx, "ctx"); requireNonNull(status, "status"); requireNonNull(cause, "cause"); return newResponse0(ctx, status, cause, null); }
[ "public", "static", "HttpResponse", "newResponse", "(", "RequestContext", "ctx", ",", "HttpStatus", "status", ",", "Throwable", "cause", ")", "{", "requireNonNull", "(", "ctx", ",", "\"ctx\"", ")", ";", "requireNonNull", "(", "status", ",", "\"status\"", ")", ...
Returns a newly created {@link HttpResponse} with the specified {@link HttpStatus} and {@code cause}.
[ "Returns", "a", "newly", "created", "{" ]
train
https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/api/HttpApiUtil.java#L125-L130
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/transfer/internal/S3ProgressPublisher.java
S3ProgressPublisher.publishTransferPersistable
public static Future<?> publishTransferPersistable( final ProgressListener listener, final PersistableTransfer persistableTransfer) { if (persistableTransfer == null || !(listener instanceof S3ProgressListener)) { return null; } final S3ProgressListener s3listener = (S3ProgressListener)listener; return deliverEvent(s3listener, persistableTransfer); }
java
public static Future<?> publishTransferPersistable( final ProgressListener listener, final PersistableTransfer persistableTransfer) { if (persistableTransfer == null || !(listener instanceof S3ProgressListener)) { return null; } final S3ProgressListener s3listener = (S3ProgressListener)listener; return deliverEvent(s3listener, persistableTransfer); }
[ "public", "static", "Future", "<", "?", ">", "publishTransferPersistable", "(", "final", "ProgressListener", "listener", ",", "final", "PersistableTransfer", "persistableTransfer", ")", "{", "if", "(", "persistableTransfer", "==", "null", "||", "!", "(", "listener",...
Used to deliver a persistable transfer to the given s3 listener. @param listener only listener of type {@link S3ProgressListener} will be notified. @return the future of a submitted task; or null if the delivery is synchronous with no future task involved. Note a listener should never block, and therefore returning null is the typical case.
[ "Used", "to", "deliver", "a", "persistable", "transfer", "to", "the", "given", "s3", "listener", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/transfer/internal/S3ProgressPublisher.java#L40-L48
kite-sdk/kite
kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/FileSystemUtil.java
FileSystemUtil.deleteParentDirectoriesIfEmpty
static boolean deleteParentDirectoriesIfEmpty(FileSystem fs, Path root, Path path) throws IOException { boolean deleted = false; try { for (Path current = path.getParent(); !current.equals(root) && !(current.getParent() == null); current = current.getParent()) { final FileStatus[] stats = fs.listStatus(current); if (stats == null || stats.length == 0) { // dir is empty and should be removed LOG.debug("Deleting empty path {}", current); deleted = fs.delete(current, true) || deleted; } else { // all parent directories will be non-empty break; } } } catch (FileNotFoundException e) { LOG.debug("Path does not exist it may have been deleted by another process.", e); } return deleted; }
java
static boolean deleteParentDirectoriesIfEmpty(FileSystem fs, Path root, Path path) throws IOException { boolean deleted = false; try { for (Path current = path.getParent(); !current.equals(root) && !(current.getParent() == null); current = current.getParent()) { final FileStatus[] stats = fs.listStatus(current); if (stats == null || stats.length == 0) { // dir is empty and should be removed LOG.debug("Deleting empty path {}", current); deleted = fs.delete(current, true) || deleted; } else { // all parent directories will be non-empty break; } } } catch (FileNotFoundException e) { LOG.debug("Path does not exist it may have been deleted by another process.", e); } return deleted; }
[ "static", "boolean", "deleteParentDirectoriesIfEmpty", "(", "FileSystem", "fs", ",", "Path", "root", ",", "Path", "path", ")", "throws", "IOException", "{", "boolean", "deleted", "=", "false", ";", "try", "{", "for", "(", "Path", "current", "=", "path", ".",...
Deletes the empty parent directories of the specified path. The method catches and ignores FileNotFoundException as it is possible that multiple parallel Kite instances are importing into a directory under the same root directory and it can happen that a Kite instance founds an empty directory which needs to be deleted but when it tries execute the delete command the folder is missing because it has been already deleted by another Kite instance. @param fs the FileSystem @param root The empty parent directories have to be deleted up to this root directory. @param path The parent directories of this path will be deleted. @return True if at least one empty parent directory was deleted false otherwise. @throws IOException
[ "Deletes", "the", "empty", "parent", "directories", "of", "the", "specified", "path", ".", "The", "method", "catches", "and", "ignores", "FileNotFoundException", "as", "it", "is", "possible", "that", "multiple", "parallel", "Kite", "instances", "are", "importing",...
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/FileSystemUtil.java#L258-L278
codegist/crest
core/src/main/java/org/codegist/crest/CRestBuilder.java
CRestBuilder.extractsEntityAuthParamsWith
public CRestBuilder extractsEntityAuthParamsWith(String entityContentType, EntityParamExtractor entityParamExtractor){ this.httpEntityParamExtrators.put(entityContentType, entityParamExtractor); return this; }
java
public CRestBuilder extractsEntityAuthParamsWith(String entityContentType, EntityParamExtractor entityParamExtractor){ this.httpEntityParamExtrators.put(entityContentType, entityParamExtractor); return this; }
[ "public", "CRestBuilder", "extractsEntityAuthParamsWith", "(", "String", "entityContentType", ",", "EntityParamExtractor", "entityParamExtractor", ")", "{", "this", ".", "httpEntityParamExtrators", ".", "put", "(", "entityContentType", ",", "entityParamExtractor", ")", ";",...
<p>Sets an entity parameters extractor for authenticated requests.</p> <p>When <b>CRest</b> is configured to authenticate requests, it uses an {@link org.codegist.crest.io.http.EntityParamExtractor} to extract parameters from the request entity to include them in the authentication process.</p> <p>A common use case is to deal with OAuth and multipart as some provider will use some multipart parameters and some not (binaries usually) in order to sign a request</p> @param entityContentType Entity Content-Type to bind the extractor to @param entityParamExtractor Extractor @return current builder
[ "<p", ">", "Sets", "an", "entity", "parameters", "extractor", "for", "authenticated", "requests", ".", "<", "/", "p", ">", "<p", ">", "When", "<b", ">", "CRest<", "/", "b", ">", "is", "configured", "to", "authenticate", "requests", "it", "uses", "an", ...
train
https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/CRestBuilder.java#L677-L680
craterdog/java-general-utilities
src/main/java/craterdog/utils/ByteUtils.java
ByteUtils.bigIntegerToBytes
static public int bigIntegerToBytes(BigInteger integer, byte[] buffer, int index) { int length = 4 + (integer.bitLength() + 8) / 8; System.arraycopy(intToBytes(length), 0, buffer, index, 4); // copy in the length index += 4; System.arraycopy(integer.toByteArray(), 0, buffer, index, length - 4); // copy in the big integer return length; }
java
static public int bigIntegerToBytes(BigInteger integer, byte[] buffer, int index) { int length = 4 + (integer.bitLength() + 8) / 8; System.arraycopy(intToBytes(length), 0, buffer, index, 4); // copy in the length index += 4; System.arraycopy(integer.toByteArray(), 0, buffer, index, length - 4); // copy in the big integer return length; }
[ "static", "public", "int", "bigIntegerToBytes", "(", "BigInteger", "integer", ",", "byte", "[", "]", "buffer", ",", "int", "index", ")", "{", "int", "length", "=", "4", "+", "(", "integer", ".", "bitLength", "(", ")", "+", "8", ")", "/", "8", ";", ...
This function converts a big integer into its corresponding byte format and inserts it into the specified buffer at the specified index. @param integer The big integer to be converted. @param buffer The byte array. @param index The index in the array to begin inserting bytes. @return The number of bytes inserted.
[ "This", "function", "converts", "a", "big", "integer", "into", "its", "corresponding", "byte", "format", "and", "inserts", "it", "into", "the", "specified", "buffer", "at", "the", "specified", "index", "." ]
train
https://github.com/craterdog/java-general-utilities/blob/a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57/src/main/java/craterdog/utils/ByteUtils.java#L355-L361
jglobus/JGlobus
gridftp/src/main/java/org/globus/ftp/vanilla/FTPControlChannel.java
FTPControlChannel.waitFor
public void waitFor(Flag aborted, int ioDelay, int maxWait) throws ServerException, IOException, InterruptedException { int oldTimeout = this.socket.getSoTimeout(); try { int c = 0; if (maxWait != WAIT_FOREVER) { this.socket.setSoTimeout(maxWait); } else { this.socket.setSoTimeout(0); } c = this.checkSocketDone(aborted, ioDelay, maxWait); /* A bug in the server causes it to append \0 to each reply. As the result, we receive this \0 before the next reply. The code below handles this case. */ if (c != 0) { // if we're here, the server is healthy // and the reply is waiting in the buffer return; } // if we're here, we deal with the buggy server. // we discarded the \0 and now resume wait. logger.debug("Server sent \\0; resume wait"); try { // gotta read past the 0 we just remarked c = ftpIn.read(); c = this.checkSocketDone(aborted, ioDelay, maxWait); } catch (SocketTimeoutException e) { throw new ServerException(ServerException.REPLY_TIMEOUT); } catch (EOFException e) { throw new InterruptedException(); } } finally { this.socket.setSoTimeout(oldTimeout); } }
java
public void waitFor(Flag aborted, int ioDelay, int maxWait) throws ServerException, IOException, InterruptedException { int oldTimeout = this.socket.getSoTimeout(); try { int c = 0; if (maxWait != WAIT_FOREVER) { this.socket.setSoTimeout(maxWait); } else { this.socket.setSoTimeout(0); } c = this.checkSocketDone(aborted, ioDelay, maxWait); /* A bug in the server causes it to append \0 to each reply. As the result, we receive this \0 before the next reply. The code below handles this case. */ if (c != 0) { // if we're here, the server is healthy // and the reply is waiting in the buffer return; } // if we're here, we deal with the buggy server. // we discarded the \0 and now resume wait. logger.debug("Server sent \\0; resume wait"); try { // gotta read past the 0 we just remarked c = ftpIn.read(); c = this.checkSocketDone(aborted, ioDelay, maxWait); } catch (SocketTimeoutException e) { throw new ServerException(ServerException.REPLY_TIMEOUT); } catch (EOFException e) { throw new InterruptedException(); } } finally { this.socket.setSoTimeout(oldTimeout); } }
[ "public", "void", "waitFor", "(", "Flag", "aborted", ",", "int", "ioDelay", ",", "int", "maxWait", ")", "throws", "ServerException", ",", "IOException", ",", "InterruptedException", "{", "int", "oldTimeout", "=", "this", ".", "socket", ".", "getSoTimeout", "("...
Block until one of the conditions are true: <ol> <li> a reply is available in the control channel, <li> timeout (maxWait) expired <li> aborted flag changes to true. </ol> If maxWait == WAIT_FOREVER, never timeout and only check conditions (1) and (3). @param maxWait timeout in miliseconds @param ioDelay frequency of polling the control channel and checking the conditions @param aborted flag indicating wait aborted.
[ "Block", "until", "one", "of", "the", "conditions", "are", "true", ":", "<ol", ">", "<li", ">", "a", "reply", "is", "available", "in", "the", "control", "channel", "<li", ">", "timeout", "(", "maxWait", ")", "expired", "<li", ">", "aborted", "flag", "c...
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gridftp/src/main/java/org/globus/ftp/vanilla/FTPControlChannel.java#L319-L362
Impetus/Kundera
src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/query/CassQuery.java
CassQuery.getColumnName
private String getColumnName(EntityMetadata metadata, String property) { MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(metadata.getPersistenceUnit()); String jpaColumnName = null; if (property.equals(((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName())) { jpaColumnName = CassandraUtilities.getIdColumnName(kunderaMetadata, metadata, ((CassandraClientBase) persistenceDelegeator.getClient(metadata)).getExternalProperties(), ((CassandraClientBase) persistenceDelegeator.getClient(metadata)).isCql3Enabled(metadata)); } else { jpaColumnName = ((AbstractAttribute) metaModel.getEntityAttribute(metadata.getEntityClazz(), property)) .getJPAColumnName(); } return jpaColumnName; }
java
private String getColumnName(EntityMetadata metadata, String property) { MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(metadata.getPersistenceUnit()); String jpaColumnName = null; if (property.equals(((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName())) { jpaColumnName = CassandraUtilities.getIdColumnName(kunderaMetadata, metadata, ((CassandraClientBase) persistenceDelegeator.getClient(metadata)).getExternalProperties(), ((CassandraClientBase) persistenceDelegeator.getClient(metadata)).isCql3Enabled(metadata)); } else { jpaColumnName = ((AbstractAttribute) metaModel.getEntityAttribute(metadata.getEntityClazz(), property)) .getJPAColumnName(); } return jpaColumnName; }
[ "private", "String", "getColumnName", "(", "EntityMetadata", "metadata", ",", "String", "property", ")", "{", "MetamodelImpl", "metaModel", "=", "(", "MetamodelImpl", ")", "kunderaMetadata", ".", "getApplicationMetadata", "(", ")", ".", "getMetamodel", "(", "metadat...
Gets column name for a given field name. @param metadata the metadata @param property the property @return the column name
[ "Gets", "column", "name", "for", "a", "given", "field", "name", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/query/CassQuery.java#L1328-L1342
knowm/XChange
xchange-okcoin/src/main/java/org/knowm/xchange/okcoin/service/OkCoinFuturesTradeService.java
OkCoinFuturesTradeService.getPriceLimits
public OkCoinPriceLimit getPriceLimits(CurrencyPair currencyPair, Object... args) throws IOException { if (args != null && args.length > 0) return getFuturesPriceLimits(currencyPair, (FuturesContract) args[0]); else return getFuturesPriceLimits(currencyPair, futuresContract); }
java
public OkCoinPriceLimit getPriceLimits(CurrencyPair currencyPair, Object... args) throws IOException { if (args != null && args.length > 0) return getFuturesPriceLimits(currencyPair, (FuturesContract) args[0]); else return getFuturesPriceLimits(currencyPair, futuresContract); }
[ "public", "OkCoinPriceLimit", "getPriceLimits", "(", "CurrencyPair", "currencyPair", ",", "Object", "...", "args", ")", "throws", "IOException", "{", "if", "(", "args", "!=", "null", "&&", "args", ".", "length", ">", "0", ")", "return", "getFuturesPriceLimits", ...
Retrieves the max price from the okex imposed by the price limits
[ "Retrieves", "the", "max", "price", "from", "the", "okex", "imposed", "by", "the", "price", "limits" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-okcoin/src/main/java/org/knowm/xchange/okcoin/service/OkCoinFuturesTradeService.java#L142-L147
aws/aws-sdk-java
aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/AddOperations.java
AddOperations.getResultShapeName
private static String getResultShapeName(Operation operation, Map<String, Shape> shapes) { Output output = operation.getOutput(); if (output == null) return null; Shape outputShape = shapes.get(output.getShape()); if (outputShape.getMembers().keySet().size() != 1) return output.getShape(); Member wrappedMember = outputShape.getMembers().values().toArray(new Member[0])[0]; Shape wrappedResult = shapes.get(wrappedMember.getShape()); return wrappedResult != null && wrappedResult.isWrapper() ? wrappedMember.getShape() : output.getShape(); }
java
private static String getResultShapeName(Operation operation, Map<String, Shape> shapes) { Output output = operation.getOutput(); if (output == null) return null; Shape outputShape = shapes.get(output.getShape()); if (outputShape.getMembers().keySet().size() != 1) return output.getShape(); Member wrappedMember = outputShape.getMembers().values().toArray(new Member[0])[0]; Shape wrappedResult = shapes.get(wrappedMember.getShape()); return wrappedResult != null && wrappedResult.isWrapper() ? wrappedMember.getShape() : output.getShape(); }
[ "private", "static", "String", "getResultShapeName", "(", "Operation", "operation", ",", "Map", "<", "String", ",", "Shape", ">", "shapes", ")", "{", "Output", "output", "=", "operation", ".", "getOutput", "(", ")", ";", "if", "(", "output", "==", "null", ...
In query protocol, the wrapped result is the real return type for the given operation. In the c2j model, if the output shape has only one member, and the member shape is wrapped (wrapper is true), then the return type is the wrapped member shape instead of the output shape. In the following example, the service API is: public Foo operation(OperationRequest operationRequest); And the wire log is: <OperationResponse> <OperationResult> <Foo> ... </Foo> </OperationResult> <OperationMetadata> </OperationMetadata> </OperationResponse> The C2j model is: "Operation": { "input": {"shape": "OperationRequest"}, "output": { "shape": "OperationResult", "resultWrapper": "OperationResult" } }, "OperationResult": { ... "members": { "Foo": {"shape": "Foo"} } }, "Foo" : { ... "wrapper" : true } Return the wrapped shape name from the given operation if it conforms to the condition described above, otherwise, simply return the direct output shape name.
[ "In", "query", "protocol", "the", "wrapped", "result", "is", "the", "real", "return", "type", "for", "the", "given", "operation", ".", "In", "the", "c2j", "model", "if", "the", "output", "shape", "has", "only", "one", "member", "and", "the", "member", "s...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/AddOperations.java#L217-L225
thinkaurelius/faunus
src/main/java/com/thinkaurelius/faunus/FaunusPipeline.java
FaunusPipeline.linkOut
public FaunusPipeline linkOut(final String label, final String step, final String mergeWeightKey) { return link(OUT, label, step, mergeWeightKey); }
java
public FaunusPipeline linkOut(final String label, final String step, final String mergeWeightKey) { return link(OUT, label, step, mergeWeightKey); }
[ "public", "FaunusPipeline", "linkOut", "(", "final", "String", "label", ",", "final", "String", "step", ",", "final", "String", "mergeWeightKey", ")", "{", "return", "link", "(", "OUT", ",", "label", ",", "step", ",", "mergeWeightKey", ")", ";", "}" ]
Have the elements for the named step previous project an edge from the current vertex with provided label. If a merge weight key is provided, then count the number of duplicate edges between the same two vertices and add a weight. No weight key is specified by "_" and then all duplicates are merged, but no weight is added to the resultant edge. @param step the name of the step where the source vertices were @param label the label of the edge to project @param mergeWeightKey the property key to use for weight @return the extended FaunusPipeline
[ "Have", "the", "elements", "for", "the", "named", "step", "previous", "project", "an", "edge", "from", "the", "current", "vertex", "with", "provided", "label", ".", "If", "a", "merge", "weight", "key", "is", "provided", "then", "count", "the", "number", "o...
train
https://github.com/thinkaurelius/faunus/blob/1eb8494eeb3fe3b84a98d810d304ba01d55b0d6e/src/main/java/com/thinkaurelius/faunus/FaunusPipeline.java#L856-L858
igniterealtime/Smack
smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleContentDescriptionProvider.java
JingleContentDescriptionProvider.parsePayload
protected JinglePayloadType parsePayload(final XmlPullParser parser) { int ptId = 0; String ptName; int ptChannels = 0; try { ptId = Integer.parseInt(parser.getAttributeValue("", "id")); } catch (Exception e) { } ptName = parser.getAttributeValue("", "name"); try { ptChannels = Integer.parseInt(parser.getAttributeValue("", "channels")); } catch (Exception e) { } return new JinglePayloadType(new PayloadType(ptId, ptName, ptChannels)); }
java
protected JinglePayloadType parsePayload(final XmlPullParser parser) { int ptId = 0; String ptName; int ptChannels = 0; try { ptId = Integer.parseInt(parser.getAttributeValue("", "id")); } catch (Exception e) { } ptName = parser.getAttributeValue("", "name"); try { ptChannels = Integer.parseInt(parser.getAttributeValue("", "channels")); } catch (Exception e) { } return new JinglePayloadType(new PayloadType(ptId, ptName, ptChannels)); }
[ "protected", "JinglePayloadType", "parsePayload", "(", "final", "XmlPullParser", "parser", ")", "{", "int", "ptId", "=", "0", ";", "String", "ptName", ";", "int", "ptChannels", "=", "0", ";", "try", "{", "ptId", "=", "Integer", ".", "parseInt", "(", "parse...
Parse a iq/jingle/description/payload-type element. @param parser the input to parse @return a payload type element
[ "Parse", "a", "iq", "/", "jingle", "/", "description", "/", "payload", "-", "type", "element", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleContentDescriptionProvider.java#L44-L62
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java
ComputationGraph.doEvaluation
public <T extends IEvaluation> T[] doEvaluation(MultiDataSetIterator iterator, T... evaluations) { try{ return doEvaluationHelper(iterator, evaluations); } catch (OutOfMemoryError e){ CrashReportingUtil.writeMemoryCrashDump(this, e); throw e; } }
java
public <T extends IEvaluation> T[] doEvaluation(MultiDataSetIterator iterator, T... evaluations) { try{ return doEvaluationHelper(iterator, evaluations); } catch (OutOfMemoryError e){ CrashReportingUtil.writeMemoryCrashDump(this, e); throw e; } }
[ "public", "<", "T", "extends", "IEvaluation", ">", "T", "[", "]", "doEvaluation", "(", "MultiDataSetIterator", "iterator", ",", "T", "...", "evaluations", ")", "{", "try", "{", "return", "doEvaluationHelper", "(", "iterator", ",", "evaluations", ")", ";", "}...
Perform evaluation on the given data (MultiDataSetIterator) with the given {@link IEvaluation} instance @param iterator Test data to evaluate on @param evaluations IEvaluation insntance @param <T> Type of the IEvaluation instance @return The input IEvaluation instance, after performing evaluation on the test data
[ "Perform", "evaluation", "on", "the", "given", "data", "(", "MultiDataSetIterator", ")", "with", "the", "given", "{", "@link", "IEvaluation", "}", "instance" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L4022-L4029
Impetus/Kundera
src/kundera-cassandra/cassandra-ds-driver/src/main/java/com/impetus/kundera/client/cassandra/dsdriver/DSClientUtilities.java
DSClientUtilities.setIntValue
private static Object setIntValue(Field member, Object retVal) { if (member != null) { if (member.getType().isAssignableFrom(byte.class)) { retVal = ((Integer) retVal).byteValue(); } else if (member.getType().isAssignableFrom(short.class)) { retVal = ((Integer) retVal).shortValue(); } } return retVal; }
java
private static Object setIntValue(Field member, Object retVal) { if (member != null) { if (member.getType().isAssignableFrom(byte.class)) { retVal = ((Integer) retVal).byteValue(); } else if (member.getType().isAssignableFrom(short.class)) { retVal = ((Integer) retVal).shortValue(); } } return retVal; }
[ "private", "static", "Object", "setIntValue", "(", "Field", "member", ",", "Object", "retVal", ")", "{", "if", "(", "member", "!=", "null", ")", "{", "if", "(", "member", ".", "getType", "(", ")", ".", "isAssignableFrom", "(", "byte", ".", "class", ")"...
Sets the int value. @param member the member @param retVal the ret val @return the object
[ "Sets", "the", "int", "value", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-ds-driver/src/main/java/com/impetus/kundera/client/cassandra/dsdriver/DSClientUtilities.java#L735-L749
eduarddrenth/ConfigurableReports
src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java
DefaultElementProducer.createTableCell
public PdfPCell createTableCell(Object val, Collection<BaseStyler> stylers, boolean noWrap) throws VectorPrintException { if (noWrap) { stylers.add(new NoWrap()); } return createCell(val, stylers); }
java
public PdfPCell createTableCell(Object val, Collection<BaseStyler> stylers, boolean noWrap) throws VectorPrintException { if (noWrap) { stylers.add(new NoWrap()); } return createCell(val, stylers); }
[ "public", "PdfPCell", "createTableCell", "(", "Object", "val", ",", "Collection", "<", "BaseStyler", ">", "stylers", ",", "boolean", "noWrap", ")", "throws", "VectorPrintException", "{", "if", "(", "noWrap", ")", "{", "stylers", ".", "add", "(", "new", "NoWr...
When noWrap is true a {@link NoWrap} is added to the stylers. Calls {@link #createCell(java.lang.Object, java.util.Collection) } @param val @param stylers @param noWrap @return @throws com.vectorprint.VectorPrintException
[ "When", "noWrap", "is", "true", "a", "{", "@link", "NoWrap", "}", "is", "added", "to", "the", "stylers", ".", "Calls", "{", "@link", "#createCell", "(", "java", ".", "lang", ".", "Object", "java", ".", "util", ".", "Collection", ")", "}" ]
train
https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java#L352-L358