repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.getAt
@SuppressWarnings("unchecked") public static List<Short> getAt(short[] array, ObjectRange range) { return primitiveArrayGet(array, range); }
java
@SuppressWarnings("unchecked") public static List<Short> getAt(short[] array, ObjectRange range) { return primitiveArrayGet(array, range); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "List", "<", "Short", ">", "getAt", "(", "short", "[", "]", "array", ",", "ObjectRange", "range", ")", "{", "return", "primitiveArrayGet", "(", "array", ",", "range", ")", ";", "}" ]
Support the subscript operator with an ObjectRange for a short array @param array a short array @param range an ObjectRange indicating the indices for the items to retrieve @return list of the retrieved shorts @since 1.0
[ "Support", "the", "subscript", "operator", "with", "an", "ObjectRange", "for", "a", "short", "array" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13860-L13863
kkopacz/agiso-core
bundles/agiso-core-lang/src/main/java/org/agiso/core/lang/util/ObjectUtils.java
ObjectUtils.compareChecker
@SuppressWarnings("unchecked") public static final boolean compareChecker(Comparable<?> object1, Comparable<?> object2) { if(null == object1 || null == object2) { return object1 == object2; } else { return 0 == ((Comparable<Object>)object1).compareTo((Comparable<Object>)object2); } }
java
@SuppressWarnings("unchecked") public static final boolean compareChecker(Comparable<?> object1, Comparable<?> object2) { if(null == object1 || null == object2) { return object1 == object2; } else { return 0 == ((Comparable<Object>)object1).compareTo((Comparable<Object>)object2); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "final", "boolean", "compareChecker", "(", "Comparable", "<", "?", ">", "object1", ",", "Comparable", "<", "?", ">", "object2", ")", "{", "if", "(", "null", "==", "object1", "||", "nul...
Porównuje dwa obiekty typu {@link Comparable} wykorzystując metodę <code> comapreTo</code> obiektu przezkazanego prarametrem wywołania <code>object1</code>. Zwraca <code>true</code> jeśli oba przekazane do porównania obiekty nie są określone (mają wartość <code>null</code>).
[ "Porównuje", "dwa", "obiekty", "typu", "{" ]
train
https://github.com/kkopacz/agiso-core/blob/b994ec0146be1fe3f10829d69cd719bdbdebe1c5/bundles/agiso-core-lang/src/main/java/org/agiso/core/lang/util/ObjectUtils.java#L249-L256
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Solo.java
Solo.clickLongOnScreen
public void clickLongOnScreen(float x, float y) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "clickLongOnScreen("+x+", "+y+")"); } clicker.clickLongOnScreen(x, y, 0, null); }
java
public void clickLongOnScreen(float x, float y) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "clickLongOnScreen("+x+", "+y+")"); } clicker.clickLongOnScreen(x, y, 0, null); }
[ "public", "void", "clickLongOnScreen", "(", "float", "x", ",", "float", "y", ")", "{", "if", "(", "config", ".", "commandLogging", ")", "{", "Log", ".", "d", "(", "config", ".", "commandLoggingTag", ",", "\"clickLongOnScreen(\"", "+", "x", "+", "\", \"", ...
Long clicks the specified coordinates. @param x the x coordinate @param y the y coordinate
[ "Long", "clicks", "the", "specified", "coordinates", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L1170-L1176
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.deleteSharedProjectGroupLink
public void deleteSharedProjectGroupLink(GitlabGroup group, GitlabProject project) throws IOException { deleteSharedProjectGroupLink(group.getId(), project.getId()); }
java
public void deleteSharedProjectGroupLink(GitlabGroup group, GitlabProject project) throws IOException { deleteSharedProjectGroupLink(group.getId(), project.getId()); }
[ "public", "void", "deleteSharedProjectGroupLink", "(", "GitlabGroup", "group", ",", "GitlabProject", "project", ")", "throws", "IOException", "{", "deleteSharedProjectGroupLink", "(", "group", ".", "getId", "(", ")", ",", "project", ".", "getId", "(", ")", ")", ...
Delete a shared project link within a group. @param group The group. @param project The project. @throws IOException on gitlab api call error
[ "Delete", "a", "shared", "project", "link", "within", "a", "group", "." ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3904-L3906
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/bot/sharding/DefaultShardManagerBuilder.java
DefaultShardManagerBuilder.setContextMap
public DefaultShardManagerBuilder setContextMap(IntFunction<? extends ConcurrentMap<String, String>> provider) { this.contextProvider = provider; if (provider != null) this.enableContext = true; return this; }
java
public DefaultShardManagerBuilder setContextMap(IntFunction<? extends ConcurrentMap<String, String>> provider) { this.contextProvider = provider; if (provider != null) this.enableContext = true; return this; }
[ "public", "DefaultShardManagerBuilder", "setContextMap", "(", "IntFunction", "<", "?", "extends", "ConcurrentMap", "<", "String", ",", "String", ">", ">", "provider", ")", "{", "this", ".", "contextProvider", "=", "provider", ";", "if", "(", "provider", "!=", ...
Sets the {@link org.slf4j.MDC MDC} mappings provider to use in JDA. <br>If sharding is enabled JDA will automatically add a {@code jda.shard} context with the format {@code [SHARD_ID / TOTAL]} where {@code SHARD_ID} and {@code TOTAL} are the shard configuration. Additionally it will provide context for the id via {@code jda.shard.id} and the total via {@code jda.shard.total}. <p><b>The manager will call this with a shardId and it is recommended to provide a different context map for each shard!</b> <br>This automatically switches {@link #setContextEnabled(boolean)} to true if the provided function is not null! @param provider The provider for <b>modifiable</b> context maps to use in JDA, or {@code null} to reset @return The DefaultShardManagerBuilder instance. Useful for chaining. @see <a href="https://www.slf4j.org/api/org/slf4j/MDC.html" target="_blank">MDC Javadoc</a>
[ "Sets", "the", "{", "@link", "org", ".", "slf4j", ".", "MDC", "MDC", "}", "mappings", "provider", "to", "use", "in", "JDA", ".", "<br", ">", "If", "sharding", "is", "enabled", "JDA", "will", "automatically", "add", "a", "{", "@code", "jda", ".", "sha...
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/bot/sharding/DefaultShardManagerBuilder.java#L167-L173
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/tools/DFSAdmin.java
DFSAdmin.blockReplication
public int blockReplication(String[] argv, int idx) throws IOException { DistributedFileSystem dfs = getDFS(); if (dfs == null) { System.out.println("FileSystem is " + getFS().getUri()); return -1; } String option = argv[idx]; boolean isEnable = true; if (option.equals("enable")) { isEnable = true; } else if (option.equals("disable")) { isEnable = false; } else { printUsage("-blockReplication"); return -1; } dfs.blockReplication(isEnable); System.out.println("Block Replication is " + (isEnable? "enabled" : "disabled") + " on server " + dfs.getUri()); return 0; }
java
public int blockReplication(String[] argv, int idx) throws IOException { DistributedFileSystem dfs = getDFS(); if (dfs == null) { System.out.println("FileSystem is " + getFS().getUri()); return -1; } String option = argv[idx]; boolean isEnable = true; if (option.equals("enable")) { isEnable = true; } else if (option.equals("disable")) { isEnable = false; } else { printUsage("-blockReplication"); return -1; } dfs.blockReplication(isEnable); System.out.println("Block Replication is " + (isEnable? "enabled" : "disabled") + " on server " + dfs.getUri()); return 0; }
[ "public", "int", "blockReplication", "(", "String", "[", "]", "argv", ",", "int", "idx", ")", "throws", "IOException", "{", "DistributedFileSystem", "dfs", "=", "getDFS", "(", ")", ";", "if", "(", "dfs", "==", "null", ")", "{", "System", ".", "out", "....
Enable/Disable Block Replication. Usage: java DFSAdmin -blockReplication enable/disable
[ "Enable", "/", "Disable", "Block", "Replication", ".", "Usage", ":", "java", "DFSAdmin", "-", "blockReplication", "enable", "/", "disable" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/DFSAdmin.java#L744-L764
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java
DataService.prepareFindById
private <T extends IEntity> IntuitMessage prepareFindById(T entity) throws FMSException { Class<?> objectClass = entity.getClass(); String entityName = objectClass.getSimpleName(); Object rid = null; Method m; try { m = objectClass.getMethod("getId"); rid = m.invoke(entity); } catch (Exception e) { throw new FMSException("Unable to read the method getId", e); } // The preferences/companyInfo check is to skip the Id null validation as it is not required for Preferences/CompanyInfo Read operation if ((!entityName.equals("Preferences") && !entityName.equals("OLBTransaction") && !entityName.equals("OLBStatus")) && rid == null) { throw new FMSException("Id is required."); } IntuitMessage intuitMessage = new IntuitMessage(); RequestElements requestElements = intuitMessage.getRequestElements(); //set the request params Map<String, String> requestParameters = requestElements.getRequestParameters(); requestParameters.put(RequestElements.REQ_PARAM_METHOD_TYPE, MethodType.GET.toString()); // The preferences/companyInfo check is to skip adding the entity id in the request URI if (!entityName.equals("Preferences") && !entityName.equals("OLBTransaction") && !entityName.equals("OLBStatus")) { requestParameters.put(RequestElements.REQ_PARAM_ENTITY_ID, rid.toString()); } requestElements.setContext(context); requestElements.setEntity(entity); return intuitMessage; }
java
private <T extends IEntity> IntuitMessage prepareFindById(T entity) throws FMSException { Class<?> objectClass = entity.getClass(); String entityName = objectClass.getSimpleName(); Object rid = null; Method m; try { m = objectClass.getMethod("getId"); rid = m.invoke(entity); } catch (Exception e) { throw new FMSException("Unable to read the method getId", e); } // The preferences/companyInfo check is to skip the Id null validation as it is not required for Preferences/CompanyInfo Read operation if ((!entityName.equals("Preferences") && !entityName.equals("OLBTransaction") && !entityName.equals("OLBStatus")) && rid == null) { throw new FMSException("Id is required."); } IntuitMessage intuitMessage = new IntuitMessage(); RequestElements requestElements = intuitMessage.getRequestElements(); //set the request params Map<String, String> requestParameters = requestElements.getRequestParameters(); requestParameters.put(RequestElements.REQ_PARAM_METHOD_TYPE, MethodType.GET.toString()); // The preferences/companyInfo check is to skip adding the entity id in the request URI if (!entityName.equals("Preferences") && !entityName.equals("OLBTransaction") && !entityName.equals("OLBStatus")) { requestParameters.put(RequestElements.REQ_PARAM_ENTITY_ID, rid.toString()); } requestElements.setContext(context); requestElements.setEntity(entity); return intuitMessage; }
[ "private", "<", "T", "extends", "IEntity", ">", "IntuitMessage", "prepareFindById", "(", "T", "entity", ")", "throws", "FMSException", "{", "Class", "<", "?", ">", "objectClass", "=", "entity", ".", "getClass", "(", ")", ";", "String", "entityName", "=", "...
Common method to prepare the request params for findById operation for both sync and async calls @param entity the entity @return IntuitMessage the intuit message @throws FMSException
[ "Common", "method", "to", "prepare", "the", "request", "params", "for", "findById", "operation", "for", "both", "sync", "and", "async", "calls" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java#L1139-L1173
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/reflect/ReflectionUtils.java
ReflectionUtils.setField
public static void setField(Class<?> type, String fieldName, Object value) { try { setField(null, getField(type, fieldName), value); } catch (FieldNotFoundException e) { throw new IllegalArgumentException(String.format("Field with name (%1$s) does not exist on class type (%2$s)!", fieldName, type.getName()), e); } }
java
public static void setField(Class<?> type, String fieldName, Object value) { try { setField(null, getField(type, fieldName), value); } catch (FieldNotFoundException e) { throw new IllegalArgumentException(String.format("Field with name (%1$s) does not exist on class type (%2$s)!", fieldName, type.getName()), e); } }
[ "public", "static", "void", "setField", "(", "Class", "<", "?", ">", "type", ",", "String", "fieldName", ",", "Object", "value", ")", "{", "try", "{", "setField", "(", "null", ",", "getField", "(", "type", ",", "fieldName", ")", ",", "value", ")", ";...
Sets the field with the specified name on the given class type to the given value. This method assumes the field is a static (class) member field. @param type the Class type on which the field is declared and defined. @param fieldName a String indicating the name of the field on which to set the value. @param value the Object value to set the specified field to. @throws IllegalArgumentException if the given class type does not declare a static member field with the specified name. @throws FieldAccessException if the value for the specified field could not be set. @see #getField(Class, String) @see #setField(Object, java.lang.reflect.Field, Object)
[ "Sets", "the", "field", "with", "the", "specified", "name", "on", "the", "given", "class", "type", "to", "the", "given", "value", ".", "This", "method", "assumes", "the", "field", "is", "a", "static", "(", "class", ")", "member", "field", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/reflect/ReflectionUtils.java#L181-L189
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/domain/RemotePDPProvider.java
RemotePDPProvider.getPDPDomainNamesForPDB
@Override public SortedSet<String> getPDPDomainNamesForPDB(String pdbId) throws IOException{ SortedSet<String> results = null; try { URL u = new URL(server + "getPDPDomainNamesForPDB?pdbId="+pdbId); logger.info("Fetching {}",u); InputStream response = URLConnectionTools.getInputStream(u); String xml = JFatCatClient.convertStreamToString(response); results = XMLUtil.getDomainRangesFromXML(xml); } catch (MalformedURLException e){ logger.error("Problem generating PDP request URL for "+pdbId,e); throw new IllegalArgumentException("Invalid PDB name: "+pdbId, e); } return results; }
java
@Override public SortedSet<String> getPDPDomainNamesForPDB(String pdbId) throws IOException{ SortedSet<String> results = null; try { URL u = new URL(server + "getPDPDomainNamesForPDB?pdbId="+pdbId); logger.info("Fetching {}",u); InputStream response = URLConnectionTools.getInputStream(u); String xml = JFatCatClient.convertStreamToString(response); results = XMLUtil.getDomainRangesFromXML(xml); } catch (MalformedURLException e){ logger.error("Problem generating PDP request URL for "+pdbId,e); throw new IllegalArgumentException("Invalid PDB name: "+pdbId, e); } return results; }
[ "@", "Override", "public", "SortedSet", "<", "String", ">", "getPDPDomainNamesForPDB", "(", "String", "pdbId", ")", "throws", "IOException", "{", "SortedSet", "<", "String", ">", "results", "=", "null", ";", "try", "{", "URL", "u", "=", "new", "URL", "(", ...
Get a list of all PDP domains for a given PDB entry @param pdbId PDB ID @return Set of domain names, e.g. "PDP:4HHBAa" @throws IOException if the server cannot be reached
[ "Get", "a", "list", "of", "all", "PDP", "domains", "for", "a", "given", "PDB", "entry" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/domain/RemotePDPProvider.java#L245-L260
raphw/byte-buddy
byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassReloadingStrategy.java
ClassReloadingStrategy.enableBootstrapInjection
public ClassReloadingStrategy enableBootstrapInjection(File folder) { return new ClassReloadingStrategy(instrumentation, strategy, new BootstrapInjection.Enabled(folder), preregisteredTypes); }
java
public ClassReloadingStrategy enableBootstrapInjection(File folder) { return new ClassReloadingStrategy(instrumentation, strategy, new BootstrapInjection.Enabled(folder), preregisteredTypes); }
[ "public", "ClassReloadingStrategy", "enableBootstrapInjection", "(", "File", "folder", ")", "{", "return", "new", "ClassReloadingStrategy", "(", "instrumentation", ",", "strategy", ",", "new", "BootstrapInjection", ".", "Enabled", "(", "folder", ")", ",", "preregister...
Enables bootstrap injection for this class reloading strategy. @param folder The folder to save jar files in that are appended to the bootstrap class path. @return A class reloading strategy with bootstrap injection enabled.
[ "Enables", "bootstrap", "injection", "for", "this", "class", "reloading", "strategy", "." ]
train
https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassReloadingStrategy.java#L279-L281
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.isAccessible
public boolean isAccessible(Env<AttrContext> env, Type site, Symbol sym) { return isAccessible(env, site, sym, false); }
java
public boolean isAccessible(Env<AttrContext> env, Type site, Symbol sym) { return isAccessible(env, site, sym, false); }
[ "public", "boolean", "isAccessible", "(", "Env", "<", "AttrContext", ">", "env", ",", "Type", "site", ",", "Symbol", "sym", ")", "{", "return", "isAccessible", "(", "env", ",", "site", ",", "sym", ",", "false", ")", ";", "}" ]
Is symbol accessible as a member of given type in given environment? @param env The current environment. @param site The type of which the tested symbol is regarded as a member. @param sym The symbol.
[ "Is", "symbol", "accessible", "as", "a", "member", "of", "given", "type", "in", "given", "environment?" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L388-L390
brutusin/commons
src/main/java/org/brutusin/commons/utils/CryptoUtils.java
CryptoUtils.getHash
private static String getHash(String str, String algorithm) throws NoSuchAlgorithmException { MessageDigest md = MessageDigest.getInstance(algorithm); md.update(str.getBytes()); byte byteData[] = md.digest(); StringBuilder hexString = new StringBuilder(); for (int i = 0; i < byteData.length; i++) { String hex = Integer.toHexString(0xff & byteData[i]); if (hex.length() == 1) { hexString.append('0'); } hexString.append(hex); } return hexString.toString(); }
java
private static String getHash(String str, String algorithm) throws NoSuchAlgorithmException { MessageDigest md = MessageDigest.getInstance(algorithm); md.update(str.getBytes()); byte byteData[] = md.digest(); StringBuilder hexString = new StringBuilder(); for (int i = 0; i < byteData.length; i++) { String hex = Integer.toHexString(0xff & byteData[i]); if (hex.length() == 1) { hexString.append('0'); } hexString.append(hex); } return hexString.toString(); }
[ "private", "static", "String", "getHash", "(", "String", "str", ",", "String", "algorithm", ")", "throws", "NoSuchAlgorithmException", "{", "MessageDigest", "md", "=", "MessageDigest", ".", "getInstance", "(", "algorithm", ")", ";", "md", ".", "update", "(", "...
Return the hezadecimal representation of the string digest given the specified algorithm. @param str @param algorithm @return @throws NoSuchAlgorithmException
[ "Return", "the", "hezadecimal", "representation", "of", "the", "string", "digest", "given", "the", "specified", "algorithm", "." ]
train
https://github.com/brutusin/commons/blob/70685df2b2456d0bf1e6a4754d72c87bba4949df/src/main/java/org/brutusin/commons/utils/CryptoUtils.java#L67-L84
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/CompareFixture.java
CompareFixture.differenceBetweenAnd
public String differenceBetweenAnd(String first, String second) { Formatter whitespaceFormatter = new Formatter() { @Override public String format(String value) { return ensureWhitespaceVisible(value); } }; return getDifferencesHtml(first, second, whitespaceFormatter); }
java
public String differenceBetweenAnd(String first, String second) { Formatter whitespaceFormatter = new Formatter() { @Override public String format(String value) { return ensureWhitespaceVisible(value); } }; return getDifferencesHtml(first, second, whitespaceFormatter); }
[ "public", "String", "differenceBetweenAnd", "(", "String", "first", ",", "String", "second", ")", "{", "Formatter", "whitespaceFormatter", "=", "new", "Formatter", "(", ")", "{", "@", "Override", "public", "String", "format", "(", "String", "value", ")", "{", ...
Determines difference between two strings. @param first first string to compare. @param second second string to compare. @return HTML of difference between the two.
[ "Determines", "difference", "between", "two", "strings", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/CompareFixture.java#L21-L29
Azure/azure-sdk-for-java
applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkbooksInner.java
WorkbooksInner.createOrUpdate
public WorkbookInner createOrUpdate(String resourceGroupName, String resourceName, WorkbookInner workbookProperties) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, workbookProperties).toBlocking().single().body(); }
java
public WorkbookInner createOrUpdate(String resourceGroupName, String resourceName, WorkbookInner workbookProperties) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, workbookProperties).toBlocking().single().body(); }
[ "public", "WorkbookInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "WorkbookInner", "workbookProperties", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ",", "wor...
Create a new workbook. @param resourceGroupName The name of the resource group. @param resourceName The name of the Application Insights component resource. @param workbookProperties Properties that need to be specified to create a new workbook. @throws IllegalArgumentException thrown if parameters fail the validation @throws WorkbookErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the WorkbookInner object if successful.
[ "Create", "a", "new", "workbook", "." ]
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/WorkbooksInner.java#L456-L458
strator-dev/greenpepper-open
extensions-external/selenium/src/main/java/com/greenpepper/extensions/selenium/SeleniumRemoteControlFixture.java
SeleniumRemoteControlFixture.startBrowserWithSeleniumConsoleOnAtPortAndScriptsAt
public boolean startBrowserWithSeleniumConsoleOnAtPortAndScriptsAt(String browserName, String serverHost, int serverPort, String browserUrl) { selenium = new DefaultSelenium(serverHost, serverPort, "*" + browserName, browserUrl); selenium.start(); return true; }
java
public boolean startBrowserWithSeleniumConsoleOnAtPortAndScriptsAt(String browserName, String serverHost, int serverPort, String browserUrl) { selenium = new DefaultSelenium(serverHost, serverPort, "*" + browserName, browserUrl); selenium.start(); return true; }
[ "public", "boolean", "startBrowserWithSeleniumConsoleOnAtPortAndScriptsAt", "(", "String", "browserName", ",", "String", "serverHost", ",", "int", "serverPort", ",", "String", "browserUrl", ")", "{", "selenium", "=", "new", "DefaultSelenium", "(", "serverHost", ",", "...
<p>startBrowserWithSeleniumConsoleOnAtPortAndScriptsAt.</p> @param browserName a {@link java.lang.String} object. @param serverHost a {@link java.lang.String} object. @param serverPort a int. @param browserUrl a {@link java.lang.String} object. @return a boolean.
[ "<p", ">", "startBrowserWithSeleniumConsoleOnAtPortAndScriptsAt", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper-open/blob/71fd244b4989e9cd2d07ae62dd954a1f2a269a92/extensions-external/selenium/src/main/java/com/greenpepper/extensions/selenium/SeleniumRemoteControlFixture.java#L60-L65
darcy-framework/synq
src/main/java/com/redhat/synq/MultiEvent.java
MultiEvent.throwMultiEventException
private void throwMultiEventException(Event<?> eventThatThrewException) { while(throwable instanceof MultiEventException && throwable.getCause() != null) { eventThatThrewException = ((MultiEventException) throwable).getEvent(); throwable = throwable.getCause(); } throw new MultiEventException(eventThatThrewException, throwable); }
java
private void throwMultiEventException(Event<?> eventThatThrewException) { while(throwable instanceof MultiEventException && throwable.getCause() != null) { eventThatThrewException = ((MultiEventException) throwable).getEvent(); throwable = throwable.getCause(); } throw new MultiEventException(eventThatThrewException, throwable); }
[ "private", "void", "throwMultiEventException", "(", "Event", "<", "?", ">", "eventThatThrewException", ")", "{", "while", "(", "throwable", "instanceof", "MultiEventException", "&&", "throwable", ".", "getCause", "(", ")", "!=", "null", ")", "{", "eventThatThrewEx...
Unwraps cause of throwable if the throwable is, itself, a MultiEventException. This eliminates much excessive noise that is purely implementation detail of MultiEvents from the stack trace.
[ "Unwraps", "cause", "of", "throwable", "if", "the", "throwable", "is", "itself", "a", "MultiEventException", ".", "This", "eliminates", "much", "excessive", "noise", "that", "is", "purely", "implementation", "detail", "of", "MultiEvents", "from", "the", "stack", ...
train
https://github.com/darcy-framework/synq/blob/37f2e6966496520efd1ec506770a717823671e9b/src/main/java/com/redhat/synq/MultiEvent.java#L97-L104
elki-project/elki
elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/vafile/PartialVAFile.java
PartialVAFile.calculateSelectivityCoeffs
protected static void calculateSelectivityCoeffs(List<DoubleObjPair<DAFile>> daFiles, NumberVector query, double epsilon) { final int dimensions = query.getDimensionality(); double[] lowerVals = new double[dimensions]; double[] upperVals = new double[dimensions]; VectorApproximation queryApprox = calculatePartialApproximation(null, query, daFiles); for(int i = 0; i < dimensions; i++) { final double val = query.doubleValue(i); lowerVals[i] = val - epsilon; upperVals[i] = val + epsilon; } DoubleVector lowerEpsilon = DoubleVector.wrap(lowerVals); VectorApproximation lowerEpsilonPartitions = calculatePartialApproximation(null, lowerEpsilon, daFiles); DoubleVector upperEpsilon = DoubleVector.wrap(upperVals); VectorApproximation upperEpsilonPartitions = calculatePartialApproximation(null, upperEpsilon, daFiles); for(int i = 0; i < daFiles.size(); i++) { int coeff = (queryApprox.getApproximation(i) - lowerEpsilonPartitions.getApproximation(i)) + (upperEpsilonPartitions.getApproximation(i) - queryApprox.getApproximation(i)) + 1; daFiles.get(i).first = coeff; } }
java
protected static void calculateSelectivityCoeffs(List<DoubleObjPair<DAFile>> daFiles, NumberVector query, double epsilon) { final int dimensions = query.getDimensionality(); double[] lowerVals = new double[dimensions]; double[] upperVals = new double[dimensions]; VectorApproximation queryApprox = calculatePartialApproximation(null, query, daFiles); for(int i = 0; i < dimensions; i++) { final double val = query.doubleValue(i); lowerVals[i] = val - epsilon; upperVals[i] = val + epsilon; } DoubleVector lowerEpsilon = DoubleVector.wrap(lowerVals); VectorApproximation lowerEpsilonPartitions = calculatePartialApproximation(null, lowerEpsilon, daFiles); DoubleVector upperEpsilon = DoubleVector.wrap(upperVals); VectorApproximation upperEpsilonPartitions = calculatePartialApproximation(null, upperEpsilon, daFiles); for(int i = 0; i < daFiles.size(); i++) { int coeff = (queryApprox.getApproximation(i) - lowerEpsilonPartitions.getApproximation(i)) + (upperEpsilonPartitions.getApproximation(i) - queryApprox.getApproximation(i)) + 1; daFiles.get(i).first = coeff; } }
[ "protected", "static", "void", "calculateSelectivityCoeffs", "(", "List", "<", "DoubleObjPair", "<", "DAFile", ">", ">", "daFiles", ",", "NumberVector", "query", ",", "double", "epsilon", ")", "{", "final", "int", "dimensions", "=", "query", ".", "getDimensional...
Calculate selectivity coefficients. @param daFiles List of files to use @param query Query vector @param epsilon Epsilon radius
[ "Calculate", "selectivity", "coefficients", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/vafile/PartialVAFile.java#L264-L287
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/config/Template.java
Template.getStyle
@SuppressWarnings("unchecked") @Nonnull public final java.util.Optional<Style> getStyle(final String styleName) { final String styleRef = this.styles.get(styleName); Optional<Style> style; if (styleRef != null) { style = (Optional<Style>) this.styleParser .loadStyle(getConfiguration(), this.httpRequestFactory, styleRef); } else { style = Optional.empty(); } return or(style, this.configuration.getStyle(styleName)); }
java
@SuppressWarnings("unchecked") @Nonnull public final java.util.Optional<Style> getStyle(final String styleName) { final String styleRef = this.styles.get(styleName); Optional<Style> style; if (styleRef != null) { style = (Optional<Style>) this.styleParser .loadStyle(getConfiguration(), this.httpRequestFactory, styleRef); } else { style = Optional.empty(); } return or(style, this.configuration.getStyle(styleName)); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Nonnull", "public", "final", "java", ".", "util", ".", "Optional", "<", "Style", ">", "getStyle", "(", "final", "String", "styleName", ")", "{", "final", "String", "styleRef", "=", "this", ".", "sty...
Look for a style in the named styles provided in the configuration. @param styleName the name of the style to look for.
[ "Look", "for", "a", "style", "in", "the", "named", "styles", "provided", "in", "the", "configuration", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/config/Template.java#L257-L269
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java
AiMesh.getFaceVertex
public int getFaceVertex(int face, int n) { if (!hasFaces()) { throw new IllegalStateException("mesh has no faces"); } if (face >= m_numFaces || face < 0) { throw new IndexOutOfBoundsException("Index: " + face + ", Size: " + m_numFaces); } if (n >= getFaceNumIndices(face) || n < 0) { throw new IndexOutOfBoundsException("Index: " + n + ", Size: " + getFaceNumIndices(face)); } int faceOffset = 0; if (m_faceOffsets == null) { faceOffset = 3 * face * SIZEOF_INT; } else { faceOffset = m_faceOffsets.getInt(face * SIZEOF_INT) * SIZEOF_INT; } return m_faces.getInt(faceOffset + n * SIZEOF_INT); }
java
public int getFaceVertex(int face, int n) { if (!hasFaces()) { throw new IllegalStateException("mesh has no faces"); } if (face >= m_numFaces || face < 0) { throw new IndexOutOfBoundsException("Index: " + face + ", Size: " + m_numFaces); } if (n >= getFaceNumIndices(face) || n < 0) { throw new IndexOutOfBoundsException("Index: " + n + ", Size: " + getFaceNumIndices(face)); } int faceOffset = 0; if (m_faceOffsets == null) { faceOffset = 3 * face * SIZEOF_INT; } else { faceOffset = m_faceOffsets.getInt(face * SIZEOF_INT) * SIZEOF_INT; } return m_faces.getInt(faceOffset + n * SIZEOF_INT); }
[ "public", "int", "getFaceVertex", "(", "int", "face", ",", "int", "n", ")", "{", "if", "(", "!", "hasFaces", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"mesh has no faces\"", ")", ";", "}", "if", "(", "face", ">=", "m_numFaces", ...
Returns a vertex reference from a face.<p> A face contains <code>getFaceNumIndices(face)</code> vertex references. This method returns the n'th of these. The returned index can be passed directly to the vertex oriented methods, such as <code>getPosition()</code> etc. @param face the face @param n the reference @return a vertex index
[ "Returns", "a", "vertex", "reference", "from", "a", "face", ".", "<p", ">" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java#L684-L707
FedericoPecora/meta-csp-framework
src/main/java/org/metacsp/multi/spatial/rectangleAlgebra/RectangleConstraintSolver.java
RectangleConstraintSolver.extractBoundingBoxesFromSTPs
public BoundingBox extractBoundingBoxesFromSTPs(RectangularRegion rect){ Bounds xLB, xUB, yLB, yUB; xLB = new Bounds(((AllenInterval)rect.getInternalVariables()[0]).getEST(),((AllenInterval)rect.getInternalVariables()[0]).getLST()); xUB = new Bounds(((AllenInterval)rect.getInternalVariables()[0]).getEET(),((AllenInterval)rect.getInternalVariables()[0]).getLET()); yLB = new Bounds(((AllenInterval)rect.getInternalVariables()[1]).getEST(),((AllenInterval)rect.getInternalVariables()[1]).getLST()); yUB = new Bounds(((AllenInterval)rect.getInternalVariables()[1]).getEET(),((AllenInterval)rect.getInternalVariables()[1]).getLET()); return new BoundingBox(xLB, xUB, yLB, yUB); }
java
public BoundingBox extractBoundingBoxesFromSTPs(RectangularRegion rect){ Bounds xLB, xUB, yLB, yUB; xLB = new Bounds(((AllenInterval)rect.getInternalVariables()[0]).getEST(),((AllenInterval)rect.getInternalVariables()[0]).getLST()); xUB = new Bounds(((AllenInterval)rect.getInternalVariables()[0]).getEET(),((AllenInterval)rect.getInternalVariables()[0]).getLET()); yLB = new Bounds(((AllenInterval)rect.getInternalVariables()[1]).getEST(),((AllenInterval)rect.getInternalVariables()[1]).getLST()); yUB = new Bounds(((AllenInterval)rect.getInternalVariables()[1]).getEET(),((AllenInterval)rect.getInternalVariables()[1]).getLET()); return new BoundingBox(xLB, xUB, yLB, yUB); }
[ "public", "BoundingBox", "extractBoundingBoxesFromSTPs", "(", "RectangularRegion", "rect", ")", "{", "Bounds", "xLB", ",", "xUB", ",", "yLB", ",", "yUB", ";", "xLB", "=", "new", "Bounds", "(", "(", "(", "AllenInterval", ")", "rect", ".", "getInternalVariables"...
Extracts a specific {@link BoundingBox} from the domain of a {@link RectangularRegion}. @param rect The {@link RectangularRegion} from to extract the {@link BoundingBox}. @return A specific {@link BoundingBox} from the domain of a {@link RectangularRegion}.
[ "Extracts", "a", "specific", "{" ]
train
https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/multi/spatial/rectangleAlgebra/RectangleConstraintSolver.java#L172-L179
google/closure-templates
java/src/com/google/template/soy/sharedpasses/render/RenderException.java
RenderException.addStackTraceElement
RenderException addStackTraceElement(TemplateNode template, SourceLocation location) { // Typically, this is fast since templates aren't that deep and we only do this in error // situations so performance matters less. soyStackTrace.add(template.createStackTraceElement(location)); return this; }
java
RenderException addStackTraceElement(TemplateNode template, SourceLocation location) { // Typically, this is fast since templates aren't that deep and we only do this in error // situations so performance matters less. soyStackTrace.add(template.createStackTraceElement(location)); return this; }
[ "RenderException", "addStackTraceElement", "(", "TemplateNode", "template", ",", "SourceLocation", "location", ")", "{", "// Typically, this is fast since templates aren't that deep and we only do this in error", "// situations so performance matters less.", "soyStackTrace", ".", "add", ...
Add a partial stack trace element by specifying the source location of the soy file.
[ "Add", "a", "partial", "stack", "trace", "element", "by", "specifying", "the", "source", "location", "of", "the", "soy", "file", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/sharedpasses/render/RenderException.java#L83-L88
looly/hutool
hutool-db/src/main/java/cn/hutool/db/handler/HandleHelper.java
HandleHelper.handleRow
public static <T> T handleRow(int columnCount, ResultSetMetaData meta, ResultSet rs, T bean) throws SQLException { return handleRow(columnCount, meta, rs).toBeanIgnoreCase(bean); }
java
public static <T> T handleRow(int columnCount, ResultSetMetaData meta, ResultSet rs, T bean) throws SQLException { return handleRow(columnCount, meta, rs).toBeanIgnoreCase(bean); }
[ "public", "static", "<", "T", ">", "T", "handleRow", "(", "int", "columnCount", ",", "ResultSetMetaData", "meta", ",", "ResultSet", "rs", ",", "T", "bean", ")", "throws", "SQLException", "{", "return", "handleRow", "(", "columnCount", ",", "meta", ",", "rs...
处理单条数据 @param columnCount 列数 @param meta ResultSetMetaData @param rs 数据集 @param bean 目标Bean @return 每一行的Entity @throws SQLException SQL执行异常 @since 3.3.1
[ "处理单条数据" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/handler/HandleHelper.java#L41-L43
santhosh-tekuri/jlibs
core/src/main/java/jlibs/core/io/IOUtil.java
IOUtil.pump
public static ByteArrayOutputStream2 pump(InputStream is, boolean closeIn) throws IOException{ return pump(is, new ByteArrayOutputStream2(), closeIn, true); }
java
public static ByteArrayOutputStream2 pump(InputStream is, boolean closeIn) throws IOException{ return pump(is, new ByteArrayOutputStream2(), closeIn, true); }
[ "public", "static", "ByteArrayOutputStream2", "pump", "(", "InputStream", "is", ",", "boolean", "closeIn", ")", "throws", "IOException", "{", "return", "pump", "(", "is", ",", "new", "ByteArrayOutputStream2", "(", ")", ",", "closeIn", ",", "true", ")", ";", ...
Reads data from <code>is</code> and writes it into an instanceof {@link ByteArrayOutputStream2}.<br> @param is inputstream from which data is read @param closeIn close inputstream or not @return the instance of {@link ByteArrayOutputStream2} into which data is written @throws IOException if an I/O error occurs.
[ "Reads", "data", "from", "<code", ">", "is<", "/", "code", ">", "and", "writes", "it", "into", "an", "instanceof", "{", "@link", "ByteArrayOutputStream2", "}", ".", "<br", ">" ]
train
https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/io/IOUtil.java#L100-L102
lessthanoptimal/BoofCV
main/boofcv-sfm/src/main/java/boofcv/alg/sfm/StereoProcessingBase.java
StereoProcessingBase.computeHomo3D
public void computeHomo3D(double x, double y, Point3D_F64 pointLeft) { // Coordinate in rectified camera frame pointRect.z = baseline*fx; pointRect.x = pointRect.z*(x - cx)/fx; pointRect.y = pointRect.z*(y - cy)/fy; // rotate into the original left camera frame GeometryMath_F64.multTran(rectR,pointRect,pointLeft); }
java
public void computeHomo3D(double x, double y, Point3D_F64 pointLeft) { // Coordinate in rectified camera frame pointRect.z = baseline*fx; pointRect.x = pointRect.z*(x - cx)/fx; pointRect.y = pointRect.z*(y - cy)/fy; // rotate into the original left camera frame GeometryMath_F64.multTran(rectR,pointRect,pointLeft); }
[ "public", "void", "computeHomo3D", "(", "double", "x", ",", "double", "y", ",", "Point3D_F64", "pointLeft", ")", "{", "// Coordinate in rectified camera frame", "pointRect", ".", "z", "=", "baseline", "*", "fx", ";", "pointRect", ".", "x", "=", "pointRect", "....
Given a coordinate of a point in the left rectified frame, compute the point's 3D coordinate in the camera's reference frame in homogeneous coordinates. To convert the coordinate into normal 3D, divide each element by the disparity. @param x x-coordinate of pixel in rectified left image @param y y-coordinate of pixel in rectified left image @param pointLeft Storage for 3D coordinate of point in homogeneous coordinates. w = disparity
[ "Given", "a", "coordinate", "of", "a", "point", "in", "the", "left", "rectified", "frame", "compute", "the", "point", "s", "3D", "coordinate", "in", "the", "camera", "s", "reference", "frame", "in", "homogeneous", "coordinates", ".", "To", "convert", "the", ...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/StereoProcessingBase.java#L147-L155
tvesalainen/util
util/src/main/java/org/vesalainen/lang/Primitives.java
Primitives.writeInt
public static final void writeInt(int value, byte[] array, int offset) { if (array.length < offset + 4) { throw new IllegalArgumentException("no room in array"); } array[offset] = (byte) (value >> 24); array[offset + 1] = (byte) ((value >> 16) & 0xff); array[offset + 2] = (byte) ((value >> 8) & 0xff); array[offset + 3] = (byte) (value & 0xff); }
java
public static final void writeInt(int value, byte[] array, int offset) { if (array.length < offset + 4) { throw new IllegalArgumentException("no room in array"); } array[offset] = (byte) (value >> 24); array[offset + 1] = (byte) ((value >> 16) & 0xff); array[offset + 2] = (byte) ((value >> 8) & 0xff); array[offset + 3] = (byte) (value & 0xff); }
[ "public", "static", "final", "void", "writeInt", "(", "int", "value", ",", "byte", "[", "]", "array", ",", "int", "offset", ")", "{", "if", "(", "array", ".", "length", "<", "offset", "+", "4", ")", "{", "throw", "new", "IllegalArgumentException", "(",...
Write value to byte array @param value @param array @param offset @see java.nio.ByteBuffer#putInt(int)
[ "Write", "value", "to", "byte", "array" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/lang/Primitives.java#L330-L340
jeremylong/DependencyCheck
maven/src/main/java/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.java
BaseDependencyCheckMojo.toDependencyNode
private DependencyNode toDependencyNode(ProjectBuildingRequest buildingRequest, DependencyNode parent, org.apache.maven.model.Dependency dependency) throws ArtifactResolverException { final DefaultArtifactCoordinate coordinate = new DefaultArtifactCoordinate(); coordinate.setGroupId(dependency.getGroupId()); coordinate.setArtifactId(dependency.getArtifactId()); coordinate.setVersion(dependency.getVersion()); final ArtifactType type = session.getRepositorySession().getArtifactTypeRegistry().get(dependency.getType()); coordinate.setExtension(type.getExtension()); coordinate.setClassifier(type.getClassifier()); final Artifact artifact = artifactResolver.resolveArtifact(buildingRequest, coordinate).getArtifact(); artifact.setScope(dependency.getScope()); final DefaultDependencyNode node = new DefaultDependencyNode(parent, artifact, dependency.getVersion(), dependency.getScope(), null); return node; }
java
private DependencyNode toDependencyNode(ProjectBuildingRequest buildingRequest, DependencyNode parent, org.apache.maven.model.Dependency dependency) throws ArtifactResolverException { final DefaultArtifactCoordinate coordinate = new DefaultArtifactCoordinate(); coordinate.setGroupId(dependency.getGroupId()); coordinate.setArtifactId(dependency.getArtifactId()); coordinate.setVersion(dependency.getVersion()); final ArtifactType type = session.getRepositorySession().getArtifactTypeRegistry().get(dependency.getType()); coordinate.setExtension(type.getExtension()); coordinate.setClassifier(type.getClassifier()); final Artifact artifact = artifactResolver.resolveArtifact(buildingRequest, coordinate).getArtifact(); artifact.setScope(dependency.getScope()); final DefaultDependencyNode node = new DefaultDependencyNode(parent, artifact, dependency.getVersion(), dependency.getScope(), null); return node; }
[ "private", "DependencyNode", "toDependencyNode", "(", "ProjectBuildingRequest", "buildingRequest", ",", "DependencyNode", "parent", ",", "org", ".", "apache", ".", "maven", ".", "model", ".", "Dependency", "dependency", ")", "throws", "ArtifactResolverException", "{", ...
Converts the dependency to a dependency node object. @param buildingRequest the Maven project building request @param parent the parent node @param dependency the dependency to convert @return the resulting dependency node @throws ArtifactResolverException thrown if the artifact could not be retrieved
[ "Converts", "the", "dependency", "to", "a", "dependency", "node", "object", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/maven/src/main/java/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.java#L882-L903
Azure/azure-sdk-for-java
storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java
BlobContainersInner.createAsync
public Observable<BlobContainerInner> createAsync(String resourceGroupName, String accountName, String containerName, PublicAccess publicAccess, Map<String, String> metadata) { return createWithServiceResponseAsync(resourceGroupName, accountName, containerName, publicAccess, metadata).map(new Func1<ServiceResponse<BlobContainerInner>, BlobContainerInner>() { @Override public BlobContainerInner call(ServiceResponse<BlobContainerInner> response) { return response.body(); } }); }
java
public Observable<BlobContainerInner> createAsync(String resourceGroupName, String accountName, String containerName, PublicAccess publicAccess, Map<String, String> metadata) { return createWithServiceResponseAsync(resourceGroupName, accountName, containerName, publicAccess, metadata).map(new Func1<ServiceResponse<BlobContainerInner>, BlobContainerInner>() { @Override public BlobContainerInner call(ServiceResponse<BlobContainerInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "BlobContainerInner", ">", "createAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "containerName", ",", "PublicAccess", "publicAccess", ",", "Map", "<", "String", ",", "String", ">", "metadata", ...
Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. @param publicAccess Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: 'Container', 'Blob', 'None' @param metadata A name-value pair to associate with the container as metadata. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the BlobContainerInner object
[ "Creates", "a", "new", "container", "under", "the", "specified", "account", "as", "described", "by", "request", "body", ".", "The", "container", "resource", "includes", "metadata", "and", "properties", "for", "that", "container", ".", "It", "does", "not", "inc...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java#L340-L347
powermock/powermock
powermock-api/powermock-api-mockito2/src/main/java/org/powermock/api/mockito/PowerMockito.java
PowerMockito.verifyNew
@SuppressWarnings("unchecked") public static synchronized <T> ConstructorArgumentsVerification verifyNew(Class<T> mock) { return verifyNew(mock, times(1)); }
java
@SuppressWarnings("unchecked") public static synchronized <T> ConstructorArgumentsVerification verifyNew(Class<T> mock) { return verifyNew(mock, times(1)); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "synchronized", "<", "T", ">", "ConstructorArgumentsVerification", "verifyNew", "(", "Class", "<", "T", ">", "mock", ")", "{", "return", "verifyNew", "(", "mock", ",", "times", "(", "1", ...
Verifies certain behavior <b>happened once</b> <p> Alias to <code>verifyNew(mockClass, times(1))</code> E.g: <p> <pre> verifyNew(ClassWithStaticMethod.class); </pre> <p> Above is equivalent to: <p> <pre> verifyNew(ClassWithStaticMethod.class, times(1)); </pre> <p> <p> @param mock Class mocked by PowerMock.
[ "Verifies", "certain", "behavior", "<b", ">", "happened", "once<", "/", "b", ">", "<p", ">", "Alias", "to", "<code", ">", "verifyNew", "(", "mockClass", "times", "(", "1", "))", "<", "/", "code", ">", "E", ".", "g", ":", "<p", ">", "<pre", ">", "...
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-mockito2/src/main/java/org/powermock/api/mockito/PowerMockito.java#L324-L327
VueGWT/vue-gwt
core/src/main/java/com/axellience/vuegwt/core/client/component/options/VueComponentOptions.java
VueComponentOptions.addJavaProp
@JsOverlay public final void addJavaProp(String propName, String fieldName, boolean required, String exposedTypeName) { if (propsToProxy == null) { propsToProxy = new HashSet<>(); } PropOptions propDefinition = new PropOptions(); propDefinition.required = required; if (exposedTypeName != null) { propDefinition.type = ((JsPropertyMap<Object>) DomGlobal.window).get(exposedTypeName); } propsToProxy.add(new PropProxyDefinition(propName, fieldName)); addProp(propName, propDefinition); }
java
@JsOverlay public final void addJavaProp(String propName, String fieldName, boolean required, String exposedTypeName) { if (propsToProxy == null) { propsToProxy = new HashSet<>(); } PropOptions propDefinition = new PropOptions(); propDefinition.required = required; if (exposedTypeName != null) { propDefinition.type = ((JsPropertyMap<Object>) DomGlobal.window).get(exposedTypeName); } propsToProxy.add(new PropProxyDefinition(propName, fieldName)); addProp(propName, propDefinition); }
[ "@", "JsOverlay", "public", "final", "void", "addJavaProp", "(", "String", "propName", ",", "String", "fieldName", ",", "boolean", "required", ",", "String", "exposedTypeName", ")", "{", "if", "(", "propsToProxy", "==", "null", ")", "{", "propsToProxy", "=", ...
Add a prop to our ComponentOptions. This will allow to receive data from the outside of our Component. @param propName The name of the prop @param fieldName The name of the java field for that prop @param required Is the property required (mandatory) @param exposedTypeName JS name of the type of this property, if not null we will ask Vue to type check based on it
[ "Add", "a", "prop", "to", "our", "ComponentOptions", ".", "This", "will", "allow", "to", "receive", "data", "from", "the", "outside", "of", "our", "Component", "." ]
train
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/core/src/main/java/com/axellience/vuegwt/core/client/component/options/VueComponentOptions.java#L171-L187
esigate/esigate
esigate-core/src/main/java/org/esigate/impl/UrlRewriter.java
UrlRewriter.rewriteReferer
public String rewriteReferer(String referer, String baseUrl, String visibleBaseUrl) { URI uri = UriUtils.createURI(referer); // Base url should end with / if (!baseUrl.endsWith("/")) { baseUrl = baseUrl + "/"; } URI baseUri = UriUtils.createURI(baseUrl); // If no visible url base is defined, use base url as visible base url if (!visibleBaseUrl.endsWith("/")) { visibleBaseUrl = visibleBaseUrl + "/"; } URI visibleBaseUri = UriUtils.createURI(visibleBaseUrl); // Relativize url to visible base url URI relativeUri = visibleBaseUri.relativize(uri); // If the url is unchanged do nothing if (relativeUri.equals(uri)) { LOG.debug("url kept unchanged: [{}]", referer); return referer; } // Else rewrite replacing baseUrl by visibleBaseUrl URI result = baseUri.resolve(relativeUri); LOG.debug("referer fixed: [{}] -> [{}]", referer, result); return result.toString(); }
java
public String rewriteReferer(String referer, String baseUrl, String visibleBaseUrl) { URI uri = UriUtils.createURI(referer); // Base url should end with / if (!baseUrl.endsWith("/")) { baseUrl = baseUrl + "/"; } URI baseUri = UriUtils.createURI(baseUrl); // If no visible url base is defined, use base url as visible base url if (!visibleBaseUrl.endsWith("/")) { visibleBaseUrl = visibleBaseUrl + "/"; } URI visibleBaseUri = UriUtils.createURI(visibleBaseUrl); // Relativize url to visible base url URI relativeUri = visibleBaseUri.relativize(uri); // If the url is unchanged do nothing if (relativeUri.equals(uri)) { LOG.debug("url kept unchanged: [{}]", referer); return referer; } // Else rewrite replacing baseUrl by visibleBaseUrl URI result = baseUri.resolve(relativeUri); LOG.debug("referer fixed: [{}] -> [{}]", referer, result); return result.toString(); }
[ "public", "String", "rewriteReferer", "(", "String", "referer", ",", "String", "baseUrl", ",", "String", "visibleBaseUrl", ")", "{", "URI", "uri", "=", "UriUtils", ".", "createURI", "(", "referer", ")", ";", "// Base url should end with /", "if", "(", "!", "ba...
Fixes a referer url in a request. @param referer the url to fix (can be anything found in an html page, relative, absolute, empty...) @param baseUrl The base URL selected for this request. @param visibleBaseUrl The base URL viewed by the browser. @return the fixed url.
[ "Fixes", "a", "referer", "url", "in", "a", "request", "." ]
train
https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/impl/UrlRewriter.java#L87-L113
fcrepo4/fcrepo4
fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/StreamUtils.java
StreamUtils.iteratorToStream
public static <T> Stream<T> iteratorToStream(final Iterator<T> iterator) { return iteratorToStream(iterator, enableParallel); }
java
public static <T> Stream<T> iteratorToStream(final Iterator<T> iterator) { return iteratorToStream(iterator, enableParallel); }
[ "public", "static", "<", "T", ">", "Stream", "<", "T", ">", "iteratorToStream", "(", "final", "Iterator", "<", "T", ">", "iterator", ")", "{", "return", "iteratorToStream", "(", "iterator", ",", "enableParallel", ")", ";", "}" ]
Convert an Iterator to a Stream @param iterator the iterator @param <T> the type of the Stream @return the stream
[ "Convert", "an", "Iterator", "to", "a", "Stream" ]
train
https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/StreamUtils.java#L64-L66
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/media/MediaSessionWrapper.java
MediaSessionWrapper.setMetaData
@SuppressWarnings("deprecation") public void setMetaData(SoundCloudTrack track, Bitmap artwork) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { // set meta data on the lock screen for pre lollipop. mRemoteControlClientCompat.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING); RemoteControlClientCompat.MetadataEditorCompat mediaEditorCompat = mRemoteControlClientCompat.editMetadata(true) .putString(MediaMetadataRetriever.METADATA_KEY_TITLE, track.getTitle()) .putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, track.getArtist()); if (artwork != null) { mediaEditorCompat.putBitmap( RemoteControlClientCompat.MetadataEditorCompat.METADATA_KEY_ARTWORK, artwork); } mediaEditorCompat.apply(); } // set meta data to the media session. MediaMetadataCompat.Builder metadataCompatBuilder = new MediaMetadataCompat.Builder() .putString(MediaMetadataCompat.METADATA_KEY_TITLE, track.getTitle()) .putString(MediaMetadataCompat.METADATA_KEY_ARTIST, track.getArtist()); if (artwork != null) { metadataCompatBuilder.putBitmap(MediaMetadataCompat.METADATA_KEY_ART, artwork); } mMediaSession.setMetadata(metadataCompatBuilder.build()); setMediaSessionCompatPlaybackState(PlaybackStateCompat.STATE_PLAYING); }
java
@SuppressWarnings("deprecation") public void setMetaData(SoundCloudTrack track, Bitmap artwork) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { // set meta data on the lock screen for pre lollipop. mRemoteControlClientCompat.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING); RemoteControlClientCompat.MetadataEditorCompat mediaEditorCompat = mRemoteControlClientCompat.editMetadata(true) .putString(MediaMetadataRetriever.METADATA_KEY_TITLE, track.getTitle()) .putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, track.getArtist()); if (artwork != null) { mediaEditorCompat.putBitmap( RemoteControlClientCompat.MetadataEditorCompat.METADATA_KEY_ARTWORK, artwork); } mediaEditorCompat.apply(); } // set meta data to the media session. MediaMetadataCompat.Builder metadataCompatBuilder = new MediaMetadataCompat.Builder() .putString(MediaMetadataCompat.METADATA_KEY_TITLE, track.getTitle()) .putString(MediaMetadataCompat.METADATA_KEY_ARTIST, track.getArtist()); if (artwork != null) { metadataCompatBuilder.putBitmap(MediaMetadataCompat.METADATA_KEY_ART, artwork); } mMediaSession.setMetadata(metadataCompatBuilder.build()); setMediaSessionCompatPlaybackState(PlaybackStateCompat.STATE_PLAYING); }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "public", "void", "setMetaData", "(", "SoundCloudTrack", "track", ",", "Bitmap", "artwork", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", "<", "Build", ".", "VERSION_CODES", ".", "LOLLIPOP",...
Update meta data used by the remote control client and the media session. @param track track currently played. @param artwork track artwork.
[ "Update", "meta", "data", "used", "by", "the", "remote", "control", "client", "and", "the", "media", "session", "." ]
train
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/media/MediaSessionWrapper.java#L208-L234
btaz/data-util
src/main/java/com/btaz/util/files/FileTracker.java
FileTracker.createFile
public File createFile(File dir, String filename) throws DataUtilException { if(dir == null) { throw new DataUtilException("The directory parameter can't be a null value"); } try { File file = new File(dir, filename); return createFile(file); } catch (Exception e) { throw new DataUtilException("Invalid file: " + filename); } }
java
public File createFile(File dir, String filename) throws DataUtilException { if(dir == null) { throw new DataUtilException("The directory parameter can't be a null value"); } try { File file = new File(dir, filename); return createFile(file); } catch (Exception e) { throw new DataUtilException("Invalid file: " + filename); } }
[ "public", "File", "createFile", "(", "File", "dir", ",", "String", "filename", ")", "throws", "DataUtilException", "{", "if", "(", "dir", "==", "null", ")", "{", "throw", "new", "DataUtilException", "(", "\"The directory parameter can't be a null value\"", ")", ";...
Create a new tracked file @param dir file directory @param filename filename @return file new file @throws DataUtilException data util exception
[ "Create", "a", "new", "tracked", "file" ]
train
https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/files/FileTracker.java#L69-L79
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShadowMap.java
GVRShadowMap.setPerspShadowMatrix
void setPerspShadowMatrix(Matrix4f modelMtx, GVRLight light) { GVRPerspectiveCamera camera = (GVRPerspectiveCamera) getCamera(); if (camera == null) { return; } float angle = light.getFloat("outer_cone_angle"); float near = camera.getNearClippingDistance(); float far = camera.getFarClippingDistance(); angle = (float) Math.acos(angle) * 2.0f; modelMtx.invert(); modelMtx.get(mTempMtx); camera.setViewMatrix(mTempMtx); camera.setFovY((float) Math.toDegrees(angle)); mShadowMatrix.setPerspective(angle, 1.0f, near, far); mShadowMatrix.mul(modelMtx); sBiasMatrix.mul(mShadowMatrix, mShadowMatrix); mShadowMatrix.getColumn(0, mTemp); light.setVec4("sm0", mTemp.x, mTemp.y, mTemp.z, mTemp.w); mShadowMatrix.getColumn(1, mTemp); light.setVec4("sm1", mTemp.x, mTemp.y, mTemp.z, mTemp.w); mShadowMatrix.getColumn(2, mTemp); light.setVec4("sm2", mTemp.x, mTemp.y, mTemp.z, mTemp.w); mShadowMatrix.getColumn(3, mTemp); light.setVec4("sm3", mTemp.x, mTemp.y, mTemp.z, mTemp.w); }
java
void setPerspShadowMatrix(Matrix4f modelMtx, GVRLight light) { GVRPerspectiveCamera camera = (GVRPerspectiveCamera) getCamera(); if (camera == null) { return; } float angle = light.getFloat("outer_cone_angle"); float near = camera.getNearClippingDistance(); float far = camera.getFarClippingDistance(); angle = (float) Math.acos(angle) * 2.0f; modelMtx.invert(); modelMtx.get(mTempMtx); camera.setViewMatrix(mTempMtx); camera.setFovY((float) Math.toDegrees(angle)); mShadowMatrix.setPerspective(angle, 1.0f, near, far); mShadowMatrix.mul(modelMtx); sBiasMatrix.mul(mShadowMatrix, mShadowMatrix); mShadowMatrix.getColumn(0, mTemp); light.setVec4("sm0", mTemp.x, mTemp.y, mTemp.z, mTemp.w); mShadowMatrix.getColumn(1, mTemp); light.setVec4("sm1", mTemp.x, mTemp.y, mTemp.z, mTemp.w); mShadowMatrix.getColumn(2, mTemp); light.setVec4("sm2", mTemp.x, mTemp.y, mTemp.z, mTemp.w); mShadowMatrix.getColumn(3, mTemp); light.setVec4("sm3", mTemp.x, mTemp.y, mTemp.z, mTemp.w); }
[ "void", "setPerspShadowMatrix", "(", "Matrix4f", "modelMtx", ",", "GVRLight", "light", ")", "{", "GVRPerspectiveCamera", "camera", "=", "(", "GVRPerspectiveCamera", ")", "getCamera", "(", ")", ";", "if", "(", "camera", "==", "null", ")", "{", "return", ";", ...
Sets the shadow matrix for the spot light from the input model/view matrix and the shadow camera projection matrix. @param modelMtx light model transform (to world coordinates) @param light spot light component to update
[ "Sets", "the", "shadow", "matrix", "for", "the", "spot", "light", "from", "the", "input", "model", "/", "view", "matrix", "and", "the", "shadow", "camera", "projection", "matrix", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShadowMap.java#L135-L163
vipshop/vjtools
vjkit/src/main/java/com/vip/vjtools/vjkit/reflect/ReflectionUtil.java
ReflectionUtil.getAccessibleMethodByName
public static Method getAccessibleMethodByName(final Class clazz, final String methodName) { Validate.notNull(clazz, "clazz can't be null"); Validate.notEmpty(methodName, "methodName can't be blank"); for (Class<?> searchType = clazz; searchType != Object.class; searchType = searchType.getSuperclass()) { Method[] methods = searchType.getDeclaredMethods(); for (Method method : methods) { if (method.getName().equals(methodName)) { makeAccessible(method); return method; } } } return null; }
java
public static Method getAccessibleMethodByName(final Class clazz, final String methodName) { Validate.notNull(clazz, "clazz can't be null"); Validate.notEmpty(methodName, "methodName can't be blank"); for (Class<?> searchType = clazz; searchType != Object.class; searchType = searchType.getSuperclass()) { Method[] methods = searchType.getDeclaredMethods(); for (Method method : methods) { if (method.getName().equals(methodName)) { makeAccessible(method); return method; } } } return null; }
[ "public", "static", "Method", "getAccessibleMethodByName", "(", "final", "Class", "clazz", ",", "final", "String", "methodName", ")", "{", "Validate", ".", "notNull", "(", "clazz", ",", "\"clazz can't be null\"", ")", ";", "Validate", ".", "notEmpty", "(", "meth...
循环向上转型, 获取对象的DeclaredMethod,并强制设置为可访问. 如向上转型到Object仍无法找到, 返回null. 只匹配函数名, 如果有多个同名函数返回第一个 方法需要被多次调用时,先使用本函数先取得Method,然后调用Method.invoke(Object obj, Object... args) 因为getMethod() 不能获取父类的private函数, 因此采用循环向上的getDeclaredMethods()
[ "循环向上转型", "获取对象的DeclaredMethod", "并强制设置为可访问", "." ]
train
https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/reflect/ReflectionUtil.java#L94-L108
Azure/azure-sdk-for-java
signalr/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/signalr/v2018_03_01_preview/implementation/SignalRsInner.java
SignalRsInner.createOrUpdateAsync
public Observable<SignalRResourceInner> createOrUpdateAsync(String resourceGroupName, String resourceName, SignalRCreateParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1<ServiceResponse<SignalRResourceInner>, SignalRResourceInner>() { @Override public SignalRResourceInner call(ServiceResponse<SignalRResourceInner> response) { return response.body(); } }); }
java
public Observable<SignalRResourceInner> createOrUpdateAsync(String resourceGroupName, String resourceName, SignalRCreateParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1<ServiceResponse<SignalRResourceInner>, SignalRResourceInner>() { @Override public SignalRResourceInner call(ServiceResponse<SignalRResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SignalRResourceInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "SignalRCreateParameters", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupN...
Create a new SignalR service and update an exiting SignalR service. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param resourceName The name of the SignalR resource. @param parameters Parameters for the create or update operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Create", "a", "new", "SignalR", "service", "and", "update", "an", "exiting", "SignalR", "service", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/signalr/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/signalr/v2018_03_01_preview/implementation/SignalRsInner.java#L1087-L1094
ziccardi/jnrpe
jnrpe-lib/src/main/java/it/jnrpe/plugins/MetricBuilder.java
MetricBuilder.withMinValue
public MetricBuilder withMinValue(Number value, String prettyPrintFormat) { min = new MetricValue(value.toString(), prettyPrintFormat); return this; }
java
public MetricBuilder withMinValue(Number value, String prettyPrintFormat) { min = new MetricValue(value.toString(), prettyPrintFormat); return this; }
[ "public", "MetricBuilder", "withMinValue", "(", "Number", "value", ",", "String", "prettyPrintFormat", ")", "{", "min", "=", "new", "MetricValue", "(", "value", ".", "toString", "(", ")", ",", "prettyPrintFormat", ")", ";", "return", "this", ";", "}" ]
Sets the minimum value of the metric to be built. @param value the minimum value of the metric @param prettyPrintFormat the format of the output (@see {@link DecimalFormat}) @return this
[ "Sets", "the", "minimum", "value", "of", "the", "metric", "to", "be", "built", "." ]
train
https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-lib/src/main/java/it/jnrpe/plugins/MetricBuilder.java#L104-L107
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java
KDTree.addInstanceToTree
protected void addInstanceToTree(Instance inst, KDTreeNode node) throws Exception { if (node.isALeaf()) { int instList[] = new int[m_Instances.numInstances()]; try { System.arraycopy(m_InstList, 0, instList, 0, node.m_End + 1); // m_InstList.squeezeIn(m_End, // index); if (node.m_End < m_InstList.length - 1) System.arraycopy(m_InstList, node.m_End + 1, instList, node.m_End + 2, m_InstList.length - node.m_End - 1); instList[node.m_End + 1] = m_Instances.numInstances() - 1; } catch (ArrayIndexOutOfBoundsException ex) { System.err.println("m_InstList.length: " + m_InstList.length + " instList.length: " + instList.length + "node.m_End+1: " + (node.m_End + 1) + "m_InstList.length-node.m_End+1: " + (m_InstList.length - node.m_End - 1)); throw ex; } m_InstList = instList; node.m_End++; node.m_NodeRanges = m_EuclideanDistance.updateRanges(inst, node.m_NodeRanges); m_Splitter.setInstanceList(m_InstList); // split this leaf node if necessary double[][] universe = m_EuclideanDistance.getRanges(); if (node.numInstances() > m_MaxInstInLeaf && getMaxRelativeNodeWidth(node.m_NodeRanges, universe) > m_MinBoxRelWidth) { m_Splitter.splitNode(node, m_NumNodes, node.m_NodeRanges, universe); m_NumNodes += 2; } }// end if node is a leaf else { if (m_EuclideanDistance.valueIsSmallerEqual(inst, node.m_SplitDim, node.m_SplitValue)) { addInstanceToTree(inst, node.m_Left); afterAddInstance(node.m_Right); } else addInstanceToTree(inst, node.m_Right); node.m_End++; node.m_NodeRanges = m_EuclideanDistance.updateRanges(inst, node.m_NodeRanges); } }
java
protected void addInstanceToTree(Instance inst, KDTreeNode node) throws Exception { if (node.isALeaf()) { int instList[] = new int[m_Instances.numInstances()]; try { System.arraycopy(m_InstList, 0, instList, 0, node.m_End + 1); // m_InstList.squeezeIn(m_End, // index); if (node.m_End < m_InstList.length - 1) System.arraycopy(m_InstList, node.m_End + 1, instList, node.m_End + 2, m_InstList.length - node.m_End - 1); instList[node.m_End + 1] = m_Instances.numInstances() - 1; } catch (ArrayIndexOutOfBoundsException ex) { System.err.println("m_InstList.length: " + m_InstList.length + " instList.length: " + instList.length + "node.m_End+1: " + (node.m_End + 1) + "m_InstList.length-node.m_End+1: " + (m_InstList.length - node.m_End - 1)); throw ex; } m_InstList = instList; node.m_End++; node.m_NodeRanges = m_EuclideanDistance.updateRanges(inst, node.m_NodeRanges); m_Splitter.setInstanceList(m_InstList); // split this leaf node if necessary double[][] universe = m_EuclideanDistance.getRanges(); if (node.numInstances() > m_MaxInstInLeaf && getMaxRelativeNodeWidth(node.m_NodeRanges, universe) > m_MinBoxRelWidth) { m_Splitter.splitNode(node, m_NumNodes, node.m_NodeRanges, universe); m_NumNodes += 2; } }// end if node is a leaf else { if (m_EuclideanDistance.valueIsSmallerEqual(inst, node.m_SplitDim, node.m_SplitValue)) { addInstanceToTree(inst, node.m_Left); afterAddInstance(node.m_Right); } else addInstanceToTree(inst, node.m_Right); node.m_End++; node.m_NodeRanges = m_EuclideanDistance.updateRanges(inst, node.m_NodeRanges); } }
[ "protected", "void", "addInstanceToTree", "(", "Instance", "inst", ",", "KDTreeNode", "node", ")", "throws", "Exception", "{", "if", "(", "node", ".", "isALeaf", "(", ")", ")", "{", "int", "instList", "[", "]", "=", "new", "int", "[", "m_Instances", ".",...
Recursively adds an instance to the tree starting from the supplied KDTreeNode. NOTE: This should not be called by outside classes, outside classes should instead call update(Instance) method. @param inst The instance to add to the tree @param node The node to start the recursive search from, for the leaf node where the supplied instance would go. @throws Exception If some error occurs while adding the instance.
[ "Recursively", "adds", "an", "instance", "to", "the", "tree", "starting", "from", "the", "supplied", "KDTreeNode", ".", "NOTE", ":", "This", "should", "not", "be", "called", "by", "outside", "classes", "outside", "classes", "should", "instead", "call", "update...
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java#L440-L486
mariosotil/river-framework
river-core/src/main/java/org/riverframework/core/AbstractDocument.java
AbstractDocument.setFieldIfNecessary
protected boolean setFieldIfNecessary(String field, Object value) { if (!isOpen()) throw new ClosedObjectException("The Document object is closed."); if (!compareFieldValue(field, value)) { _doc.setField(field, value); return true; } return false; }
java
protected boolean setFieldIfNecessary(String field, Object value) { if (!isOpen()) throw new ClosedObjectException("The Document object is closed."); if (!compareFieldValue(field, value)) { _doc.setField(field, value); return true; } return false; }
[ "protected", "boolean", "setFieldIfNecessary", "(", "String", "field", ",", "Object", "value", ")", "{", "if", "(", "!", "isOpen", "(", ")", ")", "throw", "new", "ClosedObjectException", "(", "\"The Document object is closed.\"", ")", ";", "if", "(", "!", "com...
Verifies if the new value is different from the field's old value. It's useful, for example, in NoSQL databases that replicates data between servers. This verification prevents to mark a field as modified and to be replicated needlessly. @param field the field that we are checking before to be modified @param value the new value @return true if the new and the old values are different and the value was changed.
[ "Verifies", "if", "the", "new", "value", "is", "different", "from", "the", "field", "s", "old", "value", ".", "It", "s", "useful", "for", "example", "in", "NoSQL", "databases", "that", "replicates", "data", "between", "servers", ".", "This", "verification", ...
train
https://github.com/mariosotil/river-framework/blob/e8c3ae3b0a956ec9cb4e14a81376ba8e8370b44e/river-core/src/main/java/org/riverframework/core/AbstractDocument.java#L143-L153
dbracewell/mango
src/main/java/com/davidbracewell/json/JsonReader.java
JsonReader.nextArray
public <T> T[] nextArray(@NonNull Class<T> elementType) throws IOException { return nextArray(StringUtils.EMPTY, elementType); }
java
public <T> T[] nextArray(@NonNull Class<T> elementType) throws IOException { return nextArray(StringUtils.EMPTY, elementType); }
[ "public", "<", "T", ">", "T", "[", "]", "nextArray", "(", "@", "NonNull", "Class", "<", "T", ">", "elementType", ")", "throws", "IOException", "{", "return", "nextArray", "(", "StringUtils", ".", "EMPTY", ",", "elementType", ")", ";", "}" ]
Reads the next array @param <T> the component type of the array @param elementType class information for the component type @return the array @throws IOException Something went wrong reading the array
[ "Reads", "the", "next", "array" ]
train
https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/json/JsonReader.java#L346-L348
OpenLiberty/open-liberty
dev/com.ibm.ws.javaee.ddmodel.wsbnd/src/com/ibm/ws/javaee/ddmodel/wsbnd/impl/ServiceRefType.java
ServiceRefType.handleAttribute
@Override public boolean handleAttribute(DDParser parser, String nsURI, String localName, int index) throws ParseException { boolean result = false; if (nsURI != null) { return result; } if (NAME_ATTRIBUTE_NAME.equals(localName)) { name = parser.parseStringAttributeValue(index); result = true; } else if (COMPONENT_NAME_ATTRIBUTE_NAME.equals(localName)) { componentName = parser.parseStringAttributeValue(index); result = true; } else if (PORT_ADDRESS_ATTRIBUTE_NAME.equals(localName)) { portAddress = parser.parseStringAttributeValue(index); result = true; } else if (WSDL_LOCATION_ATTRIBUTE_NAME.equals(localName)) { wsdlLocation = parser.parseStringAttributeValue(index); result = true; } return result; }
java
@Override public boolean handleAttribute(DDParser parser, String nsURI, String localName, int index) throws ParseException { boolean result = false; if (nsURI != null) { return result; } if (NAME_ATTRIBUTE_NAME.equals(localName)) { name = parser.parseStringAttributeValue(index); result = true; } else if (COMPONENT_NAME_ATTRIBUTE_NAME.equals(localName)) { componentName = parser.parseStringAttributeValue(index); result = true; } else if (PORT_ADDRESS_ATTRIBUTE_NAME.equals(localName)) { portAddress = parser.parseStringAttributeValue(index); result = true; } else if (WSDL_LOCATION_ATTRIBUTE_NAME.equals(localName)) { wsdlLocation = parser.parseStringAttributeValue(index); result = true; } return result; }
[ "@", "Override", "public", "boolean", "handleAttribute", "(", "DDParser", "parser", ",", "String", "nsURI", ",", "String", "localName", ",", "int", "index", ")", "throws", "ParseException", "{", "boolean", "result", "=", "false", ";", "if", "(", "nsURI", "!=...
parse the name and address attributes defined in the element.
[ "parse", "the", "name", "and", "address", "attributes", "defined", "in", "the", "element", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javaee.ddmodel.wsbnd/src/com/ibm/ws/javaee/ddmodel/wsbnd/impl/ServiceRefType.java#L85-L109
voldemort/voldemort
src/java/voldemort/utils/StoreDefinitionUtils.java
StoreDefinitionUtils.validateNewStoreDefIsNonBreaking
public static void validateNewStoreDefIsNonBreaking(StoreDefinition oldStoreDef, StoreDefinition newStoreDef){ if (!oldStoreDef.getName().equals(newStoreDef.getName())){ throw new VoldemortException("Cannot compare stores of different names: " + oldStoreDef.getName() + " and " + newStoreDef.getName()); } String store = oldStoreDef.getName(); verifySamePropertyForUpdate(oldStoreDef.getReplicationFactor(), newStoreDef.getReplicationFactor(), "ReplicationFactor", store); verifySamePropertyForUpdate(oldStoreDef.getType(), newStoreDef.getType(), "Type", store); verifySameSerializerType(oldStoreDef.getKeySerializer(), newStoreDef.getKeySerializer(), "KeySerializer", store); verifySameSerializerType(oldStoreDef.getValueSerializer(), newStoreDef.getValueSerializer(), "ValueSerializer", store); verifySameSerializerType(oldStoreDef.getTransformsSerializer(), newStoreDef.getTransformsSerializer(), "TransformSerializer", store); verifySamePropertyForUpdate(oldStoreDef.getRoutingPolicy(), newStoreDef.getRoutingPolicy(), "RoutingPolicy", store); verifySamePropertyForUpdate(oldStoreDef.getRoutingStrategyType(), newStoreDef.getRoutingStrategyType(), "RoutingStrategyType", store); verifySamePropertyForUpdate(oldStoreDef.getZoneReplicationFactor(), newStoreDef.getZoneReplicationFactor(), "ZoneReplicationFactor", store); verifySamePropertyForUpdate(oldStoreDef.getValueTransformation(), newStoreDef.getValueTransformation(), "ValueTransformation", store); verifySamePropertyForUpdate(oldStoreDef.getSerializerFactory(), newStoreDef.getSerializerFactory(), "SerializerFactory", store); verifySamePropertyForUpdate(oldStoreDef.getHintedHandoffStrategyType(), newStoreDef.getHintedHandoffStrategyType(), "HintedHandoffStrategyType", store); verifySamePropertyForUpdate(oldStoreDef.getHintPrefListSize(), newStoreDef.getHintPrefListSize(), "HintPrefListSize", store); }
java
public static void validateNewStoreDefIsNonBreaking(StoreDefinition oldStoreDef, StoreDefinition newStoreDef){ if (!oldStoreDef.getName().equals(newStoreDef.getName())){ throw new VoldemortException("Cannot compare stores of different names: " + oldStoreDef.getName() + " and " + newStoreDef.getName()); } String store = oldStoreDef.getName(); verifySamePropertyForUpdate(oldStoreDef.getReplicationFactor(), newStoreDef.getReplicationFactor(), "ReplicationFactor", store); verifySamePropertyForUpdate(oldStoreDef.getType(), newStoreDef.getType(), "Type", store); verifySameSerializerType(oldStoreDef.getKeySerializer(), newStoreDef.getKeySerializer(), "KeySerializer", store); verifySameSerializerType(oldStoreDef.getValueSerializer(), newStoreDef.getValueSerializer(), "ValueSerializer", store); verifySameSerializerType(oldStoreDef.getTransformsSerializer(), newStoreDef.getTransformsSerializer(), "TransformSerializer", store); verifySamePropertyForUpdate(oldStoreDef.getRoutingPolicy(), newStoreDef.getRoutingPolicy(), "RoutingPolicy", store); verifySamePropertyForUpdate(oldStoreDef.getRoutingStrategyType(), newStoreDef.getRoutingStrategyType(), "RoutingStrategyType", store); verifySamePropertyForUpdate(oldStoreDef.getZoneReplicationFactor(), newStoreDef.getZoneReplicationFactor(), "ZoneReplicationFactor", store); verifySamePropertyForUpdate(oldStoreDef.getValueTransformation(), newStoreDef.getValueTransformation(), "ValueTransformation", store); verifySamePropertyForUpdate(oldStoreDef.getSerializerFactory(), newStoreDef.getSerializerFactory(), "SerializerFactory", store); verifySamePropertyForUpdate(oldStoreDef.getHintedHandoffStrategyType(), newStoreDef.getHintedHandoffStrategyType(), "HintedHandoffStrategyType", store); verifySamePropertyForUpdate(oldStoreDef.getHintPrefListSize(), newStoreDef.getHintPrefListSize(), "HintPrefListSize", store); }
[ "public", "static", "void", "validateNewStoreDefIsNonBreaking", "(", "StoreDefinition", "oldStoreDef", ",", "StoreDefinition", "newStoreDef", ")", "{", "if", "(", "!", "oldStoreDef", ".", "getName", "(", ")", ".", "equals", "(", "newStoreDef", ".", "getName", "(",...
Ensure that new store definitions that are specified for an update do not include breaking changes to the store. Non-breaking changes include changes to description preferredWrites requiredWrites preferredReads requiredReads retentionPeriodDays retentionScanThrottleRate retentionFrequencyDays viewOf zoneCountReads zoneCountWrites owners memoryFootprintMB non breaking changes include the serializer definition, as long as the type (name field) is unchanged for keySerializer valueSerializer transformSerializer @param oldStoreDef @param newStoreDef
[ "Ensure", "that", "new", "store", "definitions", "that", "are", "specified", "for", "an", "update", "do", "not", "include", "breaking", "changes", "to", "the", "store", "." ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/StoreDefinitionUtils.java#L305-L324
zaproxy/zaproxy
src/org/parosproxy/paros/network/HttpSender.java
HttpSender.sendAndReceive
public void sendAndReceive(HttpMessage msg, boolean isFollowRedirect) throws IOException { log.debug("sendAndReceive " + msg.getRequestHeader().getMethod() + " " + msg.getRequestHeader().getURI() + " start"); msg.setTimeSentMillis(System.currentTimeMillis()); try { notifyRequestListeners(msg); if (!isFollowRedirect || !(msg.getRequestHeader().getMethod().equalsIgnoreCase(HttpRequestHeader.POST) || msg .getRequestHeader().getMethod().equalsIgnoreCase(HttpRequestHeader.PUT))) { // ZAP: Reauthentication when sending a message from the perspective of a User sendAuthenticated(msg, isFollowRedirect); return; } // ZAP: Reauthentication when sending a message from the perspective of a User sendAuthenticated(msg, false); HttpMessage temp = msg.cloneAll(); temp.setRequestingUser(getUser(msg)); // POST/PUT method cannot be redirected by library. Need to follow by code // loop 1 time only because httpclient can handle redirect itself after first GET. for (int i = 0; i < 1 && (HttpStatusCode.isRedirection(temp.getResponseHeader().getStatusCode()) && temp .getResponseHeader().getStatusCode() != HttpStatusCode.NOT_MODIFIED); i++) { String location = temp.getResponseHeader().getHeader(HttpHeader.LOCATION); URI baseUri = temp.getRequestHeader().getURI(); URI newLocation = new URI(baseUri, location, false); temp.getRequestHeader().setURI(newLocation); temp.getRequestHeader().setMethod(HttpRequestHeader.GET); temp.getRequestHeader().setHeader(HttpHeader.CONTENT_LENGTH, null); // ZAP: Reauthentication when sending a message from the perspective of a User sendAuthenticated(temp, true); } msg.setResponseHeader(temp.getResponseHeader()); msg.setResponseBody(temp.getResponseBody()); } finally { msg.setTimeElapsedMillis((int) (System.currentTimeMillis() - msg.getTimeSentMillis())); log.debug("sendAndReceive " + msg.getRequestHeader().getMethod() + " " + msg.getRequestHeader().getURI() + " took " + msg.getTimeElapsedMillis()); notifyResponseListeners(msg); } }
java
public void sendAndReceive(HttpMessage msg, boolean isFollowRedirect) throws IOException { log.debug("sendAndReceive " + msg.getRequestHeader().getMethod() + " " + msg.getRequestHeader().getURI() + " start"); msg.setTimeSentMillis(System.currentTimeMillis()); try { notifyRequestListeners(msg); if (!isFollowRedirect || !(msg.getRequestHeader().getMethod().equalsIgnoreCase(HttpRequestHeader.POST) || msg .getRequestHeader().getMethod().equalsIgnoreCase(HttpRequestHeader.PUT))) { // ZAP: Reauthentication when sending a message from the perspective of a User sendAuthenticated(msg, isFollowRedirect); return; } // ZAP: Reauthentication when sending a message from the perspective of a User sendAuthenticated(msg, false); HttpMessage temp = msg.cloneAll(); temp.setRequestingUser(getUser(msg)); // POST/PUT method cannot be redirected by library. Need to follow by code // loop 1 time only because httpclient can handle redirect itself after first GET. for (int i = 0; i < 1 && (HttpStatusCode.isRedirection(temp.getResponseHeader().getStatusCode()) && temp .getResponseHeader().getStatusCode() != HttpStatusCode.NOT_MODIFIED); i++) { String location = temp.getResponseHeader().getHeader(HttpHeader.LOCATION); URI baseUri = temp.getRequestHeader().getURI(); URI newLocation = new URI(baseUri, location, false); temp.getRequestHeader().setURI(newLocation); temp.getRequestHeader().setMethod(HttpRequestHeader.GET); temp.getRequestHeader().setHeader(HttpHeader.CONTENT_LENGTH, null); // ZAP: Reauthentication when sending a message from the perspective of a User sendAuthenticated(temp, true); } msg.setResponseHeader(temp.getResponseHeader()); msg.setResponseBody(temp.getResponseBody()); } finally { msg.setTimeElapsedMillis((int) (System.currentTimeMillis() - msg.getTimeSentMillis())); log.debug("sendAndReceive " + msg.getRequestHeader().getMethod() + " " + msg.getRequestHeader().getURI() + " took " + msg.getTimeElapsedMillis()); notifyResponseListeners(msg); } }
[ "public", "void", "sendAndReceive", "(", "HttpMessage", "msg", ",", "boolean", "isFollowRedirect", ")", "throws", "IOException", "{", "log", ".", "debug", "(", "\"sendAndReceive \"", "+", "msg", ".", "getRequestHeader", "(", ")", ".", "getMethod", "(", ")", "+...
Send and receive a HttpMessage. @param msg @param isFollowRedirect @throws HttpException @throws IOException @see #sendAndReceive(HttpMessage, HttpRequestConfig)
[ "Send", "and", "receive", "a", "HttpMessage", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/network/HttpSender.java#L402-L450
katharsis-project/katharsis-framework
katharsis-core/src/main/java/io/katharsis/legacy/registry/ResourceRegistryBuilder.java
ResourceRegistryBuilder.build
public ResourceRegistry build(String packageName, ModuleRegistry moduleRegistry, ServiceUrlProvider serviceUrlProvider) { return build(new DefaultResourceLookup(packageName), moduleRegistry, serviceUrlProvider); }
java
public ResourceRegistry build(String packageName, ModuleRegistry moduleRegistry, ServiceUrlProvider serviceUrlProvider) { return build(new DefaultResourceLookup(packageName), moduleRegistry, serviceUrlProvider); }
[ "public", "ResourceRegistry", "build", "(", "String", "packageName", ",", "ModuleRegistry", "moduleRegistry", ",", "ServiceUrlProvider", "serviceUrlProvider", ")", "{", "return", "build", "(", "new", "DefaultResourceLookup", "(", "packageName", ")", ",", "moduleRegistry...
Uses a {@link DefaultResourceLookup} to get all classes in provided package and finds all resources and repositories associated with found resource. @param packageName Package containing resources (models) and repositories. @param serviceUrlProvider Compute the resource to this service @return an instance of ResourceRegistry
[ "Uses", "a", "{", "@link", "DefaultResourceLookup", "}", "to", "get", "all", "classes", "in", "provided", "package", "and", "finds", "all", "resources", "and", "repositories", "associated", "with", "found", "resource", "." ]
train
https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/legacy/registry/ResourceRegistryBuilder.java#L55-L57
dashorst/wicket-stuff-markup-validator
jing/src/main/java/com/thaiopensource/validate/nvdl/ValidatorImpl.java
Section.addValidator
public void addValidator(Schema schema, ModeUsage modeUsage) { // adds the schema to this section schemas schemas.addElement(schema); // creates the validator Validator validator = createValidator(schema); // adds the validator to this section validators validators.addElement(validator); // add the validator handler to the list of active handlers activeHandlers.addElement(validator.getContentHandler()); // add the mode usage to the active handlers attribute mode usage list activeHandlersAttributeModeUsage.addElement(modeUsage); // compute the attribute processing attributeProcessing = Math.max(attributeProcessing, modeUsage.getAttributeProcessing()); // add a child mode with this mode usage and the validator content handler childPrograms.addElement(new Program(modeUsage, validator.getContentHandler())); if (modeUsage.isContextDependent()) contextDependent = true; }
java
public void addValidator(Schema schema, ModeUsage modeUsage) { // adds the schema to this section schemas schemas.addElement(schema); // creates the validator Validator validator = createValidator(schema); // adds the validator to this section validators validators.addElement(validator); // add the validator handler to the list of active handlers activeHandlers.addElement(validator.getContentHandler()); // add the mode usage to the active handlers attribute mode usage list activeHandlersAttributeModeUsage.addElement(modeUsage); // compute the attribute processing attributeProcessing = Math.max(attributeProcessing, modeUsage.getAttributeProcessing()); // add a child mode with this mode usage and the validator content handler childPrograms.addElement(new Program(modeUsage, validator.getContentHandler())); if (modeUsage.isContextDependent()) contextDependent = true; }
[ "public", "void", "addValidator", "(", "Schema", "schema", ",", "ModeUsage", "modeUsage", ")", "{", "// adds the schema to this section schemas", "schemas", ".", "addElement", "(", "schema", ")", ";", "// creates the validator", "Validator", "validator", "=", "createVal...
Adds a validator. @param schema The schema to validate against. @param modeUsage The mode usage for this validate action.
[ "Adds", "a", "validator", "." ]
train
https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/validate/nvdl/ValidatorImpl.java#L246-L264
aws/aws-sdk-java
aws-java-sdk-elasticsearch/src/main/java/com/amazonaws/services/elasticsearch/model/CreateElasticsearchDomainRequest.java
CreateElasticsearchDomainRequest.withAdvancedOptions
public CreateElasticsearchDomainRequest withAdvancedOptions(java.util.Map<String, String> advancedOptions) { setAdvancedOptions(advancedOptions); return this; }
java
public CreateElasticsearchDomainRequest withAdvancedOptions(java.util.Map<String, String> advancedOptions) { setAdvancedOptions(advancedOptions); return this; }
[ "public", "CreateElasticsearchDomainRequest", "withAdvancedOptions", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "advancedOptions", ")", "{", "setAdvancedOptions", "(", "advancedOptions", ")", ";", "return", "this", ";", "}" ]
<p> Option to allow references to indices in an HTTP request body. Must be <code>false</code> when configuring access to individual sub-resources. By default, the value is <code>true</code>. See <a href= "http://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-createupdatedomains.html#es-createdomain-configure-advanced-options" target="_blank">Configuration Advanced Options</a> for more information. </p> @param advancedOptions Option to allow references to indices in an HTTP request body. Must be <code>false</code> when configuring access to individual sub-resources. By default, the value is <code>true</code>. See <a href= "http://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-createupdatedomains.html#es-createdomain-configure-advanced-options" target="_blank">Configuration Advanced Options</a> for more information. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Option", "to", "allow", "references", "to", "indices", "in", "an", "HTTP", "request", "body", ".", "Must", "be", "<code", ">", "false<", "/", "code", ">", "when", "configuring", "access", "to", "individual", "sub", "-", "resources", ".", "By"...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-elasticsearch/src/main/java/com/amazonaws/services/elasticsearch/model/CreateElasticsearchDomainRequest.java#L626-L629
apache/incubator-shardingsphere
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/clause/TableReferencesClauseParser.java
TableReferencesClauseParser.parseSingleTableWithoutAlias
public final void parseSingleTableWithoutAlias(final SQLStatement sqlStatement) { int beginPosition = lexerEngine.getCurrentToken().getEndPosition() - lexerEngine.getCurrentToken().getLiterals().length(); String literals = lexerEngine.getCurrentToken().getLiterals(); int skippedSchemaNameLength = 0; lexerEngine.nextToken(); if (lexerEngine.skipIfEqual(Symbol.DOT)) { skippedSchemaNameLength = literals.length() + Symbol.DOT.getLiterals().length(); literals = lexerEngine.getCurrentToken().getLiterals(); lexerEngine.nextToken(); } sqlStatement.addSQLToken(new TableToken(beginPosition, literals, QuoteCharacter.getQuoteCharacter(literals), skippedSchemaNameLength)); sqlStatement.getTables().add(new Table(SQLUtil.getExactlyValue(literals), null)); }
java
public final void parseSingleTableWithoutAlias(final SQLStatement sqlStatement) { int beginPosition = lexerEngine.getCurrentToken().getEndPosition() - lexerEngine.getCurrentToken().getLiterals().length(); String literals = lexerEngine.getCurrentToken().getLiterals(); int skippedSchemaNameLength = 0; lexerEngine.nextToken(); if (lexerEngine.skipIfEqual(Symbol.DOT)) { skippedSchemaNameLength = literals.length() + Symbol.DOT.getLiterals().length(); literals = lexerEngine.getCurrentToken().getLiterals(); lexerEngine.nextToken(); } sqlStatement.addSQLToken(new TableToken(beginPosition, literals, QuoteCharacter.getQuoteCharacter(literals), skippedSchemaNameLength)); sqlStatement.getTables().add(new Table(SQLUtil.getExactlyValue(literals), null)); }
[ "public", "final", "void", "parseSingleTableWithoutAlias", "(", "final", "SQLStatement", "sqlStatement", ")", "{", "int", "beginPosition", "=", "lexerEngine", ".", "getCurrentToken", "(", ")", ".", "getEndPosition", "(", ")", "-", "lexerEngine", ".", "getCurrentToke...
Parse single table without alias. @param sqlStatement SQL statement
[ "Parse", "single", "table", "without", "alias", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/clause/TableReferencesClauseParser.java#L192-L204
UrielCh/ovh-java-sdk
ovh-java-sdk-cdndedicated/src/main/java/net/minidev/ovh/api/ApiOvhCdndedicated.java
ApiOvhCdndedicated.serviceName_domains_domain_cacheRules_POST
public OvhCacheRule serviceName_domains_domain_cacheRules_POST(String serviceName, String domain, OvhCacheRuleCacheTypeEnum cacheType, String fileMatch, OvhCacheRuleFileTypeEnum fileType, Long ttl) throws IOException { String qPath = "/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules"; StringBuilder sb = path(qPath, serviceName, domain); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "cacheType", cacheType); addBody(o, "fileMatch", fileMatch); addBody(o, "fileType", fileType); addBody(o, "ttl", ttl); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhCacheRule.class); }
java
public OvhCacheRule serviceName_domains_domain_cacheRules_POST(String serviceName, String domain, OvhCacheRuleCacheTypeEnum cacheType, String fileMatch, OvhCacheRuleFileTypeEnum fileType, Long ttl) throws IOException { String qPath = "/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules"; StringBuilder sb = path(qPath, serviceName, domain); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "cacheType", cacheType); addBody(o, "fileMatch", fileMatch); addBody(o, "fileType", fileType); addBody(o, "ttl", ttl); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhCacheRule.class); }
[ "public", "OvhCacheRule", "serviceName_domains_domain_cacheRules_POST", "(", "String", "serviceName", ",", "String", "domain", ",", "OvhCacheRuleCacheTypeEnum", "cacheType", ",", "String", "fileMatch", ",", "OvhCacheRuleFileTypeEnum", "fileType", ",", "Long", "ttl", ")", ...
Add a cache rule to a domain REST: POST /cdn/dedicated/{serviceName}/domains/{domain}/cacheRules @param cacheType [required] Type of cache rule to add to the domain @param ttl [required] ttl for cache rule to add to the domain @param fileMatch [required] File match for cache rule to add to the domain @param fileType [required] File type for cache rule to add to the domain @param serviceName [required] The internal name of your CDN offer @param domain [required] Domain of this object
[ "Add", "a", "cache", "rule", "to", "a", "domain" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cdndedicated/src/main/java/net/minidev/ovh/api/ApiOvhCdndedicated.java#L223-L233
Alluxio/alluxio
shell/src/main/java/alluxio/cli/fs/command/ChmodCommand.java
ChmodCommand.chmod
private void chmod(AlluxioURI path, String modeStr, boolean recursive) throws AlluxioException, IOException { Mode mode = ModeParser.parse(modeStr); SetAttributePOptions options = SetAttributePOptions.newBuilder().setMode(mode.toProto()).setRecursive(recursive).build(); mFileSystem.setAttribute(path, options); System.out .println("Changed permission of " + path + " to " + Integer.toOctalString(mode.toShort())); }
java
private void chmod(AlluxioURI path, String modeStr, boolean recursive) throws AlluxioException, IOException { Mode mode = ModeParser.parse(modeStr); SetAttributePOptions options = SetAttributePOptions.newBuilder().setMode(mode.toProto()).setRecursive(recursive).build(); mFileSystem.setAttribute(path, options); System.out .println("Changed permission of " + path + " to " + Integer.toOctalString(mode.toShort())); }
[ "private", "void", "chmod", "(", "AlluxioURI", "path", ",", "String", "modeStr", ",", "boolean", "recursive", ")", "throws", "AlluxioException", ",", "IOException", "{", "Mode", "mode", "=", "ModeParser", ".", "parse", "(", "modeStr", ")", ";", "SetAttributePO...
Changes the permissions of directory or file with the path specified in args. @param path The {@link AlluxioURI} path as the input of the command @param modeStr The new permission to be updated to the file or directory @param recursive Whether change the permission recursively
[ "Changes", "the", "permissions", "of", "directory", "or", "file", "with", "the", "path", "specified", "in", "args", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fs/command/ChmodCommand.java#L82-L90
thymeleaf/thymeleaf
src/main/java/org/thymeleaf/standard/expression/FragmentExpression.java
FragmentExpression.createExecutedFragmentExpression
@Deprecated public static ExecutedFragmentExpression createExecutedFragmentExpression( final IExpressionContext context, final FragmentExpression expression, final StandardExpressionExecutionContext expContext) { return doCreateExecutedFragmentExpression(context, expression, expContext); }
java
@Deprecated public static ExecutedFragmentExpression createExecutedFragmentExpression( final IExpressionContext context, final FragmentExpression expression, final StandardExpressionExecutionContext expContext) { return doCreateExecutedFragmentExpression(context, expression, expContext); }
[ "@", "Deprecated", "public", "static", "ExecutedFragmentExpression", "createExecutedFragmentExpression", "(", "final", "IExpressionContext", "context", ",", "final", "FragmentExpression", "expression", ",", "final", "StandardExpressionExecutionContext", "expContext", ")", "{", ...
<p> Create the executed fragment expression. </p> @param context the context @param expression the expresson @param expContext the expression context @return the executed fragment expression @deprecated Deprecated in 3.0.9. Use the version without "expContext" itself, as all FragmentExpressions should be executed in RESTRICTED mode (no request parameter use allowed).
[ "<p", ">", "Create", "the", "executed", "fragment", "expression", ".", "<", "/", "p", ">" ]
train
https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/standard/expression/FragmentExpression.java#L415-L420
JDBDT/jdbdt
src/main/java/org/jdbdt/Log.java
Log.create
static Log create(File outputFile) { try { return new Log( new PrintStream( outputFile.getName().endsWith(".gz") ? new GZIPOutputStream(new FileOutputStream(outputFile)) : new FileOutputStream(outputFile)), false); } catch (IOException e) { throw new InvalidOperationException("I/O error", e); } }
java
static Log create(File outputFile) { try { return new Log( new PrintStream( outputFile.getName().endsWith(".gz") ? new GZIPOutputStream(new FileOutputStream(outputFile)) : new FileOutputStream(outputFile)), false); } catch (IOException e) { throw new InvalidOperationException("I/O error", e); } }
[ "static", "Log", "create", "(", "File", "outputFile", ")", "{", "try", "{", "return", "new", "Log", "(", "new", "PrintStream", "(", "outputFile", ".", "getName", "(", ")", ".", "endsWith", "(", "\".gz\"", ")", "?", "new", "GZIPOutputStream", "(", "new", ...
Creator method (file variant). @param outputFile Output file. @return A new log instance.
[ "Creator", "method", "(", "file", "variant", ")", "." ]
train
https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/Log.java#L84-L96
operasoftware/operaprestodriver
src/com/opera/core/systems/OperaExtensions.java
OperaExtensions.createOEXDirectory
private void createOEXDirectory(String wuid) throws IOException { File oexDirectory = new File(directory, wuid); if (!oexDirectory.exists() && !oexDirectory.mkdirs()) { throw new WebDriverException("Unable to create directory path: " + directory.getPath()); } File prefsDatPath = new File(oexDirectory, "prefs.dat"); String prefContent = String.format(WIDGET_PREFS_DAT_CONTENT, wuid); Files.write(prefContent, prefsDatPath, Charsets.UTF_8); }
java
private void createOEXDirectory(String wuid) throws IOException { File oexDirectory = new File(directory, wuid); if (!oexDirectory.exists() && !oexDirectory.mkdirs()) { throw new WebDriverException("Unable to create directory path: " + directory.getPath()); } File prefsDatPath = new File(oexDirectory, "prefs.dat"); String prefContent = String.format(WIDGET_PREFS_DAT_CONTENT, wuid); Files.write(prefContent, prefsDatPath, Charsets.UTF_8); }
[ "private", "void", "createOEXDirectory", "(", "String", "wuid", ")", "throws", "IOException", "{", "File", "oexDirectory", "=", "new", "File", "(", "directory", ",", "wuid", ")", ";", "if", "(", "!", "oexDirectory", ".", "exists", "(", ")", "&&", "!", "o...
Create the minimal directory structure and prefs.dat for an Opera extension. @param wuid ID of extension as known in widgets.dat
[ "Create", "the", "minimal", "directory", "structure", "and", "prefs", ".", "dat", "for", "an", "Opera", "extension", "." ]
train
https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/OperaExtensions.java#L186-L194
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java
ValueFileIOHelper.writeOutput
protected long writeOutput(OutputStream out, ValueData value) throws IOException { if (value.isByteArray()) { byte[] buff = value.getAsByteArray(); out.write(buff); return buff.length; } else { InputStream in; if (value instanceof StreamPersistedValueData) { StreamPersistedValueData streamed = (StreamPersistedValueData)value; if (streamed.isPersisted()) { // already persisted in another Value, copy it to this Value in = streamed.getAsStream(); } else { in = streamed.getStream(); if (in == null) { in = new FileInputStream(streamed.getTempFile()); } } } else { in = value.getAsStream(); } try { return copy(in, out); } finally { in.close(); } } }
java
protected long writeOutput(OutputStream out, ValueData value) throws IOException { if (value.isByteArray()) { byte[] buff = value.getAsByteArray(); out.write(buff); return buff.length; } else { InputStream in; if (value instanceof StreamPersistedValueData) { StreamPersistedValueData streamed = (StreamPersistedValueData)value; if (streamed.isPersisted()) { // already persisted in another Value, copy it to this Value in = streamed.getAsStream(); } else { in = streamed.getStream(); if (in == null) { in = new FileInputStream(streamed.getTempFile()); } } } else { in = value.getAsStream(); } try { return copy(in, out); } finally { in.close(); } } }
[ "protected", "long", "writeOutput", "(", "OutputStream", "out", ",", "ValueData", "value", ")", "throws", "IOException", "{", "if", "(", "value", ".", "isByteArray", "(", ")", ")", "{", "byte", "[", "]", "buff", "=", "value", ".", "getAsByteArray", "(", ...
Stream value data to the output. @param out OutputStream @param value ValueData @throws IOException if error occurs
[ "Stream", "value", "data", "to", "the", "output", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java#L188-L232
ludovicianul/selenium-on-steroids
src/main/java/com/insidecoding/sos/xml/XMLUtils.java
XMLUtils.getTagText
public String getTagText(final String xmlString, final String tagName) throws ParserConfigurationException, SAXException, IOException { NodeList nodes = this.getNodeList(xmlString, tagName); LOG.info("Elements returned = " + nodes.getLength()); Element element = (Element) nodes.item(0); LOG.info("element text = " + element.getTextContent()); return element.getTextContent(); }
java
public String getTagText(final String xmlString, final String tagName) throws ParserConfigurationException, SAXException, IOException { NodeList nodes = this.getNodeList(xmlString, tagName); LOG.info("Elements returned = " + nodes.getLength()); Element element = (Element) nodes.item(0); LOG.info("element text = " + element.getTextContent()); return element.getTextContent(); }
[ "public", "String", "getTagText", "(", "final", "String", "xmlString", ",", "final", "String", "tagName", ")", "throws", "ParserConfigurationException", ",", "SAXException", ",", "IOException", "{", "NodeList", "nodes", "=", "this", ".", "getNodeList", "(", "xmlSt...
You must pass the xml string and the tag name. This should be called for situations where you want to get the value of a simple tag: &lt;age&gt;18&lt;/age&gt;. In this case, in order to get the 18 value we call the method like this: getTagText(xml, "age"); and this will return 18 The method will return the first tag it encounters. @param xmlString the XML string @param tagName the tag name to be searched for @return the value corresponding to the {@code tagName} @throws ParserConfigurationException if something goes wrong while parsing the XML @throws SAXException if XML is malformed @throws IOException if something goes woring when reading the file
[ "You", "must", "pass", "the", "xml", "string", "and", "the", "tag", "name", ".", "This", "should", "be", "called", "for", "situations", "where", "you", "want", "to", "get", "the", "value", "of", "a", "simple", "tag", ":", "&lt", ";", "age&gt", ";", "...
train
https://github.com/ludovicianul/selenium-on-steroids/blob/f89d91c59f686114f94624bfc55712f278005bfa/src/main/java/com/insidecoding/sos/xml/XMLUtils.java#L81-L94
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java
AbstractBeanDefinition.getBeanProviderForConstructorArgument
@SuppressWarnings("WeakerAccess") @Internal protected final Provider getBeanProviderForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, @SuppressWarnings("unused") ConstructorInjectionPoint constructorInjectionPoint, Argument argument) { return resolveBeanWithGenericsFromConstructorArgument(resolutionContext, argument, (beanType, qualifier) -> ((DefaultBeanContext) context).getBeanProvider(resolutionContext, beanType, qualifier) ); }
java
@SuppressWarnings("WeakerAccess") @Internal protected final Provider getBeanProviderForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, @SuppressWarnings("unused") ConstructorInjectionPoint constructorInjectionPoint, Argument argument) { return resolveBeanWithGenericsFromConstructorArgument(resolutionContext, argument, (beanType, qualifier) -> ((DefaultBeanContext) context).getBeanProvider(resolutionContext, beanType, qualifier) ); }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "@", "Internal", "protected", "final", "Provider", "getBeanProviderForConstructorArgument", "(", "BeanResolutionContext", "resolutionContext", ",", "BeanContext", "context", ",", "@", "SuppressWarnings", "(", "\"unused\...
Obtains a bean provider for a constructor at the given index <p> Warning: this method is used by internal generated code and should not be called by user code. @param resolutionContext The resolution context @param context The context @param constructorInjectionPoint The constructor injection point @param argument The argument @return The resolved bean
[ "Obtains", "a", "bean", "provider", "for", "a", "constructor", "at", "the", "given", "index", "<p", ">", "Warning", ":", "this", "method", "is", "used", "by", "internal", "generated", "code", "and", "should", "not", "be", "called", "by", "user", "code", ...
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java#L1061-L1067
hellosign/hellosign-java-sdk
src/main/java/com/hellosign/sdk/resource/TemplateSignatureRequest.java
TemplateSignatureRequest.setSigner
public void setSigner(String role, String email, String name) throws HelloSignException { signers.put(role, new Signer(email, name)); }
java
public void setSigner(String role, String email, String name) throws HelloSignException { signers.put(role, new Signer(email, name)); }
[ "public", "void", "setSigner", "(", "String", "role", ",", "String", "email", ",", "String", "name", ")", "throws", "HelloSignException", "{", "signers", ".", "put", "(", "role", ",", "new", "Signer", "(", "email", ",", "name", ")", ")", ";", "}" ]
Adds the signer to the list of signers for this request. @param role String @param email String @param name String @throws HelloSignException thrown if there is a problem setting the signer.
[ "Adds", "the", "signer", "to", "the", "list", "of", "signers", "for", "this", "request", "." ]
train
https://github.com/hellosign/hellosign-java-sdk/blob/08fa7aeb3b0c68ddb6c7ea797d114d55d36d36b1/src/main/java/com/hellosign/sdk/resource/TemplateSignatureRequest.java#L140-L142
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/io/stream/ByteBufferOutputStream.java
ByteBufferOutputStream.writeTo
public void writeTo (@Nonnull final byte [] aBuf, @Nonnegative final int nOfs, @Nonnegative final int nLen) { writeTo (aBuf, nOfs, nLen, true); }
java
public void writeTo (@Nonnull final byte [] aBuf, @Nonnegative final int nOfs, @Nonnegative final int nLen) { writeTo (aBuf, nOfs, nLen, true); }
[ "public", "void", "writeTo", "(", "@", "Nonnull", "final", "byte", "[", "]", "aBuf", ",", "@", "Nonnegative", "final", "int", "nOfs", ",", "@", "Nonnegative", "final", "int", "nLen", ")", "{", "writeTo", "(", "aBuf", ",", "nOfs", ",", "nLen", ",", "t...
Write current content to the passed byte array. The copied elements are removed from this streams buffer. @param aBuf Byte array to write to. May not be <code>null</code>. @param nOfs Offset to start writing. Must be &ge; 0. @param nLen Number of bytes to copy. Must be &ge; 0.
[ "Write", "current", "content", "to", "the", "passed", "byte", "array", ".", "The", "copied", "elements", "are", "removed", "from", "this", "streams", "buffer", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/ByteBufferOutputStream.java#L281-L284
jglobus/JGlobus
ssl-proxies/src/main/java/org/globus/common/CoGProperties.java
CoGProperties.getHostName
public String getHostName() { String value = System.getProperty("GLOBUS_HOSTNAME"); if (value != null) { return value; } return getProperty("hostname", null); }
java
public String getHostName() { String value = System.getProperty("GLOBUS_HOSTNAME"); if (value != null) { return value; } return getProperty("hostname", null); }
[ "public", "String", "getHostName", "(", ")", "{", "String", "value", "=", "System", ".", "getProperty", "(", "\"GLOBUS_HOSTNAME\"", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "return", "value", ";", "}", "return", "getProperty", "(", "\"hostname...
Returns the user specified hostname. This is used for DHCP machines where java is unable to determine the right hostname/IP address. It first checks the 'GLOBUS_HOSTNAME' system property. If the property is not set, it checks the 'host' system property next. If the 'host' property is not set in the current configuration, null is returned (and default 'localhost' hostname will be used) @return <code>String</code> the hostname of the machine.
[ "Returns", "the", "user", "specified", "hostname", ".", "This", "is", "used", "for", "DHCP", "machines", "where", "java", "is", "unable", "to", "determine", "the", "right", "hostname", "/", "IP", "address", ".", "It", "first", "checks", "the", "GLOBUS_HOSTNA...
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/ssl-proxies/src/main/java/org/globus/common/CoGProperties.java#L266-L272
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/utils/FileUtils.java
FileUtils.relativePath
public static String relativePath(File parent, File child) { Path superPath = parent.toPath(); Path subPath = child.toPath(); if (!subPath.startsWith(superPath)) { throw new IllegalArgumentException("Not a subpath: " + child); } return superPath.relativize(subPath).toString(); }
java
public static String relativePath(File parent, File child) { Path superPath = parent.toPath(); Path subPath = child.toPath(); if (!subPath.startsWith(superPath)) { throw new IllegalArgumentException("Not a subpath: " + child); } return superPath.relativize(subPath).toString(); }
[ "public", "static", "String", "relativePath", "(", "File", "parent", ",", "File", "child", ")", "{", "Path", "superPath", "=", "parent", ".", "toPath", "(", ")", ";", "Path", "subPath", "=", "child", ".", "toPath", "(", ")", ";", "if", "(", "!", "sub...
Return the relative path between a parent directory and some child path @param parent @param child @return the relative path for the child @throws IllegalArgumentException if child is not a subpath
[ "Return", "the", "relative", "path", "between", "a", "parent", "directory", "and", "some", "child", "path" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/utils/FileUtils.java#L212-L219
google/error-prone
check_api/src/main/java/com/google/errorprone/matchers/Matchers.java
Matchers.isVariable
public static Matcher<ExpressionTree> isVariable() { return new Matcher<ExpressionTree>() { @Override public boolean matches(ExpressionTree expressionTree, VisitorState state) { Symbol symbol = ASTHelpers.getSymbol(expressionTree); if (symbol == null) { return false; } return symbol.getKind() == ElementKind.LOCAL_VARIABLE || symbol.getKind() == ElementKind.PARAMETER; } }; }
java
public static Matcher<ExpressionTree> isVariable() { return new Matcher<ExpressionTree>() { @Override public boolean matches(ExpressionTree expressionTree, VisitorState state) { Symbol symbol = ASTHelpers.getSymbol(expressionTree); if (symbol == null) { return false; } return symbol.getKind() == ElementKind.LOCAL_VARIABLE || symbol.getKind() == ElementKind.PARAMETER; } }; }
[ "public", "static", "Matcher", "<", "ExpressionTree", ">", "isVariable", "(", ")", "{", "return", "new", "Matcher", "<", "ExpressionTree", ">", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(", "ExpressionTree", "expressionTree", ",", "Visit...
Matches an AST node that represents a local variable or parameter.
[ "Matches", "an", "AST", "node", "that", "represents", "a", "local", "variable", "or", "parameter", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L232-L244
d-michail/jheaps
src/main/java/org/jheaps/array/MinMaxBinaryArrayDoubleEndedHeap.java
MinMaxBinaryArrayDoubleEndedHeap.fixdownMaxWithComparator
private void fixdownMaxWithComparator(int k) { int c = 2 * k; while (c <= size) { int m = maxChildOrGrandchildWithComparator(k); if (m > c + 1) { // grandchild if (comparator.compare(array[m], array[k]) <= 0) { break; } K tmp = array[k]; array[k] = array[m]; array[m] = tmp; if (comparator.compare(array[m], array[m / 2]) < 0) { tmp = array[m]; array[m] = array[m / 2]; array[m / 2] = tmp; } // go down k = m; c = 2 * k; } else { // child if (comparator.compare(array[m], array[k]) > 0) { K tmp = array[k]; array[k] = array[m]; array[m] = tmp; } break; } } }
java
private void fixdownMaxWithComparator(int k) { int c = 2 * k; while (c <= size) { int m = maxChildOrGrandchildWithComparator(k); if (m > c + 1) { // grandchild if (comparator.compare(array[m], array[k]) <= 0) { break; } K tmp = array[k]; array[k] = array[m]; array[m] = tmp; if (comparator.compare(array[m], array[m / 2]) < 0) { tmp = array[m]; array[m] = array[m / 2]; array[m / 2] = tmp; } // go down k = m; c = 2 * k; } else { // child if (comparator.compare(array[m], array[k]) > 0) { K tmp = array[k]; array[k] = array[m]; array[m] = tmp; } break; } } }
[ "private", "void", "fixdownMaxWithComparator", "(", "int", "k", ")", "{", "int", "c", "=", "2", "*", "k", ";", "while", "(", "c", "<=", "size", ")", "{", "int", "m", "=", "maxChildOrGrandchildWithComparator", "(", "k", ")", ";", "if", "(", "m", ">", ...
Downwards fix starting from a particular element at a maximum level. Performs comparisons using the comparator. @param k the index of the starting element
[ "Downwards", "fix", "starting", "from", "a", "particular", "element", "at", "a", "maximum", "level", ".", "Performs", "comparisons", "using", "the", "comparator", "." ]
train
https://github.com/d-michail/jheaps/blob/7146451dd6591c2a8559dc564c9c40428c4a2c10/src/main/java/org/jheaps/array/MinMaxBinaryArrayDoubleEndedHeap.java#L639-L667
cdapio/tigon
tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java
Bytes.iterateOnSplits
public static Iterable<byte[]> iterateOnSplits(final byte[] a, final byte[] b, final int num) { return iterateOnSplits(a, b, false, num); }
java
public static Iterable<byte[]> iterateOnSplits(final byte[] a, final byte[] b, final int num) { return iterateOnSplits(a, b, false, num); }
[ "public", "static", "Iterable", "<", "byte", "[", "]", ">", "iterateOnSplits", "(", "final", "byte", "[", "]", "a", ",", "final", "byte", "[", "]", "b", ",", "final", "int", "num", ")", "{", "return", "iterateOnSplits", "(", "a", ",", "b", ",", "fa...
Iterate over keys within the passed range, splitting at an [a,b) boundary.
[ "Iterate", "over", "keys", "within", "the", "passed", "range", "splitting", "at", "an", "[", "a", "b", ")", "boundary", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java#L1128-L1130
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.listStream
public ListStreamResponse listStream(ListStreamRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getPlayDomain(), "playDomain should NOT be empty."); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_DOMAIN, request.getPlayDomain(), LIVE_STREAM); if (request.getStatus() != null) { internalRequest.addParameter("status", request.getStatus()); } if (request.getMarker() != null) { internalRequest.addParameter("marker", request.getMarker()); } if (request.getMaxSize() != null) { internalRequest.addParameter("maxSize", request.getMaxSize().toString()); } return invokeHttpClient(internalRequest, ListStreamResponse.class); }
java
public ListStreamResponse listStream(ListStreamRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getPlayDomain(), "playDomain should NOT be empty."); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_DOMAIN, request.getPlayDomain(), LIVE_STREAM); if (request.getStatus() != null) { internalRequest.addParameter("status", request.getStatus()); } if (request.getMarker() != null) { internalRequest.addParameter("marker", request.getMarker()); } if (request.getMaxSize() != null) { internalRequest.addParameter("maxSize", request.getMaxSize().toString()); } return invokeHttpClient(internalRequest, ListStreamResponse.class); }
[ "public", "ListStreamResponse", "listStream", "(", "ListStreamRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getPlayDomain", "(", ")", ",", "\"pl...
List a domain's streams in the live stream service. @param request The request object containing all options for listing domain's streams @return the response
[ "List", "a", "domain", "s", "streams", "in", "the", "live", "stream", "service", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1393-L1414
johnlcox/motif
generator/src/main/java/com/leacox/motif/generate/BaseMatchMethodPermutationBuilder.java
BaseMatchMethodPermutationBuilder.getMatcherString
protected String getMatcherString(MatchType matchType, String paramName) { String matchB; if (matchType == MatchType.DECOMPOSE || matchType == MatchType.ANY) { matchB = "any()"; } else { matchB = "eq(" + paramName + ".t)"; } return matchB; }
java
protected String getMatcherString(MatchType matchType, String paramName) { String matchB; if (matchType == MatchType.DECOMPOSE || matchType == MatchType.ANY) { matchB = "any()"; } else { matchB = "eq(" + paramName + ".t)"; } return matchB; }
[ "protected", "String", "getMatcherString", "(", "MatchType", "matchType", ",", "String", "paramName", ")", "{", "String", "matchB", ";", "if", "(", "matchType", "==", "MatchType", ".", "DECOMPOSE", "||", "matchType", "==", "MatchType", ".", "ANY", ")", "{", ...
Returns the matcher string {@code any() or eq(x)} for a given type.
[ "Returns", "the", "matcher", "string", "{" ]
train
https://github.com/johnlcox/motif/blob/33a72d79fcbac16c89f8c4b0567856f2442f59be/generator/src/main/java/com/leacox/motif/generate/BaseMatchMethodPermutationBuilder.java#L203-L211
box/box-java-sdk
src/main/java/com/box/sdk/BoxFolder.java
BoxFolder.uploadFile
public BoxFile.Info uploadFile(InputStream fileContent, String name) { FileUploadParams uploadInfo = new FileUploadParams() .setContent(fileContent) .setName(name); return this.uploadFile(uploadInfo); }
java
public BoxFile.Info uploadFile(InputStream fileContent, String name) { FileUploadParams uploadInfo = new FileUploadParams() .setContent(fileContent) .setName(name); return this.uploadFile(uploadInfo); }
[ "public", "BoxFile", ".", "Info", "uploadFile", "(", "InputStream", "fileContent", ",", "String", "name", ")", "{", "FileUploadParams", "uploadInfo", "=", "new", "FileUploadParams", "(", ")", ".", "setContent", "(", "fileContent", ")", ".", "setName", "(", "na...
Uploads a new file to this folder. @param fileContent a stream containing the contents of the file to upload. @param name the name to give the uploaded file. @return the uploaded file's info.
[ "Uploads", "a", "new", "file", "to", "this", "folder", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFolder.java#L452-L457
graphhopper/graphhopper
core/src/main/java/com/graphhopper/util/GHUtility.java
GHUtility.createEdgeKey
public static int createEdgeKey(int nodeA, int nodeB, int edgeId, boolean reverse) { edgeId = edgeId << 1; if (reverse) return (nodeA > nodeB) ? edgeId : edgeId + 1; return (nodeA > nodeB) ? edgeId + 1 : edgeId; }
java
public static int createEdgeKey(int nodeA, int nodeB, int edgeId, boolean reverse) { edgeId = edgeId << 1; if (reverse) return (nodeA > nodeB) ? edgeId : edgeId + 1; return (nodeA > nodeB) ? edgeId + 1 : edgeId; }
[ "public", "static", "int", "createEdgeKey", "(", "int", "nodeA", ",", "int", "nodeB", ",", "int", "edgeId", ",", "boolean", "reverse", ")", "{", "edgeId", "=", "edgeId", "<<", "1", ";", "if", "(", "reverse", ")", "return", "(", "nodeA", ">", "nodeB", ...
Creates unique positive number for specified edgeId taking into account the direction defined by nodeA, nodeB and reverse.
[ "Creates", "unique", "positive", "number", "for", "specified", "edgeId", "taking", "into", "account", "the", "direction", "defined", "by", "nodeA", "nodeB", "and", "reverse", "." ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/util/GHUtility.java#L465-L470
jfinal/jfinal
src/main/java/com/jfinal/plugin/redis/Cache.java
Cache.hincrByFloat
public Double hincrByFloat(Object key, Object field, double value) { Jedis jedis = getJedis(); try { return jedis.hincrByFloat(keyToBytes(key), fieldToBytes(field), value); } finally {close(jedis);} }
java
public Double hincrByFloat(Object key, Object field, double value) { Jedis jedis = getJedis(); try { return jedis.hincrByFloat(keyToBytes(key), fieldToBytes(field), value); } finally {close(jedis);} }
[ "public", "Double", "hincrByFloat", "(", "Object", "key", ",", "Object", "field", ",", "double", "value", ")", "{", "Jedis", "jedis", "=", "getJedis", "(", ")", ";", "try", "{", "return", "jedis", ".", "hincrByFloat", "(", "keyToBytes", "(", "key", ")", ...
为哈希表 key 中的域 field 加上浮点数增量 increment 。 如果哈希表中没有域 field ,那么 HINCRBYFLOAT 会先将域 field 的值设为 0 ,然后再执行加法操作。 如果键 key 不存在,那么 HINCRBYFLOAT 会先创建一个哈希表,再创建域 field ,最后再执行加法操作。 当以下任意一个条件发生时,返回一个错误: 1:域 field 的值不是字符串类型(因为 redis 中的数字和浮点数都以字符串的形式保存,所以它们都属于字符串类型) 2:域 field 当前的值或给定的增量 increment 不能解释(parse)为双精度浮点数(double precision floating point number) HINCRBYFLOAT 命令的详细功能和 INCRBYFLOAT 命令类似,请查看 INCRBYFLOAT 命令获取更多相关信息。
[ "为哈希表", "key", "中的域", "field", "加上浮点数增量", "increment", "。", "如果哈希表中没有域", "field", ",那么", "HINCRBYFLOAT", "会先将域", "field", "的值设为", "0", ",然后再执行加法操作。", "如果键", "key", "不存在,那么", "HINCRBYFLOAT", "会先创建一个哈希表,再创建域", "field", ",最后再执行加法操作。", "当以下任意一个条件发生时,返回一个错误:", "1", ":", ...
train
https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/redis/Cache.java#L597-L603
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java
AlignerHelper.setScoreVector
public static Last[][] setScoreVector(int x, Subproblem subproblem, int gop, int gep, int[] subs, boolean storing, int[][][] scores) { return setScoreVector(x, subproblem.getQueryStartIndex(), subproblem.getTargetStartIndex(), subproblem.getTargetEndIndex(), gop, gep, subs, storing, scores, subproblem.isStartAnchored()); }
java
public static Last[][] setScoreVector(int x, Subproblem subproblem, int gop, int gep, int[] subs, boolean storing, int[][][] scores) { return setScoreVector(x, subproblem.getQueryStartIndex(), subproblem.getTargetStartIndex(), subproblem.getTargetEndIndex(), gop, gep, subs, storing, scores, subproblem.isStartAnchored()); }
[ "public", "static", "Last", "[", "]", "[", "]", "setScoreVector", "(", "int", "x", ",", "Subproblem", "subproblem", ",", "int", "gop", ",", "int", "gep", ",", "int", "[", "]", "subs", ",", "boolean", "storing", ",", "int", "[", "]", "[", "]", "[", ...
Score global alignment for a given position in the query sequence @param x @param subproblem @param gop @param gep @param subs @param storing @param scores @return
[ "Score", "global", "alignment", "for", "a", "given", "position", "in", "the", "query", "sequence" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java#L384-L387
elastic/elasticsearch-hadoop
mr/src/main/java/org/elasticsearch/hadoop/mr/security/TokenUtil.java
TokenUtil.obtainTokenForJob
public static void obtainTokenForJob(final RestClient client, User user, Job job) { Token<EsTokenIdentifier> token = obtainToken(client, user); if (token == null) { throw new EsHadoopException("No token returned for user " + user.getKerberosPrincipal().getName()); } Text clusterName = token.getService(); if (LOG.isDebugEnabled()) { LOG.debug("Obtained token " + EsTokenIdentifier.KIND_NAME.toString() + " for user " + user.getKerberosPrincipal().getName() + " on cluster " + clusterName.toString()); } job.getCredentials().addToken(clusterName, token); }
java
public static void obtainTokenForJob(final RestClient client, User user, Job job) { Token<EsTokenIdentifier> token = obtainToken(client, user); if (token == null) { throw new EsHadoopException("No token returned for user " + user.getKerberosPrincipal().getName()); } Text clusterName = token.getService(); if (LOG.isDebugEnabled()) { LOG.debug("Obtained token " + EsTokenIdentifier.KIND_NAME.toString() + " for user " + user.getKerberosPrincipal().getName() + " on cluster " + clusterName.toString()); } job.getCredentials().addToken(clusterName, token); }
[ "public", "static", "void", "obtainTokenForJob", "(", "final", "RestClient", "client", ",", "User", "user", ",", "Job", "job", ")", "{", "Token", "<", "EsTokenIdentifier", ">", "token", "=", "obtainToken", "(", "client", ",", "user", ")", ";", "if", "(", ...
Obtain an authentication token on behalf of the given user and add it to the credentials for the given map reduce job. This version always obtains a fresh authentication token instead of checking for existing ones on the current user. @param client The Elasticsearch client @param user The user for whom to obtain the token @param job The job instance in which the token should be stored
[ "Obtain", "an", "authentication", "token", "on", "behalf", "of", "the", "given", "user", "and", "add", "it", "to", "the", "credentials", "for", "the", "given", "map", "reduce", "job", ".", "This", "version", "always", "obtains", "a", "fresh", "authentication...
train
https://github.com/elastic/elasticsearch-hadoop/blob/f3acaba268ff96efae8eb946088c748c777c22cc/mr/src/main/java/org/elasticsearch/hadoop/mr/security/TokenUtil.java#L122-L133
likethecolor/Alchemy-API
src/main/java/com/likethecolor/alchemy/api/util/NumberUtil.java
NumberUtil.getValue
private static int getValue(String str, boolean getMaximumValue) { int multiplier = 1; String upperOrLowerValue = null; final String[] rangeUnit = splitRangeUnit(str); if(rangeUnit.length == 2) { multiplier = getMultiplier(rangeUnit[1]); } String[] range = splitRange(rangeUnit[0]); upperOrLowerValue = range[0]; if(range.length == 2) { if(getMaximumValue) { upperOrLowerValue = range[1]; } } return (int) (convertStringToDouble(upperOrLowerValue) * multiplier); }
java
private static int getValue(String str, boolean getMaximumValue) { int multiplier = 1; String upperOrLowerValue = null; final String[] rangeUnit = splitRangeUnit(str); if(rangeUnit.length == 2) { multiplier = getMultiplier(rangeUnit[1]); } String[] range = splitRange(rangeUnit[0]); upperOrLowerValue = range[0]; if(range.length == 2) { if(getMaximumValue) { upperOrLowerValue = range[1]; } } return (int) (convertStringToDouble(upperOrLowerValue) * multiplier); }
[ "private", "static", "int", "getValue", "(", "String", "str", ",", "boolean", "getMaximumValue", ")", "{", "int", "multiplier", "=", "1", ";", "String", "upperOrLowerValue", "=", "null", ";", "final", "String", "[", "]", "rangeUnit", "=", "splitRangeUnit", "...
Return the specified value from the string. @param str string to parse; assume it is either a single value or a range (delimited by "-") @param getMaximumValue if true return the maximum value @return specified value from the string
[ "Return", "the", "specified", "value", "from", "the", "string", "." ]
train
https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/util/NumberUtil.java#L95-L114
amzn/ion-java
src/com/amazon/ion/util/IonTextUtils.java
IonTextUtils.printStringCodePoint
public static void printStringCodePoint(Appendable out, int codePoint) throws IOException { printCodePoint(out, codePoint, EscapeMode.ION_STRING); }
java
public static void printStringCodePoint(Appendable out, int codePoint) throws IOException { printCodePoint(out, codePoint, EscapeMode.ION_STRING); }
[ "public", "static", "void", "printStringCodePoint", "(", "Appendable", "out", ",", "int", "codePoint", ")", "throws", "IOException", "{", "printCodePoint", "(", "out", ",", "codePoint", ",", "EscapeMode", ".", "ION_STRING", ")", ";", "}" ]
Prints a single Unicode code point for use in an ASCII-safe Ion string. @param out the stream to receive the data. @param codePoint a Unicode code point.
[ "Prints", "a", "single", "Unicode", "code", "point", "for", "use", "in", "an", "ASCII", "-", "safe", "Ion", "string", "." ]
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/util/IonTextUtils.java#L200-L204
OpenLiberty/open-liberty
dev/com.ibm.ws.session/src/com/ibm/ws/session/StoreCallback.java
StoreCallback.sessionUserNameSet
public void sessionUserNameSet(ISession session, String oldUserName, String newUserName) { _sessionStateEventDispatcher.sessionUserNameSet(session, oldUserName, newUserName); }
java
public void sessionUserNameSet(ISession session, String oldUserName, String newUserName) { _sessionStateEventDispatcher.sessionUserNameSet(session, oldUserName, newUserName); }
[ "public", "void", "sessionUserNameSet", "(", "ISession", "session", ",", "String", "oldUserName", ",", "String", "newUserName", ")", "{", "_sessionStateEventDispatcher", ".", "sessionUserNameSet", "(", "session", ",", "oldUserName", ",", "newUserName", ")", ";", "}"...
Method sessionUserNameSet <p> @param session @param oldUserName @param newUserName @see com.ibm.wsspi.session.IStoreCallback#sessionUserNameSet(com.ibm.wsspi.session.ISession, java.lang.String, java.lang.String)
[ "Method", "sessionUserNameSet", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session/src/com/ibm/ws/session/StoreCallback.java#L210-L213
Ordinastie/MalisisCore
src/main/java/net/malisis/core/client/gui/element/position/Positions.java
Positions.topAlignedTo
public static IntSupplier topAlignedTo(IPositioned other, int offset) { checkNotNull(other); return () -> { return other.position().y() + offset; }; }
java
public static IntSupplier topAlignedTo(IPositioned other, int offset) { checkNotNull(other); return () -> { return other.position().y() + offset; }; }
[ "public", "static", "IntSupplier", "topAlignedTo", "(", "IPositioned", "other", ",", "int", "offset", ")", "{", "checkNotNull", "(", "other", ")", ";", "return", "(", ")", "->", "{", "return", "other", ".", "position", "(", ")", ".", "y", "(", ")", "+"...
Top aligns the owner to the other. @param other the other @param offset the offset @return the int supplier
[ "Top", "aligns", "the", "owner", "to", "the", "other", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/client/gui/element/position/Positions.java#L272-L279
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java
SameDiff.putSubFunction
public void putSubFunction(String name, SameDiff nameSpace) { if (sameDiffFunctionInstances.containsKey(name) && sameDiffFunctionInstances.get(name) != nameSpace) { throw new ND4JIllegalStateException("Unable to replace samediff namespace. Please choose another opName"); } sameDiffFunctionInstances.put(name, nameSpace); }
java
public void putSubFunction(String name, SameDiff nameSpace) { if (sameDiffFunctionInstances.containsKey(name) && sameDiffFunctionInstances.get(name) != nameSpace) { throw new ND4JIllegalStateException("Unable to replace samediff namespace. Please choose another opName"); } sameDiffFunctionInstances.put(name, nameSpace); }
[ "public", "void", "putSubFunction", "(", "String", "name", ",", "SameDiff", "nameSpace", ")", "{", "if", "(", "sameDiffFunctionInstances", ".", "containsKey", "(", "name", ")", "&&", "sameDiffFunctionInstances", ".", "get", "(", "name", ")", "!=", "nameSpace", ...
Associate a {@link SameDiff} namespace as a sub function. @param name the opName of the function @param nameSpace the namespace
[ "Associate", "a", "{", "@link", "SameDiff", "}", "namespace", "as", "a", "sub", "function", "." ]
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#L874-L880
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/CallStack.java
CallStack.setJsonToken
@SuppressWarnings("unchecked") public void setJsonToken(HashMap<String, Object> jRTObject, Story storyContext) throws Exception { threads.clear(); List<Object> jThreads = (List<Object>) jRTObject.get("threads"); for (Object jThreadTok : jThreads) { HashMap<String, Object> jThreadObj = (HashMap<String, Object>) jThreadTok; Thread thread = new Thread(jThreadObj, storyContext); threads.add(thread); } threadCounter = (int) jRTObject.get("threadCounter"); }
java
@SuppressWarnings("unchecked") public void setJsonToken(HashMap<String, Object> jRTObject, Story storyContext) throws Exception { threads.clear(); List<Object> jThreads = (List<Object>) jRTObject.get("threads"); for (Object jThreadTok : jThreads) { HashMap<String, Object> jThreadObj = (HashMap<String, Object>) jThreadTok; Thread thread = new Thread(jThreadObj, storyContext); threads.add(thread); } threadCounter = (int) jRTObject.get("threadCounter"); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "setJsonToken", "(", "HashMap", "<", "String", ",", "Object", ">", "jRTObject", ",", "Story", "storyContext", ")", "throws", "Exception", "{", "threads", ".", "clear", "(", ")", ";", "List...
look up RTObjects from paths for currentContainer within elements.
[ "look", "up", "RTObjects", "from", "paths", "for", "currentContainer", "within", "elements", "." ]
train
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/CallStack.java#L317-L330
TheHolyWaffle/League-of-Legends-XMPP-Chat-Library
src/main/java/com/github/theholywaffle/lolchatapi/wrapper/Friend.java
Friend.getGroup
public FriendGroup getGroup() { final Collection<RosterGroup> groups = get().getGroups(); if (groups.size() > 0) { return new FriendGroup(api, con, get().getGroups().iterator() .next()); } return null; }
java
public FriendGroup getGroup() { final Collection<RosterGroup> groups = get().getGroups(); if (groups.size() > 0) { return new FriendGroup(api, con, get().getGroups().iterator() .next()); } return null; }
[ "public", "FriendGroup", "getGroup", "(", ")", "{", "final", "Collection", "<", "RosterGroup", ">", "groups", "=", "get", "(", ")", ".", "getGroups", "(", ")", ";", "if", "(", "groups", ".", "size", "(", ")", ">", "0", ")", "{", "return", "new", "F...
Gets the FriendGroup that contains this friend. @return the FriendGroup that currently contains this Friend or null if this Friend is not in a FriendGroup.
[ "Gets", "the", "FriendGroup", "that", "contains", "this", "friend", "." ]
train
https://github.com/TheHolyWaffle/League-of-Legends-XMPP-Chat-Library/blob/5e4d87d0c054ff2f6510545b0e9f838338695c70/src/main/java/com/github/theholywaffle/lolchatapi/wrapper/Friend.java#L164-L171
liferay/com-liferay-commerce
commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CPSpecificationOptionUtil.java
CPSpecificationOptionUtil.removeByG_K
public static CPSpecificationOption removeByG_K(long groupId, String key) throws com.liferay.commerce.product.exception.NoSuchCPSpecificationOptionException { return getPersistence().removeByG_K(groupId, key); }
java
public static CPSpecificationOption removeByG_K(long groupId, String key) throws com.liferay.commerce.product.exception.NoSuchCPSpecificationOptionException { return getPersistence().removeByG_K(groupId, key); }
[ "public", "static", "CPSpecificationOption", "removeByG_K", "(", "long", "groupId", ",", "String", "key", ")", "throws", "com", ".", "liferay", ".", "commerce", ".", "product", ".", "exception", ".", "NoSuchCPSpecificationOptionException", "{", "return", "getPersist...
Removes the cp specification option where groupId = &#63; and key = &#63; from the database. @param groupId the group ID @param key the key @return the cp specification option that was removed
[ "Removes", "the", "cp", "specification", "option", "where", "groupId", "=", "&#63", ";", "and", "key", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CPSpecificationOptionUtil.java#L891-L894
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.deleteRegexEntityRole
public OperationStatus deleteRegexEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId) { return deleteRegexEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).toBlocking().single().body(); }
java
public OperationStatus deleteRegexEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId) { return deleteRegexEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).toBlocking().single().body(); }
[ "public", "OperationStatus", "deleteRegexEntityRole", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ",", "UUID", "roleId", ")", "{", "return", "deleteRegexEntityRoleWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "entityId"...
Delete an entity role. @param appId The application ID. @param versionId The version ID. @param entityId The entity ID. @param roleId The entity role Id. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful.
[ "Delete", "an", "entity", "role", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L12256-L12258
rometools/rome
rome-modules/src/main/java/com/rometools/modules/mediarss/io/MediaModuleGenerator.java
MediaModuleGenerator.generateComments
private void generateComments(final Metadata m, final Element e) { final Element commentsElements = new Element("comments", NS); for (final String comment : m.getComments()) { addNotNullElement(commentsElements, "comment", comment); } if (!commentsElements.getChildren().isEmpty()) { e.addContent(commentsElements); } }
java
private void generateComments(final Metadata m, final Element e) { final Element commentsElements = new Element("comments", NS); for (final String comment : m.getComments()) { addNotNullElement(commentsElements, "comment", comment); } if (!commentsElements.getChildren().isEmpty()) { e.addContent(commentsElements); } }
[ "private", "void", "generateComments", "(", "final", "Metadata", "m", ",", "final", "Element", "e", ")", "{", "final", "Element", "commentsElements", "=", "new", "Element", "(", "\"comments\"", ",", "NS", ")", ";", "for", "(", "final", "String", "comment", ...
Generation of comments tag. @param m source @param e element to attach new element to
[ "Generation", "of", "comments", "tag", "." ]
train
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-modules/src/main/java/com/rometools/modules/mediarss/io/MediaModuleGenerator.java#L276-L284
landawn/AbacusUtil
src/com/landawn/abacus/util/BooleanList.java
BooleanList.allMatch
public <E extends Exception> boolean allMatch(Try.BooleanPredicate<E> filter) throws E { return allMatch(0, size(), filter); }
java
public <E extends Exception> boolean allMatch(Try.BooleanPredicate<E> filter) throws E { return allMatch(0, size(), filter); }
[ "public", "<", "E", "extends", "Exception", ">", "boolean", "allMatch", "(", "Try", ".", "BooleanPredicate", "<", "E", ">", "filter", ")", "throws", "E", "{", "return", "allMatch", "(", "0", ",", "size", "(", ")", ",", "filter", ")", ";", "}" ]
Returns whether all elements of this List match the provided predicate. @param filter @return
[ "Returns", "whether", "all", "elements", "of", "this", "List", "match", "the", "provided", "predicate", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/BooleanList.java#L841-L843
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/InitOnChangeHandler.java
InitOnChangeHandler.syncClonedListener
public boolean syncClonedListener(BaseField field, FieldListener listener, boolean bInitCalled) { if (!bInitCalled) { BaseField fldTarget = this.getSyncedListenersField(m_fldTarget, listener); ((InitOnChangeHandler)listener).init(null, fldTarget); } return super.syncClonedListener(field, listener, true); }
java
public boolean syncClonedListener(BaseField field, FieldListener listener, boolean bInitCalled) { if (!bInitCalled) { BaseField fldTarget = this.getSyncedListenersField(m_fldTarget, listener); ((InitOnChangeHandler)listener).init(null, fldTarget); } return super.syncClonedListener(field, listener, true); }
[ "public", "boolean", "syncClonedListener", "(", "BaseField", "field", ",", "FieldListener", "listener", ",", "boolean", "bInitCalled", ")", "{", "if", "(", "!", "bInitCalled", ")", "{", "BaseField", "fldTarget", "=", "this", ".", "getSyncedListenersField", "(", ...
Set this cloned listener to the same state at this listener. @param field The field this new listener will be added to. @param The new listener to sync to this. @param Has the init method been called? @return True if I called init.
[ "Set", "this", "cloned", "listener", "to", "the", "same", "state", "at", "this", "listener", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/InitOnChangeHandler.java#L62-L70
Stratio/bdt
src/main/java/com/stratio/qa/utils/CassandraUtils.java
CassandraUtils.existsTable
public boolean existsTable(String keyspace, String table, boolean showLog) { this.metadata = this.cluster.getMetadata(); if (!(this.metadata.getKeyspace(keyspace).getTables().isEmpty())) { for (TableMetadata t : this.metadata.getKeyspace(keyspace).getTables()) { if (t.getName().equals(table)) { return true; } } } return false; }
java
public boolean existsTable(String keyspace, String table, boolean showLog) { this.metadata = this.cluster.getMetadata(); if (!(this.metadata.getKeyspace(keyspace).getTables().isEmpty())) { for (TableMetadata t : this.metadata.getKeyspace(keyspace).getTables()) { if (t.getName().equals(table)) { return true; } } } return false; }
[ "public", "boolean", "existsTable", "(", "String", "keyspace", ",", "String", "table", ",", "boolean", "showLog", ")", "{", "this", ".", "metadata", "=", "this", ".", "cluster", ".", "getMetadata", "(", ")", ";", "if", "(", "!", "(", "this", ".", "meta...
Checks if a keyspace contains an especific table. @param keyspace @param table @param showLog @return boolean
[ "Checks", "if", "a", "keyspace", "contains", "an", "especific", "table", "." ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/utils/CassandraUtils.java#L281-L292
op4j/op4j
src/main/java/org/op4j/functions/FnString.java
FnString.toFloat
public static final Function<String,Float> toFloat(final int scale, final RoundingMode roundingMode) { return new ToFloat(scale, roundingMode); }
java
public static final Function<String,Float> toFloat(final int scale, final RoundingMode roundingMode) { return new ToFloat(scale, roundingMode); }
[ "public", "static", "final", "Function", "<", "String", ",", "Float", ">", "toFloat", "(", "final", "int", "scale", ",", "final", "RoundingMode", "roundingMode", ")", "{", "return", "new", "ToFloat", "(", "scale", ",", "roundingMode", ")", ";", "}" ]
<p> Converts a String into a Float, using the default configuration for for decimal point and thousands separator and establishing the specified scale. Rounding mode is used for setting the scale to the specified value. The input string must be between {@link Float#MIN_VALUE} and {@link Float#MAX_VALUE} </p> @param scale the desired scale for the resulting Float object @param roundingMode the rounding mode to be used when setting the scale @return the resulting Float object
[ "<p", ">", "Converts", "a", "String", "into", "a", "Float", "using", "the", "default", "configuration", "for", "for", "decimal", "point", "and", "thousands", "separator", "and", "establishing", "the", "specified", "scale", ".", "Rounding", "mode", "is", "used"...
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnString.java#L619-L621
before/quality-check
modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java
Check.notPositive
@Throws(IllegalPositiveArgumentException.class) public static double notPositive(final double value, @Nullable final String name) { if (value > 0.0) { throw new IllegalPositiveArgumentException(name, value); } return value; }
java
@Throws(IllegalPositiveArgumentException.class) public static double notPositive(final double value, @Nullable final String name) { if (value > 0.0) { throw new IllegalPositiveArgumentException(name, value); } return value; }
[ "@", "Throws", "(", "IllegalPositiveArgumentException", ".", "class", ")", "public", "static", "double", "notPositive", "(", "final", "double", "value", ",", "@", "Nullable", "final", "String", "name", ")", "{", "if", "(", "value", ">", "0.0", ")", "{", "t...
Ensures that an double reference passed as a parameter to the calling method is not greater than {@code 0}. @param value a number @param name name of the number reference (in source code) @return the non-null reference that was validated @throws IllegalNullArgumentException if the given argument {@code reference} is smaller than {@code 0}
[ "Ensures", "that", "an", "double", "reference", "passed", "as", "a", "parameter", "to", "the", "calling", "method", "is", "not", "greater", "than", "{", "@code", "0", "}", "." ]
train
https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L3019-L3025
resilience4j/resilience4j
resilience4j-prometheus/src/main/java/io/github/resilience4j/prometheus/BulkheadExports.java
BulkheadExports.ofIterable
public static BulkheadExports ofIterable(String prefix, Iterable<Bulkhead> bulkheads) { return new BulkheadExports(prefix, bulkheads); }
java
public static BulkheadExports ofIterable(String prefix, Iterable<Bulkhead> bulkheads) { return new BulkheadExports(prefix, bulkheads); }
[ "public", "static", "BulkheadExports", "ofIterable", "(", "String", "prefix", ",", "Iterable", "<", "Bulkhead", ">", "bulkheads", ")", "{", "return", "new", "BulkheadExports", "(", "prefix", ",", "bulkheads", ")", ";", "}" ]
Creates a new instance of {@link BulkheadExports} with specified metrics names prefix and {@link Iterable} of bulkheads. @param prefix the prefix of metrics names @param bulkheads the bulkheads
[ "Creates", "a", "new", "instance", "of", "{", "@link", "BulkheadExports", "}", "with", "specified", "metrics", "names", "prefix", "and", "{", "@link", "Iterable", "}", "of", "bulkheads", "." ]
train
https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-prometheus/src/main/java/io/github/resilience4j/prometheus/BulkheadExports.java#L117-L119
abel533/EasyXls
src/main/java/com/github/abel533/easyxls/common/FieldUtil.java
FieldUtil.getField
public static Field getField(Class clazz, String fieldName) { if (Map.class.isAssignableFrom(clazz)) { return new Field(new MapField(fieldName)); } java.lang.reflect.Field field = null; while (field == null && clazz != null) { try { field = clazz.getDeclaredField(fieldName); field.setAccessible(true); } catch (Exception e) { clazz = clazz.getSuperclass(); } } return new Field(field); }
java
public static Field getField(Class clazz, String fieldName) { if (Map.class.isAssignableFrom(clazz)) { return new Field(new MapField(fieldName)); } java.lang.reflect.Field field = null; while (field == null && clazz != null) { try { field = clazz.getDeclaredField(fieldName); field.setAccessible(true); } catch (Exception e) { clazz = clazz.getSuperclass(); } } return new Field(field); }
[ "public", "static", "Field", "getField", "(", "Class", "clazz", ",", "String", "fieldName", ")", "{", "if", "(", "Map", ".", "class", ".", "isAssignableFrom", "(", "clazz", ")", ")", "{", "return", "new", "Field", "(", "new", "MapField", "(", "fieldName"...
获取字段中的Field @param clazz 类 @param fieldName 字段名 @return 返回字段对象
[ "获取字段中的Field" ]
train
https://github.com/abel533/EasyXls/blob/f73be23745c2180d7c0b8f0a510e72e61cc37d5d/src/main/java/com/github/abel533/easyxls/common/FieldUtil.java#L33-L47
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java
PgDatabaseMetaData.getCatalogs
@Override public ResultSet getCatalogs() throws SQLException { Field[] f = new Field[1]; List<byte[][]> v = new ArrayList<byte[][]>(); f[0] = new Field("TABLE_CAT", Oid.VARCHAR); byte[][] tuple = new byte[1][]; tuple[0] = connection.encodeString(connection.getCatalog()); v.add(tuple); return ((BaseStatement) createMetaDataStatement()).createDriverResultSet(f, v); }
java
@Override public ResultSet getCatalogs() throws SQLException { Field[] f = new Field[1]; List<byte[][]> v = new ArrayList<byte[][]>(); f[0] = new Field("TABLE_CAT", Oid.VARCHAR); byte[][] tuple = new byte[1][]; tuple[0] = connection.encodeString(connection.getCatalog()); v.add(tuple); return ((BaseStatement) createMetaDataStatement()).createDriverResultSet(f, v); }
[ "@", "Override", "public", "ResultSet", "getCatalogs", "(", ")", "throws", "SQLException", "{", "Field", "[", "]", "f", "=", "new", "Field", "[", "1", "]", ";", "List", "<", "byte", "[", "]", "[", "]", ">", "v", "=", "new", "ArrayList", "<", "byte"...
PostgreSQL does not support multiple catalogs from a single connection, so to reduce confusion we only return the current catalog. {@inheritDoc}
[ "PostgreSQL", "does", "not", "support", "multiple", "catalogs", "from", "a", "single", "connection", "so", "to", "reduce", "confusion", "we", "only", "return", "the", "current", "catalog", ".", "{" ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java#L1423-L1433
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java
VirtualNetworkGatewaysInner.createOrUpdateAsync
public Observable<VirtualNetworkGatewayInner> createOrUpdateAsync(String resourceGroupName, String virtualNetworkGatewayName, VirtualNetworkGatewayInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, parameters).map(new Func1<ServiceResponse<VirtualNetworkGatewayInner>, VirtualNetworkGatewayInner>() { @Override public VirtualNetworkGatewayInner call(ServiceResponse<VirtualNetworkGatewayInner> response) { return response.body(); } }); }
java
public Observable<VirtualNetworkGatewayInner> createOrUpdateAsync(String resourceGroupName, String virtualNetworkGatewayName, VirtualNetworkGatewayInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, parameters).map(new Func1<ServiceResponse<VirtualNetworkGatewayInner>, VirtualNetworkGatewayInner>() { @Override public VirtualNetworkGatewayInner call(ServiceResponse<VirtualNetworkGatewayInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualNetworkGatewayInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayName", ",", "VirtualNetworkGatewayInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", ...
Creates or updates a virtual network gateway in the specified resource group. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @param parameters Parameters supplied to create or update virtual network gateway operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "or", "updates", "a", "virtual", "network", "gateway", "in", "the", "specified", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L236-L243
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfCopy.java
PdfCopy.addPage
public void addPage(Rectangle rect, int rotation) { PdfRectangle mediabox = new PdfRectangle(rect, rotation); PageResources resources = new PageResources(); PdfPage page = new PdfPage(mediabox, new HashMap(), resources.getResources(), 0); page.put(PdfName.TABS, getTabs()); root.addPage(page); ++currentPageNumber; }
java
public void addPage(Rectangle rect, int rotation) { PdfRectangle mediabox = new PdfRectangle(rect, rotation); PageResources resources = new PageResources(); PdfPage page = new PdfPage(mediabox, new HashMap(), resources.getResources(), 0); page.put(PdfName.TABS, getTabs()); root.addPage(page); ++currentPageNumber; }
[ "public", "void", "addPage", "(", "Rectangle", "rect", ",", "int", "rotation", ")", "{", "PdfRectangle", "mediabox", "=", "new", "PdfRectangle", "(", "rect", ",", "rotation", ")", ";", "PageResources", "resources", "=", "new", "PageResources", "(", ")", ";",...
Adds a blank page. @param rect The page dimension @param rotation The rotation angle in degrees @since 2.1.5
[ "Adds", "a", "blank", "page", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfCopy.java#L372-L379
deeplearning4j/deeplearning4j
datavec/datavec-arrow/src/main/java/org/datavec/arrow/ArrowConverter.java
ArrowConverter.toArrowColumnsTimeSeries
public static List<FieldVector> toArrowColumnsTimeSeries(final BufferAllocator bufferAllocator, final Schema schema, List<List<List<Writable>>> dataVecRecord) { return toArrowColumnsTimeSeriesHelper(bufferAllocator,schema,dataVecRecord); }
java
public static List<FieldVector> toArrowColumnsTimeSeries(final BufferAllocator bufferAllocator, final Schema schema, List<List<List<Writable>>> dataVecRecord) { return toArrowColumnsTimeSeriesHelper(bufferAllocator,schema,dataVecRecord); }
[ "public", "static", "List", "<", "FieldVector", ">", "toArrowColumnsTimeSeries", "(", "final", "BufferAllocator", "bufferAllocator", ",", "final", "Schema", "schema", ",", "List", "<", "List", "<", "List", "<", "Writable", ">", ">", ">", "dataVecRecord", ")", ...
Convert a set of input strings to arrow columns for a time series. @param bufferAllocator the buffer allocator to use @param schema the schema to use @param dataVecRecord the collection of input strings to process @return the created vectors
[ "Convert", "a", "set", "of", "input", "strings", "to", "arrow", "columns", "for", "a", "time", "series", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-arrow/src/main/java/org/datavec/arrow/ArrowConverter.java#L605-L609
mapsforge/mapsforge
mapsforge-map/src/main/java/org/mapsforge/map/layer/renderer/TileDependencies.java
TileDependencies.addOverlappingElement
void addOverlappingElement(Tile from, Tile to, MapElementContainer element) { if (!overlapData.containsKey(from)) { overlapData.put(from, new HashMap<Tile, Set<MapElementContainer>>()); } if (!overlapData.get(from).containsKey(to)) { overlapData.get(from).put(to, new HashSet<MapElementContainer>()); } overlapData.get(from).get(to).add(element); }
java
void addOverlappingElement(Tile from, Tile to, MapElementContainer element) { if (!overlapData.containsKey(from)) { overlapData.put(from, new HashMap<Tile, Set<MapElementContainer>>()); } if (!overlapData.get(from).containsKey(to)) { overlapData.get(from).put(to, new HashSet<MapElementContainer>()); } overlapData.get(from).get(to).add(element); }
[ "void", "addOverlappingElement", "(", "Tile", "from", ",", "Tile", "to", ",", "MapElementContainer", "element", ")", "{", "if", "(", "!", "overlapData", ".", "containsKey", "(", "from", ")", ")", "{", "overlapData", ".", "put", "(", "from", ",", "new", "...
stores an MapElementContainer that clashesWith from one tile (the one being drawn) to another (which must not have been drawn before). @param from origin tile @param to tile the label clashesWith to @param element the MapElementContainer in question
[ "stores", "an", "MapElementContainer", "that", "clashesWith", "from", "one", "tile", "(", "the", "one", "being", "drawn", ")", "to", "another", "(", "which", "must", "not", "have", "been", "drawn", "before", ")", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map/src/main/java/org/mapsforge/map/layer/renderer/TileDependencies.java#L41-L49
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/crypto/S3ObjectWrapper.java
S3ObjectWrapper.encryptionSchemeOf
ContentCryptoScheme encryptionSchemeOf(Map<String,String> instructionFile) { if (instructionFile != null) { String cekAlgo = instructionFile.get(Headers.CRYPTO_CEK_ALGORITHM); return ContentCryptoScheme.fromCEKAlgo(cekAlgo); } ObjectMetadata meta = s3obj.getObjectMetadata(); Map<String, String> userMeta = meta.getUserMetadata(); String cekAlgo = userMeta.get(Headers.CRYPTO_CEK_ALGORITHM); return ContentCryptoScheme.fromCEKAlgo(cekAlgo); }
java
ContentCryptoScheme encryptionSchemeOf(Map<String,String> instructionFile) { if (instructionFile != null) { String cekAlgo = instructionFile.get(Headers.CRYPTO_CEK_ALGORITHM); return ContentCryptoScheme.fromCEKAlgo(cekAlgo); } ObjectMetadata meta = s3obj.getObjectMetadata(); Map<String, String> userMeta = meta.getUserMetadata(); String cekAlgo = userMeta.get(Headers.CRYPTO_CEK_ALGORITHM); return ContentCryptoScheme.fromCEKAlgo(cekAlgo); }
[ "ContentCryptoScheme", "encryptionSchemeOf", "(", "Map", "<", "String", ",", "String", ">", "instructionFile", ")", "{", "if", "(", "instructionFile", "!=", "null", ")", "{", "String", "cekAlgo", "=", "instructionFile", ".", "get", "(", "Headers", ".", "CRYPTO...
Returns the original crypto scheme used for encryption, which may differ from the crypto scheme used for decryption during, for example, a range-get operation. @param instructionFile the instruction file of the s3 object; or null if there is none.
[ "Returns", "the", "original", "crypto", "scheme", "used", "for", "encryption", "which", "may", "differ", "from", "the", "crypto", "scheme", "used", "for", "decryption", "during", "for", "example", "a", "range", "-", "get", "operation", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/crypto/S3ObjectWrapper.java#L157-L166
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/script/el/tokens/IdentifierToken.java
IdentifierToken.write
public void write(Object object, Object value) { if(object == null) { String msg = "Can not update the identifier \"" + _identifier + "\" on a null value object."; LOGGER.error(msg); throw new RuntimeException(msg); } if(TRACE_ENABLED) LOGGER.trace("Update property named \"" + _identifier + "\" on object of type: \"" + object.getClass().getName() + "\""); if(object instanceof Map) mapUpdate((Map)object, _identifier, value); else if(object instanceof List) { int i = parseIndex(_identifier); listUpdate((List)object, i, value); } else if(object.getClass().isArray()) { int i = parseIndex(_identifier); arrayUpdate(object, i, value); } else beanUpdate(object, _identifier, value); }
java
public void write(Object object, Object value) { if(object == null) { String msg = "Can not update the identifier \"" + _identifier + "\" on a null value object."; LOGGER.error(msg); throw new RuntimeException(msg); } if(TRACE_ENABLED) LOGGER.trace("Update property named \"" + _identifier + "\" on object of type: \"" + object.getClass().getName() + "\""); if(object instanceof Map) mapUpdate((Map)object, _identifier, value); else if(object instanceof List) { int i = parseIndex(_identifier); listUpdate((List)object, i, value); } else if(object.getClass().isArray()) { int i = parseIndex(_identifier); arrayUpdate(object, i, value); } else beanUpdate(object, _identifier, value); }
[ "public", "void", "write", "(", "Object", "object", ",", "Object", "value", ")", "{", "if", "(", "object", "==", "null", ")", "{", "String", "msg", "=", "\"Can not update the identifier \\\"\"", "+", "_identifier", "+", "\"\\\" on a null value object.\"", ";", "...
Update the value represented by this token on the given object <code>object</code> with the value <code>value</code>. @param object the object to update @param value the new value
[ "Update", "the", "value", "represented", "by", "this", "token", "on", "the", "given", "object", "<code", ">", "object<", "/", "code", ">", "with", "the", "value", "<code", ">", "value<", "/", "code", ">", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/script/el/tokens/IdentifierToken.java#L77-L98
crnk-project/crnk-framework
crnk-core/src/main/java/io/crnk/core/engine/internal/http/JsonApiRequestProcessor.java
JsonApiRequestProcessor.isJsonApiRequest
@SuppressWarnings("UnnecessaryLocalVariable") public static boolean isJsonApiRequest(HttpRequestContext requestContext, boolean acceptPlainJson) { String method = requestContext.getMethod().toUpperCase(); boolean isPatch = method.equals(HttpMethod.PATCH.toString()); boolean isPost = method.equals(HttpMethod.POST.toString()); if (isPatch || isPost) { String contentType = requestContext.getRequestHeader(HttpHeaders.HTTP_CONTENT_TYPE); if (contentType == null || !contentType.startsWith(HttpHeaders.JSONAPI_CONTENT_TYPE)) { LOGGER.warn("not a JSON-API request due to content type {}", contentType); return false; } } // short-circuit each of the possible Accept MIME type checks, so that we don't keep comparing after we have already // found a match. Intentionally kept as separate statements (instead of a big, chained ||) to ease debugging/maintenance. boolean acceptsJsonApi = requestContext.accepts(HttpHeaders.JSONAPI_CONTENT_TYPE); boolean acceptsAny = acceptsJsonApi || requestContext.acceptsAny(); boolean acceptsPlainJson = acceptsAny || (acceptPlainJson && requestContext.accepts("application/json")); LOGGER.debug("accepting request as JSON-API: {}", acceptPlainJson); return acceptsPlainJson; }
java
@SuppressWarnings("UnnecessaryLocalVariable") public static boolean isJsonApiRequest(HttpRequestContext requestContext, boolean acceptPlainJson) { String method = requestContext.getMethod().toUpperCase(); boolean isPatch = method.equals(HttpMethod.PATCH.toString()); boolean isPost = method.equals(HttpMethod.POST.toString()); if (isPatch || isPost) { String contentType = requestContext.getRequestHeader(HttpHeaders.HTTP_CONTENT_TYPE); if (contentType == null || !contentType.startsWith(HttpHeaders.JSONAPI_CONTENT_TYPE)) { LOGGER.warn("not a JSON-API request due to content type {}", contentType); return false; } } // short-circuit each of the possible Accept MIME type checks, so that we don't keep comparing after we have already // found a match. Intentionally kept as separate statements (instead of a big, chained ||) to ease debugging/maintenance. boolean acceptsJsonApi = requestContext.accepts(HttpHeaders.JSONAPI_CONTENT_TYPE); boolean acceptsAny = acceptsJsonApi || requestContext.acceptsAny(); boolean acceptsPlainJson = acceptsAny || (acceptPlainJson && requestContext.accepts("application/json")); LOGGER.debug("accepting request as JSON-API: {}", acceptPlainJson); return acceptsPlainJson; }
[ "@", "SuppressWarnings", "(", "\"UnnecessaryLocalVariable\"", ")", "public", "static", "boolean", "isJsonApiRequest", "(", "HttpRequestContext", "requestContext", ",", "boolean", "acceptPlainJson", ")", "{", "String", "method", "=", "requestContext", ".", "getMethod", "...
Determines whether the supplied HTTP request is considered a JSON-API request. @param requestContext The HTTP request @param acceptPlainJson Whether a plain JSON request should also be considered a JSON-API request @return <code>true</code> if it is a JSON-API request; <code>false</code> otherwise @since 2.4
[ "Determines", "whether", "the", "supplied", "HTTP", "request", "is", "considered", "a", "JSON", "-", "API", "request", "." ]
train
https://github.com/crnk-project/crnk-framework/blob/2fd3ef9a991788d46fd2e83b43c8ea37cbaf8681/crnk-core/src/main/java/io/crnk/core/engine/internal/http/JsonApiRequestProcessor.java#L53-L74
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/ECKey.java
ECKey.encryptionIsReversible
public static boolean encryptionIsReversible(ECKey originalKey, ECKey encryptedKey, KeyCrypter keyCrypter, KeyParameter aesKey) { try { ECKey rebornUnencryptedKey = encryptedKey.decrypt(keyCrypter, aesKey); byte[] originalPrivateKeyBytes = originalKey.getPrivKeyBytes(); byte[] rebornKeyBytes = rebornUnencryptedKey.getPrivKeyBytes(); if (!Arrays.equals(originalPrivateKeyBytes, rebornKeyBytes)) { log.error("The check that encryption could be reversed failed for {}", originalKey); return false; } return true; } catch (KeyCrypterException kce) { log.error(kce.getMessage()); return false; } }
java
public static boolean encryptionIsReversible(ECKey originalKey, ECKey encryptedKey, KeyCrypter keyCrypter, KeyParameter aesKey) { try { ECKey rebornUnencryptedKey = encryptedKey.decrypt(keyCrypter, aesKey); byte[] originalPrivateKeyBytes = originalKey.getPrivKeyBytes(); byte[] rebornKeyBytes = rebornUnencryptedKey.getPrivKeyBytes(); if (!Arrays.equals(originalPrivateKeyBytes, rebornKeyBytes)) { log.error("The check that encryption could be reversed failed for {}", originalKey); return false; } return true; } catch (KeyCrypterException kce) { log.error(kce.getMessage()); return false; } }
[ "public", "static", "boolean", "encryptionIsReversible", "(", "ECKey", "originalKey", ",", "ECKey", "encryptedKey", ",", "KeyCrypter", "keyCrypter", ",", "KeyParameter", "aesKey", ")", "{", "try", "{", "ECKey", "rebornUnencryptedKey", "=", "encryptedKey", ".", "decr...
<p>Check that it is possible to decrypt the key with the keyCrypter and that the original key is returned.</p> <p>Because it is a critical failure if the private keys cannot be decrypted successfully (resulting of loss of all bitcoins controlled by the private key) you can use this method to check when you *encrypt* a wallet that it can definitely be decrypted successfully.</p> <p>See {@link Wallet#encrypt(KeyCrypter keyCrypter, KeyParameter aesKey)} for example usage.</p> @return true if the encrypted key can be decrypted back to the original key successfully.
[ "<p", ">", "Check", "that", "it", "is", "possible", "to", "decrypt", "the", "key", "with", "the", "keyCrypter", "and", "that", "the", "original", "key", "is", "returned", ".", "<", "/", "p", ">" ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/ECKey.java#L1154-L1168
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
PossiblyRedundantMethodCalls.isRiskyName
private static boolean isRiskyName(String className, String methodName) { if (riskyClassNames.contains(className)) { return true; } String qualifiedMethodName = className + '.' + methodName; if (riskyMethodNameContents.contains(qualifiedMethodName)) { return true; } for (String riskyName : riskyMethodNameContents) { if (methodName.indexOf(riskyName) >= 0) { return true; } } return methodName.indexOf(Values.SYNTHETIC_MEMBER_CHAR) >= 0; }
java
private static boolean isRiskyName(String className, String methodName) { if (riskyClassNames.contains(className)) { return true; } String qualifiedMethodName = className + '.' + methodName; if (riskyMethodNameContents.contains(qualifiedMethodName)) { return true; } for (String riskyName : riskyMethodNameContents) { if (methodName.indexOf(riskyName) >= 0) { return true; } } return methodName.indexOf(Values.SYNTHETIC_MEMBER_CHAR) >= 0; }
[ "private", "static", "boolean", "isRiskyName", "(", "String", "className", ",", "String", "methodName", ")", "{", "if", "(", "riskyClassNames", ".", "contains", "(", "className", ")", ")", "{", "return", "true", ";", "}", "String", "qualifiedMethodName", "=", ...
returns true if the class or method name contains a pattern that is considered likely to be this modifying @param className the class name to check @param methodName the method name to check @return whether the method sounds like it modifies this
[ "returns", "true", "if", "the", "class", "or", "method", "name", "contains", "a", "pattern", "that", "is", "considered", "likely", "to", "be", "this", "modifying" ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java#L501-L518
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/convolution/Convolution.java
Convolution.outSize
@Deprecated public static int outSize(int size, int k, int s, int p, int dilation, boolean coverAll) { k = effectiveKernelSize(k, dilation); if (coverAll) return (size + p * 2 - k + s - 1) / s + 1; else return (size + p * 2 - k) / s + 1; }
java
@Deprecated public static int outSize(int size, int k, int s, int p, int dilation, boolean coverAll) { k = effectiveKernelSize(k, dilation); if (coverAll) return (size + p * 2 - k + s - 1) / s + 1; else return (size + p * 2 - k) / s + 1; }
[ "@", "Deprecated", "public", "static", "int", "outSize", "(", "int", "size", ",", "int", "k", ",", "int", "s", ",", "int", "p", ",", "int", "dilation", ",", "boolean", "coverAll", ")", "{", "k", "=", "effectiveKernelSize", "(", "k", ",", "dilation", ...
The out size for a convolution @param size @param k @param s @param p @param coverAll @return
[ "The", "out", "size", "for", "a", "convolution" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/convolution/Convolution.java#L322-L330
voldemort/voldemort
src/java/voldemort/routing/StoreRoutingPlan.java
StoreRoutingPlan.checkKeyBelongsToNode
public boolean checkKeyBelongsToNode(byte[] key, int nodeId) { List<Integer> nodePartitions = cluster.getNodeById(nodeId).getPartitionIds(); List<Integer> replicatingPartitions = getReplicatingPartitionList(key); // remove all partitions from the list, except those that belong to the // node replicatingPartitions.retainAll(nodePartitions); return replicatingPartitions.size() > 0; }
java
public boolean checkKeyBelongsToNode(byte[] key, int nodeId) { List<Integer> nodePartitions = cluster.getNodeById(nodeId).getPartitionIds(); List<Integer> replicatingPartitions = getReplicatingPartitionList(key); // remove all partitions from the list, except those that belong to the // node replicatingPartitions.retainAll(nodePartitions); return replicatingPartitions.size() > 0; }
[ "public", "boolean", "checkKeyBelongsToNode", "(", "byte", "[", "]", "key", ",", "int", "nodeId", ")", "{", "List", "<", "Integer", ">", "nodePartitions", "=", "cluster", ".", "getNodeById", "(", "nodeId", ")", ".", "getPartitionIds", "(", ")", ";", "List"...
Determines if the key replicates to the given node @param key @param nodeId @return true if the key belongs to the node as some replica
[ "Determines", "if", "the", "key", "replicates", "to", "the", "given", "node" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/routing/StoreRoutingPlan.java#L360-L367
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/io/file/FileOperations.java
FileOperations._copyFileViaStreams
@Nonnull private static ESuccess _copyFileViaStreams (@Nonnull final File aSrcFile, @Nonnull final File aDestFile) { final InputStream aSrcIS = FileHelper.getInputStream (aSrcFile); if (aSrcIS == null) return ESuccess.FAILURE; try { final OutputStream aDstOS = FileHelper.getOutputStream (aDestFile, EAppend.TRUNCATE); if (aDstOS == null) return ESuccess.FAILURE; try { return StreamHelper.copyInputStreamToOutputStream (aSrcIS, aDstOS); } finally { StreamHelper.close (aDstOS); } } finally { StreamHelper.close (aSrcIS); } }
java
@Nonnull private static ESuccess _copyFileViaStreams (@Nonnull final File aSrcFile, @Nonnull final File aDestFile) { final InputStream aSrcIS = FileHelper.getInputStream (aSrcFile); if (aSrcIS == null) return ESuccess.FAILURE; try { final OutputStream aDstOS = FileHelper.getOutputStream (aDestFile, EAppend.TRUNCATE); if (aDstOS == null) return ESuccess.FAILURE; try { return StreamHelper.copyInputStreamToOutputStream (aSrcIS, aDstOS); } finally { StreamHelper.close (aDstOS); } } finally { StreamHelper.close (aSrcIS); } }
[ "@", "Nonnull", "private", "static", "ESuccess", "_copyFileViaStreams", "(", "@", "Nonnull", "final", "File", "aSrcFile", ",", "@", "Nonnull", "final", "File", "aDestFile", ")", "{", "final", "InputStream", "aSrcIS", "=", "FileHelper", ".", "getInputStream", "("...
Copy the content of the source file to the destination file using {@link InputStream} and {@link OutputStream}. @param aSrcFile Source file. May not be <code>null</code>. @param aDestFile Destination file. May not be <code>null</code>. @return {@link ESuccess}
[ "Copy", "the", "content", "of", "the", "source", "file", "to", "the", "destination", "file", "using", "{", "@link", "InputStream", "}", "and", "{", "@link", "OutputStream", "}", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/file/FileOperations.java#L578-L604
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/extras/Poi.java
Poi.toXY
public final Point2D toXY(final double LAT, final double LON) { final double LATITUDE = (LAT * (-1)) + 90.0; final double LONGITUDE = LON + 180.0; final double X = Math.round(LONGITUDE * (WORLD_MAP.getWidth() / 360)); final double Y = Math.round(LATITUDE * (WORLD_MAP.getHeight() / 180)); return new java.awt.geom.Point2D.Double(X, Y); }
java
public final Point2D toXY(final double LAT, final double LON) { final double LATITUDE = (LAT * (-1)) + 90.0; final double LONGITUDE = LON + 180.0; final double X = Math.round(LONGITUDE * (WORLD_MAP.getWidth() / 360)); final double Y = Math.round(LATITUDE * (WORLD_MAP.getHeight() / 180)); return new java.awt.geom.Point2D.Double(X, Y); }
[ "public", "final", "Point2D", "toXY", "(", "final", "double", "LAT", ",", "final", "double", "LON", ")", "{", "final", "double", "LATITUDE", "=", "(", "LAT", "*", "(", "-", "1", ")", ")", "+", "90.0", ";", "final", "double", "LONGITUDE", "=", "LON", ...
Converts the given latitude and longitude to x,y values @param LAT @param LON @return Point2D with the location of the given lat, lon
[ "Converts", "the", "given", "latitude", "and", "longitude", "to", "x", "y", "values" ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/extras/Poi.java#L439-L447