repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
tvesalainen/util
util/src/main/java/org/vesalainen/util/CmdArgs.java
CmdArgs.addOption
public final <T> void addOption(Class<T> cls, String name, String description, String exclusiveGroup) { addOption(cls, name, description, exclusiveGroup, true); }
java
public final <T> void addOption(Class<T> cls, String name, String description, String exclusiveGroup) { addOption(cls, name, description, exclusiveGroup, true); }
[ "public", "final", "<", "T", ">", "void", "addOption", "(", "Class", "<", "T", ">", "cls", ",", "String", "name", ",", "String", "description", ",", "String", "exclusiveGroup", ")", "{", "addOption", "(", "cls", ",", "name", ",", "description", ",", "e...
Add a mandatory option @param <T> Type of option @param cls Option type class @param name Option name Option name without @param description Option description @param exclusiveGroup A group of options. Only options of a single group are accepted.
[ "Add", "a", "mandatory", "option" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/CmdArgs.java#L344-L347
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LoadBalancersInner.java
LoadBalancersInner.beginCreateOrUpdate
public LoadBalancerInner beginCreateOrUpdate(String resourceGroupName, String loadBalancerName, LoadBalancerInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, loadBalancerName, parameters).toBlocking().single().body(); }
java
public LoadBalancerInner beginCreateOrUpdate(String resourceGroupName, String loadBalancerName, LoadBalancerInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, loadBalancerName, parameters).toBlocking().single().body(); }
[ "public", "LoadBalancerInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "loadBalancerName", ",", "LoadBalancerInner", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "loadBalancerNa...
Creates or updates a load balancer. @param resourceGroupName The name of the resource group. @param loadBalancerName The name of the load balancer. @param parameters Parameters supplied to the create or update load balancer 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 LoadBalancerInner object if successful.
[ "Creates", "or", "updates", "a", "load", "balancer", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LoadBalancersInner.java#L519-L521
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/loader/impl/OgmLoader.java
OgmLoader.loadEntitiesFromTuples
@Override public List<Object> loadEntitiesFromTuples(SharedSessionContractImplementor session, LockOptions lockOptions, OgmLoadingContext ogmContext) { return loadEntity( null, null, session, lockOptions, ogmContext ); }
java
@Override public List<Object> loadEntitiesFromTuples(SharedSessionContractImplementor session, LockOptions lockOptions, OgmLoadingContext ogmContext) { return loadEntity( null, null, session, lockOptions, ogmContext ); }
[ "@", "Override", "public", "List", "<", "Object", ">", "loadEntitiesFromTuples", "(", "SharedSessionContractImplementor", "session", ",", "LockOptions", "lockOptions", ",", "OgmLoadingContext", "ogmContext", ")", "{", "return", "loadEntity", "(", "null", ",", "null", ...
Load a list of entities using the information in the context @param session The session @param lockOptions The locking details @param ogmContext The context with the information to load the entities @return the list of entities corresponding to the given context
[ "Load", "a", "list", "of", "entities", "using", "the", "information", "in", "the", "context" ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/loader/impl/OgmLoader.java#L219-L222
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java
ElasticPoolsInner.beginCreateOrUpdateAsync
public Observable<ElasticPoolInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1<ServiceResponse<ElasticPoolInner>, ElasticPoolInner>() { @Override public ElasticPoolInner call(ServiceResponse<ElasticPoolInner> response) { return response.body(); } }); }
java
public Observable<ElasticPoolInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1<ServiceResponse<ElasticPoolInner>, ElasticPoolInner>() { @Override public ElasticPoolInner call(ServiceResponse<ElasticPoolInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ElasticPoolInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "elasticPoolName", ",", "ElasticPoolInner", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceRes...
Creates a new elastic pool or updates an existing elastic pool. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param elasticPoolName The name of the elastic pool to be operated on (updated or created). @param parameters The required parameters for creating or updating an elastic pool. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ElasticPoolInner object
[ "Creates", "a", "new", "elastic", "pool", "or", "updates", "an", "existing", "elastic", "pool", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java#L224-L231
albfernandez/itext2
src/main/java/com/lowagie/text/Chunk.java
Chunk.setUnderline
public Chunk setUnderline(Color color, float thickness, float thicknessMul, float yPosition, float yPositionMul, int cap) { if (attributes == null) attributes = new HashMap(); Object obj[] = { color, new float[] { thickness, thicknessMul, yPosition, yPositionMul, cap } }; Object unders[][] = Utilities.addToArray((Object[][]) attributes.get(UNDERLINE), obj); return setAttribute(UNDERLINE, unders); }
java
public Chunk setUnderline(Color color, float thickness, float thicknessMul, float yPosition, float yPositionMul, int cap) { if (attributes == null) attributes = new HashMap(); Object obj[] = { color, new float[] { thickness, thicknessMul, yPosition, yPositionMul, cap } }; Object unders[][] = Utilities.addToArray((Object[][]) attributes.get(UNDERLINE), obj); return setAttribute(UNDERLINE, unders); }
[ "public", "Chunk", "setUnderline", "(", "Color", "color", ",", "float", "thickness", ",", "float", "thicknessMul", ",", "float", "yPosition", ",", "float", "yPositionMul", ",", "int", "cap", ")", "{", "if", "(", "attributes", "==", "null", ")", "attributes",...
Sets an horizontal line that can be an underline or a strikethrough. Actually, the line can be anywhere vertically and has always the <CODE> Chunk</CODE> width. Multiple call to this method will produce multiple lines. @param color the color of the line or <CODE>null</CODE> to follow the text color @param thickness the absolute thickness of the line @param thicknessMul the thickness multiplication factor with the font size @param yPosition the absolute y position relative to the baseline @param yPositionMul the position multiplication factor with the font size @param cap the end line cap. Allowed values are PdfContentByte.LINE_CAP_BUTT, PdfContentByte.LINE_CAP_ROUND and PdfContentByte.LINE_CAP_PROJECTING_SQUARE @return this <CODE>Chunk</CODE>
[ "Sets", "an", "horizontal", "line", "that", "can", "be", "an", "underline", "or", "a", "strikethrough", ".", "Actually", "the", "line", "can", "be", "anywhere", "vertically", "and", "has", "always", "the", "<CODE", ">", "Chunk<", "/", "CODE", ">", "width",...
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Chunk.java#L525-L535
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeDecoderBits.java
QrCodeDecoderBits.decodeAlphanumeric
private int decodeAlphanumeric( QrCode qr , PackedBits8 data, int bitLocation ) { int lengthBits = QrCodeEncoder.getLengthBitsAlphanumeric(qr.version); int length = data.read(bitLocation,lengthBits,true); bitLocation += lengthBits; while( length >= 2 ) { if( data.size < bitLocation+11 ) { qr.failureCause = QrCode.Failure.MESSAGE_OVERFLOW; return -1; } int chunk = data.read(bitLocation,11,true); bitLocation += 11; int valA = chunk/45; int valB = chunk-valA*45; workString.append(valueToAlphanumeric(valA)); workString.append(valueToAlphanumeric(valB)); length -= 2; } if( length == 1 ) { if( data.size < bitLocation+6 ) { qr.failureCause = QrCode.Failure.MESSAGE_OVERFLOW; return -1; } int valA = data.read(bitLocation,6,true); bitLocation += 6; workString.append(valueToAlphanumeric(valA)); } return bitLocation; }
java
private int decodeAlphanumeric( QrCode qr , PackedBits8 data, int bitLocation ) { int lengthBits = QrCodeEncoder.getLengthBitsAlphanumeric(qr.version); int length = data.read(bitLocation,lengthBits,true); bitLocation += lengthBits; while( length >= 2 ) { if( data.size < bitLocation+11 ) { qr.failureCause = QrCode.Failure.MESSAGE_OVERFLOW; return -1; } int chunk = data.read(bitLocation,11,true); bitLocation += 11; int valA = chunk/45; int valB = chunk-valA*45; workString.append(valueToAlphanumeric(valA)); workString.append(valueToAlphanumeric(valB)); length -= 2; } if( length == 1 ) { if( data.size < bitLocation+6 ) { qr.failureCause = QrCode.Failure.MESSAGE_OVERFLOW; return -1; } int valA = data.read(bitLocation,6,true); bitLocation += 6; workString.append(valueToAlphanumeric(valA)); } return bitLocation; }
[ "private", "int", "decodeAlphanumeric", "(", "QrCode", "qr", ",", "PackedBits8", "data", ",", "int", "bitLocation", ")", "{", "int", "lengthBits", "=", "QrCodeEncoder", ".", "getLengthBitsAlphanumeric", "(", "qr", ".", "version", ")", ";", "int", "length", "="...
Decodes alphanumeric messages @param qr QR code @param data encoded data @return Location it has read up to in bits
[ "Decodes", "alphanumeric", "messages" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeDecoderBits.java#L296-L328
apache/groovy
src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java
StaticInvocationWriter.tryBridgeMethod
@Deprecated protected boolean tryBridgeMethod(MethodNode target, Expression receiver, boolean implicitThis, TupleExpression args) { return tryBridgeMethod(target, receiver, implicitThis, args, null); }
java
@Deprecated protected boolean tryBridgeMethod(MethodNode target, Expression receiver, boolean implicitThis, TupleExpression args) { return tryBridgeMethod(target, receiver, implicitThis, args, null); }
[ "@", "Deprecated", "protected", "boolean", "tryBridgeMethod", "(", "MethodNode", "target", ",", "Expression", "receiver", ",", "boolean", "implicitThis", ",", "TupleExpression", "args", ")", "{", "return", "tryBridgeMethod", "(", "target", ",", "receiver", ",", "i...
Attempts to make a direct method call on a bridge method, if it exists.
[ "Attempts", "to", "make", "a", "direct", "method", "call", "on", "a", "bridge", "method", "if", "it", "exists", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java#L218-L221
RuedigerMoeller/kontraktor
src/main/java/org/nustaq/kontraktor/Actors.java
Actors.SubmitDelayed
public static void SubmitDelayed( long millis, Runnable task ) { Actors.delayedCalls.schedule( new TimerTask() { @Override public void run() { task.run(); } },millis); }
java
public static void SubmitDelayed( long millis, Runnable task ) { Actors.delayedCalls.schedule( new TimerTask() { @Override public void run() { task.run(); } },millis); }
[ "public", "static", "void", "SubmitDelayed", "(", "long", "millis", ",", "Runnable", "task", ")", "{", "Actors", ".", "delayedCalls", ".", "schedule", "(", "new", "TimerTask", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "task"...
utility function. Executed in foreign thread. Use Actor::delayed() to have the runnable executed inside actor thread
[ "utility", "function", ".", "Executed", "in", "foreign", "thread", ".", "Use", "Actor", "::", "delayed", "()", "to", "have", "the", "runnable", "executed", "inside", "actor", "thread" ]
train
https://github.com/RuedigerMoeller/kontraktor/blob/d5f3817f9476f3786187b8ef00400b7a4f25a404/src/main/java/org/nustaq/kontraktor/Actors.java#L136-L143
apache/incubator-shardingsphere
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/sql/dal/show/ShowParserFactory.java
ShowParserFactory.newInstance
public static AbstractShowParser newInstance(final DatabaseType dbType, final ShardingRule shardingRule, final LexerEngine lexerEngine) { switch (dbType) { case H2: case MySQL: return new MySQLShowParser(shardingRule, lexerEngine); default: throw new UnsupportedOperationException(String.format("Cannot support database [%s].", dbType)); } }
java
public static AbstractShowParser newInstance(final DatabaseType dbType, final ShardingRule shardingRule, final LexerEngine lexerEngine) { switch (dbType) { case H2: case MySQL: return new MySQLShowParser(shardingRule, lexerEngine); default: throw new UnsupportedOperationException(String.format("Cannot support database [%s].", dbType)); } }
[ "public", "static", "AbstractShowParser", "newInstance", "(", "final", "DatabaseType", "dbType", ",", "final", "ShardingRule", "shardingRule", ",", "final", "LexerEngine", "lexerEngine", ")", "{", "switch", "(", "dbType", ")", "{", "case", "H2", ":", "case", "My...
Create show parser instance. @param dbType database type @param shardingRule databases and tables sharding rule @param lexerEngine lexical analysis engine. @return show parser instance
[ "Create", "show", "parser", "instance", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/sql/dal/show/ShowParserFactory.java#L43-L51
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java
Extern.readPackageListFromURL
private void readPackageListFromURL(String urlpath, URL pkglisturlpath) throws Fault { try { URL link = pkglisturlpath.toURI().resolve(DocPaths.PACKAGE_LIST.getPath()).toURL(); readPackageList(link.openStream(), urlpath, false); } catch (URISyntaxException | MalformedURLException exc) { throw new Fault(configuration.getText("doclet.MalformedURL", pkglisturlpath.toString()), exc); } catch (IOException exc) { throw new Fault(configuration.getText("doclet.URL_error", pkglisturlpath.toString()), exc); } }
java
private void readPackageListFromURL(String urlpath, URL pkglisturlpath) throws Fault { try { URL link = pkglisturlpath.toURI().resolve(DocPaths.PACKAGE_LIST.getPath()).toURL(); readPackageList(link.openStream(), urlpath, false); } catch (URISyntaxException | MalformedURLException exc) { throw new Fault(configuration.getText("doclet.MalformedURL", pkglisturlpath.toString()), exc); } catch (IOException exc) { throw new Fault(configuration.getText("doclet.URL_error", pkglisturlpath.toString()), exc); } }
[ "private", "void", "readPackageListFromURL", "(", "String", "urlpath", ",", "URL", "pkglisturlpath", ")", "throws", "Fault", "{", "try", "{", "URL", "link", "=", "pkglisturlpath", ".", "toURI", "(", ")", ".", "resolve", "(", "DocPaths", ".", "PACKAGE_LIST", ...
Fetch the URL and read the "package-list" file. @param urlpath Path to the packages. @param pkglisturlpath URL or the path to the "package-list" file.
[ "Fetch", "the", "URL", "and", "read", "the", "package", "-", "list", "file", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java#L242-L252
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsLongWithDefault
public long getAsLongWithDefault(String key, long defaultValue) { Object value = getAsObject(key); return LongConverter.toLongWithDefault(value, defaultValue); }
java
public long getAsLongWithDefault(String key, long defaultValue) { Object value = getAsObject(key); return LongConverter.toLongWithDefault(value, defaultValue); }
[ "public", "long", "getAsLongWithDefault", "(", "String", "key", ",", "long", "defaultValue", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "LongConverter", ".", "toLongWithDefault", "(", "value", ",", "defaultValue", ")", ";"...
Converts map element into a long or returns default value if conversion is not possible. @param key a key of element to get. @param defaultValue the default value @return long value of the element or default value if conversion is not supported. @see LongConverter#toLongWithDefault(Object, long)
[ "Converts", "map", "element", "into", "a", "long", "or", "returns", "default", "value", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L290-L293
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
TiledMap.getObjectName
public String getObjectName(int groupID, int objectID) { if (groupID >= 0 && groupID < objectGroups.size()) { ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID); if (objectID >= 0 && objectID < grp.objects.size()) { GroupObject object = (GroupObject) grp.objects.get(objectID); return object.name; } } return null; }
java
public String getObjectName(int groupID, int objectID) { if (groupID >= 0 && groupID < objectGroups.size()) { ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID); if (objectID >= 0 && objectID < grp.objects.size()) { GroupObject object = (GroupObject) grp.objects.get(objectID); return object.name; } } return null; }
[ "public", "String", "getObjectName", "(", "int", "groupID", ",", "int", "objectID", ")", "{", "if", "(", "groupID", ">=", "0", "&&", "groupID", "<", "objectGroups", ".", "size", "(", ")", ")", "{", "ObjectGroup", "grp", "=", "(", "ObjectGroup", ")", "o...
Return the name of a specific object from a specific group. @param groupID Index of a group @param objectID Index of an object @return The name of an object or null, when error occurred
[ "Return", "the", "name", "of", "a", "specific", "object", "from", "a", "specific", "group", "." ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L806-L815
jqno/equalsverifier
src/main/java/nl/jqno/equalsverifier/internal/reflection/annotations/AnnotationProperties.java
AnnotationProperties.putArrayValues
public void putArrayValues(String name, Set<String> values) { arrayValues.put(name, values); }
java
public void putArrayValues(String name, Set<String> values) { arrayValues.put(name, values); }
[ "public", "void", "putArrayValues", "(", "String", "name", ",", "Set", "<", "String", ">", "values", ")", "{", "arrayValues", ".", "put", "(", "name", ",", "values", ")", ";", "}" ]
Adds the content of an array value property. @param name The name of the array value property. @param values The content of the array value property.
[ "Adds", "the", "content", "of", "an", "array", "value", "property", "." ]
train
https://github.com/jqno/equalsverifier/blob/25d73c9cb801c8b20b257d1d1283ac6e0585ef1d/src/main/java/nl/jqno/equalsverifier/internal/reflection/annotations/AnnotationProperties.java#L40-L42
alkacon/opencms-core
src/org/opencms/staticexport/CmsStaticExportManager.java
CmsStaticExportManager.addDefaultFileNameToFolder
public String addDefaultFileNameToFolder(String rfsName, boolean isFolder) { StringBuffer name = new StringBuffer(rfsName); if (isFolder) { // vfs folder case name.append(EXPORT_DEFAULT_FILE); } return name.toString(); }
java
public String addDefaultFileNameToFolder(String rfsName, boolean isFolder) { StringBuffer name = new StringBuffer(rfsName); if (isFolder) { // vfs folder case name.append(EXPORT_DEFAULT_FILE); } return name.toString(); }
[ "public", "String", "addDefaultFileNameToFolder", "(", "String", "rfsName", ",", "boolean", "isFolder", ")", "{", "StringBuffer", "name", "=", "new", "StringBuffer", "(", "rfsName", ")", ";", "if", "(", "isFolder", ")", "{", "// vfs folder case", "name", ".", ...
Returns the real file system name plus the default file name.<p> @param rfsName the real file system name to append the default file name to @param isFolder signals whether the according virtual file system resource is an folder or not @return the real file system name plus the default file name
[ "Returns", "the", "real", "file", "system", "name", "plus", "the", "default", "file", "name", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsStaticExportManager.java#L345-L354
RestComm/sip-servlets
sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java
FacebookRestClient.profile_setFBML
public boolean profile_setFBML(CharSequence profileFbmlMarkup, CharSequence profileActionFbmlMarkup, Long profileId) throws FacebookException, IOException { return profile_setFBML(profileFbmlMarkup, profileActionFbmlMarkup, /* mobileFbmlMarkup */null, profileId); }
java
public boolean profile_setFBML(CharSequence profileFbmlMarkup, CharSequence profileActionFbmlMarkup, Long profileId) throws FacebookException, IOException { return profile_setFBML(profileFbmlMarkup, profileActionFbmlMarkup, /* mobileFbmlMarkup */null, profileId); }
[ "public", "boolean", "profile_setFBML", "(", "CharSequence", "profileFbmlMarkup", ",", "CharSequence", "profileActionFbmlMarkup", ",", "Long", "profileId", ")", "throws", "FacebookException", ",", "IOException", "{", "return", "profile_setFBML", "(", "profileFbmlMarkup", ...
Sets the FBML for the profile box and profile actions for the user or page profile with ID <code>profileId</code>. Refer to the FBML documentation for a description of the markup and its role in various contexts. @param profileFbmlMarkup the FBML for the profile box @param profileActionFbmlMarkup the FBML for the profile actions @param profileId a page or user ID (null for the logged-in user) @return a boolean indicating whether the FBML was successfully set @see <a href="http://wiki.developers.facebook.com/index.php/Profile.setFBML"> Developers wiki: Profile.setFBML</a>
[ "Sets", "the", "FBML", "for", "the", "profile", "box", "and", "profile", "actions", "for", "the", "user", "or", "page", "profile", "with", "ID", "<code", ">", "profileId<", "/", "code", ">", ".", "Refer", "to", "the", "FBML", "documentation", "for", "a",...
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1530-L1533
liferay/com-liferay-commerce
commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CPOptionValueUtil.java
CPOptionValueUtil.removeByC_K
public static CPOptionValue removeByC_K(long CPOptionId, String key) throws com.liferay.commerce.product.exception.NoSuchCPOptionValueException { return getPersistence().removeByC_K(CPOptionId, key); }
java
public static CPOptionValue removeByC_K(long CPOptionId, String key) throws com.liferay.commerce.product.exception.NoSuchCPOptionValueException { return getPersistence().removeByC_K(CPOptionId, key); }
[ "public", "static", "CPOptionValue", "removeByC_K", "(", "long", "CPOptionId", ",", "String", "key", ")", "throws", "com", ".", "liferay", ".", "commerce", ".", "product", ".", "exception", ".", "NoSuchCPOptionValueException", "{", "return", "getPersistence", "(",...
Removes the cp option value where CPOptionId = &#63; and key = &#63; from the database. @param CPOptionId the cp option ID @param key the key @return the cp option value that was removed
[ "Removes", "the", "cp", "option", "value", "where", "CPOptionId", "=", "&#63", ";", "and", "key", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CPOptionValueUtil.java#L1024-L1027
hawtio/hawtio
platforms/hawtio-osgi-jmx/src/main/java/io/hawt/osgi/jmx/RBACDecorator.java
RBACDecorator.decorateCanInvoke
@SuppressWarnings("unchecked") private void decorateCanInvoke(Map<String, Object> mBeanInfo, String method, boolean canInvoke) { LOG.trace("decorateCanInvoke: {} - {}", method, canInvoke); // op String[] methodNameAndArgs = method.split("[()]"); Object op = ((Map<String, Object>) mBeanInfo.get("op")).get(methodNameAndArgs[0]); if (op instanceof List) { // for method overloading List<Map<String, Object>> overloaded = (List<Map<String, Object>>) op; for (Map<String, Object> m : overloaded) { String args = argsToString((List<Map<String, String>>) m.get("args")); if ((methodNameAndArgs.length == 1 && args.equals("")) || (methodNameAndArgs.length > 1 && args.equals(methodNameAndArgs[1]))) { m.put("canInvoke", canInvoke); LOG.trace(" op: {}({}) - {}", methodNameAndArgs[0], args, m.get("canInvoke")); break; } } } else { ((Map<String, Object>) op).put("canInvoke", canInvoke); LOG.trace(" op: {} - {}", method, ((Map<String, Object>) op).get("canInvoke")); } // opByString Map<String, Object> opByString = (Map<String, Object>) mBeanInfo.get("opByString"); Map<String, Object> opByStringMethod = (Map<String, Object>) opByString.get(method); opByStringMethod.put("canInvoke", canInvoke); LOG.trace(" opByString: {} - {}", method, opByStringMethod.get("canInvoke")); }
java
@SuppressWarnings("unchecked") private void decorateCanInvoke(Map<String, Object> mBeanInfo, String method, boolean canInvoke) { LOG.trace("decorateCanInvoke: {} - {}", method, canInvoke); // op String[] methodNameAndArgs = method.split("[()]"); Object op = ((Map<String, Object>) mBeanInfo.get("op")).get(methodNameAndArgs[0]); if (op instanceof List) { // for method overloading List<Map<String, Object>> overloaded = (List<Map<String, Object>>) op; for (Map<String, Object> m : overloaded) { String args = argsToString((List<Map<String, String>>) m.get("args")); if ((methodNameAndArgs.length == 1 && args.equals("")) || (methodNameAndArgs.length > 1 && args.equals(methodNameAndArgs[1]))) { m.put("canInvoke", canInvoke); LOG.trace(" op: {}({}) - {}", methodNameAndArgs[0], args, m.get("canInvoke")); break; } } } else { ((Map<String, Object>) op).put("canInvoke", canInvoke); LOG.trace(" op: {} - {}", method, ((Map<String, Object>) op).get("canInvoke")); } // opByString Map<String, Object> opByString = (Map<String, Object>) mBeanInfo.get("opByString"); Map<String, Object> opByStringMethod = (Map<String, Object>) opByString.get(method); opByStringMethod.put("canInvoke", canInvoke); LOG.trace(" opByString: {} - {}", method, opByStringMethod.get("canInvoke")); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "decorateCanInvoke", "(", "Map", "<", "String", ",", "Object", ">", "mBeanInfo", ",", "String", "method", ",", "boolean", "canInvoke", ")", "{", "LOG", ".", "trace", "(", "\"decorateCanInvo...
Decorates {@link MBeanInfo} operations with "canInvoke" entries. Note both "op" and "opByString" may be used in HawtIO. @param mBeanInfo @param method @param canInvoke
[ "Decorates", "{" ]
train
https://github.com/hawtio/hawtio/blob/d8b1c8f246307c0313ba297a494106d0859f3ffd/platforms/hawtio-osgi-jmx/src/main/java/io/hawt/osgi/jmx/RBACDecorator.java#L480-L508
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGridTools.java
SquareGridTools.findIntersection
protected int findIntersection( SquareNode target , SquareNode node ) { lineCenters.a = target.center; lineCenters.b = node.center; for (int i = 0; i < 4; i++) { int j = (i+1)%4; lineSide.a = target.square.get(i); lineSide.b = target.square.get(j); if(Intersection2D_F64.intersection(lineCenters,lineSide,dummy) != null ) { return i; } } return -1; }
java
protected int findIntersection( SquareNode target , SquareNode node ) { lineCenters.a = target.center; lineCenters.b = node.center; for (int i = 0; i < 4; i++) { int j = (i+1)%4; lineSide.a = target.square.get(i); lineSide.b = target.square.get(j); if(Intersection2D_F64.intersection(lineCenters,lineSide,dummy) != null ) { return i; } } return -1; }
[ "protected", "int", "findIntersection", "(", "SquareNode", "target", ",", "SquareNode", "node", ")", "{", "lineCenters", ".", "a", "=", "target", ".", "center", ";", "lineCenters", ".", "b", "=", "node", ".", "center", ";", "for", "(", "int", "i", "=", ...
Finds the side which intersects the line segment from the center of target to center of node
[ "Finds", "the", "side", "which", "intersects", "the", "line", "segment", "from", "the", "center", "of", "target", "to", "center", "of", "node" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGridTools.java#L326-L341
pressgang-ccms/PressGangCCMSQuery
src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java
BaseFilterQueryBuilder.addNotLikeIgnoresCaseCondition
protected void addNotLikeIgnoresCaseCondition(final String propertyName, final String value) { final Expression<String> propertyNameField = getCriteriaBuilder().lower(getRootPath().get(propertyName).as(String.class)); fieldConditions.add(getCriteriaBuilder().notLike(propertyNameField, "%" + cleanLikeCondition(value).toLowerCase() + "%")); }
java
protected void addNotLikeIgnoresCaseCondition(final String propertyName, final String value) { final Expression<String> propertyNameField = getCriteriaBuilder().lower(getRootPath().get(propertyName).as(String.class)); fieldConditions.add(getCriteriaBuilder().notLike(propertyNameField, "%" + cleanLikeCondition(value).toLowerCase() + "%")); }
[ "protected", "void", "addNotLikeIgnoresCaseCondition", "(", "final", "String", "propertyName", ",", "final", "String", "value", ")", "{", "final", "Expression", "<", "String", ">", "propertyNameField", "=", "getCriteriaBuilder", "(", ")", ".", "lower", "(", "getRo...
Add a Field Search Condition that will search a field for values that aren't like a specified value using the following SQL logic: {@code LOWER(field) NOT LIKE LOWER('%value%')} @param propertyName The name of the field as defined in the Entity mapping class. @param value The value to search against.
[ "Add", "a", "Field", "Search", "Condition", "that", "will", "search", "a", "field", "for", "values", "that", "aren", "t", "like", "a", "specified", "value", "using", "the", "following", "SQL", "logic", ":", "{", "@code", "LOWER", "(", "field", ")", "NOT"...
train
https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java#L235-L238
zaproxy/zaproxy
src/org/zaproxy/zap/spider/Spider.java
Spider.addRootFileSeed
private void addRootFileSeed(URI baseUri, String fileName) { String seed = buildUri(baseUri.getScheme(), baseUri.getRawHost(), baseUri.getPort(), "/" + fileName); try { this.seedList.add(new URI(seed, true)); } catch (Exception e) { log.warn("Error while creating [" + fileName + "] seed: " + seed, e); } }
java
private void addRootFileSeed(URI baseUri, String fileName) { String seed = buildUri(baseUri.getScheme(), baseUri.getRawHost(), baseUri.getPort(), "/" + fileName); try { this.seedList.add(new URI(seed, true)); } catch (Exception e) { log.warn("Error while creating [" + fileName + "] seed: " + seed, e); } }
[ "private", "void", "addRootFileSeed", "(", "URI", "baseUri", ",", "String", "fileName", ")", "{", "String", "seed", "=", "buildUri", "(", "baseUri", ".", "getScheme", "(", ")", ",", "baseUri", ".", "getRawHost", "(", ")", ",", "baseUri", ".", "getPort", ...
Adds a file seed, with the given file name, at the root of the base URI. <p> For example, with base URI as {@code http://example.com/some/path/file.html} and file name as {@code sitemap.xml} it's added the seed {@code http://example.com/sitemap.xml}. @param baseUri the base URI. @param fileName the file name.
[ "Adds", "a", "file", "seed", "with", "the", "given", "file", "name", "at", "the", "root", "of", "the", "base", "URI", ".", "<p", ">", "For", "example", "with", "base", "URI", "as", "{", "@code", "http", ":", "//", "example", ".", "com", "/", "some"...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/spider/Spider.java#L269-L276
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/route/Route.java
Route.POST
public static Route POST(String uriPattern, RouteHandler routeHandler) { return new Route(HttpConstants.Method.POST, uriPattern, routeHandler); }
java
public static Route POST(String uriPattern, RouteHandler routeHandler) { return new Route(HttpConstants.Method.POST, uriPattern, routeHandler); }
[ "public", "static", "Route", "POST", "(", "String", "uriPattern", ",", "RouteHandler", "routeHandler", ")", "{", "return", "new", "Route", "(", "HttpConstants", ".", "Method", ".", "POST", ",", "uriPattern", ",", "routeHandler", ")", ";", "}" ]
Create a {@code POST} route. @param uriPattern @param routeHandler @return
[ "Create", "a", "{", "@code", "POST", "}", "route", "." ]
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/route/Route.java#L81-L83
jbundle/osgi
core/src/main/java/org/jbundle/util/osgi/finder/ClassServiceUtility.java
ClassServiceUtility.getBundleClassLoader
public ClassLoader getBundleClassLoader(String packageName, String version) throws ClassNotFoundException { if ((packageName == null) || (packageName.length() == 0)) return null; ClassLoader classLoader = null; if (this.getClassFinder(null) != null) classLoader = this.getClassFinder(null).findBundleClassLoader(packageName, version); // Try to find this class in the obr repos return classLoader; }
java
public ClassLoader getBundleClassLoader(String packageName, String version) throws ClassNotFoundException { if ((packageName == null) || (packageName.length() == 0)) return null; ClassLoader classLoader = null; if (this.getClassFinder(null) != null) classLoader = this.getClassFinder(null).findBundleClassLoader(packageName, version); // Try to find this class in the obr repos return classLoader; }
[ "public", "ClassLoader", "getBundleClassLoader", "(", "String", "packageName", ",", "String", "version", ")", "throws", "ClassNotFoundException", "{", "if", "(", "(", "packageName", "==", "null", ")", "||", "(", "packageName", ".", "length", "(", ")", "==", "0...
Get the bundle classloader for this package. @param string The class name to find the bundle for. @return The class loader. @throws ClassNotFoundException
[ "Get", "the", "bundle", "classloader", "for", "this", "package", "." ]
train
https://github.com/jbundle/osgi/blob/beb02aef78736a4f799aaac001c8f0327bf0536c/core/src/main/java/org/jbundle/util/osgi/finder/ClassServiceUtility.java#L263-L273
Azure/azure-sdk-for-java
servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java
ClientFactory.acceptSessionFromConnectionStringAsync
public static CompletableFuture<IMessageSession> acceptSessionFromConnectionStringAsync(String amqpConnectionString, String sessionId) { return acceptSessionFromConnectionStringAsync(amqpConnectionString, sessionId, DEFAULTRECEIVEMODE); }
java
public static CompletableFuture<IMessageSession> acceptSessionFromConnectionStringAsync(String amqpConnectionString, String sessionId) { return acceptSessionFromConnectionStringAsync(amqpConnectionString, sessionId, DEFAULTRECEIVEMODE); }
[ "public", "static", "CompletableFuture", "<", "IMessageSession", ">", "acceptSessionFromConnectionStringAsync", "(", "String", "amqpConnectionString", ",", "String", "sessionId", ")", "{", "return", "acceptSessionFromConnectionStringAsync", "(", "amqpConnectionString", ",", "...
Accept a {@link IMessageSession} in default {@link ReceiveMode#PEEKLOCK} mode asynchronously from service bus connection string with specified session id. Session Id can be null, if null, service will return the first available session. @param amqpConnectionString the connection string @param sessionId session id, if null, service will return the first available session, otherwise, service will return specified session @return a CompletableFuture representing the pending session accepting
[ "Accept", "a", "{", "@link", "IMessageSession", "}", "in", "default", "{", "@link", "ReceiveMode#PEEKLOCK", "}", "mode", "asynchronously", "from", "service", "bus", "connection", "string", "with", "specified", "session", "id", ".", "Session", "Id", "can", "be", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L622-L624
hawkular/hawkular-inventory
hawkular-inventory-api/src/main/java/org/hawkular/inventory/api/Interest.java
Interest.matches
public boolean matches(Action<?, ?> action, Object object) { return this.action == action && object != null && entityType.isAssignableFrom(object.getClass()); }
java
public boolean matches(Action<?, ?> action, Object object) { return this.action == action && object != null && entityType.isAssignableFrom(object.getClass()); }
[ "public", "boolean", "matches", "(", "Action", "<", "?", ",", "?", ">", "action", ",", "Object", "object", ")", "{", "return", "this", ".", "action", "==", "action", "&&", "object", "!=", "null", "&&", "entityType", ".", "isAssignableFrom", "(", "object"...
Checks whether given object is of interest to this interest instance. @param action the action to be performed on the object @param object the object to check @return true if the object is of interest to this, false otherwise
[ "Checks", "whether", "given", "object", "is", "of", "interest", "to", "this", "interest", "instance", "." ]
train
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-api/src/main/java/org/hawkular/inventory/api/Interest.java#L56-L58
DDTH/ddth-zookeeper
src/main/java/com/github/ddth/zookeeper/ZooKeeperClient.java
ZooKeeperClient.createNode
public boolean createNode(String path, byte[] value) throws ZooKeeperException { return _create(path, value, CreateMode.PERSISTENT); }
java
public boolean createNode(String path, byte[] value) throws ZooKeeperException { return _create(path, value, CreateMode.PERSISTENT); }
[ "public", "boolean", "createNode", "(", "String", "path", ",", "byte", "[", "]", "value", ")", "throws", "ZooKeeperException", "{", "return", "_create", "(", "path", ",", "value", ",", "CreateMode", ".", "PERSISTENT", ")", ";", "}" ]
Creates a node, with initial values. <p> Note: nodes are created recursively (parent nodes are created if needed). </p> @param path @param value @return @throws ZooKeeperException
[ "Creates", "a", "node", "with", "initial", "values", "." ]
train
https://github.com/DDTH/ddth-zookeeper/blob/0994eea8b25fa3d885f3da4579768b7d08c1c32b/src/main/java/com/github/ddth/zookeeper/ZooKeeperClient.java#L453-L455
korpling/ANNIS
annis-service/src/main/java/annis/administration/AdministrationDao.java
AdministrationDao.getOperators
private void getOperators(List<ExampleQuery> exQueries, String regex) { Pattern opsRegex = Pattern.compile(regex); for (ExampleQuery eQ : exQueries) { List<String> ops = new ArrayList<>(); Matcher m = opsRegex.matcher(eQ.getExampleQuery().replaceAll("\\s", "")); while (m.find()) { ops.add(m.group()); } eQ.setUsedOperators("{" + StringUtils.join(ops, ",") + "}"); } }
java
private void getOperators(List<ExampleQuery> exQueries, String regex) { Pattern opsRegex = Pattern.compile(regex); for (ExampleQuery eQ : exQueries) { List<String> ops = new ArrayList<>(); Matcher m = opsRegex.matcher(eQ.getExampleQuery().replaceAll("\\s", "")); while (m.find()) { ops.add(m.group()); } eQ.setUsedOperators("{" + StringUtils.join(ops, ",") + "}"); } }
[ "private", "void", "getOperators", "(", "List", "<", "ExampleQuery", ">", "exQueries", ",", "String", "regex", ")", "{", "Pattern", "opsRegex", "=", "Pattern", ".", "compile", "(", "regex", ")", ";", "for", "(", "ExampleQuery", "eQ", ":", "exQueries", ")",...
Fetches operators used in the {@link ExampleQuery#getExampleQuery()} with a given regex. @param exQueries Set the used operators property of each member. @param regex The regex to search operators.
[ "Fetches", "operators", "used", "in", "the", "{", "@link", "ExampleQuery#getExampleQuery", "()", "}", "with", "a", "given", "regex", "." ]
train
https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-service/src/main/java/annis/administration/AdministrationDao.java#L2191-L2207
lagom/lagom
service/javadsl/server/src/main/java/com/lightbend/lagom/javadsl/server/status/Latency.java
Latency.withPercentile98th
public final Latency withPercentile98th(double value) { double newValue = value; return new Latency(this.median, newValue, this.percentile99th, this.percentile999th, this.mean, this.min, this.max); }
java
public final Latency withPercentile98th(double value) { double newValue = value; return new Latency(this.median, newValue, this.percentile99th, this.percentile999th, this.mean, this.min, this.max); }
[ "public", "final", "Latency", "withPercentile98th", "(", "double", "value", ")", "{", "double", "newValue", "=", "value", ";", "return", "new", "Latency", "(", "this", ".", "median", ",", "newValue", ",", "this", ".", "percentile99th", ",", "this", ".", "p...
Copy the current immutable object by setting a value for the {@link AbstractLatency#getPercentile98th() percentile98th} attribute. @param value A new value for percentile98th @return A modified copy of the {@code this} object
[ "Copy", "the", "current", "immutable", "object", "by", "setting", "a", "value", "for", "the", "{" ]
train
https://github.com/lagom/lagom/blob/3763055a9d1aace793a5d970f4e688aea61b1a5a/service/javadsl/server/src/main/java/com/lightbend/lagom/javadsl/server/status/Latency.java#L137-L140
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/routing/handlers/RequestHandler.java
RequestHandler.executeFilter
protected Response executeFilter(List<Annotation> annotations, Response response) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { for (final Annotation annotation : annotations) { final FilterWith filterWith = (FilterWith) annotation; for (final Class<?> clazz : filterWith.value()) { if (response.isEndResponse()) { return response; } else { final Method classMethod = clazz.getMethod(Default.FILTER_METHOD.toString(), Request.class, Response.class); response = (Response) classMethod.invoke(Application.getInstance(clazz), this.attachment.getRequest(), response); } } } return response; }
java
protected Response executeFilter(List<Annotation> annotations, Response response) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { for (final Annotation annotation : annotations) { final FilterWith filterWith = (FilterWith) annotation; for (final Class<?> clazz : filterWith.value()) { if (response.isEndResponse()) { return response; } else { final Method classMethod = clazz.getMethod(Default.FILTER_METHOD.toString(), Request.class, Response.class); response = (Response) classMethod.invoke(Application.getInstance(clazz), this.attachment.getRequest(), response); } } } return response; }
[ "protected", "Response", "executeFilter", "(", "List", "<", "Annotation", ">", "annotations", ",", "Response", "response", ")", "throws", "NoSuchMethodException", ",", "IllegalAccessException", ",", "InvocationTargetException", "{", "for", "(", "final", "Annotation", ...
Executes all filters on controller and method level @param annotations An array of @FilterWith annotated classes and methods @param response @return True if the request should continue after filter execution, false otherwise @throws NoSuchMethodException @throws IllegalAccessException @throws InvocationTargetException
[ "Executes", "all", "filters", "on", "controller", "and", "method", "level" ]
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/RequestHandler.java#L291-L305
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/MetadataCache.java
MetadataCache.findTrackIdAtOffset
private static int findTrackIdAtOffset(SlotReference slot, Client client, int offset) throws IOException { Message entry = client.renderMenuItems(Message.MenuIdentifier.MAIN_MENU, slot.slot, CdjStatus.TrackType.REKORDBOX, offset, 1).get(0); if (entry.getMenuItemType() == Message.MenuItemType.UNKNOWN) { logger.warn("Encountered unrecognized track list entry item type: {}", entry); } return (int)((NumberField)entry.arguments.get(1)).getValue(); }
java
private static int findTrackIdAtOffset(SlotReference slot, Client client, int offset) throws IOException { Message entry = client.renderMenuItems(Message.MenuIdentifier.MAIN_MENU, slot.slot, CdjStatus.TrackType.REKORDBOX, offset, 1).get(0); if (entry.getMenuItemType() == Message.MenuItemType.UNKNOWN) { logger.warn("Encountered unrecognized track list entry item type: {}", entry); } return (int)((NumberField)entry.arguments.get(1)).getValue(); }
[ "private", "static", "int", "findTrackIdAtOffset", "(", "SlotReference", "slot", ",", "Client", "client", ",", "int", "offset", ")", "throws", "IOException", "{", "Message", "entry", "=", "client", ".", "renderMenuItems", "(", "Message", ".", "MenuIdentifier", "...
As part of checking whether a metadata cache can be auto-mounted for a particular media slot, this method looks up the track at the specified offset within the player's track list, and returns its rekordbox ID. @param slot the slot being considered for auto-attaching a metadata cache @param client the connection to the database server on the player holding that slot @param offset an index into the list of all tracks present in the slot @throws IOException if there is a problem communicating with the player
[ "As", "part", "of", "checking", "whether", "a", "metadata", "cache", "can", "be", "auto", "-", "mounted", "for", "a", "particular", "media", "slot", "this", "method", "looks", "up", "the", "track", "at", "the", "specified", "offset", "within", "the", "play...
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/MetadataCache.java#L1036-L1042
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/JShell.java
JShell.messageFormat
String messageFormat(String key, Object... args) { if (outputRB == null) { try { outputRB = ResourceBundle.getBundle(L10N_RB_NAME); } catch (MissingResourceException mre) { throw new InternalError("Cannot find ResourceBundle: " + L10N_RB_NAME); } } String s; try { s = outputRB.getString(key); } catch (MissingResourceException mre) { throw new InternalError("Missing resource: " + key + " in " + L10N_RB_NAME); } return MessageFormat.format(s, args); }
java
String messageFormat(String key, Object... args) { if (outputRB == null) { try { outputRB = ResourceBundle.getBundle(L10N_RB_NAME); } catch (MissingResourceException mre) { throw new InternalError("Cannot find ResourceBundle: " + L10N_RB_NAME); } } String s; try { s = outputRB.getString(key); } catch (MissingResourceException mre) { throw new InternalError("Missing resource: " + key + " in " + L10N_RB_NAME); } return MessageFormat.format(s, args); }
[ "String", "messageFormat", "(", "String", "key", ",", "Object", "...", "args", ")", "{", "if", "(", "outputRB", "==", "null", ")", "{", "try", "{", "outputRB", "=", "ResourceBundle", ".", "getBundle", "(", "L10N_RB_NAME", ")", ";", "}", "catch", "(", "...
Format using resource bundle look-up using MessageFormat @param key the resource key @param args
[ "Format", "using", "resource", "bundle", "look", "-", "up", "using", "MessageFormat" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/JShell.java#L895-L910
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/configure/SchemaConfiguration.java
SchemaConfiguration.getSchemaProperty
private String getSchemaProperty(String persistenceUnit, Map<String, Object> externalProperties) { PersistenceUnitMetadata persistenceUnitMetadata = kunderaMetadata.getApplicationMetadata() .getPersistenceUnitMetadata(persistenceUnit); String autoDdlOption = externalProperties != null ? (String) externalProperties.get(PersistenceProperties.KUNDERA_DDL_AUTO_PREPARE) : null; if (autoDdlOption == null) { autoDdlOption = persistenceUnitMetadata != null ? persistenceUnitMetadata.getProperty(PersistenceProperties.KUNDERA_DDL_AUTO_PREPARE) : null; } return autoDdlOption; }
java
private String getSchemaProperty(String persistenceUnit, Map<String, Object> externalProperties) { PersistenceUnitMetadata persistenceUnitMetadata = kunderaMetadata.getApplicationMetadata() .getPersistenceUnitMetadata(persistenceUnit); String autoDdlOption = externalProperties != null ? (String) externalProperties.get(PersistenceProperties.KUNDERA_DDL_AUTO_PREPARE) : null; if (autoDdlOption == null) { autoDdlOption = persistenceUnitMetadata != null ? persistenceUnitMetadata.getProperty(PersistenceProperties.KUNDERA_DDL_AUTO_PREPARE) : null; } return autoDdlOption; }
[ "private", "String", "getSchemaProperty", "(", "String", "persistenceUnit", ",", "Map", "<", "String", ",", "Object", ">", "externalProperties", ")", "{", "PersistenceUnitMetadata", "persistenceUnitMetadata", "=", "kunderaMetadata", ".", "getApplicationMetadata", "(", "...
getKunderaProperty method return auto schema generation property for give persistence unit. @param externalProperties @param String persistenceUnit. @return value of kundera auto ddl in form of String.
[ "getKunderaProperty", "method", "return", "auto", "schema", "generation", "property", "for", "give", "persistence", "unit", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/configure/SchemaConfiguration.java#L708-L720
apache/flink
flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableFactoryService.java
TableFactoryService.discoverFactories
private static List<TableFactory> discoverFactories(Optional<ClassLoader> classLoader) { try { List<TableFactory> result = new LinkedList<>(); if (classLoader.isPresent()) { ServiceLoader .load(TableFactory.class, classLoader.get()) .iterator() .forEachRemaining(result::add); } else { defaultLoader.iterator().forEachRemaining(result::add); } return result; } catch (ServiceConfigurationError e) { LOG.error("Could not load service provider for table factories.", e); throw new TableException("Could not load service provider for table factories.", e); } }
java
private static List<TableFactory> discoverFactories(Optional<ClassLoader> classLoader) { try { List<TableFactory> result = new LinkedList<>(); if (classLoader.isPresent()) { ServiceLoader .load(TableFactory.class, classLoader.get()) .iterator() .forEachRemaining(result::add); } else { defaultLoader.iterator().forEachRemaining(result::add); } return result; } catch (ServiceConfigurationError e) { LOG.error("Could not load service provider for table factories.", e); throw new TableException("Could not load service provider for table factories.", e); } }
[ "private", "static", "List", "<", "TableFactory", ">", "discoverFactories", "(", "Optional", "<", "ClassLoader", ">", "classLoader", ")", "{", "try", "{", "List", "<", "TableFactory", ">", "result", "=", "new", "LinkedList", "<>", "(", ")", ";", "if", "(",...
Searches for factories using Java service providers. @return all factories in the classpath
[ "Searches", "for", "factories", "using", "Java", "service", "providers", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableFactoryService.java#L150-L167
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java
TemperatureConversion.convertFromCelsius
public static double convertFromCelsius(TemperatureScale to, double temperature) { switch(to) { case FARENHEIT: return convertCelsiusToFarenheit(temperature); case CELSIUS: return temperature; case KELVIN: return convertCelsiusToKelvin(temperature); case RANKINE: return convertCelsiusToRankine(temperature); default: throw(new RuntimeException("Invalid termpature conversion")); } }
java
public static double convertFromCelsius(TemperatureScale to, double temperature) { switch(to) { case FARENHEIT: return convertCelsiusToFarenheit(temperature); case CELSIUS: return temperature; case KELVIN: return convertCelsiusToKelvin(temperature); case RANKINE: return convertCelsiusToRankine(temperature); default: throw(new RuntimeException("Invalid termpature conversion")); } }
[ "public", "static", "double", "convertFromCelsius", "(", "TemperatureScale", "to", ",", "double", "temperature", ")", "{", "switch", "(", "to", ")", "{", "case", "FARENHEIT", ":", "return", "convertCelsiusToFarenheit", "(", "temperature", ")", ";", "case", "CELS...
Convert a temperature value from the Celsius temperature scale to another. @param to TemperatureScale @param temperature value in degrees centigrade @return converted temperature value in the requested to scale
[ "Convert", "a", "temperature", "value", "from", "the", "Celsius", "temperature", "scale", "to", "another", "." ]
train
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java#L121-L136
javalite/activeweb
activeweb/src/main/java/org/javalite/activeweb/SessionFacade.java
SessionFacade.put
public Object put(String name, Serializable value){ Object val = RequestContext.getHttpRequest().getSession(true).getAttribute(name); RequestContext.getHttpRequest().getSession(true).setAttribute(name, value); return val; }
java
public Object put(String name, Serializable value){ Object val = RequestContext.getHttpRequest().getSession(true).getAttribute(name); RequestContext.getHttpRequest().getSession(true).setAttribute(name, value); return val; }
[ "public", "Object", "put", "(", "String", "name", ",", "Serializable", "value", ")", "{", "Object", "val", "=", "RequestContext", ".", "getHttpRequest", "(", ")", ".", "getSession", "(", "true", ")", ".", "getAttribute", "(", "name", ")", ";", "RequestCont...
Add object to a session. @param name name of object @param value object reference.
[ "Add", "object", "to", "a", "session", "." ]
train
https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/SessionFacade.java#L81-L85
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/validation/rules/AttributeConstraintRule.java
AttributeConstraintRule.validatePast
private boolean validatePast(Object validationObject, Annotation annotate) { if (checkNullObject(validationObject)) { return true; } int res = 0; if (validationObject.getClass().isAssignableFrom(java.util.Date.class)) { Date today = new Date(); Date pastDate = (Date) validationObject; res = pastDate.compareTo(today); } else if (validationObject.getClass().isAssignableFrom(java.util.Calendar.class)) { Calendar cal = Calendar.getInstance(); Calendar pastDate = (Calendar) validationObject; res = pastDate.compareTo(cal); } // else // { // ruleExceptionHandler(((Past) annotate).message()); // } if (res >= 0) { throwValidationException(((Past) annotate).message()); } return true; }
java
private boolean validatePast(Object validationObject, Annotation annotate) { if (checkNullObject(validationObject)) { return true; } int res = 0; if (validationObject.getClass().isAssignableFrom(java.util.Date.class)) { Date today = new Date(); Date pastDate = (Date) validationObject; res = pastDate.compareTo(today); } else if (validationObject.getClass().isAssignableFrom(java.util.Calendar.class)) { Calendar cal = Calendar.getInstance(); Calendar pastDate = (Calendar) validationObject; res = pastDate.compareTo(cal); } // else // { // ruleExceptionHandler(((Past) annotate).message()); // } if (res >= 0) { throwValidationException(((Past) annotate).message()); } return true; }
[ "private", "boolean", "validatePast", "(", "Object", "validationObject", ",", "Annotation", "annotate", ")", "{", "if", "(", "checkNullObject", "(", "validationObject", ")", ")", "{", "return", "true", ";", "}", "int", "res", "=", "0", ";", "if", "(", "val...
Checks whether the object is null or not @param validationObject @param annotate @return
[ "Checks", "whether", "the", "object", "is", "null", "or", "not" ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/validation/rules/AttributeConstraintRule.java#L273-L307
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java
DocBookBuilder.createRootContainerXML
protected Element createRootContainerXML(final BuildData buildData, final Document doc, final Level level, final boolean flattenStructure) throws BuildProcessingException { // Check if the app should be shutdown if (isShuttingDown.get()) { return null; } // Get the name of the element based on the type final String elementName = level.getLevelType() == LevelType.PROCESS ? "chapter" : level.getLevelType().getTitle().toLowerCase( Locale.ENGLISH); Document container = null; try { container = XMLUtilities.convertStringToDocument("<" + elementName + "></" + elementName + ">"); } catch (Exception ex) { // Exit since we shouldn't fail at converting a basic chapter log.debug("", ex); throw new BuildProcessingException(getMessages().getString("FAILED_CREATING_BASIC_TEMPLATE")); } // Create the title final String containerName = level.getUniqueLinkId(buildData.isUseFixedUrls()); final String containerXMLName = containerName + ".xml"; // Create the xiInclude to be added to the book.xml file final Element xiInclude = XMLUtilities.createXIInclude(doc, containerXMLName); // Setup the title and id setUpRootElement(buildData, level, container, container.getDocumentElement()); // Create and add the chapter/level contents createContainerXML(buildData, level, container, container.getDocumentElement(), buildData.getBookTopicsFolder() + containerName + "/", flattenStructure); // Add the boiler plate text and add the chapter to the book final String chapterString = DocBookBuildUtilities.convertDocumentToDocBookFormattedString(buildData.getDocBookVersion(), container, elementName, buildData.getEntityFileName(), getXMLFormatProperties()); addToZip(buildData.getBookLocaleFolder() + containerXMLName, chapterString, buildData); return xiInclude; }
java
protected Element createRootContainerXML(final BuildData buildData, final Document doc, final Level level, final boolean flattenStructure) throws BuildProcessingException { // Check if the app should be shutdown if (isShuttingDown.get()) { return null; } // Get the name of the element based on the type final String elementName = level.getLevelType() == LevelType.PROCESS ? "chapter" : level.getLevelType().getTitle().toLowerCase( Locale.ENGLISH); Document container = null; try { container = XMLUtilities.convertStringToDocument("<" + elementName + "></" + elementName + ">"); } catch (Exception ex) { // Exit since we shouldn't fail at converting a basic chapter log.debug("", ex); throw new BuildProcessingException(getMessages().getString("FAILED_CREATING_BASIC_TEMPLATE")); } // Create the title final String containerName = level.getUniqueLinkId(buildData.isUseFixedUrls()); final String containerXMLName = containerName + ".xml"; // Create the xiInclude to be added to the book.xml file final Element xiInclude = XMLUtilities.createXIInclude(doc, containerXMLName); // Setup the title and id setUpRootElement(buildData, level, container, container.getDocumentElement()); // Create and add the chapter/level contents createContainerXML(buildData, level, container, container.getDocumentElement(), buildData.getBookTopicsFolder() + containerName + "/", flattenStructure); // Add the boiler plate text and add the chapter to the book final String chapterString = DocBookBuildUtilities.convertDocumentToDocBookFormattedString(buildData.getDocBookVersion(), container, elementName, buildData.getEntityFileName(), getXMLFormatProperties()); addToZip(buildData.getBookLocaleFolder() + containerXMLName, chapterString, buildData); return xiInclude; }
[ "protected", "Element", "createRootContainerXML", "(", "final", "BuildData", "buildData", ",", "final", "Document", "doc", ",", "final", "Level", "level", ",", "final", "boolean", "flattenStructure", ")", "throws", "BuildProcessingException", "{", "// Check if the app s...
Creates all the chapters/appendixes for a book and generates the section/topic data inside of each chapter. @param buildData Information and data structures for the build. @param doc The Book document object to add the child level content to. @param level The level to build the chapter from. @param flattenStructure Whether or not the build should be flattened. @return The Element that specifies the XiInclude for the chapter/appendix in the files. @throws BuildProcessingException Thrown if an unexpected error occurs during building.
[ "Creates", "all", "the", "chapters", "/", "appendixes", "for", "a", "book", "and", "generates", "the", "section", "/", "topic", "data", "inside", "of", "each", "chapter", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java#L2250-L2290
cdk/cdk
base/valencycheck/src/main/java/org/openscience/cdk/tools/SmilesValencyChecker.java
SmilesValencyChecker.saturateByIncreasingBondOrder
public boolean saturateByIncreasingBondOrder(IBond bond, IAtomContainer atomContainer) throws CDKException { IAtom[] atoms = BondManipulator.getAtomArray(bond); IAtom atom = atoms[0]; IAtom partner = atoms[1]; logger.debug(" saturating bond: ", atom.getSymbol(), "-", partner.getSymbol()); IAtomType[] atomTypes1 = getAtomTypeFactory(bond.getBuilder()).getAtomTypes(atom.getSymbol()); IAtomType[] atomTypes2 = getAtomTypeFactory(bond.getBuilder()).getAtomTypes(partner.getSymbol()); for (int atCounter1 = 0; atCounter1 < atomTypes1.length; atCounter1++) { IAtomType aType1 = atomTypes1[atCounter1]; logger.debug(" condidering atom type: ", aType1); if (couldMatchAtomType(atomContainer, atom, aType1)) { logger.debug(" trying atom type: ", aType1); for (int atCounter2 = 0; atCounter2 < atomTypes2.length; atCounter2++) { IAtomType aType2 = atomTypes2[atCounter2]; logger.debug(" condidering partner type: ", aType1); if (couldMatchAtomType(atomContainer, partner, atomTypes2[atCounter2])) { logger.debug(" with atom type: ", aType2); if (BondManipulator.isLowerOrder(bond.getOrder(), aType2.getMaxBondOrder()) && BondManipulator.isLowerOrder(bond.getOrder(), aType1.getMaxBondOrder())) { bond.setOrder(BondManipulator.increaseBondOrder(bond.getOrder())); logger.debug("Bond order now ", bond.getOrder()); return true; } } } } } return false; }
java
public boolean saturateByIncreasingBondOrder(IBond bond, IAtomContainer atomContainer) throws CDKException { IAtom[] atoms = BondManipulator.getAtomArray(bond); IAtom atom = atoms[0]; IAtom partner = atoms[1]; logger.debug(" saturating bond: ", atom.getSymbol(), "-", partner.getSymbol()); IAtomType[] atomTypes1 = getAtomTypeFactory(bond.getBuilder()).getAtomTypes(atom.getSymbol()); IAtomType[] atomTypes2 = getAtomTypeFactory(bond.getBuilder()).getAtomTypes(partner.getSymbol()); for (int atCounter1 = 0; atCounter1 < atomTypes1.length; atCounter1++) { IAtomType aType1 = atomTypes1[atCounter1]; logger.debug(" condidering atom type: ", aType1); if (couldMatchAtomType(atomContainer, atom, aType1)) { logger.debug(" trying atom type: ", aType1); for (int atCounter2 = 0; atCounter2 < atomTypes2.length; atCounter2++) { IAtomType aType2 = atomTypes2[atCounter2]; logger.debug(" condidering partner type: ", aType1); if (couldMatchAtomType(atomContainer, partner, atomTypes2[atCounter2])) { logger.debug(" with atom type: ", aType2); if (BondManipulator.isLowerOrder(bond.getOrder(), aType2.getMaxBondOrder()) && BondManipulator.isLowerOrder(bond.getOrder(), aType1.getMaxBondOrder())) { bond.setOrder(BondManipulator.increaseBondOrder(bond.getOrder())); logger.debug("Bond order now ", bond.getOrder()); return true; } } } } } return false; }
[ "public", "boolean", "saturateByIncreasingBondOrder", "(", "IBond", "bond", ",", "IAtomContainer", "atomContainer", ")", "throws", "CDKException", "{", "IAtom", "[", "]", "atoms", "=", "BondManipulator", ".", "getAtomArray", "(", "bond", ")", ";", "IAtom", "atom",...
Tries to saturate a bond by increasing its bond orders by 1.0. @return true if the bond could be increased
[ "Tries", "to", "saturate", "a", "bond", "by", "increasing", "its", "bond", "orders", "by", "1", ".", "0", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/valencycheck/src/main/java/org/openscience/cdk/tools/SmilesValencyChecker.java#L164-L192
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/PropertiesField.java
PropertiesField.propertiesToString
public static String propertiesToString(Map<String,Object> map) { String strProperties = null; Properties properties = Utility.mapToProperties(map); ByteArrayOutputStream baOut = new ByteArrayOutputStream(); try { properties.store(baOut, PROPERTIES_COMMENT); byte[] rgBytes = baOut.toByteArray(); ByteArrayInputStream baIn = new ByteArrayInputStream(rgBytes); InputStreamReader isIn = new InputStreamReader(baIn); // byte -> char char[] cbuf = new char[rgBytes.length]; isIn.read(cbuf, 0, rgBytes.length); if (cbuf.length == rgBytes.length) strProperties = new String(cbuf); } catch (IOException ex) { ex.printStackTrace(); } return strProperties; }
java
public static String propertiesToString(Map<String,Object> map) { String strProperties = null; Properties properties = Utility.mapToProperties(map); ByteArrayOutputStream baOut = new ByteArrayOutputStream(); try { properties.store(baOut, PROPERTIES_COMMENT); byte[] rgBytes = baOut.toByteArray(); ByteArrayInputStream baIn = new ByteArrayInputStream(rgBytes); InputStreamReader isIn = new InputStreamReader(baIn); // byte -> char char[] cbuf = new char[rgBytes.length]; isIn.read(cbuf, 0, rgBytes.length); if (cbuf.length == rgBytes.length) strProperties = new String(cbuf); } catch (IOException ex) { ex.printStackTrace(); } return strProperties; }
[ "public", "static", "String", "propertiesToString", "(", "Map", "<", "String", ",", "Object", ">", "map", ")", "{", "String", "strProperties", "=", "null", ";", "Properties", "properties", "=", "Utility", ".", "mapToProperties", "(", "map", ")", ";", "ByteAr...
Convert these java properties to a string. @param properties The java properties. @return The properties string.
[ "Convert", "these", "java", "properties", "to", "a", "string", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/PropertiesField.java#L266-L284
Whiley/WhileyCompiler
src/main/java/wyil/interpreter/Interpreter.java
Interpreter.executeIndirectInvoke
private RValue[] executeIndirectInvoke(Expr.IndirectInvoke expr, CallStack frame) { RValue.Lambda src = executeExpression(LAMBDA_T, expr.getSource(),frame); RValue[] arguments = executeExpressions(expr.getArguments(), frame); // Here we have to use the enclosing frame when the lambda was created. // The reason for this is that the lambda may try to access enclosing // variables in the scope it was created. frame = src.getFrame(); extractParameters(frame,arguments,src.getContext()); // Execute the method or function body Stmt body = src.getBody(); if(body instanceof Stmt.Block) { executeBlock((Stmt.Block) body, frame, new FunctionOrMethodScope(src.getContext())); // Extra the return values return packReturns(frame,src.getContext()); } else { RValue retval = executeExpression(ANY_T,(Expr) body, frame); return new RValue[]{retval}; } }
java
private RValue[] executeIndirectInvoke(Expr.IndirectInvoke expr, CallStack frame) { RValue.Lambda src = executeExpression(LAMBDA_T, expr.getSource(),frame); RValue[] arguments = executeExpressions(expr.getArguments(), frame); // Here we have to use the enclosing frame when the lambda was created. // The reason for this is that the lambda may try to access enclosing // variables in the scope it was created. frame = src.getFrame(); extractParameters(frame,arguments,src.getContext()); // Execute the method or function body Stmt body = src.getBody(); if(body instanceof Stmt.Block) { executeBlock((Stmt.Block) body, frame, new FunctionOrMethodScope(src.getContext())); // Extra the return values return packReturns(frame,src.getContext()); } else { RValue retval = executeExpression(ANY_T,(Expr) body, frame); return new RValue[]{retval}; } }
[ "private", "RValue", "[", "]", "executeIndirectInvoke", "(", "Expr", ".", "IndirectInvoke", "expr", ",", "CallStack", "frame", ")", "{", "RValue", ".", "Lambda", "src", "=", "executeExpression", "(", "LAMBDA_T", ",", "expr", ".", "getSource", "(", ")", ",", ...
Execute an IndirectInvoke bytecode instruction at a given point in the function or method body. This first checks the operand is a function reference, and then generates a recursive call to execute the given function. If the function does not exist, or is provided with the wrong number of arguments, then a runtime fault will occur. @param expr --- The expression to execute @param frame --- The current stack frame @param context --- Context in which bytecodes are executed @return
[ "Execute", "an", "IndirectInvoke", "bytecode", "instruction", "at", "a", "given", "point", "in", "the", "function", "or", "method", "body", ".", "This", "first", "checks", "the", "operand", "is", "a", "function", "reference", "and", "then", "generates", "a", ...
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/interpreter/Interpreter.java#L1144-L1162
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/utils/ValueMap.java
ValueMap.withInt
public ValueMap withInt(String key, int val) { return withNumber(key, Integer.valueOf(val)); }
java
public ValueMap withInt(String key, int val) { return withNumber(key, Integer.valueOf(val)); }
[ "public", "ValueMap", "withInt", "(", "String", "key", ",", "int", "val", ")", "{", "return", "withNumber", "(", "key", ",", "Integer", ".", "valueOf", "(", "val", ")", ")", ";", "}" ]
Sets the value of the specified key in the current ValueMap to the given value.
[ "Sets", "the", "value", "of", "the", "specified", "key", "in", "the", "current", "ValueMap", "to", "the", "given", "value", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/utils/ValueMap.java#L68-L70
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/LevelRipConverter.java
LevelRipConverter.searchForTile
private static Tile searchForTile(MapTile map, ImageBuffer tileSprite, int x, int y) { // Check each tile on each sheet for (final Integer sheet : map.getSheets()) { final Tile tile = checkTile(map, tileSprite, sheet, x, y); if (tile != null) { return tile; } } // No tile found return null; }
java
private static Tile searchForTile(MapTile map, ImageBuffer tileSprite, int x, int y) { // Check each tile on each sheet for (final Integer sheet : map.getSheets()) { final Tile tile = checkTile(map, tileSprite, sheet, x, y); if (tile != null) { return tile; } } // No tile found return null; }
[ "private", "static", "Tile", "searchForTile", "(", "MapTile", "map", ",", "ImageBuffer", "tileSprite", ",", "int", "x", ",", "int", "y", ")", "{", "// Check each tile on each sheet", "for", "(", "final", "Integer", "sheet", ":", "map", ".", "getSheets", "(", ...
Search current tile of image map by checking all surfaces. @param map The destination map reference. @param tileSprite The tiled sprite @param x The location x. @param y The location y. @return The tile found.
[ "Search", "current", "tile", "of", "image", "map", "by", "checking", "all", "surfaces", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/LevelRipConverter.java#L156-L170
pravega/pravega
controller/src/main/java/io/pravega/controller/server/SegmentHelper.java
SegmentHelper.sealSegment
public CompletableFuture<Boolean> sealSegment(final String scope, final String stream, final long segmentId, String delegationToken, final long clientRequestId) { final Controller.NodeUri uri = getSegmentUri(scope, stream, segmentId); final String qualifiedName = getQualifiedStreamSegmentName(scope, stream, segmentId); final long requestId = (clientRequestId == RequestTag.NON_EXISTENT_ID) ? idGenerator.get() : clientRequestId; return sealSegment(qualifiedName, uri, delegationToken, requestId); }
java
public CompletableFuture<Boolean> sealSegment(final String scope, final String stream, final long segmentId, String delegationToken, final long clientRequestId) { final Controller.NodeUri uri = getSegmentUri(scope, stream, segmentId); final String qualifiedName = getQualifiedStreamSegmentName(scope, stream, segmentId); final long requestId = (clientRequestId == RequestTag.NON_EXISTENT_ID) ? idGenerator.get() : clientRequestId; return sealSegment(qualifiedName, uri, delegationToken, requestId); }
[ "public", "CompletableFuture", "<", "Boolean", ">", "sealSegment", "(", "final", "String", "scope", ",", "final", "String", "stream", ",", "final", "long", "segmentId", ",", "String", "delegationToken", ",", "final", "long", "clientRequestId", ")", "{", "final",...
This method sends segment sealed message for the specified segment. @param scope stream scope @param stream stream name @param segmentId number of segment to be sealed @param delegationToken the token to be presented to segmentstore. @param clientRequestId client-generated id for end-to-end tracing @return void
[ "This", "method", "sends", "segment", "sealed", "message", "for", "the", "specified", "segment", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/SegmentHelper.java#L276-L285
mongodb/stitch-android-sdk
server/services/mongodb-remote/src/main/java/com/mongodb/stitch/server/services/mongodb/remote/internal/RemoteMongoCollectionImpl.java
RemoteMongoCollectionImpl.findOneAndUpdate
public DocumentT findOneAndUpdate(final Bson filter, final Bson update) { return proxy.findOneAndUpdate(filter, update); }
java
public DocumentT findOneAndUpdate(final Bson filter, final Bson update) { return proxy.findOneAndUpdate(filter, update); }
[ "public", "DocumentT", "findOneAndUpdate", "(", "final", "Bson", "filter", ",", "final", "Bson", "update", ")", "{", "return", "proxy", ".", "findOneAndUpdate", "(", "filter", ",", "update", ")", ";", "}" ]
Finds a document in the collection and performs the given update. @param filter the query filter @param update the update document @return the resulting document
[ "Finds", "a", "document", "in", "the", "collection", "and", "performs", "the", "given", "update", "." ]
train
https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/server/services/mongodb-remote/src/main/java/com/mongodb/stitch/server/services/mongodb/remote/internal/RemoteMongoCollectionImpl.java#L368-L370
jenkinsci/ghprb-plugin
src/main/java/org/jenkinsci/plugins/ghprb/Ghprb.java
Ghprb.checkSkipBuildInString
private String checkSkipBuildInString(Map<Pattern, String> patterns, String string) { // check for skip build phrase in the passed string if (!patterns.isEmpty() && StringUtils.isNotBlank(string)) { for (Map.Entry<Pattern, String> e : patterns.entrySet()) { if (e.getKey().matcher(string).matches()) { return e.getValue(); } } } return null; }
java
private String checkSkipBuildInString(Map<Pattern, String> patterns, String string) { // check for skip build phrase in the passed string if (!patterns.isEmpty() && StringUtils.isNotBlank(string)) { for (Map.Entry<Pattern, String> e : patterns.entrySet()) { if (e.getKey().matcher(string).matches()) { return e.getValue(); } } } return null; }
[ "private", "String", "checkSkipBuildInString", "(", "Map", "<", "Pattern", ",", "String", ">", "patterns", ",", "String", "string", ")", "{", "// check for skip build phrase in the passed string", "if", "(", "!", "patterns", ".", "isEmpty", "(", ")", "&&", "String...
Checks for skip pattern in the passed string @param patterns The map of Patter to String values @param string The string we're looking for the phrase in @return the skip value or null if we don't find it
[ "Checks", "for", "skip", "pattern", "in", "the", "passed", "string" ]
train
https://github.com/jenkinsci/ghprb-plugin/blob/b972d3b94ebbe6d40542c2771407e297bff8430b/src/main/java/org/jenkinsci/plugins/ghprb/Ghprb.java#L184-L194
jcustenborder/connect-utils
connect-utils/src/main/java/com/github/jcustenborder/kafka/connect/utils/config/ConfigUtils.java
ConfigUtils.inetSocketAddress
public static InetSocketAddress inetSocketAddress(AbstractConfig config, String key) { Preconditions.checkNotNull(config, "config cannot be null"); String value = config.getString(key); return parseInetSocketAddress(value); }
java
public static InetSocketAddress inetSocketAddress(AbstractConfig config, String key) { Preconditions.checkNotNull(config, "config cannot be null"); String value = config.getString(key); return parseInetSocketAddress(value); }
[ "public", "static", "InetSocketAddress", "inetSocketAddress", "(", "AbstractConfig", "config", ",", "String", "key", ")", "{", "Preconditions", ".", "checkNotNull", "(", "config", ",", "\"config cannot be null\"", ")", ";", "String", "value", "=", "config", ".", "...
Method is used to return an InetSocketAddress from a hostname:port string. @param config config to read the value from @param key key for the value @return InetSocketAddress for the supplied string.
[ "Method", "is", "used", "to", "return", "an", "InetSocketAddress", "from", "a", "hostname", ":", "port", "string", "." ]
train
https://github.com/jcustenborder/connect-utils/blob/19add138921f59ffcc85282d7aad551eeb582370/connect-utils/src/main/java/com/github/jcustenborder/kafka/connect/utils/config/ConfigUtils.java#L116-L120
GerdHolz/TOVAL
src/de/invation/code/toval/os/WindowsUtils.java
WindowsUtils.registerFileExtension
@Override public boolean registerFileExtension(String fileTypeName, String fileTypeExtension, String application) throws RegistryException, OSException { if (!isApplicable()) { return false; } // sanitize file extension fileTypeExtension = sanitizeFileExtension(fileTypeExtension); // create path to linked application String applicationPath = toWindowsPath(new File(application).getAbsolutePath()); // Set registry hive WindowsRegistry.Hive hive = WindowsRegistry.Hive.HKEY_CURRENT_USER; // create programmatic identifier WindowsRegistry.createKey(hive.getName() + SOFTWARE_CLASSES_PATH + fileTypeName); // create verb to open file type WindowsRegistry.createKey(hive.getName() + SOFTWARE_CLASSES_PATH + fileTypeName + SHELL_OPEN_COMMAND_PATH); WindowsRegistry.writeValue(hive.getName() + SOFTWARE_CLASSES_PATH + fileTypeName + SHELL_OPEN_COMMAND_PATH, WindowsRegistry.DEFAULT_KEY_NAME, "\"" + applicationPath + "\" \"%1\""); // associate with file extension WindowsRegistry.createKey(hive.getName() + SOFTWARE_CLASSES_PATH + fileTypeExtension); WindowsRegistry.writeValue(hive.getName() + SOFTWARE_CLASSES_PATH + fileTypeExtension, WindowsRegistry.DEFAULT_KEY_NAME, fileTypeName); return true; }
java
@Override public boolean registerFileExtension(String fileTypeName, String fileTypeExtension, String application) throws RegistryException, OSException { if (!isApplicable()) { return false; } // sanitize file extension fileTypeExtension = sanitizeFileExtension(fileTypeExtension); // create path to linked application String applicationPath = toWindowsPath(new File(application).getAbsolutePath()); // Set registry hive WindowsRegistry.Hive hive = WindowsRegistry.Hive.HKEY_CURRENT_USER; // create programmatic identifier WindowsRegistry.createKey(hive.getName() + SOFTWARE_CLASSES_PATH + fileTypeName); // create verb to open file type WindowsRegistry.createKey(hive.getName() + SOFTWARE_CLASSES_PATH + fileTypeName + SHELL_OPEN_COMMAND_PATH); WindowsRegistry.writeValue(hive.getName() + SOFTWARE_CLASSES_PATH + fileTypeName + SHELL_OPEN_COMMAND_PATH, WindowsRegistry.DEFAULT_KEY_NAME, "\"" + applicationPath + "\" \"%1\""); // associate with file extension WindowsRegistry.createKey(hive.getName() + SOFTWARE_CLASSES_PATH + fileTypeExtension); WindowsRegistry.writeValue(hive.getName() + SOFTWARE_CLASSES_PATH + fileTypeExtension, WindowsRegistry.DEFAULT_KEY_NAME, fileTypeName); return true; }
[ "@", "Override", "public", "boolean", "registerFileExtension", "(", "String", "fileTypeName", ",", "String", "fileTypeExtension", ",", "String", "application", ")", "throws", "RegistryException", ",", "OSException", "{", "if", "(", "!", "isApplicable", "(", ")", "...
Registers a new file extension in the Windows registry. @param fileTypeName Name of the file extension. Must be atomic, e.g. <code>foocorp.fooapp.v1</code>. @param fileTypeExtension File extension with leading dot, e.g. <code>.bar</code>. @param application Path to the application, which should open the new file extension. @return <code>true</code> if registration was successful, <code>false</code> otherwise. @throws RegistryException If keys can't be created or values can't be written.
[ "Registers", "a", "new", "file", "extension", "in", "the", "Windows", "registry", "." ]
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/os/WindowsUtils.java#L187-L213
Azure/azure-sdk-for-java
containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/OpenShiftManagedClustersInner.java
OpenShiftManagedClustersInner.beginUpdateTagsAsync
public Observable<OpenShiftManagedClusterInner> beginUpdateTagsAsync(String resourceGroupName, String resourceName) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<OpenShiftManagedClusterInner>, OpenShiftManagedClusterInner>() { @Override public OpenShiftManagedClusterInner call(ServiceResponse<OpenShiftManagedClusterInner> response) { return response.body(); } }); }
java
public Observable<OpenShiftManagedClusterInner> beginUpdateTagsAsync(String resourceGroupName, String resourceName) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<OpenShiftManagedClusterInner>, OpenShiftManagedClusterInner>() { @Override public OpenShiftManagedClusterInner call(ServiceResponse<OpenShiftManagedClusterInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OpenShiftManagedClusterInner", ">", "beginUpdateTagsAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ")", "{", "return", "beginUpdateTagsWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ")", "....
Updates tags on an OpenShift managed cluster. Updates an OpenShift managed cluster with the specified tags. @param resourceGroupName The name of the resource group. @param resourceName The name of the OpenShift managed cluster resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OpenShiftManagedClusterInner object
[ "Updates", "tags", "on", "an", "OpenShift", "managed", "cluster", ".", "Updates", "an", "OpenShift", "managed", "cluster", "with", "the", "specified", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/OpenShiftManagedClustersInner.java#L797-L804
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java
ImmatureClass.sawOpcode
@Override public void sawOpcode(int seen) { if ((seen == Const.INVOKEVIRTUAL) && "printStackTrace".equals(getNameConstantOperand()) && SignatureBuilder.SIG_VOID_TO_VOID.equals(getSigConstantOperand())) { bugReporter .reportBug(new BugInstance(this, BugType.IMC_IMMATURE_CLASS_PRINTSTACKTRACE.name(), NORMAL_PRIORITY) .addClass(this).addMethod(this).addSourceLine(this)); } }
java
@Override public void sawOpcode(int seen) { if ((seen == Const.INVOKEVIRTUAL) && "printStackTrace".equals(getNameConstantOperand()) && SignatureBuilder.SIG_VOID_TO_VOID.equals(getSigConstantOperand())) { bugReporter .reportBug(new BugInstance(this, BugType.IMC_IMMATURE_CLASS_PRINTSTACKTRACE.name(), NORMAL_PRIORITY) .addClass(this).addMethod(this).addSourceLine(this)); } }
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "if", "(", "(", "seen", "==", "Const", ".", "INVOKEVIRTUAL", ")", "&&", "\"printStackTrace\"", ".", "equals", "(", "getNameConstantOperand", "(", ")", ")", "&&", "SignatureBuilder"...
implements the visitor to check for calls to Throwable.printStackTrace() @param seen the currently parsed opcode
[ "implements", "the", "visitor", "to", "check", "for", "calls", "to", "Throwable", ".", "printStackTrace", "()" ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java#L253-L261
SUSE/salt-netapi-client
src/main/java/com/suse/salt/netapi/calls/modules/File.java
File.getHash
public static LocalCall<String> getHash(String path, HashType form) { return getHash(path, Optional.of(form), Optional.empty()); }
java
public static LocalCall<String> getHash(String path, HashType form) { return getHash(path, Optional.of(form), Optional.empty()); }
[ "public", "static", "LocalCall", "<", "String", ">", "getHash", "(", "String", "path", ",", "HashType", "form", ")", "{", "return", "getHash", "(", "path", ",", "Optional", ".", "of", "(", "form", ")", ",", "Optional", ".", "empty", "(", ")", ")", ";...
Get the hash sum of a file @param path Path to the file or directory @param form Desired sum format @return The {@link LocalCall} object to make the call
[ "Get", "the", "hash", "sum", "of", "a", "file" ]
train
https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/modules/File.java#L131-L133
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebProviderAuthenticatorProxy.java
WebProviderAuthenticatorProxy.getSSOAuthenticator
public WebAuthenticator getSSOAuthenticator(WebRequest webRequest, String ssoCookieName) { SecurityMetadata securityMetadata = webRequest.getSecurityMetadata(); SecurityService securityService = securityServiceRef.getService(); SSOCookieHelper cookieHelper; if (ssoCookieName != null) { cookieHelper = new SSOCookieHelperImpl(webAppSecurityConfig, ssoCookieName); } else { cookieHelper = webAppSecurityConfig.createSSOCookieHelper(); } return new SSOAuthenticator(securityService.getAuthenticationService(), securityMetadata, webAppSecurityConfig, cookieHelper); }
java
public WebAuthenticator getSSOAuthenticator(WebRequest webRequest, String ssoCookieName) { SecurityMetadata securityMetadata = webRequest.getSecurityMetadata(); SecurityService securityService = securityServiceRef.getService(); SSOCookieHelper cookieHelper; if (ssoCookieName != null) { cookieHelper = new SSOCookieHelperImpl(webAppSecurityConfig, ssoCookieName); } else { cookieHelper = webAppSecurityConfig.createSSOCookieHelper(); } return new SSOAuthenticator(securityService.getAuthenticationService(), securityMetadata, webAppSecurityConfig, cookieHelper); }
[ "public", "WebAuthenticator", "getSSOAuthenticator", "(", "WebRequest", "webRequest", ",", "String", "ssoCookieName", ")", "{", "SecurityMetadata", "securityMetadata", "=", "webRequest", ".", "getSecurityMetadata", "(", ")", ";", "SecurityService", "securityService", "=",...
Create an instance of SSOAuthenticator. @param webRequest @return The SSOAuthenticator, or {@code null} if it could not be created.
[ "Create", "an", "instance", "of", "SSOAuthenticator", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebProviderAuthenticatorProxy.java#L387-L397
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/TriggersInner.java
TriggersInner.createOrUpdateAsync
public Observable<TriggerInner> createOrUpdateAsync(String deviceName, String name, String resourceGroupName, TriggerInner trigger) { return createOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, trigger).map(new Func1<ServiceResponse<TriggerInner>, TriggerInner>() { @Override public TriggerInner call(ServiceResponse<TriggerInner> response) { return response.body(); } }); }
java
public Observable<TriggerInner> createOrUpdateAsync(String deviceName, String name, String resourceGroupName, TriggerInner trigger) { return createOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, trigger).map(new Func1<ServiceResponse<TriggerInner>, TriggerInner>() { @Override public TriggerInner call(ServiceResponse<TriggerInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "TriggerInner", ">", "createOrUpdateAsync", "(", "String", "deviceName", ",", "String", "name", ",", "String", "resourceGroupName", ",", "TriggerInner", "trigger", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "deviceNam...
Creates or updates a trigger. @param deviceName Creates or updates a trigger @param name The trigger name. @param resourceGroupName The resource group name. @param trigger The trigger. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "or", "updates", "a", "trigger", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/TriggersInner.java#L473-L480
apache/reef
lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/uploader/JobFolder.java
JobFolder.uploadAsLocalResource
public LocalResource uploadAsLocalResource(final File localFile, final LocalResourceType type) throws IOException { final Path remoteFile = upload(localFile); return getLocalResourceForPath(remoteFile, type); }
java
public LocalResource uploadAsLocalResource(final File localFile, final LocalResourceType type) throws IOException { final Path remoteFile = upload(localFile); return getLocalResourceForPath(remoteFile, type); }
[ "public", "LocalResource", "uploadAsLocalResource", "(", "final", "File", "localFile", ",", "final", "LocalResourceType", "type", ")", "throws", "IOException", "{", "final", "Path", "remoteFile", "=", "upload", "(", "localFile", ")", ";", "return", "getLocalResource...
Shortcut to first upload the file and then form a LocalResource for the YARN submission. @param localFile File on local FS to upload to the (remote) DFS. @return an instance of a LocalResource on (remote) DFS. @throws IOException if unable to upload the file or local file cannot be read.
[ "Shortcut", "to", "first", "upload", "the", "file", "and", "then", "form", "a", "LocalResource", "for", "the", "YARN", "submission", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/uploader/JobFolder.java#L92-L95
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java
SDMath.iamax
public SDVariable iamax(String name, SDVariable in, int... dimensions) { return iamax(name, in, false, dimensions); }
java
public SDVariable iamax(String name, SDVariable in, int... dimensions) { return iamax(name, in, false, dimensions); }
[ "public", "SDVariable", "iamax", "(", "String", "name", ",", "SDVariable", "in", ",", "int", "...", "dimensions", ")", "{", "return", "iamax", "(", "name", ",", "in", ",", "false", ",", "dimensions", ")", ";", "}" ]
Index of the max absolute value: argmax(abs(in)) @see SameDiff#argmax(String, SDVariable, boolean, int...)
[ "Index", "of", "the", "max", "absolute", "value", ":", "argmax", "(", "abs", "(", "in", "))" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java#L1212-L1214
jkrasnay/sqlbuilder
src/main/java/ca/krasnay/sqlbuilder/orm/ReflectionUtils.java
ReflectionUtils.setFieldValue
public static void setFieldValue(Object object, String fieldName, Object value) { try { getDeclaredFieldInHierarchy(object.getClass(), fieldName).set(object, value); } catch (IllegalArgumentException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
java
public static void setFieldValue(Object object, String fieldName, Object value) { try { getDeclaredFieldInHierarchy(object.getClass(), fieldName).set(object, value); } catch (IllegalArgumentException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
[ "public", "static", "void", "setFieldValue", "(", "Object", "object", ",", "String", "fieldName", ",", "Object", "value", ")", "{", "try", "{", "getDeclaredFieldInHierarchy", "(", "object", ".", "getClass", "(", ")", ",", "fieldName", ")", ".", "set", "(", ...
Convenience method for setting the value of a private object field, without the stress of checked exceptions in the reflection API. @param object Object containing the field. @param fieldName Name of the field to set. @param value Value to which to set the field.
[ "Convenience", "method", "for", "setting", "the", "value", "of", "a", "private", "object", "field", "without", "the", "stress", "of", "checked", "exceptions", "in", "the", "reflection", "API", "." ]
train
https://github.com/jkrasnay/sqlbuilder/blob/8e6acedc51cfad0527263376af51e1ef052f7147/src/main/java/ca/krasnay/sqlbuilder/orm/ReflectionUtils.java#L139-L147
grpc/grpc-java
examples/src/main/java/io/grpc/examples/advanced/JsonMarshaller.java
JsonMarshaller.jsonMarshaller
public static <T extends Message> Marshaller<T> jsonMarshaller(final T defaultInstance) { final Parser parser = JsonFormat.parser(); final Printer printer = JsonFormat.printer(); return jsonMarshaller(defaultInstance, parser, printer); }
java
public static <T extends Message> Marshaller<T> jsonMarshaller(final T defaultInstance) { final Parser parser = JsonFormat.parser(); final Printer printer = JsonFormat.printer(); return jsonMarshaller(defaultInstance, parser, printer); }
[ "public", "static", "<", "T", "extends", "Message", ">", "Marshaller", "<", "T", ">", "jsonMarshaller", "(", "final", "T", "defaultInstance", ")", "{", "final", "Parser", "parser", "=", "JsonFormat", ".", "parser", "(", ")", ";", "final", "Printer", "print...
Create a {@code Marshaller} for json protos of the same type as {@code defaultInstance}. <p>This is an unstable API and has not been optimized yet for performance.
[ "Create", "a", "{", "@code", "Marshaller", "}", "for", "json", "protos", "of", "the", "same", "type", "as", "{", "@code", "defaultInstance", "}", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/examples/src/main/java/io/grpc/examples/advanced/JsonMarshaller.java#L47-L51
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/serializer/SARLSyntacticSequencer.java
SARLSyntacticSequencer.emit_XExpressionInClosure_SemicolonKeyword_1_1_q
protected void emit_XExpressionInClosure_SemicolonKeyword_1_1_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) { acceptNodes(transition, nodes); }
java
protected void emit_XExpressionInClosure_SemicolonKeyword_1_1_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) { acceptNodes(transition, nodes); }
[ "protected", "void", "emit_XExpressionInClosure_SemicolonKeyword_1_1_q", "(", "EObject", "semanticObject", ",", "ISynNavigable", "transition", ",", "List", "<", "INode", ">", "nodes", ")", "{", "acceptNodes", "(", "transition", ",", "nodes", ")", ";", "}" ]
Ambiguous syntax: ';'? This ambiguous syntax occurs at: expressions+=XExpressionOrVarDeclaration (ambiguity) (rule end) expressions+=XExpressionOrVarDeclaration (ambiguity) expressions+=XExpressionOrVarDeclaration
[ "Ambiguous", "syntax", ":", ";", "?" ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/serializer/SARLSyntacticSequencer.java#L558-L560
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.license_windows_serviceName_upgrade_GET
public ArrayList<String> license_windows_serviceName_upgrade_GET(String serviceName, OvhWindowsSqlVersionEnum sqlVersion, OvhWindowsOsVersionEnum version) throws IOException { String qPath = "/order/license/windows/{serviceName}/upgrade"; StringBuilder sb = path(qPath, serviceName); query(sb, "sqlVersion", sqlVersion); query(sb, "version", version); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> license_windows_serviceName_upgrade_GET(String serviceName, OvhWindowsSqlVersionEnum sqlVersion, OvhWindowsOsVersionEnum version) throws IOException { String qPath = "/order/license/windows/{serviceName}/upgrade"; StringBuilder sb = path(qPath, serviceName); query(sb, "sqlVersion", sqlVersion); query(sb, "version", version); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "license_windows_serviceName_upgrade_GET", "(", "String", "serviceName", ",", "OvhWindowsSqlVersionEnum", "sqlVersion", ",", "OvhWindowsOsVersionEnum", "version", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ord...
Get allowed durations for 'upgrade' option REST: GET /order/license/windows/{serviceName}/upgrade @param version [required] The windows version you want to enable on your windows license @param sqlVersion [required] The SQL Server version to enable on this license Windows license @param serviceName [required] The name of your Windows license
[ "Get", "allowed", "durations", "for", "upgrade", "option" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L1228-L1235
apache/incubator-gobblin
gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/store/hdfs/SimpleHDFSStoreMetadata.java
SimpleHDFSStoreMetadata.readMetadata
Config readMetadata() throws IOException { if (!isStoreMetadataFilePresent()) { throw new IOException("Store metadata file does not exist at " + this.storeMetadataFilePath); } try (InputStream storeMetadataInputStream = this.fs.open(this.storeMetadataFilePath)) { return ConfigFactory.parseReader(new InputStreamReader(storeMetadataInputStream, Charsets.UTF_8)); } }
java
Config readMetadata() throws IOException { if (!isStoreMetadataFilePresent()) { throw new IOException("Store metadata file does not exist at " + this.storeMetadataFilePath); } try (InputStream storeMetadataInputStream = this.fs.open(this.storeMetadataFilePath)) { return ConfigFactory.parseReader(new InputStreamReader(storeMetadataInputStream, Charsets.UTF_8)); } }
[ "Config", "readMetadata", "(", ")", "throws", "IOException", "{", "if", "(", "!", "isStoreMetadataFilePresent", "(", ")", ")", "{", "throw", "new", "IOException", "(", "\"Store metadata file does not exist at \"", "+", "this", ".", "storeMetadataFilePath", ")", ";",...
Get all metadata from the {@link #CONFIG_STORE_METADATA_FILENAME} file at {@link #storeMetadataFilePath}
[ "Get", "all", "metadata", "from", "the", "{", "@link", "#CONFIG_STORE_METADATA_FILENAME", "}", "file", "at", "{", "@link", "#storeMetadataFilePath", "}" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/store/hdfs/SimpleHDFSStoreMetadata.java#L130-L137
pip-services3-java/pip-services3-components-java
src/org/pipservices3/components/log/Logger.java
Logger.setReferences
public void setReferences(IReferences references) { Object contextInfo = references.getOneOptional(new Descriptor("pip-services3", "context-info", "*", "*", "1.0")); if (contextInfo instanceof ContextInfo && contextInfo != null && _source == null) _source = ((ContextInfo) contextInfo).getName(); }
java
public void setReferences(IReferences references) { Object contextInfo = references.getOneOptional(new Descriptor("pip-services3", "context-info", "*", "*", "1.0")); if (contextInfo instanceof ContextInfo && contextInfo != null && _source == null) _source = ((ContextInfo) contextInfo).getName(); }
[ "public", "void", "setReferences", "(", "IReferences", "references", ")", "{", "Object", "contextInfo", "=", "references", ".", "getOneOptional", "(", "new", "Descriptor", "(", "\"pip-services3\"", ",", "\"context-info\"", ",", "\"*\"", ",", "\"*\"", ",", "\"1.0\"...
Sets references to dependent components. @param references references to locate the component dependencies.
[ "Sets", "references", "to", "dependent", "components", "." ]
train
https://github.com/pip-services3-java/pip-services3-components-java/blob/122352fbf9b208f6417376da7b8ad725bc85ee58/src/org/pipservices3/components/log/Logger.java#L50-L54
validator/validator
src/nu/validator/gnu/xml/aelfred2/XmlParser.java
XmlParser.parseDocument
private void parseDocument() throws Exception { try { // added by MHK boolean sawDTD = parseProlog(); require('<'); parseElement(!sawDTD); } catch (EOFException ee) { // added by MHK fatal("premature end of file", "[EOF]", null); } try { parseMisc(); // skip all white, PIs, and comments char c = readCh(); // if this doesn't throw an exception... fatal("unexpected characters after document end", c, null); } catch (EOFException e) { if (characterHandler != null) { characterHandler.end(); } if (normalizationChecker != null) { normalizationChecker.end(); } return; } }
java
private void parseDocument() throws Exception { try { // added by MHK boolean sawDTD = parseProlog(); require('<'); parseElement(!sawDTD); } catch (EOFException ee) { // added by MHK fatal("premature end of file", "[EOF]", null); } try { parseMisc(); // skip all white, PIs, and comments char c = readCh(); // if this doesn't throw an exception... fatal("unexpected characters after document end", c, null); } catch (EOFException e) { if (characterHandler != null) { characterHandler.end(); } if (normalizationChecker != null) { normalizationChecker.end(); } return; } }
[ "private", "void", "parseDocument", "(", ")", "throws", "Exception", "{", "try", "{", "// added by MHK", "boolean", "sawDTD", "=", "parseProlog", "(", ")", ";", "require", "(", "'", "'", ")", ";", "parseElement", "(", "!", "sawDTD", ")", ";", "}", "catch...
Parse an XML document. <pre> [1] document ::= prolog element Misc* </pre> <p> This is the top-level parsing function for a single XML document. As a minimum, a well-formed document must have a document element, and a valid document must have a prolog (one with doctype) as well.
[ "Parse", "an", "XML", "document", "." ]
train
https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/gnu/xml/aelfred2/XmlParser.java#L613-L635
gaixie/jibu-core
src/main/java/org/gaixie/jibu/utils/SQLBuilder.java
SQLBuilder.getSortClause
public static String getSortClause (String sql,Criteria crt) { if (null == sql ) return null; if (null != crt && null != crt.getSort()) { String[] sorts = crt.getSort().split(","); String s = ""; for(String sort: sorts) { if(s.length()==0) s = sort + " "+crt.getDir(); else s = s + " , " +sort + " "+crt.getDir(); } return sql + " ORDER BY " + s; } return sql; }
java
public static String getSortClause (String sql,Criteria crt) { if (null == sql ) return null; if (null != crt && null != crt.getSort()) { String[] sorts = crt.getSort().split(","); String s = ""; for(String sort: sorts) { if(s.length()==0) s = sort + " "+crt.getDir(); else s = s + " , " +sort + " "+crt.getDir(); } return sql + " ORDER BY " + s; } return sql; }
[ "public", "static", "String", "getSortClause", "(", "String", "sql", ",", "Criteria", "crt", ")", "{", "if", "(", "null", "==", "sql", ")", "return", "null", ";", "if", "(", "null", "!=", "crt", "&&", "null", "!=", "crt", ".", "getSort", "(", ")", ...
通过 criteria 生成排序的 sql 语句。数据库类型无关。 <p> 注意,如果结合分页,要保证在分页语句之前条用。</p> @param sql 要处理语句。 @param crt 传递排序信息。 @return 有效的 sql语句。
[ "通过", "criteria", "生成排序的", "sql", "语句。数据库类型无关。", "<p", ">", "注意,如果结合分页,要保证在分页语句之前条用。<", "/", "p", ">" ]
train
https://github.com/gaixie/jibu-core/blob/d5462f2883321c82d898c8752b7e5eba4b7dc184/src/main/java/org/gaixie/jibu/utils/SQLBuilder.java#L199-L214
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/Sphere3f.java
Sphere3f.set
@Override public void set(double x, double y, double z, double radius1) { this.cx = x; this.cy = y; this.cz = z; this.radius = Math.abs(radius1); }
java
@Override public void set(double x, double y, double z, double radius1) { this.cx = x; this.cy = y; this.cz = z; this.radius = Math.abs(radius1); }
[ "@", "Override", "public", "void", "set", "(", "double", "x", ",", "double", "y", ",", "double", "z", ",", "double", "radius1", ")", "{", "this", ".", "cx", "=", "x", ";", "this", ".", "cy", "=", "y", ";", "this", ".", "cz", "=", "z", ";", "t...
Change the frame of the sphere. @param x @param y @param z @param radius1
[ "Change", "the", "frame", "of", "the", "sphere", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Sphere3f.java#L67-L73
buschmais/jqa-java-plugin
src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/ClassVisitor.java
ClassVisitor.getVisibility
private VisibilityModifier getVisibility(int flags) { if (hasFlag(flags, Opcodes.ACC_PRIVATE)) { return VisibilityModifier.PRIVATE; } else if (hasFlag(flags, Opcodes.ACC_PROTECTED)) { return VisibilityModifier.PROTECTED; } else if (hasFlag(flags, Opcodes.ACC_PUBLIC)) { return VisibilityModifier.PUBLIC; } else { return VisibilityModifier.DEFAULT; } }
java
private VisibilityModifier getVisibility(int flags) { if (hasFlag(flags, Opcodes.ACC_PRIVATE)) { return VisibilityModifier.PRIVATE; } else if (hasFlag(flags, Opcodes.ACC_PROTECTED)) { return VisibilityModifier.PROTECTED; } else if (hasFlag(flags, Opcodes.ACC_PUBLIC)) { return VisibilityModifier.PUBLIC; } else { return VisibilityModifier.DEFAULT; } }
[ "private", "VisibilityModifier", "getVisibility", "(", "int", "flags", ")", "{", "if", "(", "hasFlag", "(", "flags", ",", "Opcodes", ".", "ACC_PRIVATE", ")", ")", "{", "return", "VisibilityModifier", ".", "PRIVATE", ";", "}", "else", "if", "(", "hasFlag", ...
Returns the AccessModifier for the flag pattern. @param flags the flags @return the AccessModifier
[ "Returns", "the", "AccessModifier", "for", "the", "flag", "pattern", "." ]
train
https://github.com/buschmais/jqa-java-plugin/blob/4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54/src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/ClassVisitor.java#L243-L253
jimmoores/quandl4j
core/src/main/java/com/jimmoores/quandl/util/PrettyPrinter.java
PrettyPrinter.toPrettyPrintedString
public static String toPrettyPrintedString(final Map<String, HeaderDefinition> multiHeaderDefinitionResult) { ArgumentChecker.notNull(multiHeaderDefinitionResult, "multiHeaderDefinitionResult"); StringBuilder sb = new StringBuilder(); int max = 0; for (String each : multiHeaderDefinitionResult.keySet()) { max = Math.max(max, each.length()); } for (Map.Entry<String, HeaderDefinition> entry : multiHeaderDefinitionResult.entrySet()) { String quandlCode = entry.getKey(); HeaderDefinition headerDefinition = entry.getValue(); sb.append(quandlCode); sb.append(repeat(max - quandlCode.length(), ' ')); // indent sb.append(" => "); Iterator<String> iterator = headerDefinition.iterator(); while (iterator.hasNext()) { sb.append(iterator.next()); if (iterator.hasNext()) { sb.append(", "); } } sb.append("\n"); } return sb.toString(); }
java
public static String toPrettyPrintedString(final Map<String, HeaderDefinition> multiHeaderDefinitionResult) { ArgumentChecker.notNull(multiHeaderDefinitionResult, "multiHeaderDefinitionResult"); StringBuilder sb = new StringBuilder(); int max = 0; for (String each : multiHeaderDefinitionResult.keySet()) { max = Math.max(max, each.length()); } for (Map.Entry<String, HeaderDefinition> entry : multiHeaderDefinitionResult.entrySet()) { String quandlCode = entry.getKey(); HeaderDefinition headerDefinition = entry.getValue(); sb.append(quandlCode); sb.append(repeat(max - quandlCode.length(), ' ')); // indent sb.append(" => "); Iterator<String> iterator = headerDefinition.iterator(); while (iterator.hasNext()) { sb.append(iterator.next()); if (iterator.hasNext()) { sb.append(", "); } } sb.append("\n"); } return sb.toString(); }
[ "public", "static", "String", "toPrettyPrintedString", "(", "final", "Map", "<", "String", ",", "HeaderDefinition", ">", "multiHeaderDefinitionResult", ")", "{", "ArgumentChecker", ".", "notNull", "(", "multiHeaderDefinitionResult", ",", "\"multiHeaderDefinitionResult\"", ...
Pretty print a map of String to HeaderDefinition (see QuandlSession.getMultipleHeaderDefinition) Throws a QuandlRuntimeException if it can't render the JSONObject to a String. @param multiHeaderDefinitionResult the pre-parsed JSON object to pretty-print, not null @return a String representation of the object, probably multi-line.
[ "Pretty", "print", "a", "map", "of", "String", "to", "HeaderDefinition", "(", "see", "QuandlSession", ".", "getMultipleHeaderDefinition", ")", "Throws", "a", "QuandlRuntimeException", "if", "it", "can", "t", "render", "the", "JSONObject", "to", "a", "String", "....
train
https://github.com/jimmoores/quandl4j/blob/5d67ae60279d889da93ae7aa3bf6b7d536f88822/core/src/main/java/com/jimmoores/quandl/util/PrettyPrinter.java#L77-L100
geomajas/geomajas-project-geometry
core/src/main/java/org/geomajas/geometry/service/GeometryService.java
GeometryService.isValid
@Deprecated public static boolean isValid(Geometry geometry, int[] index) { return isValid(geometry, toIndex(geometry.getGeometryType(), index)); }
java
@Deprecated public static boolean isValid(Geometry geometry, int[] index) { return isValid(geometry, toIndex(geometry.getGeometryType(), index)); }
[ "@", "Deprecated", "public", "static", "boolean", "isValid", "(", "Geometry", "geometry", ",", "int", "[", "]", "index", ")", "{", "return", "isValid", "(", "geometry", ",", "toIndex", "(", "geometry", ".", "getGeometryType", "(", ")", ",", "index", ")", ...
Validates a geometry, focusing on changes at a specific sub-level of the geometry. The sublevel is indicated by passing an array of indexes. The array should uniquely determine a coordinate or subgeometry (linear ring) by recursing through the geometry tree. The only checks are on intersection and containment, we don't check on too few coordinates as we want to support incremental creation of polygons. @param geometry The geometry to check. @param index an array of indexes, points to edge, ring, polygon, etc... @return True or false. @since 1.2.0 @deprecated use {@link #isValid(Geometry, GeometryIndex)} instead
[ "Validates", "a", "geometry", "focusing", "on", "changes", "at", "a", "specific", "sub", "-", "level", "of", "the", "geometry", ".", "The", "sublevel", "is", "indicated", "by", "passing", "an", "array", "of", "indexes", ".", "The", "array", "should", "uniq...
train
https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/GeometryService.java#L261-L264
sahan/IckleBot
icklebot/src/main/java/com/lonepulse/icklebot/util/PermissionUtils.java
PermissionUtils.areAllGranted
public static boolean areAllGranted(Object context, Set<String> permissions) { for (String permission : permissions) { if(ContextUtils.discover(context).checkCallingOrSelfPermission(permission) == PackageManager.PERMISSION_DENIED) { return false; } } return true; }
java
public static boolean areAllGranted(Object context, Set<String> permissions) { for (String permission : permissions) { if(ContextUtils.discover(context).checkCallingOrSelfPermission(permission) == PackageManager.PERMISSION_DENIED) { return false; } } return true; }
[ "public", "static", "boolean", "areAllGranted", "(", "Object", "context", ",", "Set", "<", "String", ">", "permissions", ")", "{", "for", "(", "String", "permission", ":", "permissions", ")", "{", "if", "(", "ContextUtils", ".", "discover", "(", "context", ...
<p>Takes a set of permissions and determines if all of them are granted.</p> <p>Use {@link Manifest.permission} to reference permission constants.</p> @param context the permissible {@link Context} @param permissions the set of {@link permission}s to test @return {@code true} if all the permissions are granted @since 1.1.0
[ "<p", ">", "Takes", "a", "set", "of", "permissions", "and", "determines", "if", "all", "of", "them", "are", "granted", ".", "<", "/", "p", ">" ]
train
https://github.com/sahan/IckleBot/blob/a19003ceb3ad7c7ee508dc23a8cb31b5676aa499/icklebot/src/main/java/com/lonepulse/icklebot/util/PermissionUtils.java#L63-L74
google/closure-compiler
src/com/google/javascript/jscomp/NodeUtil.java
NodeUtil.isNameDeclOrSimpleAssignLhs
public static boolean isNameDeclOrSimpleAssignLhs(Node n, Node parent) { return (parent.isAssign() && parent.getFirstChild() == n) || NodeUtil.isNameDeclaration(parent); }
java
public static boolean isNameDeclOrSimpleAssignLhs(Node n, Node parent) { return (parent.isAssign() && parent.getFirstChild() == n) || NodeUtil.isNameDeclaration(parent); }
[ "public", "static", "boolean", "isNameDeclOrSimpleAssignLhs", "(", "Node", "n", ",", "Node", "parent", ")", "{", "return", "(", "parent", ".", "isAssign", "(", ")", "&&", "parent", ".", "getFirstChild", "(", ")", "==", "n", ")", "||", "NodeUtil", ".", "i...
Determines whether this node is strictly on the left hand side of an assign or var initialization. Notably, this does not include all L-values, only statements where the node is used only as an L-value. @param n The node @param parent Parent of the node @return True if n is the left hand of an assign
[ "Determines", "whether", "this", "node", "is", "strictly", "on", "the", "left", "hand", "side", "of", "an", "assign", "or", "var", "initialization", ".", "Notably", "this", "does", "not", "include", "all", "L", "-", "values", "only", "statements", "where", ...
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L3309-L3312
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptTask.java
AptTask.setSrcExtensions
public void setSrcExtensions(String srcExts) { StringTokenizer tok = new StringTokenizer(srcExts, ","); while (tok.hasMoreTokens()) _srcExts.add(tok.nextToken()); }
java
public void setSrcExtensions(String srcExts) { StringTokenizer tok = new StringTokenizer(srcExts, ","); while (tok.hasMoreTokens()) _srcExts.add(tok.nextToken()); }
[ "public", "void", "setSrcExtensions", "(", "String", "srcExts", ")", "{", "StringTokenizer", "tok", "=", "new", "StringTokenizer", "(", "srcExts", ",", "\",\"", ")", ";", "while", "(", "tok", ".", "hasMoreTokens", "(", ")", ")", "_srcExts", ".", "add", "("...
The srcExtensions attribute can be set to a comma-separated list of source filename extensions that are considered to be valid inputs to APT processing. The default value is "*.java".
[ "The", "srcExtensions", "attribute", "can", "be", "set", "to", "a", "comma", "-", "separated", "list", "of", "source", "filename", "extensions", "that", "are", "considered", "to", "be", "valid", "inputs", "to", "APT", "processing", ".", "The", "default", "va...
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptTask.java#L57-L62
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bos/BosClient.java
BosClient.putObject
public PutObjectResponse putObject(String bucketName, String key, byte[] value, ObjectMetadata metadata) { if (metadata.getContentLength() == -1) { metadata.setContentLength(value.length); } return this.putObject(new PutObjectRequest(bucketName, key, RestartableInputStream.wrap(value), metadata)); }
java
public PutObjectResponse putObject(String bucketName, String key, byte[] value, ObjectMetadata metadata) { if (metadata.getContentLength() == -1) { metadata.setContentLength(value.length); } return this.putObject(new PutObjectRequest(bucketName, key, RestartableInputStream.wrap(value), metadata)); }
[ "public", "PutObjectResponse", "putObject", "(", "String", "bucketName", ",", "String", "key", ",", "byte", "[", "]", "value", ",", "ObjectMetadata", "metadata", ")", "{", "if", "(", "metadata", ".", "getContentLength", "(", ")", "==", "-", "1", ")", "{", ...
Uploads the specified bytes and object metadata to Bos under the specified bucket and key name. @param bucketName The name of an existing bucket, to which you have Write permission. @param key The key under which to store the specified file. @param value The bytes containing the value to be uploaded to Bos. @param metadata Additional metadata instructing Bos how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.). @return A PutObjectResponse object containing the information returned by Bos for the newly created object.
[ "Uploads", "the", "specified", "bytes", "and", "object", "metadata", "to", "Bos", "under", "the", "specified", "bucket", "and", "key", "name", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/BosClient.java#L862-L867
victims/victims-lib-java
src/main/java/com/redhat/victims/database/VictimsSQL.java
VictimsSQL.insertRecord
protected int insertRecord(Connection connection, String hash) throws SQLException { int id = -1; PreparedStatement ps = setObjects(connection, Query.INSERT_RECORD, hash); ps.execute(); ResultSet rs = ps.getGeneratedKeys(); try { while (rs.next()) { id = rs.getInt(1); break; } } finally { rs.close(); ps.close(); } return id; }
java
protected int insertRecord(Connection connection, String hash) throws SQLException { int id = -1; PreparedStatement ps = setObjects(connection, Query.INSERT_RECORD, hash); ps.execute(); ResultSet rs = ps.getGeneratedKeys(); try { while (rs.next()) { id = rs.getInt(1); break; } } finally { rs.close(); ps.close(); } return id; }
[ "protected", "int", "insertRecord", "(", "Connection", "connection", ",", "String", "hash", ")", "throws", "SQLException", "{", "int", "id", "=", "-", "1", ";", "PreparedStatement", "ps", "=", "setObjects", "(", "connection", ",", "Query", ".", "INSERT_RECORD"...
Insert a new record with the given hash and return the record id. @param hash @return A record id if it was created correctly, else return -1. @throws SQLException
[ "Insert", "a", "new", "record", "with", "the", "given", "hash", "and", "return", "the", "record", "id", "." ]
train
https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/database/VictimsSQL.java#L230-L247
JakeWharton/picasso2-okhttp3-downloader
src/main/java/com/jakewharton/picasso/OkHttp3Downloader.java
OkHttp3Downloader.createDefaultCache
public static Cache createDefaultCache(Context context) { File dir = defaultCacheDir(context); return new Cache(dir, calculateDiskCacheSize(dir)); }
java
public static Cache createDefaultCache(Context context) { File dir = defaultCacheDir(context); return new Cache(dir, calculateDiskCacheSize(dir)); }
[ "public", "static", "Cache", "createDefaultCache", "(", "Context", "context", ")", "{", "File", "dir", "=", "defaultCacheDir", "(", "context", ")", ";", "return", "new", "Cache", "(", "dir", ",", "calculateDiskCacheSize", "(", "dir", ")", ")", ";", "}" ]
Creates a {@link Cache} that would have otherwise been created by calling {@link #OkHttp3Downloader(Context)}. This allows you to build your own {@link OkHttpClient} while still getting the default disk cache.
[ "Creates", "a", "{" ]
train
https://github.com/JakeWharton/picasso2-okhttp3-downloader/blob/e54cccd29b70eed68a3ec21401ec9910b294028d/src/main/java/com/jakewharton/picasso/OkHttp3Downloader.java#L51-L54
michael-rapp/AndroidUtil
library/src/main/java/de/mrapp/android/util/view/AbstractViewRecycler.java
AbstractViewRecycler.addUnusedView
protected final void addUnusedView(@NonNull final View view, final int viewType) { if (useCache) { if (unusedViews == null) { unusedViews = new SparseArray<>(adapter.getViewTypeCount()); } Queue<View> queue = unusedViews.get(viewType); if (queue == null) { queue = new LinkedList<>(); unusedViews.put(viewType, queue); } queue.add(view); } }
java
protected final void addUnusedView(@NonNull final View view, final int viewType) { if (useCache) { if (unusedViews == null) { unusedViews = new SparseArray<>(adapter.getViewTypeCount()); } Queue<View> queue = unusedViews.get(viewType); if (queue == null) { queue = new LinkedList<>(); unusedViews.put(viewType, queue); } queue.add(view); } }
[ "protected", "final", "void", "addUnusedView", "(", "@", "NonNull", "final", "View", "view", ",", "final", "int", "viewType", ")", "{", "if", "(", "useCache", ")", "{", "if", "(", "unusedViews", "==", "null", ")", "{", "unusedViews", "=", "new", "SparseA...
Adds an unused view to the cache. @param view The unused view, which should be added to the cache, as an instance of the class {@link View}. The view may not be null @param viewType The view type, the unused view corresponds to, as an {@link Integer} value
[ "Adds", "an", "unused", "view", "to", "the", "cache", "." ]
train
https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/view/AbstractViewRecycler.java#L212-L227
pushtorefresh/storio
storio-sqlite/src/main/java/com/pushtorefresh/storio3/sqlite/Changes.java
Changes.newInstance
@NonNull public static Changes newInstance(@NonNull String affectedTable, @Nullable String... affectedTags) { checkNotNull(affectedTable, "Please specify affected table"); return new Changes(singleton(affectedTable), nonNullSet(affectedTags)); }
java
@NonNull public static Changes newInstance(@NonNull String affectedTable, @Nullable String... affectedTags) { checkNotNull(affectedTable, "Please specify affected table"); return new Changes(singleton(affectedTable), nonNullSet(affectedTags)); }
[ "@", "NonNull", "public", "static", "Changes", "newInstance", "(", "@", "NonNull", "String", "affectedTable", ",", "@", "Nullable", "String", "...", "affectedTags", ")", "{", "checkNotNull", "(", "affectedTable", ",", "\"Please specify affected table\"", ")", ";", ...
Creates {@link Changes} container with info about changes. @param affectedTable table that was affected. @param affectedTags nullable set of affected tags. @return new immutable instance of {@link Changes}.
[ "Creates", "{", "@link", "Changes", "}", "container", "with", "info", "about", "changes", "." ]
train
https://github.com/pushtorefresh/storio/blob/58f53d81bcc7b069c8bb271c46a90e37775abe8d/storio-sqlite/src/main/java/com/pushtorefresh/storio3/sqlite/Changes.java#L100-L104
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/ParallelStreamReader.java
ParallelStreamReader.performReads
private void performReads(ReadResult readResult) throws InterruptedException { long start = System.currentTimeMillis(); for (int i = 0; i < streams.length; ) { boolean acquired = slots.tryAcquire(1, 10, TimeUnit.SECONDS); reporter.progress(); if (acquired) { readPool.execute(new ReadOperation(readResult, i)); i++; } } // All read operations have been submitted to the readPool. // Now wait for the operations to finish and release the semaphore. while (true) { boolean acquired = slots.tryAcquire(numThreads, 10, TimeUnit.SECONDS); reporter.progress(); if (acquired) { slots.release(numThreads); break; } } readTime += (System.currentTimeMillis() - start); }
java
private void performReads(ReadResult readResult) throws InterruptedException { long start = System.currentTimeMillis(); for (int i = 0; i < streams.length; ) { boolean acquired = slots.tryAcquire(1, 10, TimeUnit.SECONDS); reporter.progress(); if (acquired) { readPool.execute(new ReadOperation(readResult, i)); i++; } } // All read operations have been submitted to the readPool. // Now wait for the operations to finish and release the semaphore. while (true) { boolean acquired = slots.tryAcquire(numThreads, 10, TimeUnit.SECONDS); reporter.progress(); if (acquired) { slots.release(numThreads); break; } } readTime += (System.currentTimeMillis() - start); }
[ "private", "void", "performReads", "(", "ReadResult", "readResult", ")", "throws", "InterruptedException", "{", "long", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "streams", ".", "lengt...
Performs a batch of reads from the given streams and waits for the reads to finish.
[ "Performs", "a", "batch", "of", "reads", "from", "the", "given", "streams", "and", "waits", "for", "the", "reads", "to", "finish", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/ParallelStreamReader.java#L284-L307
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/proxy/utils/ByteUtilities.java
ByteUtilities.networkByteOrderToInt
public static int networkByteOrderToInt(byte[] buf, int start, int count) { if (count > 4) { throw new IllegalArgumentException( "Cannot handle more than 4 bytes"); } int result = 0; for (int i = 0; i < count; i++) { result <<= 8; result |= (buf[start + i] & 0xff); } return result; }
java
public static int networkByteOrderToInt(byte[] buf, int start, int count) { if (count > 4) { throw new IllegalArgumentException( "Cannot handle more than 4 bytes"); } int result = 0; for (int i = 0; i < count; i++) { result <<= 8; result |= (buf[start + i] & 0xff); } return result; }
[ "public", "static", "int", "networkByteOrderToInt", "(", "byte", "[", "]", "buf", ",", "int", "start", ",", "int", "count", ")", "{", "if", "(", "count", ">", "4", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Cannot handle more than 4 bytes\""...
Returns the integer represented by up to 4 bytes in network byte order. @param buf the buffer to read the bytes from @param start @param count @return
[ "Returns", "the", "integer", "represented", "by", "up", "to", "4", "bytes", "in", "network", "byte", "order", "." ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/utils/ByteUtilities.java#L36-L50
apache/reef
lang/java/reef-utils/src/main/java/org/apache/reef/util/MultiAsyncToSync.java
MultiAsyncToSync.addSleeper
private void addSleeper(final long identifier, final ComplexCondition call) { if (sleeperMap.put(identifier, call) != null) { throw new RuntimeException(String.format("Duplicate identifier [%d] in sleeper map", identifier)); } }
java
private void addSleeper(final long identifier, final ComplexCondition call) { if (sleeperMap.put(identifier, call) != null) { throw new RuntimeException(String.format("Duplicate identifier [%d] in sleeper map", identifier)); } }
[ "private", "void", "addSleeper", "(", "final", "long", "identifier", ",", "final", "ComplexCondition", "call", ")", "{", "if", "(", "sleeperMap", ".", "put", "(", "identifier", ",", "call", ")", "!=", "null", ")", "{", "throw", "new", "RuntimeException", "...
Atomically add a coll to the sleeper map. @param identifier The unique call identifier. @param call The call object to be added to the sleeper map.
[ "Atomically", "add", "a", "coll", "to", "the", "sleeper", "map", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-utils/src/main/java/org/apache/reef/util/MultiAsyncToSync.java#L163-L167
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/ByteArrayUtil.java
ByteArrayUtil.getIntBE
public static int getIntBE(final byte[] array, final int offset) { return ( array[offset + 3] & 0XFF ) | ((array[offset + 2] & 0XFF) << 8) | ((array[offset + 1] & 0XFF) << 16) | ((array[offset ] & 0XFF) << 24); }
java
public static int getIntBE(final byte[] array, final int offset) { return ( array[offset + 3] & 0XFF ) | ((array[offset + 2] & 0XFF) << 8) | ((array[offset + 1] & 0XFF) << 16) | ((array[offset ] & 0XFF) << 24); }
[ "public", "static", "int", "getIntBE", "(", "final", "byte", "[", "]", "array", ",", "final", "int", "offset", ")", "{", "return", "(", "array", "[", "offset", "+", "3", "]", "&", "0XFF", ")", "|", "(", "(", "array", "[", "offset", "+", "2", "]",...
Get a <i>int</i> from the given byte array starting at the given offset in big endian order. There is no bounds checking. @param array source byte array @param offset source offset @return the <i>int</i>
[ "Get", "a", "<i", ">", "int<", "/", "i", ">", "from", "the", "given", "byte", "array", "starting", "at", "the", "given", "offset", "in", "big", "endian", "order", ".", "There", "is", "no", "bounds", "checking", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/ByteArrayUtil.java#L95-L100
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.beginDeleteInstances
public OperationStatusResponseInner beginDeleteInstances(String resourceGroupName, String vmScaleSetName, List<String> instanceIds) { return beginDeleteInstancesWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().single().body(); }
java
public OperationStatusResponseInner beginDeleteInstances(String resourceGroupName, String vmScaleSetName, List<String> instanceIds) { return beginDeleteInstancesWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().single().body(); }
[ "public", "OperationStatusResponseInner", "beginDeleteInstances", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ",", "List", "<", "String", ">", "instanceIds", ")", "{", "return", "beginDeleteInstancesWithServiceResponseAsync", "(", "resourceGroupName",...
Deletes virtual machines in a VM scale set. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @param instanceIds The virtual machine scale set instance ids. @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 OperationStatusResponseInner object if successful.
[ "Deletes", "virtual", "machines", "in", "a", "VM", "scale", "set", "." ]
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#L1199-L1201
amsa-code/risky
ais/src/main/java/au/gov/amsa/ais/Util.java
Util.checkMessageId
public static void checkMessageId(int messageId, AisMessageType... messageTypes) { boolean found = false; for (AisMessageType messageType : messageTypes) { if (messageType.getId() == messageId) found = true; } if (!found) { StringBuffer s = new StringBuffer(); for (AisMessageType messageType : messageTypes) { if (s.length() > 0) s.append(","); s.append(messageType.getId() + ""); } checkArgument(found, "messageId must be in [" + s + "] but was " + messageId); } }
java
public static void checkMessageId(int messageId, AisMessageType... messageTypes) { boolean found = false; for (AisMessageType messageType : messageTypes) { if (messageType.getId() == messageId) found = true; } if (!found) { StringBuffer s = new StringBuffer(); for (AisMessageType messageType : messageTypes) { if (s.length() > 0) s.append(","); s.append(messageType.getId() + ""); } checkArgument(found, "messageId must be in [" + s + "] but was " + messageId); } }
[ "public", "static", "void", "checkMessageId", "(", "int", "messageId", ",", "AisMessageType", "...", "messageTypes", ")", "{", "boolean", "found", "=", "false", ";", "for", "(", "AisMessageType", "messageType", ":", "messageTypes", ")", "{", "if", "(", "messag...
Check message id corresponds to one of the given list of message types. @param messageId @param messageTypes
[ "Check", "message", "id", "corresponds", "to", "one", "of", "the", "given", "list", "of", "message", "types", "." ]
train
https://github.com/amsa-code/risky/blob/13649942aeddfdb9210eec072c605bc5d7a6daf3/ais/src/main/java/au/gov/amsa/ais/Util.java#L261-L276
aws/aws-sdk-java
aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/PutIntegrationRequest.java
PutIntegrationRequest.withRequestParameters
public PutIntegrationRequest withRequestParameters(java.util.Map<String, String> requestParameters) { setRequestParameters(requestParameters); return this; }
java
public PutIntegrationRequest withRequestParameters(java.util.Map<String, String> requestParameters) { setRequestParameters(requestParameters); return this; }
[ "public", "PutIntegrationRequest", "withRequestParameters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "requestParameters", ")", "{", "setRequestParameters", "(", "requestParameters", ")", ";", "return", "this", ";", "}" ]
<p> A key-value map specifying request parameters that are passed from the method request to the back end. The key is an integration request parameter name and the associated value is a method request parameter value or static value that must be enclosed within single quotes and pre-encoded as required by the back end. The method request parameter value must match the pattern of <code>method.request.{location}.{name}</code>, where <code>location</code> is <code>querystring</code>, <code>path</code>, or <code>header</code> and <code>name</code> must be a valid and unique method request parameter name. </p> @param requestParameters A key-value map specifying request parameters that are passed from the method request to the back end. The key is an integration request parameter name and the associated value is a method request parameter value or static value that must be enclosed within single quotes and pre-encoded as required by the back end. The method request parameter value must match the pattern of <code>method.request.{location}.{name}</code> , where <code>location</code> is <code>querystring</code>, <code>path</code>, or <code>header</code> and <code>name</code> must be a valid and unique method request parameter name. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "key", "-", "value", "map", "specifying", "request", "parameters", "that", "are", "passed", "from", "the", "method", "request", "to", "the", "back", "end", ".", "The", "key", "is", "an", "integration", "request", "parameter", "name", "and",...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/PutIntegrationRequest.java#L905-L908
google/closure-compiler
src/com/google/javascript/jscomp/JSModuleGraph.java
JSModuleGraph.moveMarkedWeakSources
private static void moveMarkedWeakSources(JSModule weakModule, Iterable<CompilerInput> inputs) { checkNotNull(weakModule); ImmutableList<CompilerInput> allInputs = ImmutableList.copyOf(inputs); for (CompilerInput i : allInputs) { if (i.getSourceFile().isWeak()) { JSModule existingModule = i.getModule(); if (existingModule == weakModule) { continue; } if (existingModule != null) { existingModule.remove(i); } weakModule.add(i); } } }
java
private static void moveMarkedWeakSources(JSModule weakModule, Iterable<CompilerInput> inputs) { checkNotNull(weakModule); ImmutableList<CompilerInput> allInputs = ImmutableList.copyOf(inputs); for (CompilerInput i : allInputs) { if (i.getSourceFile().isWeak()) { JSModule existingModule = i.getModule(); if (existingModule == weakModule) { continue; } if (existingModule != null) { existingModule.remove(i); } weakModule.add(i); } } }
[ "private", "static", "void", "moveMarkedWeakSources", "(", "JSModule", "weakModule", ",", "Iterable", "<", "CompilerInput", ">", "inputs", ")", "{", "checkNotNull", "(", "weakModule", ")", ";", "ImmutableList", "<", "CompilerInput", ">", "allInputs", "=", "Immutab...
Moves all sources that have {@link SourceKind#WEAK} into the weak module so that they may be pruned later.
[ "Moves", "all", "sources", "that", "have", "{" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JSModuleGraph.java#L479-L494
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/DigitalSignature.java
DigitalSignature.verify
public boolean verify(String base64Signature, String content, String timestamp) throws Exception { return verify(base64Signature, content, timestamp, keyName); }
java
public boolean verify(String base64Signature, String content, String timestamp) throws Exception { return verify(base64Signature, content, timestamp, keyName); }
[ "public", "boolean", "verify", "(", "String", "base64Signature", ",", "String", "content", ",", "String", "timestamp", ")", "throws", "Exception", "{", "return", "verify", "(", "base64Signature", ",", "content", ",", "timestamp", ",", "keyName", ")", ";", "}" ...
Verifies the validity of the digital signature using stored key name. @param base64Signature The digital signature. @param content The authorization string to which the signature was applied. @param timestamp The timestamp of the digital signature. @return True if the signature is valid. @throws Exception Unspecified exception.
[ "Verifies", "the", "validity", "of", "the", "digital", "signature", "using", "stored", "key", "name", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/DigitalSignature.java#L87-L89
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java
Pixel.argb_fromNormalized
public static final int argb_fromNormalized(final double a, final double r, final double g, final double b){ return argb_bounded((int)Math.round(a*0xff), (int)Math.round(r*0xff), (int)Math.round(g*0xff), (int)Math.round(b*0xff)); }
java
public static final int argb_fromNormalized(final double a, final double r, final double g, final double b){ return argb_bounded((int)Math.round(a*0xff), (int)Math.round(r*0xff), (int)Math.round(g*0xff), (int)Math.round(b*0xff)); }
[ "public", "static", "final", "int", "argb_fromNormalized", "(", "final", "double", "a", ",", "final", "double", "r", ",", "final", "double", "g", ",", "final", "double", "b", ")", "{", "return", "argb_bounded", "(", "(", "int", ")", "Math", ".", "round",...
Packs normalized ARGB color components (values in [0.0 .. 1.0]) into a single 32bit integer value. Component values less than 0 or greater than 1 are clamped to fit the range. @param a alpha @param r red @param g green @param b blue @return packed ARGB value @see #rgb_fromNormalized(double, double, double) @see #argb(int, int, int, int) @see #a_normalized(int) @see #r_normalized(int) @see #g_normalized(int) @see #b_normalized(int) @since 1.2
[ "Packs", "normalized", "ARGB", "color", "components", "(", "values", "in", "[", "0", ".", "0", "..", "1", ".", "0", "]", ")", "into", "a", "single", "32bit", "integer", "value", ".", "Component", "values", "less", "than", "0", "or", "greater", "than", ...
train
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java#L792-L794
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
AbstractMemberWriter.addNavDetailLink
protected void addNavDetailLink(List<?> members, Content liNav) { addNavDetailLink(members.size() > 0 ? true : false, liNav); }
java
protected void addNavDetailLink(List<?> members, Content liNav) { addNavDetailLink(members.size() > 0 ? true : false, liNav); }
[ "protected", "void", "addNavDetailLink", "(", "List", "<", "?", ">", "members", ",", "Content", "liNav", ")", "{", "addNavDetailLink", "(", "members", ".", "size", "(", ")", ">", "0", "?", "true", ":", "false", ",", "liNav", ")", ";", "}" ]
Add the navigation detail link. @param members the members to be linked @param liNav the content tree to which the navigation detail link will be added
[ "Add", "the", "navigation", "detail", "link", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java#L512-L514
threerings/nenya
core/src/main/java/com/threerings/miso/client/SceneBlock.java
SceneBlock.updateBaseTile
public void updateBaseTile (int fqTileId, int tx, int ty) { String errmsg = null; int tidx = index(tx, ty); // this is a bit magical: we pass the fully qualified tile id to // the tile manager which loads up from the configured tileset // repository the appropriate tileset (which should be a // BaseTileSet) and then extracts the appropriate base tile (the // index of which is also in the fqTileId) try { if (fqTileId <= 0) { _base[tidx] = null; } else { _base[tidx] = (BaseTile)_tileMgr.getTile(fqTileId); } // clear out the fringe (it must be recomputed by the caller) _fringe[tidx] = null; } catch (ClassCastException cce) { errmsg = "Scene contains non-base tile in base layer"; } catch (NoSuchTileSetException nste) { errmsg = "Scene contains non-existent tileset"; } if (errmsg != null) { log.warning(errmsg + " [fqtid=" + fqTileId + ", x=" + tx + ", y=" + ty + "]."); } }
java
public void updateBaseTile (int fqTileId, int tx, int ty) { String errmsg = null; int tidx = index(tx, ty); // this is a bit magical: we pass the fully qualified tile id to // the tile manager which loads up from the configured tileset // repository the appropriate tileset (which should be a // BaseTileSet) and then extracts the appropriate base tile (the // index of which is also in the fqTileId) try { if (fqTileId <= 0) { _base[tidx] = null; } else { _base[tidx] = (BaseTile)_tileMgr.getTile(fqTileId); } // clear out the fringe (it must be recomputed by the caller) _fringe[tidx] = null; } catch (ClassCastException cce) { errmsg = "Scene contains non-base tile in base layer"; } catch (NoSuchTileSetException nste) { errmsg = "Scene contains non-existent tileset"; } if (errmsg != null) { log.warning(errmsg + " [fqtid=" + fqTileId + ", x=" + tx + ", y=" + ty + "]."); } }
[ "public", "void", "updateBaseTile", "(", "int", "fqTileId", ",", "int", "tx", ",", "int", "ty", ")", "{", "String", "errmsg", "=", "null", ";", "int", "tidx", "=", "index", "(", "tx", ",", "ty", ")", ";", "// this is a bit magical: we pass the fully qualifie...
Informs this scene block that the specified base tile has been changed.
[ "Informs", "this", "scene", "block", "that", "the", "specified", "base", "tile", "has", "been", "changed", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/SceneBlock.java#L311-L340
FedericoPecora/meta-csp-framework
src/main/java/org/metacsp/multi/spatial/rectangleAlgebra/RectangleConstraintSolver.java
RectangleConstraintSolver.drawAlmostCentreRectangle
public String drawAlmostCentreRectangle(long horizon, RectangularRegion ... rect){ String ret = ""; int j = 1; ret = "set xrange [0:" + horizon +"]"+ "\n"; ret += "set yrange [0:" + horizon +"]" + "\n"; for (int i = 0; i < rect.length; i++) { //rec ret += "set obj " + j + " rect from " + extractBoundingBoxesFromSTPs(rect[i]).getAlmostCentreRectangle().getMinX() + "," + extractBoundingBoxesFromSTPs(rect[i]).getAlmostCentreRectangle().getMinY() +" to " + extractBoundingBoxesFromSTPs(rect[i]).getAlmostCentreRectangle().getMaxX() + "," +extractBoundingBoxesFromSTPs(rect[i]).getAlmostCentreRectangle().getMaxY() + " front fs transparent solid 0.0 border " + (i+1) +" lw 0.5" + "\n"; j++; //label of centre Rec ret += "set label " + "\""+ rect[i]+"-c" +"\""+" at "+ extractBoundingBoxesFromSTPs(rect[i]).getAlmostCentreRectangle().getCenterX() +"," + extractBoundingBoxesFromSTPs(rect[i]).getAlmostCentreRectangle().getCenterY() + " textcolor lt " + (i+1) + " font \"9\"" + "\n"; j++; } ret += "plot NaN" + "\n"; ret += "pause -1"; return ret; }
java
public String drawAlmostCentreRectangle(long horizon, RectangularRegion ... rect){ String ret = ""; int j = 1; ret = "set xrange [0:" + horizon +"]"+ "\n"; ret += "set yrange [0:" + horizon +"]" + "\n"; for (int i = 0; i < rect.length; i++) { //rec ret += "set obj " + j + " rect from " + extractBoundingBoxesFromSTPs(rect[i]).getAlmostCentreRectangle().getMinX() + "," + extractBoundingBoxesFromSTPs(rect[i]).getAlmostCentreRectangle().getMinY() +" to " + extractBoundingBoxesFromSTPs(rect[i]).getAlmostCentreRectangle().getMaxX() + "," +extractBoundingBoxesFromSTPs(rect[i]).getAlmostCentreRectangle().getMaxY() + " front fs transparent solid 0.0 border " + (i+1) +" lw 0.5" + "\n"; j++; //label of centre Rec ret += "set label " + "\""+ rect[i]+"-c" +"\""+" at "+ extractBoundingBoxesFromSTPs(rect[i]).getAlmostCentreRectangle().getCenterX() +"," + extractBoundingBoxesFromSTPs(rect[i]).getAlmostCentreRectangle().getCenterY() + " textcolor lt " + (i+1) + " font \"9\"" + "\n"; j++; } ret += "plot NaN" + "\n"; ret += "pause -1"; return ret; }
[ "public", "String", "drawAlmostCentreRectangle", "(", "long", "horizon", ",", "RectangularRegion", "...", "rect", ")", "{", "String", "ret", "=", "\"\"", ";", "int", "j", "=", "1", ";", "ret", "=", "\"set xrange [0:\"", "+", "horizon", "+", "\"]\"", "+", "...
Output a Gnuplot-readable script that draws, for each given {@link RectangularRegion}, a rectangle which is close to the "center" of the {@link RectangularRegion}'s domain. @param horizon The maximum X and Y coordinate to be used in the plot. @param rect The set of {@link RectangularRegion}s to draw. @return A Gnuplot script.
[ "Output", "a", "Gnuplot", "-", "readable", "script", "that", "draws", "for", "each", "given", "{" ]
train
https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/multi/spatial/rectangleAlgebra/RectangleConstraintSolver.java#L112-L131
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/http/client/RequestBuilder.java
RequestBuilder.sendRequest
public Request sendRequest(String requestData, RequestCallback callback) throws RequestException { StringValidator.throwIfNull("callback", callback); return doSend(requestData, callback); }
java
public Request sendRequest(String requestData, RequestCallback callback) throws RequestException { StringValidator.throwIfNull("callback", callback); return doSend(requestData, callback); }
[ "public", "Request", "sendRequest", "(", "String", "requestData", ",", "RequestCallback", "callback", ")", "throws", "RequestException", "{", "StringValidator", ".", "throwIfNull", "(", "\"callback\"", ",", "callback", ")", ";", "return", "doSend", "(", "requestData...
Sends an HTTP request based on the current builder configuration with the specified data and callback. If no request headers have been set, the header "Content-Type" will be used with a value of "text/plain; charset=utf-8". This method does not cache <code>requestData</code> or <code>callback</code>. @param requestData the data to send as part of the request @param callback the response handler to be notified when the request fails or completes @return a {@link Request} object that can be used to track the request @throws NullPointerException if <code>callback</code> <code>null</code>
[ "Sends", "an", "HTTP", "request", "based", "on", "the", "current", "builder", "configuration", "with", "the", "specified", "data", "and", "callback", ".", "If", "no", "request", "headers", "have", "been", "set", "the", "header", "Content", "-", "Type", "will...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/http/client/RequestBuilder.java#L251-L255
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/split/ST_Split.java
ST_Split.splitMultiPolygonWithLine
private static Geometry splitMultiPolygonWithLine(MultiPolygon multiPolygon, LineString lineString) throws SQLException { ArrayList<Polygon> allPolygons = new ArrayList<Polygon>(); for (int i = 0; i < multiPolygon.getNumGeometries(); i++) { Collection<Polygon> polygons = splitPolygonizer((Polygon) multiPolygon.getGeometryN(i), lineString); if (polygons != null) { allPolygons.addAll(polygons); } } if (!allPolygons.isEmpty()) { return FACTORY.buildGeometry(allPolygons); } return null; }
java
private static Geometry splitMultiPolygonWithLine(MultiPolygon multiPolygon, LineString lineString) throws SQLException { ArrayList<Polygon> allPolygons = new ArrayList<Polygon>(); for (int i = 0; i < multiPolygon.getNumGeometries(); i++) { Collection<Polygon> polygons = splitPolygonizer((Polygon) multiPolygon.getGeometryN(i), lineString); if (polygons != null) { allPolygons.addAll(polygons); } } if (!allPolygons.isEmpty()) { return FACTORY.buildGeometry(allPolygons); } return null; }
[ "private", "static", "Geometry", "splitMultiPolygonWithLine", "(", "MultiPolygon", "multiPolygon", ",", "LineString", "lineString", ")", "throws", "SQLException", "{", "ArrayList", "<", "Polygon", ">", "allPolygons", "=", "new", "ArrayList", "<", "Polygon", ">", "("...
Splits a MultiPolygon using a LineString. @param multiPolygon @param lineString @return
[ "Splits", "a", "MultiPolygon", "using", "a", "LineString", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/split/ST_Split.java#L290-L302
snowflakedb/snowflake-jdbc
src/main/java/net/snowflake/client/jdbc/SnowflakeStatementV1.java
SnowflakeStatementV1.executeInternal
boolean executeInternal(String sql, Map<String, ParameterBindingDTO> parameterBindings) throws SQLException { raiseSQLExceptionIfStatementIsClosed(); connection.injectedDelay(); logger.debug("execute: {}", sql); String trimmedSql = sql.trim(); if (trimmedSql.length() >= 20 && trimmedSql.toLowerCase().startsWith("set-sf-property")) { // deprecated: sfsql executeSetProperty(sql); return false; } SFBaseResultSet sfResultSet; try { sfResultSet = sfStatement.execute(sql, parameterBindings, SFStatement.CallingMethod.EXECUTE); sfResultSet.setSession(this.connection.getSfSession()); if (resultSet != null) { openResultSets.add(resultSet); } resultSet = new SnowflakeResultSetV1(sfResultSet, this); queryID = sfResultSet.getQueryId(); // Legacy behavior treats update counts as result sets for single- // statement execute, so we only treat update counts as update counts // if JDBC_EXECUTE_RETURN_COUNT_FOR_DML is set, or if a statement // is multi-statement if (!sfResultSet.getStatementType().isGenerateResultSet() && (connection.getSfSession().isExecuteReturnCountForDML() || sfStatement.hasChildren())) { updateCount = ResultUtil.calculateUpdateCount(sfResultSet); if (resultSet != null) { openResultSets.add(resultSet); } resultSet = null; return false; } updateCount = NO_UPDATES; return true; } catch (SFException ex) { throw new SnowflakeSQLException(ex.getCause(), ex.getSqlState(), ex.getVendorCode(), ex.getParams()); } }
java
boolean executeInternal(String sql, Map<String, ParameterBindingDTO> parameterBindings) throws SQLException { raiseSQLExceptionIfStatementIsClosed(); connection.injectedDelay(); logger.debug("execute: {}", sql); String trimmedSql = sql.trim(); if (trimmedSql.length() >= 20 && trimmedSql.toLowerCase().startsWith("set-sf-property")) { // deprecated: sfsql executeSetProperty(sql); return false; } SFBaseResultSet sfResultSet; try { sfResultSet = sfStatement.execute(sql, parameterBindings, SFStatement.CallingMethod.EXECUTE); sfResultSet.setSession(this.connection.getSfSession()); if (resultSet != null) { openResultSets.add(resultSet); } resultSet = new SnowflakeResultSetV1(sfResultSet, this); queryID = sfResultSet.getQueryId(); // Legacy behavior treats update counts as result sets for single- // statement execute, so we only treat update counts as update counts // if JDBC_EXECUTE_RETURN_COUNT_FOR_DML is set, or if a statement // is multi-statement if (!sfResultSet.getStatementType().isGenerateResultSet() && (connection.getSfSession().isExecuteReturnCountForDML() || sfStatement.hasChildren())) { updateCount = ResultUtil.calculateUpdateCount(sfResultSet); if (resultSet != null) { openResultSets.add(resultSet); } resultSet = null; return false; } updateCount = NO_UPDATES; return true; } catch (SFException ex) { throw new SnowflakeSQLException(ex.getCause(), ex.getSqlState(), ex.getVendorCode(), ex.getParams()); } }
[ "boolean", "executeInternal", "(", "String", "sql", ",", "Map", "<", "String", ",", "ParameterBindingDTO", ">", "parameterBindings", ")", "throws", "SQLException", "{", "raiseSQLExceptionIfStatementIsClosed", "(", ")", ";", "connection", ".", "injectedDelay", "(", "...
Execute sql @param sql sql statement @param parameterBindings a map of binds to use for this query @return whether there is result set or not @throws SQLException if @link{#executeQuery(String)} throws exception
[ "Execute", "sql" ]
train
https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeStatementV1.java#L267-L324
Azure/azure-sdk-for-java
mediaservices/data-plane/src/main/java/com/microsoft/windowsazure/services/media/models/ContentKeyAuthorizationPolicy.java
ContentKeyAuthorizationPolicy.linkOptions
public static EntityLinkOperation linkOptions(String contentKeyAuthorizationPolicyId, String contentKeyAuthorizationPolicyOptionId) { String escapedContentKeyId = null; try { escapedContentKeyId = URLEncoder.encode(contentKeyAuthorizationPolicyOptionId, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new InvalidParameterException("contentKeyId"); } URI contentKeyUri = URI .create(String.format("ContentKeyAuthorizationPolicyOptions('%s')", escapedContentKeyId)); return new EntityLinkOperation(ENTITY_SET, contentKeyAuthorizationPolicyId, "Options", contentKeyUri); }
java
public static EntityLinkOperation linkOptions(String contentKeyAuthorizationPolicyId, String contentKeyAuthorizationPolicyOptionId) { String escapedContentKeyId = null; try { escapedContentKeyId = URLEncoder.encode(contentKeyAuthorizationPolicyOptionId, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new InvalidParameterException("contentKeyId"); } URI contentKeyUri = URI .create(String.format("ContentKeyAuthorizationPolicyOptions('%s')", escapedContentKeyId)); return new EntityLinkOperation(ENTITY_SET, contentKeyAuthorizationPolicyId, "Options", contentKeyUri); }
[ "public", "static", "EntityLinkOperation", "linkOptions", "(", "String", "contentKeyAuthorizationPolicyId", ",", "String", "contentKeyAuthorizationPolicyOptionId", ")", "{", "String", "escapedContentKeyId", "=", "null", ";", "try", "{", "escapedContentKeyId", "=", "URLEncod...
Link a content key authorization policy options. @param contentKeyAuthorizationPolicyId the content key authorization policy id @param contentKeyAuthorizationPolicyOptionId the content key authorization policy option id @return the entity action operation
[ "Link", "a", "content", "key", "authorization", "policy", "options", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/data-plane/src/main/java/com/microsoft/windowsazure/services/media/models/ContentKeyAuthorizationPolicy.java#L138-L149
Waikato/moa
moa/src/main/java/moa/core/Utils.java
Utils.probRound
public static int probRound(double value, Random rand) { if (value >= 0) { double lower = Math.floor(value); double prob = value - lower; if (rand.nextDouble() < prob) { return (int)lower + 1; } else { return (int)lower; } } else { double lower = Math.floor(Math.abs(value)); double prob = Math.abs(value) - lower; if (rand.nextDouble() < prob) { return -((int)lower + 1); } else { return -(int)lower; } } }
java
public static int probRound(double value, Random rand) { if (value >= 0) { double lower = Math.floor(value); double prob = value - lower; if (rand.nextDouble() < prob) { return (int)lower + 1; } else { return (int)lower; } } else { double lower = Math.floor(Math.abs(value)); double prob = Math.abs(value) - lower; if (rand.nextDouble() < prob) { return -((int)lower + 1); } else { return -(int)lower; } } }
[ "public", "static", "int", "probRound", "(", "double", "value", ",", "Random", "rand", ")", "{", "if", "(", "value", ">=", "0", ")", "{", "double", "lower", "=", "Math", ".", "floor", "(", "value", ")", ";", "double", "prob", "=", "value", "-", "lo...
Rounds a double to the next nearest integer value in a probabilistic fashion (e.g. 0.8 has a 20% chance of being rounded down to 0 and a 80% chance of being rounded up to 1). In the limit, the average of the rounded numbers generated by this procedure should converge to the original double. @param value the double value @param rand the random number generator @return the resulting integer value
[ "Rounds", "a", "double", "to", "the", "next", "nearest", "integer", "value", "in", "a", "probabilistic", "fashion", "(", "e", ".", "g", ".", "0", ".", "8", "has", "a", "20%", "chance", "of", "being", "rounded", "down", "to", "0", "and", "a", "80%", ...
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/core/Utils.java#L1279-L1298
ModeShape/modeshape
index-providers/modeshape-lucene-index-provider/src/main/java/org/modeshape/jcr/index/lucene/query/ComparePathQuery.java
ComparePathQuery.createQueryForNodesWithPathGreaterThan
public static ComparePathQuery createQueryForNodesWithPathGreaterThan( Path constraintPath, String fieldName, ValueFactories factories, Function<String, String> caseOperation) { return new ComparePathQuery(fieldName, constraintPath, factories.getPathFactory(), (path1, path2) -> PATH_COMPARATOR.compare(path1, path2) > 0, caseOperation); }
java
public static ComparePathQuery createQueryForNodesWithPathGreaterThan( Path constraintPath, String fieldName, ValueFactories factories, Function<String, String> caseOperation) { return new ComparePathQuery(fieldName, constraintPath, factories.getPathFactory(), (path1, path2) -> PATH_COMPARATOR.compare(path1, path2) > 0, caseOperation); }
[ "public", "static", "ComparePathQuery", "createQueryForNodesWithPathGreaterThan", "(", "Path", "constraintPath", ",", "String", "fieldName", ",", "ValueFactories", "factories", ",", "Function", "<", "String", ",", "String", ">", "caseOperation", ")", "{", "return", "n...
Construct a {@link Query} implementation that scores documents such that the node represented by the document has a path that is greater than the supplied constraint path. @param constraintPath the constraint path; may not be null @param fieldName the name of the document field containing the path value; may not be null @param factories the value factories that can be used during the scoring; may not be null @param caseOperation the operation that should be performed on the indexed values before the constraint value is being evaluated; may be null which indicates that no case conversion should be done @return the path query; never null
[ "Construct", "a", "{", "@link", "Query", "}", "implementation", "that", "scores", "documents", "such", "that", "the", "node", "represented", "by", "the", "document", "has", "a", "path", "that", "is", "greater", "than", "the", "supplied", "constraint", "path", ...
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/index-providers/modeshape-lucene-index-provider/src/main/java/org/modeshape/jcr/index/lucene/query/ComparePathQuery.java#L82-L88
OpenTSDB/opentsdb
src/query/expression/ExpressionFactory.java
ExpressionFactory.addFunction
static void addFunction(final String name, final Expression expr) { if (name == null || name.isEmpty()) { throw new IllegalArgumentException("Missing function name"); } if (expr == null) { throw new IllegalArgumentException("Function cannot be null"); } available_functions.put(name, expr); }
java
static void addFunction(final String name, final Expression expr) { if (name == null || name.isEmpty()) { throw new IllegalArgumentException("Missing function name"); } if (expr == null) { throw new IllegalArgumentException("Function cannot be null"); } available_functions.put(name, expr); }
[ "static", "void", "addFunction", "(", "final", "String", "name", ",", "final", "Expression", "expr", ")", "{", "if", "(", "name", "==", "null", "||", "name", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Missing fu...
Add an expression to the map. WARNING: The map is not thread safe so don't use this to dynamically modify the map while the TSD is running. @param name The name of the expression @param expr The expression object to store. @throws IllegalArgumentException if the name is null or empty or the function is null.
[ "Add", "an", "expression", "to", "the", "map", ".", "WARNING", ":", "The", "map", "is", "not", "thread", "safe", "so", "don", "t", "use", "this", "to", "dynamically", "modify", "the", "map", "while", "the", "TSD", "is", "running", "." ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/query/expression/ExpressionFactory.java#L70-L78
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscNodesInner.java
DscNodesInner.deleteAsync
public Observable<DscNodeInner> deleteAsync(String resourceGroupName, String automationAccountName, String nodeId) { return deleteWithServiceResponseAsync(resourceGroupName, automationAccountName, nodeId).map(new Func1<ServiceResponse<DscNodeInner>, DscNodeInner>() { @Override public DscNodeInner call(ServiceResponse<DscNodeInner> response) { return response.body(); } }); }
java
public Observable<DscNodeInner> deleteAsync(String resourceGroupName, String automationAccountName, String nodeId) { return deleteWithServiceResponseAsync(resourceGroupName, automationAccountName, nodeId).map(new Func1<ServiceResponse<DscNodeInner>, DscNodeInner>() { @Override public DscNodeInner call(ServiceResponse<DscNodeInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DscNodeInner", ">", "deleteAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "nodeId", ")", "{", "return", "deleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountNam...
Delete the dsc node identified by node id. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param nodeId The node id. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DscNodeInner object
[ "Delete", "the", "dsc", "node", "identified", "by", "node", "id", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscNodesInner.java#L125-L132
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/math/matrixes/Matrix.java
Matrix.setRow
public void setRow(RowVector rv, int r) throws MatrixException { if ((r < 0) || (r >= nRows)) { throw new MatrixException(MatrixException.INVALID_INDEX); } if (nCols != rv.nCols) { throw new MatrixException( MatrixException.INVALID_DIMENSIONS); } for (int c = 0; c < nCols; ++c) { this.values[r][c] = rv.values[0][c]; } }
java
public void setRow(RowVector rv, int r) throws MatrixException { if ((r < 0) || (r >= nRows)) { throw new MatrixException(MatrixException.INVALID_INDEX); } if (nCols != rv.nCols) { throw new MatrixException( MatrixException.INVALID_DIMENSIONS); } for (int c = 0; c < nCols; ++c) { this.values[r][c] = rv.values[0][c]; } }
[ "public", "void", "setRow", "(", "RowVector", "rv", ",", "int", "r", ")", "throws", "MatrixException", "{", "if", "(", "(", "r", "<", "0", ")", "||", "(", "r", ">=", "nRows", ")", ")", "{", "throw", "new", "MatrixException", "(", "MatrixException", "...
Set a row of this matrix from a row vector. @param rv the row vector @param r the row index @throws numbercruncher.MatrixException for an invalid index or an invalid vector size
[ "Set", "a", "row", "of", "this", "matrix", "from", "a", "row", "vector", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/math/matrixes/Matrix.java#L183-L196
rhuss/jolokia
agent/core/src/main/java/org/jolokia/backend/MBeanServerHandler.java
MBeanServerHandler.dispatchRequest
public Object dispatchRequest(JsonRequestHandler pRequestHandler, JmxRequest pJmxReq) throws InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, NotChangedException { serverHandle.preDispatch(mBeanServerManager,pJmxReq); if (pRequestHandler.handleAllServersAtOnce(pJmxReq)) { try { return pRequestHandler.handleRequest(mBeanServerManager,pJmxReq); } catch (IOException e) { throw new IllegalStateException("Internal: IOException " + e + ". Shouldn't happen.",e); } } else { return mBeanServerManager.handleRequest(pRequestHandler, pJmxReq); } }
java
public Object dispatchRequest(JsonRequestHandler pRequestHandler, JmxRequest pJmxReq) throws InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, NotChangedException { serverHandle.preDispatch(mBeanServerManager,pJmxReq); if (pRequestHandler.handleAllServersAtOnce(pJmxReq)) { try { return pRequestHandler.handleRequest(mBeanServerManager,pJmxReq); } catch (IOException e) { throw new IllegalStateException("Internal: IOException " + e + ". Shouldn't happen.",e); } } else { return mBeanServerManager.handleRequest(pRequestHandler, pJmxReq); } }
[ "public", "Object", "dispatchRequest", "(", "JsonRequestHandler", "pRequestHandler", ",", "JmxRequest", "pJmxReq", ")", "throws", "InstanceNotFoundException", ",", "AttributeNotFoundException", ",", "ReflectionException", ",", "MBeanException", ",", "NotChangedException", "{"...
Dispatch a request to the MBeanServer which can handle it @param pRequestHandler request handler to be called with an MBeanServer @param pJmxReq the request to dispatch @return the result of the request
[ "Dispatch", "a", "request", "to", "the", "MBeanServer", "which", "can", "handle", "it" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/backend/MBeanServerHandler.java#L151-L163
opentable/otj-logging
jetty/src/main/java/com/opentable/logging/jetty/JsonRequestLog.java
JsonRequestLog.getRequestIdFrom
protected UUID getRequestIdFrom(Request request, Response response) { return optUuid(response.getHeader(OTHeaders.REQUEST_ID)); }
java
protected UUID getRequestIdFrom(Request request, Response response) { return optUuid(response.getHeader(OTHeaders.REQUEST_ID)); }
[ "protected", "UUID", "getRequestIdFrom", "(", "Request", "request", ",", "Response", "response", ")", "{", "return", "optUuid", "(", "response", ".", "getHeader", "(", "OTHeaders", ".", "REQUEST_ID", ")", ")", ";", "}" ]
Provides a hook whereby an alternate source can be provided for grabbing the requestId
[ "Provides", "a", "hook", "whereby", "an", "alternate", "source", "can", "be", "provided", "for", "grabbing", "the", "requestId" ]
train
https://github.com/opentable/otj-logging/blob/eaa74c877c4721ddb9af8eb7fe1612166f7ac14d/jetty/src/main/java/com/opentable/logging/jetty/JsonRequestLog.java#L157-L159
samskivert/pythagoras
src/main/java/pythagoras/f/QuadCurve.java
QuadCurve.setCurve
public void setCurve (float x1, float y1, float ctrlx, float ctrly, float x2, float y2) { this.x1 = x1; this.y1 = y1; this.ctrlx = ctrlx; this.ctrly = ctrly; this.x2 = x2; this.y2 = y2; }
java
public void setCurve (float x1, float y1, float ctrlx, float ctrly, float x2, float y2) { this.x1 = x1; this.y1 = y1; this.ctrlx = ctrlx; this.ctrly = ctrly; this.x2 = x2; this.y2 = y2; }
[ "public", "void", "setCurve", "(", "float", "x1", ",", "float", "y1", ",", "float", "ctrlx", ",", "float", "ctrly", ",", "float", "x2", ",", "float", "y2", ")", "{", "this", ".", "x1", "=", "x1", ";", "this", ".", "y1", "=", "y1", ";", "this", ...
Configures the start, control, and end points for this curve.
[ "Configures", "the", "start", "control", "and", "end", "points", "for", "this", "curve", "." ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/QuadCurve.java#L50-L57
gotev/android-upload-service
examples/app/demoapp/src/main/java/net/gotev/uploadservicedemo/utils/AndroidPermissions.java
AndroidPermissions.areAllRequiredPermissionsGranted
public boolean areAllRequiredPermissionsGranted(String[] permissions, int[] grantResults) { if (permissions == null || permissions.length == 0 || grantResults == null || grantResults.length == 0) { return false; } LinkedHashMap<String, Integer> perms = new LinkedHashMap<>(); for (int i = 0; i < permissions.length; i++) { if (!perms.containsKey(permissions[i]) || (perms.containsKey(permissions[i]) && perms.get(permissions[i]) == PackageManager.PERMISSION_DENIED)) perms.put(permissions[i], grantResults[i]); } for (Map.Entry<String, Integer> entry : perms.entrySet()) { if (entry.getValue() != PackageManager.PERMISSION_GRANTED) { return false; } } return true; }
java
public boolean areAllRequiredPermissionsGranted(String[] permissions, int[] grantResults) { if (permissions == null || permissions.length == 0 || grantResults == null || grantResults.length == 0) { return false; } LinkedHashMap<String, Integer> perms = new LinkedHashMap<>(); for (int i = 0; i < permissions.length; i++) { if (!perms.containsKey(permissions[i]) || (perms.containsKey(permissions[i]) && perms.get(permissions[i]) == PackageManager.PERMISSION_DENIED)) perms.put(permissions[i], grantResults[i]); } for (Map.Entry<String, Integer> entry : perms.entrySet()) { if (entry.getValue() != PackageManager.PERMISSION_GRANTED) { return false; } } return true; }
[ "public", "boolean", "areAllRequiredPermissionsGranted", "(", "String", "[", "]", "permissions", ",", "int", "[", "]", "grantResults", ")", "{", "if", "(", "permissions", "==", "null", "||", "permissions", ".", "length", "==", "0", "||", "grantResults", "==", ...
Method to call inside {@link Activity#onRequestPermissionsResult(int, String[], int[])}, to check if the required permissions are granted. @param permissions permissions requested @param grantResults results @return true if all the required permissions are granted, otherwise false
[ "Method", "to", "call", "inside", "{" ]
train
https://github.com/gotev/android-upload-service/blob/0952fcbe4b32c100150ffd0a237de3be4942e0a8/examples/app/demoapp/src/main/java/net/gotev/uploadservicedemo/utils/AndroidPermissions.java#L83-L104
m-m-m/util
lang/src/main/java/net/sf/mmm/util/lang/api/BasicHelper.java
BasicHelper.toUpperCase
public static String toUpperCase(String string, Locale locale) { if (locale == null) { return toUpperCase(string, STANDARD_LOCALE); } return string.toUpperCase(locale); }
java
public static String toUpperCase(String string, Locale locale) { if (locale == null) { return toUpperCase(string, STANDARD_LOCALE); } return string.toUpperCase(locale); }
[ "public", "static", "String", "toUpperCase", "(", "String", "string", ",", "Locale", "locale", ")", "{", "if", "(", "locale", "==", "null", ")", "{", "return", "toUpperCase", "(", "string", ",", "STANDARD_LOCALE", ")", ";", "}", "return", "string", ".", ...
Indirection for {@link String#toUpperCase(Locale)}. @param string is the {@link String}. @param locale is the {@link Locale}. @return the result of {@link String#toUpperCase(Locale)}.
[ "Indirection", "for", "{", "@link", "String#toUpperCase", "(", "Locale", ")", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/lang/src/main/java/net/sf/mmm/util/lang/api/BasicHelper.java#L116-L122