repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/CallableProcedureStatement.java
CallableProcedureStatement.registerOutParameter
@Override public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException { CallParameter callParameter = getParameter(parameterIndex); callParameter.setOutput(true); callParameter.setOutputSqlType(sqlType); callParameter.setScale(scale); }
java
@Override public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException { CallParameter callParameter = getParameter(parameterIndex); callParameter.setOutput(true); callParameter.setOutputSqlType(sqlType); callParameter.setScale(scale); }
[ "@", "Override", "public", "void", "registerOutParameter", "(", "int", "parameterIndex", ",", "int", "sqlType", ",", "int", "scale", ")", "throws", "SQLException", "{", "CallParameter", "callParameter", "=", "getParameter", "(", "parameterIndex", ")", ";", "callPa...
<p>Registers the parameter in ordinal position <code>parameterIndex</code> to be of JDBC type <code>sqlType</code>. All OUT parameters must be registered before a stored procedure is executed.</p> <p>The JDBC type specified by <code>sqlType</code> for an OUT parameter determines the Java type that must be used in the <code>get</code> method to read the value of that parameter.</p> <p>This version of <code>registerOutParameter</code> should be used when the parameter is of JDBC type <code>NUMERIC</code> or <code>DECIMAL</code>.</p> @param parameterIndex the first parameter is 1, the second is 2, and so on @param sqlType the SQL type code defined by <code>java.sql.Types</code>. @param scale the desired number of digits to the right of the decimal point. It must be greater than or equal to zero. @throws SQLException if the parameterIndex is not valid; if a database access error occurs or this method is called on a closed <code>CallableStatement</code> @see Types
[ "<p", ">", "Registers", "the", "parameter", "in", "ordinal", "position", "<code", ">", "parameterIndex<", "/", "code", ">", "to", "be", "of", "JDBC", "type", "<code", ">", "sqlType<", "/", "code", ">", ".", "All", "OUT", "parameters", "must", "be", "regi...
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/CallableProcedureStatement.java#L605-L611
graknlabs/grakn
server/src/server/ServerFactory.java
ServerFactory.createServer
public static Server createServer(boolean benchmark) { // Grakn Server configuration ServerID serverID = ServerID.me(); Config config = Config.create(); JanusGraphFactory janusGraphFactory = new JanusGraphFactory(config); // locks LockManager lockManager = new ServerLockManager(); KeyspaceManager keyspaceStore = new KeyspaceManager(janusGraphFactory, config); // session factory SessionFactory sessionFactory = new SessionFactory(lockManager, janusGraphFactory, keyspaceStore, config); // post-processing AttributeDeduplicatorDaemon attributeDeduplicatorDaemon = new AttributeDeduplicatorDaemon(sessionFactory); // Enable server tracing if (benchmark) { ServerTracing.initInstrumentation("server-instrumentation"); } // create gRPC server io.grpc.Server serverRPC = createServerRPC(config, sessionFactory, attributeDeduplicatorDaemon, keyspaceStore, janusGraphFactory); return createServer(serverID, serverRPC, lockManager, attributeDeduplicatorDaemon, keyspaceStore); }
java
public static Server createServer(boolean benchmark) { // Grakn Server configuration ServerID serverID = ServerID.me(); Config config = Config.create(); JanusGraphFactory janusGraphFactory = new JanusGraphFactory(config); // locks LockManager lockManager = new ServerLockManager(); KeyspaceManager keyspaceStore = new KeyspaceManager(janusGraphFactory, config); // session factory SessionFactory sessionFactory = new SessionFactory(lockManager, janusGraphFactory, keyspaceStore, config); // post-processing AttributeDeduplicatorDaemon attributeDeduplicatorDaemon = new AttributeDeduplicatorDaemon(sessionFactory); // Enable server tracing if (benchmark) { ServerTracing.initInstrumentation("server-instrumentation"); } // create gRPC server io.grpc.Server serverRPC = createServerRPC(config, sessionFactory, attributeDeduplicatorDaemon, keyspaceStore, janusGraphFactory); return createServer(serverID, serverRPC, lockManager, attributeDeduplicatorDaemon, keyspaceStore); }
[ "public", "static", "Server", "createServer", "(", "boolean", "benchmark", ")", "{", "// Grakn Server configuration", "ServerID", "serverID", "=", "ServerID", ".", "me", "(", ")", ";", "Config", "config", "=", "Config", ".", "create", "(", ")", ";", "JanusGrap...
Create a Server configured for Grakn Core. @return a Server instance configured for Grakn Core
[ "Create", "a", "Server", "configured", "for", "Grakn", "Core", "." ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/ServerFactory.java#L46-L73
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/MatchCache.java
MatchCache.put
public Object put(Object key, Object value) { // Make sure the value is not null if (value == null) { throw new NullPointerException(); } // Makes sure the key is not already in the hashtable. FastHashtableEntry tab[] = table; int hash = key.hashCode(); int index = (hash & 0x7FFFFFFF) % tab.length; for (FastHashtableEntry e = tab[index] ; e != null ; e = e.next) { if ((e.hash == hash) && e.key.equals(key)) { Object old = e.value; e.value = value; return old; } } if (count >= threshold) { // Rehash the table if the threshold is exceeded rehash(); return put(key, value); } // Creates the new entry. FastHashtableEntry e = new FastHashtableEntry(); e.hash = hash; e.key = key; e.value = value; e.next = tab[index]; tab[index] = e; count++; return null; }
java
public Object put(Object key, Object value) { // Make sure the value is not null if (value == null) { throw new NullPointerException(); } // Makes sure the key is not already in the hashtable. FastHashtableEntry tab[] = table; int hash = key.hashCode(); int index = (hash & 0x7FFFFFFF) % tab.length; for (FastHashtableEntry e = tab[index] ; e != null ; e = e.next) { if ((e.hash == hash) && e.key.equals(key)) { Object old = e.value; e.value = value; return old; } } if (count >= threshold) { // Rehash the table if the threshold is exceeded rehash(); return put(key, value); } // Creates the new entry. FastHashtableEntry e = new FastHashtableEntry(); e.hash = hash; e.key = key; e.value = value; e.next = tab[index]; tab[index] = e; count++; return null; }
[ "public", "Object", "put", "(", "Object", "key", ",", "Object", "value", ")", "{", "// Make sure the value is not null", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "// Makes sure the key is not already i...
Maps the specified <code>key</code> to the specified <code>value</code> in this hashtable. Neither the key nor the value can be <code>null</code>. <p> The value can be retrieved by calling the <code>get</code> method with a key that is equal to the original key. @param key the hashtable key. @param value the value. @return the previous value of the specified key in this hashtable, or <code>null</code> if it did not have one. @exception NullPointerException if the key or value is <code>null</code>. @see java.lang.Object#equals(java.lang.Object) @see java.util.Hashtable#get(java.lang.Object) @since JDK1.0
[ "Maps", "the", "specified", "<code", ">", "key<", "/", "code", ">", "to", "the", "specified", "<code", ">", "value<", "/", "code", ">", "in", "this", "hashtable", ".", "Neither", "the", "key", "nor", "the", "value", "can", "be", "<code", ">", "null<", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/MatchCache.java#L410-L443
filestack/filestack-android
samples/form/app/src/main/java/com/filestack/android/samples/form/FormFragment.java
FormFragment.getAdaptiveUrl
private String getAdaptiveUrl(FileLink fileLink, int dimen) { ResizeTask resizeTask = new ResizeTask.Builder() .fit("crop") .align("center") .width(dimen) .height(dimen) .build(); return fileLink.imageTransform().addTask(resizeTask).url(); }
java
private String getAdaptiveUrl(FileLink fileLink, int dimen) { ResizeTask resizeTask = new ResizeTask.Builder() .fit("crop") .align("center") .width(dimen) .height(dimen) .build(); return fileLink.imageTransform().addTask(resizeTask).url(); }
[ "private", "String", "getAdaptiveUrl", "(", "FileLink", "fileLink", ",", "int", "dimen", ")", "{", "ResizeTask", "resizeTask", "=", "new", "ResizeTask", ".", "Builder", "(", ")", ".", "fit", "(", "\"crop\"", ")", ".", "align", "(", "\"center\"", ")", ".", ...
Creates a URL to an image sized appropriately for the form ImageView
[ "Creates", "a", "URL", "to", "an", "image", "sized", "appropriately", "for", "the", "form", "ImageView" ]
train
https://github.com/filestack/filestack-android/blob/8dafa1cb5c77542c351d631be0742717b5a9d45d/samples/form/app/src/main/java/com/filestack/android/samples/form/FormFragment.java#L70-L79
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/libs/modules/ModelsEngine.java
ModelsEngine.meanDoublematrixColumn
public static double meanDoublematrixColumn( double[][] matrix, int column ) { double mean; mean = 0; int length = matrix.length; for( int i = 0; i < length; i++ ) { mean += matrix[i][column]; } return mean / length; }
java
public static double meanDoublematrixColumn( double[][] matrix, int column ) { double mean; mean = 0; int length = matrix.length; for( int i = 0; i < length; i++ ) { mean += matrix[i][column]; } return mean / length; }
[ "public", "static", "double", "meanDoublematrixColumn", "(", "double", "[", "]", "[", "]", "matrix", ",", "int", "column", ")", "{", "double", "mean", ";", "mean", "=", "0", ";", "int", "length", "=", "matrix", ".", "length", ";", "for", "(", "int", ...
Return the mean of a column of a matrix. @param matrix matrix of the value to calculate. @param column index of the column to calculate the variance. @return mean.
[ "Return", "the", "mean", "of", "a", "column", "of", "a", "matrix", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/libs/modules/ModelsEngine.java#L1396-L1409
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/util/log/LoggerUtil.java
LoggerUtil.initializeLogging
public static String initializeLogging() throws IOException { System.setProperty("org.slf4j.simpleLogger.logFile", "System.out"); System.setProperty("org.slf4j.simpleLogger.showDateTime", "true"); System.setProperty("org.slf4j.simpleLogger.dateTimeFormat", "yyyyMMdd.HH:mm:ss.SSS"); // Peek at mdw.yaml to find default logging level, but do not initialize PropertyManager // which could initialize slf4j prematurely. (Works only with yaml config file). String mdwLogLevel = null; File mdwYaml = getConfigurationFile("mdw.yaml"); if (mdwYaml.exists()) { YamlProperties yamlProps = new YamlProperties("mdw", mdwYaml); mdwLogLevel = yamlProps.getString("mdw.logging.level"); if (mdwLogLevel != null) { if (mdwLogLevel.equals("MDW_DEBUG")) mdwLogLevel = "TRACE"; System.setProperty("org.slf4j.simpleLogger.log.com.centurylink.mdw", mdwLogLevel.toLowerCase()); } } return mdwLogLevel; }
java
public static String initializeLogging() throws IOException { System.setProperty("org.slf4j.simpleLogger.logFile", "System.out"); System.setProperty("org.slf4j.simpleLogger.showDateTime", "true"); System.setProperty("org.slf4j.simpleLogger.dateTimeFormat", "yyyyMMdd.HH:mm:ss.SSS"); // Peek at mdw.yaml to find default logging level, but do not initialize PropertyManager // which could initialize slf4j prematurely. (Works only with yaml config file). String mdwLogLevel = null; File mdwYaml = getConfigurationFile("mdw.yaml"); if (mdwYaml.exists()) { YamlProperties yamlProps = new YamlProperties("mdw", mdwYaml); mdwLogLevel = yamlProps.getString("mdw.logging.level"); if (mdwLogLevel != null) { if (mdwLogLevel.equals("MDW_DEBUG")) mdwLogLevel = "TRACE"; System.setProperty("org.slf4j.simpleLogger.log.com.centurylink.mdw", mdwLogLevel.toLowerCase()); } } return mdwLogLevel; }
[ "public", "static", "String", "initializeLogging", "(", ")", "throws", "IOException", "{", "System", ".", "setProperty", "(", "\"org.slf4j.simpleLogger.logFile\"", ",", "\"System.out\"", ")", ";", "System", ".", "setProperty", "(", "\"org.slf4j.simpleLogger.showDateTime\"...
For Spring Boot with slf4j SimpleLogger, an opportunity to initialize logging before Spring starts logging. Otherwise for slf4j, properties have already been defaulted before we have a chance to set them. See mdw-spring-boot AutoConfig for initialization of logback for pure Spring Boot apps.
[ "For", "Spring", "Boot", "with", "slf4j", "SimpleLogger", "an", "opportunity", "to", "initialize", "logging", "before", "Spring", "starts", "logging", ".", "Otherwise", "for", "slf4j", "properties", "have", "already", "been", "defaulted", "before", "we", "have", ...
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/util/log/LoggerUtil.java#L51-L69
jdereg/java-util
src/main/java/com/cedarsoftware/util/DeepEquals.java
DeepEquals.compareSortedMap
private static boolean compareSortedMap(SortedMap map1, SortedMap map2, Deque stack, Set visited) { // Same instance check already performed... if (map1.size() != map2.size()) { return false; } Iterator i1 = map1.entrySet().iterator(); Iterator i2 = map2.entrySet().iterator(); while (i1.hasNext()) { Map.Entry entry1 = (Map.Entry)i1.next(); Map.Entry entry2 = (Map.Entry)i2.next(); // Must split the Key and Value so that Map.Entry's equals() method is not used. DualKey dk = new DualKey(entry1.getKey(), entry2.getKey()); if (!visited.contains(dk)) { // Push Keys for further comparison stack.addFirst(dk); } dk = new DualKey(entry1.getValue(), entry2.getValue()); if (!visited.contains(dk)) { // Push values for further comparison stack.addFirst(dk); } } return true; }
java
private static boolean compareSortedMap(SortedMap map1, SortedMap map2, Deque stack, Set visited) { // Same instance check already performed... if (map1.size() != map2.size()) { return false; } Iterator i1 = map1.entrySet().iterator(); Iterator i2 = map2.entrySet().iterator(); while (i1.hasNext()) { Map.Entry entry1 = (Map.Entry)i1.next(); Map.Entry entry2 = (Map.Entry)i2.next(); // Must split the Key and Value so that Map.Entry's equals() method is not used. DualKey dk = new DualKey(entry1.getKey(), entry2.getKey()); if (!visited.contains(dk)) { // Push Keys for further comparison stack.addFirst(dk); } dk = new DualKey(entry1.getValue(), entry2.getValue()); if (!visited.contains(dk)) { // Push values for further comparison stack.addFirst(dk); } } return true; }
[ "private", "static", "boolean", "compareSortedMap", "(", "SortedMap", "map1", ",", "SortedMap", "map2", ",", "Deque", "stack", ",", "Set", "visited", ")", "{", "// Same instance check already performed...", "if", "(", "map1", ".", "size", "(", ")", "!=", "map2",...
Deeply compare two SortedMap instances. This method walks the Maps in order, taking advantage of the fact that the Maps are SortedMaps. @param map1 SortedMap one @param map2 SortedMap two @param stack add items to compare to the Stack (Stack versus recursion) @param visited Set containing items that have already been compared, to prevent cycles. @return false if the Maps are for certain not equals. 'true' indicates that 'on the surface' the maps are equal, however, it will place the contents of the Maps on the stack for further comparisons.
[ "Deeply", "compare", "two", "SortedMap", "instances", ".", "This", "method", "walks", "the", "Maps", "in", "order", "taking", "advantage", "of", "the", "fact", "that", "the", "Maps", "are", "SortedMaps", "." ]
train
https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/DeepEquals.java#L510-L541
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.setStorageAccountAsync
public Observable<StorageBundle> setStorageAccountAsync(String vaultBaseUrl, String storageAccountName, String resourceId, String activeKeyName, boolean autoRegenerateKey, String regenerationPeriod, StorageAccountAttributes storageAccountAttributes, Map<String, String> tags) { return setStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName, resourceId, activeKeyName, autoRegenerateKey, regenerationPeriod, storageAccountAttributes, tags).map(new Func1<ServiceResponse<StorageBundle>, StorageBundle>() { @Override public StorageBundle call(ServiceResponse<StorageBundle> response) { return response.body(); } }); }
java
public Observable<StorageBundle> setStorageAccountAsync(String vaultBaseUrl, String storageAccountName, String resourceId, String activeKeyName, boolean autoRegenerateKey, String regenerationPeriod, StorageAccountAttributes storageAccountAttributes, Map<String, String> tags) { return setStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName, resourceId, activeKeyName, autoRegenerateKey, regenerationPeriod, storageAccountAttributes, tags).map(new Func1<ServiceResponse<StorageBundle>, StorageBundle>() { @Override public StorageBundle call(ServiceResponse<StorageBundle> response) { return response.body(); } }); }
[ "public", "Observable", "<", "StorageBundle", ">", "setStorageAccountAsync", "(", "String", "vaultBaseUrl", ",", "String", "storageAccountName", ",", "String", "resourceId", ",", "String", "activeKeyName", ",", "boolean", "autoRegenerateKey", ",", "String", "regeneratio...
Creates or updates a new storage account. This operation requires the storage/set permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @param resourceId Storage account resource id. @param activeKeyName Current active storage account key name. @param autoRegenerateKey whether keyvault should manage the storage account for the user. @param regenerationPeriod The key regeneration time duration specified in ISO-8601 format. @param storageAccountAttributes The attributes of the storage account. @param tags Application specific metadata in the form of key-value pairs. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the StorageBundle object
[ "Creates", "or", "updates", "a", "new", "storage", "account", ".", "This", "operation", "requires", "the", "storage", "/", "set", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L10013-L10020
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.license_windows_serviceName_upgrade_duration_GET
public OvhOrder license_windows_serviceName_upgrade_duration_GET(String serviceName, String duration, OvhWindowsSqlVersionEnum sqlVersion, OvhWindowsOsVersionEnum version) throws IOException { String qPath = "/order/license/windows/{serviceName}/upgrade/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "sqlVersion", sqlVersion); query(sb, "version", version); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder license_windows_serviceName_upgrade_duration_GET(String serviceName, String duration, OvhWindowsSqlVersionEnum sqlVersion, OvhWindowsOsVersionEnum version) throws IOException { String qPath = "/order/license/windows/{serviceName}/upgrade/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "sqlVersion", sqlVersion); query(sb, "version", version); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "license_windows_serviceName_upgrade_duration_GET", "(", "String", "serviceName", ",", "String", "duration", ",", "OvhWindowsSqlVersionEnum", "sqlVersion", ",", "OvhWindowsOsVersionEnum", "version", ")", "throws", "IOException", "{", "String", "qPath", ...
Get prices and contracts information REST: GET /order/license/windows/{serviceName}/upgrade/{duration} @param version [required] The windows version you want to enable on your windows license @param sqlVersion [required] The SQL Server version to enable on this license Windows license @param serviceName [required] The name of your Windows license @param duration [required] Duration
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L1192-L1199
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.setLegalHoldAsync
public Observable<LegalHoldInner> setLegalHoldAsync(String resourceGroupName, String accountName, String containerName, List<String> tags) { return setLegalHoldWithServiceResponseAsync(resourceGroupName, accountName, containerName, tags).map(new Func1<ServiceResponse<LegalHoldInner>, LegalHoldInner>() { @Override public LegalHoldInner call(ServiceResponse<LegalHoldInner> response) { return response.body(); } }); }
java
public Observable<LegalHoldInner> setLegalHoldAsync(String resourceGroupName, String accountName, String containerName, List<String> tags) { return setLegalHoldWithServiceResponseAsync(resourceGroupName, accountName, containerName, tags).map(new Func1<ServiceResponse<LegalHoldInner>, LegalHoldInner>() { @Override public LegalHoldInner call(ServiceResponse<LegalHoldInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "LegalHoldInner", ">", "setLegalHoldAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "containerName", ",", "List", "<", "String", ">", "tags", ")", "{", "return", "setLegalHoldWithServiceResponseAsyn...
Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. @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 tags Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the LegalHoldInner object
[ "Sets", "legal", "hold", "tags", ".", "Setting", "the", "same", "tag", "results", "in", "an", "idempotent", "operation", ".", "SetLegalHold", "follows", "an", "append", "pattern", "and", "does", "not", "clear", "out", "the", "existing", "tags", "that", "are"...
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#L824-L831
wdullaer/MaterialDateTimePicker
library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialSelectorView.java
RadialSelectorView.setSelection
public void setSelection(int selectionDegrees, boolean isInnerCircle, boolean forceDrawDot) { mSelectionDegrees = selectionDegrees; mSelectionRadians = selectionDegrees * Math.PI / 180; mForceDrawDot = forceDrawDot; if (mHasInnerCircle) { if (isInnerCircle) { mNumbersRadiusMultiplier = mInnerNumbersRadiusMultiplier; } else { mNumbersRadiusMultiplier = mOuterNumbersRadiusMultiplier; } } }
java
public void setSelection(int selectionDegrees, boolean isInnerCircle, boolean forceDrawDot) { mSelectionDegrees = selectionDegrees; mSelectionRadians = selectionDegrees * Math.PI / 180; mForceDrawDot = forceDrawDot; if (mHasInnerCircle) { if (isInnerCircle) { mNumbersRadiusMultiplier = mInnerNumbersRadiusMultiplier; } else { mNumbersRadiusMultiplier = mOuterNumbersRadiusMultiplier; } } }
[ "public", "void", "setSelection", "(", "int", "selectionDegrees", ",", "boolean", "isInnerCircle", ",", "boolean", "forceDrawDot", ")", "{", "mSelectionDegrees", "=", "selectionDegrees", ";", "mSelectionRadians", "=", "selectionDegrees", "*", "Math", ".", "PI", "/",...
Set the selection. @param selectionDegrees The degrees to be selected. @param isInnerCircle Whether the selection should be in the inner circle or outer. Will be ignored if hasInnerCircle was initialized to false. @param forceDrawDot Whether to force the dot in the center of the selection circle to be drawn. If false, the dot will be drawn only when the degrees is not a multiple of 30, i.e. the selection is not on a visible number.
[ "Set", "the", "selection", "." ]
train
https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialSelectorView.java#L156-L168
killbill/killbill
util/src/main/java/org/killbill/billing/util/callcontext/InternalCallContextFactory.java
InternalCallContextFactory.getRecordIdFromObject
public Long getRecordIdFromObject(final UUID objectId, final ObjectType objectType, final TenantContext context) { try { if (objectBelongsToTheRightTenant(objectId, objectType, context)) { return nonEntityDao.retrieveRecordIdFromObject(objectId, objectType, recordIdCacheController); } else { return null; } } catch (final ObjectDoesNotExist e) { return null; } }
java
public Long getRecordIdFromObject(final UUID objectId, final ObjectType objectType, final TenantContext context) { try { if (objectBelongsToTheRightTenant(objectId, objectType, context)) { return nonEntityDao.retrieveRecordIdFromObject(objectId, objectType, recordIdCacheController); } else { return null; } } catch (final ObjectDoesNotExist e) { return null; } }
[ "public", "Long", "getRecordIdFromObject", "(", "final", "UUID", "objectId", ",", "final", "ObjectType", "objectType", ",", "final", "TenantContext", "context", ")", "{", "try", "{", "if", "(", "objectBelongsToTheRightTenant", "(", "objectId", ",", "objectType", "...
Safe method to retrieve the record id from any object (should only be used by DefaultRecordIdApi)
[ "Safe", "method", "to", "retrieve", "the", "record", "id", "from", "any", "object", "(", "should", "only", "be", "used", "by", "DefaultRecordIdApi", ")" ]
train
https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/util/src/main/java/org/killbill/billing/util/callcontext/InternalCallContextFactory.java#L354-L364
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java
XML.attributeExists
private boolean attributeExists(Class<?> aClass,Attribute attribute){ if(!classExists(aClass))return false; for (XmlAttribute xmlAttribute : findXmlClass(aClass).attributes) if(xmlAttribute.name.equals(attribute.getName()))return true; return false; }
java
private boolean attributeExists(Class<?> aClass,Attribute attribute){ if(!classExists(aClass))return false; for (XmlAttribute xmlAttribute : findXmlClass(aClass).attributes) if(xmlAttribute.name.equals(attribute.getName()))return true; return false; }
[ "private", "boolean", "attributeExists", "(", "Class", "<", "?", ">", "aClass", ",", "Attribute", "attribute", ")", "{", "if", "(", "!", "classExists", "(", "aClass", ")", ")", "return", "false", ";", "for", "(", "XmlAttribute", "xmlAttribute", ":", "findX...
This method returns true if the attribute exist in the Class given in input, returns false otherwise. @param aClass Class of the Attribute @param attribute Attribute to check @return true if attribute exist, false otherwise
[ "This", "method", "returns", "true", "if", "the", "attribute", "exist", "in", "the", "Class", "given", "in", "input", "returns", "false", "otherwise", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java#L454-L460
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/LuceneQueryBuilder.java
LuceneQueryBuilder.createSingleValueConstraint
private Query createSingleValueConstraint(Query q, String propName) { // get nodes with multi-values in propName Query mvp = new JcrTermQuery(new Term(FieldNames.MVP, propName)); // now negate, that gives the nodes that have propName as single // values but also all others Query svp = new NotQuery(mvp); // now join the two, which will result in those nodes where propName // only contains a single value. This works because q already restricts // the result to those nodes that have a property propName BooleanQuery and = new BooleanQuery(); and.add(q, Occur.MUST); and.add(svp, Occur.MUST); return and; }
java
private Query createSingleValueConstraint(Query q, String propName) { // get nodes with multi-values in propName Query mvp = new JcrTermQuery(new Term(FieldNames.MVP, propName)); // now negate, that gives the nodes that have propName as single // values but also all others Query svp = new NotQuery(mvp); // now join the two, which will result in those nodes where propName // only contains a single value. This works because q already restricts // the result to those nodes that have a property propName BooleanQuery and = new BooleanQuery(); and.add(q, Occur.MUST); and.add(svp, Occur.MUST); return and; }
[ "private", "Query", "createSingleValueConstraint", "(", "Query", "q", ",", "String", "propName", ")", "{", "// get nodes with multi-values in propName", "Query", "mvp", "=", "new", "JcrTermQuery", "(", "new", "Term", "(", "FieldNames", ".", "MVP", ",", "propName", ...
Wraps a constraint query around <code>q</code> that limits the nodes to those where <code>propName</code> is the name of a single value property on the node instance. @param q the query to wrap. @param propName the name of a property that only has one value. @return the wrapped query <code>q</code>.
[ "Wraps", "a", "constraint", "query", "around", "<code", ">", "q<", "/", "code", ">", "that", "limits", "the", "nodes", "to", "those", "where", "<code", ">", "propName<", "/", "code", ">", "is", "the", "name", "of", "a", "single", "value", "property", "...
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/LuceneQueryBuilder.java#L1118-L1132
mapbox/mapbox-plugins-android
plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java
OfflinePlugin.cancelDownload
public void cancelDownload(OfflineDownloadOptions offlineDownload) { Intent intent = new Intent(context, OfflineDownloadService.class); intent.setAction(OfflineConstants.ACTION_CANCEL_DOWNLOAD); intent.putExtra(KEY_BUNDLE, offlineDownload); context.startService(intent); }
java
public void cancelDownload(OfflineDownloadOptions offlineDownload) { Intent intent = new Intent(context, OfflineDownloadService.class); intent.setAction(OfflineConstants.ACTION_CANCEL_DOWNLOAD); intent.putExtra(KEY_BUNDLE, offlineDownload); context.startService(intent); }
[ "public", "void", "cancelDownload", "(", "OfflineDownloadOptions", "offlineDownload", ")", "{", "Intent", "intent", "=", "new", "Intent", "(", "context", ",", "OfflineDownloadService", ".", "class", ")", ";", "intent", ".", "setAction", "(", "OfflineConstants", "....
Cancel an ongoing download. @param offlineDownload the offline download @since 0.1.0
[ "Cancel", "an", "ongoing", "download", "." ]
train
https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java#L94-L99
realexpayments/rxp-hpp-java
src/main/java/com/realexpayments/hpp/sdk/utils/JsonUtils.java
JsonUtils.toJson
public static String toJson(HppRequest hppRequest) { try { return hppRequestWriter.writeValueAsString(hppRequest); } catch (JsonProcessingException ex) { LOGGER.error("Error writing HppRequest to JSON.", ex); throw new RealexException("Error writing HppRequest to JSON.", ex); } }
java
public static String toJson(HppRequest hppRequest) { try { return hppRequestWriter.writeValueAsString(hppRequest); } catch (JsonProcessingException ex) { LOGGER.error("Error writing HppRequest to JSON.", ex); throw new RealexException("Error writing HppRequest to JSON.", ex); } }
[ "public", "static", "String", "toJson", "(", "HppRequest", "hppRequest", ")", "{", "try", "{", "return", "hppRequestWriter", ".", "writeValueAsString", "(", "hppRequest", ")", ";", "}", "catch", "(", "JsonProcessingException", "ex", ")", "{", "LOGGER", ".", "e...
Method serialises <code>HppRequest</code> to JSON. @param hppRequest @return String
[ "Method", "serialises", "<code", ">", "HppRequest<", "/", "code", ">", "to", "JSON", "." ]
train
https://github.com/realexpayments/rxp-hpp-java/blob/29cc5df036af09a6d8ea16ccd7e02e856f72620f/src/main/java/com/realexpayments/hpp/sdk/utils/JsonUtils.java#L63-L70
aragozin/jvm-tools
mxdump/src/main/java/org/gridkit/jvmtool/jackson/JsonGenerator.java
JsonGenerator.writeStringField
public void writeStringField(String fieldName, String value) throws IOException, JsonGenerationException { writeFieldName(fieldName); writeString(value); }
java
public void writeStringField(String fieldName, String value) throws IOException, JsonGenerationException { writeFieldName(fieldName); writeString(value); }
[ "public", "void", "writeStringField", "(", "String", "fieldName", ",", "String", "value", ")", "throws", "IOException", ",", "JsonGenerationException", "{", "writeFieldName", "(", "fieldName", ")", ";", "writeString", "(", "value", ")", ";", "}" ]
Convenience method for outputting a field entry ("member") that has a String value. Equivalent to: <pre> writeFieldName(fieldName); writeString(value); </pre> <p> Note: many performance-sensitive implementations override this method
[ "Convenience", "method", "for", "outputting", "a", "field", "entry", "(", "member", ")", "that", "has", "a", "String", "value", ".", "Equivalent", "to", ":", "<pre", ">", "writeFieldName", "(", "fieldName", ")", ";", "writeString", "(", "value", ")", ";", ...
train
https://github.com/aragozin/jvm-tools/blob/d3a4d0c6a47fb9317f274988569655f30dcd2f76/mxdump/src/main/java/org/gridkit/jvmtool/jackson/JsonGenerator.java#L691-L696
Berico-Technologies/CLAVIN
src/main/java/com/bericotech/clavin/gazetteer/query/QueryBuilder.java
QueryBuilder.addFeatureCodes
public QueryBuilder addFeatureCodes(final FeatureCode code1, final FeatureCode... codes) { featureCodes.add(code1); featureCodes.addAll(Arrays.asList(codes)); return this; }
java
public QueryBuilder addFeatureCodes(final FeatureCode code1, final FeatureCode... codes) { featureCodes.add(code1); featureCodes.addAll(Arrays.asList(codes)); return this; }
[ "public", "QueryBuilder", "addFeatureCodes", "(", "final", "FeatureCode", "code1", ",", "final", "FeatureCode", "...", "codes", ")", "{", "featureCodes", ".", "add", "(", "code1", ")", ";", "featureCodes", ".", "addAll", "(", "Arrays", ".", "asList", "(", "c...
Add the provided {@link FeatureCode}s to the set of query constraints. @param code1 the first {@link FeatureCode} to add @param codes the subsequent {@link FeatureCode}s to add @return this
[ "Add", "the", "provided", "{" ]
train
https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/gazetteer/query/QueryBuilder.java#L390-L394
haraldk/TwelveMonkeys
sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/NetUtil.java
NetUtil.getInputStreamHttp
public static InputStream getInputStreamHttp(String pURL, int pTimeout) throws IOException { return getInputStreamHttp(pURL, null, true, pTimeout); }
java
public static InputStream getInputStreamHttp(String pURL, int pTimeout) throws IOException { return getInputStreamHttp(pURL, null, true, pTimeout); }
[ "public", "static", "InputStream", "getInputStreamHttp", "(", "String", "pURL", ",", "int", "pTimeout", ")", "throws", "IOException", "{", "return", "getInputStreamHttp", "(", "pURL", ",", "null", ",", "true", ",", "pTimeout", ")", ";", "}" ]
Gets the InputStream from a given URL, with the given timeout. The timeout must be > 0. A timeout of zero is interpreted as an infinite timeout. Supports basic HTTP authentication, using a URL string similar to most browsers. <P/> <SMALL>Implementation note: If the timeout parameter is greater than 0, this method uses my own implementation of java.net.HttpURLConnection, that uses plain sockets, to create an HTTP connection to the given URL. The {@code read} methods called on the returned InputStream, will block only for the specified timeout. If the timeout expires, a java.io.InterruptedIOException is raised. This might happen BEFORE OR AFTER this method returns, as the HTTP headers will be read and parsed from the InputStream before this method returns, while further read operations on the returned InputStream might be performed at a later stage. <BR/> </SMALL> @param pURL the URL to get. @param pTimeout the specified timeout, in milliseconds. @return an input stream that reads from the socket connection, created from the given URL. @throws MalformedURLException if the url parameter specifies an unknown protocol, or does not form a valid URL. @throws UnknownHostException if the IP address for the given URL cannot be resolved. @throws FileNotFoundException if there is no file at the given URL. @throws IOException if an error occurs during transfer. @see #getInputStreamHttp(URL,int) @see java.net.Socket @see java.net.Socket#setSoTimeout(int) setSoTimeout @see java.io.InterruptedIOException @see <A href="http://www.w3.org/Protocols/rfc2616/rfc2616.html">RFC 2616</A>
[ "Gets", "the", "InputStream", "from", "a", "given", "URL", "with", "the", "given", "timeout", ".", "The", "timeout", "must", "be", ">", "0", ".", "A", "timeout", "of", "zero", "is", "interpreted", "as", "an", "infinite", "timeout", ".", "Supports", "basi...
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/NetUtil.java#L535-L537
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.createRegexEntityRoleWithServiceResponseAsync
public Observable<ServiceResponse<UUID>> createRegexEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID entityId, CreateRegexEntityRoleOptionalParameter createRegexEntityRoleOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } if (entityId == null) { throw new IllegalArgumentException("Parameter entityId is required and cannot be null."); } final String name = createRegexEntityRoleOptionalParameter != null ? createRegexEntityRoleOptionalParameter.name() : null; return createRegexEntityRoleWithServiceResponseAsync(appId, versionId, entityId, name); }
java
public Observable<ServiceResponse<UUID>> createRegexEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID entityId, CreateRegexEntityRoleOptionalParameter createRegexEntityRoleOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } if (entityId == null) { throw new IllegalArgumentException("Parameter entityId is required and cannot be null."); } final String name = createRegexEntityRoleOptionalParameter != null ? createRegexEntityRoleOptionalParameter.name() : null; return createRegexEntityRoleWithServiceResponseAsync(appId, versionId, entityId, name); }
[ "public", "Observable", "<", "ServiceResponse", "<", "UUID", ">", ">", "createRegexEntityRoleWithServiceResponseAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ",", "CreateRegexEntityRoleOptionalParameter", "createRegexEntityRoleOptionalPara...
Create an entity role for an entity in the application. @param appId The application ID. @param versionId The version ID. @param entityId The entity model ID. @param createRegexEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the UUID object
[ "Create", "an", "entity", "role", "for", "an", "entity", "in", "the", "application", "." ]
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#L8640-L8656
wellner/jcarafe
jcarafe-core/src/main/java/cern/colt/GenericSorting.java
GenericSorting.upper_bound
private static int upper_bound(int first, int last, int x, IntComparator comp) { //if (comp==null) throw new NullPointerException(); int len = last - first; while (len > 0) { int half = len / 2; int middle = first + half; if (comp.compare(x, middle)<0) { len = half; } else { first = middle + 1; len -= half + 1; } } return first; }
java
private static int upper_bound(int first, int last, int x, IntComparator comp) { //if (comp==null) throw new NullPointerException(); int len = last - first; while (len > 0) { int half = len / 2; int middle = first + half; if (comp.compare(x, middle)<0) { len = half; } else { first = middle + 1; len -= half + 1; } } return first; }
[ "private", "static", "int", "upper_bound", "(", "int", "first", ",", "int", "last", ",", "int", "x", ",", "IntComparator", "comp", ")", "{", "//if (comp==null) throw new NullPointerException();\r", "int", "len", "=", "last", "-", "first", ";", "while", "(", "l...
Performs a binary search on an already-sorted range: finds the last position where an element can be inserted without violating the ordering. Sorting is by a user-supplied comparison function. @param array Array containing the range. @param first Beginning of the range. @param last One past the end of the range. @param x Element to be searched for. @param comp Comparison function. @return The largest index i such that, for every j in the range <code>[first, i)</code>, <code>comp.apply(x, array[j])</code> is <code>false</code>. @see Sorting#lower_bound @see Sorting#equal_range @see Sorting#binary_search
[ "Performs", "a", "binary", "search", "on", "an", "already", "-", "sorted", "range", ":", "finds", "the", "last", "position", "where", "an", "element", "can", "be", "inserted", "without", "violating", "the", "ordering", ".", "Sorting", "is", "by", "a", "use...
train
https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/GenericSorting.java#L443-L458
primefaces-extensions/core
src/main/java/org/primefaces/extensions/component/sheet/Sheet.java
Sheet.getLocalValue
public Object getLocalValue(final String rowKey, final int col) { return localValues.get(new SheetRowColIndex(rowKey, col)); }
java
public Object getLocalValue(final String rowKey, final int col) { return localValues.get(new SheetRowColIndex(rowKey, col)); }
[ "public", "Object", "getLocalValue", "(", "final", "String", "rowKey", ",", "final", "int", "col", ")", "{", "return", "localValues", ".", "get", "(", "new", "SheetRowColIndex", "(", "rowKey", ",", "col", ")", ")", ";", "}" ]
Retrieves the submitted value for the rowKey and col. @param row @param col @return
[ "Retrieves", "the", "submitted", "value", "for", "the", "rowKey", "and", "col", "." ]
train
https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L302-L304
lucee/Lucee
core/src/main/java/lucee/runtime/op/date/DateCaster.java
DateCaster.toDateSimple
public static DateTime toDateSimple(String str, short convertingType, boolean alsoMonthString, TimeZone timeZone, DateTime defaultValue) { str = StringUtil.trim(str, ""); DateString ds = new DateString(str); // Timestamp if (ds.isCurrent('{') && ds.isLast('}')) { return _toDateSimpleTS(ds, timeZone, defaultValue); } DateTime res = parseDateTime(str, ds, convertingType, alsoMonthString, timeZone, defaultValue); if (res == defaultValue && Decision.isNumber(str)) { return numberToDate(timeZone, Caster.toDoubleValue(str, Double.NaN), convertingType, defaultValue); } return res; }
java
public static DateTime toDateSimple(String str, short convertingType, boolean alsoMonthString, TimeZone timeZone, DateTime defaultValue) { str = StringUtil.trim(str, ""); DateString ds = new DateString(str); // Timestamp if (ds.isCurrent('{') && ds.isLast('}')) { return _toDateSimpleTS(ds, timeZone, defaultValue); } DateTime res = parseDateTime(str, ds, convertingType, alsoMonthString, timeZone, defaultValue); if (res == defaultValue && Decision.isNumber(str)) { return numberToDate(timeZone, Caster.toDoubleValue(str, Double.NaN), convertingType, defaultValue); } return res; }
[ "public", "static", "DateTime", "toDateSimple", "(", "String", "str", ",", "short", "convertingType", ",", "boolean", "alsoMonthString", ",", "TimeZone", "timeZone", ",", "DateTime", "defaultValue", ")", "{", "str", "=", "StringUtil", ".", "trim", "(", "str", ...
converts the given string to a date following simple and fast parsing rules (no international formats) @param str @param convertingType one of the following values: - CONVERTING_TYPE_NONE: number are not converted at all - CONVERTING_TYPE_YEAR: integers are handled as years - CONVERTING_TYPE_OFFSET: numbers are handled as offset from 1899-12-30 00:00:00 UTC @param alsoMonthString allow that the month is defined as english word (jan,janauary ...) @param timeZone @param defaultValue @return
[ "converts", "the", "given", "string", "to", "a", "date", "following", "simple", "and", "fast", "parsing", "rules", "(", "no", "international", "formats", ")" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/date/DateCaster.java#L831-L844
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.addAnnotationInfo
public void addAnnotationInfo(Element element, Content htmltree) { addAnnotationInfo(element, element.getAnnotationMirrors(), htmltree); }
java
public void addAnnotationInfo(Element element, Content htmltree) { addAnnotationInfo(element, element.getAnnotationMirrors(), htmltree); }
[ "public", "void", "addAnnotationInfo", "(", "Element", "element", ",", "Content", "htmltree", ")", "{", "addAnnotationInfo", "(", "element", ",", "element", ".", "getAnnotationMirrors", "(", ")", ",", "htmltree", ")", ";", "}" ]
Adds the annotatation types for the given element. @param element the package to write annotations for @param htmltree the content tree to which the annotation types will be added
[ "Adds", "the", "annotatation", "types", "for", "the", "given", "element", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L2243-L2245
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/auth/policy/conditions/ConditionFactory.java
ConditionFactory.newRefererCondition
public static Condition newRefererCondition(StringComparisonType comparisonType, String value) { return new StringCondition(comparisonType, REFERER_CONDITION_KEY, value); }
java
public static Condition newRefererCondition(StringComparisonType comparisonType, String value) { return new StringCondition(comparisonType, REFERER_CONDITION_KEY, value); }
[ "public", "static", "Condition", "newRefererCondition", "(", "StringComparisonType", "comparisonType", ",", "String", "value", ")", "{", "return", "new", "StringCondition", "(", "comparisonType", ",", "REFERER_CONDITION_KEY", ",", "value", ")", ";", "}" ]
Constructs a new access control policy condition that tests the incoming request's referer field against the specified value, using the specified comparison type. @param comparisonType The type of string comparison to perform when testing an incoming request's referer field with the specified value. @param value The value against which to compare the incoming request's referer field. @return A new access control policy condition that tests an incoming request's referer field.
[ "Constructs", "a", "new", "access", "control", "policy", "condition", "that", "tests", "the", "incoming", "request", "s", "referer", "field", "against", "the", "specified", "value", "using", "the", "specified", "comparison", "type", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/auth/policy/conditions/ConditionFactory.java#L171-L173
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/PullFileLoader.java
PullFileLoader.loadAncestorGlobalConfigs
private Config loadAncestorGlobalConfigs(Path path, Config sysProps) throws IOException { Config config = sysProps; if (!PathUtils.isAncestor(this.rootDirectory, path)) { log.warn(String.format("Loaded path %s is not a descendant of root path %s. Cannot load global properties.", path, this.rootDirectory)); } else { List<Path> ancestorPaths = Lists.newArrayList(); while (PathUtils.isAncestor(this.rootDirectory, path)) { ancestorPaths.add(path); path = path.getParent(); } List<Path> reversedAncestors = Lists.reverse(ancestorPaths); for (Path ancestor : reversedAncestors) { config = findAndLoadGlobalConfigInDirectory(ancestor, config); } } return config; }
java
private Config loadAncestorGlobalConfigs(Path path, Config sysProps) throws IOException { Config config = sysProps; if (!PathUtils.isAncestor(this.rootDirectory, path)) { log.warn(String.format("Loaded path %s is not a descendant of root path %s. Cannot load global properties.", path, this.rootDirectory)); } else { List<Path> ancestorPaths = Lists.newArrayList(); while (PathUtils.isAncestor(this.rootDirectory, path)) { ancestorPaths.add(path); path = path.getParent(); } List<Path> reversedAncestors = Lists.reverse(ancestorPaths); for (Path ancestor : reversedAncestors) { config = findAndLoadGlobalConfigInDirectory(ancestor, config); } } return config; }
[ "private", "Config", "loadAncestorGlobalConfigs", "(", "Path", "path", ",", "Config", "sysProps", ")", "throws", "IOException", "{", "Config", "config", "=", "sysProps", ";", "if", "(", "!", "PathUtils", ".", "isAncestor", "(", "this", ".", "rootDirectory", ",...
Load at most one *.properties files from path and each ancestor of path up to and including {@link #rootDirectory}. Higher directories will serve as fallback for lower directories, and sysProps will serve as fallback for all of them. @throws IOException
[ "Load", "at", "most", "one", "*", ".", "properties", "files", "from", "path", "and", "each", "ancestor", "of", "path", "up", "to", "and", "including", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/PullFileLoader.java#L226-L246
Waikato/moa
moa/src/main/java/com/github/javacliparser/AbstractClassOption.java
AbstractClassOption.classToCLIString
public static String classToCLIString(Class<?> aClass, Class<?> requiredType) { String className = aClass.getName(); String packageName = requiredType.getPackage().getName(); if (className.startsWith(packageName)) { // cut off package name className = className.substring(packageName.length() + 1, className.length()); } /*else if (Task.class.isAssignableFrom(aClass)) { packageName = Task.class.getPackage().getName(); if (className.startsWith(packageName)) { // cut off task package name className = className.substring(packageName.length() + 1, className.length()); } }*/ return className; }
java
public static String classToCLIString(Class<?> aClass, Class<?> requiredType) { String className = aClass.getName(); String packageName = requiredType.getPackage().getName(); if (className.startsWith(packageName)) { // cut off package name className = className.substring(packageName.length() + 1, className.length()); } /*else if (Task.class.isAssignableFrom(aClass)) { packageName = Task.class.getPackage().getName(); if (className.startsWith(packageName)) { // cut off task package name className = className.substring(packageName.length() + 1, className.length()); } }*/ return className; }
[ "public", "static", "String", "classToCLIString", "(", "Class", "<", "?", ">", "aClass", ",", "Class", "<", "?", ">", "requiredType", ")", "{", "String", "className", "=", "aClass", ".", "getName", "(", ")", ";", "String", "packageName", "=", "requiredType...
Gets the command line interface text of the class. @param aClass the class @param requiredType the class type @return the command line interface text of the class
[ "Gets", "the", "command", "line", "interface", "text", "of", "the", "class", "." ]
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/github/javacliparser/AbstractClassOption.java#L188-L203
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShipmentPersistenceImpl.java
CommerceShipmentPersistenceImpl.findByGroupId
@Override public List<CommerceShipment> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
java
@Override public List<CommerceShipment> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceShipment", ">", "findByGroupId", "(", "long", "groupId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the commerce shipments where groupId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceShipmentModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param groupId the group ID @param start the lower bound of the range of commerce shipments @param end the upper bound of the range of commerce shipments (not inclusive) @return the range of matching commerce shipments
[ "Returns", "a", "range", "of", "all", "the", "commerce", "shipments", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShipmentPersistenceImpl.java#L139-L142
AgNO3/jcifs-ng
src/main/java/jcifs/smb/NtlmPasswordAuthenticator.java
NtlmPasswordAuthenticator.getUserSessionKey
public void getUserSessionKey ( CIFSContext tc, byte[] chlng, byte[] dest, int offset ) throws SmbException { try { MessageDigest md4 = Crypto.getMD4(); md4.update(Strings.getUNIBytes(this.password)); switch ( tc.getConfig().getLanManCompatibility() ) { case 0: case 1: case 2: md4.update(md4.digest()); md4.digest(dest, offset, 16); break; case 3: case 4: case 5: synchronized ( this ) { if ( this.clientChallenge == null ) { this.clientChallenge = new byte[8]; tc.getConfig().getRandom().nextBytes(this.clientChallenge); } } MessageDigest hmac = Crypto.getHMACT64(md4.digest()); hmac.update(Strings.getUNIBytes(this.username.toUpperCase())); hmac.update(Strings.getUNIBytes(this.domain.toUpperCase())); byte[] ntlmv2Hash = hmac.digest(); hmac = Crypto.getHMACT64(ntlmv2Hash); hmac.update(chlng); hmac.update(this.clientChallenge); MessageDigest userKey = Crypto.getHMACT64(ntlmv2Hash); userKey.update(hmac.digest()); userKey.digest(dest, offset, 16); break; default: md4.update(md4.digest()); md4.digest(dest, offset, 16); break; } } catch ( Exception e ) { throw new SmbException("", e); } }
java
public void getUserSessionKey ( CIFSContext tc, byte[] chlng, byte[] dest, int offset ) throws SmbException { try { MessageDigest md4 = Crypto.getMD4(); md4.update(Strings.getUNIBytes(this.password)); switch ( tc.getConfig().getLanManCompatibility() ) { case 0: case 1: case 2: md4.update(md4.digest()); md4.digest(dest, offset, 16); break; case 3: case 4: case 5: synchronized ( this ) { if ( this.clientChallenge == null ) { this.clientChallenge = new byte[8]; tc.getConfig().getRandom().nextBytes(this.clientChallenge); } } MessageDigest hmac = Crypto.getHMACT64(md4.digest()); hmac.update(Strings.getUNIBytes(this.username.toUpperCase())); hmac.update(Strings.getUNIBytes(this.domain.toUpperCase())); byte[] ntlmv2Hash = hmac.digest(); hmac = Crypto.getHMACT64(ntlmv2Hash); hmac.update(chlng); hmac.update(this.clientChallenge); MessageDigest userKey = Crypto.getHMACT64(ntlmv2Hash); userKey.update(hmac.digest()); userKey.digest(dest, offset, 16); break; default: md4.update(md4.digest()); md4.digest(dest, offset, 16); break; } } catch ( Exception e ) { throw new SmbException("", e); } }
[ "public", "void", "getUserSessionKey", "(", "CIFSContext", "tc", ",", "byte", "[", "]", "chlng", ",", "byte", "[", "]", "dest", ",", "int", "offset", ")", "throws", "SmbException", "{", "try", "{", "MessageDigest", "md4", "=", "Crypto", ".", "getMD4", "(...
Calculates the effective user session key. @param tc context to use @param chlng The server challenge. @param dest The destination array in which the user session key will be placed. @param offset The offset in the destination array at which the session key will start. @throws SmbException
[ "Calculates", "the", "effective", "user", "session", "key", "." ]
train
https://github.com/AgNO3/jcifs-ng/blob/0311107a077ea372527ae74839eec8042197332f/src/main/java/jcifs/smb/NtlmPasswordAuthenticator.java#L495-L536
ReactiveX/RxNetty
rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/sse/ServerSentEvent.java
ServerSentEvent.withEventType
public static ServerSentEvent withEventType(ByteBuf eventType, ByteBuf data) { return new ServerSentEvent(null, eventType, data); }
java
public static ServerSentEvent withEventType(ByteBuf eventType, ByteBuf data) { return new ServerSentEvent(null, eventType, data); }
[ "public", "static", "ServerSentEvent", "withEventType", "(", "ByteBuf", "eventType", ",", "ByteBuf", "data", ")", "{", "return", "new", "ServerSentEvent", "(", "null", ",", "eventType", ",", "data", ")", ";", "}" ]
Creates a {@link ServerSentEvent} instance with an event type. @param eventType Type for the event. @param data Data for the event. @return The {@link ServerSentEvent} instance.
[ "Creates", "a", "{", "@link", "ServerSentEvent", "}", "instance", "with", "an", "event", "type", "." ]
train
https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/sse/ServerSentEvent.java#L264-L266
HeidelTime/heideltime
src/de/unihd/dbs/uima/consumer/eventi2014writer/Eventi2014Writer.java
Eventi2014Writer.writeDocument
private void writeDocument(String fullDocument, String filename) { // create output file handle File outFile = new File(mOutputDir, filename+".xml"); BufferedWriter bw = null; try { // create a buffered writer for the output file bw = new BufferedWriter(new FileWriter(outFile)); bw.append(fullDocument); } catch (IOException e) { // something went wrong with the bufferedwriter e.printStackTrace(); Logger.printError(component, "File "+outFile.getAbsolutePath()+" could not be written."); } finally { // clean up for the bufferedwriter try { bw.close(); } catch(IOException e) { e.printStackTrace(); Logger.printError(component, "File "+outFile.getAbsolutePath()+" could not be closed."); } } }
java
private void writeDocument(String fullDocument, String filename) { // create output file handle File outFile = new File(mOutputDir, filename+".xml"); BufferedWriter bw = null; try { // create a buffered writer for the output file bw = new BufferedWriter(new FileWriter(outFile)); bw.append(fullDocument); } catch (IOException e) { // something went wrong with the bufferedwriter e.printStackTrace(); Logger.printError(component, "File "+outFile.getAbsolutePath()+" could not be written."); } finally { // clean up for the bufferedwriter try { bw.close(); } catch(IOException e) { e.printStackTrace(); Logger.printError(component, "File "+outFile.getAbsolutePath()+" could not be closed."); } } }
[ "private", "void", "writeDocument", "(", "String", "fullDocument", ",", "String", "filename", ")", "{", "// create output file handle", "File", "outFile", "=", "new", "File", "(", "mOutputDir", ",", "filename", "+", "\".xml\"", ")", ";", "BufferedWriter", "bw", ...
writes a populated DOM xml(timeml) document to a given directory/file @param xmlDoc xml dom object @param filename name of the file that gets appended to the set output path
[ "writes", "a", "populated", "DOM", "xml", "(", "timeml", ")", "document", "to", "a", "given", "directory", "/", "file" ]
train
https://github.com/HeidelTime/heideltime/blob/4ef5002eb5ecfeb818086ff7e394e792ee360335/src/de/unihd/dbs/uima/consumer/eventi2014writer/Eventi2014Writer.java#L226-L247
killbill/killbill
invoice/src/main/java/org/killbill/billing/invoice/tree/SubscriptionItemTree.java
SubscriptionItemTree.addItem
public void addItem(final InvoiceItem invoiceItem) { Preconditions.checkState(!isBuilt, "Tree already built, unable to add new invoiceItem=%s", invoiceItem); switch (invoiceItem.getInvoiceItemType()) { case RECURRING: if (invoiceItem.getAmount().compareTo(BigDecimal.ZERO) == 0) { // Nothing to repair -- https://github.com/killbill/killbill/issues/783 existingIgnoredItems.add(invoiceItem); } else { root.addExistingItem(new ItemsNodeInterval(root, new Item(invoiceItem, targetInvoiceId, ItemAction.ADD))); } break; case REPAIR_ADJ: root.addExistingItem(new ItemsNodeInterval(root, new Item(invoiceItem, targetInvoiceId, ItemAction.CANCEL))); break; case FIXED: existingIgnoredItems.add(invoiceItem); break; case ITEM_ADJ: pendingItemAdj.add(invoiceItem); break; default: break; } }
java
public void addItem(final InvoiceItem invoiceItem) { Preconditions.checkState(!isBuilt, "Tree already built, unable to add new invoiceItem=%s", invoiceItem); switch (invoiceItem.getInvoiceItemType()) { case RECURRING: if (invoiceItem.getAmount().compareTo(BigDecimal.ZERO) == 0) { // Nothing to repair -- https://github.com/killbill/killbill/issues/783 existingIgnoredItems.add(invoiceItem); } else { root.addExistingItem(new ItemsNodeInterval(root, new Item(invoiceItem, targetInvoiceId, ItemAction.ADD))); } break; case REPAIR_ADJ: root.addExistingItem(new ItemsNodeInterval(root, new Item(invoiceItem, targetInvoiceId, ItemAction.CANCEL))); break; case FIXED: existingIgnoredItems.add(invoiceItem); break; case ITEM_ADJ: pendingItemAdj.add(invoiceItem); break; default: break; } }
[ "public", "void", "addItem", "(", "final", "InvoiceItem", "invoiceItem", ")", "{", "Preconditions", ".", "checkState", "(", "!", "isBuilt", ",", "\"Tree already built, unable to add new invoiceItem=%s\"", ",", "invoiceItem", ")", ";", "switch", "(", "invoiceItem", "."...
Add an existing item in the tree. A new node is inserted or an existing one updated, if one for the same period already exists. @param invoiceItem new existing invoice item on disk.
[ "Add", "an", "existing", "item", "in", "the", "tree", ".", "A", "new", "node", "is", "inserted", "or", "an", "existing", "one", "updated", "if", "one", "for", "the", "same", "period", "already", "exists", "." ]
train
https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/invoice/src/main/java/org/killbill/billing/invoice/tree/SubscriptionItemTree.java#L90-L118
openengsb/openengsb
ui/common/src/main/java/org/openengsb/ui/common/editor/AttributeEditorUtil.java
AttributeEditorUtil.createFieldList
public static RepeatingView createFieldList(String id, Class<?> bean, Map<String, String> values) { List<AttributeDefinition> attributes = MethodUtil.buildAttributesList(bean); return createFieldList(id, attributes, values); }
java
public static RepeatingView createFieldList(String id, Class<?> bean, Map<String, String> values) { List<AttributeDefinition> attributes = MethodUtil.buildAttributesList(bean); return createFieldList(id, attributes, values); }
[ "public", "static", "RepeatingView", "createFieldList", "(", "String", "id", ",", "Class", "<", "?", ">", "bean", ",", "Map", "<", "String", ",", "String", ">", "values", ")", "{", "List", "<", "AttributeDefinition", ">", "attributes", "=", "MethodUtil", "...
creates a RepeatingView providing a suitable editor field for every property. @param values map used for saving the data @see org.openengsb.ui.common.wicket.model.MapModel
[ "creates", "a", "RepeatingView", "providing", "a", "suitable", "editor", "field", "for", "every", "property", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/ui/common/src/main/java/org/openengsb/ui/common/editor/AttributeEditorUtil.java#L53-L56
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java
PolylineSplitMerge.findInitialTriangle
boolean findInitialTriangle(List<Point2D_I32> contour) { // find the first estimate for a corner int cornerSeed = findCornerSeed(contour); // see if it can reject the contour immediately if( convex ) { if( !isConvexUsingMaxDistantPoints(contour,0,cornerSeed)) return false; } // Select the second corner. splitter.selectSplitPoint(contour,0,cornerSeed,resultsA); splitter.selectSplitPoint(contour,cornerSeed,0,resultsB); if( splitter.compareScore(resultsA.score,resultsB.score) >= 0 ) { addCorner(resultsA.index); addCorner(cornerSeed); } else { addCorner(cornerSeed); addCorner(resultsB.index); } // Select the third corner. Initial triangle will be complete now // the third corner will be the one which maximizes the distance from the first two int index0 = list.getHead().object.index; int index1 = list.getHead().next.object.index; int index2 = maximumDistance(contour,index0,index1); addCorner(index2); // enforce CCW requirement ensureTriangleOrder(contour); return initializeScore(contour, true); }
java
boolean findInitialTriangle(List<Point2D_I32> contour) { // find the first estimate for a corner int cornerSeed = findCornerSeed(contour); // see if it can reject the contour immediately if( convex ) { if( !isConvexUsingMaxDistantPoints(contour,0,cornerSeed)) return false; } // Select the second corner. splitter.selectSplitPoint(contour,0,cornerSeed,resultsA); splitter.selectSplitPoint(contour,cornerSeed,0,resultsB); if( splitter.compareScore(resultsA.score,resultsB.score) >= 0 ) { addCorner(resultsA.index); addCorner(cornerSeed); } else { addCorner(cornerSeed); addCorner(resultsB.index); } // Select the third corner. Initial triangle will be complete now // the third corner will be the one which maximizes the distance from the first two int index0 = list.getHead().object.index; int index1 = list.getHead().next.object.index; int index2 = maximumDistance(contour,index0,index1); addCorner(index2); // enforce CCW requirement ensureTriangleOrder(contour); return initializeScore(contour, true); }
[ "boolean", "findInitialTriangle", "(", "List", "<", "Point2D_I32", ">", "contour", ")", "{", "// find the first estimate for a corner", "int", "cornerSeed", "=", "findCornerSeed", "(", "contour", ")", ";", "// see if it can reject the contour immediately", "if", "(", "con...
Select an initial triangle. A good initial triangle is needed. By good it should minimize the error of the contour from each side
[ "Select", "an", "initial", "triangle", ".", "A", "good", "initial", "triangle", "is", "needed", ".", "By", "good", "it", "should", "minimize", "the", "error", "of", "the", "contour", "from", "each", "side" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java#L309-L342
Stratio/stratio-cassandra
src/java/org/apache/cassandra/serializers/MapSerializer.java
MapSerializer.getSerializedValue
public ByteBuffer getSerializedValue(ByteBuffer serializedMap, ByteBuffer serializedKey, AbstractType keyType) { try { ByteBuffer input = serializedMap.duplicate(); int n = readCollectionSize(input, Server.VERSION_3); for (int i = 0; i < n; i++) { ByteBuffer kbb = readValue(input, Server.VERSION_3); ByteBuffer vbb = readValue(input, Server.VERSION_3); int comparison = keyType.compare(kbb, serializedKey); if (comparison == 0) return vbb; else if (comparison > 0) // since the map is in sorted order, we know we've gone too far and the element doesn't exist return null; } return null; } catch (BufferUnderflowException e) { throw new MarshalException("Not enough bytes to read a map"); } }
java
public ByteBuffer getSerializedValue(ByteBuffer serializedMap, ByteBuffer serializedKey, AbstractType keyType) { try { ByteBuffer input = serializedMap.duplicate(); int n = readCollectionSize(input, Server.VERSION_3); for (int i = 0; i < n; i++) { ByteBuffer kbb = readValue(input, Server.VERSION_3); ByteBuffer vbb = readValue(input, Server.VERSION_3); int comparison = keyType.compare(kbb, serializedKey); if (comparison == 0) return vbb; else if (comparison > 0) // since the map is in sorted order, we know we've gone too far and the element doesn't exist return null; } return null; } catch (BufferUnderflowException e) { throw new MarshalException("Not enough bytes to read a map"); } }
[ "public", "ByteBuffer", "getSerializedValue", "(", "ByteBuffer", "serializedMap", ",", "ByteBuffer", "serializedKey", ",", "AbstractType", "keyType", ")", "{", "try", "{", "ByteBuffer", "input", "=", "serializedMap", ".", "duplicate", "(", ")", ";", "int", "n", ...
Given a serialized map, gets the value associated with a given key. @param serializedMap a serialized map @param serializedKey a serialized key @param keyType the key type for the map @return the value associated with the key if one exists, null otherwise
[ "Given", "a", "serialized", "map", "gets", "the", "value", "associated", "with", "a", "given", "key", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/serializers/MapSerializer.java#L126-L149
pwittchen/kirai
src/main/java/com/github/pwittchen/kirai/library/Preconditions.java
Preconditions.checkNotEmpty
public static void checkNotEmpty(CharSequence str, String message) { if (str == null || str.length() == 0) { throw new IllegalArgumentException(message); } }
java
public static void checkNotEmpty(CharSequence str, String message) { if (str == null || str.length() == 0) { throw new IllegalArgumentException(message); } }
[ "public", "static", "void", "checkNotEmpty", "(", "CharSequence", "str", ",", "String", "message", ")", "{", "if", "(", "str", "==", "null", "||", "str", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "mess...
Throws an exception with a message, when CharSequence is null @param str is a CharSequence to examine @param message for IllegalArgumentException
[ "Throws", "an", "exception", "with", "a", "message", "when", "CharSequence", "is", "null" ]
train
https://github.com/pwittchen/kirai/blob/0b8080a1f28c1e068a00e5bd2804dc3d2fb3c334/src/main/java/com/github/pwittchen/kirai/library/Preconditions.java#L25-L29
liyiorg/weixin-popular
src/main/java/weixin/popular/api/MessageAPI.java
MessageAPI.messageTemplateSend
public static TemplateMessageResult messageTemplateSend(String access_token, TemplateMessage templateMessage) { String messageJson = JsonUtil.toJSONString(templateMessage); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI + "/cgi-bin/message/template/send") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity(messageJson, Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest, TemplateMessageResult.class); }
java
public static TemplateMessageResult messageTemplateSend(String access_token, TemplateMessage templateMessage) { String messageJson = JsonUtil.toJSONString(templateMessage); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI + "/cgi-bin/message/template/send") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity(messageJson, Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest, TemplateMessageResult.class); }
[ "public", "static", "TemplateMessageResult", "messageTemplateSend", "(", "String", "access_token", ",", "TemplateMessage", "templateMessage", ")", "{", "String", "messageJson", "=", "JsonUtil", ".", "toJSONString", "(", "templateMessage", ")", ";", "HttpUriRequest", "ht...
模板消息发送 <p> <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751277">微信模板消息文档</a> @param access_token access_token @param templateMessage templateMessage @return TemplateMessageResult
[ "模板消息发送", "<p", ">", "<a", "href", "=", "https", ":", "//", "mp", ".", "weixin", ".", "qq", ".", "com", "/", "wiki?t", "=", "resource", "/", "res_main&id", "=", "mp1433751277", ">", "微信模板消息文档<", "/", "a", ">" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/MessageAPI.java#L274-L283
calrissian/mango
mango-core/src/main/java/org/calrissian/mango/collect/CloseableIterables.java
CloseableIterables.fromStream
public static <T> CloseableIterable<T> fromStream(Stream<T> stream) { return wrap(stream::iterator, stream); }
java
public static <T> CloseableIterable<T> fromStream(Stream<T> stream) { return wrap(stream::iterator, stream); }
[ "public", "static", "<", "T", ">", "CloseableIterable", "<", "T", ">", "fromStream", "(", "Stream", "<", "T", ">", "stream", ")", "{", "return", "wrap", "(", "stream", "::", "iterator", ",", "stream", ")", ";", "}" ]
Creates a {@link CloseableIterable} from a standard {@link Stream}.
[ "Creates", "a", "{" ]
train
https://github.com/calrissian/mango/blob/a95aa5e77af9aa0e629787228d80806560023452/mango-core/src/main/java/org/calrissian/mango/collect/CloseableIterables.java#L53-L55
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WFieldSet.java
WFieldSet.setMandatory
public void setMandatory(final boolean mandatory, final String message) { setFlag(ComponentModel.MANDATORY_FLAG, mandatory); getOrCreateComponentModel().errorMessage = message; }
java
public void setMandatory(final boolean mandatory, final String message) { setFlag(ComponentModel.MANDATORY_FLAG, mandatory); getOrCreateComponentModel().errorMessage = message; }
[ "public", "void", "setMandatory", "(", "final", "boolean", "mandatory", ",", "final", "String", "message", ")", "{", "setFlag", "(", "ComponentModel", ".", "MANDATORY_FLAG", ",", "mandatory", ")", ";", "getOrCreateComponentModel", "(", ")", ".", "errorMessage", ...
Set whether or not this field set is mandatory, and customise the error message that will be displayed. @param mandatory true for mandatory, false for optional. @param message the message to display to the user on mandatory validation failure.
[ "Set", "whether", "or", "not", "this", "field", "set", "is", "mandatory", "and", "customise", "the", "error", "message", "that", "will", "be", "displayed", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WFieldSet.java#L110-L113
h2oai/h2o-2
src/main/java/water/exec/Env.java
Env.frId
public Frame frId(int d, int n) { int idx = _display[_tod-d]+n; assert _ary[idx]!=null; return _ary[idx]; }
java
public Frame frId(int d, int n) { int idx = _display[_tod-d]+n; assert _ary[idx]!=null; return _ary[idx]; }
[ "public", "Frame", "frId", "(", "int", "d", ",", "int", "n", ")", "{", "int", "idx", "=", "_display", "[", "_tod", "-", "d", "]", "+", "n", ";", "assert", "_ary", "[", "idx", "]", "!=", "null", ";", "return", "_ary", "[", "idx", "]", ";", "}"...
Load the nth Id/variable from the named lexical scope, typed as a Frame
[ "Load", "the", "nth", "Id", "/", "variable", "from", "the", "named", "lexical", "scope", "typed", "as", "a", "Frame" ]
train
https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/exec/Env.java#L76-L80
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/Configurer.java
Configurer.getNode
private Xml getNode(String... path) { Xml node = root; for (final String element : path) { try { node = node.getChild(element); } catch (final LionEngineException exception) { throw new LionEngineException(exception, media); } } return node; }
java
private Xml getNode(String... path) { Xml node = root; for (final String element : path) { try { node = node.getChild(element); } catch (final LionEngineException exception) { throw new LionEngineException(exception, media); } } return node; }
[ "private", "Xml", "getNode", "(", "String", "...", "path", ")", "{", "Xml", "node", "=", "root", ";", "for", "(", "final", "String", "element", ":", "path", ")", "{", "try", "{", "node", "=", "node", ".", "getChild", "(", "element", ")", ";", "}", ...
Get the node at the following path. @param path The node path. @return The node found. @throws LionEngineException If node not found.
[ "Get", "the", "node", "at", "the", "following", "path", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/Configurer.java#L447-L462
UrielCh/ovh-java-sdk
ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java
ApiOvhSms.serviceName_receivers_slotId_PUT
public void serviceName_receivers_slotId_PUT(String serviceName, Long slotId, OvhReceiver body) throws IOException { String qPath = "/sms/{serviceName}/receivers/{slotId}"; StringBuilder sb = path(qPath, serviceName, slotId); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_receivers_slotId_PUT(String serviceName, Long slotId, OvhReceiver body) throws IOException { String qPath = "/sms/{serviceName}/receivers/{slotId}"; StringBuilder sb = path(qPath, serviceName, slotId); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_receivers_slotId_PUT", "(", "String", "serviceName", ",", "Long", "slotId", ",", "OvhReceiver", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/sms/{serviceName}/receivers/{slotId}\"", ";", "StringBuilder", "sb", "="...
Alter this object properties REST: PUT /sms/{serviceName}/receivers/{slotId} @param body [required] New object properties @param serviceName [required] The internal name of your SMS offer @param slotId [required] Slot number id
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L560-L564
CubeEngine/Dirigent
src/main/java/org/cubeengine/dirigent/AbstractDirigent.java
AbstractDirigent.applyPostProcessors
private Component applyPostProcessors(Component in, Context context, Arguments args) { Component out = in; for (final PostProcessor postProcessor : postProcessors) { out = postProcessor.process(out, context, args); } return out; }
java
private Component applyPostProcessors(Component in, Context context, Arguments args) { Component out = in; for (final PostProcessor postProcessor : postProcessors) { out = postProcessor.process(out, context, args); } return out; }
[ "private", "Component", "applyPostProcessors", "(", "Component", "in", ",", "Context", "context", ",", "Arguments", "args", ")", "{", "Component", "out", "=", "in", ";", "for", "(", "final", "PostProcessor", "postProcessor", ":", "postProcessors", ")", "{", "o...
Executes all attached {@link PostProcessor}s to process the specified {@link Component}. @param in The component to process. @param context The compose context. @param args The macro arguments. @return The processed component.
[ "Executes", "all", "attached", "{", "@link", "PostProcessor", "}", "s", "to", "process", "the", "specified", "{", "@link", "Component", "}", "." ]
train
https://github.com/CubeEngine/Dirigent/blob/68587a8202754a6a6b629cc15e14c516806badaa/src/main/java/org/cubeengine/dirigent/AbstractDirigent.java#L254-L264
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/atomic/AtomicStampedReference.java
AtomicStampedReference.attemptStamp
public boolean attemptStamp(V expectedReference, int newStamp) { Pair<V> current = pair; return expectedReference == current.reference && (newStamp == current.stamp || casPair(current, Pair.of(expectedReference, newStamp))); }
java
public boolean attemptStamp(V expectedReference, int newStamp) { Pair<V> current = pair; return expectedReference == current.reference && (newStamp == current.stamp || casPair(current, Pair.of(expectedReference, newStamp))); }
[ "public", "boolean", "attemptStamp", "(", "V", "expectedReference", ",", "int", "newStamp", ")", "{", "Pair", "<", "V", ">", "current", "=", "pair", ";", "return", "expectedReference", "==", "current", ".", "reference", "&&", "(", "newStamp", "==", "current"...
Atomically sets the value of the stamp to the given update value if the current reference is {@code ==} to the expected reference. Any given invocation of this operation may fail (return {@code false}) spuriously, but repeated invocation when the current value holds the expected value and no other thread is also attempting to set the value will eventually succeed. @param expectedReference the expected value of the reference @param newStamp the new value for the stamp @return {@code true} if successful
[ "Atomically", "sets", "the", "value", "of", "the", "stamp", "to", "the", "given", "update", "value", "if", "the", "current", "reference", "is", "{", "@code", "==", "}", "to", "the", "expected", "reference", ".", "Any", "given", "invocation", "of", "this", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/atomic/AtomicStampedReference.java#L183-L189
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java
FieldUtils.getField
public static Field getField(final Class<?> cls, final String fieldName) { final Field field = getField(cls, fieldName, false); MemberUtils.setAccessibleWorkaround(field); return field; }
java
public static Field getField(final Class<?> cls, final String fieldName) { final Field field = getField(cls, fieldName, false); MemberUtils.setAccessibleWorkaround(field); return field; }
[ "public", "static", "Field", "getField", "(", "final", "Class", "<", "?", ">", "cls", ",", "final", "String", "fieldName", ")", "{", "final", "Field", "field", "=", "getField", "(", "cls", ",", "fieldName", ",", "false", ")", ";", "MemberUtils", ".", "...
Gets an accessible {@link Field} by name respecting scope. Superclasses/interfaces will be considered. @param cls the {@link Class} to reflect, must not be {@code null} @param fieldName the field name to obtain @return the Field object @throws IllegalArgumentException if the class is {@code null}, or the field name is blank or empty
[ "Gets", "an", "accessible", "{", "@link", "Field", "}", "by", "name", "respecting", "scope", ".", "Superclasses", "/", "interfaces", "will", "be", "considered", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java#L65-L69
snowflakedb/snowflake-jdbc
src/main/java/net/snowflake/client/core/SFStatement.java
SFStatement.getMoreResults
public boolean getMoreResults(int current) throws SQLException { // clean up current result, if exists if (resultSet != null && (current == Statement.CLOSE_CURRENT_RESULT || current == Statement.CLOSE_ALL_RESULTS)) { resultSet.close(); } resultSet = null; // verify if more results exist if (childResults == null || childResults.isEmpty()) { return false; } // fetch next result using the query id SFChildResult nextResult = childResults.remove(0); try { JsonNode result = StmtUtil.getQueryResultJSON( nextResult.getId(), session); Object sortProperty = session.getSFSessionProperty("sort"); boolean sortResult = sortProperty != null && (Boolean) sortProperty; resultSet = new SFResultSet(result, this, sortResult); // override statement type so we can treat the result set like a result of // the original statement called (and not the result scan) resultSet.setStatementType(nextResult.getType()); return nextResult.getType().isGenerateResultSet(); } catch (SFException ex) { throw new SnowflakeSQLException(ex); } }
java
public boolean getMoreResults(int current) throws SQLException { // clean up current result, if exists if (resultSet != null && (current == Statement.CLOSE_CURRENT_RESULT || current == Statement.CLOSE_ALL_RESULTS)) { resultSet.close(); } resultSet = null; // verify if more results exist if (childResults == null || childResults.isEmpty()) { return false; } // fetch next result using the query id SFChildResult nextResult = childResults.remove(0); try { JsonNode result = StmtUtil.getQueryResultJSON( nextResult.getId(), session); Object sortProperty = session.getSFSessionProperty("sort"); boolean sortResult = sortProperty != null && (Boolean) sortProperty; resultSet = new SFResultSet(result, this, sortResult); // override statement type so we can treat the result set like a result of // the original statement called (and not the result scan) resultSet.setStatementType(nextResult.getType()); return nextResult.getType().isGenerateResultSet(); } catch (SFException ex) { throw new SnowflakeSQLException(ex); } }
[ "public", "boolean", "getMoreResults", "(", "int", "current", ")", "throws", "SQLException", "{", "// clean up current result, if exists", "if", "(", "resultSet", "!=", "null", "&&", "(", "current", "==", "Statement", ".", "CLOSE_CURRENT_RESULT", "||", "current", "=...
Sets the result set to the next one, if available. @param current What to do with the current result. One of Statement.CLOSE_CURRENT_RESULT, Statement.CLOSE_ALL_RESULTS, or Statement.KEEP_CURRENT_RESULT @return true if there is a next result and it's a result set false if there are no more results, or there is a next result and it's an update count @throws SQLException if something fails while getting the next result
[ "Sets", "the", "result", "set", "to", "the", "next", "one", "if", "available", "." ]
train
https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFStatement.java#L877-L913
Azure/azure-sdk-for-java
network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/VirtualHubsInner.java
VirtualHubsInner.beginUpdateTags
public VirtualHubInner beginUpdateTags(String resourceGroupName, String virtualHubName, Map<String, String> tags) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, virtualHubName, tags).toBlocking().single().body(); }
java
public VirtualHubInner beginUpdateTags(String resourceGroupName, String virtualHubName, Map<String, String> tags) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, virtualHubName, tags).toBlocking().single().body(); }
[ "public", "VirtualHubInner", "beginUpdateTags", "(", "String", "resourceGroupName", ",", "String", "virtualHubName", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "beginUpdateTagsWithServiceResponseAsync", "(", "resourceGroupName", ",", "v...
Updates VirtualHub tags. @param resourceGroupName The resource group name of the VirtualHub. @param virtualHubName The name of the VirtualHub. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VirtualHubInner object if successful.
[ "Updates", "VirtualHub", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/VirtualHubsInner.java#L602-L604
icode/ameba
src/main/java/ameba/db/ebean/internal/ModelInterceptor.java
ModelInterceptor.applyFilter
public static <T> void applyFilter(MultivaluedMap<String, String> queryParams, SpiQuery<T> query, InjectionManager manager) { List<String> wheres = queryParams.get(FILTER_PARAM_NAME); if (wheres != null && wheres.size() > 0) { EbeanExprInvoker invoker = new EbeanExprInvoker(query, manager); WhereExprApplier<T> applier = WhereExprApplier.create(query.where()); for (String w : wheres) { QueryDSL.invoke( w, invoker, applier ); } } }
java
public static <T> void applyFilter(MultivaluedMap<String, String> queryParams, SpiQuery<T> query, InjectionManager manager) { List<String> wheres = queryParams.get(FILTER_PARAM_NAME); if (wheres != null && wheres.size() > 0) { EbeanExprInvoker invoker = new EbeanExprInvoker(query, manager); WhereExprApplier<T> applier = WhereExprApplier.create(query.where()); for (String w : wheres) { QueryDSL.invoke( w, invoker, applier ); } } }
[ "public", "static", "<", "T", ">", "void", "applyFilter", "(", "MultivaluedMap", "<", "String", ",", "String", ">", "queryParams", ",", "SpiQuery", "<", "T", ">", "query", ",", "InjectionManager", "manager", ")", "{", "List", "<", "String", ">", "wheres", ...
/path?filter=p.in(1,2)c.eq('ddd')d.startWith('a')or(f.eq('a')g.startWith(2)) @param queryParams uri query params @param query query @param manager a {@link InjectionManager} object. @param <T> a T object.
[ "/", "path?filter", "=", "p", ".", "in", "(", "1", "2", ")", "c", ".", "eq", "(", "ddd", ")", "d", ".", "startWith", "(", "a", ")", "or", "(", "f", ".", "eq", "(", "a", ")", "g", ".", "startWith", "(", "2", "))" ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/internal/ModelInterceptor.java#L319-L334
Azure/azure-sdk-for-java
notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java
NotificationHubsInner.createOrUpdateAsync
public Observable<NotificationHubResourceInner> createOrUpdateAsync(String resourceGroupName, String namespaceName, String notificationHubName, NotificationHubCreateOrUpdateParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName, parameters).map(new Func1<ServiceResponse<NotificationHubResourceInner>, NotificationHubResourceInner>() { @Override public NotificationHubResourceInner call(ServiceResponse<NotificationHubResourceInner> response) { return response.body(); } }); }
java
public Observable<NotificationHubResourceInner> createOrUpdateAsync(String resourceGroupName, String namespaceName, String notificationHubName, NotificationHubCreateOrUpdateParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName, parameters).map(new Func1<ServiceResponse<NotificationHubResourceInner>, NotificationHubResourceInner>() { @Override public NotificationHubResourceInner call(ServiceResponse<NotificationHubResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "NotificationHubResourceInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "namespaceName", ",", "String", "notificationHubName", ",", "NotificationHubCreateOrUpdateParameters", "parameters", ")", "{", "return",...
Creates/Update a NotificationHub in a namespace. @param resourceGroupName The name of the resource group. @param namespaceName The namespace name. @param notificationHubName The notification hub name. @param parameters Parameters supplied to the create/update a NotificationHub Resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the NotificationHubResourceInner object
[ "Creates", "/", "Update", "a", "NotificationHub", "in", "a", "namespace", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java#L273-L280
kaazing/gateway
service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/HttpDirectoryService.java
HttpDirectoryService.toFile
private File toFile(File rootDir, String location) { File locationFile = rootDir; if (location != null) { URI locationURI = URI.create(location); locationFile = new File(locationURI.getPath()); if (locationURI.getScheme() == null) { locationFile = new File(rootDir, location); } else if (!"file".equals(locationURI.getScheme())) { throw new IllegalArgumentException("Unexpected resources directory: " + location); } } return locationFile; }
java
private File toFile(File rootDir, String location) { File locationFile = rootDir; if (location != null) { URI locationURI = URI.create(location); locationFile = new File(locationURI.getPath()); if (locationURI.getScheme() == null) { locationFile = new File(rootDir, location); } else if (!"file".equals(locationURI.getScheme())) { throw new IllegalArgumentException("Unexpected resources directory: " + location); } } return locationFile; }
[ "private", "File", "toFile", "(", "File", "rootDir", ",", "String", "location", ")", "{", "File", "locationFile", "=", "rootDir", ";", "if", "(", "location", "!=", "null", ")", "{", "URI", "locationURI", "=", "URI", ".", "create", "(", "location", ")", ...
Converts a location in the gateway configuration file into a file relative to a specified root directory. @param rootDir the root directory @param location the location (either a file:// URI or a location relative the root directory @return the file corresponding to the location
[ "Converts", "a", "location", "in", "the", "gateway", "configuration", "file", "into", "a", "file", "relative", "to", "a", "specified", "root", "directory", "." ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/HttpDirectoryService.java#L207-L219
VoltDB/voltdb
third_party/java/src/com/google_voltpatches/common/io/BaseEncoding.java
BaseEncoding.decodeChecked
final byte[] decodeChecked(CharSequence chars) throws DecodingException { chars = padding().trimTrailingFrom(chars); byte[] tmp = new byte[maxDecodedSize(chars.length())]; int len = decodeTo(tmp, chars); return extract(tmp, len); }
java
final byte[] decodeChecked(CharSequence chars) throws DecodingException { chars = padding().trimTrailingFrom(chars); byte[] tmp = new byte[maxDecodedSize(chars.length())]; int len = decodeTo(tmp, chars); return extract(tmp, len); }
[ "final", "byte", "[", "]", "decodeChecked", "(", "CharSequence", "chars", ")", "throws", "DecodingException", "{", "chars", "=", "padding", "(", ")", ".", "trimTrailingFrom", "(", "chars", ")", ";", "byte", "[", "]", "tmp", "=", "new", "byte", "[", "maxD...
Decodes the specified character sequence, and returns the resulting {@code byte[]}. This is the inverse operation to {@link #encode(byte[])}. @throws DecodingException if the input is not a valid encoded string according to this encoding.
[ "Decodes", "the", "specified", "character", "sequence", "and", "returns", "the", "resulting", "{", "@code", "byte", "[]", "}", ".", "This", "is", "the", "inverse", "operation", "to", "{", "@link", "#encode", "(", "byte", "[]", ")", "}", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/io/BaseEncoding.java#L224-L230
JodaOrg/joda-time
src/main/java/org/joda/time/DateTime.java
DateTime.withTime
public DateTime withTime(int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond) { Chronology chrono = getChronology(); long localInstant = chrono.withUTC().getDateTimeMillis( getYear(), getMonthOfYear(), getDayOfMonth(), hourOfDay, minuteOfHour, secondOfMinute, millisOfSecond); return withMillis(chrono.getZone().convertLocalToUTC(localInstant, false, getMillis())); }
java
public DateTime withTime(int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond) { Chronology chrono = getChronology(); long localInstant = chrono.withUTC().getDateTimeMillis( getYear(), getMonthOfYear(), getDayOfMonth(), hourOfDay, minuteOfHour, secondOfMinute, millisOfSecond); return withMillis(chrono.getZone().convertLocalToUTC(localInstant, false, getMillis())); }
[ "public", "DateTime", "withTime", "(", "int", "hourOfDay", ",", "int", "minuteOfHour", ",", "int", "secondOfMinute", ",", "int", "millisOfSecond", ")", "{", "Chronology", "chrono", "=", "getChronology", "(", ")", ";", "long", "localInstant", "=", "chrono", "."...
Returns a copy of this datetime with the specified time, retaining the date fields. <p> If the time is already the time passed in, then <code>this</code> is returned. <p> To set a single field use the properties, for example: <pre> DateTime set = dt.hourOfDay().setCopy(6); </pre> <p> If the new time is invalid due to the time-zone, the time will be adjusted. <p> This instance is immutable and unaffected by this method call. @param hourOfDay the hour of the day @param minuteOfHour the minute of the hour @param secondOfMinute the second of the minute @param millisOfSecond the millisecond of the second @return a copy of this datetime with a different time @throws IllegalArgumentException if any value if invalid
[ "Returns", "a", "copy", "of", "this", "datetime", "with", "the", "specified", "time", "retaining", "the", "date", "fields", ".", "<p", ">", "If", "the", "time", "is", "already", "the", "time", "passed", "in", "then", "<code", ">", "this<", "/", "code", ...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/DateTime.java#L770-L775
mozilla/rhino
src/org/mozilla/javascript/ScriptableObject.java
ScriptableObject.putProperty
public static void putProperty(Scriptable obj, String name, Object value) { Scriptable base = getBase(obj, name); if (base == null) base = obj; base.put(name, obj, value); }
java
public static void putProperty(Scriptable obj, String name, Object value) { Scriptable base = getBase(obj, name); if (base == null) base = obj; base.put(name, obj, value); }
[ "public", "static", "void", "putProperty", "(", "Scriptable", "obj", ",", "String", "name", ",", "Object", "value", ")", "{", "Scriptable", "base", "=", "getBase", "(", "obj", ",", "name", ")", ";", "if", "(", "base", "==", "null", ")", "base", "=", ...
Puts a named property in an object or in an object in its prototype chain. <p> Searches for the named property in the prototype chain. If it is found, the value of the property in <code>obj</code> is changed through a call to {@link Scriptable#put(String, Scriptable, Object)} on the prototype passing <code>obj</code> as the <code>start</code> argument. This allows the prototype to veto the property setting in case the prototype defines the property with [[ReadOnly]] attribute. If the property is not found, it is added in <code>obj</code>. @param obj a JavaScript object @param name a property name @param value any JavaScript value accepted by Scriptable.put @since 1.5R2
[ "Puts", "a", "named", "property", "in", "an", "object", "or", "in", "an", "object", "in", "its", "prototype", "chain", ".", "<p", ">", "Searches", "for", "the", "named", "property", "in", "the", "prototype", "chain", ".", "If", "it", "is", "found", "th...
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptableObject.java#L2502-L2508
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/metadata/ModificationBuilderTarget.java
ModificationBuilderTarget.addFile
public T addFile(final String name, final List<String> path, final byte[] newHash, final boolean isDirectory) { return addFile(name, path, newHash, isDirectory, null); }
java
public T addFile(final String name, final List<String> path, final byte[] newHash, final boolean isDirectory) { return addFile(name, path, newHash, isDirectory, null); }
[ "public", "T", "addFile", "(", "final", "String", "name", ",", "final", "List", "<", "String", ">", "path", ",", "final", "byte", "[", "]", "newHash", ",", "final", "boolean", "isDirectory", ")", "{", "return", "addFile", "(", "name", ",", "path", ",",...
Add a misc file. @param name the file name @param path the relative path @param newHash the new hash of the added content @param isDirectory whether the file is a directory or not @return the builder
[ "Add", "a", "misc", "file", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/metadata/ModificationBuilderTarget.java#L116-L118
datastax/spark-cassandra-connector
spark-cassandra-connector/src/main/java/com/datastax/driver/core/MetadataHook.java
MetadataHook.newToken
public static Token newToken(Metadata metadata, ByteBuffer routingKey) { return metadata.tokenFactory().hash(routingKey); }
java
public static Token newToken(Metadata metadata, ByteBuffer routingKey) { return metadata.tokenFactory().hash(routingKey); }
[ "public", "static", "Token", "newToken", "(", "Metadata", "metadata", ",", "ByteBuffer", "routingKey", ")", "{", "return", "metadata", ".", "tokenFactory", "(", ")", ".", "hash", "(", "routingKey", ")", ";", "}" ]
Builds a new {@link Token} from a partition key, according to the partitioner reported by the Cassandra nodes. @param metadata the original driver's metadata. @param routingKey the routing key of the bound partition key @return the token. @throws IllegalStateException if the token factory was not initialized. This would typically happen if metadata was explicitly disabled with {@link QueryOptions#setMetadataEnabled(boolean)} before startup.
[ "Builds", "a", "new", "{", "@link", "Token", "}", "from", "a", "partition", "key", "according", "to", "the", "partitioner", "reported", "by", "the", "Cassandra", "nodes", "." ]
train
https://github.com/datastax/spark-cassandra-connector/blob/23c09965c34576e17b4315772eb78af399ec9df1/spark-cassandra-connector/src/main/java/com/datastax/driver/core/MetadataHook.java#L21-L23
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/util/ExceptionUtil.java
ExceptionUtil.logException
public final static void logException(TraceComponent compTc, Throwable t, EJBMethodMetaData m, BeanO bean) { //d408351 - only log recursive exceptions if they have not been logged before if (hasBeenLogged(t)) { return; } BeanId beanId = null; if (bean != null) { beanId = bean.getId(); } if (m == null) { if (beanId == null) { Tr.error(compTc, "NON_APPLICATION_EXCEPTION_CNTR0018E", t); } else { Tr.error(compTc, "NON_APPLICATION_EXCEPTION_ON_BEAN_CNTR0021E", new Object[] { t, beanId }); } } else { String methodName = m.getMethodName(); if (beanId == null) { Tr.error(compTc, "NON_APPLICATION_EXCEPTION_METHOD_CNTR0019E", new Object[] { t, methodName }); } else { Tr.error(compTc, "NON_APPLICATION_EXCEPTION_METHOD_ON_BEAN_CNTR0020E", new Object[] { t, methodName, beanId }); } } }
java
public final static void logException(TraceComponent compTc, Throwable t, EJBMethodMetaData m, BeanO bean) { //d408351 - only log recursive exceptions if they have not been logged before if (hasBeenLogged(t)) { return; } BeanId beanId = null; if (bean != null) { beanId = bean.getId(); } if (m == null) { if (beanId == null) { Tr.error(compTc, "NON_APPLICATION_EXCEPTION_CNTR0018E", t); } else { Tr.error(compTc, "NON_APPLICATION_EXCEPTION_ON_BEAN_CNTR0021E", new Object[] { t, beanId }); } } else { String methodName = m.getMethodName(); if (beanId == null) { Tr.error(compTc, "NON_APPLICATION_EXCEPTION_METHOD_CNTR0019E", new Object[] { t, methodName }); } else { Tr.error(compTc, "NON_APPLICATION_EXCEPTION_METHOD_ON_BEAN_CNTR0020E", new Object[] { t, methodName, beanId }); } } }
[ "public", "final", "static", "void", "logException", "(", "TraceComponent", "compTc", ",", "Throwable", "t", ",", "EJBMethodMetaData", "m", ",", "BeanO", "bean", ")", "{", "//d408351 - only log recursive exceptions if they have not been logged before", "if", "(", "hasBeen...
d408351 - added new signature with customizable TraceComponent
[ "d408351", "-", "added", "new", "signature", "with", "customizable", "TraceComponent" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/util/ExceptionUtil.java#L82-L109
mozilla/rhino
src/org/mozilla/javascript/Context.java
Context.newObject
public Scriptable newObject(Scriptable scope, String constructorName) { return newObject(scope, constructorName, ScriptRuntime.emptyArgs); }
java
public Scriptable newObject(Scriptable scope, String constructorName) { return newObject(scope, constructorName, ScriptRuntime.emptyArgs); }
[ "public", "Scriptable", "newObject", "(", "Scriptable", "scope", ",", "String", "constructorName", ")", "{", "return", "newObject", "(", "scope", ",", "constructorName", ",", "ScriptRuntime", ".", "emptyArgs", ")", ";", "}" ]
Create a new JavaScript object by executing the named constructor. The call <code>newObject(scope, "Foo")</code> is equivalent to evaluating "new Foo()". @param scope the scope to search for the constructor and to evaluate against @param constructorName the name of the constructor to call @return the new object
[ "Create", "a", "new", "JavaScript", "object", "by", "executing", "the", "named", "constructor", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Context.java#L1656-L1659
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalTime.java
LocalTime.withHour
public LocalTime withHour(int hour) { if (this.hour == hour) { return this; } HOUR_OF_DAY.checkValidValue(hour); return create(hour, minute, second, nano); }
java
public LocalTime withHour(int hour) { if (this.hour == hour) { return this; } HOUR_OF_DAY.checkValidValue(hour); return create(hour, minute, second, nano); }
[ "public", "LocalTime", "withHour", "(", "int", "hour", ")", "{", "if", "(", "this", ".", "hour", "==", "hour", ")", "{", "return", "this", ";", "}", "HOUR_OF_DAY", ".", "checkValidValue", "(", "hour", ")", ";", "return", "create", "(", "hour", ",", "...
Returns a copy of this {@code LocalTime} with the hour-of-day altered. <p> This instance is immutable and unaffected by this method call. @param hour the hour-of-day to set in the result, from 0 to 23 @return a {@code LocalTime} based on this time with the requested hour, not null @throws DateTimeException if the hour value is invalid
[ "Returns", "a", "copy", "of", "this", "{", "@code", "LocalTime", "}", "with", "the", "hour", "-", "of", "-", "day", "altered", ".", "<p", ">", "This", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "call", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalTime.java#L863-L869
baratine/baratine
framework/src/main/java/com/caucho/v5/vfs/ReadStreamOld.java
ReadStreamOld.readAll
public int readAll(char []buf, int offset, int length) throws IOException { int readLength = 0; while (length > 0) { int sublen = read(buf, offset, length); if (sublen <= 0) { return readLength > 0 ? readLength : -1; } offset += sublen; readLength += sublen; length -= sublen; } return readLength; }
java
public int readAll(char []buf, int offset, int length) throws IOException { int readLength = 0; while (length > 0) { int sublen = read(buf, offset, length); if (sublen <= 0) { return readLength > 0 ? readLength : -1; } offset += sublen; readLength += sublen; length -= sublen; } return readLength; }
[ "public", "int", "readAll", "(", "char", "[", "]", "buf", ",", "int", "offset", ",", "int", "length", ")", "throws", "IOException", "{", "int", "readLength", "=", "0", ";", "while", "(", "length", ">", "0", ")", "{", "int", "sublen", "=", "read", "...
Reads into a character buffer from the stream. <code>length</code> characters will always be read until the end of file is reached. @param buf character buffer to fill @param offset starting offset into the character buffer @param length maximum number of characters to read @return number of characters read or -1 on end of file.
[ "Reads", "into", "a", "character", "buffer", "from", "the", "stream", ".", "<code", ">", "length<", "/", "code", ">", "characters", "will", "always", "be", "read", "until", "the", "end", "of", "file", "is", "reached", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/ReadStreamOld.java#L663-L680
canoo/open-dolphin
subprojects/server/src/main/groovy/org/opendolphin/server/adapter/DolphinServlet.java
DolphinServlet.writeHeaders
protected void writeHeaders(HttpServletRequest request, HttpServletResponse response, List<Command> results) throws ServletException, IOException { // empty on purpose }
java
protected void writeHeaders(HttpServletRequest request, HttpServletResponse response, List<Command> results) throws ServletException, IOException { // empty on purpose }
[ "protected", "void", "writeHeaders", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "List", "<", "Command", ">", "results", ")", "throws", "ServletException", ",", "IOException", "{", "// empty on purpose", "}" ]
Updates {@code response} headers if needed. @param request - an HttpServletRequest object that contains the request the client has made of the servlet @param response - an HttpServletResponse object that contains the response the servlet sends to the client @param results - the list of commands to be sent to the client after the response was processed @throws IOException - if an input or output error is detected when the servlet handles the request @throws ServletException - if the request for the POST could not be handled
[ "Updates", "{", "@code", "response", "}", "headers", "if", "needed", "." ]
train
https://github.com/canoo/open-dolphin/blob/50166defc3ef2de473d7a7246c32dc04304d80ef/subprojects/server/src/main/groovy/org/opendolphin/server/adapter/DolphinServlet.java#L93-L95
StanKocken/EfficientAdapter
efficientadapter/src/main/java/com/skocken/efficientadapter/lib/viewholder/EfficientViewHolder.java
EfficientViewHolder.setTextSize
public void setTextSize(int viewId, int unit, float size) { ViewHelper.setTextSize(mCacheView, viewId, unit, size); }
java
public void setTextSize(int viewId, int unit, float size) { ViewHelper.setTextSize(mCacheView, viewId, unit, size); }
[ "public", "void", "setTextSize", "(", "int", "viewId", ",", "int", "unit", ",", "float", "size", ")", "{", "ViewHelper", ".", "setTextSize", "(", "mCacheView", ",", "viewId", ",", "unit", ",", "size", ")", ";", "}" ]
Equivalent to calling TextView.setTextSize @param viewId The id of the view whose text size should change @param unit The desired dimension unit. @param size The desired size in the given units.
[ "Equivalent", "to", "calling", "TextView", ".", "setTextSize" ]
train
https://github.com/StanKocken/EfficientAdapter/blob/0bcc3a20182cbce9d7901e1e2a9104251637167d/efficientadapter/src/main/java/com/skocken/efficientadapter/lib/viewholder/EfficientViewHolder.java#L345-L347
radkovo/jStyleParser
src/main/java/cz/vutbr/web/csskit/OutputUtil.java
OutputUtil.appendCalcArgs
public static StringBuilder appendCalcArgs(StringBuilder sb, CalcArgs args) { final String astr = args.evaluate(CalcArgs.stringEvaluator); if (!astr.startsWith(FUNCTION_OPENING)) { sb.append(FUNCTION_OPENING); sb.append(astr); sb.append(FUNCTION_CLOSING); } else { sb.append(astr); } return sb; }
java
public static StringBuilder appendCalcArgs(StringBuilder sb, CalcArgs args) { final String astr = args.evaluate(CalcArgs.stringEvaluator); if (!astr.startsWith(FUNCTION_OPENING)) { sb.append(FUNCTION_OPENING); sb.append(astr); sb.append(FUNCTION_CLOSING); } else { sb.append(astr); } return sb; }
[ "public", "static", "StringBuilder", "appendCalcArgs", "(", "StringBuilder", "sb", ",", "CalcArgs", "args", ")", "{", "final", "String", "astr", "=", "args", ".", "evaluate", "(", "CalcArgs", ".", "stringEvaluator", ")", ";", "if", "(", "!", "astr", ".", "...
Appends the calc() function arguments to a string builder. @param sb the string builder to be modified @param args the calc arguments @return Modified <code>sb</code> to allow chaining
[ "Appends", "the", "calc", "()", "function", "arguments", "to", "a", "string", "builder", "." ]
train
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/OutputUtil.java#L160-L170
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/ConfigManager.java
ConfigManager.getDefaultParentForEntityInRealm
public String getDefaultParentForEntityInRealm(String entType, String realmName) throws WIMException { String defaultParent = getDefaultParent(entType); if (realmName != null) { validateRealmName(realmName); String parent = null; RealmConfig realmConfig = getRealmConfig(realmName); Map defaultParentsMap = realmConfig.getDefaultParentMapping(); if (defaultParentsMap != null) { parent = (String) defaultParentsMap.get(entType); if (parent != null) { defaultParent = parent; } } if (parent == null && !isUniqueNameInRealm(defaultParent, realmName)) { defaultParent = null; } } return defaultParent; }
java
public String getDefaultParentForEntityInRealm(String entType, String realmName) throws WIMException { String defaultParent = getDefaultParent(entType); if (realmName != null) { validateRealmName(realmName); String parent = null; RealmConfig realmConfig = getRealmConfig(realmName); Map defaultParentsMap = realmConfig.getDefaultParentMapping(); if (defaultParentsMap != null) { parent = (String) defaultParentsMap.get(entType); if (parent != null) { defaultParent = parent; } } if (parent == null && !isUniqueNameInRealm(defaultParent, realmName)) { defaultParent = null; } } return defaultParent; }
[ "public", "String", "getDefaultParentForEntityInRealm", "(", "String", "entType", ",", "String", "realmName", ")", "throws", "WIMException", "{", "String", "defaultParent", "=", "getDefaultParent", "(", "entType", ")", ";", "if", "(", "realmName", "!=", "null", ")...
Gets the default parent node that is for the specified entity type in specified realm. @param entType The entity type. e.g. Person, Group... @param realmName The name of the realm @return The default parent node.
[ "Gets", "the", "default", "parent", "node", "that", "is", "for", "the", "specified", "entity", "type", "in", "specified", "realm", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/ConfigManager.java#L367-L385
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/style/StyleUtilities.java
StyleUtilities.substituteMark
public static void substituteMark( Rule rule, String wellKnownMarkName ) { PointSymbolizer pointSymbolizer = StyleUtilities.pointSymbolizerFromRule(rule); Mark oldMark = SLD.mark(pointSymbolizer); Graphic graphic = SLD.graphic(pointSymbolizer); graphic.graphicalSymbols().clear(); Mark mark = StyleUtilities.sf.createMark(); mark.setWellKnownName(StyleUtilities.ff.literal(wellKnownMarkName)); if (oldMark != null) { mark.setFill(oldMark.getFill()); mark.setStroke(oldMark.getStroke()); } graphic.graphicalSymbols().add(mark); }
java
public static void substituteMark( Rule rule, String wellKnownMarkName ) { PointSymbolizer pointSymbolizer = StyleUtilities.pointSymbolizerFromRule(rule); Mark oldMark = SLD.mark(pointSymbolizer); Graphic graphic = SLD.graphic(pointSymbolizer); graphic.graphicalSymbols().clear(); Mark mark = StyleUtilities.sf.createMark(); mark.setWellKnownName(StyleUtilities.ff.literal(wellKnownMarkName)); if (oldMark != null) { mark.setFill(oldMark.getFill()); mark.setStroke(oldMark.getStroke()); } graphic.graphicalSymbols().add(mark); }
[ "public", "static", "void", "substituteMark", "(", "Rule", "rule", ",", "String", "wellKnownMarkName", ")", "{", "PointSymbolizer", "pointSymbolizer", "=", "StyleUtilities", ".", "pointSymbolizerFromRule", "(", "rule", ")", ";", "Mark", "oldMark", "=", "SLD", ".",...
Change the mark shape in a rule. @param rule the rule of which the mark has to be changed. @param wellKnownMarkName the name of the new mark.
[ "Change", "the", "mark", "shape", "in", "a", "rule", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/style/StyleUtilities.java#L575-L589
VoltDB/voltdb
src/frontend/org/voltdb/planner/MVQueryRewriter.java
MVQueryRewriter.rewriteSelectStmt
private boolean rewriteSelectStmt() { if (m_mvi != null) { final Table view = m_mvi.getDest(); final String viewName = view.getTypeName(); // Get the map of select stmt's display column index -> view table (column name, column index) m_selectStmt.getFinalProjectionSchema() .resetTableName(viewName, viewName) .toTVEAndFixColumns(m_QueryColumnNameAndIndx_to_MVColumnNameAndIndx.entrySet().stream() .collect(Collectors.toMap(kv -> kv.getKey().getFirst(), Map.Entry::getValue))); // change to display column index-keyed map final Map<Integer, Pair<String, Integer>> colSubIndx = m_QueryColumnNameAndIndx_to_MVColumnNameAndIndx .entrySet().stream().collect(Collectors.toMap(kv -> kv.getKey().getSecond(), Map.Entry::getValue)); ParsedSelectStmt.updateTableNames(m_selectStmt.m_aggResultColumns, viewName); ParsedSelectStmt.fixColumns(m_selectStmt.m_aggResultColumns, colSubIndx); ParsedSelectStmt.updateTableNames(m_selectStmt.m_displayColumns, viewName); ParsedSelectStmt.fixColumns(m_selectStmt.m_displayColumns, colSubIndx); m_selectStmt.rewriteAsMV(view); m_mvi = null; // makes this method re-entrant safe return true; } else { // scans all sub-queries for rewriting opportunities return m_selectStmt.allScans().stream() .map(scan -> scan instanceof StmtSubqueryScan && rewriteTableAlias((StmtSubqueryScan) scan)) .reduce(Boolean::logicalOr).get(); } }
java
private boolean rewriteSelectStmt() { if (m_mvi != null) { final Table view = m_mvi.getDest(); final String viewName = view.getTypeName(); // Get the map of select stmt's display column index -> view table (column name, column index) m_selectStmt.getFinalProjectionSchema() .resetTableName(viewName, viewName) .toTVEAndFixColumns(m_QueryColumnNameAndIndx_to_MVColumnNameAndIndx.entrySet().stream() .collect(Collectors.toMap(kv -> kv.getKey().getFirst(), Map.Entry::getValue))); // change to display column index-keyed map final Map<Integer, Pair<String, Integer>> colSubIndx = m_QueryColumnNameAndIndx_to_MVColumnNameAndIndx .entrySet().stream().collect(Collectors.toMap(kv -> kv.getKey().getSecond(), Map.Entry::getValue)); ParsedSelectStmt.updateTableNames(m_selectStmt.m_aggResultColumns, viewName); ParsedSelectStmt.fixColumns(m_selectStmt.m_aggResultColumns, colSubIndx); ParsedSelectStmt.updateTableNames(m_selectStmt.m_displayColumns, viewName); ParsedSelectStmt.fixColumns(m_selectStmt.m_displayColumns, colSubIndx); m_selectStmt.rewriteAsMV(view); m_mvi = null; // makes this method re-entrant safe return true; } else { // scans all sub-queries for rewriting opportunities return m_selectStmt.allScans().stream() .map(scan -> scan instanceof StmtSubqueryScan && rewriteTableAlias((StmtSubqueryScan) scan)) .reduce(Boolean::logicalOr).get(); } }
[ "private", "boolean", "rewriteSelectStmt", "(", ")", "{", "if", "(", "m_mvi", "!=", "null", ")", "{", "final", "Table", "view", "=", "m_mvi", ".", "getDest", "(", ")", ";", "final", "String", "viewName", "=", "view", ".", "getTypeName", "(", ")", ";", ...
Try to rewrite SELECT stmt if there is a matching materialized view. @return if SELECT stmt had been rewritten. Updates SELECT stmt transactionally.
[ "Try", "to", "rewrite", "SELECT", "stmt", "if", "there", "is", "a", "matching", "materialized", "view", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/planner/MVQueryRewriter.java#L128-L152
oasp/oasp4j
modules/security/src/main/java/io/oasp/module/security/common/base/accesscontrol/AbstractAccessControlProvider.java
AbstractAccessControlProvider.collectPermissionIds
public void collectPermissionIds(AccessControlGroup group, Set<String> permissions) { boolean added = permissions.add(group.getId()); if (!added) { // we have already visited this node, stop recursion... return; } for (AccessControlPermission permission : group.getPermissions()) { permissions.add(permission.getId()); } for (AccessControlGroup inheritedGroup : group.getInherits()) { collectPermissionIds(inheritedGroup, permissions); } }
java
public void collectPermissionIds(AccessControlGroup group, Set<String> permissions) { boolean added = permissions.add(group.getId()); if (!added) { // we have already visited this node, stop recursion... return; } for (AccessControlPermission permission : group.getPermissions()) { permissions.add(permission.getId()); } for (AccessControlGroup inheritedGroup : group.getInherits()) { collectPermissionIds(inheritedGroup, permissions); } }
[ "public", "void", "collectPermissionIds", "(", "AccessControlGroup", "group", ",", "Set", "<", "String", ">", "permissions", ")", "{", "boolean", "added", "=", "permissions", ".", "add", "(", "group", ".", "getId", "(", ")", ")", ";", "if", "(", "!", "ad...
Recursive implementation of {@link #collectAccessControlIds(String, Set)} for {@link AccessControlGroup}s. @param group is the {@link AccessControlGroup} to traverse. @param permissions is the {@link Set} used to collect.
[ "Recursive", "implementation", "of", "{", "@link", "#collectAccessControlIds", "(", "String", "Set", ")", "}", "for", "{", "@link", "AccessControlGroup", "}", "s", "." ]
train
https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/security/src/main/java/io/oasp/module/security/common/base/accesscontrol/AbstractAccessControlProvider.java#L175-L188
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/SchedulesInner.java
SchedulesInner.listByAutomationAccountAsync
public Observable<Page<ScheduleInner>> listByAutomationAccountAsync(final String resourceGroupName, final String automationAccountName) { return listByAutomationAccountWithServiceResponseAsync(resourceGroupName, automationAccountName) .map(new Func1<ServiceResponse<Page<ScheduleInner>>, Page<ScheduleInner>>() { @Override public Page<ScheduleInner> call(ServiceResponse<Page<ScheduleInner>> response) { return response.body(); } }); }
java
public Observable<Page<ScheduleInner>> listByAutomationAccountAsync(final String resourceGroupName, final String automationAccountName) { return listByAutomationAccountWithServiceResponseAsync(resourceGroupName, automationAccountName) .map(new Func1<ServiceResponse<Page<ScheduleInner>>, Page<ScheduleInner>>() { @Override public Page<ScheduleInner> call(ServiceResponse<Page<ScheduleInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "ScheduleInner", ">", ">", "listByAutomationAccountAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "automationAccountName", ")", "{", "return", "listByAutomationAccountWithServiceResponseAsync", "(", "...
Retrieve a list of schedules. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ScheduleInner&gt; object
[ "Retrieve", "a", "list", "of", "schedules", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/SchedulesInner.java#L522-L530
apache/groovy
src/main/groovy/groovy/lang/MetaClassImpl.java
MetaClassImpl.setAttribute
public void setAttribute(Object object, String attribute, Object newValue) { setAttribute(theClass, object, attribute, newValue, false, false); }
java
public void setAttribute(Object object, String attribute, Object newValue) { setAttribute(theClass, object, attribute, newValue, false, false); }
[ "public", "void", "setAttribute", "(", "Object", "object", ",", "String", "attribute", ",", "Object", "newValue", ")", "{", "setAttribute", "(", "theClass", ",", "object", ",", "attribute", ",", "newValue", ",", "false", ",", "false", ")", ";", "}" ]
Sets the value of an attribute (field). This method is to support the Groovy runtime and not for general client API usage. @param object The object to get the attribute from @param attribute The name of the attribute @param newValue The new value of the attribute
[ "Sets", "the", "value", "of", "an", "attribute", "(", "field", ")", ".", "This", "method", "is", "to", "support", "the", "Groovy", "runtime", "and", "not", "for", "general", "client", "API", "usage", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/MetaClassImpl.java#L3892-L3894
VoltDB/voltdb
src/frontend/org/voltdb/AbstractTopology.java
AbstractTopology.mutateRemoveHosts
public static Pair<AbstractTopology, Set<Integer>> mutateRemoveHosts(AbstractTopology currentTopology, Set<Integer> removalHosts) { Set<Integer> removalPartitionIds = getPartitionIdsForHosts(currentTopology, removalHosts); return Pair.of(new AbstractTopology(currentTopology, removalHosts, removalPartitionIds), removalPartitionIds); }
java
public static Pair<AbstractTopology, Set<Integer>> mutateRemoveHosts(AbstractTopology currentTopology, Set<Integer> removalHosts) { Set<Integer> removalPartitionIds = getPartitionIdsForHosts(currentTopology, removalHosts); return Pair.of(new AbstractTopology(currentTopology, removalHosts, removalPartitionIds), removalPartitionIds); }
[ "public", "static", "Pair", "<", "AbstractTopology", ",", "Set", "<", "Integer", ">", ">", "mutateRemoveHosts", "(", "AbstractTopology", "currentTopology", ",", "Set", "<", "Integer", ">", "removalHosts", ")", "{", "Set", "<", "Integer", ">", "removalPartitionId...
Remove hosts from an existing topology @param currentTopology to extend @param removalHostInfos hosts to be removed from topology @return update {@link AbstractTopology} with remaining hosts and removed partition IDs @throws RuntimeException if hosts are not valid for topology
[ "Remove", "hosts", "from", "an", "existing", "topology" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/AbstractTopology.java#L946-L950
connect-group/thymesheet
src/main/java/com/connect_group/thymesheet/css/selectors/dom/internal/TagChecker.java
TagChecker.tagEquals
private boolean tagEquals(String tag1, String tag2) { if (caseSensitive) { return tag1.equals(tag2); } return tag1.equalsIgnoreCase(tag2); }
java
private boolean tagEquals(String tag1, String tag2) { if (caseSensitive) { return tag1.equals(tag2); } return tag1.equalsIgnoreCase(tag2); }
[ "private", "boolean", "tagEquals", "(", "String", "tag1", ",", "String", "tag2", ")", "{", "if", "(", "caseSensitive", ")", "{", "return", "tag1", ".", "equals", "(", "tag2", ")", ";", "}", "return", "tag1", ".", "equalsIgnoreCase", "(", "tag2", ")", "...
Determine if the two specified tag names are equal. @param tag1 A tag name. @param tag2 A tag name. @return <code>true</code> if the tag names are equal, <code>false</code> otherwise.
[ "Determine", "if", "the", "two", "specified", "tag", "names", "are", "equal", "." ]
train
https://github.com/connect-group/thymesheet/blob/b6384e385d3e3b54944d53993bbd396d2668a5a0/src/main/java/com/connect_group/thymesheet/css/selectors/dom/internal/TagChecker.java#L168-L174
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/transfer/TransferManager.java
TransferManager.abortMultipartUploads
public void abortMultipartUploads(String bucketName, Date date) throws AmazonServiceException, AmazonClientException { MultipartUploadListing uploadListing = s3.listMultipartUploads(appendSingleObjectUserAgent( new ListMultipartUploadsRequest(bucketName))); do { for (MultipartUpload upload : uploadListing.getMultipartUploads()) { if (upload.getInitiated().compareTo(date) < 0) { s3.abortMultipartUpload(appendSingleObjectUserAgent(new AbortMultipartUploadRequest( bucketName, upload.getKey(), upload.getUploadId()))); } } ListMultipartUploadsRequest request = new ListMultipartUploadsRequest(bucketName) .withUploadIdMarker(uploadListing.getNextUploadIdMarker()) .withKeyMarker(uploadListing.getNextKeyMarker()); uploadListing = s3.listMultipartUploads(appendSingleObjectUserAgent(request)); } while (uploadListing.isTruncated()); }
java
public void abortMultipartUploads(String bucketName, Date date) throws AmazonServiceException, AmazonClientException { MultipartUploadListing uploadListing = s3.listMultipartUploads(appendSingleObjectUserAgent( new ListMultipartUploadsRequest(bucketName))); do { for (MultipartUpload upload : uploadListing.getMultipartUploads()) { if (upload.getInitiated().compareTo(date) < 0) { s3.abortMultipartUpload(appendSingleObjectUserAgent(new AbortMultipartUploadRequest( bucketName, upload.getKey(), upload.getUploadId()))); } } ListMultipartUploadsRequest request = new ListMultipartUploadsRequest(bucketName) .withUploadIdMarker(uploadListing.getNextUploadIdMarker()) .withKeyMarker(uploadListing.getNextKeyMarker()); uploadListing = s3.listMultipartUploads(appendSingleObjectUserAgent(request)); } while (uploadListing.isTruncated()); }
[ "public", "void", "abortMultipartUploads", "(", "String", "bucketName", ",", "Date", "date", ")", "throws", "AmazonServiceException", ",", "AmazonClientException", "{", "MultipartUploadListing", "uploadListing", "=", "s3", ".", "listMultipartUploads", "(", "appendSingleOb...
<p> Aborts any multipart uploads that were initiated before the specified date. </p> <p> This method is useful for cleaning up any interrupted multipart uploads. <code>TransferManager</code> attempts to abort any failed uploads, but in some cases this may not be possible, such as if network connectivity is completely lost. </p> @param bucketName The name of the bucket containing the multipart uploads to abort. @param date The date indicating which multipart uploads should be aborted.
[ "<p", ">", "Aborts", "any", "multipart", "uploads", "that", "were", "initiated", "before", "the", "specified", "date", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "is", "useful", "for", "cleaning", "up", "any", "interrupted", "multipart", "upload...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/transfer/TransferManager.java#L1900-L1917
aoindustries/aocode-public
src/main/java/com/aoindustries/util/IntArrayList.java
IntArrayList.set
@Override public int set(int index, int element) { RangeCheck(index); int oldValue = elementData[index]; elementData[index] = element; return oldValue; }
java
@Override public int set(int index, int element) { RangeCheck(index); int oldValue = elementData[index]; elementData[index] = element; return oldValue; }
[ "@", "Override", "public", "int", "set", "(", "int", "index", ",", "int", "element", ")", "{", "RangeCheck", "(", "index", ")", ";", "int", "oldValue", "=", "elementData", "[", "index", "]", ";", "elementData", "[", "index", "]", "=", "element", ";", ...
Replaces the element at the specified position in this list with the specified element. @param index index of element to replace. @param element element to be stored at the specified position. @return the element previously at the specified position. @throws IndexOutOfBoundsException if index out of range <tt>(index &lt; 0 || index &gt;= size())</tt>.
[ "Replaces", "the", "element", "at", "the", "specified", "position", "in", "this", "list", "with", "the", "specified", "element", "." ]
train
https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/util/IntArrayList.java#L387-L394
i-net-software/jlessc
src/com/inet/lib/less/LessParser.java
LessParser.parseParameterList
@Nonnull Operation parseParameterList() { Expression left = null; char ch; do { nesting++; Expression expr = parseExpression( (char)0 ); nesting--; left = concat( left, ';', expr ); ch = read(); } while( ch == ';' ); if( ch != ')' ) { throw createException( "Unrecognized input: '" + ch + "'" ); } if( left == null ) { return new Operation( reader ); } if( left.getClass() == Operation.class ) { switch( ((Operation)left).getOperator() ) { case ',': case ';': return (Operation)left; } } return new Operation( reader, left, ',' ); }
java
@Nonnull Operation parseParameterList() { Expression left = null; char ch; do { nesting++; Expression expr = parseExpression( (char)0 ); nesting--; left = concat( left, ';', expr ); ch = read(); } while( ch == ';' ); if( ch != ')' ) { throw createException( "Unrecognized input: '" + ch + "'" ); } if( left == null ) { return new Operation( reader ); } if( left.getClass() == Operation.class ) { switch( ((Operation)left).getOperator() ) { case ',': case ';': return (Operation)left; } } return new Operation( reader, left, ',' ); }
[ "@", "Nonnull", "Operation", "parseParameterList", "(", ")", "{", "Expression", "left", "=", "null", ";", "char", "ch", ";", "do", "{", "nesting", "++", ";", "Expression", "expr", "=", "parseExpression", "(", "(", "char", ")", "0", ")", ";", "nesting", ...
Parse a parameter list for a function. @return the operation
[ "Parse", "a", "parameter", "list", "for", "a", "function", "." ]
train
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L1014-L1039
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDataPropertyRangeAxiomImpl_CustomFieldSerializer.java
OWLDataPropertyRangeAxiomImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLDataPropertyRangeAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLDataPropertyRangeAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLDataPropertyRangeAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamWriter", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDataPropertyRangeAxiomImpl_CustomFieldSerializer.java#L77-L80
jasminb/jsonapi-converter
src/main/java/com/github/jasminb/jsonapi/ResourceConverter.java
ResourceConverter.createIdentifier
private String createIdentifier(JsonNode object) { JsonNode idNode = object.get(ID); String id = idNode != null ? idNode.asText().trim() : ""; if (id.isEmpty() && deserializationFeatures.contains(DeserializationFeature.REQUIRE_RESOURCE_ID)) { throw new IllegalArgumentException(String.format("Resource must have a non null and non-empty 'id' attribute! %s", object.toString())); } String type = object.get(TYPE).asText(); return type.concat(id); }
java
private String createIdentifier(JsonNode object) { JsonNode idNode = object.get(ID); String id = idNode != null ? idNode.asText().trim() : ""; if (id.isEmpty() && deserializationFeatures.contains(DeserializationFeature.REQUIRE_RESOURCE_ID)) { throw new IllegalArgumentException(String.format("Resource must have a non null and non-empty 'id' attribute! %s", object.toString())); } String type = object.get(TYPE).asText(); return type.concat(id); }
[ "private", "String", "createIdentifier", "(", "JsonNode", "object", ")", "{", "JsonNode", "idNode", "=", "object", ".", "get", "(", "ID", ")", ";", "String", "id", "=", "idNode", "!=", "null", "?", "idNode", ".", "asText", "(", ")", ".", "trim", "(", ...
Generates unique resource identifier by combining resource type and resource id fields. <br /> By specification id/type combination guarantees uniqueness. @param object data object @return concatenated id and type values
[ "Generates", "unique", "resource", "identifier", "by", "combining", "resource", "type", "and", "resource", "id", "fields", ".", "<br", "/", ">", "By", "specification", "id", "/", "type", "combination", "guarantees", "uniqueness", "." ]
train
https://github.com/jasminb/jsonapi-converter/blob/73b41c3b9274e70e62b3425071ca8afdc7bddaf6/src/main/java/com/github/jasminb/jsonapi/ResourceConverter.java#L603-L614
jenkinsci/support-core-plugin
src/main/java/com/cloudbees/jenkins/support/util/StreamUtils.java
StreamUtils.isNonWhitespaceControlCharacter
public static boolean isNonWhitespaceControlCharacter(@NonNull byte[] b) { ByteBuffer head = ByteBuffer.allocate(DEFAULT_PROBE_SIZE); int toCopy = Math.min(head.remaining(), b.length); if (toCopy == 0) { throw new IllegalStateException("No more room to buffer header, should have chosen stream by now"); } head.put(b, 0, toCopy); head.flip().mark(); return isNonWhitespaceControlCharacter(head); }
java
public static boolean isNonWhitespaceControlCharacter(@NonNull byte[] b) { ByteBuffer head = ByteBuffer.allocate(DEFAULT_PROBE_SIZE); int toCopy = Math.min(head.remaining(), b.length); if (toCopy == 0) { throw new IllegalStateException("No more room to buffer header, should have chosen stream by now"); } head.put(b, 0, toCopy); head.flip().mark(); return isNonWhitespaceControlCharacter(head); }
[ "public", "static", "boolean", "isNonWhitespaceControlCharacter", "(", "@", "NonNull", "byte", "[", "]", "b", ")", "{", "ByteBuffer", "head", "=", "ByteBuffer", ".", "allocate", "(", "DEFAULT_PROBE_SIZE", ")", ";", "int", "toCopy", "=", "Math", ".", "min", "...
Check if the content of a byte array is binary @param b byte array to check @return true if the content is binary (Non-white Control Characters)
[ "Check", "if", "the", "content", "of", "a", "byte", "array", "is", "binary" ]
train
https://github.com/jenkinsci/support-core-plugin/blob/bcbe1dfd5bf48ac89903645cd48ed897c1a04688/src/main/java/com/cloudbees/jenkins/support/util/StreamUtils.java#L46-L56
jayantk/jklol
src/com/jayantkrish/jklol/cfg/CfgParseChart.java
CfgParseChart.getOutsideEntries
public Factor getOutsideEntries(int spanStart, int spanEnd) { Tensor entries = new DenseTensor(parentVar.getVariableNumsArray(), parentVar.getVariableSizes(), outsideChart[spanStart][spanEnd]); return new TableFactor(parentVar, entries); }
java
public Factor getOutsideEntries(int spanStart, int spanEnd) { Tensor entries = new DenseTensor(parentVar.getVariableNumsArray(), parentVar.getVariableSizes(), outsideChart[spanStart][spanEnd]); return new TableFactor(parentVar, entries); }
[ "public", "Factor", "getOutsideEntries", "(", "int", "spanStart", ",", "int", "spanEnd", ")", "{", "Tensor", "entries", "=", "new", "DenseTensor", "(", "parentVar", ".", "getVariableNumsArray", "(", ")", ",", "parentVar", ".", "getVariableSizes", "(", ")", ","...
Get the outside unnormalized probabilities over productions at a particular span in the tree.
[ "Get", "the", "outside", "unnormalized", "probabilities", "over", "productions", "at", "a", "particular", "span", "in", "the", "tree", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/cfg/CfgParseChart.java#L267-L271
VoltDB/voltdb
third_party/java/src/com/google_voltpatches/common/net/MediaType.java
MediaType.withParameter
public MediaType withParameter(String attribute, String value) { checkNotNull(attribute); checkNotNull(value); String normalizedAttribute = normalizeToken(attribute); ImmutableListMultimap.Builder<String, String> builder = ImmutableListMultimap.builder(); for (Entry<String, String> entry : parameters.entries()) { String key = entry.getKey(); if (!normalizedAttribute.equals(key)) { builder.put(key, entry.getValue()); } } builder.put(normalizedAttribute, normalizeParameterValue(normalizedAttribute, value)); MediaType mediaType = new MediaType(type, subtype, builder.build()); // Return one of the constants if the media type is a known type. return MoreObjects.firstNonNull(KNOWN_TYPES.get(mediaType), mediaType); }
java
public MediaType withParameter(String attribute, String value) { checkNotNull(attribute); checkNotNull(value); String normalizedAttribute = normalizeToken(attribute); ImmutableListMultimap.Builder<String, String> builder = ImmutableListMultimap.builder(); for (Entry<String, String> entry : parameters.entries()) { String key = entry.getKey(); if (!normalizedAttribute.equals(key)) { builder.put(key, entry.getValue()); } } builder.put(normalizedAttribute, normalizeParameterValue(normalizedAttribute, value)); MediaType mediaType = new MediaType(type, subtype, builder.build()); // Return one of the constants if the media type is a known type. return MoreObjects.firstNonNull(KNOWN_TYPES.get(mediaType), mediaType); }
[ "public", "MediaType", "withParameter", "(", "String", "attribute", ",", "String", "value", ")", "{", "checkNotNull", "(", "attribute", ")", ";", "checkNotNull", "(", "value", ")", ";", "String", "normalizedAttribute", "=", "normalizeToken", "(", "attribute", ")...
<em>Replaces</em> all parameters with the given attribute with a single parameter with the given value. If multiple parameters with the same attributes are necessary use {@link #withParameters}. Prefer {@link #withCharset} for setting the {@code charset} parameter when using a {@link Charset} object. @throws IllegalArgumentException if either {@code attribute} or {@code value} is invalid
[ "<em", ">", "Replaces<", "/", "em", ">", "all", "parameters", "with", "the", "given", "attribute", "with", "a", "single", "parameter", "with", "the", "given", "value", ".", "If", "multiple", "parameters", "with", "the", "same", "attributes", "are", "necessar...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/net/MediaType.java#L608-L623
LearnLib/automatalib
visualization/dot-visualizer/src/main/java/net/automatalib/visualization/dot/DOT.java
DOT.renderDOTExternal
public static void renderDOTExternal(File dotFile, String format) throws IOException { renderDOTExternal(IOUtil.asBufferedUTF8Reader(dotFile), format); }
java
public static void renderDOTExternal(File dotFile, String format) throws IOException { renderDOTExternal(IOUtil.asBufferedUTF8Reader(dotFile), format); }
[ "public", "static", "void", "renderDOTExternal", "(", "File", "dotFile", ",", "String", "format", ")", "throws", "IOException", "{", "renderDOTExternal", "(", "IOUtil", ".", "asBufferedUTF8Reader", "(", "dotFile", ")", ",", "format", ")", ";", "}" ]
Renders a GraphVIZ description from a file, using an external program for displaying. Convenience method, see {@link #renderDOTExternal(Reader, String)}. @throws IOException if opening the file resulted in errors.
[ "Renders", "a", "GraphVIZ", "description", "from", "a", "file", "using", "an", "external", "program", "for", "displaying", ".", "Convenience", "method", "see", "{", "@link", "#renderDOTExternal", "(", "Reader", "String", ")", "}", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/visualization/dot-visualizer/src/main/java/net/automatalib/visualization/dot/DOT.java#L229-L231
astrapi69/jaulp-wicket
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/parameter/PageParametersExtensions.java
PageParametersExtensions.getParameter
public static String getParameter(final String parameterName) { final Request request = RequestCycle.get().getRequest(); return getParameter(request, parameterName); }
java
public static String getParameter(final String parameterName) { final Request request = RequestCycle.get().getRequest(); return getParameter(request, parameterName); }
[ "public", "static", "String", "getParameter", "(", "final", "String", "parameterName", ")", "{", "final", "Request", "request", "=", "RequestCycle", ".", "get", "(", ")", ".", "getRequest", "(", ")", ";", "return", "getParameter", "(", "request", ",", "param...
Gets the parameter value from given parameter name. Looks in the query and post parameters. @param parameterName the parameter name @return the parameter value
[ "Gets", "the", "parameter", "value", "from", "given", "parameter", "name", ".", "Looks", "in", "the", "query", "and", "post", "parameters", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/parameter/PageParametersExtensions.java#L220-L224
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/SubnetsInner.java
SubnetsInner.beginCreateOrUpdateAsync
public Observable<SubnetInner> beginCreateOrUpdateAsync(String resourceGroupName, String virtualNetworkName, String subnetName, SubnetInner subnetParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName, subnetParameters).map(new Func1<ServiceResponse<SubnetInner>, SubnetInner>() { @Override public SubnetInner call(ServiceResponse<SubnetInner> response) { return response.body(); } }); }
java
public Observable<SubnetInner> beginCreateOrUpdateAsync(String resourceGroupName, String virtualNetworkName, String subnetName, SubnetInner subnetParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName, subnetParameters).map(new Func1<ServiceResponse<SubnetInner>, SubnetInner>() { @Override public SubnetInner call(ServiceResponse<SubnetInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SubnetInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkName", ",", "String", "subnetName", ",", "SubnetInner", "subnetParameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResp...
Creates or updates a subnet in the specified virtual network. @param resourceGroupName The name of the resource group. @param virtualNetworkName The name of the virtual network. @param subnetName The name of the subnet. @param subnetParameters Parameters supplied to the create or update subnet operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SubnetInner object
[ "Creates", "or", "updates", "a", "subnet", "in", "the", "specified", "virtual", "network", "." ]
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/SubnetsInner.java#L562-L569
fabric8io/ipaas-quickstarts
archetype-builder/src/main/java/io/fabric8/tooling/archetype/builder/ArchetypeBuilder.java
ArchetypeBuilder.generateArchetypesFromGitRepoList
public void generateArchetypesFromGitRepoList(File file, File outputDir, List<String> dirs) throws IOException { File cloneParentDir = new File(outputDir, "../git-clones"); if (cloneParentDir.exists()) { Files.recursiveDelete(cloneParentDir); } Properties properties = new Properties(); try (FileInputStream is = new FileInputStream(file)) { properties.load(is); } for (Map.Entry<Object, Object> entry : properties.entrySet()) { LinkedList<String> values = new LinkedList<>(Arrays.asList(((String) entry.getValue()).split("\\|"))); String gitrepo = values.removeFirst(); String tag = values.isEmpty() ? null : values.removeFirst(); generateArchetypeFromGitRepo(outputDir, dirs, cloneParentDir, (String)entry.getKey(), gitrepo, tag); } }
java
public void generateArchetypesFromGitRepoList(File file, File outputDir, List<String> dirs) throws IOException { File cloneParentDir = new File(outputDir, "../git-clones"); if (cloneParentDir.exists()) { Files.recursiveDelete(cloneParentDir); } Properties properties = new Properties(); try (FileInputStream is = new FileInputStream(file)) { properties.load(is); } for (Map.Entry<Object, Object> entry : properties.entrySet()) { LinkedList<String> values = new LinkedList<>(Arrays.asList(((String) entry.getValue()).split("\\|"))); String gitrepo = values.removeFirst(); String tag = values.isEmpty() ? null : values.removeFirst(); generateArchetypeFromGitRepo(outputDir, dirs, cloneParentDir, (String)entry.getKey(), gitrepo, tag); } }
[ "public", "void", "generateArchetypesFromGitRepoList", "(", "File", "file", ",", "File", "outputDir", ",", "List", "<", "String", ">", "dirs", ")", "throws", "IOException", "{", "File", "cloneParentDir", "=", "new", "File", "(", "outputDir", ",", "\"../git-clone...
Iterates through all projects in the given properties file adn generate an archetype for it
[ "Iterates", "through", "all", "projects", "in", "the", "given", "properties", "file", "adn", "generate", "an", "archetype", "for", "it" ]
train
https://github.com/fabric8io/ipaas-quickstarts/blob/cf9a9aa09204a82ac996304ab8c96791f7e5db22/archetype-builder/src/main/java/io/fabric8/tooling/archetype/builder/ArchetypeBuilder.java#L110-L127
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/MapTransitionExtractor.java
MapTransitionExtractor.getNeighborGroup
private String getNeighborGroup(Tile tile, Tile neighbor) { final String neighborGroup; if (isTransition(neighbor)) { if (isTransition(tile)) { neighborGroup = getOtherGroup(tile, neighbor); } else { neighborGroup = null; } } else { neighborGroup = mapGroup.getGroup(neighbor); } return neighborGroup; }
java
private String getNeighborGroup(Tile tile, Tile neighbor) { final String neighborGroup; if (isTransition(neighbor)) { if (isTransition(tile)) { neighborGroup = getOtherGroup(tile, neighbor); } else { neighborGroup = null; } } else { neighborGroup = mapGroup.getGroup(neighbor); } return neighborGroup; }
[ "private", "String", "getNeighborGroup", "(", "Tile", "tile", ",", "Tile", "neighbor", ")", "{", "final", "String", "neighborGroup", ";", "if", "(", "isTransition", "(", "neighbor", ")", ")", "{", "if", "(", "isTransition", "(", "tile", ")", ")", "{", "n...
Get the neighbor group depending if it is a transition tile. @param tile The current tile. @param neighbor The neighbor tile. @return The neighbor group, <code>null</code> if none.
[ "Get", "the", "neighbor", "group", "depending", "if", "it", "is", "a", "transition", "tile", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/MapTransitionExtractor.java#L184-L203
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java
ComputeNodesImpl.reimageAsync
public Observable<Void> reimageAsync(String poolId, String nodeId) { return reimageWithServiceResponseAsync(poolId, nodeId).map(new Func1<ServiceResponseWithHeaders<Void, ComputeNodeReimageHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, ComputeNodeReimageHeaders> response) { return response.body(); } }); }
java
public Observable<Void> reimageAsync(String poolId, String nodeId) { return reimageWithServiceResponseAsync(poolId, nodeId).map(new Func1<ServiceResponseWithHeaders<Void, ComputeNodeReimageHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, ComputeNodeReimageHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "reimageAsync", "(", "String", "poolId", ",", "String", "nodeId", ")", "{", "return", "reimageWithServiceResponseAsync", "(", "poolId", ",", "nodeId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponseWithHeader...
Reinstalls the operating system on the specified compute node. You can reinstall the operating system on a node only if it is in an idle or running state. This API can be invoked only on pools created with the cloud service configuration property. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node that you want to restart. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful.
[ "Reinstalls", "the", "operating", "system", "on", "the", "specified", "compute", "node", ".", "You", "can", "reinstall", "the", "operating", "system", "on", "a", "node", "only", "if", "it", "is", "in", "an", "idle", "or", "running", "state", ".", "This", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java#L1310-L1317
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/transform/transformpolicy_binding.java
transformpolicy_binding.get
public static transformpolicy_binding get(nitro_service service, String name) throws Exception{ transformpolicy_binding obj = new transformpolicy_binding(); obj.set_name(name); transformpolicy_binding response = (transformpolicy_binding) obj.get_resource(service); return response; }
java
public static transformpolicy_binding get(nitro_service service, String name) throws Exception{ transformpolicy_binding obj = new transformpolicy_binding(); obj.set_name(name); transformpolicy_binding response = (transformpolicy_binding) obj.get_resource(service); return response; }
[ "public", "static", "transformpolicy_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "transformpolicy_binding", "obj", "=", "new", "transformpolicy_binding", "(", ")", ";", "obj", ".", "set_name", "(", "nam...
Use this API to fetch transformpolicy_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "transformpolicy_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/transform/transformpolicy_binding.java#L136-L141
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/source/extractor/utils/Utils.java
Utils.dateTimeToString
public static String dateTimeToString(DateTime input, String format, String timezone) { String tz = StringUtils.defaultString(timezone, ConfigurationKeys.DEFAULT_SOURCE_TIMEZONE); DateTimeZone dateTimeZone = getTimeZone(tz); DateTimeFormatter outputDtFormat = DateTimeFormat.forPattern(format).withZone(dateTimeZone); return outputDtFormat.print(input); }
java
public static String dateTimeToString(DateTime input, String format, String timezone) { String tz = StringUtils.defaultString(timezone, ConfigurationKeys.DEFAULT_SOURCE_TIMEZONE); DateTimeZone dateTimeZone = getTimeZone(tz); DateTimeFormatter outputDtFormat = DateTimeFormat.forPattern(format).withZone(dateTimeZone); return outputDtFormat.print(input); }
[ "public", "static", "String", "dateTimeToString", "(", "DateTime", "input", ",", "String", "format", ",", "String", "timezone", ")", "{", "String", "tz", "=", "StringUtils", ".", "defaultString", "(", "timezone", ",", "ConfigurationKeys", ".", "DEFAULT_SOURCE_TIME...
Convert joda time to a string in the given format @param input timestamp @param format expected format @param timezone time zone of timestamp @return string format of timestamp
[ "Convert", "joda", "time", "to", "a", "string", "in", "the", "given", "format" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/source/extractor/utils/Utils.java#L308-L313
sundrio/sundrio
codegen/src/main/java/io/sundr/codegen/utils/TypeUtils.java
TypeUtils.typeGenericOf
public static TypeDef typeGenericOf(TypeDef base, TypeParamDef... parameters) { return new TypeDefBuilder(base) .withParameters(parameters) .build(); }
java
public static TypeDef typeGenericOf(TypeDef base, TypeParamDef... parameters) { return new TypeDefBuilder(base) .withParameters(parameters) .build(); }
[ "public", "static", "TypeDef", "typeGenericOf", "(", "TypeDef", "base", ",", "TypeParamDef", "...", "parameters", ")", "{", "return", "new", "TypeDefBuilder", "(", "base", ")", ".", "withParameters", "(", "parameters", ")", ".", "build", "(", ")", ";", "}" ]
Sets one {@link io.sundr.codegen.model.TypeDef} as a generic of an other. @param base The base type. @param parameters The parameter types. @return The generic type.
[ "Sets", "one", "{", "@link", "io", ".", "sundr", ".", "codegen", ".", "model", ".", "TypeDef", "}", "as", "a", "generic", "of", "an", "other", "." ]
train
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/codegen/src/main/java/io/sundr/codegen/utils/TypeUtils.java#L147-L151
kotcrab/vis-ui
ui/src/main/java/com/kotcrab/vis/ui/building/utilities/Padding.java
Padding.setPadding
public static Table setPadding (final Padding padding, final Table table) { table.pad(padding.getTop(), padding.getLeft(), padding.getBottom(), padding.getRight()); return table; }
java
public static Table setPadding (final Padding padding, final Table table) { table.pad(padding.getTop(), padding.getLeft(), padding.getBottom(), padding.getRight()); return table; }
[ "public", "static", "Table", "setPadding", "(", "final", "Padding", "padding", ",", "final", "Table", "table", ")", "{", "table", ".", "pad", "(", "padding", ".", "getTop", "(", ")", ",", "padding", ".", "getLeft", "(", ")", ",", "padding", ".", "getBo...
Allows to set Table's padding with the Padding object, which has be done externally, as it's not part of the standard libGDX API. @param padding contains data of padding sizes. @param table will have the padding set according to the given data. @return the given table for chaining.
[ "Allows", "to", "set", "Table", "s", "padding", "with", "the", "Padding", "object", "which", "has", "be", "done", "externally", "as", "it", "s", "not", "part", "of", "the", "standard", "libGDX", "API", "." ]
train
https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/building/utilities/Padding.java#L177-L180
google/closure-templates
java/src/com/google/template/soy/jbcsrc/restricted/SoyExpression.java
SoyExpression.coerceToDouble
public SoyExpression coerceToDouble() { if (!isBoxed()) { if (soyRuntimeType.isKnownFloat()) { return this; } if (soyRuntimeType.isKnownInt()) { return forFloat(BytecodeUtils.numericConversion(delegate, Type.DOUBLE_TYPE)); } throw new UnsupportedOperationException("Can't convert " + resultType() + " to a double"); } if (soyRuntimeType.isKnownFloat()) { return forFloat(delegate.invoke(MethodRef.SOY_VALUE_FLOAT_VALUE)); } return forFloat(delegate.invoke(MethodRef.SOY_VALUE_NUMBER_VALUE)); }
java
public SoyExpression coerceToDouble() { if (!isBoxed()) { if (soyRuntimeType.isKnownFloat()) { return this; } if (soyRuntimeType.isKnownInt()) { return forFloat(BytecodeUtils.numericConversion(delegate, Type.DOUBLE_TYPE)); } throw new UnsupportedOperationException("Can't convert " + resultType() + " to a double"); } if (soyRuntimeType.isKnownFloat()) { return forFloat(delegate.invoke(MethodRef.SOY_VALUE_FLOAT_VALUE)); } return forFloat(delegate.invoke(MethodRef.SOY_VALUE_NUMBER_VALUE)); }
[ "public", "SoyExpression", "coerceToDouble", "(", ")", "{", "if", "(", "!", "isBoxed", "(", ")", ")", "{", "if", "(", "soyRuntimeType", ".", "isKnownFloat", "(", ")", ")", "{", "return", "this", ";", "}", "if", "(", "soyRuntimeType", ".", "isKnownInt", ...
Coerce this expression to a double value. Useful for float-int comparisons.
[ "Coerce", "this", "expression", "to", "a", "double", "value", ".", "Useful", "for", "float", "-", "int", "comparisons", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/SoyExpression.java#L408-L422
pressgang-ccms/PressGangCCMSCommonUtilities
src/main/java/org/jboss/pressgang/ccms/utils/common/StringUtilities.java
StringUtilities.similarDamerauLevenshtein
public static double similarDamerauLevenshtein(String s1, String s2) { if (s1.equals(s2)) { return 1.0; } // Make sure s1 is the longest string if (s1.length() < s2.length()) { String swap = s1; s1 = s2; s2 = swap; } int bigLength = s1.length(); return (bigLength - getDamerauLevenshteinDistance(s2, s1)) / (double) bigLength; }
java
public static double similarDamerauLevenshtein(String s1, String s2) { if (s1.equals(s2)) { return 1.0; } // Make sure s1 is the longest string if (s1.length() < s2.length()) { String swap = s1; s1 = s2; s2 = swap; } int bigLength = s1.length(); return (bigLength - getDamerauLevenshteinDistance(s2, s1)) / (double) bigLength; }
[ "public", "static", "double", "similarDamerauLevenshtein", "(", "String", "s1", ",", "String", "s2", ")", "{", "if", "(", "s1", ".", "equals", "(", "s2", ")", ")", "{", "return", "1.0", ";", "}", "// Make sure s1 is the longest string", "if", "(", "s1", "....
Checks to see how similar two strings are using the Damerau-Levenshtein distance algorithm. @param s1 The first string to compare against. @param s2 The second string to compare against. @return A value between 0 and 1.0, where 1.0 is an exact match and 0 is no match at all.
[ "Checks", "to", "see", "how", "similar", "two", "strings", "are", "using", "the", "Damerau", "-", "Levenshtein", "distance", "algorithm", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/StringUtilities.java#L388-L402
googleads/googleads-java-lib
modules/ads_lib/src/main/java/com/google/api/ads/admanager/lib/utils/DateTimesHelper.java
DateTimesHelper.toDateTime
public T toDateTime(Instant instant, String timeZoneId) { return toDateTime( instant.toDateTime(DateTimeZone.forTimeZone(TimeZone.getTimeZone(timeZoneId)))); }
java
public T toDateTime(Instant instant, String timeZoneId) { return toDateTime( instant.toDateTime(DateTimeZone.forTimeZone(TimeZone.getTimeZone(timeZoneId)))); }
[ "public", "T", "toDateTime", "(", "Instant", "instant", ",", "String", "timeZoneId", ")", "{", "return", "toDateTime", "(", "instant", ".", "toDateTime", "(", "DateTimeZone", ".", "forTimeZone", "(", "TimeZone", ".", "getTimeZone", "(", "timeZoneId", ")", ")",...
Converts an {@code Instant} object to an API date time in the time zone supplied.
[ "Converts", "an", "{" ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/admanager/lib/utils/DateTimesHelper.java#L63-L66
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/HeapQuickSelectSketch.java
HeapQuickSelectSketch.heapifyInstance
static HeapQuickSelectSketch heapifyInstance(final Memory srcMem, final long seed) { final int preambleLongs = extractPreLongs(srcMem); //byte 0 final int lgNomLongs = extractLgNomLongs(srcMem); //byte 3 final int lgArrLongs = extractLgArrLongs(srcMem); //byte 4 checkUnionQuickSelectFamily(srcMem, preambleLongs, lgNomLongs); checkMemIntegrity(srcMem, seed, preambleLongs, lgNomLongs, lgArrLongs); final float p = extractP(srcMem); //bytes 12-15 final int lgRF = extractLgResizeFactor(srcMem); //byte 0 ResizeFactor myRF = ResizeFactor.getRF(lgRF); final int familyID = extractFamilyID(srcMem); final Family family = Family.idToFamily(familyID); if ((myRF == ResizeFactor.X1) && (lgArrLongs != Util.startingSubMultiple(lgNomLongs + 1, myRF, MIN_LG_ARR_LONGS))) { myRF = ResizeFactor.X2; } final HeapQuickSelectSketch hqss = new HeapQuickSelectSketch(lgNomLongs, seed, p, myRF, preambleLongs, family); hqss.lgArrLongs_ = lgArrLongs; hqss.hashTableThreshold_ = setHashTableThreshold(lgNomLongs, lgArrLongs); hqss.curCount_ = extractCurCount(srcMem); hqss.thetaLong_ = extractThetaLong(srcMem); hqss.empty_ = PreambleUtil.isEmpty(srcMem); hqss.cache_ = new long[1 << lgArrLongs]; srcMem.getLongArray(preambleLongs << 3, hqss.cache_, 0, 1 << lgArrLongs); //read in as hash table return hqss; }
java
static HeapQuickSelectSketch heapifyInstance(final Memory srcMem, final long seed) { final int preambleLongs = extractPreLongs(srcMem); //byte 0 final int lgNomLongs = extractLgNomLongs(srcMem); //byte 3 final int lgArrLongs = extractLgArrLongs(srcMem); //byte 4 checkUnionQuickSelectFamily(srcMem, preambleLongs, lgNomLongs); checkMemIntegrity(srcMem, seed, preambleLongs, lgNomLongs, lgArrLongs); final float p = extractP(srcMem); //bytes 12-15 final int lgRF = extractLgResizeFactor(srcMem); //byte 0 ResizeFactor myRF = ResizeFactor.getRF(lgRF); final int familyID = extractFamilyID(srcMem); final Family family = Family.idToFamily(familyID); if ((myRF == ResizeFactor.X1) && (lgArrLongs != Util.startingSubMultiple(lgNomLongs + 1, myRF, MIN_LG_ARR_LONGS))) { myRF = ResizeFactor.X2; } final HeapQuickSelectSketch hqss = new HeapQuickSelectSketch(lgNomLongs, seed, p, myRF, preambleLongs, family); hqss.lgArrLongs_ = lgArrLongs; hqss.hashTableThreshold_ = setHashTableThreshold(lgNomLongs, lgArrLongs); hqss.curCount_ = extractCurCount(srcMem); hqss.thetaLong_ = extractThetaLong(srcMem); hqss.empty_ = PreambleUtil.isEmpty(srcMem); hqss.cache_ = new long[1 << lgArrLongs]; srcMem.getLongArray(preambleLongs << 3, hqss.cache_, 0, 1 << lgArrLongs); //read in as hash table return hqss; }
[ "static", "HeapQuickSelectSketch", "heapifyInstance", "(", "final", "Memory", "srcMem", ",", "final", "long", "seed", ")", "{", "final", "int", "preambleLongs", "=", "extractPreLongs", "(", "srcMem", ")", ";", "//byte 0", "final", "int", "lgNomLongs", "=", "extr...
Heapify a sketch from a Memory UpdateSketch or Union object containing sketch data. @param srcMem The source Memory object. <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a> @param seed <a href="{@docRoot}/resources/dictionary.html#seed">See seed</a> @return instance of this sketch
[ "Heapify", "a", "sketch", "from", "a", "Memory", "UpdateSketch", "or", "Union", "object", "containing", "sketch", "data", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/HeapQuickSelectSketch.java#L97-L126
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.toListString
public static String toListString(Collection self, int maxSize) { return (self == null) ? "null" : InvokerHelper.toListString(self, maxSize); }
java
public static String toListString(Collection self, int maxSize) { return (self == null) ? "null" : InvokerHelper.toListString(self, maxSize); }
[ "public", "static", "String", "toListString", "(", "Collection", "self", ",", "int", "maxSize", ")", "{", "return", "(", "self", "==", "null", ")", "?", "\"null\"", ":", "InvokerHelper", ".", "toListString", "(", "self", ",", "maxSize", ")", ";", "}" ]
Returns the string representation of the given list. The string displays the contents of the list, similar to a list literal, i.e. <code>[1, 2, a]</code>. @param self a Collection @param maxSize stop after approximately this many characters and append '...' @return the string representation @since 1.7.3
[ "Returns", "the", "string", "representation", "of", "the", "given", "list", ".", "The", "string", "displays", "the", "contents", "of", "the", "list", "similar", "to", "a", "list", "literal", "i", ".", "e", ".", "<code", ">", "[", "1", "2", "a", "]", ...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L14912-L14914
deeplearning4j/deeplearning4j
datavec/datavec-api/src/main/java/org/datavec/api/transform/condition/BooleanCondition.java
BooleanCondition.XOR
public static Condition XOR(Condition first, Condition second) { return new BooleanCondition(Type.XOR, first, second); }
java
public static Condition XOR(Condition first, Condition second) { return new BooleanCondition(Type.XOR, first, second); }
[ "public", "static", "Condition", "XOR", "(", "Condition", "first", ",", "Condition", "second", ")", "{", "return", "new", "BooleanCondition", "(", "Type", ".", "XOR", ",", "first", ",", "second", ")", ";", "}" ]
And of all the given conditions @param first the first condition @param second the second condition for xor @return the xor of these 2 conditions
[ "And", "of", "all", "the", "given", "conditions" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/transform/condition/BooleanCondition.java#L296-L298
pawelprazak/java-extended
hamcrest/src/main/java/com/bluecatcode/hamcrest/matchers/IsThrowable.java
IsThrowable.withCause
@Factory public static <T extends Throwable, C extends Throwable> Matcher<T> withCause(final Matcher<C> matcher) { return new CustomTypeSafeMatcher<T>(CustomMatchers.fixedDescription("cause ", matcher)) { @Override protected boolean matchesSafely(T item) { return matcher.matches(item.getCause()); } public void describeMismatchSafely(T item, Description mismatchDescription) { matcher.describeMismatch(item.getCause(), mismatchDescription); } }; }
java
@Factory public static <T extends Throwable, C extends Throwable> Matcher<T> withCause(final Matcher<C> matcher) { return new CustomTypeSafeMatcher<T>(CustomMatchers.fixedDescription("cause ", matcher)) { @Override protected boolean matchesSafely(T item) { return matcher.matches(item.getCause()); } public void describeMismatchSafely(T item, Description mismatchDescription) { matcher.describeMismatch(item.getCause(), mismatchDescription); } }; }
[ "@", "Factory", "public", "static", "<", "T", "extends", "Throwable", ",", "C", "extends", "Throwable", ">", "Matcher", "<", "T", ">", "withCause", "(", "final", "Matcher", "<", "C", ">", "matcher", ")", "{", "return", "new", "CustomTypeSafeMatcher", "<", ...
Matches if value is a throwable with a cause that matches the <tt>matcher</tt> @param matcher cause matcher @param <T> the throwable type @param <C> the cause throwable type @return the matcher
[ "Matches", "if", "value", "is", "a", "throwable", "with", "a", "cause", "that", "matches", "the", "<tt", ">", "matcher<", "/", "tt", ">" ]
train
https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/hamcrest/src/main/java/com/bluecatcode/hamcrest/matchers/IsThrowable.java#L98-L110
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/dataformats/json/jackson/DefaultFeature.java
DefaultFeature.addProperty
public void addProperty(String propertyName, Object value) { if (propertyName != null) { propertyNames.add(propertyName); if (value == null) { properties.remove(propertyName); } else { properties.put(propertyName, value); } } }
java
public void addProperty(String propertyName, Object value) { if (propertyName != null) { propertyNames.add(propertyName); if (value == null) { properties.remove(propertyName); } else { properties.put(propertyName, value); } } }
[ "public", "void", "addProperty", "(", "String", "propertyName", ",", "Object", "value", ")", "{", "if", "(", "propertyName", "!=", "null", ")", "{", "propertyNames", ".", "add", "(", "propertyName", ")", ";", "if", "(", "value", "==", "null", ")", "{", ...
The name of the property to add. if it already exists, the value is updated. If the propertyname is null, the property addition is ignored. @param propertyName the name of the property to add @param value the value to assign to the given property.
[ "The", "name", "of", "the", "property", "to", "add", ".", "if", "it", "already", "exists", "the", "value", "is", "updated", ".", "If", "the", "propertyname", "is", "null", "the", "property", "addition", "is", "ignored", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/DefaultFeature.java#L119-L133
protegeproject/jpaul
src/main/java/jpaul/DataStructs/DSUtil.java
DSUtil.unionIterable
public static <E> Iterable<E> unionIterable(Iterable<E> it1, Iterable<E> it2) { return unionIterable(Arrays.<Iterable<E>>asList(it1, it2)); }
java
public static <E> Iterable<E> unionIterable(Iterable<E> it1, Iterable<E> it2) { return unionIterable(Arrays.<Iterable<E>>asList(it1, it2)); }
[ "public", "static", "<", "E", ">", "Iterable", "<", "E", ">", "unionIterable", "(", "Iterable", "<", "E", ">", "it1", ",", "Iterable", "<", "E", ">", "it2", ")", "{", "return", "unionIterable", "(", "Arrays", ".", "<", "Iterable", "<", "E", ">", ">...
Returns an immutable <code>Iterable</code> that is the union of two <code>Iterable</code>s. The resulting <code>Iterable</code> contains first all elements from <code>it1</code>, and next all elements from <code>it2</code>.
[ "Returns", "an", "immutable", "<code", ">", "Iterable<", "/", "code", ">", "that", "is", "the", "union", "of", "two", "<code", ">", "Iterable<", "/", "code", ">", "s", ".", "The", "resulting", "<code", ">", "Iterable<", "/", "code", ">", "contains", "f...
train
https://github.com/protegeproject/jpaul/blob/db579ffb16faaa4b0c577ec82c246f7349427714/src/main/java/jpaul/DataStructs/DSUtil.java#L223-L225
jenkinsci/jenkins
core/src/main/java/hudson/util/jna/RegistryKey.java
RegistryKey.getSubKeys
public Collection<String> getSubKeys() { WINBASE.FILETIME lpftLastWriteTime; TreeSet<String> subKeys = new TreeSet<>(); char[] lpName = new char[256]; IntByReference lpcName = new IntByReference(256); lpftLastWriteTime = new WINBASE.FILETIME(); int dwIndex = 0; while (Advapi32.INSTANCE.RegEnumKeyEx(handle, dwIndex, lpName, lpcName, null, null, null, lpftLastWriteTime) == WINERROR.ERROR_SUCCESS) { subKeys.add(new String(lpName, 0, lpcName.getValue())); lpcName.setValue(256); dwIndex++; } return subKeys; }
java
public Collection<String> getSubKeys() { WINBASE.FILETIME lpftLastWriteTime; TreeSet<String> subKeys = new TreeSet<>(); char[] lpName = new char[256]; IntByReference lpcName = new IntByReference(256); lpftLastWriteTime = new WINBASE.FILETIME(); int dwIndex = 0; while (Advapi32.INSTANCE.RegEnumKeyEx(handle, dwIndex, lpName, lpcName, null, null, null, lpftLastWriteTime) == WINERROR.ERROR_SUCCESS) { subKeys.add(new String(lpName, 0, lpcName.getValue())); lpcName.setValue(256); dwIndex++; } return subKeys; }
[ "public", "Collection", "<", "String", ">", "getSubKeys", "(", ")", "{", "WINBASE", ".", "FILETIME", "lpftLastWriteTime", ";", "TreeSet", "<", "String", ">", "subKeys", "=", "new", "TreeSet", "<>", "(", ")", ";", "char", "[", "]", "lpName", "=", "new", ...
Get all sub keys of a key. @return array with all sub key names
[ "Get", "all", "sub", "keys", "of", "a", "key", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/jna/RegistryKey.java#L188-L204
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/Utils.java
Utils.parseFloat
public static float parseFloat(String val, float defVal){ if(TextUtils.isEmpty(val)) return defVal; try{ return Float.parseFloat(val); }catch (NumberFormatException e){ return defVal; } }
java
public static float parseFloat(String val, float defVal){ if(TextUtils.isEmpty(val)) return defVal; try{ return Float.parseFloat(val); }catch (NumberFormatException e){ return defVal; } }
[ "public", "static", "float", "parseFloat", "(", "String", "val", ",", "float", "defVal", ")", "{", "if", "(", "TextUtils", ".", "isEmpty", "(", "val", ")", ")", "return", "defVal", ";", "try", "{", "return", "Float", ".", "parseFloat", "(", "val", ")",...
Parse a float from a String in a safe manner. @param val the string to parse @param defVal the default value to return if parsing fails @return the parsed float, or default value
[ "Parse", "a", "float", "from", "a", "String", "in", "a", "safe", "manner", "." ]
train
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/Utils.java#L246-L253
DDTH/ddth-tsc
ddth-tsc-core/src/main/java/com/github/ddth/tsc/redis/RedisCounterFactory.java
RedisCounterFactory.newJedisPool
public static JedisPool newJedisPool(String hostAndPort, String password, int db) { return newJedisPool(hostAndPort, password, db, DEFAULT_TIMEOUT_MS); }
java
public static JedisPool newJedisPool(String hostAndPort, String password, int db) { return newJedisPool(hostAndPort, password, db, DEFAULT_TIMEOUT_MS); }
[ "public", "static", "JedisPool", "newJedisPool", "(", "String", "hostAndPort", ",", "String", "password", ",", "int", "db", ")", "{", "return", "newJedisPool", "(", "hostAndPort", ",", "password", ",", "db", ",", "DEFAULT_TIMEOUT_MS", ")", ";", "}" ]
Creates a new {@link JedisPool}, with specified database and default timeout. @param hostAndPort @param password @param db @return @since 0.7.0
[ "Creates", "a", "new", "{", "@link", "JedisPool", "}", "with", "specified", "database", "and", "default", "timeout", "." ]
train
https://github.com/DDTH/ddth-tsc/blob/d233c304c8fed2f3c069de42a36b7bbd5c8be01b/ddth-tsc-core/src/main/java/com/github/ddth/tsc/redis/RedisCounterFactory.java#L49-L51