repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
ingwarsw/arquillian-suite-extension
src/main/java/org/eu/ingwar/tools/arquillian/extension/deployment/EarDescriptorBuilder.java
EarDescriptorBuilder.addWeb
public EarDescriptorBuilder addWeb(String filename, String context) { Map.Entry<String, String> entry = new AbstractMap.SimpleEntry<String, String>(filename, context); this.webs.add(entry); return this; }
java
public EarDescriptorBuilder addWeb(String filename, String context) { Map.Entry<String, String> entry = new AbstractMap.SimpleEntry<String, String>(filename, context); this.webs.add(entry); return this; }
[ "public", "EarDescriptorBuilder", "addWeb", "(", "String", "filename", ",", "String", "context", ")", "{", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", "=", "new", "AbstractMap", ".", "SimpleEntry", "<", "String", ",", "String", ">", "(...
Adds WEB module to descriptor. @param filename name of WAR to add @param context web context to set for WEB module @return this object
[ "Adds", "WEB", "module", "to", "descriptor", "." ]
train
https://github.com/ingwarsw/arquillian-suite-extension/blob/93c9e542ead1d52f45e87b0632bb02ac11f693c8/src/main/java/org/eu/ingwar/tools/arquillian/extension/deployment/EarDescriptorBuilder.java#L81-L85
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwpolicylabel.java
appfwpolicylabel.get
public static appfwpolicylabel get(nitro_service service, String labelname) throws Exception{ appfwpolicylabel obj = new appfwpolicylabel(); obj.set_labelname(labelname); appfwpolicylabel response = (appfwpolicylabel) obj.get_resource(service); return response; }
java
public static appfwpolicylabel get(nitro_service service, String labelname) throws Exception{ appfwpolicylabel obj = new appfwpolicylabel(); obj.set_labelname(labelname); appfwpolicylabel response = (appfwpolicylabel) obj.get_resource(service); return response; }
[ "public", "static", "appfwpolicylabel", "get", "(", "nitro_service", "service", ",", "String", "labelname", ")", "throws", "Exception", "{", "appfwpolicylabel", "obj", "=", "new", "appfwpolicylabel", "(", ")", ";", "obj", ".", "set_labelname", "(", "labelname", ...
Use this API to fetch appfwpolicylabel resource of given name .
[ "Use", "this", "API", "to", "fetch", "appfwpolicylabel", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwpolicylabel.java#L333-L338
morimekta/providence
providence-core/src/main/java/net/morimekta/providence/util/BaseTypeRegistry.java
BaseTypeRegistry.qualifiedNameFromIdAndContext
protected static String qualifiedNameFromIdAndContext(String name, String context) { if (!name.contains(".")) { return context + "." + name; } return name; }
java
protected static String qualifiedNameFromIdAndContext(String name, String context) { if (!name.contains(".")) { return context + "." + name; } return name; }
[ "protected", "static", "String", "qualifiedNameFromIdAndContext", "(", "String", "name", ",", "String", "context", ")", "{", "if", "(", "!", "name", ".", "contains", "(", "\".\"", ")", ")", "{", "return", "context", "+", "\".\"", "+", "name", ";", "}", "...
Make a qualified type name from a name identifier string and the program context. @param name The type name. @param context The program context. @return The qualified name containing program name and type name.
[ "Make", "a", "qualified", "type", "name", "from", "a", "name", "identifier", "string", "and", "the", "program", "context", "." ]
train
https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-core/src/main/java/net/morimekta/providence/util/BaseTypeRegistry.java#L183-L188
snowflakedb/snowflake-jdbc
src/main/java/net/snowflake/client/core/SFTrustManager.java
SFTrustManager.isValidityRange
private static boolean isValidityRange(Date currentTime, Date thisUpdate, Date nextUpdate) { long tolerableValidity = calculateTolerableVadility(thisUpdate, nextUpdate); return thisUpdate.getTime() - MAX_CLOCK_SKEW_IN_MILLISECONDS <= currentTime.getTime() && currentTime.getTime() <= nextUpdate.getTime() + tolerableValidity; }
java
private static boolean isValidityRange(Date currentTime, Date thisUpdate, Date nextUpdate) { long tolerableValidity = calculateTolerableVadility(thisUpdate, nextUpdate); return thisUpdate.getTime() - MAX_CLOCK_SKEW_IN_MILLISECONDS <= currentTime.getTime() && currentTime.getTime() <= nextUpdate.getTime() + tolerableValidity; }
[ "private", "static", "boolean", "isValidityRange", "(", "Date", "currentTime", ",", "Date", "thisUpdate", ",", "Date", "nextUpdate", ")", "{", "long", "tolerableValidity", "=", "calculateTolerableVadility", "(", "thisUpdate", ",", "nextUpdate", ")", ";", "return", ...
Checks the validity @param currentTime the current time @param thisUpdate the last update timestamp @param nextUpdate the next update timestamp @return true if valid or false
[ "Checks", "the", "validity" ]
train
https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L1592-L1597
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.purgeDeletedStorageAccount
public void purgeDeletedStorageAccount(String vaultBaseUrl, String storageAccountName) { purgeDeletedStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName).toBlocking().single().body(); }
java
public void purgeDeletedStorageAccount(String vaultBaseUrl, String storageAccountName) { purgeDeletedStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName).toBlocking().single().body(); }
[ "public", "void", "purgeDeletedStorageAccount", "(", "String", "vaultBaseUrl", ",", "String", "storageAccountName", ")", "{", "purgeDeletedStorageAccountWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "storageAccountName", ")", ".", "toBlocking", "(", ")", ".", "sing...
Permanently deletes the specified storage account. The purge deleted storage account operation removes the secret permanently, without the possibility of recovery. This operation can only be performed on a soft-delete enabled vault. This operation requires the storage/purge permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Permanently", "deletes", "the", "specified", "storage", "account", ".", "The", "purge", "deleted", "storage", "account", "operation", "removes", "the", "secret", "permanently", "without", "the", "possibility", "of", "recovery", ".", "This", "operation", "can", "o...
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#L9344-L9346
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/ui/MaterialListValueBox.java
MaterialListValueBox.insertItem
public void insertItem(T value, String text, int index) { insertItemInternal(value, text, index, true); }
java
public void insertItem(T value, String text, int index) { insertItemInternal(value, text, index, true); }
[ "public", "void", "insertItem", "(", "T", "value", ",", "String", "text", ",", "int", "index", ")", "{", "insertItemInternal", "(", "value", ",", "text", ",", "index", ",", "true", ")", ";", "}" ]
Inserts an item into the list box, specifying an initial value for the item. Has the same effect as <pre>insertItem(value, null, item, index)</pre> @param value the item's value, to be submitted if it is part of a {@link FormPanel}. @param text the text of the item to be inserted @param index the index at which to insert it
[ "Inserts", "an", "item", "into", "the", "list", "box", "specifying", "an", "initial", "value", "for", "the", "item", ".", "Has", "the", "same", "effect", "as", "<pre", ">", "insertItem", "(", "value", "null", "item", "index", ")", "<", "/", "pre", ">" ...
train
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialListValueBox.java#L383-L385
craterdog/java-general-utilities
src/main/java/craterdog/utils/ByteUtils.java
ByteUtils.bytesToInt
static public int bytesToInt(byte[] buffer, int index) { int length = buffer.length - index; if (length > 4) length = 4; int integer = 0; for (int i = 0; i < length; i++) { integer |= ((buffer[index + length - i - 1] & 0xFF) << (i * 8)); } return integer; }
java
static public int bytesToInt(byte[] buffer, int index) { int length = buffer.length - index; if (length > 4) length = 4; int integer = 0; for (int i = 0; i < length; i++) { integer |= ((buffer[index + length - i - 1] & 0xFF) << (i * 8)); } return integer; }
[ "static", "public", "int", "bytesToInt", "(", "byte", "[", "]", "buffer", ",", "int", "index", ")", "{", "int", "length", "=", "buffer", ".", "length", "-", "index", ";", "if", "(", "length", ">", "4", ")", "length", "=", "4", ";", "int", "integer"...
This function converts the bytes in a byte array at the specified index to its corresponding integer value. @param buffer The byte array containing the integer. @param index The index for the first byte in the byte array. @return The corresponding integer value.
[ "This", "function", "converts", "the", "bytes", "in", "a", "byte", "array", "at", "the", "specified", "index", "to", "its", "corresponding", "integer", "value", "." ]
train
https://github.com/craterdog/java-general-utilities/blob/a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57/src/main/java/craterdog/utils/ByteUtils.java#L232-L240
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/Cursor.java
Cursor.setLocation
public void setLocation(int x, int y) { screenX = UtilMath.clamp(x, minX, maxX); screenY = UtilMath.clamp(y, minY, maxY); }
java
public void setLocation(int x, int y) { screenX = UtilMath.clamp(x, minX, maxX); screenY = UtilMath.clamp(y, minY, maxY); }
[ "public", "void", "setLocation", "(", "int", "x", ",", "int", "y", ")", "{", "screenX", "=", "UtilMath", ".", "clamp", "(", "x", ",", "minX", ",", "maxX", ")", ";", "screenY", "=", "UtilMath", ".", "clamp", "(", "y", ",", "minY", ",", "maxY", ")"...
Set cursor location. @param x The horizontal location. @param y The vertical location.
[ "Set", "cursor", "location", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/Cursor.java#L178-L182
apiman/apiman
manager/api/war/tomcat8/src/main/java/io/apiman/manager/api/war/tomcat8/Tomcat8PluginRegistry.java
Tomcat8PluginRegistry.getPluginDir
private static File getPluginDir() { String dataDirPath = System.getProperty("catalina.home"); //$NON-NLS-1$ File dataDir = new File(dataDirPath, "data"); //$NON-NLS-1$ if (!dataDir.getParentFile().isDirectory()) { throw new RuntimeException("Failed to find Tomcat home at: " + dataDirPath); //$NON-NLS-1$ } if (!dataDir.exists()) { dataDir.mkdir(); } File pluginsDir = new File(dataDir, "apiman/plugins"); //$NON-NLS-1$ return pluginsDir; }
java
private static File getPluginDir() { String dataDirPath = System.getProperty("catalina.home"); //$NON-NLS-1$ File dataDir = new File(dataDirPath, "data"); //$NON-NLS-1$ if (!dataDir.getParentFile().isDirectory()) { throw new RuntimeException("Failed to find Tomcat home at: " + dataDirPath); //$NON-NLS-1$ } if (!dataDir.exists()) { dataDir.mkdir(); } File pluginsDir = new File(dataDir, "apiman/plugins"); //$NON-NLS-1$ return pluginsDir; }
[ "private", "static", "File", "getPluginDir", "(", ")", "{", "String", "dataDirPath", "=", "System", ".", "getProperty", "(", "\"catalina.home\"", ")", ";", "//$NON-NLS-1$", "File", "dataDir", "=", "new", "File", "(", "dataDirPath", ",", "\"data\"", ")", ";", ...
Creates the directory to use for the plugin registry. The location of the plugin registry is in the tomcat data directory.
[ "Creates", "the", "directory", "to", "use", "for", "the", "plugin", "registry", ".", "The", "location", "of", "the", "plugin", "registry", "is", "in", "the", "tomcat", "data", "directory", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/war/tomcat8/src/main/java/io/apiman/manager/api/war/tomcat8/Tomcat8PluginRegistry.java#L48-L59
facebookarchive/hadoop-20
src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyUgiManager.java
ProxyUgiManager.getUgiForUser
public static synchronized UnixUserGroupInformation getUgiForUser( String userName) { long now = System.currentTimeMillis(); long cutoffTime = now - ugiLifetime; CachedUgi cachedUgi = ugiCache.get(userName); if (cachedUgi != null && cachedUgi.getInitTime() > cutoffTime) return cachedUgi.getUgi(); UnixUserGroupInformation ugi = null; try { ugi = getUgi(userName); } catch (IOException e) { return null; } if (ugiCache.size() > CLEANUP_THRESHOLD) { // remove expired ugi's first for (Iterator<Map.Entry<String, CachedUgi>> it = ugiCache.entrySet() .iterator(); it.hasNext();) { Map.Entry<String, CachedUgi> e = it.next(); if (e.getValue().getInitTime() < cutoffTime) { it.remove(); } } } ugiCache.put(ugi.getUserName(), new CachedUgi(ugi, now)); return ugi; }
java
public static synchronized UnixUserGroupInformation getUgiForUser( String userName) { long now = System.currentTimeMillis(); long cutoffTime = now - ugiLifetime; CachedUgi cachedUgi = ugiCache.get(userName); if (cachedUgi != null && cachedUgi.getInitTime() > cutoffTime) return cachedUgi.getUgi(); UnixUserGroupInformation ugi = null; try { ugi = getUgi(userName); } catch (IOException e) { return null; } if (ugiCache.size() > CLEANUP_THRESHOLD) { // remove expired ugi's first for (Iterator<Map.Entry<String, CachedUgi>> it = ugiCache.entrySet() .iterator(); it.hasNext();) { Map.Entry<String, CachedUgi> e = it.next(); if (e.getValue().getInitTime() < cutoffTime) { it.remove(); } } } ugiCache.put(ugi.getUserName(), new CachedUgi(ugi, now)); return ugi; }
[ "public", "static", "synchronized", "UnixUserGroupInformation", "getUgiForUser", "(", "String", "userName", ")", "{", "long", "now", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "long", "cutoffTime", "=", "now", "-", "ugiLifetime", ";", "CachedUgi", "...
retrieve an ugi for a user. try the cache first, if not found, get it by running a shell command
[ "retrieve", "an", "ugi", "for", "a", "user", ".", "try", "the", "cache", "first", "if", "not", "found", "get", "it", "by", "running", "a", "shell", "command" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyUgiManager.java#L49-L73
amazon-archives/aws-sdk-java-resources
aws-resources-core/src/main/java/com/amazonaws/resources/internal/ReflectionUtils.java
ReflectionUtils.getByPath
public static Object getByPath(Object target, List<String> path) { Object obj = target; for (String field : path) { if (obj == null) { return null; } obj = evaluate(obj, trimType(field)); } return obj; }
java
public static Object getByPath(Object target, List<String> path) { Object obj = target; for (String field : path) { if (obj == null) { return null; } obj = evaluate(obj, trimType(field)); } return obj; }
[ "public", "static", "Object", "getByPath", "(", "Object", "target", ",", "List", "<", "String", ">", "path", ")", "{", "Object", "obj", "=", "target", ";", "for", "(", "String", "field", ":", "path", ")", "{", "if", "(", "obj", "==", "null", ")", "...
Evaluates the given path expression on the given object and returns the object found. @param target the object to reflect on @param path the path to evaluate @return the result of evaluating the path against the given object
[ "Evaluates", "the", "given", "path", "expression", "on", "the", "given", "object", "and", "returns", "the", "object", "found", "." ]
train
https://github.com/amazon-archives/aws-sdk-java-resources/blob/0f4fef2615d9687997b70a36eed1d62dd42df035/aws-resources-core/src/main/java/com/amazonaws/resources/internal/ReflectionUtils.java#L112-L123
i-net-software/jlessc
src/com/inet/lib/less/CssFormatter.java
CssFormatter.addGuardParameters
void addGuardParameters( Map<String, Expression> parameters, boolean isDefault ) { isGuard = true; wasDefaultFunction = false; guardDefault = isDefault; if( parameters != null ) { addMixin( null, parameters, null ); } }
java
void addGuardParameters( Map<String, Expression> parameters, boolean isDefault ) { isGuard = true; wasDefaultFunction = false; guardDefault = isDefault; if( parameters != null ) { addMixin( null, parameters, null ); } }
[ "void", "addGuardParameters", "(", "Map", "<", "String", ",", "Expression", ">", "parameters", ",", "boolean", "isDefault", ")", "{", "isGuard", "=", "true", ";", "wasDefaultFunction", "=", "false", ";", "guardDefault", "=", "isDefault", ";", "if", "(", "par...
Add the parameters of a guard @param parameters the parameters @param isDefault if the default case will be evaluated, in this case the expression "default" in guard is true.
[ "Add", "the", "parameters", "of", "a", "guard" ]
train
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssFormatter.java#L478-L485
datumbox/datumbox-framework
datumbox-framework-common/src/main/java/com/datumbox/framework/common/dataobjects/AssociativeArray2D.java
AssociativeArray2D.put2d
public final Object put2d(Object key1, Object key2, Object value) { AssociativeArray tmp = internalData.get(key1); if(tmp == null) { internalData.put(key1, new AssociativeArray()); } return internalData.get(key1).internalData.put(key2, value); }
java
public final Object put2d(Object key1, Object key2, Object value) { AssociativeArray tmp = internalData.get(key1); if(tmp == null) { internalData.put(key1, new AssociativeArray()); } return internalData.get(key1).internalData.put(key2, value); }
[ "public", "final", "Object", "put2d", "(", "Object", "key1", ",", "Object", "key2", ",", "Object", "value", ")", "{", "AssociativeArray", "tmp", "=", "internalData", ".", "get", "(", "key1", ")", ";", "if", "(", "tmp", "==", "null", ")", "{", "internal...
Convenience function used to put a value in a particular key positions. @param key1 @param key2 @param value @return
[ "Convenience", "function", "used", "to", "put", "a", "value", "in", "a", "particular", "key", "positions", "." ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/dataobjects/AssociativeArray2D.java#L144-L151
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.deleteClosedListEntityRoleAsync
public Observable<OperationStatus> deleteClosedListEntityRoleAsync(UUID appId, String versionId, UUID entityId, UUID roleId) { return deleteClosedListEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
java
public Observable<OperationStatus> deleteClosedListEntityRoleAsync(UUID appId, String versionId, UUID entityId, UUID roleId) { return deleteClosedListEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatus", ">", "deleteClosedListEntityRoleAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ",", "UUID", "roleId", ")", "{", "return", "deleteClosedListEntityRoleWithServiceResponseAsync", "(", "appI...
Delete an entity role. @param appId The application ID. @param versionId The version ID. @param entityId The entity ID. @param roleId The entity role Id. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Delete", "an", "entity", "role", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L11882-L11889
orbisgis/h2gis
postgis-jts/src/main/java/org/h2gis/postgis_jts/JtsBinaryParser.java
JtsBinaryParser.parseMultiPoint
private MultiPoint parseMultiPoint(ValueGetter data, int srid) { Point[] points = new Point[data.getInt()]; this.parseGeometryArray(data, points, srid); return JtsGeometry.geofac.createMultiPoint(points); }
java
private MultiPoint parseMultiPoint(ValueGetter data, int srid) { Point[] points = new Point[data.getInt()]; this.parseGeometryArray(data, points, srid); return JtsGeometry.geofac.createMultiPoint(points); }
[ "private", "MultiPoint", "parseMultiPoint", "(", "ValueGetter", "data", ",", "int", "srid", ")", "{", "Point", "[", "]", "points", "=", "new", "Point", "[", "data", ".", "getInt", "(", ")", "]", ";", "this", ".", "parseGeometryArray", "(", "data", ",", ...
Parse the given {@link org.postgis.binary.ValueGetter} into a JTS {@link org.locationtech.jts.geom.MultiPoint}. @param data {@link org.postgis.binary.ValueGetter} to parse. @param srid SRID of the parsed geometries. @return The parsed {@link org.locationtech.jts.geom.MultiPoint}.
[ "Parse", "the", "given", "{", "@link", "org", ".", "postgis", ".", "binary", ".", "ValueGetter", "}", "into", "a", "JTS", "{", "@link", "org", ".", "locationtech", ".", "jts", ".", "geom", ".", "MultiPoint", "}", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/postgis-jts/src/main/java/org/h2gis/postgis_jts/JtsBinaryParser.java#L237-L241
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/Config.java
Config.getMapConfigOrNull
public MapConfig getMapConfigOrNull(String name) { name = getBaseName(name); return lookupByPattern(configPatternMatcher, mapConfigs, name); }
java
public MapConfig getMapConfigOrNull(String name) { name = getBaseName(name); return lookupByPattern(configPatternMatcher, mapConfigs, name); }
[ "public", "MapConfig", "getMapConfigOrNull", "(", "String", "name", ")", "{", "name", "=", "getBaseName", "(", "name", ")", ";", "return", "lookupByPattern", "(", "configPatternMatcher", ",", "mapConfigs", ",", "name", ")", ";", "}" ]
Returns the map config with the given name or {@code null} if there is none. The name is matched by pattern to the configuration and by stripping the partition ID qualifier from the given {@code name}. @param name name of the map config @return the map configuration or {@code null} if none was found @throws ConfigurationException if ambiguous configurations are found @see StringPartitioningStrategy#getBaseName(java.lang.String) @see #setConfigPatternMatcher(ConfigPatternMatcher) @see #getConfigPatternMatcher()
[ "Returns", "the", "map", "config", "with", "the", "given", "name", "or", "{", "@code", "null", "}", "if", "there", "is", "none", ".", "The", "name", "is", "matched", "by", "pattern", "to", "the", "configuration", "and", "by", "stripping", "the", "partiti...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L427-L430
Netflix/denominator
core/src/main/java/denominator/CredentialsConfiguration.java
CredentialsConfiguration.checkValidForProvider
public static Credentials checkValidForProvider(Credentials creds, denominator.Provider provider) { checkNotNull(provider, "provider cannot be null"); if (isAnonymous(creds) && provider.credentialTypeToParameterNames().isEmpty()) { return AnonymousCredentials.INSTANCE; } else if (creds instanceof Map) { // check Map first as clojure Map implements List Map.Entry if (credentialConfigurationHasKeys(provider, Map.class.cast(creds).keySet())) { return creds; } } else if (creds instanceof List) { if (credentialConfigurationHasPartCount(provider, List.class.cast(creds).size())) { return creds; } } throw new IllegalArgumentException(exceptionMessage(creds, provider)); }
java
public static Credentials checkValidForProvider(Credentials creds, denominator.Provider provider) { checkNotNull(provider, "provider cannot be null"); if (isAnonymous(creds) && provider.credentialTypeToParameterNames().isEmpty()) { return AnonymousCredentials.INSTANCE; } else if (creds instanceof Map) { // check Map first as clojure Map implements List Map.Entry if (credentialConfigurationHasKeys(provider, Map.class.cast(creds).keySet())) { return creds; } } else if (creds instanceof List) { if (credentialConfigurationHasPartCount(provider, List.class.cast(creds).size())) { return creds; } } throw new IllegalArgumentException(exceptionMessage(creds, provider)); }
[ "public", "static", "Credentials", "checkValidForProvider", "(", "Credentials", "creds", ",", "denominator", ".", "Provider", "provider", ")", "{", "checkNotNull", "(", "provider", ",", "\"provider cannot be null\"", ")", ";", "if", "(", "isAnonymous", "(", "creds",...
checks that the supplied input is valid, or throws an {@code IllegalArgumentException} if not. Users of this are guaranteed that the {@code input} matches the count of parameters of a credential type listed in {@link denominator.Provider#credentialTypeToParameterNames()}. <br> <br> <b>Coercion to {@code AnonymousCredentials}</b><br> if {@link denominator.Provider#credentialTypeToParameterNames()} is empty, then no credentials are required. When this is true, the following cases will return {@code AnonymousCredentials}. <ul> <li>when {@code input} is null</li> <li>when {@code input} is an instance of {@code AnonymousCredentials}</li> <li>when {@code input} is an empty instance of {@code Map} or {@code List}</li> </ul> <br> <br> <b>Validation Rules</b><br> See {@link Credentials} for Validation Rules @param creds nullable credentials to test @param provider context which helps create a useful error message on failure. @return correct Credentials value which can be {@link AnonymousCredentials} if {@code input} was null and credentials are not needed. @throws IllegalArgumentException if provider requires a different amount of credential parts than {@code input}
[ "checks", "that", "the", "supplied", "input", "is", "valid", "or", "throws", "an", "{", "@code", "IllegalArgumentException", "}", "if", "not", ".", "Users", "of", "this", "are", "guaranteed", "that", "the", "{", "@code", "input", "}", "matches", "the", "co...
train
https://github.com/Netflix/denominator/blob/c565e3b8c6043051252e0947029511f9ac5d306f/core/src/main/java/denominator/CredentialsConfiguration.java#L107-L123
jglobus/JGlobus
gridftp/src/main/java/org/globus/ftp/FTPClient.java
FTPClient.getChecksum
public String getChecksum(String algorithm, long offset, long length, String path) throws ClientException, ServerException, IOException { // check if we the cksum commands and specific algorithm are supported checkCksumSupport(algorithm); // form CKSM command String parameters = String.format("%s %d %d %s",algorithm, offset,length,path); Command cmd = new Command("CKSM", parameters); // transfer command, obtain reply Reply cksumReply = doCommand(cmd); // check for error if( !Reply.isPositiveCompletion(cksumReply) ) { throw new ServerException(ServerException.SERVER_REFUSED, cksumReply.getMessage()); } return cksumReply.getMessage(); }
java
public String getChecksum(String algorithm, long offset, long length, String path) throws ClientException, ServerException, IOException { // check if we the cksum commands and specific algorithm are supported checkCksumSupport(algorithm); // form CKSM command String parameters = String.format("%s %d %d %s",algorithm, offset,length,path); Command cmd = new Command("CKSM", parameters); // transfer command, obtain reply Reply cksumReply = doCommand(cmd); // check for error if( !Reply.isPositiveCompletion(cksumReply) ) { throw new ServerException(ServerException.SERVER_REFUSED, cksumReply.getMessage()); } return cksumReply.getMessage(); }
[ "public", "String", "getChecksum", "(", "String", "algorithm", ",", "long", "offset", ",", "long", "length", ",", "String", "path", ")", "throws", "ClientException", ",", "ServerException", ",", "IOException", "{", "// check if we the cksum commands and specific algorit...
implement GridFTP v2 CKSM command from <a href="http://www.ogf.org/documents/GFD.47.pdf">GridFTP v2 Protocol Description</a> <pre> 5.1 CKSM This command is used by the client to request checksum calculation over a portion or whole file existing on the server. The syntax is: CKSM &lt;algorithm&gt; &lt;offset&gt; &lt;length&gt; &lt;path&gt; CRLF Server executes this command by calculating specified type of checksum over portion of the file starting at the offset and of the specified length. If length is –1, the checksum will be calculated through the end of the file. On success, the server replies with 2xx &lt;checksum value&gt; Actual format of checksum value depends on the algorithm used, but generally, hexadecimal representation should be used. </pre> @param algorithm ckeckum alorithm @param offset @param length @param path @return ckecksum value returned by the server @throws org.globus.ftp.exception.ClientException @throws org.globus.ftp.exception.ServerException @throws java.io.IOException
[ "implement", "GridFTP", "v2", "CKSM", "command", "from", "<a", "href", "=", "http", ":", "//", "www", ".", "ogf", ".", "org", "/", "documents", "/", "GFD", ".", "47", ".", "pdf", ">", "GridFTP", "v2", "Protocol", "Description<", "/", "a", ">", "<pre"...
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gridftp/src/main/java/org/globus/ftp/FTPClient.java#L2152-L2175
notnoop/java-apns
src/main/java/com/notnoop/apns/ApnsServiceBuilder.java
ApnsServiceBuilder.withCert
public ApnsServiceBuilder withCert(KeyStore keyStore, String password, String alias) throws InvalidSSLConfig { assertPasswordNotEmpty(password); return withSSLContext(new SSLContextBuilder() .withAlgorithm(KEY_ALGORITHM) .withCertificateKeyStore(keyStore, password, alias) .withDefaultTrustKeyStore() .build()); }
java
public ApnsServiceBuilder withCert(KeyStore keyStore, String password, String alias) throws InvalidSSLConfig { assertPasswordNotEmpty(password); return withSSLContext(new SSLContextBuilder() .withAlgorithm(KEY_ALGORITHM) .withCertificateKeyStore(keyStore, password, alias) .withDefaultTrustKeyStore() .build()); }
[ "public", "ApnsServiceBuilder", "withCert", "(", "KeyStore", "keyStore", ",", "String", "password", ",", "String", "alias", ")", "throws", "InvalidSSLConfig", "{", "assertPasswordNotEmpty", "(", "password", ")", ";", "return", "withSSLContext", "(", "new", "SSLConte...
Specify the certificate store used to connect to Apple APNS servers. This relies on the stream of keystore (*.p12 | *.jks) containing the keys and certificates, along with the given password and alias. The keystore can be either PKCS12 or JKS and the keystore needs to be encrypted using the SunX509 algorithm. This library does not support password-less p12 certificates, due to a Oracle Java library <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6415637"> Bug 6415637</a>. There are three workarounds: use a password-protected certificate, use a different boot Java SDK implementation, or constract the `SSLContext` yourself! Needless to say, the password-protected certificate is most recommended option. @param keyStore the keystore @param password the password of the keystore @param alias the alias identifing the key to be used @return this @throws InvalidSSLConfig if stream is an invalid Keystore, the password is invalid or the alias is not found
[ "Specify", "the", "certificate", "store", "used", "to", "connect", "to", "Apple", "APNS", "servers", ".", "This", "relies", "on", "the", "stream", "of", "keystore", "(", "*", ".", "p12", "|", "*", ".", "jks", ")", "containing", "the", "keys", "and", "c...
train
https://github.com/notnoop/java-apns/blob/180a190d4cb49458441596ca7c69d50ec7f1dba5/src/main/java/com/notnoop/apns/ApnsServiceBuilder.java#L281-L289
codeprimate-software/cp-elements
src/main/java/org/cp/elements/util/CollectionUtils.java
CollectionUtils.findOne
public static <T> T findOne(Iterable<T> iterable, Filter<T> filter) { Assert.notNull(filter, "Filter is required"); return StreamSupport.stream(nullSafeIterable(iterable).spliterator(), false) .filter(filter::accept) .findFirst().orElse(null); }
java
public static <T> T findOne(Iterable<T> iterable, Filter<T> filter) { Assert.notNull(filter, "Filter is required"); return StreamSupport.stream(nullSafeIterable(iterable).spliterator(), false) .filter(filter::accept) .findFirst().orElse(null); }
[ "public", "static", "<", "T", ">", "T", "findOne", "(", "Iterable", "<", "T", ">", "iterable", ",", "Filter", "<", "T", ">", "filter", ")", "{", "Assert", ".", "notNull", "(", "filter", ",", "\"Filter is required\"", ")", ";", "return", "StreamSupport", ...
Searches the {@link Iterable} for the first element accepted by the {@link Filter}. @param <T> Class type of the elements in the {@link Iterable}. @param iterable {@link Iterable} collection of elements to search. @param filter {@link Filter} used to find the first element from the {@link Iterable} accepted by the {@link Filter}. @return the first element from the {@link Iterable} accepted by the {@link Filter}, or {@literal null} if no such element is found. @throws IllegalArgumentException if {@link Filter} is null. @see #findAll(Iterable, Filter) @see #nullSafeIterable(Iterable) @see org.cp.elements.lang.Filter @see java.lang.Iterable
[ "Searches", "the", "{", "@link", "Iterable", "}", "for", "the", "first", "element", "accepted", "by", "the", "{", "@link", "Filter", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/CollectionUtils.java#L415-L422
Netflix/Hystrix
hystrix-core/src/main/java/com/netflix/hystrix/strategy/executionhook/HystrixCommandExecutionHook.java
HystrixCommandExecutionHook.onComplete
@Deprecated public <T> T onComplete(HystrixInvokable<T> commandInstance, T response) { // pass-thru by default return response; }
java
@Deprecated public <T> T onComplete(HystrixInvokable<T> commandInstance, T response) { // pass-thru by default return response; }
[ "@", "Deprecated", "public", "<", "T", ">", "T", "onComplete", "(", "HystrixInvokable", "<", "T", ">", "commandInstance", ",", "T", "response", ")", "{", "// pass-thru by default", "return", "response", ";", "}" ]
DEPRECATED: Change usages of this to {@link #onEmit} if you want to write a hook that handles each emitted command value or to {@link #onSuccess} if you want to write a hook that handles success of the command Invoked after completion of {@link HystrixCommand} execution that results in a response. <p> The response can come either from {@link HystrixCommand#run()} or {@link HystrixCommand#getFallback()}. @param commandInstance The executing HystrixCommand instance. @param response from {@link HystrixCommand#run()} or {@link HystrixCommand#getFallback()}. @return T response object that can be modified, decorated, replaced or just returned as a pass-thru. @since 1.2
[ "DEPRECATED", ":", "Change", "usages", "of", "this", "to", "{", "@link", "#onEmit", "}", "if", "you", "want", "to", "write", "a", "hook", "that", "handles", "each", "emitted", "command", "value", "or", "to", "{", "@link", "#onSuccess", "}", "if", "you", ...
train
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/strategy/executionhook/HystrixCommandExecutionHook.java#L469-L473
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/component/selectOneMenu/SelectOneMenuRenderer.java
SelectOneMenuRenderer.renderJQueryAfterComponent
private void renderJQueryAfterComponent(ResponseWriter rw, String clientId, SelectOneMenu menu) throws IOException { Boolean select2 = menu.isSelect2(); if (select2 != null && select2) { rw.startElement("script", menu); rw.writeAttribute("type", "text/javascript", "script"); StringBuilder buf = new StringBuilder("$(document).ready(function(){"); buf.append("\n"); // jquery selector for the ID of the select component buf.append(" $(\"[id='").append(clientId).append("']\")"); // select2 command to enable filtering buf.append(".select2();"); buf.append("\n"); buf.append("});"); rw.writeText(buf.toString(), "script"); rw.endElement("script"); } }
java
private void renderJQueryAfterComponent(ResponseWriter rw, String clientId, SelectOneMenu menu) throws IOException { Boolean select2 = menu.isSelect2(); if (select2 != null && select2) { rw.startElement("script", menu); rw.writeAttribute("type", "text/javascript", "script"); StringBuilder buf = new StringBuilder("$(document).ready(function(){"); buf.append("\n"); // jquery selector for the ID of the select component buf.append(" $(\"[id='").append(clientId).append("']\")"); // select2 command to enable filtering buf.append(".select2();"); buf.append("\n"); buf.append("});"); rw.writeText(buf.toString(), "script"); rw.endElement("script"); } }
[ "private", "void", "renderJQueryAfterComponent", "(", "ResponseWriter", "rw", ",", "String", "clientId", ",", "SelectOneMenu", "menu", ")", "throws", "IOException", "{", "Boolean", "select2", "=", "menu", ".", "isSelect2", "(", ")", ";", "if", "(", "select2", ...
render a jquery javascript block after the component if necessary @param rw @param clientId @param menu @throws IOException
[ "render", "a", "jquery", "javascript", "block", "after", "the", "component", "if", "necessary" ]
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/selectOneMenu/SelectOneMenuRenderer.java#L290-L308
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java
ClientAsynchEventThreadPool.dispatchDestinationListenerEvent
public void dispatchDestinationListenerEvent(SICoreConnection conn, SIDestinationAddress destinationAddress, DestinationAvailability destinationAvailability, DestinationListener destinationListener) { if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dispatchDestinationListenerEvent", new Object[]{conn, destinationAddress, destinationAvailability, destinationListener}); //Create a new DestinationListenerThread and dispatch it. final DestinationListenerThread thread = new DestinationListenerThread(conn, destinationAddress, destinationAvailability, destinationListener); dispatchThread(thread); if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dispatchDestinationListenerEvent"); }
java
public void dispatchDestinationListenerEvent(SICoreConnection conn, SIDestinationAddress destinationAddress, DestinationAvailability destinationAvailability, DestinationListener destinationListener) { if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dispatchDestinationListenerEvent", new Object[]{conn, destinationAddress, destinationAvailability, destinationListener}); //Create a new DestinationListenerThread and dispatch it. final DestinationListenerThread thread = new DestinationListenerThread(conn, destinationAddress, destinationAvailability, destinationListener); dispatchThread(thread); if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dispatchDestinationListenerEvent"); }
[ "public", "void", "dispatchDestinationListenerEvent", "(", "SICoreConnection", "conn", ",", "SIDestinationAddress", "destinationAddress", ",", "DestinationAvailability", "destinationAvailability", ",", "DestinationListener", "destinationListener", ")", "{", "if", "(", "TraceCom...
Dispatches a thread which will call the destinationAvailable method on the destinationListener passing in the supplied parameters. @param conn @param destinationAddress @param destinationAvailability @param destinationListener
[ "Dispatches", "a", "thread", "which", "will", "call", "the", "destinationAvailable", "method", "on", "the", "destinationListener", "passing", "in", "the", "supplied", "parameters", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java#L189-L200
EdwardRaff/JSAT
JSAT/src/jsat/io/LIBSVMLoader.java
LIBSVMLoader.loadR
public static RegressionDataSet loadR(File file, double sparseRatio) throws FileNotFoundException, IOException { return loadR(file, sparseRatio, -1); }
java
public static RegressionDataSet loadR(File file, double sparseRatio) throws FileNotFoundException, IOException { return loadR(file, sparseRatio, -1); }
[ "public", "static", "RegressionDataSet", "loadR", "(", "File", "file", ",", "double", "sparseRatio", ")", "throws", "FileNotFoundException", ",", "IOException", "{", "return", "loadR", "(", "file", ",", "sparseRatio", ",", "-", "1", ")", ";", "}" ]
Loads a new regression data set from a LIBSVM file, assuming the label is a numeric target value to predict @param file the file to load @param sparseRatio the fraction of non zero values to qualify a data point as sparse @return a regression data set @throws FileNotFoundException if the file was not found @throws IOException if an error occurred reading the input stream
[ "Loads", "a", "new", "regression", "data", "set", "from", "a", "LIBSVM", "file", "assuming", "the", "label", "is", "a", "numeric", "target", "value", "to", "predict" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/io/LIBSVMLoader.java#L79-L82
elki-project/elki
elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/minkowski/LPNormDistanceFunction.java
LPNormDistanceFunction.preNormMBR
private double preNormMBR(SpatialComparable mbr, final int start, final int end) { double agg = 0.; for(int d = start; d < end; d++) { double delta = mbr.getMin(d); delta = delta >= 0 ? delta : -mbr.getMax(d); if(delta > 0.) { agg += FastMath.pow(delta, p); } } return agg; }
java
private double preNormMBR(SpatialComparable mbr, final int start, final int end) { double agg = 0.; for(int d = start; d < end; d++) { double delta = mbr.getMin(d); delta = delta >= 0 ? delta : -mbr.getMax(d); if(delta > 0.) { agg += FastMath.pow(delta, p); } } return agg; }
[ "private", "double", "preNormMBR", "(", "SpatialComparable", "mbr", ",", "final", "int", "start", ",", "final", "int", "end", ")", "{", "double", "agg", "=", "0.", ";", "for", "(", "int", "d", "=", "start", ";", "d", "<", "end", ";", "d", "++", ")"...
Compute unscaled norm in a range of dimensions. @param mbr Data object @param start First dimension @param end Exclusive last dimension @return Aggregated values.
[ "Compute", "unscaled", "norm", "in", "a", "range", "of", "dimensions", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/minkowski/LPNormDistanceFunction.java#L162-L172
shekhargulati/strman-java
src/main/java/strman/Strman.java
Strman.countSubstr
public static long countSubstr(final String value, final String subStr) { return countSubstr(value, subStr, true, false); }
java
public static long countSubstr(final String value, final String subStr) { return countSubstr(value, subStr, true, false); }
[ "public", "static", "long", "countSubstr", "(", "final", "String", "value", ",", "final", "String", "subStr", ")", "{", "return", "countSubstr", "(", "value", ",", "subStr", ",", "true", ",", "false", ")", ";", "}" ]
Count the number of times substr appears in value @param value input @param subStr to search @return count of times substring exists
[ "Count", "the", "number", "of", "times", "substr", "appears", "in", "value" ]
train
https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L229-L231
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/validator/AbstractExtraLanguageValidator.java
AbstractExtraLanguageValidator.doTypeMappingCheck
protected boolean doTypeMappingCheck(EObject source, JvmType type, Procedure3<? super EObject, ? super JvmType, ? super String> errorHandler) { if (source != null && type != null) { final ExtraLanguageTypeConverter converter = getTypeConverter(); final String qn = type.getQualifiedName(); if (converter != null && !converter.hasConversion(qn)) { if (errorHandler != null) { errorHandler.apply(source, type, qn); } return false; } } return true; }
java
protected boolean doTypeMappingCheck(EObject source, JvmType type, Procedure3<? super EObject, ? super JvmType, ? super String> errorHandler) { if (source != null && type != null) { final ExtraLanguageTypeConverter converter = getTypeConverter(); final String qn = type.getQualifiedName(); if (converter != null && !converter.hasConversion(qn)) { if (errorHandler != null) { errorHandler.apply(source, type, qn); } return false; } } return true; }
[ "protected", "boolean", "doTypeMappingCheck", "(", "EObject", "source", ",", "JvmType", "type", ",", "Procedure3", "<", "?", "super", "EObject", ",", "?", "super", "JvmType", ",", "?", "super", "String", ">", "errorHandler", ")", "{", "if", "(", "source", ...
Do a type mapping check. @param source the source of the type. @param type the type to check. @param errorHandler the error handler. @return {@code true} if a type mapping is defined.
[ "Do", "a", "type", "mapping", "check", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/validator/AbstractExtraLanguageValidator.java#L390-L402
alkacon/opencms-core
src/org/opencms/file/CmsLinkRewriter.java
CmsLinkRewriter.checkNotSubPath
protected void checkNotSubPath(String source, String target) { source = CmsStringUtil.joinPaths("/", source, "/"); target = CmsStringUtil.joinPaths("/", target, "/"); if (target.startsWith(source)) { throw new CmsIllegalArgumentException( org.opencms.file.Messages.get().container( org.opencms.file.Messages.ERR_REWRITE_LINKS_ROOTS_DEPENDENT_2, source, target)); } }
java
protected void checkNotSubPath(String source, String target) { source = CmsStringUtil.joinPaths("/", source, "/"); target = CmsStringUtil.joinPaths("/", target, "/"); if (target.startsWith(source)) { throw new CmsIllegalArgumentException( org.opencms.file.Messages.get().container( org.opencms.file.Messages.ERR_REWRITE_LINKS_ROOTS_DEPENDENT_2, source, target)); } }
[ "protected", "void", "checkNotSubPath", "(", "String", "source", ",", "String", "target", ")", "{", "source", "=", "CmsStringUtil", ".", "joinPaths", "(", "\"/\"", ",", "source", ",", "\"/\"", ")", ";", "target", "=", "CmsStringUtil", ".", "joinPaths", "(", ...
Checks that the target path is not a subfolder of the source path.<p> @param source the source path @param target the target path
[ "Checks", "that", "the", "target", "path", "is", "not", "a", "subfolder", "of", "the", "source", "path", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsLinkRewriter.java#L280-L291
intellimate/Izou
src/main/java/org/intellimate/izou/security/RootPermission.java
RootPermission.checkPermission
@Override public void checkPermission(Permission permission, AddOnModel addon) throws IzouPermissionException { if (isRegistered(addon)) return; if (permission instanceof FilePermission && !permission.getActions().intern().toLowerCase().equals("read")) { String canonicalName = permission.getName().intern().toLowerCase(); getSecurityManager().getPermissionManager().getFilePermissionModule().fileWriteCheck(canonicalName, addon); } Function<PluginDescriptor, Boolean> checkPermission = descriptor -> { try { return descriptor.getAddOnProperties().get("root").equals("true"); } catch (NullPointerException e) { return false; } }; String exceptionMessage = "Root permission denied for: " + addon + "is not registered to " + "use socket root connections."; registerOrThrow(addon, () -> new IzouSocketPermissionException(exceptionMessage), checkPermission); }
java
@Override public void checkPermission(Permission permission, AddOnModel addon) throws IzouPermissionException { if (isRegistered(addon)) return; if (permission instanceof FilePermission && !permission.getActions().intern().toLowerCase().equals("read")) { String canonicalName = permission.getName().intern().toLowerCase(); getSecurityManager().getPermissionManager().getFilePermissionModule().fileWriteCheck(canonicalName, addon); } Function<PluginDescriptor, Boolean> checkPermission = descriptor -> { try { return descriptor.getAddOnProperties().get("root").equals("true"); } catch (NullPointerException e) { return false; } }; String exceptionMessage = "Root permission denied for: " + addon + "is not registered to " + "use socket root connections."; registerOrThrow(addon, () -> new IzouSocketPermissionException(exceptionMessage), checkPermission); }
[ "@", "Override", "public", "void", "checkPermission", "(", "Permission", "permission", ",", "AddOnModel", "addon", ")", "throws", "IzouPermissionException", "{", "if", "(", "isRegistered", "(", "addon", ")", ")", "return", ";", "if", "(", "permission", "instance...
Checks if the given addOn is allowed to access the requested service and registers them if not yet registered. @param permission the Permission to check @param addon the identifiable to check @throws IzouPermissionException thrown if the addOn is not allowed to access its requested service
[ "Checks", "if", "the", "given", "addOn", "is", "allowed", "to", "access", "the", "requested", "service", "and", "registers", "them", "if", "not", "yet", "registered", "." ]
train
https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/security/RootPermission.java#L46-L67
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/Scheduler.java
Scheduler.scheduleDirect
@NonNull public Disposable scheduleDirect(@NonNull Runnable run) { return scheduleDirect(run, 0L, TimeUnit.NANOSECONDS); }
java
@NonNull public Disposable scheduleDirect(@NonNull Runnable run) { return scheduleDirect(run, 0L, TimeUnit.NANOSECONDS); }
[ "@", "NonNull", "public", "Disposable", "scheduleDirect", "(", "@", "NonNull", "Runnable", "run", ")", "{", "return", "scheduleDirect", "(", "run", ",", "0L", ",", "TimeUnit", ".", "NANOSECONDS", ")", ";", "}" ]
Schedules the given task on this Scheduler without any time delay. <p> This method is safe to be called from multiple threads but there are no ordering or non-overlapping guarantees between tasks. @param run the task to execute @return the Disposable instance that let's one cancel this particular task. @since 2.0
[ "Schedules", "the", "given", "task", "on", "this", "Scheduler", "without", "any", "time", "delay", "." ]
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Scheduler.java#L176-L179
gotev/android-upload-service
uploadservice/src/main/java/net/gotev/uploadservice/UploadTask.java
UploadTask.broadcastProgress
protected final void broadcastProgress(final long uploadedBytes, final long totalBytes) { long currentTime = System.currentTimeMillis(); if (uploadedBytes < totalBytes && currentTime < lastProgressNotificationTime + UploadService.PROGRESS_REPORT_INTERVAL) { return; } setLastProgressNotificationTime(currentTime); Logger.debug(LOG_TAG, "Broadcasting upload progress for " + params.id + ": " + uploadedBytes + " bytes of " + totalBytes); final UploadInfo uploadInfo = new UploadInfo(params.id, startTime, uploadedBytes, totalBytes, (attempts - 1), successfullyUploadedFiles, pathStringListFrom(params.files)); BroadcastData data = new BroadcastData() .setStatus(BroadcastData.Status.IN_PROGRESS) .setUploadInfo(uploadInfo); final UploadStatusDelegate delegate = UploadService.getUploadStatusDelegate(params.id); if (delegate != null) { mainThreadHandler.post(new Runnable() { @Override public void run() { delegate.onProgress(service, uploadInfo); } }); } else { service.sendBroadcast(data.getIntent()); } updateNotificationProgress(uploadInfo); }
java
protected final void broadcastProgress(final long uploadedBytes, final long totalBytes) { long currentTime = System.currentTimeMillis(); if (uploadedBytes < totalBytes && currentTime < lastProgressNotificationTime + UploadService.PROGRESS_REPORT_INTERVAL) { return; } setLastProgressNotificationTime(currentTime); Logger.debug(LOG_TAG, "Broadcasting upload progress for " + params.id + ": " + uploadedBytes + " bytes of " + totalBytes); final UploadInfo uploadInfo = new UploadInfo(params.id, startTime, uploadedBytes, totalBytes, (attempts - 1), successfullyUploadedFiles, pathStringListFrom(params.files)); BroadcastData data = new BroadcastData() .setStatus(BroadcastData.Status.IN_PROGRESS) .setUploadInfo(uploadInfo); final UploadStatusDelegate delegate = UploadService.getUploadStatusDelegate(params.id); if (delegate != null) { mainThreadHandler.post(new Runnable() { @Override public void run() { delegate.onProgress(service, uploadInfo); } }); } else { service.sendBroadcast(data.getIntent()); } updateNotificationProgress(uploadInfo); }
[ "protected", "final", "void", "broadcastProgress", "(", "final", "long", "uploadedBytes", ",", "final", "long", "totalBytes", ")", "{", "long", "currentTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "if", "(", "uploadedBytes", "<", "totalBytes", ...
Broadcasts a progress update. @param uploadedBytes number of bytes which has been uploaded to the server @param totalBytes total bytes of the request
[ "Broadcasts", "a", "progress", "update", "." ]
train
https://github.com/gotev/android-upload-service/blob/0952fcbe4b32c100150ffd0a237de3be4942e0a8/uploadservice/src/main/java/net/gotev/uploadservice/UploadTask.java#L228-L262
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java
CommerceOrderPersistenceImpl.removeByG_U_O
@Override public void removeByG_U_O(long groupId, long userId, int orderStatus) { for (CommerceOrder commerceOrder : findByG_U_O(groupId, userId, orderStatus, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceOrder); } }
java
@Override public void removeByG_U_O(long groupId, long userId, int orderStatus) { for (CommerceOrder commerceOrder : findByG_U_O(groupId, userId, orderStatus, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceOrder); } }
[ "@", "Override", "public", "void", "removeByG_U_O", "(", "long", "groupId", ",", "long", "userId", ",", "int", "orderStatus", ")", "{", "for", "(", "CommerceOrder", "commerceOrder", ":", "findByG_U_O", "(", "groupId", ",", "userId", ",", "orderStatus", ",", ...
Removes all the commerce orders where groupId = &#63; and userId = &#63; and orderStatus = &#63; from the database. @param groupId the group ID @param userId the user ID @param orderStatus the order status
[ "Removes", "all", "the", "commerce", "orders", "where", "groupId", "=", "&#63", ";", "and", "userId", "=", "&#63", ";", "and", "orderStatus", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java#L4583-L4589
FasterXML/woodstox
src/main/java/com/ctc/wstx/sr/AttributeCollector.java
AttributeCollector.decodeValue
public final void decodeValue(int index, TypedValueDecoder tvd) throws IllegalArgumentException { if (index < 0 || index >= mAttrCount) { throwIndex(index); } /* Should be faster to pass the char array even if we might * have a String */ // Either way, need to trim before passing: char[] buf = mValueBuilder.getCharBuffer(); int start = mAttributes[index].mValueStartOffset; int end = getValueStartOffset(index+1); while (true) { if (start >= end) { tvd.handleEmptyValue(); return; } if (!StringUtil.isSpace(buf[start])) { break; } ++start; } // Trailing space? while (--end > start && StringUtil.isSpace(buf[end])) { } tvd.decode(buf, start, end+1); }
java
public final void decodeValue(int index, TypedValueDecoder tvd) throws IllegalArgumentException { if (index < 0 || index >= mAttrCount) { throwIndex(index); } /* Should be faster to pass the char array even if we might * have a String */ // Either way, need to trim before passing: char[] buf = mValueBuilder.getCharBuffer(); int start = mAttributes[index].mValueStartOffset; int end = getValueStartOffset(index+1); while (true) { if (start >= end) { tvd.handleEmptyValue(); return; } if (!StringUtil.isSpace(buf[start])) { break; } ++start; } // Trailing space? while (--end > start && StringUtil.isSpace(buf[end])) { } tvd.decode(buf, start, end+1); }
[ "public", "final", "void", "decodeValue", "(", "int", "index", ",", "TypedValueDecoder", "tvd", ")", "throws", "IllegalArgumentException", "{", "if", "(", "index", "<", "0", "||", "index", ">=", "mAttrCount", ")", "{", "throwIndex", "(", "index", ")", ";", ...
Method called to decode the whole attribute value as a single typed value. Decoding is done using the decoder provided.
[ "Method", "called", "to", "decode", "the", "whole", "attribute", "value", "as", "a", "single", "typed", "value", ".", "Decoding", "is", "done", "using", "the", "decoder", "provided", "." ]
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/AttributeCollector.java#L537-L564
telly/groundy
library/src/main/java/com/telly/groundy/Groundy.java
Groundy.arg
public Groundy arg(String key, Serializable value) { mArgs.putSerializable(key, value); return this; }
java
public Groundy arg(String key, Serializable value) { mArgs.putSerializable(key, value); return this; }
[ "public", "Groundy", "arg", "(", "String", "key", ",", "Serializable", "value", ")", "{", "mArgs", ".", "putSerializable", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts a Serializable value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value a Serializable object, or null
[ "Inserts", "a", "Serializable", "value", "into", "the", "mapping", "of", "this", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", ".", "Either", "key", "or", "value", "may", "be", "null", "." ]
train
https://github.com/telly/groundy/blob/e90baf9901a8be20b348bd1575d5ad782560cec8/library/src/main/java/com/telly/groundy/Groundy.java#L596-L599
Impetus/Kundera
src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBQueryInterpreter.java
CouchDBQueryInterpreter.setKeyValues
public void setKeyValues(String keyName, Object obj) { if (this.keyValues == null) { this.keyValues = new HashMap<String, Object>(); } this.keyValues.put(keyName, obj); }
java
public void setKeyValues(String keyName, Object obj) { if (this.keyValues == null) { this.keyValues = new HashMap<String, Object>(); } this.keyValues.put(keyName, obj); }
[ "public", "void", "setKeyValues", "(", "String", "keyName", ",", "Object", "obj", ")", "{", "if", "(", "this", ".", "keyValues", "==", "null", ")", "{", "this", ".", "keyValues", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";"...
Sets the key values. @param keyName the key name @param obj the obj
[ "Sets", "the", "key", "values", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBQueryInterpreter.java#L290-L297
rampatra/jbot
jbot-example/src/main/java/example/jbot/facebook/FbBot.java
FbBot.setupMeeting
@Controller(pattern = "(?i)(setup meeting)", next = "confirmTiming") public void setupMeeting(Event event) { startConversation(event, "confirmTiming"); // start conversation reply(event, "Cool! At what time (ex. 15:30) do you want me to set up the meeting?"); }
java
@Controller(pattern = "(?i)(setup meeting)", next = "confirmTiming") public void setupMeeting(Event event) { startConversation(event, "confirmTiming"); // start conversation reply(event, "Cool! At what time (ex. 15:30) do you want me to set up the meeting?"); }
[ "@", "Controller", "(", "pattern", "=", "\"(?i)(setup meeting)\"", ",", "next", "=", "\"confirmTiming\"", ")", "public", "void", "setupMeeting", "(", "Event", "event", ")", "{", "startConversation", "(", "event", ",", "\"confirmTiming\"", ")", ";", "// start conve...
Type "setup meeting" to start a conversation with the bot. Provide the name of the next method to be invoked in {@code next}. This method is the starting point of the conversation (as it calls {@link Bot#startConversation(Event, String)} within it. You can chain methods which will be invoked one after the other leading to a conversation. @param event
[ "Type", "setup", "meeting", "to", "start", "a", "conversation", "with", "the", "bot", ".", "Provide", "the", "name", "of", "the", "next", "method", "to", "be", "invoked", "in", "{", "@code", "next", "}", ".", "This", "method", "is", "the", "starting", ...
train
https://github.com/rampatra/jbot/blob/0f42e1a6ec4dcbc5d1257e1307704903e771f7b5/jbot-example/src/main/java/example/jbot/facebook/FbBot.java#L154-L158
unbescape/unbescape
src/main/java/org/unbescape/xml/XmlEscape.java
XmlEscape.escapeXml10Attribute
public static void escapeXml10Attribute(final Reader reader, final Writer writer, final XmlEscapeType type, final XmlEscapeLevel level) throws IOException { escapeXml(reader, writer, XmlEscapeSymbols.XML10_ATTRIBUTE_SYMBOLS, type, level); }
java
public static void escapeXml10Attribute(final Reader reader, final Writer writer, final XmlEscapeType type, final XmlEscapeLevel level) throws IOException { escapeXml(reader, writer, XmlEscapeSymbols.XML10_ATTRIBUTE_SYMBOLS, type, level); }
[ "public", "static", "void", "escapeXml10Attribute", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ",", "final", "XmlEscapeType", "type", ",", "final", "XmlEscapeLevel", "level", ")", "throws", "IOException", "{", "escapeXml", "(", "reader", ...
<p> Perform a (configurable) XML 1.0 <strong>escape</strong> operation on a <tt>Reader</tt> input meant to be an XML attribute value, writing results to a <tt>Writer</tt>. </p> <p> This method will perform an escape operation according to the specified {@link org.unbescape.xml.XmlEscapeType} and {@link org.unbescape.xml.XmlEscapeLevel} argument values. </p> <p> Besides, being an attribute value also <tt>&#92;t</tt>, <tt>&#92;n</tt> and <tt>&#92;r</tt> will be escaped to avoid white-space normalization from removing line feeds (turning them into white spaces) during future parsing operations. </p> <p> All other <tt>Reader</tt>/<tt>Writer</tt>-based <tt>escapeXml10*(...)</tt> methods call this one with preconfigured <tt>type</tt> and <tt>level</tt> values. </p> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @param type the type of escape operation to be performed, see {@link org.unbescape.xml.XmlEscapeType}. @param level the escape level to be applied, see {@link org.unbescape.xml.XmlEscapeLevel}. @throws IOException if an input/output exception occurs @since 1.1.5
[ "<p", ">", "Perform", "a", "(", "configurable", ")", "XML", "1", ".", "0", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "meant", "to", "be", "an", "XML", "attribute", "value", ...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/xml/XmlEscape.java#L1660-L1663
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java
VirtualMachineScaleSetsInner.listSkusAsync
public Observable<Page<VirtualMachineScaleSetSkuInner>> listSkusAsync(final String resourceGroupName, final String vmScaleSetName) { return listSkusWithServiceResponseAsync(resourceGroupName, vmScaleSetName) .map(new Func1<ServiceResponse<Page<VirtualMachineScaleSetSkuInner>>, Page<VirtualMachineScaleSetSkuInner>>() { @Override public Page<VirtualMachineScaleSetSkuInner> call(ServiceResponse<Page<VirtualMachineScaleSetSkuInner>> response) { return response.body(); } }); }
java
public Observable<Page<VirtualMachineScaleSetSkuInner>> listSkusAsync(final String resourceGroupName, final String vmScaleSetName) { return listSkusWithServiceResponseAsync(resourceGroupName, vmScaleSetName) .map(new Func1<ServiceResponse<Page<VirtualMachineScaleSetSkuInner>>, Page<VirtualMachineScaleSetSkuInner>>() { @Override public Page<VirtualMachineScaleSetSkuInner> call(ServiceResponse<Page<VirtualMachineScaleSetSkuInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "VirtualMachineScaleSetSkuInner", ">", ">", "listSkusAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "vmScaleSetName", ")", "{", "return", "listSkusWithServiceResponseAsync", "(", "resourceGroupName", ...
Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for each SKU. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;VirtualMachineScaleSetSkuInner&gt; object
[ "Gets", "a", "list", "of", "SKUs", "available", "for", "your", "VM", "scale", "set", "including", "the", "minimum", "and", "maximum", "VM", "instances", "allowed", "for", "each", "SKU", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L1642-L1650
zeroturnaround/maven-jrebel-plugin
src/main/java/org/zeroturnaround/javarebel/maven/GenerateRebelMojo.java
GenerateRebelMojo.getPluginConfigurationDom
private static Xpp3Dom getPluginConfigurationDom(MavenProject project, String pluginId) { Plugin plugin = project.getBuild().getPluginsAsMap().get(pluginId); if (plugin != null) { return (Xpp3Dom) plugin.getConfiguration(); } return null; }
java
private static Xpp3Dom getPluginConfigurationDom(MavenProject project, String pluginId) { Plugin plugin = project.getBuild().getPluginsAsMap().get(pluginId); if (plugin != null) { return (Xpp3Dom) plugin.getConfiguration(); } return null; }
[ "private", "static", "Xpp3Dom", "getPluginConfigurationDom", "(", "MavenProject", "project", ",", "String", "pluginId", ")", "{", "Plugin", "plugin", "=", "project", ".", "getBuild", "(", ")", ".", "getPluginsAsMap", "(", ")", ".", "get", "(", "pluginId", ")",...
Taken from eclipse plugin. Search for the configuration Xpp3 dom of an other plugin. @param project the current maven project to get the configuration from. @param pluginId the group id and artifact id of the plugin to search for @return the value of the plugin configuration
[ "Taken", "from", "eclipse", "plugin", ".", "Search", "for", "the", "configuration", "Xpp3", "dom", "of", "an", "other", "plugin", "." ]
train
https://github.com/zeroturnaround/maven-jrebel-plugin/blob/6a0d12529a13ae6b2b772658a714398147c091ca/src/main/java/org/zeroturnaround/javarebel/maven/GenerateRebelMojo.java#L742-L749
Azure/azure-sdk-for-java
hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ExtensionsInner.java
ExtensionsInner.getMonitoringStatusAsync
public Observable<ClusterMonitoringResponseInner> getMonitoringStatusAsync(String resourceGroupName, String clusterName) { return getMonitoringStatusWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1<ServiceResponse<ClusterMonitoringResponseInner>, ClusterMonitoringResponseInner>() { @Override public ClusterMonitoringResponseInner call(ServiceResponse<ClusterMonitoringResponseInner> response) { return response.body(); } }); }
java
public Observable<ClusterMonitoringResponseInner> getMonitoringStatusAsync(String resourceGroupName, String clusterName) { return getMonitoringStatusWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1<ServiceResponse<ClusterMonitoringResponseInner>, ClusterMonitoringResponseInner>() { @Override public ClusterMonitoringResponseInner call(ServiceResponse<ClusterMonitoringResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ClusterMonitoringResponseInner", ">", "getMonitoringStatusAsync", "(", "String", "resourceGroupName", ",", "String", "clusterName", ")", "{", "return", "getMonitoringStatusWithServiceResponseAsync", "(", "resourceGroupName", ",", "clusterName", "...
Gets the status of Operations Management Suite (OMS) on the HDInsight cluster. @param resourceGroupName The name of the resource group. @param clusterName The name of the cluster. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ClusterMonitoringResponseInner object
[ "Gets", "the", "status", "of", "Operations", "Management", "Suite", "(", "OMS", ")", "on", "the", "HDInsight", "cluster", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ExtensionsInner.java#L306-L313
op4j/op4j
src/main/java/org/op4j/functions/FnString.java
FnString.toCalendar
public static final Function<String,Calendar> toCalendar(final String pattern, final Locale locale) { return new ToCalendar(pattern, locale); }
java
public static final Function<String,Calendar> toCalendar(final String pattern, final Locale locale) { return new ToCalendar(pattern, locale); }
[ "public", "static", "final", "Function", "<", "String", ",", "Calendar", ">", "toCalendar", "(", "final", "String", "pattern", ",", "final", "Locale", "locale", ")", "{", "return", "new", "ToCalendar", "(", "pattern", ",", "locale", ")", ";", "}" ]
<p> Converts the target String to a <tt>java.util.Calendar</tt> by applying the specified pattern and locale. The locale is needed for correctly parsing month names. </p> <p> Pattern format is that of <tt>java.text.SimpleDateFormat</tt>. </p> @param pattern the pattern to be used. @param locale the locale which will be used for parsing month names @return the resulting Calendar
[ "<p", ">", "Converts", "the", "target", "String", "to", "a", "<tt", ">", "java", ".", "util", ".", "Calendar<", "/", "tt", ">", "by", "applying", "the", "specified", "pattern", "and", "locale", ".", "The", "locale", "is", "needed", "for", "correctly", ...
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnString.java#L1680-L1682
Netflix/ndbench
ndbench-dyno-plugins/src/main/java/com/netflix/ndbench/plugin/dyno/DynoJedisUtils.java
DynoJedisUtils.pipelineReadHGETALL
public String pipelineReadHGETALL(String key, String hm_key_prefix) throws Exception { DynoJedisPipeline pipeline = jedisClient.get().pipelined(); Response<Map<byte[], byte[]>> resp = pipeline.hgetAll((hm_key_prefix + key).getBytes()); pipeline.sync(); if (resp == null || resp.get() == null) { logger.info("Cache Miss: key:" + key); return null; } else { StringBuilder sb = new StringBuilder(); for (byte[] bytes : resp.get().keySet()) { if (sb.length() > 0) { sb.append(","); } sb.append(new String(bytes)); } return "HGETALL:" + sb.toString(); } }
java
public String pipelineReadHGETALL(String key, String hm_key_prefix) throws Exception { DynoJedisPipeline pipeline = jedisClient.get().pipelined(); Response<Map<byte[], byte[]>> resp = pipeline.hgetAll((hm_key_prefix + key).getBytes()); pipeline.sync(); if (resp == null || resp.get() == null) { logger.info("Cache Miss: key:" + key); return null; } else { StringBuilder sb = new StringBuilder(); for (byte[] bytes : resp.get().keySet()) { if (sb.length() > 0) { sb.append(","); } sb.append(new String(bytes)); } return "HGETALL:" + sb.toString(); } }
[ "public", "String", "pipelineReadHGETALL", "(", "String", "key", ",", "String", "hm_key_prefix", ")", "throws", "Exception", "{", "DynoJedisPipeline", "pipeline", "=", "jedisClient", ".", "get", "(", ")", ".", "pipelined", "(", ")", ";", "Response", "<", "Map"...
This the pipelined HGETALL @param key @return the contents of the hash @throws Exception
[ "This", "the", "pipelined", "HGETALL" ]
train
https://github.com/Netflix/ndbench/blob/8d664244b5f9d01395248a296b86a3c822e6d764/ndbench-dyno-plugins/src/main/java/com/netflix/ndbench/plugin/dyno/DynoJedisUtils.java#L119-L136
oehf/ipf-oht-atna
nodeauth/src/main/java/org/openhealthtools/ihe/atna/nodeauth/SecurityDomainManager.java
SecurityDomainManager.formatKey
public String formatKey(String host, int port) throws URISyntaxException { if (port < 1) { throw new URISyntaxException("","The port value must be greater than zero"); } if (!"".equals(host)) { return host + ":" + port; } else { throw new URISyntaxException("","The host cannot be null"); } }
java
public String formatKey(String host, int port) throws URISyntaxException { if (port < 1) { throw new URISyntaxException("","The port value must be greater than zero"); } if (!"".equals(host)) { return host + ":" + port; } else { throw new URISyntaxException("","The host cannot be null"); } }
[ "public", "String", "formatKey", "(", "String", "host", ",", "int", "port", ")", "throws", "URISyntaxException", "{", "if", "(", "port", "<", "1", ")", "{", "throw", "new", "URISyntaxException", "(", "\"\"", ",", "\"The port value must be greater than zero\"", "...
Concatenates a host string and port integer into a "host:port" string @param host @param port @return @throws URISyntaxException
[ "Concatenates", "a", "host", "string", "and", "port", "integer", "into", "a", "host", ":", "port", "string" ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/nodeauth/src/main/java/org/openhealthtools/ihe/atna/nodeauth/SecurityDomainManager.java#L255-L266
Netflix/Nicobar
nicobar-core/src/main/java/com/netflix/nicobar/core/module/jboss/JBossModuleUtils.java
JBossModuleUtils.buildFilters
private static PathFilter buildFilters(Set<String> filterPaths, boolean failedMatchValue) { if (filterPaths == null) return PathFilters.acceptAll(); else if (filterPaths.isEmpty()) { return PathFilters.rejectAll(); } else { MultiplePathFilterBuilder builder = PathFilters.multiplePathFilterBuilder(failedMatchValue); for (String importPathGlob : filterPaths) builder.addFilter(PathFilters.match(importPathGlob), !failedMatchValue); return builder.create(); } }
java
private static PathFilter buildFilters(Set<String> filterPaths, boolean failedMatchValue) { if (filterPaths == null) return PathFilters.acceptAll(); else if (filterPaths.isEmpty()) { return PathFilters.rejectAll(); } else { MultiplePathFilterBuilder builder = PathFilters.multiplePathFilterBuilder(failedMatchValue); for (String importPathGlob : filterPaths) builder.addFilter(PathFilters.match(importPathGlob), !failedMatchValue); return builder.create(); } }
[ "private", "static", "PathFilter", "buildFilters", "(", "Set", "<", "String", ">", "filterPaths", ",", "boolean", "failedMatchValue", ")", "{", "if", "(", "filterPaths", "==", "null", ")", "return", "PathFilters", ".", "acceptAll", "(", ")", ";", "else", "if...
Build a PathFilter for a set of filter paths @param filterPaths the set of paths to filter on. Can be null to indicate that no filters should be applied (accept all), can be empty to indicate that everything should be filtered (reject all). @param failedMatchValue the value the PathFilter returns when a path does not match. @return a PathFilter.
[ "Build", "a", "PathFilter", "for", "a", "set", "of", "filter", "paths" ]
train
https://github.com/Netflix/Nicobar/blob/507173dcae4a86a955afc3df222a855862fab8d7/nicobar-core/src/main/java/com/netflix/nicobar/core/module/jboss/JBossModuleUtils.java#L297-L308
alkacon/opencms-core
src/org/opencms/ui/A_CmsUI.java
A_CmsUI.setContentToDialog
public void setContentToDialog(String caption, CmsBasicDialog dialog) { setContent(new Label()); Window window = CmsBasicDialog.prepareWindow(DialogWidth.narrow); window.setContent(dialog); window.setCaption(caption); window.setClosable(false); addWindow(window); window.center(); }
java
public void setContentToDialog(String caption, CmsBasicDialog dialog) { setContent(new Label()); Window window = CmsBasicDialog.prepareWindow(DialogWidth.narrow); window.setContent(dialog); window.setCaption(caption); window.setClosable(false); addWindow(window); window.center(); }
[ "public", "void", "setContentToDialog", "(", "String", "caption", ",", "CmsBasicDialog", "dialog", ")", "{", "setContent", "(", "new", "Label", "(", ")", ")", ";", "Window", "window", "=", "CmsBasicDialog", ".", "prepareWindow", "(", "DialogWidth", ".", "narro...
Replaces the ui content with a single dialog.<p> @param caption the caption @param dialog the dialog content
[ "Replaces", "the", "ui", "content", "with", "a", "single", "dialog", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/A_CmsUI.java#L278-L287
OpenLiberty/open-liberty
dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/handlers/FileStatusTaskPropertyHandler.java
FileStatusTaskPropertyHandler.taskProperties
private void taskProperties(RESTRequest request, RESTResponse response) { String taskID = RESTHelper.getRequiredParam(request, APIConstants.PARAM_TASK_ID); String taskPropertiesText = getMultipleRoutingHelper().getTaskProperties(taskID); OutputHelper.writeTextOutput(response, taskPropertiesText); }
java
private void taskProperties(RESTRequest request, RESTResponse response) { String taskID = RESTHelper.getRequiredParam(request, APIConstants.PARAM_TASK_ID); String taskPropertiesText = getMultipleRoutingHelper().getTaskProperties(taskID); OutputHelper.writeTextOutput(response, taskPropertiesText); }
[ "private", "void", "taskProperties", "(", "RESTRequest", "request", ",", "RESTResponse", "response", ")", "{", "String", "taskID", "=", "RESTHelper", ".", "getRequiredParam", "(", "request", ",", "APIConstants", ".", "PARAM_TASK_ID", ")", ";", "String", "taskPrope...
Returns the list of available properties and their corresponding URLs.
[ "Returns", "the", "list", "of", "available", "properties", "and", "their", "corresponding", "URLs", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/handlers/FileStatusTaskPropertyHandler.java#L86-L91
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/blas/BlasBufferUtil.java
BlasBufferUtil.getDimension
public static int getDimension(INDArray arr, boolean defaultRows) { // FIXME: int cast //ignore ordering for vectors if (arr.isVector()) { return defaultRows ? (int) arr.rows() : (int) arr.columns(); } if (arr.ordering() == NDArrayFactory.C) return defaultRows ? (int) arr.columns() : (int) arr.rows(); return defaultRows ? (int) arr.rows() : (int) arr.columns(); }
java
public static int getDimension(INDArray arr, boolean defaultRows) { // FIXME: int cast //ignore ordering for vectors if (arr.isVector()) { return defaultRows ? (int) arr.rows() : (int) arr.columns(); } if (arr.ordering() == NDArrayFactory.C) return defaultRows ? (int) arr.columns() : (int) arr.rows(); return defaultRows ? (int) arr.rows() : (int) arr.columns(); }
[ "public", "static", "int", "getDimension", "(", "INDArray", "arr", ",", "boolean", "defaultRows", ")", "{", "// FIXME: int cast", "//ignore ordering for vectors", "if", "(", "arr", ".", "isVector", "(", ")", ")", "{", "return", "defaultRows", "?", "(", "int", ...
Get the dimension associated with the given ordering. When working with blas routines, they typically assume c ordering, instead you can invert the rows/columns which enable you to do no copy blas operations. @param arr @param defaultRows @return
[ "Get", "the", "dimension", "associated", "with", "the", "given", "ordering", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/blas/BlasBufferUtil.java#L145-L155
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_rsva_serviceName_PUT
public void billingAccount_rsva_serviceName_PUT(String billingAccount, String serviceName, OvhRsva body) throws IOException { String qPath = "/telephony/{billingAccount}/rsva/{serviceName}"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
java
public void billingAccount_rsva_serviceName_PUT(String billingAccount, String serviceName, OvhRsva body) throws IOException { String qPath = "/telephony/{billingAccount}/rsva/{serviceName}"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "billingAccount_rsva_serviceName_PUT", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "OvhRsva", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/rsva/{serviceName}\"", ";", "StringBuild...
Alter this object properties REST: PUT /telephony/{billingAccount}/rsva/{serviceName} @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L5937-L5941
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehouseItemPersistenceImpl.java
CommerceWarehouseItemPersistenceImpl.findByCommerceWarehouseId
@Override public List<CommerceWarehouseItem> findByCommerceWarehouseId( long commerceWarehouseId, int start, int end) { return findByCommerceWarehouseId(commerceWarehouseId, start, end, null); }
java
@Override public List<CommerceWarehouseItem> findByCommerceWarehouseId( long commerceWarehouseId, int start, int end) { return findByCommerceWarehouseId(commerceWarehouseId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceWarehouseItem", ">", "findByCommerceWarehouseId", "(", "long", "commerceWarehouseId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByCommerceWarehouseId", "(", "commerceWarehouseId", ",", "start", ...
Returns a range of all the commerce warehouse items where commerceWarehouseId = &#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 CommerceWarehouseItemModelImpl}. 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 commerceWarehouseId the commerce warehouse ID @param start the lower bound of the range of commerce warehouse items @param end the upper bound of the range of commerce warehouse items (not inclusive) @return the range of matching commerce warehouse items
[ "Returns", "a", "range", "of", "all", "the", "commerce", "warehouse", "items", "where", "commerceWarehouseId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehouseItemPersistenceImpl.java#L143-L147
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java
DestinationManager.createForeignDestination
private DestinationHandler createForeignDestination(DestinationForeignDefinition dfd, String busName) throws SIResourceException, SINotPossibleInCurrentConfigurationException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createForeignDestination", new Object[] { dfd, busName }); ForeignDestinationHandler fdh = null; //The lock on the destinationManager is taken to stop 2 threads creating the same //destination and also to synchronize dynamic deletes with the //creation of aliases. This stops an alias destination being created that targets a //destination in the process of being deleted. synchronized (this) { // Create a new DestinationHandler, which is created locked fdh = new ForeignDestinationHandler(dfd, messageProcessor, this, findBus(dfd.getBus()), busName); DestinationIndex.Type type = new DestinationIndex.Type(); type.foreignDestination = Boolean.TRUE; type.alias = Boolean.FALSE; type.local = Boolean.FALSE; type.remote = Boolean.FALSE; type.queue = new Boolean(!fdh.isPubSub()); type.state = State.ACTIVE; destinationIndex.put(fdh, type); fdh.registerControlAdapters(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createForeignDestination", fdh); return fdh; }
java
private DestinationHandler createForeignDestination(DestinationForeignDefinition dfd, String busName) throws SIResourceException, SINotPossibleInCurrentConfigurationException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createForeignDestination", new Object[] { dfd, busName }); ForeignDestinationHandler fdh = null; //The lock on the destinationManager is taken to stop 2 threads creating the same //destination and also to synchronize dynamic deletes with the //creation of aliases. This stops an alias destination being created that targets a //destination in the process of being deleted. synchronized (this) { // Create a new DestinationHandler, which is created locked fdh = new ForeignDestinationHandler(dfd, messageProcessor, this, findBus(dfd.getBus()), busName); DestinationIndex.Type type = new DestinationIndex.Type(); type.foreignDestination = Boolean.TRUE; type.alias = Boolean.FALSE; type.local = Boolean.FALSE; type.remote = Boolean.FALSE; type.queue = new Boolean(!fdh.isPubSub()); type.state = State.ACTIVE; destinationIndex.put(fdh, type); fdh.registerControlAdapters(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createForeignDestination", fdh); return fdh; }
[ "private", "DestinationHandler", "createForeignDestination", "(", "DestinationForeignDefinition", "dfd", ",", "String", "busName", ")", "throws", "SIResourceException", ",", "SINotPossibleInCurrentConfigurationException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnab...
Create a foreign destination when passed an appropriate and a valid targetDestinationHandler. <p> Assumes that the destination to create does not already exist. @param destinationDefinition @param destinationLocalizingMEs @param busName @return
[ "Create", "a", "foreign", "destination", "when", "passed", "an", "appropriate", "and", "a", "valid", "targetDestinationHandler", ".", "<p", ">", "Assumes", "that", "the", "destination", "to", "create", "does", "not", "already", "exist", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L6247-L6279
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java
FileSystem.unzipFile
public static void unzipFile(InputStream input, File output) throws IOException { if (output == null) { return; } output.mkdirs(); if (!output.isDirectory()) { throw new IOException(Locale.getString("E3", output)); //$NON-NLS-1$ } try (ZipInputStream zis = new ZipInputStream(input)) { final byte[] buffer = new byte[BUFFER_SIZE]; int len; ZipEntry zipEntry = zis.getNextEntry(); while (zipEntry != null) { final String name = zipEntry.getName(); final File outFile = new File(output, name).getCanonicalFile(); if (zipEntry.isDirectory()) { outFile.mkdirs(); } else { outFile.getParentFile().mkdirs(); try (FileOutputStream fos = new FileOutputStream(outFile)) { while ((len = zis.read(buffer)) > 0) { fos.write(buffer, 0, len); } } } zipEntry = zis.getNextEntry(); } } }
java
public static void unzipFile(InputStream input, File output) throws IOException { if (output == null) { return; } output.mkdirs(); if (!output.isDirectory()) { throw new IOException(Locale.getString("E3", output)); //$NON-NLS-1$ } try (ZipInputStream zis = new ZipInputStream(input)) { final byte[] buffer = new byte[BUFFER_SIZE]; int len; ZipEntry zipEntry = zis.getNextEntry(); while (zipEntry != null) { final String name = zipEntry.getName(); final File outFile = new File(output, name).getCanonicalFile(); if (zipEntry.isDirectory()) { outFile.mkdirs(); } else { outFile.getParentFile().mkdirs(); try (FileOutputStream fos = new FileOutputStream(outFile)) { while ((len = zis.read(buffer)) > 0) { fos.write(buffer, 0, len); } } } zipEntry = zis.getNextEntry(); } } }
[ "public", "static", "void", "unzipFile", "(", "InputStream", "input", ",", "File", "output", ")", "throws", "IOException", "{", "if", "(", "output", "==", "null", ")", "{", "return", ";", "}", "output", ".", "mkdirs", "(", ")", ";", "if", "(", "!", "...
Unzip the given stream and write out the file in the output. If the input file is a directory, the content of the directory is zipped. If the input file is a standard file, it is zipped. @param input the ZIP file to uncompress. @param output the uncompressed file to create. @throws IOException when uncompressing is failing. @since 6.2
[ "Unzip", "the", "given", "stream", "and", "write", "out", "the", "file", "in", "the", "output", ".", "If", "the", "input", "file", "is", "a", "directory", "the", "content", "of", "the", "directory", "is", "zipped", ".", "If", "the", "input", "file", "i...
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L3002-L3031
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/UnitQuaternions.java
UnitQuaternions.orientationAngle
public static double orientationAngle(Point3d[] fixed, Point3d[] moved) { Quat4d q = relativeOrientation(fixed, moved); return angle(q); }
java
public static double orientationAngle(Point3d[] fixed, Point3d[] moved) { Quat4d q = relativeOrientation(fixed, moved); return angle(q); }
[ "public", "static", "double", "orientationAngle", "(", "Point3d", "[", "]", "fixed", ",", "Point3d", "[", "]", "moved", ")", "{", "Quat4d", "q", "=", "relativeOrientation", "(", "fixed", ",", "moved", ")", ";", "return", "angle", "(", "q", ")", ";", "}...
The angle of the relative orientation of the two sets of points in 3D. Equivalent to {@link #angle(Quat4d)} of the unit quaternion obtained by {@link #relativeOrientation(Point3d[], Point3d[])}. <p> The arrays of points need to be centered at the origin. To center the points use {@link CalcPoint#center(Point3d[])}. @param fixed array of Point3d, centered at origin. Original coordinates will not be modified. @param moved array of Point3d, centered at origin. Original coordinates will not be modified. @return the angle in radians of the relative orientation of the points, angle to rotate moved to bring it to the same orientation as fixed.
[ "The", "angle", "of", "the", "relative", "orientation", "of", "the", "two", "sets", "of", "points", "in", "3D", ".", "Equivalent", "to", "{", "@link", "#angle", "(", "Quat4d", ")", "}", "of", "the", "unit", "quaternion", "obtained", "by", "{", "@link", ...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/UnitQuaternions.java#L158-L161
alkacon/opencms-core
src/org/opencms/db/generic/CmsHistoryDriver.java
CmsHistoryDriver.internalValidateResource
protected boolean internalValidateResource(CmsDbContext dbc, CmsResource resource, int publishTag) throws CmsDataAccessException { Connection conn = null; PreparedStatement stmt = null; ResultSet res = null; boolean exists = false; try { conn = m_sqlManager.getConnection(dbc); stmt = m_sqlManager.getPreparedStatement(conn, "C_HISTORY_EXISTS_RESOURCE"); stmt.setString(1, resource.getResourceId().toString()); stmt.setInt(2, publishTag); res = stmt.executeQuery(); exists = res.next(); } catch (SQLException e) { throw new CmsDbSqlException( Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)), e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, res); } return exists; }
java
protected boolean internalValidateResource(CmsDbContext dbc, CmsResource resource, int publishTag) throws CmsDataAccessException { Connection conn = null; PreparedStatement stmt = null; ResultSet res = null; boolean exists = false; try { conn = m_sqlManager.getConnection(dbc); stmt = m_sqlManager.getPreparedStatement(conn, "C_HISTORY_EXISTS_RESOURCE"); stmt.setString(1, resource.getResourceId().toString()); stmt.setInt(2, publishTag); res = stmt.executeQuery(); exists = res.next(); } catch (SQLException e) { throw new CmsDbSqlException( Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)), e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, res); } return exists; }
[ "protected", "boolean", "internalValidateResource", "(", "CmsDbContext", "dbc", ",", "CmsResource", "resource", ",", "int", "publishTag", ")", "throws", "CmsDataAccessException", "{", "Connection", "conn", "=", "null", ";", "PreparedStatement", "stmt", "=", "null", ...
Tests if a history resource does exist.<p> @param dbc the current database context @param resource the resource to test @param publishTag the publish tag of the resource to test @return <code>true</code> if the resource already exists, <code>false</code> otherwise @throws CmsDataAccessException if something goes wrong
[ "Tests", "if", "a", "history", "resource", "does", "exist", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsHistoryDriver.java#L1894-L1918
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAddressPersistenceImpl.java
CommerceAddressPersistenceImpl.countByG_C_C
@Override public int countByG_C_C(long groupId, long classNameId, long classPK) { FinderPath finderPath = FINDER_PATH_COUNT_BY_G_C_C; Object[] finderArgs = new Object[] { groupId, classNameId, classPK }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_COMMERCEADDRESS_WHERE); query.append(_FINDER_COLUMN_G_C_C_GROUPID_2); query.append(_FINDER_COLUMN_G_C_C_CLASSNAMEID_2); query.append(_FINDER_COLUMN_G_C_C_CLASSPK_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(classNameId); qPos.add(classPK); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
java
@Override public int countByG_C_C(long groupId, long classNameId, long classPK) { FinderPath finderPath = FINDER_PATH_COUNT_BY_G_C_C; Object[] finderArgs = new Object[] { groupId, classNameId, classPK }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_COMMERCEADDRESS_WHERE); query.append(_FINDER_COLUMN_G_C_C_GROUPID_2); query.append(_FINDER_COLUMN_G_C_C_CLASSNAMEID_2); query.append(_FINDER_COLUMN_G_C_C_CLASSPK_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(classNameId); qPos.add(classPK); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
[ "@", "Override", "public", "int", "countByG_C_C", "(", "long", "groupId", ",", "long", "classNameId", ",", "long", "classPK", ")", "{", "FinderPath", "finderPath", "=", "FINDER_PATH_COUNT_BY_G_C_C", ";", "Object", "[", "]", "finderArgs", "=", "new", "Object", ...
Returns the number of commerce addresses where groupId = &#63; and classNameId = &#63; and classPK = &#63;. @param groupId the group ID @param classNameId the class name ID @param classPK the class pk @return the number of matching commerce addresses
[ "Returns", "the", "number", "of", "commerce", "addresses", "where", "groupId", "=", "&#63", ";", "and", "classNameId", "=", "&#63", ";", "and", "classPK", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAddressPersistenceImpl.java#L2210-L2261
google/j2objc
jre_emul/android/frameworks/base/core/java/android/text/SpannableStringBuilder.java
SpannableStringBuilder.setSpan
public void setSpan(Object what, int start, int end, int flags) { setSpan(true, what, start, end, flags); }
java
public void setSpan(Object what, int start, int end, int flags) { setSpan(true, what, start, end, flags); }
[ "public", "void", "setSpan", "(", "Object", "what", ",", "int", "start", ",", "int", "end", ",", "int", "flags", ")", "{", "setSpan", "(", "true", ",", "what", ",", "start", ",", "end", ",", "flags", ")", ";", "}" ]
Mark the specified range of text with the specified object. The flags determine how the span will behave when text is inserted at the start or end of the span's range.
[ "Mark", "the", "specified", "range", "of", "text", "with", "the", "specified", "object", ".", "The", "flags", "determine", "how", "the", "span", "will", "behave", "when", "text", "is", "inserted", "at", "the", "start", "or", "end", "of", "the", "span", "...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/SpannableStringBuilder.java#L585-L587
google/j2objc
jre_emul/android/platform/libcore/xml/src/main/java/org/xmlpull/v1/sax2/Driver.java
Driver.startElement
protected void startElement(String namespace, String localName, String qName) throws SAXException { contentHandler.startElement(namespace, localName, qName, this); }
java
protected void startElement(String namespace, String localName, String qName) throws SAXException { contentHandler.startElement(namespace, localName, qName, this); }
[ "protected", "void", "startElement", "(", "String", "namespace", ",", "String", "localName", ",", "String", "qName", ")", "throws", "SAXException", "{", "contentHandler", ".", "startElement", "(", "namespace", ",", "localName", ",", "qName", ",", "this", ")", ...
Calls {@link ContentHandler#startElement(String, String, String, Attributes) startElement} on the <code>ContentHandler</code> with <code>this</code> driver object as the {@link Attributes} implementation. In default implementation {@link Attributes} object is valid only during this method call and may not be stored. Sub-classes can overwrite this method to cache attributes.
[ "Calls", "{" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/xml/src/main/java/org/xmlpull/v1/sax2/Driver.java#L466-L468
google/closure-compiler
src/com/google/javascript/jscomp/TypeInference.java
TypeInference.traverseCatch
@CheckReturnValue private FlowScope traverseCatch(Node catchNode, FlowScope scope) { Node catchTarget = catchNode.getFirstChild(); if (catchTarget.isName()) { // TODO(lharker): is this case even necessary? seems like TypedScopeCreator handles it Node name = catchNode.getFirstChild(); JSType type; // If the catch expression name was declared in the catch use that type, // otherwise use "unknown". JSDocInfo info = name.getJSDocInfo(); if (info != null && info.hasType()) { type = info.getType().evaluate(scope.getDeclarationScope(), registry); } else { type = getNativeType(JSTypeNative.UNKNOWN_TYPE); } name.setJSType(type); return redeclareSimpleVar(scope, name, type); } else if (catchTarget.isDestructuringPattern()) { Node pattern = catchNode.getFirstChild(); return traverseDestructuringPattern(pattern, scope, unknownType, AssignmentType.DECLARATION); } else { checkState(catchTarget.isEmpty(), catchTarget); // ES2019 allows `try {} catch {}` with no catch expression return scope; } }
java
@CheckReturnValue private FlowScope traverseCatch(Node catchNode, FlowScope scope) { Node catchTarget = catchNode.getFirstChild(); if (catchTarget.isName()) { // TODO(lharker): is this case even necessary? seems like TypedScopeCreator handles it Node name = catchNode.getFirstChild(); JSType type; // If the catch expression name was declared in the catch use that type, // otherwise use "unknown". JSDocInfo info = name.getJSDocInfo(); if (info != null && info.hasType()) { type = info.getType().evaluate(scope.getDeclarationScope(), registry); } else { type = getNativeType(JSTypeNative.UNKNOWN_TYPE); } name.setJSType(type); return redeclareSimpleVar(scope, name, type); } else if (catchTarget.isDestructuringPattern()) { Node pattern = catchNode.getFirstChild(); return traverseDestructuringPattern(pattern, scope, unknownType, AssignmentType.DECLARATION); } else { checkState(catchTarget.isEmpty(), catchTarget); // ES2019 allows `try {} catch {}` with no catch expression return scope; } }
[ "@", "CheckReturnValue", "private", "FlowScope", "traverseCatch", "(", "Node", "catchNode", ",", "FlowScope", "scope", ")", "{", "Node", "catchTarget", "=", "catchNode", ".", "getFirstChild", "(", ")", ";", "if", "(", "catchTarget", ".", "isName", "(", ")", ...
Any value can be thrown, so it's really impossible to determine the type of a CATCH param. Treat it as the UNKNOWN type.
[ "Any", "value", "can", "be", "thrown", "so", "it", "s", "really", "impossible", "to", "determine", "the", "type", "of", "a", "CATCH", "param", ".", "Treat", "it", "as", "the", "UNKNOWN", "type", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInference.java#L852-L877
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/spider/ObjectUpdater.java
ObjectUpdater.deleteObject
public ObjectResult deleteObject(SpiderTransaction parentTran, String objID) { ObjectResult result = new ObjectResult(objID); try { result.setObjectID(objID); DBObject dbObj = SpiderService.instance().getObject(m_tableDef, objID); if (dbObj != null) { deleteObject(dbObj); result.setUpdated(true); parentTran.mergeSubTransaction(m_dbTran); m_logger.trace("deleteObject(): object deleted with ID={}", objID); } else { result.setComment("Object not found"); m_logger.trace("deleteObject(): no object with ID={}", objID); } } catch (Throwable ex) { buildErrorStatus(result, objID, ex); } return result; }
java
public ObjectResult deleteObject(SpiderTransaction parentTran, String objID) { ObjectResult result = new ObjectResult(objID); try { result.setObjectID(objID); DBObject dbObj = SpiderService.instance().getObject(m_tableDef, objID); if (dbObj != null) { deleteObject(dbObj); result.setUpdated(true); parentTran.mergeSubTransaction(m_dbTran); m_logger.trace("deleteObject(): object deleted with ID={}", objID); } else { result.setComment("Object not found"); m_logger.trace("deleteObject(): no object with ID={}", objID); } } catch (Throwable ex) { buildErrorStatus(result, objID, ex); } return result; }
[ "public", "ObjectResult", "deleteObject", "(", "SpiderTransaction", "parentTran", ",", "String", "objID", ")", "{", "ObjectResult", "result", "=", "new", "ObjectResult", "(", "objID", ")", ";", "try", "{", "result", ".", "setObjectID", "(", "objID", ")", ";", ...
Delete the object with the given object ID. Because of idempotent update semantics, it is not an error if the object does not exist. If an object is actually deleted, updates are merged to the given parent SpiderTransaction. @param parentTran Parent {@link SpiderTransaction} to which updates are applied if the delete is successful. @param objID ID of object to be deleted. @return {@link ObjectResult} representing the results of the delete. Includes a comment if the object was not found.
[ "Delete", "the", "object", "with", "the", "given", "object", "ID", ".", "Because", "of", "idempotent", "update", "semantics", "it", "is", "not", "an", "error", "if", "the", "object", "does", "not", "exist", ".", "If", "an", "object", "is", "actually", "d...
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/ObjectUpdater.java#L137-L155
astrapi69/jaulp-wicket
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/parameter/PageParametersExtensions.java
PageParametersExtensions.getParameter
public static String getParameter(final PageParameters parameters, final String name) { return getString(parameters.get(name)); }
java
public static String getParameter(final PageParameters parameters, final String name) { return getString(parameters.get(name)); }
[ "public", "static", "String", "getParameter", "(", "final", "PageParameters", "parameters", ",", "final", "String", "name", ")", "{", "return", "getString", "(", "parameters", ".", "get", "(", "name", ")", ")", ";", "}" ]
Gets the parameter or returns null if it does not exists or is empty. @param parameters the parameters @param name the name @return the parameter or returns null if it does not exists or is empty.
[ "Gets", "the", "parameter", "or", "returns", "null", "if", "it", "does", "not", "exists", "or", "is", "empty", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/parameter/PageParametersExtensions.java#L177-L180
codeprimate-software/cp-elements
src/main/java/org/cp/elements/util/CollectionUtils.java
CollectionUtils.defaultIfEmpty
public static <E, T extends Iterable<E>> T defaultIfEmpty(T iterable, T defaultIterable) { return iterable != null && iterable.iterator().hasNext() ? iterable : defaultIterable; }
java
public static <E, T extends Iterable<E>> T defaultIfEmpty(T iterable, T defaultIterable) { return iterable != null && iterable.iterator().hasNext() ? iterable : defaultIterable; }
[ "public", "static", "<", "E", ",", "T", "extends", "Iterable", "<", "E", ">", ">", "T", "defaultIfEmpty", "(", "T", "iterable", ",", "T", "defaultIterable", ")", "{", "return", "iterable", "!=", "null", "&&", "iterable", ".", "iterator", "(", ")", ".",...
Returns the given {@link Iterable} if not {@literal null} or empty, otherwise returns the {@code defaultIterable}. @param <E> {@link Class} type of the elements in the {@link Iterable Iterables}. @param <T> concrete {@link Class} type of the {@link Iterable}. @param iterable {@link Iterable} to evaluate. @param defaultIterable {@link Iterable} to return if the given {@code iterable} is {@literal null} or empty. @return {@code iterable} if not {@literal null} or empty otherwise return {@code defaultIterable}. @see java.lang.Iterable
[ "Returns", "the", "given", "{", "@link", "Iterable", "}", "if", "not", "{", "@literal", "null", "}", "or", "empty", "otherwise", "returns", "the", "{", "@code", "defaultIterable", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/CollectionUtils.java#L315-L317
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java
MiniSatStyleSolver.pickBranchLit
protected int pickBranchLit() { int next = -1; while (next == -1 || this.vars.get(next).assignment() != Tristate.UNDEF || !this.vars.get(next).decision()) if (this.orderHeap.empty()) return -1; else next = this.orderHeap.removeMin(); return mkLit(next, this.vars.get(next).polarity()); }
java
protected int pickBranchLit() { int next = -1; while (next == -1 || this.vars.get(next).assignment() != Tristate.UNDEF || !this.vars.get(next).decision()) if (this.orderHeap.empty()) return -1; else next = this.orderHeap.removeMin(); return mkLit(next, this.vars.get(next).polarity()); }
[ "protected", "int", "pickBranchLit", "(", ")", "{", "int", "next", "=", "-", "1", ";", "while", "(", "next", "==", "-", "1", "||", "this", ".", "vars", ".", "get", "(", "next", ")", ".", "assignment", "(", ")", "!=", "Tristate", ".", "UNDEF", "||...
Picks the next branching literal. @return the literal or -1 if there are no unassigned literals left
[ "Picks", "the", "next", "branching", "literal", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java#L452-L460
Azure/azure-sdk-for-java
datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/DataLakeStoreAccountsInner.java
DataLakeStoreAccountsInner.listByAccountWithServiceResponseAsync
public Observable<ServiceResponse<Page<DataLakeStoreAccountInformationInner>>> listByAccountWithServiceResponseAsync(final String resourceGroupName, final String accountName) { return listByAccountSinglePageAsync(resourceGroupName, accountName) .concatMap(new Func1<ServiceResponse<Page<DataLakeStoreAccountInformationInner>>, Observable<ServiceResponse<Page<DataLakeStoreAccountInformationInner>>>>() { @Override public Observable<ServiceResponse<Page<DataLakeStoreAccountInformationInner>>> call(ServiceResponse<Page<DataLakeStoreAccountInformationInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByAccountNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<DataLakeStoreAccountInformationInner>>> listByAccountWithServiceResponseAsync(final String resourceGroupName, final String accountName) { return listByAccountSinglePageAsync(resourceGroupName, accountName) .concatMap(new Func1<ServiceResponse<Page<DataLakeStoreAccountInformationInner>>, Observable<ServiceResponse<Page<DataLakeStoreAccountInformationInner>>>>() { @Override public Observable<ServiceResponse<Page<DataLakeStoreAccountInformationInner>>> call(ServiceResponse<Page<DataLakeStoreAccountInformationInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByAccountNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "DataLakeStoreAccountInformationInner", ">", ">", ">", "listByAccountWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "accountName", ")", "{", "return", "lis...
Gets the first page of Data Lake Store accounts linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any. @param resourceGroupName The name of the Azure resource group. @param accountName The name of the Data Lake Analytics account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DataLakeStoreAccountInformationInner&gt; object
[ "Gets", "the", "first", "page", "of", "Data", "Lake", "Store", "accounts", "linked", "to", "the", "specified", "Data", "Lake", "Analytics", "account", ".", "The", "response", "includes", "a", "link", "to", "the", "next", "page", "if", "any", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/DataLakeStoreAccountsInner.java#L154-L166
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java
PrivacyListManager.createPrivacyList
public void createPrivacyList(String listName, List<PrivacyItem> privacyItems) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { updatePrivacyList(listName, privacyItems); }
java
public void createPrivacyList(String listName, List<PrivacyItem> privacyItems) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { updatePrivacyList(listName, privacyItems); }
[ "public", "void", "createPrivacyList", "(", "String", "listName", ",", "List", "<", "PrivacyItem", ">", "privacyItems", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "updatePrivacyList", ...
The client has created a new list. It send the new one to the server. @param listName the list that has changed its content. @param privacyItems a List with every privacy item in the list. @throws XMPPErrorException @throws NoResponseException @throws NotConnectedException @throws InterruptedException
[ "The", "client", "has", "created", "a", "new", "list", ".", "It", "send", "the", "new", "one", "to", "the", "server", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java#L506-L508
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/landf/ScreenUtil.java
ScreenUtil.setFont
public static void setFont(Font font, PropertyOwner propertyOwner, Map<String,Object> properties) { if (font != null) { ScreenUtil.setProperty(ScreenUtil.FONT_SIZE, Integer.toString(font.getSize()), propertyOwner, properties); ScreenUtil.setProperty(ScreenUtil.FONT_STYLE, Integer.toString(font.getStyle()), propertyOwner, properties); ScreenUtil.setProperty(ScreenUtil.FONT_NAME, font.getName(), propertyOwner, properties); } else { ScreenUtil.setProperty(ScreenUtil.FONT_SIZE, null, propertyOwner, properties); ScreenUtil.setProperty(ScreenUtil.FONT_STYLE, null, propertyOwner, properties); ScreenUtil.setProperty(ScreenUtil.FONT_NAME, null, propertyOwner, properties); } }
java
public static void setFont(Font font, PropertyOwner propertyOwner, Map<String,Object> properties) { if (font != null) { ScreenUtil.setProperty(ScreenUtil.FONT_SIZE, Integer.toString(font.getSize()), propertyOwner, properties); ScreenUtil.setProperty(ScreenUtil.FONT_STYLE, Integer.toString(font.getStyle()), propertyOwner, properties); ScreenUtil.setProperty(ScreenUtil.FONT_NAME, font.getName(), propertyOwner, properties); } else { ScreenUtil.setProperty(ScreenUtil.FONT_SIZE, null, propertyOwner, properties); ScreenUtil.setProperty(ScreenUtil.FONT_STYLE, null, propertyOwner, properties); ScreenUtil.setProperty(ScreenUtil.FONT_NAME, null, propertyOwner, properties); } }
[ "public", "static", "void", "setFont", "(", "Font", "font", ",", "PropertyOwner", "propertyOwner", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "if", "(", "font", "!=", "null", ")", "{", "ScreenUtil", ".", "setProperty", "(", "S...
Encode and set the font info. (Utility method). Font is saved in three properties (font.fontname, font.size, font.style). @param The registered font.
[ "Encode", "and", "set", "the", "font", "info", ".", "(", "Utility", "method", ")", ".", "Font", "is", "saved", "in", "three", "properties", "(", "font", ".", "fontname", "font", ".", "size", "font", ".", "style", ")", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/landf/ScreenUtil.java#L167-L181
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworksInner.java
VirtualNetworksInner.createOrUpdate
public VirtualNetworkInner createOrUpdate(String resourceGroupName, String virtualNetworkName, VirtualNetworkInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkName, parameters).toBlocking().last().body(); }
java
public VirtualNetworkInner createOrUpdate(String resourceGroupName, String virtualNetworkName, VirtualNetworkInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkName, parameters).toBlocking().last().body(); }
[ "public", "VirtualNetworkInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkName", ",", "VirtualNetworkInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkName...
Creates or updates a virtual network in the specified resource group. @param resourceGroupName The name of the resource group. @param virtualNetworkName The name of the virtual network. @param parameters Parameters supplied to the create or update virtual network operation @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VirtualNetworkInner object if successful.
[ "Creates", "or", "updates", "a", "virtual", "network", "in", "the", "specified", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworksInner.java#L456-L458
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/CachingPersonAttributeDaoImpl.java
CachingPersonAttributeDaoImpl.setUserInfoCache
@JsonIgnore public void setUserInfoCache(final Map<Serializable, Set<IPersonAttributes>> userInfoCache) { if (userInfoCache == null) { throw new IllegalArgumentException("userInfoCache may not be null"); } this.userInfoCache = userInfoCache; }
java
@JsonIgnore public void setUserInfoCache(final Map<Serializable, Set<IPersonAttributes>> userInfoCache) { if (userInfoCache == null) { throw new IllegalArgumentException("userInfoCache may not be null"); } this.userInfoCache = userInfoCache; }
[ "@", "JsonIgnore", "public", "void", "setUserInfoCache", "(", "final", "Map", "<", "Serializable", ",", "Set", "<", "IPersonAttributes", ">", ">", "userInfoCache", ")", "{", "if", "(", "userInfoCache", "==", "null", ")", "{", "throw", "new", "IllegalArgumentEx...
The Map to use for caching results. Only get, put and remove are used so the Map may be backed by a real caching implementation. @param userInfoCache The userInfoCache to set.
[ "The", "Map", "to", "use", "for", "caching", "results", ".", "Only", "get", "put", "and", "remove", "are", "used", "so", "the", "Map", "may", "be", "backed", "by", "a", "real", "caching", "implementation", "." ]
train
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/CachingPersonAttributeDaoImpl.java#L210-L217
JOML-CI/JOML
src/org/joml/Matrix3x2d.java
Matrix3x2d.scaleAround
public Matrix3x2d scaleAround(double sx, double sy, double ox, double oy, Matrix3x2d dest) { double nm20 = m00 * ox + m10 * oy + m20; double nm21 = m01 * ox + m11 * oy + m21; dest.m00 = m00 * sx; dest.m01 = m01 * sx; dest.m10 = m10 * sy; dest.m11 = m11 * sy; dest.m20 = -m00 * ox - m10 * oy + nm20; dest.m21 = -m01 * ox - m11 * oy + nm21; return dest; }
java
public Matrix3x2d scaleAround(double sx, double sy, double ox, double oy, Matrix3x2d dest) { double nm20 = m00 * ox + m10 * oy + m20; double nm21 = m01 * ox + m11 * oy + m21; dest.m00 = m00 * sx; dest.m01 = m01 * sx; dest.m10 = m10 * sy; dest.m11 = m11 * sy; dest.m20 = -m00 * ox - m10 * oy + nm20; dest.m21 = -m01 * ox - m11 * oy + nm21; return dest; }
[ "public", "Matrix3x2d", "scaleAround", "(", "double", "sx", ",", "double", "sy", ",", "double", "ox", ",", "double", "oy", ",", "Matrix3x2d", "dest", ")", "{", "double", "nm20", "=", "m00", "*", "ox", "+", "m10", "*", "oy", "+", "m20", ";", "double",...
Apply scaling to <code>this</code> matrix by scaling the base axes by the given sx and sy factors while using <code>(ox, oy)</code> as the scaling origin, and store the result in <code>dest</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>S</code> the scaling matrix, then the new matrix will be <code>M * S</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * S * v</code> , the scaling will be applied first! <p> This method is equivalent to calling: <code>translate(ox, oy, dest).scale(sx, sy).translate(-ox, -oy)</code> @param sx the scaling factor of the x component @param sy the scaling factor of the y component @param ox the x coordinate of the scaling origin @param oy the y coordinate of the scaling origin @param dest will hold the result @return dest
[ "Apply", "scaling", "to", "<code", ">", "this<", "/", "code", ">", "matrix", "by", "scaling", "the", "base", "axes", "by", "the", "given", "sx", "and", "sy", "factors", "while", "using", "<code", ">", "(", "ox", "oy", ")", "<", "/", "code", ">", "a...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3x2d.java#L1431-L1441
micronaut-projects/micronaut-core
core/src/main/java/io/micronaut/core/annotation/AnnotationValueBuilder.java
AnnotationValueBuilder.values
public AnnotationValueBuilder<T> values(@Nullable Enum<?>... enumObjs) { return member(AnnotationMetadata.VALUE_MEMBER, enumObjs); }
java
public AnnotationValueBuilder<T> values(@Nullable Enum<?>... enumObjs) { return member(AnnotationMetadata.VALUE_MEMBER, enumObjs); }
[ "public", "AnnotationValueBuilder", "<", "T", ">", "values", "(", "@", "Nullable", "Enum", "<", "?", ">", "...", "enumObjs", ")", "{", "return", "member", "(", "AnnotationMetadata", ".", "VALUE_MEMBER", ",", "enumObjs", ")", ";", "}" ]
Sets the value member to the given enum objects. @param enumObjs The enum[] @return This builder
[ "Sets", "the", "value", "member", "to", "the", "given", "enum", "objects", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/annotation/AnnotationValueBuilder.java#L149-L151
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/JFapByteBuffer.java
JFapByteBuffer.getDumpBytes
private static String getDumpBytes(WsByteBuffer buffer, int bytesToDump, boolean rewind) { // Save the current position int pos = buffer.position(); if (rewind) { buffer.rewind(); } byte[] data = null; int start; int count = bytesToDump; if (count > buffer.remaining() || count == ENTIRE_BUFFER) count = buffer.remaining(); if (buffer.hasArray()) { data = buffer.array(); start = buffer.arrayOffset() + buffer.position(); } else { data = new byte[count]; buffer.get(data); start = 0; } String strData = "Dumping "+count+" bytes of buffer data:\r\n"; if (count > 0) strData += SibTr.formatBytes(data, start, count); // Return the position to where it should be if (rewind) buffer.position(pos); return strData; }
java
private static String getDumpBytes(WsByteBuffer buffer, int bytesToDump, boolean rewind) { // Save the current position int pos = buffer.position(); if (rewind) { buffer.rewind(); } byte[] data = null; int start; int count = bytesToDump; if (count > buffer.remaining() || count == ENTIRE_BUFFER) count = buffer.remaining(); if (buffer.hasArray()) { data = buffer.array(); start = buffer.arrayOffset() + buffer.position(); } else { data = new byte[count]; buffer.get(data); start = 0; } String strData = "Dumping "+count+" bytes of buffer data:\r\n"; if (count > 0) strData += SibTr.formatBytes(data, start, count); // Return the position to where it should be if (rewind) buffer.position(pos); return strData; }
[ "private", "static", "String", "getDumpBytes", "(", "WsByteBuffer", "buffer", ",", "int", "bytesToDump", ",", "boolean", "rewind", ")", "{", "// Save the current position", "int", "pos", "=", "buffer", ".", "position", "(", ")", ";", "if", "(", "rewind", ")", ...
Returns a dump of the specified number of bytes of the specified buffer. @param buffer @param bytesToDump @return Returns a String containing a dump of the buffer.
[ "Returns", "a", "dump", "of", "the", "specified", "number", "of", "bytes", "of", "the", "specified", "buffer", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/JFapByteBuffer.java#L830-L863
thelinmichael/spotify-web-api-java
src/main/java/com/wrapper/spotify/SpotifyApi.java
SpotifyApi.getArtistsTopTracks
public GetArtistsTopTracksRequest.Builder getArtistsTopTracks(String id, CountryCode country) { return new GetArtistsTopTracksRequest.Builder(accessToken) .setDefaults(httpManager, scheme, host, port) .id(id) .country(country); }
java
public GetArtistsTopTracksRequest.Builder getArtistsTopTracks(String id, CountryCode country) { return new GetArtistsTopTracksRequest.Builder(accessToken) .setDefaults(httpManager, scheme, host, port) .id(id) .country(country); }
[ "public", "GetArtistsTopTracksRequest", ".", "Builder", "getArtistsTopTracks", "(", "String", "id", ",", "CountryCode", "country", ")", "{", "return", "new", "GetArtistsTopTracksRequest", ".", "Builder", "(", "accessToken", ")", ".", "setDefaults", "(", "httpManager",...
Get the top tracks of an artist in a specific country. @param id The Spotify ID of the artist. @param country The ISO 3166-1 alpha-2 country code of the specific country. @return A {@link GetArtistsTopTracksRequest.Builder}. @see <a href="https://developer.spotify.com/web-api/user-guide/#spotify-uris-and-ids">Spotify: URLs &amp; IDs</a> @see <a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">Wikipedia: ISO 3166-1 alpha-2 country codes </a>
[ "Get", "the", "top", "tracks", "of", "an", "artist", "in", "a", "specific", "country", "." ]
train
https://github.com/thelinmichael/spotify-web-api-java/blob/c06b8512344c0310d0c1df362fa267879021da2e/src/main/java/com/wrapper/spotify/SpotifyApi.java#L495-L500
schallee/alib4j
jvm/src/main/java/net/darkmist/alib/jvm/JVMLauncher.java
JVMLauncher.getProcessBuilder
public static ProcessBuilder getProcessBuilder(String mainClass, List<URL> classPath, List<String> args) throws LauncherException { List<String> cmdList = new ArrayList<String>(); String[] cmdArray; cmdList.add(getJavaPath()); if(classPath != null && classPath.size() > 0) { cmdList.add("-cp"); cmdList.add(mkPath(classPath)); } cmdList.add(mainClass); if(args!=null && args.size()>0) cmdList.addAll(args); cmdArray = cmdList.toArray(new String[cmdList.size()]); if(logger.isDebugEnabled()) logger.debug("cmdArray=" + Arrays.toString(cmdArray)); return new ProcessBuilder(cmdArray); }
java
public static ProcessBuilder getProcessBuilder(String mainClass, List<URL> classPath, List<String> args) throws LauncherException { List<String> cmdList = new ArrayList<String>(); String[] cmdArray; cmdList.add(getJavaPath()); if(classPath != null && classPath.size() > 0) { cmdList.add("-cp"); cmdList.add(mkPath(classPath)); } cmdList.add(mainClass); if(args!=null && args.size()>0) cmdList.addAll(args); cmdArray = cmdList.toArray(new String[cmdList.size()]); if(logger.isDebugEnabled()) logger.debug("cmdArray=" + Arrays.toString(cmdArray)); return new ProcessBuilder(cmdArray); }
[ "public", "static", "ProcessBuilder", "getProcessBuilder", "(", "String", "mainClass", ",", "List", "<", "URL", ">", "classPath", ",", "List", "<", "String", ">", "args", ")", "throws", "LauncherException", "{", "List", "<", "String", ">", "cmdList", "=", "n...
Get a process loader for a JVM. @param mainClass Main class to run @param classPath List of urls to use for the new JVM's class path. @param args Additional command line parameters @return ProcessBuilder that has not been started.
[ "Get", "a", "process", "loader", "for", "a", "JVM", "." ]
train
https://github.com/schallee/alib4j/blob/0e0718aee574bbb62268e1cf58e99286529ce529/jvm/src/main/java/net/darkmist/alib/jvm/JVMLauncher.java#L220-L238
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/component/badge/BadgeRenderer.java
BadgeRenderer.encodeBegin
@Override public void encodeBegin(FacesContext context, UIComponent component) throws IOException { if (!component.isRendered()) { return; } Badge badge = (Badge) component; ResponseWriter rw = context.getResponseWriter(); String clientId = badge.getClientId(); if (!component.isRendered()) { return; } String styleClass = badge.getStyleClass(); String style=badge.getStyle(); String val = getValue2Render(context, badge); generateBadge(context, badge, rw, clientId, styleClass, style, val, null); }
java
@Override public void encodeBegin(FacesContext context, UIComponent component) throws IOException { if (!component.isRendered()) { return; } Badge badge = (Badge) component; ResponseWriter rw = context.getResponseWriter(); String clientId = badge.getClientId(); if (!component.isRendered()) { return; } String styleClass = badge.getStyleClass(); String style=badge.getStyle(); String val = getValue2Render(context, badge); generateBadge(context, badge, rw, clientId, styleClass, style, val, null); }
[ "@", "Override", "public", "void", "encodeBegin", "(", "FacesContext", "context", ",", "UIComponent", "component", ")", "throws", "IOException", "{", "if", "(", "!", "component", ".", "isRendered", "(", ")", ")", "{", "return", ";", "}", "Badge", "badge", ...
This methods generates the HTML code of the current b:badge. @param context the FacesContext. @param component the current b:badge. @throws IOException thrown if something goes wrong when writing the HTML code.
[ "This", "methods", "generates", "the", "HTML", "code", "of", "the", "current", "b", ":", "badge", "." ]
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/badge/BadgeRenderer.java#L47-L64
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/time/TimeSourceProvider.java
TimeSourceProvider.getInstance
public static TimeSource getInstance(String className) { try { Class<?> c = Class.forName(className); Method m = c.getMethod("getInstance"); return (TimeSource) m.invoke(null); } catch (Exception e) { throw new RuntimeException("Error getting TimeSource instance for class \"" + className + "\"", e); } }
java
public static TimeSource getInstance(String className) { try { Class<?> c = Class.forName(className); Method m = c.getMethod("getInstance"); return (TimeSource) m.invoke(null); } catch (Exception e) { throw new RuntimeException("Error getting TimeSource instance for class \"" + className + "\"", e); } }
[ "public", "static", "TimeSource", "getInstance", "(", "String", "className", ")", "{", "try", "{", "Class", "<", "?", ">", "c", "=", "Class", ".", "forName", "(", "className", ")", ";", "Method", "m", "=", "c", ".", "getMethod", "(", "\"getInstance\"", ...
Get a specific TimeSource by class name @param className Class name of the TimeSource to return the instance for @return TimeSource instance
[ "Get", "a", "specific", "TimeSource", "by", "class", "name" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/time/TimeSourceProvider.java#L63-L71
doanduyhai/Achilles
achilles-embedded/src/main/java/info/archinnov/achilles/embedded/CassandraEmbeddedServerBuilder.java
CassandraEmbeddedServerBuilder.withScriptTemplate
public CassandraEmbeddedServerBuilder withScriptTemplate(String scriptTemplateLocation, Map<String, Object> values) { Validator.validateNotBlank(scriptTemplateLocation, "The script template should not be blank while executing CassandraEmbeddedServerBuilder.withScriptTemplate()"); Validator.validateNotEmpty(values, "The template values should not be empty while executing CassandraEmbeddedServerBuilder.withScriptTemplate()"); scriptTemplates.put(scriptTemplateLocation.trim(), values); return this; }
java
public CassandraEmbeddedServerBuilder withScriptTemplate(String scriptTemplateLocation, Map<String, Object> values) { Validator.validateNotBlank(scriptTemplateLocation, "The script template should not be blank while executing CassandraEmbeddedServerBuilder.withScriptTemplate()"); Validator.validateNotEmpty(values, "The template values should not be empty while executing CassandraEmbeddedServerBuilder.withScriptTemplate()"); scriptTemplates.put(scriptTemplateLocation.trim(), values); return this; }
[ "public", "CassandraEmbeddedServerBuilder", "withScriptTemplate", "(", "String", "scriptTemplateLocation", ",", "Map", "<", "String", ",", "Object", ">", "values", ")", "{", "Validator", ".", "validateNotBlank", "(", "scriptTemplateLocation", ",", "\"The script template s...
Load an CQL script template in the class path, inject the values into the template to produce the final script and execute it upon initialization of the embedded Cassandra server <br/> Call this method as many times as there are CQL templates to be executed. <br/> Example: <br/> <pre class="code"><code class="java"> Map&lt;String, Object&gt; map1 = new HashMap&lt;&gt;(); map1.put("id", 100L); map1.put("date", new Date()); ... CassandraEmbeddedServerBuilder .withScriptTemplate("script1.cql", map1) .withScriptTemplate("script2.cql", map2) ... .build(); </code></pre> @param scriptTemplateLocation location of the CQL script in the <strong>class path</strong> @param values values to inject into the template. @return CassandraEmbeddedServerBuilder
[ "Load", "an", "CQL", "script", "template", "in", "the", "class", "path", "inject", "the", "values", "into", "the", "template", "to", "produce", "the", "final", "script", "and", "execute", "it", "upon", "initialization", "of", "the", "embedded", "Cassandra", ...
train
https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-embedded/src/main/java/info/archinnov/achilles/embedded/CassandraEmbeddedServerBuilder.java#L465-L470
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/KeyVaultClientImpl.java
KeyVaultClientImpl.deleteSecretAsync
public Observable<SecretBundle> deleteSecretAsync(String vaultBaseUrl, String secretName) { return deleteSecretWithServiceResponseAsync(vaultBaseUrl, secretName).map(new Func1<ServiceResponse<SecretBundle>, SecretBundle>() { @Override public SecretBundle call(ServiceResponse<SecretBundle> response) { return response.body(); } }); }
java
public Observable<SecretBundle> deleteSecretAsync(String vaultBaseUrl, String secretName) { return deleteSecretWithServiceResponseAsync(vaultBaseUrl, secretName).map(new Func1<ServiceResponse<SecretBundle>, SecretBundle>() { @Override public SecretBundle call(ServiceResponse<SecretBundle> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SecretBundle", ">", "deleteSecretAsync", "(", "String", "vaultBaseUrl", ",", "String", "secretName", ")", "{", "return", "deleteSecretWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "secretName", ")", ".", "map", "(", "new", "Func1...
Deletes a secret from a specified key vault. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param secretName The name of the secret. @return the observable to the SecretBundle object
[ "Deletes", "a", "secret", "from", "a", "specified", "key", "vault", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/KeyVaultClientImpl.java#L2617-L2624
UrielCh/ovh-java-sdk
ovh-java-sdk-freefax/src/main/java/net/minidev/ovh/api/ApiOvhFreefax.java
ApiOvhFreefax.serviceName_voicemail_PUT
public void serviceName_voicemail_PUT(String serviceName, OvhVoicemailProperties body) throws IOException { String qPath = "/freefax/{serviceName}/voicemail"; StringBuilder sb = path(qPath, serviceName); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_voicemail_PUT(String serviceName, OvhVoicemailProperties body) throws IOException { String qPath = "/freefax/{serviceName}/voicemail"; StringBuilder sb = path(qPath, serviceName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_voicemail_PUT", "(", "String", "serviceName", ",", "OvhVoicemailProperties", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/freefax/{serviceName}/voicemail\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ...
Alter this object properties REST: PUT /freefax/{serviceName}/voicemail @param body [required] New object properties @param serviceName [required] Freefax number
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-freefax/src/main/java/net/minidev/ovh/api/ApiOvhFreefax.java#L98-L102
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/RandomCompat.java
RandomCompat.longs
@NotNull public LongStream longs(final long randomNumberOrigin, final long randomNumberBound) { if (randomNumberOrigin >= randomNumberBound) { throw new IllegalArgumentException(); } return LongStream.generate(new LongSupplier() { private final long bound = randomNumberBound - randomNumberOrigin; private final long boundMinus1 = bound - 1; @Override public long getAsLong() { long result = random.nextLong(); if ((bound & boundMinus1) == 0L) { // power of two result = (result & boundMinus1) + randomNumberOrigin; } else if (bound > 0L) { // reject over-represented candidates long u = result >>> 1; // ensure nonnegative while (u + boundMinus1 - (result = u % bound) < 0L) { u = random.nextLong() >>> 1; } result += randomNumberOrigin; } else { // range not representable as long while (randomNumberOrigin >= result || result >= randomNumberBound) { result = random.nextLong(); } } return result; } }); }
java
@NotNull public LongStream longs(final long randomNumberOrigin, final long randomNumberBound) { if (randomNumberOrigin >= randomNumberBound) { throw new IllegalArgumentException(); } return LongStream.generate(new LongSupplier() { private final long bound = randomNumberBound - randomNumberOrigin; private final long boundMinus1 = bound - 1; @Override public long getAsLong() { long result = random.nextLong(); if ((bound & boundMinus1) == 0L) { // power of two result = (result & boundMinus1) + randomNumberOrigin; } else if (bound > 0L) { // reject over-represented candidates long u = result >>> 1; // ensure nonnegative while (u + boundMinus1 - (result = u % bound) < 0L) { u = random.nextLong() >>> 1; } result += randomNumberOrigin; } else { // range not representable as long while (randomNumberOrigin >= result || result >= randomNumberBound) { result = random.nextLong(); } } return result; } }); }
[ "@", "NotNull", "public", "LongStream", "longs", "(", "final", "long", "randomNumberOrigin", ",", "final", "long", "randomNumberBound", ")", "{", "if", "(", "randomNumberOrigin", ">=", "randomNumberBound", ")", "{", "throw", "new", "IllegalArgumentException", "(", ...
Returns an effectively unlimited stream of pseudorandom {@code long} values, each conforming to the given origin (inclusive) and bound (exclusive) @param randomNumberOrigin the origin (inclusive) of each random value @param randomNumberBound the bound (exclusive) of each random value @return a stream of pseudorandom {@code long} values, each with the given origin (inclusive) and bound (exclusive) @throws IllegalArgumentException if {@code randomNumberOrigin} is greater than or equal to {@code randomNumberBound}
[ "Returns", "an", "effectively", "unlimited", "stream", "of", "pseudorandom", "{", "@code", "long", "}", "values", "each", "conforming", "to", "the", "given", "origin", "(", "inclusive", ")", "and", "bound", "(", "exclusive", ")" ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/RandomCompat.java#L293-L325
googleapis/google-cloud-java
google-cloud-examples/src/main/java/com/google/cloud/examples/translate/snippets/TranslateSnippetsBeta.java
TranslateSnippetsBeta.translateText
static TranslateTextResponse translateText( String projectId, String location, String text, String sourceLanguageCode, String targetLanguageCode) { try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) { LocationName locationName = LocationName.newBuilder().setProject(projectId).setLocation(location).build(); TranslateTextRequest translateTextRequest = TranslateTextRequest.newBuilder() .setParent(locationName.toString()) .setMimeType("text/plain") .setSourceLanguageCode(sourceLanguageCode) .setTargetLanguageCode(targetLanguageCode) .addContents(text) .build(); // Call the API TranslateTextResponse response = translationServiceClient.translateText(translateTextRequest); System.out.format( "Translated Text: %s", response.getTranslationsList().get(0).getTranslatedText()); return response; } catch (Exception e) { throw new RuntimeException("Couldn't create client.", e); } }
java
static TranslateTextResponse translateText( String projectId, String location, String text, String sourceLanguageCode, String targetLanguageCode) { try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) { LocationName locationName = LocationName.newBuilder().setProject(projectId).setLocation(location).build(); TranslateTextRequest translateTextRequest = TranslateTextRequest.newBuilder() .setParent(locationName.toString()) .setMimeType("text/plain") .setSourceLanguageCode(sourceLanguageCode) .setTargetLanguageCode(targetLanguageCode) .addContents(text) .build(); // Call the API TranslateTextResponse response = translationServiceClient.translateText(translateTextRequest); System.out.format( "Translated Text: %s", response.getTranslationsList().get(0).getTranslatedText()); return response; } catch (Exception e) { throw new RuntimeException("Couldn't create client.", e); } }
[ "static", "TranslateTextResponse", "translateText", "(", "String", "projectId", ",", "String", "location", ",", "String", "text", ",", "String", "sourceLanguageCode", ",", "String", "targetLanguageCode", ")", "{", "try", "(", "TranslationServiceClient", "translationServ...
Translates a given text to a target language. @param projectId - Id of the project. @param location - location name. @param text - Text for translation. @param sourceLanguageCode - Language code of text. e.g. "en" @param targetLanguageCode - Language code for translation. e.g. "sr"
[ "Translates", "a", "given", "text", "to", "a", "target", "language", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/translate/snippets/TranslateSnippetsBeta.java#L169-L198
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java
NetworkWatchersInner.setFlowLogConfigurationAsync
public Observable<FlowLogInformationInner> setFlowLogConfigurationAsync(String resourceGroupName, String networkWatcherName, FlowLogInformationInner parameters) { return setFlowLogConfigurationWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<FlowLogInformationInner>, FlowLogInformationInner>() { @Override public FlowLogInformationInner call(ServiceResponse<FlowLogInformationInner> response) { return response.body(); } }); }
java
public Observable<FlowLogInformationInner> setFlowLogConfigurationAsync(String resourceGroupName, String networkWatcherName, FlowLogInformationInner parameters) { return setFlowLogConfigurationWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<FlowLogInformationInner>, FlowLogInformationInner>() { @Override public FlowLogInformationInner call(ServiceResponse<FlowLogInformationInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "FlowLogInformationInner", ">", "setFlowLogConfigurationAsync", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "FlowLogInformationInner", "parameters", ")", "{", "return", "setFlowLogConfigurationWithServiceResponseAsync...
Configures flow log on a specified resource. @param resourceGroupName The name of the network watcher resource group. @param networkWatcherName The name of the network watcher resource. @param parameters Parameters that define the configuration of flow log. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Configures", "flow", "log", "on", "a", "specified", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L1829-L1836
inaiat/jqplot4java
src/main/java/br/com/digilabs/jqplot/chart/BubbleChart.java
BubbleChart.addValue
public void addValue(Float x, Float y, Float radius, String label) { bubbleData.addValue(new BubbleItem(x, y, radius, label)); }
java
public void addValue(Float x, Float y, Float radius, String label) { bubbleData.addValue(new BubbleItem(x, y, radius, label)); }
[ "public", "void", "addValue", "(", "Float", "x", ",", "Float", "y", ",", "Float", "radius", ",", "String", "label", ")", "{", "bubbleData", ".", "addValue", "(", "new", "BubbleItem", "(", "x", ",", "y", ",", "radius", ",", "label", ")", ")", ";", "...
Add a value @param x x @param y y @param radius radius @param label label
[ "Add", "a", "value" ]
train
https://github.com/inaiat/jqplot4java/blob/35bcd17749442e88695df0438c8330a65a3977cc/src/main/java/br/com/digilabs/jqplot/chart/BubbleChart.java#L84-L86
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/ByteArrayUtil.java
ByteArrayUtil.getBytesIntValue
public static int getBytesIntValue(byte[] bytes, int offset, int length) { assert length <= 4 && length > 0; assert bytes != null && bytes.length >= length + offset; byte[] value = Arrays.copyOfRange(bytes, offset, offset + length); return bytesToInt(value); }
java
public static int getBytesIntValue(byte[] bytes, int offset, int length) { assert length <= 4 && length > 0; assert bytes != null && bytes.length >= length + offset; byte[] value = Arrays.copyOfRange(bytes, offset, offset + length); return bytesToInt(value); }
[ "public", "static", "int", "getBytesIntValue", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ",", "int", "length", ")", "{", "assert", "length", "<=", "4", "&&", "length", ">", "0", ";", "assert", "bytes", "!=", "null", "&&", "bytes", ".", "l...
Retrieves the integer value of a subarray of bytes. The values are considered little endian. The subarray is determined by offset and length. <p> Presumes the bytes to be not null and the length must be between 1 and 4 inclusive. The length of bytes must be larger than or equal to length + offset. @param bytes the little endian byte array that shall be converted to int @param offset the index to start reading the integer value from @param length the number of bytes used to convert to int @return int value
[ "Retrieves", "the", "integer", "value", "of", "a", "subarray", "of", "bytes", ".", "The", "values", "are", "considered", "little", "endian", ".", "The", "subarray", "is", "determined", "by", "offset", "and", "length", ".", "<p", ">", "Presumes", "the", "by...
train
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/ByteArrayUtil.java#L75-L80
line/armeria
core/src/main/java/com/linecorp/armeria/client/ClientDecorationBuilder.java
ClientDecorationBuilder.addRpc
public <T extends Client<I, O>, R extends Client<I, O>, I extends RpcRequest, O extends RpcResponse> ClientDecorationBuilder addRpc(Function<T, R> decorator) { @SuppressWarnings("unchecked") final Function<Client<RpcRequest, RpcResponse>, Client<RpcRequest, RpcResponse>> cast = (Function<Client<RpcRequest, RpcResponse>, Client<RpcRequest, RpcResponse>>) decorator; return add0(RpcRequest.class, RpcResponse.class, cast); }
java
public <T extends Client<I, O>, R extends Client<I, O>, I extends RpcRequest, O extends RpcResponse> ClientDecorationBuilder addRpc(Function<T, R> decorator) { @SuppressWarnings("unchecked") final Function<Client<RpcRequest, RpcResponse>, Client<RpcRequest, RpcResponse>> cast = (Function<Client<RpcRequest, RpcResponse>, Client<RpcRequest, RpcResponse>>) decorator; return add0(RpcRequest.class, RpcResponse.class, cast); }
[ "public", "<", "T", "extends", "Client", "<", "I", ",", "O", ">", ",", "R", "extends", "Client", "<", "I", ",", "O", ">", ",", "I", "extends", "RpcRequest", ",", "O", "extends", "RpcResponse", ">", "ClientDecorationBuilder", "addRpc", "(", "Function", ...
Adds the specified RPC-level {@code decorator}. @param decorator the {@link Function} that transforms a {@link Client} to another @param <T> the type of the {@link Client} being decorated @param <R> the type of the {@link Client} produced by the {@code decorator} @param <I> the {@link Request} type of the {@link Client} being decorated @param <O> the {@link Response} type of the {@link Client} being decorated
[ "Adds", "the", "specified", "RPC", "-", "level", "{", "@code", "decorator", "}", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/ClientDecorationBuilder.java#L117-L123
groupon/monsoon
impl/src/main/java/com/groupon/lex/metrics/misc/MonitorMonitor.java
MonitorMonitor.get_metrics_
private Map<MetricName, MetricValue> get_metrics_(DateTime now, Context ctx) { final Consumer<Alert> alert_manager = ctx.getAlertManager(); final long failed_collections = registry_.getFailedCollections(); final boolean has_config = registry_.hasConfig(); final Optional<Duration> scrape_duration = registry_.getScrapeDuration(); final Optional<Duration> rule_eval_duration = registry_.getRuleEvalDuration(); final Optional<Duration> processor_duration = registry_.getProcessorDuration(); first_scrape_ts_.compareAndSet(null, now); // First time, register the timestamp. final Duration uptime = new Duration(first_scrape_ts_.get(), now); final Optional<DateTime> last_scrape = last_scrape_; last_scrape_ = Optional.of(now); final long metric_count = ctx.getTSData().getCurrentCollection().getTSValues().stream() .map(TimeSeriesValue::getMetrics) .collect(Collectors.summingLong(Map::size)); alert_manager.accept(new Alert(now, MONITOR_FAIL_ALERT, () -> "builtin rule", Optional.of(failed_collections != 0), MON_ALERT_DURATION, "builtin rule: some collectors failed", EMPTY_MAP)); alert_manager.accept(new Alert(now, HAS_CONFIG_ALERT, () -> "builtin rule", Optional.of(!has_config), Duration.ZERO, "builtin rule: monitor has no configuration file", EMPTY_MAP)); Map<MetricName, MetricValue> result = new HashMap<>(); result.put(FAILED_COLLECTIONS_METRIC, MetricValue.fromIntValue(failed_collections)); result.put(GROUP_COUNT_METRIC, MetricValue.fromIntValue(ctx.getTSData().getCurrentCollection().getGroups(x -> true).size())); result.put(METRIC_COUNT_METRIC, MetricValue.fromIntValue(metric_count)); result.put(CONFIG_PRESENT_METRIC, MetricValue.fromBoolean(has_config)); result.put(SCRAPE_DURATION, opt_duration_to_metricvalue_(scrape_duration)); result.put(RULE_EVAL_DURATION, opt_duration_to_metricvalue_(rule_eval_duration)); result.put(PROCESSOR_DURATION, opt_duration_to_metricvalue_(processor_duration)); result.put(UPTIME_DURATION, duration_to_metricvalue_(uptime)); result.put(SCRAPE_COUNT, MetricValue.fromIntValue(++scrape_count_)); result.put(SCRAPE_INTERVAL, opt_duration_to_metricvalue_(last_scrape.map(prev -> new Duration(prev, now)))); result.put(SCRAPE_TS, MetricValue.fromIntValue(now.getMillis())); return result; }
java
private Map<MetricName, MetricValue> get_metrics_(DateTime now, Context ctx) { final Consumer<Alert> alert_manager = ctx.getAlertManager(); final long failed_collections = registry_.getFailedCollections(); final boolean has_config = registry_.hasConfig(); final Optional<Duration> scrape_duration = registry_.getScrapeDuration(); final Optional<Duration> rule_eval_duration = registry_.getRuleEvalDuration(); final Optional<Duration> processor_duration = registry_.getProcessorDuration(); first_scrape_ts_.compareAndSet(null, now); // First time, register the timestamp. final Duration uptime = new Duration(first_scrape_ts_.get(), now); final Optional<DateTime> last_scrape = last_scrape_; last_scrape_ = Optional.of(now); final long metric_count = ctx.getTSData().getCurrentCollection().getTSValues().stream() .map(TimeSeriesValue::getMetrics) .collect(Collectors.summingLong(Map::size)); alert_manager.accept(new Alert(now, MONITOR_FAIL_ALERT, () -> "builtin rule", Optional.of(failed_collections != 0), MON_ALERT_DURATION, "builtin rule: some collectors failed", EMPTY_MAP)); alert_manager.accept(new Alert(now, HAS_CONFIG_ALERT, () -> "builtin rule", Optional.of(!has_config), Duration.ZERO, "builtin rule: monitor has no configuration file", EMPTY_MAP)); Map<MetricName, MetricValue> result = new HashMap<>(); result.put(FAILED_COLLECTIONS_METRIC, MetricValue.fromIntValue(failed_collections)); result.put(GROUP_COUNT_METRIC, MetricValue.fromIntValue(ctx.getTSData().getCurrentCollection().getGroups(x -> true).size())); result.put(METRIC_COUNT_METRIC, MetricValue.fromIntValue(metric_count)); result.put(CONFIG_PRESENT_METRIC, MetricValue.fromBoolean(has_config)); result.put(SCRAPE_DURATION, opt_duration_to_metricvalue_(scrape_duration)); result.put(RULE_EVAL_DURATION, opt_duration_to_metricvalue_(rule_eval_duration)); result.put(PROCESSOR_DURATION, opt_duration_to_metricvalue_(processor_duration)); result.put(UPTIME_DURATION, duration_to_metricvalue_(uptime)); result.put(SCRAPE_COUNT, MetricValue.fromIntValue(++scrape_count_)); result.put(SCRAPE_INTERVAL, opt_duration_to_metricvalue_(last_scrape.map(prev -> new Duration(prev, now)))); result.put(SCRAPE_TS, MetricValue.fromIntValue(now.getMillis())); return result; }
[ "private", "Map", "<", "MetricName", ",", "MetricValue", ">", "get_metrics_", "(", "DateTime", "now", ",", "Context", "ctx", ")", "{", "final", "Consumer", "<", "Alert", ">", "alert_manager", "=", "ctx", ".", "getAlertManager", "(", ")", ";", "final", "lon...
Get metrics for the monitor. @return All metrics for the monitor.
[ "Get", "metrics", "for", "the", "monitor", "." ]
train
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/impl/src/main/java/com/groupon/lex/metrics/misc/MonitorMonitor.java#L96-L129
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java
GeneratedDConnectionDaoImpl.queryByUpdatedDate
public Iterable<DConnection> queryByUpdatedDate(java.util.Date updatedDate) { return queryByField(null, DConnectionMapper.Field.UPDATEDDATE.getFieldName(), updatedDate); }
java
public Iterable<DConnection> queryByUpdatedDate(java.util.Date updatedDate) { return queryByField(null, DConnectionMapper.Field.UPDATEDDATE.getFieldName(), updatedDate); }
[ "public", "Iterable", "<", "DConnection", ">", "queryByUpdatedDate", "(", "java", ".", "util", ".", "Date", "updatedDate", ")", "{", "return", "queryByField", "(", "null", ",", "DConnectionMapper", ".", "Field", ".", "UPDATEDDATE", ".", "getFieldName", "(", ")...
query-by method for field updatedDate @param updatedDate the specified attribute @return an Iterable of DConnections for the specified updatedDate
[ "query", "-", "by", "method", "for", "field", "updatedDate" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L160-L162
enioka/jqm
jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/GlobalParameter.java
GlobalParameter.getParameter
public static String getParameter(DbConn cnx, String key, String defaultValue) { try { return cnx.runSelectSingle("globalprm_select_by_key", 3, String.class, key); } catch (NoResultException e) { return defaultValue; } }
java
public static String getParameter(DbConn cnx, String key, String defaultValue) { try { return cnx.runSelectSingle("globalprm_select_by_key", 3, String.class, key); } catch (NoResultException e) { return defaultValue; } }
[ "public", "static", "String", "getParameter", "(", "DbConn", "cnx", ",", "String", "key", ",", "String", "defaultValue", ")", "{", "try", "{", "return", "cnx", ".", "runSelectSingle", "(", "\"globalprm_select_by_key\"", ",", "3", ",", "String", ".", "class", ...
Retrieve the value of a single-valued parameter. @param key @param defaultValue @param cnx
[ "Retrieve", "the", "value", "of", "a", "single", "-", "valued", "parameter", "." ]
train
https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/GlobalParameter.java#L154-L164
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java
DerInputStream.getEnumerated
public int getEnumerated() throws IOException { if (buffer.read() != DerValue.tag_Enumerated) { throw new IOException("DER input, Enumerated tag error"); } return buffer.getInteger(getLength(buffer)); }
java
public int getEnumerated() throws IOException { if (buffer.read() != DerValue.tag_Enumerated) { throw new IOException("DER input, Enumerated tag error"); } return buffer.getInteger(getLength(buffer)); }
[ "public", "int", "getEnumerated", "(", ")", "throws", "IOException", "{", "if", "(", "buffer", ".", "read", "(", ")", "!=", "DerValue", ".", "tag_Enumerated", ")", "{", "throw", "new", "IOException", "(", "\"DER input, Enumerated tag error\"", ")", ";", "}", ...
Get an enumerated from the input stream. @return the integer held in this DER input stream.
[ "Get", "an", "enumerated", "from", "the", "input", "stream", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java#L204-L209
h2oai/h2o-3
h2o-core/src/main/java/water/TaskGetKey.java
TaskGetKey.onAck
@Override public void onAck() { if( _val != null ) { // Set transient fields after deserializing assert !_xkey.home() && _val._key == null; _val._key = _xkey; } // Now update the local store, caching the result. // We only started down the TGK path because we missed locally, so we only // expect to find a NULL in the local store. If somebody else installed // another value (e.g. a racing TGK, or racing local Put) this value must // be more recent than our NULL - but is UNORDERED relative to the Value // returned from the Home. We'll take the local Value to preserve ordering // and rely on invalidates from Home to force refreshes as needed. // Hence we can do a blind putIfMatch here over a null or empty Value // If it fails, what is there is also the TGK result. Value old = H2O.STORE.get(_xkey); if( old != null && !old.isEmpty() ) old=null; Value res = H2O.putIfMatch(_xkey,_val,old); if( res != old ) _val = res; TGKS.remove(_xkey); // Clear from dup cache }
java
@Override public void onAck() { if( _val != null ) { // Set transient fields after deserializing assert !_xkey.home() && _val._key == null; _val._key = _xkey; } // Now update the local store, caching the result. // We only started down the TGK path because we missed locally, so we only // expect to find a NULL in the local store. If somebody else installed // another value (e.g. a racing TGK, or racing local Put) this value must // be more recent than our NULL - but is UNORDERED relative to the Value // returned from the Home. We'll take the local Value to preserve ordering // and rely on invalidates from Home to force refreshes as needed. // Hence we can do a blind putIfMatch here over a null or empty Value // If it fails, what is there is also the TGK result. Value old = H2O.STORE.get(_xkey); if( old != null && !old.isEmpty() ) old=null; Value res = H2O.putIfMatch(_xkey,_val,old); if( res != old ) _val = res; TGKS.remove(_xkey); // Clear from dup cache }
[ "@", "Override", "public", "void", "onAck", "(", ")", "{", "if", "(", "_val", "!=", "null", ")", "{", "// Set transient fields after deserializing", "assert", "!", "_xkey", ".", "home", "(", ")", "&&", "_val", ".", "_key", "==", "null", ";", "_val", ".",...
Received an ACK; executes on the node asking&receiving the Value
[ "Received", "an", "ACK", ";", "executes", "on", "the", "node", "asking&receiving", "the", "Value" ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/TaskGetKey.java#L60-L81
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbAuthentication.java
TmdbAuthentication.getSessionToken
public TokenSession getSessionToken(TokenAuthorisation token) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); if (!token.getSuccess()) { throw new MovieDbException(ApiExceptionType.AUTH_FAILURE, "Authorisation token was not successful!"); } parameters.add(Param.TOKEN, token.getRequestToken()); URL url = new ApiUrl(apiKey, MethodBase.AUTH).subMethod(MethodSub.SESSION_NEW).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, TokenSession.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get Session Token", url, ex); } }
java
public TokenSession getSessionToken(TokenAuthorisation token) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); if (!token.getSuccess()) { throw new MovieDbException(ApiExceptionType.AUTH_FAILURE, "Authorisation token was not successful!"); } parameters.add(Param.TOKEN, token.getRequestToken()); URL url = new ApiUrl(apiKey, MethodBase.AUTH).subMethod(MethodSub.SESSION_NEW).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, TokenSession.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get Session Token", url, ex); } }
[ "public", "TokenSession", "getSessionToken", "(", "TokenAuthorisation", "token", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "if", "(", "!", "token", ".", "getSuccess", "(", ")", ")", "{", ...
This method is used to generate a session id for user based authentication. A session id is required in order to use any of the write methods. @param token @return @throws MovieDbException
[ "This", "method", "is", "used", "to", "generate", "a", "session", "id", "for", "user", "based", "authentication", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbAuthentication.java#L90-L106
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_vxml_serviceName_settings_PUT
public void billingAccount_vxml_serviceName_settings_PUT(String billingAccount, String serviceName, OvhVxmlProperties body) throws IOException { String qPath = "/telephony/{billingAccount}/vxml/{serviceName}/settings"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
java
public void billingAccount_vxml_serviceName_settings_PUT(String billingAccount, String serviceName, OvhVxmlProperties body) throws IOException { String qPath = "/telephony/{billingAccount}/vxml/{serviceName}/settings"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "billingAccount_vxml_serviceName_settings_PUT", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "OvhVxmlProperties", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/vxml/{serviceName}/settin...
Alter this object properties REST: PUT /telephony/{billingAccount}/vxml/{serviceName}/settings @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L5105-L5109
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java
ApiOvhHostingweb.serviceName_attachedDomain_domain_PUT
public void serviceName_attachedDomain_domain_PUT(String serviceName, String domain, OvhAttachedDomain body) throws IOException { String qPath = "/hosting/web/{serviceName}/attachedDomain/{domain}"; StringBuilder sb = path(qPath, serviceName, domain); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_attachedDomain_domain_PUT(String serviceName, String domain, OvhAttachedDomain body) throws IOException { String qPath = "/hosting/web/{serviceName}/attachedDomain/{domain}"; StringBuilder sb = path(qPath, serviceName, domain); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_attachedDomain_domain_PUT", "(", "String", "serviceName", ",", "String", "domain", ",", "OvhAttachedDomain", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/hosting/web/{serviceName}/attachedDomain/{domain}\"", ";", "Str...
Alter this object properties REST: PUT /hosting/web/{serviceName}/attachedDomain/{domain} @param body [required] New object properties @param serviceName [required] The internal name of your hosting @param domain [required] Domain linked (fqdn)
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L1963-L1967
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/ReComputeFieldHandler.java
ReComputeFieldHandler.fieldChanged
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { double srcValue = ((NumberField)this.getOwner()).getValue(); BaseField fldTarget = this.getFieldTarget(); if (this.getOwner().isNull()) // If null, set the target to null return fldTarget.moveFieldToThis(this.getOwner(), bDisplayOption, iMoveMode); // zero out the field boolean[] rgbListeners = null; if (m_bDisableTarget) rgbListeners = fldTarget.setEnableListeners(false); int iErrorCode = fldTarget.setValue(this.computeValue(srcValue), bDisplayOption, iMoveMode); if (m_bDisableTarget) fldTarget.setEnableListeners(rgbListeners); return iErrorCode; }
java
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { double srcValue = ((NumberField)this.getOwner()).getValue(); BaseField fldTarget = this.getFieldTarget(); if (this.getOwner().isNull()) // If null, set the target to null return fldTarget.moveFieldToThis(this.getOwner(), bDisplayOption, iMoveMode); // zero out the field boolean[] rgbListeners = null; if (m_bDisableTarget) rgbListeners = fldTarget.setEnableListeners(false); int iErrorCode = fldTarget.setValue(this.computeValue(srcValue), bDisplayOption, iMoveMode); if (m_bDisableTarget) fldTarget.setEnableListeners(rgbListeners); return iErrorCode; }
[ "public", "int", "fieldChanged", "(", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "double", "srcValue", "=", "(", "(", "NumberField", ")", "this", ".", "getOwner", "(", ")", ")", ".", "getValue", "(", ")", ";", "BaseField", "fldTarget",...
The Field has Changed. Get the value of this listener's owner, pass it to the computeValue method and set the returned value to the target field. @param bDisplayOption If true, display the change. @param iMoveMode The type of move being done (init/read/screen). @return The error code (or NORMAL_RETURN if okay). Field changed, re-compute the value in this field.
[ "The", "Field", "has", "Changed", ".", "Get", "the", "value", "of", "this", "listener", "s", "owner", "pass", "it", "to", "the", "computeValue", "method", "and", "set", "the", "returned", "value", "to", "the", "target", "field", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/ReComputeFieldHandler.java#L129-L142
brianwhu/xillium
data/src/main/java/org/xillium/data/persistence/ParametricStatement.java
ParametricStatement.executeUpdate
public int executeUpdate(Connection conn, DataObject[] objects) throws SQLException { PreparedStatement statement = conn.prepareStatement(_sql); try { for (DataObject object: objects) { load(statement, object); statement.addBatch(); } int count = getAffectedRowCount(statement.executeBatch()); return count; } finally { statement.close(); } }
java
public int executeUpdate(Connection conn, DataObject[] objects) throws SQLException { PreparedStatement statement = conn.prepareStatement(_sql); try { for (DataObject object: objects) { load(statement, object); statement.addBatch(); } int count = getAffectedRowCount(statement.executeBatch()); return count; } finally { statement.close(); } }
[ "public", "int", "executeUpdate", "(", "Connection", "conn", ",", "DataObject", "[", "]", "objects", ")", "throws", "SQLException", "{", "PreparedStatement", "statement", "=", "conn", ".", "prepareStatement", "(", "_sql", ")", ";", "try", "{", "for", "(", "D...
Executes a batch UPDATE or DELETE statement. @return the number of rows affected
[ "Executes", "a", "batch", "UPDATE", "or", "DELETE", "statement", "." ]
train
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/data/src/main/java/org/xillium/data/persistence/ParametricStatement.java#L286-L298
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/DoubleIntIndex.java
DoubleIntIndex.addUnique
public synchronized boolean addUnique(int key, int value) { if (count == capacity) { if (fixedSize) { return false; } else { doubleCapacity(); } } if (!sorted) { fastQuickSort(); } targetSearchValue = sortOnValues ? value : key; int i = binaryEmptySlotSearch(); if (i == -1) { return false; } hasChanged = true; if (count != i) { moveRows(i, i + 1, count - i); } keys[i] = key; values[i] = value; count++; return true; }
java
public synchronized boolean addUnique(int key, int value) { if (count == capacity) { if (fixedSize) { return false; } else { doubleCapacity(); } } if (!sorted) { fastQuickSort(); } targetSearchValue = sortOnValues ? value : key; int i = binaryEmptySlotSearch(); if (i == -1) { return false; } hasChanged = true; if (count != i) { moveRows(i, i + 1, count - i); } keys[i] = key; values[i] = value; count++; return true; }
[ "public", "synchronized", "boolean", "addUnique", "(", "int", "key", ",", "int", "value", ")", "{", "if", "(", "count", "==", "capacity", ")", "{", "if", "(", "fixedSize", ")", "{", "return", "false", ";", "}", "else", "{", "doubleCapacity", "(", ")", ...
Adds a pair, ensuring no duplicate key xor value already exists in the current search target column. @param key the key @param value the value @return true or false depending on success
[ "Adds", "a", "pair", "ensuring", "no", "duplicate", "key", "xor", "value", "already", "exists", "in", "the", "current", "search", "target", "column", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/DoubleIntIndex.java#L215-L250
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java
BugInstance.addMethod
@Nonnull public BugInstance addMethod(JavaClass javaClass, Method method) { MethodAnnotation methodAnnotation = new MethodAnnotation(javaClass.getClassName(), method.getName(), method.getSignature(), method.isStatic()); SourceLineAnnotation methodSourceLines = SourceLineAnnotation.forEntireMethod(javaClass, method); methodAnnotation.setSourceLines(methodSourceLines); addMethod(methodAnnotation); return this; }
java
@Nonnull public BugInstance addMethod(JavaClass javaClass, Method method) { MethodAnnotation methodAnnotation = new MethodAnnotation(javaClass.getClassName(), method.getName(), method.getSignature(), method.isStatic()); SourceLineAnnotation methodSourceLines = SourceLineAnnotation.forEntireMethod(javaClass, method); methodAnnotation.setSourceLines(methodSourceLines); addMethod(methodAnnotation); return this; }
[ "@", "Nonnull", "public", "BugInstance", "addMethod", "(", "JavaClass", "javaClass", ",", "Method", "method", ")", "{", "MethodAnnotation", "methodAnnotation", "=", "new", "MethodAnnotation", "(", "javaClass", ".", "getClassName", "(", ")", ",", "method", ".", "...
Add a method annotation. If this is the first method annotation added, it becomes the primary method annotation. If the method has source line information, then a SourceLineAnnotation is added to the method. @param javaClass the class the method is defined in @param method the method @return this object
[ "Add", "a", "method", "annotation", ".", "If", "this", "is", "the", "first", "method", "annotation", "added", "it", "becomes", "the", "primary", "method", "annotation", ".", "If", "the", "method", "has", "source", "line", "information", "then", "a", "SourceL...
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java#L1363-L1371
Polidea/RxAndroidBle
rxandroidble/src/main/java/com/polidea/rxandroidble2/helpers/ValueInterpreter.java
ValueInterpreter.getIntValue
public static Integer getIntValue(@NonNull byte[] value, @IntFormatType int formatType, @IntRange(from = 0) int offset) { if ((offset + getTypeLen(formatType)) > value.length) { RxBleLog.w( "Int formatType (0x%x) is longer than remaining bytes (%d) - returning null", formatType, value.length - offset ); return null; } switch (formatType) { case FORMAT_UINT8: return unsignedByteToInt(value[offset]); case FORMAT_UINT16: return unsignedBytesToInt(value[offset], value[offset + 1]); case FORMAT_UINT32: return unsignedBytesToInt(value[offset], value[offset + 1], value[offset + 2], value[offset + 3]); case FORMAT_SINT8: return unsignedToSigned(unsignedByteToInt(value[offset]), 8); case FORMAT_SINT16: return unsignedToSigned(unsignedBytesToInt(value[offset], value[offset + 1]), 16); case FORMAT_SINT32: return unsignedToSigned(unsignedBytesToInt(value[offset], value[offset + 1], value[offset + 2], value[offset + 3]), 32); default: RxBleLog.w("Passed an invalid integer formatType (0x%x) - returning null", formatType); return null; } }
java
public static Integer getIntValue(@NonNull byte[] value, @IntFormatType int formatType, @IntRange(from = 0) int offset) { if ((offset + getTypeLen(formatType)) > value.length) { RxBleLog.w( "Int formatType (0x%x) is longer than remaining bytes (%d) - returning null", formatType, value.length - offset ); return null; } switch (formatType) { case FORMAT_UINT8: return unsignedByteToInt(value[offset]); case FORMAT_UINT16: return unsignedBytesToInt(value[offset], value[offset + 1]); case FORMAT_UINT32: return unsignedBytesToInt(value[offset], value[offset + 1], value[offset + 2], value[offset + 3]); case FORMAT_SINT8: return unsignedToSigned(unsignedByteToInt(value[offset]), 8); case FORMAT_SINT16: return unsignedToSigned(unsignedBytesToInt(value[offset], value[offset + 1]), 16); case FORMAT_SINT32: return unsignedToSigned(unsignedBytesToInt(value[offset], value[offset + 1], value[offset + 2], value[offset + 3]), 32); default: RxBleLog.w("Passed an invalid integer formatType (0x%x) - returning null", formatType); return null; } }
[ "public", "static", "Integer", "getIntValue", "(", "@", "NonNull", "byte", "[", "]", "value", ",", "@", "IntFormatType", "int", "formatType", ",", "@", "IntRange", "(", "from", "=", "0", ")", "int", "offset", ")", "{", "if", "(", "(", "offset", "+", ...
Return the integer value interpreted from the passed byte array. <p>The formatType parameter determines how the value is to be interpreted. For example, setting formatType to {@link #FORMAT_UINT16} specifies that the first two bytes of the characteristic value at the given offset are interpreted to generate the return value. @param value The byte array from which to interpret value. @param formatType The format type used to interpret the value. @param offset Offset at which the integer value can be found. @return The value at a given offset or null if offset exceeds value size.
[ "Return", "the", "integer", "value", "interpreted", "from", "the", "passed", "byte", "array", "." ]
train
https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/rxandroidble/src/main/java/com/polidea/rxandroidble2/helpers/ValueInterpreter.java#L94-L126
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/lock/ClientLockManager.java
ClientLockManager.getLockSessionInfo
public SessionInfo getLockSessionInfo(Task objSession, String strUserName) { if (objSession == null) { Utility.getLogger().warning("null session"); return new SessionInfo(0, strUserName); // } SessionInfo intSession = (SessionInfo)m_hmLockSessions.get(objSession); if (intSession == null) m_hmLockSessions.put(objSession, intSession = new SessionInfo(m_iNextLockSession++, strUserName)); return intSession; }
java
public SessionInfo getLockSessionInfo(Task objSession, String strUserName) { if (objSession == null) { Utility.getLogger().warning("null session"); return new SessionInfo(0, strUserName); // } SessionInfo intSession = (SessionInfo)m_hmLockSessions.get(objSession); if (intSession == null) m_hmLockSessions.put(objSession, intSession = new SessionInfo(m_iNextLockSession++, strUserName)); return intSession; }
[ "public", "SessionInfo", "getLockSessionInfo", "(", "Task", "objSession", ",", "String", "strUserName", ")", "{", "if", "(", "objSession", "==", "null", ")", "{", "Utility", ".", "getLogger", "(", ")", ".", "warning", "(", "\"null session\"", ")", ";", "retu...
Lookup the information for this session (or create new sessioninfo). @param objSession The unique object identifying this session (Typically the Task). @param strUser The (optional) user name. @return The new or looked up session information.
[ "Lookup", "the", "information", "for", "this", "session", "(", "or", "create", "new", "sessioninfo", ")", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/lock/ClientLockManager.java#L164-L175
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/AbstractReplicator.java
AbstractReplicator.addDocumentReplicationListener
@NonNull public ListenerToken addDocumentReplicationListener(@NonNull DocumentReplicationListener listener) { if (listener == null) { throw new IllegalArgumentException("listener cannot be null."); } return addDocumentReplicationListener(null, listener); }
java
@NonNull public ListenerToken addDocumentReplicationListener(@NonNull DocumentReplicationListener listener) { if (listener == null) { throw new IllegalArgumentException("listener cannot be null."); } return addDocumentReplicationListener(null, listener); }
[ "@", "NonNull", "public", "ListenerToken", "addDocumentReplicationListener", "(", "@", "NonNull", "DocumentReplicationListener", "listener", ")", "{", "if", "(", "listener", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"listener cannot be n...
Set the given DocumentReplicationListener to the this replicator. @param listener @return ListenerToken A token to remove the handler later
[ "Set", "the", "given", "DocumentReplicationListener", "to", "the", "this", "replicator", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/AbstractReplicator.java#L434-L439
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/TileCollisionModel.java
TileCollisionModel.getInputValue
public double getInputValue(Axis input, double x, double y) { final double v; switch (input) { case X: v = Math.floor(x - tile.getX()); break; case Y: v = Math.floor(y - tile.getY()); break; default: throw new LionEngineException(input); } return v; }
java
public double getInputValue(Axis input, double x, double y) { final double v; switch (input) { case X: v = Math.floor(x - tile.getX()); break; case Y: v = Math.floor(y - tile.getY()); break; default: throw new LionEngineException(input); } return v; }
[ "public", "double", "getInputValue", "(", "Axis", "input", ",", "double", "x", ",", "double", "y", ")", "{", "final", "double", "v", ";", "switch", "(", "input", ")", "{", "case", "X", ":", "v", "=", "Math", ".", "floor", "(", "x", "-", "tile", "...
Get the input value relative to tile. @param input The input used. @param x The horizontal location. @param y The vertical location. @return The input value.
[ "Get", "the", "input", "value", "relative", "to", "tile", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/TileCollisionModel.java#L58-L73
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/contact/AtomContactSet.java
AtomContactSet.getContact
public AtomContact getContact(Atom atom1, Atom atom2) { return contacts.get(new Pair<AtomIdentifier>( new AtomIdentifier(atom1.getPDBserial(),atom1.getGroup().getChainId()), new AtomIdentifier(atom2.getPDBserial(),atom2.getGroup().getChainId()) )); }
java
public AtomContact getContact(Atom atom1, Atom atom2) { return contacts.get(new Pair<AtomIdentifier>( new AtomIdentifier(atom1.getPDBserial(),atom1.getGroup().getChainId()), new AtomIdentifier(atom2.getPDBserial(),atom2.getGroup().getChainId()) )); }
[ "public", "AtomContact", "getContact", "(", "Atom", "atom1", ",", "Atom", "atom2", ")", "{", "return", "contacts", ".", "get", "(", "new", "Pair", "<", "AtomIdentifier", ">", "(", "new", "AtomIdentifier", "(", "atom1", ".", "getPDBserial", "(", ")", ",", ...
Returns the corresponding AtomContact or null if no contact exists between the 2 given atoms @param atom1 @param atom2 @return
[ "Returns", "the", "corresponding", "AtomContact", "or", "null", "if", "no", "contact", "exists", "between", "the", "2", "given", "atoms" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/AtomContactSet.java#L74-L78
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/ConcurrentServiceReferenceMap.java
ConcurrentServiceReferenceMap.removeReference
public boolean removeReference(K key, ServiceReference<V> reference) { if (key == null || reference == null) return false; ConcurrentServiceReferenceElement<V> element = new ConcurrentServiceReferenceElement<V>(referenceName, reference); return elementMap.remove(key, element); }
java
public boolean removeReference(K key, ServiceReference<V> reference) { if (key == null || reference == null) return false; ConcurrentServiceReferenceElement<V> element = new ConcurrentServiceReferenceElement<V>(referenceName, reference); return elementMap.remove(key, element); }
[ "public", "boolean", "removeReference", "(", "K", "key", ",", "ServiceReference", "<", "V", ">", "reference", ")", "{", "if", "(", "key", "==", "null", "||", "reference", "==", "null", ")", "return", "false", ";", "ConcurrentServiceReferenceElement", "<", "V...
Removes the reference associated with the key. @param key Key associated with this reference @param reference ServiceReference associated with service to be unset. @return true if reference was unset (not previously replaced)
[ "Removes", "the", "reference", "associated", "with", "the", "key", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/ConcurrentServiceReferenceMap.java#L161-L166