repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
darylteo/directory-watcher
src/main/java/com/darylteo/nio/AbstractDirectoryWatchService.java
AbstractDirectoryWatchService.newWatcher
public DirectoryWatcher newWatcher(String dir, String separator) throws IOException { return newWatcher(Paths.get(dir), separator); }
java
public DirectoryWatcher newWatcher(String dir, String separator) throws IOException { return newWatcher(Paths.get(dir), separator); }
[ "public", "DirectoryWatcher", "newWatcher", "(", "String", "dir", ",", "String", "separator", ")", "throws", "IOException", "{", "return", "newWatcher", "(", "Paths", ".", "get", "(", "dir", ")", ",", "separator", ")", ";", "}" ]
<p> Instantiates a new DirectoryWatcher for the path given. </p> @param dir the path to watch for events. @param separator the file path separator for this watcher @return a DirectoryWatcher for this path (and all child paths) @throws IOException
[ "<p", ">", "Instantiates", "a", "new", "DirectoryWatcher", "for", "the", "path", "given", ".", "<", "/", "p", ">" ]
train
https://github.com/darylteo/directory-watcher/blob/c1144366dcf58443073c0a67d1a5f6535ac5e8d8/src/main/java/com/darylteo/nio/AbstractDirectoryWatchService.java#L66-L68
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/AssetsInner.java
AssetsInner.createOrUpdateAsync
public Observable<AssetInner> createOrUpdateAsync(String resourceGroupName, String accountName, String assetName, AssetInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, assetName, parameters).map(new Func1<ServiceResponse<AssetInner>, AssetInner>() { @Override public AssetInner call(ServiceResponse<AssetInner> response) { return response.body(); } }); }
java
public Observable<AssetInner> createOrUpdateAsync(String resourceGroupName, String accountName, String assetName, AssetInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, assetName, parameters).map(new Func1<ServiceResponse<AssetInner>, AssetInner>() { @Override public AssetInner call(ServiceResponse<AssetInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AssetInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "assetName", ",", "AssetInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "reso...
Create or update an Asset. Creates or updates an Asset in the Media Services account. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param assetName The Asset name. @param parameters The request parameters @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AssetInner object
[ "Create", "or", "update", "an", "Asset", ".", "Creates", "or", "updates", "an", "Asset", "in", "the", "Media", "Services", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/AssetsInner.java#L510-L517
UrielCh/ovh-java-sdk
ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java
ApiOvhDbaaslogs.serviceName_output_elasticsearch_alias_aliasId_GET
public OvhAlias serviceName_output_elasticsearch_alias_aliasId_GET(String serviceName, String aliasId) throws IOException { String qPath = "/dbaas/logs/{serviceName}/output/elasticsearch/alias/{aliasId}"; StringBuilder sb = path(qPath, serviceName, aliasId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhAlias.class); }
java
public OvhAlias serviceName_output_elasticsearch_alias_aliasId_GET(String serviceName, String aliasId) throws IOException { String qPath = "/dbaas/logs/{serviceName}/output/elasticsearch/alias/{aliasId}"; StringBuilder sb = path(qPath, serviceName, aliasId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhAlias.class); }
[ "public", "OvhAlias", "serviceName_output_elasticsearch_alias_aliasId_GET", "(", "String", "serviceName", ",", "String", "aliasId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dbaas/logs/{serviceName}/output/elasticsearch/alias/{aliasId}\"", ";", "StringBuilder...
Returns specified elasticsearch alias REST: GET /dbaas/logs/{serviceName}/output/elasticsearch/alias/{aliasId} @param serviceName [required] Service name @param aliasId [required] Alias ID
[ "Returns", "specified", "elasticsearch", "alias" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L1702-L1707
cryptomator/cryptofs
src/main/java/org/cryptomator/cryptofs/fh/OpenCryptoFiles.java
OpenCryptoFiles.prepareMove
public TwoPhaseMove prepareMove(Path src, Path dst) throws FileAlreadyExistsException { return new TwoPhaseMove(src, dst); }
java
public TwoPhaseMove prepareMove(Path src, Path dst) throws FileAlreadyExistsException { return new TwoPhaseMove(src, dst); }
[ "public", "TwoPhaseMove", "prepareMove", "(", "Path", "src", ",", "Path", "dst", ")", "throws", "FileAlreadyExistsException", "{", "return", "new", "TwoPhaseMove", "(", "src", ",", "dst", ")", ";", "}" ]
Prepares to update any open file references during a move operation. MUST be invoked using a try-with-resource statement and committed after the physical file move succeeded. @param src The ciphertext file path before the move @param dst The ciphertext file path after the move @return Utility to update OpenCryptoFile references. @throws FileAlreadyExistsException Thrown if the destination file is an existing file that is currently opened.
[ "Prepares", "to", "update", "any", "open", "file", "references", "during", "a", "move", "operation", ".", "MUST", "be", "invoked", "using", "a", "try", "-", "with", "-", "resource", "statement", "and", "committed", "after", "the", "physical", "file", "move",...
train
https://github.com/cryptomator/cryptofs/blob/67fc1a4950dd1c150cd2e2c75bcabbeb7c9ac82e/src/main/java/org/cryptomator/cryptofs/fh/OpenCryptoFiles.java#L104-L106
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/AbstractJcrNode.java
AbstractJcrNode.propertyDefinitionFor
final JcrPropertyDefinition propertyDefinitionFor( org.modeshape.jcr.value.Property property, Name primaryType, Set<Name> mixinTypes, NodeTypes nodeTypes ) throws ConstraintViolationException { // Figure out the JCR property type ... boolean single = property.isSingle(); boolean skipProtected = false; JcrPropertyDefinition defn = findBestPropertyDefinition(primaryType, mixinTypes, property, single, skipProtected, false, nodeTypes); if (defn != null) return defn; // See if there is a definition that has constraints that were violated ... defn = findBestPropertyDefinition(primaryType, mixinTypes, property, single, skipProtected, true, nodeTypes); String pName = readable(property.getName()); String loc = location(); if (defn != null) { I18n msg = JcrI18n.propertyNoLongerSatisfiesConstraints; throw new ConstraintViolationException(msg.text(pName, loc, defn.getName(), defn.getDeclaringNodeType().getName())); } CachedNode node = sessionCache().getNode(key); String ptype = readable(node.getPrimaryType(sessionCache())); String mixins = readable(node.getMixinTypes(sessionCache())); String pstr = property.getString(session.namespaces()); throw new ConstraintViolationException(JcrI18n.propertyNoLongerHasValidDefinition.text(pstr, loc, ptype, mixins)); }
java
final JcrPropertyDefinition propertyDefinitionFor( org.modeshape.jcr.value.Property property, Name primaryType, Set<Name> mixinTypes, NodeTypes nodeTypes ) throws ConstraintViolationException { // Figure out the JCR property type ... boolean single = property.isSingle(); boolean skipProtected = false; JcrPropertyDefinition defn = findBestPropertyDefinition(primaryType, mixinTypes, property, single, skipProtected, false, nodeTypes); if (defn != null) return defn; // See if there is a definition that has constraints that were violated ... defn = findBestPropertyDefinition(primaryType, mixinTypes, property, single, skipProtected, true, nodeTypes); String pName = readable(property.getName()); String loc = location(); if (defn != null) { I18n msg = JcrI18n.propertyNoLongerSatisfiesConstraints; throw new ConstraintViolationException(msg.text(pName, loc, defn.getName(), defn.getDeclaringNodeType().getName())); } CachedNode node = sessionCache().getNode(key); String ptype = readable(node.getPrimaryType(sessionCache())); String mixins = readable(node.getMixinTypes(sessionCache())); String pstr = property.getString(session.namespaces()); throw new ConstraintViolationException(JcrI18n.propertyNoLongerHasValidDefinition.text(pstr, loc, ptype, mixins)); }
[ "final", "JcrPropertyDefinition", "propertyDefinitionFor", "(", "org", ".", "modeshape", ".", "jcr", ".", "value", ".", "Property", "property", ",", "Name", "primaryType", ",", "Set", "<", "Name", ">", "mixinTypes", ",", "NodeTypes", "nodeTypes", ")", "throws", ...
Find the property definition for the property, given this node's primary type and mixin types. @param property the property owned by this node; may not be null @param primaryType the name of the node's primary type; may not be null @param mixinTypes the names of the node's mixin types; may be null or empty @param nodeTypes the node types cache to use; may not be null @return the property definition; never null @throws ConstraintViolationException if the property has no valid property definition
[ "Find", "the", "property", "definition", "for", "the", "property", "given", "this", "node", "s", "primary", "type", "and", "mixin", "types", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/AbstractJcrNode.java#L452-L477
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/modules/r/interpolation2d/core/TPSInterpolator.java
TPSInterpolator.fillVMatrix
private GeneralMatrix fillVMatrix( int dim, Coordinate[] controlPoints ) { int controlPointsNum = controlPoints.length; GeneralMatrix V = new GeneralMatrix(controlPointsNum + 3, 1); for( int i = 0; i < controlPointsNum; i++ ) { V.setElement(i, 0, controlPoints[i].z); } V.setElement(V.getNumRow() - 3, 0, 0); V.setElement(V.getNumRow() - 2, 0, 0); V.setElement(V.getNumRow() - 1, 0, 0); return V; }
java
private GeneralMatrix fillVMatrix( int dim, Coordinate[] controlPoints ) { int controlPointsNum = controlPoints.length; GeneralMatrix V = new GeneralMatrix(controlPointsNum + 3, 1); for( int i = 0; i < controlPointsNum; i++ ) { V.setElement(i, 0, controlPoints[i].z); } V.setElement(V.getNumRow() - 3, 0, 0); V.setElement(V.getNumRow() - 2, 0, 0); V.setElement(V.getNumRow() - 1, 0, 0); return V; }
[ "private", "GeneralMatrix", "fillVMatrix", "(", "int", "dim", ",", "Coordinate", "[", "]", "controlPoints", ")", "{", "int", "controlPointsNum", "=", "controlPoints", ".", "length", ";", "GeneralMatrix", "V", "=", "new", "GeneralMatrix", "(", "controlPointsNum", ...
Fill V matrix (matrix of target values). @param dim 0 for dx, 1 for dy. @return V Matrix
[ "Fill", "V", "matrix", "(", "matrix", "of", "target", "values", ")", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/modules/r/interpolation2d/core/TPSInterpolator.java#L170-L183
tencentyun/cos-java-sdk
src/main/java/com/qcloud/cos/sign/Sign.java
Sign.getOneEffectiveSign
public static String getOneEffectiveSign(String bucketName, String cosPath, Credentials cred) throws AbstractCosException { return appSignatureBase(cred, bucketName, cosPath, 0, true); }
java
public static String getOneEffectiveSign(String bucketName, String cosPath, Credentials cred) throws AbstractCosException { return appSignatureBase(cred, bucketName, cosPath, 0, true); }
[ "public", "static", "String", "getOneEffectiveSign", "(", "String", "bucketName", ",", "String", "cosPath", ",", "Credentials", "cred", ")", "throws", "AbstractCosException", "{", "return", "appSignatureBase", "(", "cred", ",", "bucketName", ",", "cosPath", ",", "...
获取单次签名, 一次有效,针对删除和更新文件目录 @param bucketName bucket名称 @param cosPath 要签名的cos路径 @param cred 用户的身份信息, 包括appid, secret_id和secret_key @return base64编码的字符串 @throws AbstractCosException
[ "获取单次签名", "一次有效,针对删除和更新文件目录" ]
train
https://github.com/tencentyun/cos-java-sdk/blob/6709a48f67c1ea7b82a7215f5037d6ccf218b630/src/main/java/com/qcloud/cos/sign/Sign.java#L92-L95
seedstack/i18n-addon
rest/src/it/java/org/seedstack/i18n/internal/rest/TranslationsResourceIT.java
TranslationsResourceIT.outdated_scenario
@Test public void outdated_scenario() throws JSONException { httpPost("keys", jsonKey.toString(), 201); try { // Add two outdated translations sendTranslationUpdate("zztranslation", EN, true); sendTranslationUpdate("translation", FR, true); // Update the default translation jsonKey.put("translation", "updated translation"); httpPut("keys/" + keyName, jsonKey.toString(), 200); // The key should remain outdated assertOutdatedStatus(true); // Update English translations sendTranslationUpdate("updated translation", EN, false); // The key should remain outdated assertOutdatedStatus(true); // Update French translations sendTranslationUpdate("updated translation", FR, false); // Now, all the translation have been updated assertOutdatedStatus(false); } finally { // clean the repo httpDelete("keys/" + keyName, 204); } }
java
@Test public void outdated_scenario() throws JSONException { httpPost("keys", jsonKey.toString(), 201); try { // Add two outdated translations sendTranslationUpdate("zztranslation", EN, true); sendTranslationUpdate("translation", FR, true); // Update the default translation jsonKey.put("translation", "updated translation"); httpPut("keys/" + keyName, jsonKey.toString(), 200); // The key should remain outdated assertOutdatedStatus(true); // Update English translations sendTranslationUpdate("updated translation", EN, false); // The key should remain outdated assertOutdatedStatus(true); // Update French translations sendTranslationUpdate("updated translation", FR, false); // Now, all the translation have been updated assertOutdatedStatus(false); } finally { // clean the repo httpDelete("keys/" + keyName, 204); } }
[ "@", "Test", "public", "void", "outdated_scenario", "(", ")", "throws", "JSONException", "{", "httpPost", "(", "\"keys\"", ",", "jsonKey", ".", "toString", "(", ")", ",", "201", ")", ";", "try", "{", "// Add two outdated translations", "sendTranslationUpdate", "...
Checks the outdated scenario. 1) A key is added 2) Add fr translation 3) Update default translation => key become outdated 4) Update en translation => key is still outdated 5) Update fr translation => key is no longer outdated
[ "Checks", "the", "outdated", "scenario", ".", "1", ")", "A", "key", "is", "added", "2", ")", "Add", "fr", "translation", "3", ")", "Update", "default", "translation", "=", ">", "key", "become", "outdated", "4", ")", "Update", "en", "translation", "=", ...
train
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/it/java/org/seedstack/i18n/internal/rest/TranslationsResourceIT.java#L76-L108
jasminb/jsonapi-converter
src/main/java/com/github/jasminb/jsonapi/ConverterConfiguration.java
ConverterConfiguration.getRelationshipMetaField
public Field getRelationshipMetaField(Class<?> clazz, String relationshipName) { return relationshipMetaFieldMap.get(clazz).get(relationshipName); }
java
public Field getRelationshipMetaField(Class<?> clazz, String relationshipName) { return relationshipMetaFieldMap.get(clazz).get(relationshipName); }
[ "public", "Field", "getRelationshipMetaField", "(", "Class", "<", "?", ">", "clazz", ",", "String", "relationshipName", ")", "{", "return", "relationshipMetaFieldMap", ".", "get", "(", "clazz", ")", ".", "get", "(", "relationshipName", ")", ";", "}" ]
Returns relationship meta field. @param clazz {@link Class} class holding relationship @param relationshipName {@link String} name of the relationship @return {@link Field} field
[ "Returns", "relationship", "meta", "field", "." ]
train
https://github.com/jasminb/jsonapi-converter/blob/73b41c3b9274e70e62b3425071ca8afdc7bddaf6/src/main/java/com/github/jasminb/jsonapi/ConverterConfiguration.java#L334-L336
lucee/Lucee
core/src/main/java/lucee/runtime/cache/CacheUtil.java
CacheUtil.getInstance
public static Cache getInstance(CacheConnection cc, Config config) throws IOException { return cc.getInstance(config); }
java
public static Cache getInstance(CacheConnection cc, Config config) throws IOException { return cc.getInstance(config); }
[ "public", "static", "Cache", "getInstance", "(", "CacheConnection", "cc", ",", "Config", "config", ")", "throws", "IOException", "{", "return", "cc", ".", "getInstance", "(", "config", ")", ";", "}" ]
in difference to the getInstance method of the CacheConnection this method produces a wrapper Cache (if necessary) that creates Entry objects to make sure the Cache has meta data. @param cc @param config @return @throws IOException
[ "in", "difference", "to", "the", "getInstance", "method", "of", "the", "CacheConnection", "this", "method", "produces", "a", "wrapper", "Cache", "(", "if", "necessary", ")", "that", "creates", "Entry", "objects", "to", "make", "sure", "the", "Cache", "has", ...
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/cache/CacheUtil.java#L250-L252
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/store/HashIndex.java
HashIndex.unlinkNode
void unlinkNode(int index, int lastLookup, int lookup) { // A VoltDB extension to diagnose ArrayOutOfBounds. voltDBhistory[voltDBhistoryDepth++ % voltDBhistoryCapacity] = -index-1; // End of VoltDB extension // unlink the node if (lastLookup == -1) { hashTable[index] = linkTable[lookup]; } else { linkTable[lastLookup] = linkTable[lookup]; } // add to reclaimed list linkTable[lookup] = reclaimedNodePointer; reclaimedNodePointer = lookup; elementCount--; }
java
void unlinkNode(int index, int lastLookup, int lookup) { // A VoltDB extension to diagnose ArrayOutOfBounds. voltDBhistory[voltDBhistoryDepth++ % voltDBhistoryCapacity] = -index-1; // End of VoltDB extension // unlink the node if (lastLookup == -1) { hashTable[index] = linkTable[lookup]; } else { linkTable[lastLookup] = linkTable[lookup]; } // add to reclaimed list linkTable[lookup] = reclaimedNodePointer; reclaimedNodePointer = lookup; elementCount--; }
[ "void", "unlinkNode", "(", "int", "index", ",", "int", "lastLookup", ",", "int", "lookup", ")", "{", "// A VoltDB extension to diagnose ArrayOutOfBounds.", "voltDBhistory", "[", "voltDBhistoryDepth", "++", "%", "voltDBhistoryCapacity", "]", "=", "-", "index", "-", "...
Unlink a node from a linked list and link into the reclaimed list. @param index an index into hashTable @param lastLookup either -1 or the node to which the target node is linked @param lookup the node to remove
[ "Unlink", "a", "node", "from", "a", "linked", "list", "and", "link", "into", "the", "reclaimed", "list", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/store/HashIndex.java#L280-L297
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java
DocEnv.getConstructorDoc
public ConstructorDocImpl getConstructorDoc(MethodSymbol meth) { assert meth.isConstructor() : "expecting a constructor symbol"; ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth); if (result != null) return result; result = new ConstructorDocImpl(this, meth); methodMap.put(meth, result); return result; }
java
public ConstructorDocImpl getConstructorDoc(MethodSymbol meth) { assert meth.isConstructor() : "expecting a constructor symbol"; ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth); if (result != null) return result; result = new ConstructorDocImpl(this, meth); methodMap.put(meth, result); return result; }
[ "public", "ConstructorDocImpl", "getConstructorDoc", "(", "MethodSymbol", "meth", ")", "{", "assert", "meth", ".", "isConstructor", "(", ")", ":", "\"expecting a constructor symbol\"", ";", "ConstructorDocImpl", "result", "=", "(", "ConstructorDocImpl", ")", "methodMap"...
Return the ConstructorDoc for a MethodSymbol. Should be called only on symbols representing constructors.
[ "Return", "the", "ConstructorDoc", "for", "a", "MethodSymbol", ".", "Should", "be", "called", "only", "on", "symbols", "representing", "constructors", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java#L702-L709
unbescape/unbescape
src/main/java/org/unbescape/xml/XmlEscape.java
XmlEscape.escapeXml11AttributeMinimal
public static void escapeXml11AttributeMinimal(final char[] text, final int offset, final int len, final Writer writer) throws IOException { escapeXml(text, offset, len, writer, XmlEscapeSymbols.XML11_ATTRIBUTE_SYMBOLS, XmlEscapeType.CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA, XmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT); }
java
public static void escapeXml11AttributeMinimal(final char[] text, final int offset, final int len, final Writer writer) throws IOException { escapeXml(text, offset, len, writer, XmlEscapeSymbols.XML11_ATTRIBUTE_SYMBOLS, XmlEscapeType.CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA, XmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT); }
[ "public", "static", "void", "escapeXml11AttributeMinimal", "(", "final", "char", "[", "]", "text", ",", "final", "int", "offset", ",", "final", "int", "len", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeXml", "(", "text", ",", ...
<p> Perform an XML 1.1 level 1 (only markup-significant chars) <strong>escape</strong> operation on a <tt>char[]</tt> input meant to be an XML attribute value. </p> <p> <em>Level 1</em> means this method will only escape the five markup-significant characters which are <em>predefined</em> as Character Entity References in XML: <tt>&lt;</tt>, <tt>&gt;</tt>, <tt>&amp;</tt>, <tt>&quot;</tt> and <tt>&#39;</tt>. </p> <p> Besides, being an attribute value also <tt>&#92;t</tt>, <tt>&#92;n</tt> and <tt>&#92;r</tt> will be escaped to avoid white-space normalization from removing line feeds (turning them into white spaces) during future parsing operations. </p> <p> This method calls {@link #escapeXml10(char[], int, int, java.io.Writer, XmlEscapeType, XmlEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>type</tt>: {@link org.unbescape.xml.XmlEscapeType#CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA}</li> <li><tt>level</tt>: {@link org.unbescape.xml.XmlEscapeLevel#LEVEL_1_ONLY_MARKUP_SIGNIFICANT}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>char[]</tt> to be escaped. @param offset the position in <tt>text</tt> at which the escape operation should start. @param len the number of characters in <tt>text</tt> that should be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.5
[ "<p", ">", "Perform", "an", "XML", "1", ".", "1", "level", "1", "(", "only", "markup", "-", "significant", "chars", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "char", "[]", "<", "/", "tt", ">", "input", ...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/xml/XmlEscape.java#L1898-L1903
VoltDB/voltdb
src/frontend/org/voltdb/types/GeographyValue.java
GeographyValue.unflattenFromBuffer
public static GeographyValue unflattenFromBuffer(ByteBuffer inBuffer, int offset) { int origPos = inBuffer.position(); inBuffer.position(offset); GeographyValue gv = unflattenFromBuffer(inBuffer); inBuffer.position(origPos); return gv; }
java
public static GeographyValue unflattenFromBuffer(ByteBuffer inBuffer, int offset) { int origPos = inBuffer.position(); inBuffer.position(offset); GeographyValue gv = unflattenFromBuffer(inBuffer); inBuffer.position(origPos); return gv; }
[ "public", "static", "GeographyValue", "unflattenFromBuffer", "(", "ByteBuffer", "inBuffer", ",", "int", "offset", ")", "{", "int", "origPos", "=", "inBuffer", ".", "position", "(", ")", ";", "inBuffer", ".", "position", "(", "offset", ")", ";", "GeographyValue...
Deserialize a GeographyValue from a ByteBuffer from an absolute offset. (Assumes that the 4-byte length prefix has already been deserialized, and that offset points to the start of data just after the prefix.) @param inBuffer The ByteBuffer from which to read a GeographyValue @param offset The absolute offset in the ByteBuffer from which to read data @return A new GeographyValue instance.
[ "Deserialize", "a", "GeographyValue", "from", "a", "ByteBuffer", "from", "an", "absolute", "offset", ".", "(", "Assumes", "that", "the", "4", "-", "byte", "length", "prefix", "has", "already", "been", "deserialized", "and", "that", "offset", "points", "to", ...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/types/GeographyValue.java#L426-L432
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/concurrent/ExecutorServiceHelper.java
ExecutorServiceHelper.waitUntilAllTasksAreFinished
@Nonnull public static EInterrupt waitUntilAllTasksAreFinished (@Nonnull final ExecutorService aES) { return waitUntilAllTasksAreFinished (aES, 1, TimeUnit.SECONDS); }
java
@Nonnull public static EInterrupt waitUntilAllTasksAreFinished (@Nonnull final ExecutorService aES) { return waitUntilAllTasksAreFinished (aES, 1, TimeUnit.SECONDS); }
[ "@", "Nonnull", "public", "static", "EInterrupt", "waitUntilAllTasksAreFinished", "(", "@", "Nonnull", "final", "ExecutorService", "aES", ")", "{", "return", "waitUntilAllTasksAreFinished", "(", "aES", ",", "1", ",", "TimeUnit", ".", "SECONDS", ")", ";", "}" ]
Wait indefinitely on the {@link ExecutorService} until it terminates. @param aES The {@link ExecutorService} to operate on. May not be <code>null</code>. @return {@link EInterrupt#INTERRUPTED} if the executor service was interrupted while awaiting termination. Never <code>null</code>.
[ "Wait", "indefinitely", "on", "the", "{", "@link", "ExecutorService", "}", "until", "it", "terminates", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/concurrent/ExecutorServiceHelper.java#L54-L58
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/FormModelFactory.java
FormModelFactory.getChild
public FormModel getChild(HierarchicalFormModel formModel, String childPageName) { if (childPageName == null) throw new IllegalArgumentException("childPageName == null"); if (formModel == null) throw new IllegalArgumentException("formModel == null"); final FormModel[] children = formModel.getChildren(); if (children == null) return null; for (int i = 0; i < children.length; i++) { final FormModel child = children[i]; if (childPageName.equals(child.getId())) return child; } return null; }
java
public FormModel getChild(HierarchicalFormModel formModel, String childPageName) { if (childPageName == null) throw new IllegalArgumentException("childPageName == null"); if (formModel == null) throw new IllegalArgumentException("formModel == null"); final FormModel[] children = formModel.getChildren(); if (children == null) return null; for (int i = 0; i < children.length; i++) { final FormModel child = children[i]; if (childPageName.equals(child.getId())) return child; } return null; }
[ "public", "FormModel", "getChild", "(", "HierarchicalFormModel", "formModel", ",", "String", "childPageName", ")", "{", "if", "(", "childPageName", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"childPageName == null\"", ")", ";", "if", "(", ...
Returns the child of the formModel with the given page name. @param formModel the parent model to get the child from @param childPageName the name of the child to retrieve @return null the child can not be found @throws IllegalArgumentException if childPageName or formModel are null
[ "Returns", "the", "child", "of", "the", "formModel", "with", "the", "given", "page", "name", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/FormModelFactory.java#L159-L173
webjars/webjars-locator
src/main/java/org/webjars/RequireJS.java
RequireJS.getBowerBestMatchFromMainArray
private static String getBowerBestMatchFromMainArray(ArrayList<String> items, String name) { if(items.size() == 1) // not really much choice here return items.get(0); ArrayList<String> filteredList = new ArrayList<>(); // first idea: only look at .js files for(String item : items) { if(item.toLowerCase().endsWith(".js")) { filteredList.add(item); } } // ... if there are any if(filteredList.size() == 0) filteredList = items; final HashMap<String, Integer> distanceMap = new HashMap<>(); final String nameForComparisons = name.toLowerCase(); // second idea: most scripts are named after the project's name // sort all script files by their Levenshtein-distance // and return the one which is most similar to the project's name Collections.sort(filteredList, new Comparator<String>() { Integer getDistance(String value) { int distance; value = value.toLowerCase(); if (distanceMap.containsKey(value)) { distance = distanceMap.get(value); } else { distance = StringUtils.getLevenshteinDistance(nameForComparisons, value); distanceMap.put(value, distance); } return distance; } @Override public int compare(String o1, String o2) { return getDistance(o1).compareTo(getDistance(o2)); } }); return filteredList.get(0); }
java
private static String getBowerBestMatchFromMainArray(ArrayList<String> items, String name) { if(items.size() == 1) // not really much choice here return items.get(0); ArrayList<String> filteredList = new ArrayList<>(); // first idea: only look at .js files for(String item : items) { if(item.toLowerCase().endsWith(".js")) { filteredList.add(item); } } // ... if there are any if(filteredList.size() == 0) filteredList = items; final HashMap<String, Integer> distanceMap = new HashMap<>(); final String nameForComparisons = name.toLowerCase(); // second idea: most scripts are named after the project's name // sort all script files by their Levenshtein-distance // and return the one which is most similar to the project's name Collections.sort(filteredList, new Comparator<String>() { Integer getDistance(String value) { int distance; value = value.toLowerCase(); if (distanceMap.containsKey(value)) { distance = distanceMap.get(value); } else { distance = StringUtils.getLevenshteinDistance(nameForComparisons, value); distanceMap.put(value, distance); } return distance; } @Override public int compare(String o1, String o2) { return getDistance(o1).compareTo(getDistance(o2)); } }); return filteredList.get(0); }
[ "private", "static", "String", "getBowerBestMatchFromMainArray", "(", "ArrayList", "<", "String", ">", "items", ",", "String", "name", ")", "{", "if", "(", "items", ".", "size", "(", ")", "==", "1", ")", "// not really much choice here", "return", "items", "."...
/* Heuristic approach to find the 'best' candidate which most likely is the main script of a package.
[ "/", "*", "Heuristic", "approach", "to", "find", "the", "best", "candidate", "which", "most", "likely", "is", "the", "main", "script", "of", "a", "package", "." ]
train
https://github.com/webjars/webjars-locator/blob/8796fb3ff1b9ad5c0d433ecf63a60520c715e3a0/src/main/java/org/webjars/RequireJS.java#L476-L522
kaazing/gateway
mina.netty/src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioWorker.java
AbstractNioWorker.executeInIoThread
public void executeInIoThread(Runnable task, boolean alwaysAsync) { if (!alwaysAsync && isIoThread()) { task.run(); } else { registerTask(task); } }
java
public void executeInIoThread(Runnable task, boolean alwaysAsync) { if (!alwaysAsync && isIoThread()) { task.run(); } else { registerTask(task); } }
[ "public", "void", "executeInIoThread", "(", "Runnable", "task", ",", "boolean", "alwaysAsync", ")", "{", "if", "(", "!", "alwaysAsync", "&&", "isIoThread", "(", ")", ")", "{", "task", ".", "run", "(", ")", ";", "}", "else", "{", "registerTask", "(", "t...
Execute the {@link Runnable} in a IO-Thread @param task the {@link Runnable} to execute @param alwaysAsync {@code true} if the {@link Runnable} should be executed in an async fashion even if the current Thread == IO Thread
[ "Execute", "the", "{", "@link", "Runnable", "}", "in", "a", "IO", "-", "Thread" ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioWorker.java#L114-L120
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/dynamic/output/OutputRegistry.java
OutputRegistry.getStreamingType
@SuppressWarnings("rawtypes") static OutputType getStreamingType(Class<? extends CommandOutput> commandOutputClass) { ClassTypeInformation<? extends CommandOutput> classTypeInformation = ClassTypeInformation.from(commandOutputClass); TypeInformation<?> superTypeInformation = classTypeInformation.getSuperTypeInformation(StreamingOutput.class); if (superTypeInformation == null) { return null; } List<TypeInformation<?>> typeArguments = superTypeInformation.getTypeArguments(); return new OutputType(commandOutputClass, typeArguments.get(0), true) { @Override public ResolvableType withCodec(RedisCodec<?, ?> codec) { TypeInformation<?> typeInformation = ClassTypeInformation.from(codec.getClass()); ResolvableType resolvableType = ResolvableType.forType(commandOutputClass, new CodecVariableTypeResolver( typeInformation)); while (resolvableType != ResolvableType.NONE) { ResolvableType[] interfaces = resolvableType.getInterfaces(); for (ResolvableType resolvableInterface : interfaces) { if (resolvableInterface.getRawClass().equals(StreamingOutput.class)) { return resolvableInterface.getGeneric(0); } } resolvableType = resolvableType.getSuperType(); } throw new IllegalStateException(); } }; }
java
@SuppressWarnings("rawtypes") static OutputType getStreamingType(Class<? extends CommandOutput> commandOutputClass) { ClassTypeInformation<? extends CommandOutput> classTypeInformation = ClassTypeInformation.from(commandOutputClass); TypeInformation<?> superTypeInformation = classTypeInformation.getSuperTypeInformation(StreamingOutput.class); if (superTypeInformation == null) { return null; } List<TypeInformation<?>> typeArguments = superTypeInformation.getTypeArguments(); return new OutputType(commandOutputClass, typeArguments.get(0), true) { @Override public ResolvableType withCodec(RedisCodec<?, ?> codec) { TypeInformation<?> typeInformation = ClassTypeInformation.from(codec.getClass()); ResolvableType resolvableType = ResolvableType.forType(commandOutputClass, new CodecVariableTypeResolver( typeInformation)); while (resolvableType != ResolvableType.NONE) { ResolvableType[] interfaces = resolvableType.getInterfaces(); for (ResolvableType resolvableInterface : interfaces) { if (resolvableInterface.getRawClass().equals(StreamingOutput.class)) { return resolvableInterface.getGeneric(0); } } resolvableType = resolvableType.getSuperType(); } throw new IllegalStateException(); } }; }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "static", "OutputType", "getStreamingType", "(", "Class", "<", "?", "extends", "CommandOutput", ">", "commandOutputClass", ")", "{", "ClassTypeInformation", "<", "?", "extends", "CommandOutput", ">", "classTypeInforma...
Retrieve {@link OutputType} for a {@link StreamingOutput} type. @param commandOutputClass @return
[ "Retrieve", "{", "@link", "OutputType", "}", "for", "a", "{", "@link", "StreamingOutput", "}", "type", "." ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/dynamic/output/OutputRegistry.java#L152-L191
twitter/finagle
finagle-serversets/src/main/java/com/twitter/finagle/common/zookeeper/ZooKeeperUtils.java
ZooKeeperUtils.ensurePath
public static void ensurePath(ZooKeeperClient zkClient, List<ACL> acl, String path) throws ZooKeeperConnectionException, InterruptedException, KeeperException { Objects.requireNonNull(zkClient); Objects.requireNonNull(path); if (!path.startsWith("/")) { throw new IllegalArgumentException(); } ensurePathInternal(zkClient, acl, path); }
java
public static void ensurePath(ZooKeeperClient zkClient, List<ACL> acl, String path) throws ZooKeeperConnectionException, InterruptedException, KeeperException { Objects.requireNonNull(zkClient); Objects.requireNonNull(path); if (!path.startsWith("/")) { throw new IllegalArgumentException(); } ensurePathInternal(zkClient, acl, path); }
[ "public", "static", "void", "ensurePath", "(", "ZooKeeperClient", "zkClient", ",", "List", "<", "ACL", ">", "acl", ",", "String", "path", ")", "throws", "ZooKeeperConnectionException", ",", "InterruptedException", ",", "KeeperException", "{", "Objects", ".", "requ...
Ensures the given {@code path} exists in the ZK cluster accessed by {@code zkClient}. If the path already exists, nothing is done; however if any portion of the path is missing, it will be created with the given {@code acl} as a persistent zookeeper node. The given {@code path} must be a valid zookeeper absolute path. @param zkClient the client to use to access the ZK cluster @param acl the acl to use if creating path nodes @param path the path to ensure exists @throws ZooKeeperConnectionException if there was a problem accessing the ZK cluster @throws InterruptedException if we were interrupted attempting to connect to the ZK cluster @throws KeeperException if there was a problem in ZK
[ "Ensures", "the", "given", "{", "@code", "path", "}", "exists", "in", "the", "ZK", "cluster", "accessed", "by", "{", "@code", "zkClient", "}", ".", "If", "the", "path", "already", "exists", "nothing", "is", "done", ";", "however", "if", "any", "portion",...
train
https://github.com/twitter/finagle/blob/872be5f2b147fa50351bdbf08b003a26745e1df8/finagle-serversets/src/main/java/com/twitter/finagle/common/zookeeper/ZooKeeperUtils.java#L125-L134
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/MachinetagsApi.java
MachinetagsApi.getNamespaces
public Namespaces getNamespaces(String predicate, int perPage, int page, boolean sign) throws JinxException { Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.machinetags.getNamespaces"); if (!JinxUtils.isNullOrEmpty(predicate)) { params.put("predicate", predicate); } if (perPage > 0) { params.put("per_page", Integer.toString(perPage)); } if (page > 0) { params.put("page", Integer.toString(page)); } return jinx.flickrGet(params, Namespaces.class, sign); }
java
public Namespaces getNamespaces(String predicate, int perPage, int page, boolean sign) throws JinxException { Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.machinetags.getNamespaces"); if (!JinxUtils.isNullOrEmpty(predicate)) { params.put("predicate", predicate); } if (perPage > 0) { params.put("per_page", Integer.toString(perPage)); } if (page > 0) { params.put("page", Integer.toString(page)); } return jinx.flickrGet(params, Namespaces.class, sign); }
[ "public", "Namespaces", "getNamespaces", "(", "String", "predicate", ",", "int", "perPage", ",", "int", "page", ",", "boolean", "sign", ")", "throws", "JinxException", "{", "Map", "<", "String", ",", "String", ">", "params", "=", "new", "TreeMap", "<>", "(...
Return a list of unique namespaces, optionally limited by a given predicate, in alphabetical order. <br> This method does not require authentication. @param predicate (Optional) Limit the list of namespaces returned to those that have this predicate. @param perPage Number of photos to return per page. If this argument is less than 1, it defaults to 100. The maximum allowed value is 500. @param page The page of results to return. If this argument is less than 1, it defaults to 1. @param sign if true, the request will be signed. @return object containing a list of unique namespaces. @throws JinxException if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.machinetags.getNamespaces.html">flickr.machinetags.getNamespaces</a>
[ "Return", "a", "list", "of", "unique", "namespaces", "optionally", "limited", "by", "a", "given", "predicate", "in", "alphabetical", "order", ".", "<br", ">", "This", "method", "does", "not", "require", "authentication", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/MachinetagsApi.java#L57-L70
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/EmailApi.java
EmailApi.forwardEmail
public ApiSuccessResponse forwardEmail(String id, ForwardData1 forwardData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = forwardEmailWithHttpInfo(id, forwardData); return resp.getData(); }
java
public ApiSuccessResponse forwardEmail(String id, ForwardData1 forwardData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = forwardEmailWithHttpInfo(id, forwardData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "forwardEmail", "(", "String", "id", ",", "ForwardData1", "forwardData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "forwardEmailWithHttpInfo", "(", "id", ",", "forwardData", ")", "...
forward email forward inbound email interaction specified in the id path parameter @param id id of interaction to forward (required) @param forwardData Request parameters. (optional) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "forward", "email", "forward", "inbound", "email", "interaction", "specified", "in", "the", "id", "path", "parameter" ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/EmailApi.java#L509-L512
youngmonkeys/ezyfox-sfs2x
src/main/java/com/tvd12/ezyfox/sfs2x/data/impl/SimpleTransformer.java
SimpleTransformer.transformArrayObject
protected SFSDataWrapper transformArrayObject(Object value) { int length = ArrayUtils.getLength(value); if(length == 0) return new SFSDataWrapper(SFSDataType.NULL, null); ISFSArray sfsarray = new SFSArray(); for(Object obj : (Object[])value) sfsarray.add(transform(obj)); return new SFSDataWrapper(SFSDataType.SFS_ARRAY, sfsarray); }
java
protected SFSDataWrapper transformArrayObject(Object value) { int length = ArrayUtils.getLength(value); if(length == 0) return new SFSDataWrapper(SFSDataType.NULL, null); ISFSArray sfsarray = new SFSArray(); for(Object obj : (Object[])value) sfsarray.add(transform(obj)); return new SFSDataWrapper(SFSDataType.SFS_ARRAY, sfsarray); }
[ "protected", "SFSDataWrapper", "transformArrayObject", "(", "Object", "value", ")", "{", "int", "length", "=", "ArrayUtils", ".", "getLength", "(", "value", ")", ";", "if", "(", "length", "==", "0", ")", "return", "new", "SFSDataWrapper", "(", "SFSDataType", ...
Transform a java pojo object array to sfsarray @param value the pojo object array @return a SFSDataWrapper object
[ "Transform", "a", "java", "pojo", "object", "array", "to", "sfsarray" ]
train
https://github.com/youngmonkeys/ezyfox-sfs2x/blob/7e004033a3b551c3ae970a0c8f45db7b1ec144de/src/main/java/com/tvd12/ezyfox/sfs2x/data/impl/SimpleTransformer.java#L112-L120
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_usage_history_usageId_GET
public OvhUsageHistoryDetail project_serviceName_usage_history_usageId_GET(String serviceName, String usageId) throws IOException { String qPath = "/cloud/project/{serviceName}/usage/history/{usageId}"; StringBuilder sb = path(qPath, serviceName, usageId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhUsageHistoryDetail.class); }
java
public OvhUsageHistoryDetail project_serviceName_usage_history_usageId_GET(String serviceName, String usageId) throws IOException { String qPath = "/cloud/project/{serviceName}/usage/history/{usageId}"; StringBuilder sb = path(qPath, serviceName, usageId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhUsageHistoryDetail.class); }
[ "public", "OvhUsageHistoryDetail", "project_serviceName_usage_history_usageId_GET", "(", "String", "serviceName", ",", "String", "usageId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/usage/history/{usageId}\"", ";", "StringBuilder",...
Usage information details REST: GET /cloud/project/{serviceName}/usage/history/{usageId} @param serviceName [required] Service name @param usageId [required] Usage id
[ "Usage", "information", "details" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1726-L1731
threerings/narya
core/src/main/java/com/threerings/crowd/chat/server/SpeakUtil.java
SpeakUtil.sendSpeak
public static void sendSpeak (DObject speakObj, Name speaker, String bundle, String message, byte mode) { sendMessage(speakObj, new UserMessage(speaker, bundle, message, mode)); }
java
public static void sendSpeak (DObject speakObj, Name speaker, String bundle, String message, byte mode) { sendMessage(speakObj, new UserMessage(speaker, bundle, message, mode)); }
[ "public", "static", "void", "sendSpeak", "(", "DObject", "speakObj", ",", "Name", "speaker", ",", "String", "bundle", ",", "String", "message", ",", "byte", "mode", ")", "{", "sendMessage", "(", "speakObj", ",", "new", "UserMessage", "(", "speaker", ",", "...
Sends a speak notification to the specified place object originating with the specified speaker (the speaker optionally being a server entity that wishes to fake a "speak" message) and with the supplied message content. @param speakObj the object on which to generate the speak message. @param speaker the username of the user that generated the message (or some special speaker name for server messages). @param bundle null when the message originates from a real human, the bundle identifier that will be used by the client to translate the message text when the message originates from a server entity "faking" a chat message. @param message the text of the speak message. @param mode the mode of the message, see {@link ChatCodes#DEFAULT_MODE}.
[ "Sends", "a", "speak", "notification", "to", "the", "specified", "place", "object", "originating", "with", "the", "specified", "speaker", "(", "the", "speaker", "optionally", "being", "a", "server", "entity", "that", "wishes", "to", "fake", "a", "speak", "mess...
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/chat/server/SpeakUtil.java#L106-L110
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/ie/pascal/PascalTemplate.java
PascalTemplate.unpackToCliqueTemplates
public void unpackToCliqueTemplates(CliqueTemplates ct, double score) { ct.dateCliqueCounter.incrementCount(new DateTemplate(values[0], values[1], values[2], values[3]), score); if (values[4] != null) { ct.locationCliqueCounter.incrementCount(values[4], score); } ct.workshopInfoCliqueCounter.incrementCount(new InfoTemplate(values[6], values[5], values[7], values[9], values[8], values[10], ct), score); }
java
public void unpackToCliqueTemplates(CliqueTemplates ct, double score) { ct.dateCliqueCounter.incrementCount(new DateTemplate(values[0], values[1], values[2], values[3]), score); if (values[4] != null) { ct.locationCliqueCounter.incrementCount(values[4], score); } ct.workshopInfoCliqueCounter.incrementCount(new InfoTemplate(values[6], values[5], values[7], values[9], values[8], values[10], ct), score); }
[ "public", "void", "unpackToCliqueTemplates", "(", "CliqueTemplates", "ct", ",", "double", "score", ")", "{", "ct", ".", "dateCliqueCounter", ".", "incrementCount", "(", "new", "DateTemplate", "(", "values", "[", "0", "]", ",", "values", "[", "1", "]", ",", ...
Divides this template into partial templates, and updates the counts of these partial templates in the {@link CliqueTemplates} object. @param ct the partial templates counter object @param score increment counts by this much
[ "Divides", "this", "template", "into", "partial", "templates", "and", "updates", "the", "counts", "of", "these", "partial", "templates", "in", "the", "{", "@link", "CliqueTemplates", "}", "object", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ie/pascal/PascalTemplate.java#L252-L260
betfair/cougar
cougar-framework/jetty-transport/src/main/java/com/betfair/cougar/transport/impl/protocol/http/jsonrpc/JsonRpcTransportCommandProcessor.java
JsonRpcTransportCommandProcessor.writeErrorResponse
@Override public void writeErrorResponse(HttpCommand command, DehydratedExecutionContext context, CougarException error, boolean traceStarted) { try { incrementErrorsWritten(); final HttpServletResponse response = command.getResponse(); try { long bytesWritten = 0; if(error.getResponseCode() != ResponseCode.CantWriteToSocket) { ResponseCodeMapper.setResponseStatus(response, error.getResponseCode()); ByteCountingOutputStream out = null; try { int jsonErrorCode = mapServerFaultCodeToJsonErrorCode(error.getServerFaultCode()); JsonRpcError rpcError = new JsonRpcError(jsonErrorCode, error.getFault().getErrorCode(), null); JsonRpcErrorResponse jsonRpcErrorResponse = JsonRpcErrorResponse.buildErrorResponse(null, rpcError); out = new ByteCountingOutputStream(response.getOutputStream()); mapper.writeValue(out, jsonRpcErrorResponse); bytesWritten = out.getCount(); } catch (IOException ex) { handleResponseWritingIOException(ex, error.getClass()); } finally { closeStream(out); } } else { LOGGER.debug("Skipping error handling for a request where the output channel/socket has been prematurely closed"); } logAccess(command, resolveContextForErrorHandling(context, command), -1, bytesWritten, MediaType.APPLICATION_JSON_TYPE, MediaType.APPLICATION_JSON_TYPE, error.getResponseCode()); } finally { command.onComplete(); } } finally { if (context != null && traceStarted) { tracer.end(context.getRequestUUID()); } } }
java
@Override public void writeErrorResponse(HttpCommand command, DehydratedExecutionContext context, CougarException error, boolean traceStarted) { try { incrementErrorsWritten(); final HttpServletResponse response = command.getResponse(); try { long bytesWritten = 0; if(error.getResponseCode() != ResponseCode.CantWriteToSocket) { ResponseCodeMapper.setResponseStatus(response, error.getResponseCode()); ByteCountingOutputStream out = null; try { int jsonErrorCode = mapServerFaultCodeToJsonErrorCode(error.getServerFaultCode()); JsonRpcError rpcError = new JsonRpcError(jsonErrorCode, error.getFault().getErrorCode(), null); JsonRpcErrorResponse jsonRpcErrorResponse = JsonRpcErrorResponse.buildErrorResponse(null, rpcError); out = new ByteCountingOutputStream(response.getOutputStream()); mapper.writeValue(out, jsonRpcErrorResponse); bytesWritten = out.getCount(); } catch (IOException ex) { handleResponseWritingIOException(ex, error.getClass()); } finally { closeStream(out); } } else { LOGGER.debug("Skipping error handling for a request where the output channel/socket has been prematurely closed"); } logAccess(command, resolveContextForErrorHandling(context, command), -1, bytesWritten, MediaType.APPLICATION_JSON_TYPE, MediaType.APPLICATION_JSON_TYPE, error.getResponseCode()); } finally { command.onComplete(); } } finally { if (context != null && traceStarted) { tracer.end(context.getRequestUUID()); } } }
[ "@", "Override", "public", "void", "writeErrorResponse", "(", "HttpCommand", "command", ",", "DehydratedExecutionContext", "context", ",", "CougarException", "error", ",", "boolean", "traceStarted", ")", "{", "try", "{", "incrementErrorsWritten", "(", ")", ";", "fin...
Please note this should only be used when the JSON rpc call itself fails - the answer will not contain any mention of the requests that caused the failure, nor their ID @param command the command that caused the error @param context @param error @param traceStarted
[ "Please", "note", "this", "should", "only", "be", "used", "when", "the", "JSON", "rpc", "call", "itself", "fails", "-", "the", "answer", "will", "not", "contain", "any", "mention", "of", "the", "requests", "that", "caused", "the", "failure", "nor", "their"...
train
https://github.com/betfair/cougar/blob/08d1fe338fbd0e8572a9c2305bb5796402d5b1f5/cougar-framework/jetty-transport/src/main/java/com/betfair/cougar/transport/impl/protocol/http/jsonrpc/JsonRpcTransportCommandProcessor.java#L406-L446
rometools/rome
rome/src/main/java/com/rometools/rome/io/impl/RSS091UserlandParser.java
RSS091UserlandParser.parseItem
@Override protected Item parseItem(final Element rssRoot, final Element eItem, final Locale locale) { final Item item = super.parseItem(rssRoot, eItem, locale); final Element description = eItem.getChild("description", getRSSNamespace()); if (description != null) { item.setDescription(parseItemDescription(rssRoot, description)); } final Element encoded = eItem.getChild("encoded", getContentNamespace()); if (encoded != null) { final Content content = new Content(); content.setType(Content.HTML); content.setValue(encoded.getText()); item.setContent(content); } return item; }
java
@Override protected Item parseItem(final Element rssRoot, final Element eItem, final Locale locale) { final Item item = super.parseItem(rssRoot, eItem, locale); final Element description = eItem.getChild("description", getRSSNamespace()); if (description != null) { item.setDescription(parseItemDescription(rssRoot, description)); } final Element encoded = eItem.getChild("encoded", getContentNamespace()); if (encoded != null) { final Content content = new Content(); content.setType(Content.HTML); content.setValue(encoded.getText()); item.setContent(content); } return item; }
[ "@", "Override", "protected", "Item", "parseItem", "(", "final", "Element", "rssRoot", ",", "final", "Element", "eItem", ",", "final", "Locale", "locale", ")", "{", "final", "Item", "item", "=", "super", ".", "parseItem", "(", "rssRoot", ",", "eItem", ",",...
Parses an item element of an RSS document looking for item information. <p/> It first invokes super.parseItem and then parses and injects the description property if present. <p/> @param rssRoot the root element of the RSS document in case it's needed for context. @param eItem the item element to parse. @return the parsed RSSItem bean.
[ "Parses", "an", "item", "element", "of", "an", "RSS", "document", "looking", "for", "item", "information", ".", "<p", "/", ">", "It", "first", "invokes", "super", ".", "parseItem", "and", "then", "parses", "and", "injects", "the", "description", "property", ...
train
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome/src/main/java/com/rometools/rome/io/impl/RSS091UserlandParser.java#L266-L286
liferay/com-liferay-commerce
commerce-tax-api/src/main/java/com/liferay/commerce/tax/service/persistence/CommerceTaxMethodUtil.java
CommerceTaxMethodUtil.findByG_E
public static CommerceTaxMethod findByG_E(long groupId, String engineKey) throws com.liferay.commerce.tax.exception.NoSuchTaxMethodException { return getPersistence().findByG_E(groupId, engineKey); }
java
public static CommerceTaxMethod findByG_E(long groupId, String engineKey) throws com.liferay.commerce.tax.exception.NoSuchTaxMethodException { return getPersistence().findByG_E(groupId, engineKey); }
[ "public", "static", "CommerceTaxMethod", "findByG_E", "(", "long", "groupId", ",", "String", "engineKey", ")", "throws", "com", ".", "liferay", ".", "commerce", ".", "tax", ".", "exception", ".", "NoSuchTaxMethodException", "{", "return", "getPersistence", "(", ...
Returns the commerce tax method where groupId = &#63; and engineKey = &#63; or throws a {@link NoSuchTaxMethodException} if it could not be found. @param groupId the group ID @param engineKey the engine key @return the matching commerce tax method @throws NoSuchTaxMethodException if a matching commerce tax method could not be found
[ "Returns", "the", "commerce", "tax", "method", "where", "groupId", "=", "&#63", ";", "and", "engineKey", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchTaxMethodException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-tax-api/src/main/java/com/liferay/commerce/tax/service/persistence/CommerceTaxMethodUtil.java#L282-L285
auth0/java-jwt
lib/src/main/java/com/auth0/jwt/algorithms/Algorithm.java
Algorithm.ECDSA512
@Deprecated public static Algorithm ECDSA512(ECKey key) throws IllegalArgumentException { ECPublicKey publicKey = key instanceof ECPublicKey ? (ECPublicKey) key : null; ECPrivateKey privateKey = key instanceof ECPrivateKey ? (ECPrivateKey) key : null; return ECDSA512(publicKey, privateKey); }
java
@Deprecated public static Algorithm ECDSA512(ECKey key) throws IllegalArgumentException { ECPublicKey publicKey = key instanceof ECPublicKey ? (ECPublicKey) key : null; ECPrivateKey privateKey = key instanceof ECPrivateKey ? (ECPrivateKey) key : null; return ECDSA512(publicKey, privateKey); }
[ "@", "Deprecated", "public", "static", "Algorithm", "ECDSA512", "(", "ECKey", "key", ")", "throws", "IllegalArgumentException", "{", "ECPublicKey", "publicKey", "=", "key", "instanceof", "ECPublicKey", "?", "(", "ECPublicKey", ")", "key", ":", "null", ";", "ECPr...
Creates a new Algorithm instance using SHA512withECDSA. Tokens specify this as "ES512". @param key the key to use in the verify or signing instance. @return a valid ECDSA512 Algorithm. @throws IllegalArgumentException if the provided Key is null. @deprecated use {@link #ECDSA512(ECPublicKey, ECPrivateKey)} or {@link #ECDSA512(ECDSAKeyProvider)}
[ "Creates", "a", "new", "Algorithm", "instance", "using", "SHA512withECDSA", ".", "Tokens", "specify", "this", "as", "ES512", "." ]
train
https://github.com/auth0/java-jwt/blob/890538970a9699b7251a4bfe4f26e8d7605ad530/lib/src/main/java/com/auth0/jwt/algorithms/Algorithm.java#L308-L313
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/PathPatternUtils.java
PathPatternUtils.extractCommonAncestor
public static String extractCommonAncestor(String pattern, String absPath) { pattern = normalizePath(pattern); absPath = normalizePath(absPath); String[] patterEntries = pattern.split("/"); String[] pathEntries = absPath.split("/"); StringBuilder ancestor = new StringBuilder(); int count = Math.min(pathEntries.length, patterEntries.length); for (int i = 1; i < count; i++) { if (acceptName(patterEntries[i], pathEntries[i])) { ancestor.append("/"); ancestor.append(pathEntries[i]); } else { break; } } return ancestor.length() == 0 ? JCRPath.ROOT_PATH : ancestor.toString(); }
java
public static String extractCommonAncestor(String pattern, String absPath) { pattern = normalizePath(pattern); absPath = normalizePath(absPath); String[] patterEntries = pattern.split("/"); String[] pathEntries = absPath.split("/"); StringBuilder ancestor = new StringBuilder(); int count = Math.min(pathEntries.length, patterEntries.length); for (int i = 1; i < count; i++) { if (acceptName(patterEntries[i], pathEntries[i])) { ancestor.append("/"); ancestor.append(pathEntries[i]); } else { break; } } return ancestor.length() == 0 ? JCRPath.ROOT_PATH : ancestor.toString(); }
[ "public", "static", "String", "extractCommonAncestor", "(", "String", "pattern", ",", "String", "absPath", ")", "{", "pattern", "=", "normalizePath", "(", "pattern", ")", ";", "absPath", "=", "normalizePath", "(", "absPath", ")", ";", "String", "[", "]", "pa...
Returns common ancestor for paths represented by absolute path and pattern.
[ "Returns", "common", "ancestor", "for", "paths", "represented", "by", "absolute", "path", "and", "pattern", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/PathPatternUtils.java#L98-L123
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/FileLock.java
FileLock.getFileLock
public static FileLock getFileLock(java.io.RandomAccessFile file, String fileName) throws java.io.IOException { return (FileLock) Utils.getImpl("com.ibm.ws.objectManager.utils.FileLockImpl", new Class[] { java.io.RandomAccessFile.class, String.class }, new Object[] { file, fileName }); }
java
public static FileLock getFileLock(java.io.RandomAccessFile file, String fileName) throws java.io.IOException { return (FileLock) Utils.getImpl("com.ibm.ws.objectManager.utils.FileLockImpl", new Class[] { java.io.RandomAccessFile.class, String.class }, new Object[] { file, fileName }); }
[ "public", "static", "FileLock", "getFileLock", "(", "java", ".", "io", ".", "RandomAccessFile", "file", ",", "String", "fileName", ")", "throws", "java", ".", "io", ".", "IOException", "{", "return", "(", "FileLock", ")", "Utils", ".", "getImpl", "(", "\"c...
Create a platform specific FileLock instance. @param file to be locked. The file must be already open. @param fileName of the file. @return FileLock for the file. @throws java.io.IOException
[ "Create", "a", "platform", "specific", "FileLock", "instance", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/FileLock.java#L33-L38
Alluxio/alluxio
core/common/src/main/java/alluxio/util/executor/ExecutorServiceFactories.java
ExecutorServiceFactories.fixedThreadPool
public static ExecutorServiceFactory fixedThreadPool(String name, int nThreads) { return () -> Executors.newFixedThreadPool(nThreads, ThreadFactoryUtils.build(name + "-%d", true)); }
java
public static ExecutorServiceFactory fixedThreadPool(String name, int nThreads) { return () -> Executors.newFixedThreadPool(nThreads, ThreadFactoryUtils.build(name + "-%d", true)); }
[ "public", "static", "ExecutorServiceFactory", "fixedThreadPool", "(", "String", "name", ",", "int", "nThreads", ")", "{", "return", "(", ")", "->", "Executors", ".", "newFixedThreadPool", "(", "nThreads", ",", "ThreadFactoryUtils", ".", "build", "(", "name", "+"...
Returns a {@link ExecutorServiceFactory} which creates threadpool executors with the given base name and number of threads. Created threads will be daemonic. @param name the base name for executor thread names @param nThreads the number of threads to create executors with @return the {@link ExecutorServiceFactory}
[ "Returns", "a", "{", "@link", "ExecutorServiceFactory", "}", "which", "creates", "threadpool", "executors", "with", "the", "given", "base", "name", "and", "number", "of", "threads", ".", "Created", "threads", "will", "be", "daemonic", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/executor/ExecutorServiceFactories.java#L42-L45
jOOQ/jOOL
jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java
Unchecked.biFunction
public static <T, U, R> BiFunction<T, U, R> biFunction(CheckedBiFunction<T, U, R> function) { return biFunction(function, THROWABLE_TO_RUNTIME_EXCEPTION); }
java
public static <T, U, R> BiFunction<T, U, R> biFunction(CheckedBiFunction<T, U, R> function) { return biFunction(function, THROWABLE_TO_RUNTIME_EXCEPTION); }
[ "public", "static", "<", "T", ",", "U", ",", "R", ">", "BiFunction", "<", "T", ",", "U", ",", "R", ">", "biFunction", "(", "CheckedBiFunction", "<", "T", ",", "U", ",", "R", ">", "function", ")", "{", "return", "biFunction", "(", "function", ",", ...
Wrap a {@link org.jooq.lambda.fi.util.function.CheckedBiFunction} in a {@link BiFunction}. <p> Example: <code><pre> map.computeIfPresent("key", Unchecked.biFunction((k, v) -> { if (k == null || v == null) throw new Exception("No nulls allowed in map"); return 42; })); </pre></code>
[ "Wrap", "a", "{", "@link", "org", ".", "jooq", ".", "lambda", ".", "fi", ".", "util", ".", "function", ".", "CheckedBiFunction", "}", "in", "a", "{", "@link", "BiFunction", "}", ".", "<p", ">", "Example", ":", "<code", ">", "<pre", ">", "map", ".",...
train
https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L329-L331
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.updateConfig
public void updateConfig(String appName, Map<String, String> config) { connection.execute(new ConfigUpdate(appName, config), apiKey); }
java
public void updateConfig(String appName, Map<String, String> config) { connection.execute(new ConfigUpdate(appName, config), apiKey); }
[ "public", "void", "updateConfig", "(", "String", "appName", ",", "Map", "<", "String", ",", "String", ">", "config", ")", "{", "connection", ".", "execute", "(", "new", "ConfigUpdate", "(", "appName", ",", "config", ")", ",", "apiKey", ")", ";", "}" ]
Update environment variables to an app. @param appName App name. See {@link #listApps} for a list of apps that can be used. @param config Key/Value pairs of environment variables.
[ "Update", "environment", "variables", "to", "an", "app", "." ]
train
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L329-L331
JodaOrg/joda-convert
src/main/java/org/joda/convert/MethodConstructorStringConverter.java
MethodConstructorStringConverter.convertFromString
@Override public T convertFromString(Class<? extends T> cls, String str) { try { return fromString.newInstance(str); } catch (IllegalAccessException ex) { throw new IllegalStateException("Constructor is not accessible: " + fromString); } catch (InstantiationException ex) { throw new IllegalStateException("Constructor is not valid: " + fromString); } catch (InvocationTargetException ex) { if (ex.getCause() instanceof RuntimeException) { throw (RuntimeException) ex.getCause(); } throw new RuntimeException(ex.getMessage(), ex.getCause()); } }
java
@Override public T convertFromString(Class<? extends T> cls, String str) { try { return fromString.newInstance(str); } catch (IllegalAccessException ex) { throw new IllegalStateException("Constructor is not accessible: " + fromString); } catch (InstantiationException ex) { throw new IllegalStateException("Constructor is not valid: " + fromString); } catch (InvocationTargetException ex) { if (ex.getCause() instanceof RuntimeException) { throw (RuntimeException) ex.getCause(); } throw new RuntimeException(ex.getMessage(), ex.getCause()); } }
[ "@", "Override", "public", "T", "convertFromString", "(", "Class", "<", "?", "extends", "T", ">", "cls", ",", "String", "str", ")", "{", "try", "{", "return", "fromString", ".", "newInstance", "(", "str", ")", ";", "}", "catch", "(", "IllegalAccessExcept...
Converts the {@code String} to an object. @param cls the class to convert to, not null @param str the string to convert, not null @return the converted object, may be null but generally not
[ "Converts", "the", "{" ]
train
https://github.com/JodaOrg/joda-convert/blob/266bd825f4550590d5dafdf4225c548559e0633b/src/main/java/org/joda/convert/MethodConstructorStringConverter.java#L65-L79
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/UsersInner.java
UsersInner.createOrUpdate
public UserInner createOrUpdate(String resourceGroupName, String labAccountName, String labName, String userName, UserInner user) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, userName, user).toBlocking().single().body(); }
java
public UserInner createOrUpdate(String resourceGroupName, String labAccountName, String labName, String userName, UserInner user) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, userName, user).toBlocking().single().body(); }
[ "public", "UserInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "labName", ",", "String", "userName", ",", "UserInner", "user", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroup...
Create or replace an existing User. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param userName The name of the user. @param user The User registered to a lab @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 UserInner object if successful.
[ "Create", "or", "replace", "an", "existing", "User", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/UsersInner.java#L586-L588
gotev/android-upload-service
uploadservice-ftp/src/main/java/net/gotev/uploadservice/ftp/FTPUploadRequest.java
FTPUploadRequest.addFileToUpload
public FTPUploadRequest addFileToUpload(String filePath, String remotePath) throws FileNotFoundException { return addFileToUpload(filePath, remotePath, null); }
java
public FTPUploadRequest addFileToUpload(String filePath, String remotePath) throws FileNotFoundException { return addFileToUpload(filePath, remotePath, null); }
[ "public", "FTPUploadRequest", "addFileToUpload", "(", "String", "filePath", ",", "String", "remotePath", ")", "throws", "FileNotFoundException", "{", "return", "addFileToUpload", "(", "filePath", ",", "remotePath", ",", "null", ")", ";", "}" ]
Add a file to be uploaded. @param filePath path to the local file on the device @param remotePath absolute path (or relative path to the default remote working directory) of the file on the FTP server. Valid paths are for example: {@code /path/to/myfile.txt}, {@code relative/path/} or {@code myfile.zip}. If any of the directories of the specified remote path does not exist, they will be automatically created. You can also set with which permissions to create them by using {@link FTPUploadRequest#setCreatedDirectoriesPermissions(UnixPermissions)} method. <br><br> Remember that if the remote path ends with {@code /}, the remote file name will be the same as the local file, so for example if I'm uploading {@code /home/alex/photos.zip} into {@code images/} remote path, I will have {@code photos.zip} into the remote {@code images/} directory. <br><br> If the remote path does not end with {@code /}, the last path segment will be used as the remote file name, so for example if I'm uploading {@code /home/alex/photos.zip} into {@code images/vacations.zip}, I will have {@code vacations.zip} into the remote {@code images/} directory. @return {@link FTPUploadRequest} @throws FileNotFoundException if the local file does not exist
[ "Add", "a", "file", "to", "be", "uploaded", "." ]
train
https://github.com/gotev/android-upload-service/blob/0952fcbe4b32c100150ffd0a237de3be4942e0a8/uploadservice-ftp/src/main/java/net/gotev/uploadservice/ftp/FTPUploadRequest.java#L112-L114
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringParser.java
StringParser.parseInt
public static int parseInt (@Nullable final Object aObject, @Nonnegative final int nRadix, final int nDefault) { if (aObject == null) return nDefault; if (aObject instanceof Number) return ((Number) aObject).intValue (); return parseInt (aObject.toString (), nRadix, nDefault); }
java
public static int parseInt (@Nullable final Object aObject, @Nonnegative final int nRadix, final int nDefault) { if (aObject == null) return nDefault; if (aObject instanceof Number) return ((Number) aObject).intValue (); return parseInt (aObject.toString (), nRadix, nDefault); }
[ "public", "static", "int", "parseInt", "(", "@", "Nullable", "final", "Object", "aObject", ",", "@", "Nonnegative", "final", "int", "nRadix", ",", "final", "int", "nDefault", ")", "{", "if", "(", "aObject", "==", "null", ")", "return", "nDefault", ";", "...
Parse the given {@link Object} as int with the specified radix. @param aObject The object to parse. May be <code>null</code>. @param nRadix The radix to use. Must be &ge; {@link Character#MIN_RADIX} and &le; {@link Character#MAX_RADIX}. @param nDefault The default value to be returned if the passed object could not be converted to a valid value. @return The default value if the string does not represent a valid value.
[ "Parse", "the", "given", "{", "@link", "Object", "}", "as", "int", "with", "the", "specified", "radix", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L727-L734
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/common/logging/Logger.java
Logger.logMessage
public synchronized void logMessage(final Level level, final String message) { if (logLevel.toInt() > level.toInt()) { return; } try { this.writer.write(System.currentTimeMillis() + "\t" + consumerName + " [" + type.toString() + "] " + "\t" + message + "\r\n"); this.writer.flush(); } catch (IOException ioe) { ioe.printStackTrace(); } }
java
public synchronized void logMessage(final Level level, final String message) { if (logLevel.toInt() > level.toInt()) { return; } try { this.writer.write(System.currentTimeMillis() + "\t" + consumerName + " [" + type.toString() + "] " + "\t" + message + "\r\n"); this.writer.flush(); } catch (IOException ioe) { ioe.printStackTrace(); } }
[ "public", "synchronized", "void", "logMessage", "(", "final", "Level", "level", ",", "final", "String", "message", ")", "{", "if", "(", "logLevel", ".", "toInt", "(", ")", ">", "level", ".", "toInt", "(", ")", ")", "{", "return", ";", "}", "try", "{"...
This method will be called with a message and the related log level. It be verified if the message should be logged or not. The format of the logged message is: \t consumerName [ Type of Logger ] \t message \r\n @param level level @param message message
[ "This", "method", "will", "be", "called", "with", "a", "message", "and", "the", "related", "log", "level", ".", "It", "be", "verified", "if", "the", "message", "should", "be", "logged", "or", "not", "." ]
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/common/logging/Logger.java#L229-L244
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/GLRenderWrapper.java
GLRenderWrapper.savePixels
private Bitmap savePixels(int x, int y, int w, int h) { int b[] = new int[w * (y + h)]; int bt[] = new int[w * h]; IntBuffer ib = IntBuffer.wrap(b); ib.position(0); GLES20.glReadPixels(x, 0, w, y + h, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ib); for (int i = 0, k = 0; i < h; i++, k++) { // remember, that OpenGL bitmap is incompatible with Android bitmap // and so, some correction need. for (int j = 0; j < w; j++) { int pix = b[i * w + j]; int pb = (pix >> 16) & 0xff; int pr = (pix << 16) & 0x00ff0000; int pix1 = (pix & 0xff00ff00) | pr | pb; bt[(h - k - 1) * w + j] = pix1; } } Bitmap sb = Bitmap.createBitmap(bt, w, h, Bitmap.Config.ARGB_8888); return sb; }
java
private Bitmap savePixels(int x, int y, int w, int h) { int b[] = new int[w * (y + h)]; int bt[] = new int[w * h]; IntBuffer ib = IntBuffer.wrap(b); ib.position(0); GLES20.glReadPixels(x, 0, w, y + h, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ib); for (int i = 0, k = 0; i < h; i++, k++) { // remember, that OpenGL bitmap is incompatible with Android bitmap // and so, some correction need. for (int j = 0; j < w; j++) { int pix = b[i * w + j]; int pb = (pix >> 16) & 0xff; int pr = (pix << 16) & 0x00ff0000; int pix1 = (pix & 0xff00ff00) | pr | pb; bt[(h - k - 1) * w + j] = pix1; } } Bitmap sb = Bitmap.createBitmap(bt, w, h, Bitmap.Config.ARGB_8888); return sb; }
[ "private", "Bitmap", "savePixels", "(", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ")", "{", "int", "b", "[", "]", "=", "new", "int", "[", "w", "*", "(", "y", "+", "h", ")", "]", ";", "int", "bt", "[", "]", "=", "new",...
Extract the bitmap from OpenGL @param x the start column @param y the start line @param w the width of the bitmap @param h the height of the bitmap
[ "Extract", "the", "bitmap", "from", "OpenGL" ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/GLRenderWrapper.java#L128-L150
samskivert/samskivert
src/main/java/com/samskivert/util/ProcessLogger.java
ProcessLogger.copyOutput
public static void copyOutput (Logger target, String name, Process process) { new StreamReader(target, name + " stdout", process.getInputStream()).start(); new StreamReader(target, name + " stderr", process.getErrorStream()).start(); }
java
public static void copyOutput (Logger target, String name, Process process) { new StreamReader(target, name + " stdout", process.getInputStream()).start(); new StreamReader(target, name + " stderr", process.getErrorStream()).start(); }
[ "public", "static", "void", "copyOutput", "(", "Logger", "target", ",", "String", "name", ",", "Process", "process", ")", "{", "new", "StreamReader", "(", "target", ",", "name", "+", "\" stdout\"", ",", "process", ".", "getInputStream", "(", ")", ")", ".",...
Starts threads that copy the output of the supplied process's stdout and stderr streams to the supplied target logger. When the streams reach EOF, the threads will exit. The threads will be set to daemon so that they do not prevent the VM from exiting. @param target the logger to which to copy the output. @param name prepended to all output lines as either <code>name stderr:</code> or <code>name stdout:</code>. @param process the process whose output should be copied.
[ "Starts", "threads", "that", "copy", "the", "output", "of", "the", "supplied", "process", "s", "stdout", "and", "stderr", "streams", "to", "the", "supplied", "target", "logger", ".", "When", "the", "streams", "reach", "EOF", "the", "threads", "will", "exit",...
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ProcessLogger.java#L29-L33
trustathsh/ifmapj
src/main/java/de/hshannover/f4/trust/ifmapj/IfmapJHelper.java
IfmapJHelper.getTrustManagers
public static TrustManager[] getTrustManagers() throws InitializationException { String file = System.getProperty("javax.net.ssl.trustStore"); String pass = System.getProperty("javax.net.ssl.trustStorePassword"); if (file == null || pass == null) { throw new InitializationException("javax.net.ssl.trustStore / " + "javax.net.ssl.trustStorePassword not set"); } return getTrustManagers(file, pass); }
java
public static TrustManager[] getTrustManagers() throws InitializationException { String file = System.getProperty("javax.net.ssl.trustStore"); String pass = System.getProperty("javax.net.ssl.trustStorePassword"); if (file == null || pass == null) { throw new InitializationException("javax.net.ssl.trustStore / " + "javax.net.ssl.trustStorePassword not set"); } return getTrustManagers(file, pass); }
[ "public", "static", "TrustManager", "[", "]", "getTrustManagers", "(", ")", "throws", "InitializationException", "{", "String", "file", "=", "System", ".", "getProperty", "(", "\"javax.net.ssl.trustStore\"", ")", ";", "String", "pass", "=", "System", ".", "getProp...
Creates {@link TrustManager} instances based on the javax.net.ssl.trustStore and javax.net.ssl.trustStorePassword environment variables. @return an array of {@link TrustManager} instances @throws InitializationException
[ "Creates", "{", "@link", "TrustManager", "}", "instances", "based", "on", "the", "javax", ".", "net", ".", "ssl", ".", "trustStore", "and", "javax", ".", "net", ".", "ssl", ".", "trustStorePassword", "environment", "variables", "." ]
train
https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/IfmapJHelper.java#L136-L146
mangstadt/biweekly
src/main/java/biweekly/io/scribe/property/RecurrencePropertyScribe.java
RecurrencePropertyScribe.handleVersion1Multivalued
private void handleVersion1Multivalued(String value, ICalDataType dataType, ICalParameters parameters, ParseContext context) { List<String> rrules = splitRRULEValues(value); if (rrules.size() == 1) { return; } DataModelConversionException conversionException = new DataModelConversionException(null); for (String rrule : rrules) { ICalParameters parametersCopy = new ICalParameters(parameters); ICalProperty property; try { property = parseTextV1(rrule, dataType, parametersCopy, context); } catch (CannotParseException e) { //@formatter:off context.getWarnings().add(new ParseWarning.Builder(context) .message(e) .build() ); //@formatter:on property = new RawProperty(getPropertyName(context.getVersion()), dataType, rrule); property.setParameters(parametersCopy); } conversionException.getProperties().add(property); } throw conversionException; }
java
private void handleVersion1Multivalued(String value, ICalDataType dataType, ICalParameters parameters, ParseContext context) { List<String> rrules = splitRRULEValues(value); if (rrules.size() == 1) { return; } DataModelConversionException conversionException = new DataModelConversionException(null); for (String rrule : rrules) { ICalParameters parametersCopy = new ICalParameters(parameters); ICalProperty property; try { property = parseTextV1(rrule, dataType, parametersCopy, context); } catch (CannotParseException e) { //@formatter:off context.getWarnings().add(new ParseWarning.Builder(context) .message(e) .build() ); //@formatter:on property = new RawProperty(getPropertyName(context.getVersion()), dataType, rrule); property.setParameters(parametersCopy); } conversionException.getProperties().add(property); } throw conversionException; }
[ "private", "void", "handleVersion1Multivalued", "(", "String", "value", ",", "ICalDataType", "dataType", ",", "ICalParameters", "parameters", ",", "ParseContext", "context", ")", "{", "List", "<", "String", ">", "rrules", "=", "splitRRULEValues", "(", "value", ")"...
Version 1.0 allows multiple RRULE values to be defined inside of the same property. This method checks for this and, if multiple values are found, parses them and throws a {@link DataModelConversionException}. @param value the property value @param dataType the property data type @param parameters the property parameters @param context the parse context @throws DataModelConversionException if the property contains multiple RRULE values
[ "Version", "1", ".", "0", "allows", "multiple", "RRULE", "values", "to", "be", "defined", "inside", "of", "the", "same", "property", ".", "This", "method", "checks", "for", "this", "and", "if", "multiple", "values", "are", "found", "parses", "them", "and",...
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/scribe/property/RecurrencePropertyScribe.java#L229-L256
radkovo/jStyleParser
src/main/java/cz/vutbr/web/domassign/Repeater.java
Repeater.repeatOverFourTermDeclaration
public boolean repeatOverFourTermDeclaration(Declaration d, Map<String, CSSProperty> properties, Map<String, Term<?>> values) throws IllegalArgumentException { switch (d.size()) { case 1: // one term for all value Term<?> term = d.get(0); // check inherit if(term instanceof TermIdent && CSSProperty.INHERIT_KEYWORD.equalsIgnoreCase(((TermIdent) term).getValue())) { CSSProperty property = CSSProperty.Translator.createInherit(type); for(int i = 0; i < times; i++) { properties.put(names.get(i), property); } return true; } assignTerms(term, term, term, term); return repeat(properties, values); case 2: // one term for bottom-top and left-right Term<?> term1 = d.get(0); Term<?> term2 = d.get(1); assignTerms(term1, term2, term1, term2); return repeat(properties, values); case 3: // terms for bottom, top, left-right Term<?> term31 = d.get(0); Term<?> term32 = d.get(1); Term<?> term33 = d.get(2); assignTerms(term31, term32, term33, term32); return repeat(properties, values); case 4: // four individual terms (or more - omitted) //if (d.size() > 4) // LoggerFactory.getLogger(Repeater.class).warn("Omitting additional terms in four-term declaration"); Term<?> term41 = d.get(0); Term<?> term42 = d.get(1); Term<?> term43 = d.get(2); Term<?> term44 = d.get(3); assignTerms(term41, term42, term43, term44); return repeat(properties, values); default: throw new IllegalArgumentException( "Invalid length of terms in Repeater."); } }
java
public boolean repeatOverFourTermDeclaration(Declaration d, Map<String, CSSProperty> properties, Map<String, Term<?>> values) throws IllegalArgumentException { switch (d.size()) { case 1: // one term for all value Term<?> term = d.get(0); // check inherit if(term instanceof TermIdent && CSSProperty.INHERIT_KEYWORD.equalsIgnoreCase(((TermIdent) term).getValue())) { CSSProperty property = CSSProperty.Translator.createInherit(type); for(int i = 0; i < times; i++) { properties.put(names.get(i), property); } return true; } assignTerms(term, term, term, term); return repeat(properties, values); case 2: // one term for bottom-top and left-right Term<?> term1 = d.get(0); Term<?> term2 = d.get(1); assignTerms(term1, term2, term1, term2); return repeat(properties, values); case 3: // terms for bottom, top, left-right Term<?> term31 = d.get(0); Term<?> term32 = d.get(1); Term<?> term33 = d.get(2); assignTerms(term31, term32, term33, term32); return repeat(properties, values); case 4: // four individual terms (or more - omitted) //if (d.size() > 4) // LoggerFactory.getLogger(Repeater.class).warn("Omitting additional terms in four-term declaration"); Term<?> term41 = d.get(0); Term<?> term42 = d.get(1); Term<?> term43 = d.get(2); Term<?> term44 = d.get(3); assignTerms(term41, term42, term43, term44); return repeat(properties, values); default: throw new IllegalArgumentException( "Invalid length of terms in Repeater."); } }
[ "public", "boolean", "repeatOverFourTermDeclaration", "(", "Declaration", "d", ",", "Map", "<", "String", ",", "CSSProperty", ">", "properties", ",", "Map", "<", "String", ",", "Term", "<", "?", ">", ">", "values", ")", "throws", "IllegalArgumentException", "{...
Construct terms array to be used by repeated object from available terms (in size 1 to 4) according to CSS rules. Example: <p> <code>margin: 2px 5px;</code> creates virtual terms array with terms <code>2px 5px 2px 5px</code> so top and bottom; left and right contains the same margin </p> @param d Declaration with terms @param properties Properties map where to store properties types @param values Value map where to store properties values @return <code>true</code> in case of success, <code>false</code> elsewhere @throws IllegalArgumentException In case when number of terms passed does not correspond to iteration times
[ "Construct", "terms", "array", "to", "be", "used", "by", "repeated", "object", "from", "available", "terms", "(", "in", "size", "1", "to", "4", ")", "according", "to", "CSS", "rules", "." ]
train
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/Repeater.java#L113-L160
hap-java/HAP-Java
src/main/java/io/github/hapjava/impl/pairing/HomekitSRP6ServerSession.java
HomekitSRP6ServerSession.step1
public BigInteger step1(final String userID, final BigInteger s, final BigInteger v) { // Check arguments if (userID == null || userID.trim().isEmpty()) throw new IllegalArgumentException("The user identity 'I' must not be null or empty"); this.userID = userID; if (s == null) throw new IllegalArgumentException("The salt 's' must not be null"); this.s = s; if (v == null) throw new IllegalArgumentException("The verifier 'v' must not be null"); this.v = v; // Check current state if (state != State.INIT) throw new IllegalStateException("State violation: Session must be in INIT state"); // Generate server private and public values k = SRP6Routines.computeK(digest, config.N, config.g); digest.reset(); b = HomekitSRP6Routines.generatePrivateValue(config.N, random); digest.reset(); B = SRP6Routines.computePublicServerValue(config.N, config.g, k, v, b); state = State.STEP_1; updateLastActivityTime(); return B; }
java
public BigInteger step1(final String userID, final BigInteger s, final BigInteger v) { // Check arguments if (userID == null || userID.trim().isEmpty()) throw new IllegalArgumentException("The user identity 'I' must not be null or empty"); this.userID = userID; if (s == null) throw new IllegalArgumentException("The salt 's' must not be null"); this.s = s; if (v == null) throw new IllegalArgumentException("The verifier 'v' must not be null"); this.v = v; // Check current state if (state != State.INIT) throw new IllegalStateException("State violation: Session must be in INIT state"); // Generate server private and public values k = SRP6Routines.computeK(digest, config.N, config.g); digest.reset(); b = HomekitSRP6Routines.generatePrivateValue(config.N, random); digest.reset(); B = SRP6Routines.computePublicServerValue(config.N, config.g, k, v, b); state = State.STEP_1; updateLastActivityTime(); return B; }
[ "public", "BigInteger", "step1", "(", "final", "String", "userID", ",", "final", "BigInteger", "s", ",", "final", "BigInteger", "v", ")", "{", "// Check arguments", "if", "(", "userID", "==", "null", "||", "userID", ".", "trim", "(", ")", ".", "isEmpty", ...
Increments this SRP-6a authentication session to {@link State#STEP_1}. <p>Argument origin: <ul> <li>From client: user identity 'I'. <li>From server database: matching salt 's' and password verifier 'v' values. </ul> @param userID The identity 'I' of the authenticating user. Must not be {@code null} or empty. @param s The password salt 's'. Must not be {@code null}. @param v The password verifier 'v'. Must not be {@code null}. @return The server public value 'B'. @throws IllegalStateException If the mehod is invoked in a state other than {@link State#INIT}.
[ "Increments", "this", "SRP", "-", "6a", "authentication", "session", "to", "{", "@link", "State#STEP_1", "}", "." ]
train
https://github.com/hap-java/HAP-Java/blob/d2b2f4f1579580a2b5958af3a192128345843db9/src/main/java/io/github/hapjava/impl/pairing/HomekitSRP6ServerSession.java#L132-L167
zxing/zxing
core/src/main/java/com/google/zxing/BinaryBitmap.java
BinaryBitmap.getBlackRow
public BitArray getBlackRow(int y, BitArray row) throws NotFoundException { return binarizer.getBlackRow(y, row); }
java
public BitArray getBlackRow(int y, BitArray row) throws NotFoundException { return binarizer.getBlackRow(y, row); }
[ "public", "BitArray", "getBlackRow", "(", "int", "y", ",", "BitArray", "row", ")", "throws", "NotFoundException", "{", "return", "binarizer", ".", "getBlackRow", "(", "y", ",", "row", ")", ";", "}" ]
Converts one row of luminance data to 1 bit data. May actually do the conversion, or return cached data. Callers should assume this method is expensive and call it as seldom as possible. This method is intended for decoding 1D barcodes and may choose to apply sharpening. @param y The row to fetch, which must be in [0, bitmap height) @param row An optional preallocated array. If null or too small, it will be ignored. If used, the Binarizer will call BitArray.clear(). Always use the returned object. @return The array of bits for this row (true means black). @throws NotFoundException if row can't be binarized
[ "Converts", "one", "row", "of", "luminance", "data", "to", "1", "bit", "data", ".", "May", "actually", "do", "the", "conversion", "or", "return", "cached", "data", ".", "Callers", "should", "assume", "this", "method", "is", "expensive", "and", "call", "it"...
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/BinaryBitmap.java#L65-L67
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java
GISTreeSetUtil.getNodeBuildingBounds
@Pure public static Rectangle2d getNodeBuildingBounds(AbstractGISTreeSetNode<?, ?> node) { assert node != null; final double w = node.nodeWidth / 2.; final double h = node.nodeHeight / 2.; final IcosepQuadTreeZone zone = node.getZone(); final double lx; final double ly; if (zone == null) { // Is root node lx = node.verticalSplit - w; ly = node.horizontalSplit - h; } else { switch (zone) { case SOUTH_EAST: lx = node.verticalSplit; ly = node.horizontalSplit - h; break; case SOUTH_WEST: lx = node.verticalSplit - w; ly = node.horizontalSplit - h; break; case NORTH_EAST: lx = node.verticalSplit; ly = node.horizontalSplit; break; case NORTH_WEST: lx = node.verticalSplit - w; ly = node.horizontalSplit; break; case ICOSEP: return getNodeBuildingBounds(node.getParentNode()); default: throw new IllegalStateException(); } } return new Rectangle2d(lx, ly, node.nodeWidth, node.nodeHeight); }
java
@Pure public static Rectangle2d getNodeBuildingBounds(AbstractGISTreeSetNode<?, ?> node) { assert node != null; final double w = node.nodeWidth / 2.; final double h = node.nodeHeight / 2.; final IcosepQuadTreeZone zone = node.getZone(); final double lx; final double ly; if (zone == null) { // Is root node lx = node.verticalSplit - w; ly = node.horizontalSplit - h; } else { switch (zone) { case SOUTH_EAST: lx = node.verticalSplit; ly = node.horizontalSplit - h; break; case SOUTH_WEST: lx = node.verticalSplit - w; ly = node.horizontalSplit - h; break; case NORTH_EAST: lx = node.verticalSplit; ly = node.horizontalSplit; break; case NORTH_WEST: lx = node.verticalSplit - w; ly = node.horizontalSplit; break; case ICOSEP: return getNodeBuildingBounds(node.getParentNode()); default: throw new IllegalStateException(); } } return new Rectangle2d(lx, ly, node.nodeWidth, node.nodeHeight); }
[ "@", "Pure", "public", "static", "Rectangle2d", "getNodeBuildingBounds", "(", "AbstractGISTreeSetNode", "<", "?", ",", "?", ">", "node", ")", "{", "assert", "node", "!=", "null", ";", "final", "double", "w", "=", "node", ".", "nodeWidth", "/", "2.", ";", ...
Replies the bounds of the area covered by the node. The replied rectangle is not normalized. @param node is the node for which the bounds must be extracted and reploed. @return the not-normalized rectangle.
[ "Replies", "the", "bounds", "of", "the", "area", "covered", "by", "the", "node", ".", "The", "replied", "rectangle", "is", "not", "normalized", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java#L387-L424
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLAnnotationUtil.java
SARLAnnotationUtil.findStringValue
public String findStringValue(JvmAnnotationTarget op, Class<? extends Annotation> annotationType) { final JvmAnnotationReference reference = this.lookup.findAnnotation(op, annotationType); if (reference != null) { return findStringValue(reference); } return null; }
java
public String findStringValue(JvmAnnotationTarget op, Class<? extends Annotation> annotationType) { final JvmAnnotationReference reference = this.lookup.findAnnotation(op, annotationType); if (reference != null) { return findStringValue(reference); } return null; }
[ "public", "String", "findStringValue", "(", "JvmAnnotationTarget", "op", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotationType", ")", "{", "final", "JvmAnnotationReference", "reference", "=", "this", ".", "lookup", ".", "findAnnotation", "(", "op",...
Extract the string value of the given annotation, if it exists. @param op the annotated element. @param annotationType the type of the annotation to consider @return the value of the annotation, or {@code null} if no annotation or no value.
[ "Extract", "the", "string", "value", "of", "the", "given", "annotation", "if", "it", "exists", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLAnnotationUtil.java#L70-L76
alkacon/opencms-core
src/org/opencms/ade/configuration/formatters/CmsFormatterBeanParser.java
CmsFormatterBeanParser.getString
private String getString(I_CmsXmlContentLocation val, String path, String defaultValue) { if ((val != null)) { I_CmsXmlContentValueLocation subVal = val.getSubValue(path); if ((subVal != null) && (subVal.getValue() != null)) { return subVal.getValue().getStringValue(m_cms); } } return defaultValue; }
java
private String getString(I_CmsXmlContentLocation val, String path, String defaultValue) { if ((val != null)) { I_CmsXmlContentValueLocation subVal = val.getSubValue(path); if ((subVal != null) && (subVal.getValue() != null)) { return subVal.getValue().getStringValue(m_cms); } } return defaultValue; }
[ "private", "String", "getString", "(", "I_CmsXmlContentLocation", "val", ",", "String", "path", ",", "String", "defaultValue", ")", "{", "if", "(", "(", "val", "!=", "null", ")", ")", "{", "I_CmsXmlContentValueLocation", "subVal", "=", "val", ".", "getSubValue...
Gets an XML string value.<p> @param val the location of the parent value @param path the path of the sub-value @param defaultValue the default value to use if no value was found @return the found value
[ "Gets", "an", "XML", "string", "value", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/formatters/CmsFormatterBeanParser.java#L648-L657
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/Block.java
Block.addCoinbaseTransaction
@VisibleForTesting void addCoinbaseTransaction(byte[] pubKeyTo, Coin value, final int height) { unCacheTransactions(); transactions = new ArrayList<>(); Transaction coinbase = new Transaction(params); final ScriptBuilder inputBuilder = new ScriptBuilder(); if (height >= Block.BLOCK_HEIGHT_GENESIS) { inputBuilder.number(height); } inputBuilder.data(new byte[]{(byte) txCounter, (byte) (txCounter++ >> 8)}); // A real coinbase transaction has some stuff in the scriptSig like the extraNonce and difficulty. The // transactions are distinguished by every TX output going to a different key. // // Here we will do things a bit differently so a new address isn't needed every time. We'll put a simple // counter in the scriptSig so every transaction has a different hash. coinbase.addInput(new TransactionInput(params, coinbase, inputBuilder.build().getProgram())); coinbase.addOutput(new TransactionOutput(params, coinbase, value, ScriptBuilder.createP2PKOutputScript(ECKey.fromPublicOnly(pubKeyTo)).getProgram())); transactions.add(coinbase); coinbase.setParent(this); coinbase.length = coinbase.unsafeBitcoinSerialize().length; adjustLength(transactions.size(), coinbase.length); }
java
@VisibleForTesting void addCoinbaseTransaction(byte[] pubKeyTo, Coin value, final int height) { unCacheTransactions(); transactions = new ArrayList<>(); Transaction coinbase = new Transaction(params); final ScriptBuilder inputBuilder = new ScriptBuilder(); if (height >= Block.BLOCK_HEIGHT_GENESIS) { inputBuilder.number(height); } inputBuilder.data(new byte[]{(byte) txCounter, (byte) (txCounter++ >> 8)}); // A real coinbase transaction has some stuff in the scriptSig like the extraNonce and difficulty. The // transactions are distinguished by every TX output going to a different key. // // Here we will do things a bit differently so a new address isn't needed every time. We'll put a simple // counter in the scriptSig so every transaction has a different hash. coinbase.addInput(new TransactionInput(params, coinbase, inputBuilder.build().getProgram())); coinbase.addOutput(new TransactionOutput(params, coinbase, value, ScriptBuilder.createP2PKOutputScript(ECKey.fromPublicOnly(pubKeyTo)).getProgram())); transactions.add(coinbase); coinbase.setParent(this); coinbase.length = coinbase.unsafeBitcoinSerialize().length; adjustLength(transactions.size(), coinbase.length); }
[ "@", "VisibleForTesting", "void", "addCoinbaseTransaction", "(", "byte", "[", "]", "pubKeyTo", ",", "Coin", "value", ",", "final", "int", "height", ")", "{", "unCacheTransactions", "(", ")", ";", "transactions", "=", "new", "ArrayList", "<>", "(", ")", ";", ...
Adds a coinbase transaction to the block. This exists for unit tests. @param height block height, if known, or -1 otherwise.
[ "Adds", "a", "coinbase", "transaction", "to", "the", "block", ".", "This", "exists", "for", "unit", "tests", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Block.java#L910-L935
hawkular/hawkular-commons
hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/MessageProcessor.java
MessageProcessor.sendWithBinaryData
public MessageId sendWithBinaryData(ProducerConnectionContext context, BasicMessage basicMessage, File file) throws JMSException, FileNotFoundException { return sendWithBinaryData(context, basicMessage, new FileInputStream(file), null); }
java
public MessageId sendWithBinaryData(ProducerConnectionContext context, BasicMessage basicMessage, File file) throws JMSException, FileNotFoundException { return sendWithBinaryData(context, basicMessage, new FileInputStream(file), null); }
[ "public", "MessageId", "sendWithBinaryData", "(", "ProducerConnectionContext", "context", ",", "BasicMessage", "basicMessage", ",", "File", "file", ")", "throws", "JMSException", ",", "FileNotFoundException", "{", "return", "sendWithBinaryData", "(", "context", ",", "ba...
Same as {@link #sendWithBinaryData(ProducerConnectionContext, BasicMessage, File, Map)} with <code>null</code> headers. @throws FileNotFoundException if the file does not exist
[ "Same", "as", "{", "@link", "#sendWithBinaryData", "(", "ProducerConnectionContext", "BasicMessage", "File", "Map", ")", "}", "with", "<code", ">", "null<", "/", "code", ">", "headers", "." ]
train
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/MessageProcessor.java#L154-L157
michel-kraemer/bson4jackson
src/main/java/de/undercouch/bson4jackson/BsonGenerator.java
BsonGenerator._writeStartObject
protected void _writeStartObject(boolean array) throws IOException { _writeArrayFieldNameIfNeeded(); if (_currentDocument != null) { //embedded document/array _buffer.putByte(_typeMarker, array ? BsonConstants.TYPE_ARRAY : BsonConstants.TYPE_DOCUMENT); } _currentDocument = new DocumentInfo(_currentDocument, _buffer.size(), array); reserveHeader(); }
java
protected void _writeStartObject(boolean array) throws IOException { _writeArrayFieldNameIfNeeded(); if (_currentDocument != null) { //embedded document/array _buffer.putByte(_typeMarker, array ? BsonConstants.TYPE_ARRAY : BsonConstants.TYPE_DOCUMENT); } _currentDocument = new DocumentInfo(_currentDocument, _buffer.size(), array); reserveHeader(); }
[ "protected", "void", "_writeStartObject", "(", "boolean", "array", ")", "throws", "IOException", "{", "_writeArrayFieldNameIfNeeded", "(", ")", ";", "if", "(", "_currentDocument", "!=", "null", ")", "{", "//embedded document/array", "_buffer", ".", "putByte", "(", ...
Creates a new embedded document or array @param array true if the embedded object is an array @throws IOException if the document could not be created
[ "Creates", "a", "new", "embedded", "document", "or", "array" ]
train
https://github.com/michel-kraemer/bson4jackson/blob/32d2ab3c516b3c07490fdfcf0c5e4ed0a2ee3979/src/main/java/de/undercouch/bson4jackson/BsonGenerator.java#L337-L346
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/BooleanIndexing.java
BooleanIndexing.firstIndex
public static INDArray firstIndex(INDArray array, Condition condition, int... dimension) { if (!(condition instanceof BaseCondition)) throw new UnsupportedOperationException("Only static Conditions are supported"); return Nd4j.getExecutioner().exec(new FirstIndex(array, condition, dimension)); }
java
public static INDArray firstIndex(INDArray array, Condition condition, int... dimension) { if (!(condition instanceof BaseCondition)) throw new UnsupportedOperationException("Only static Conditions are supported"); return Nd4j.getExecutioner().exec(new FirstIndex(array, condition, dimension)); }
[ "public", "static", "INDArray", "firstIndex", "(", "INDArray", "array", ",", "Condition", "condition", ",", "int", "...", "dimension", ")", "{", "if", "(", "!", "(", "condition", "instanceof", "BaseCondition", ")", ")", "throw", "new", "UnsupportedOperationExcep...
This method returns first index matching given condition along given dimensions PLEASE NOTE: This method will return -1 values for missing conditions @param array @param condition @param dimension @return
[ "This", "method", "returns", "first", "index", "matching", "given", "condition", "along", "given", "dimensions" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/BooleanIndexing.java#L298-L303
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java
ClassUtil.invoke
public static <T> T invoke(String className, String methodName, boolean isSingleton, Object... args) { Class<Object> clazz = loadClass(className); try { final Method method = getDeclaredMethod(clazz, methodName, getClasses(args)); if (null == method) { throw new NoSuchMethodException(StrUtil.format("No such method: [{}]", methodName)); } if (isStatic(method)) { return ReflectUtil.invoke(null, method, args); } else { return ReflectUtil.invoke(isSingleton ? Singleton.get(clazz) : clazz.newInstance(), method, args); } } catch (Exception e) { throw new UtilException(e); } }
java
public static <T> T invoke(String className, String methodName, boolean isSingleton, Object... args) { Class<Object> clazz = loadClass(className); try { final Method method = getDeclaredMethod(clazz, methodName, getClasses(args)); if (null == method) { throw new NoSuchMethodException(StrUtil.format("No such method: [{}]", methodName)); } if (isStatic(method)) { return ReflectUtil.invoke(null, method, args); } else { return ReflectUtil.invoke(isSingleton ? Singleton.get(clazz) : clazz.newInstance(), method, args); } } catch (Exception e) { throw new UtilException(e); } }
[ "public", "static", "<", "T", ">", "T", "invoke", "(", "String", "className", ",", "String", "methodName", ",", "boolean", "isSingleton", ",", "Object", "...", "args", ")", "{", "Class", "<", "Object", ">", "clazz", "=", "loadClass", "(", "className", ")...
执行方法<br> 可执行Private方法,也可执行static方法<br> 执行非static方法时,必须满足对象有默认构造方法<br> @param <T> 对象类型 @param className 类名,完整类路径 @param methodName 方法名 @param isSingleton 是否为单例对象,如果此参数为false,每次执行方法时创建一个新对象 @param args 参数,必须严格对应指定方法的参数类型和数量 @return 返回结果
[ "执行方法<br", ">", "可执行Private方法,也可执行static方法<br", ">", "执行非static方法时,必须满足对象有默认构造方法<br", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L681-L696
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java
ContentSpecParser.processRelationshipList
private void processRelationshipList(final ParserType parserType, final SpecNodeWithRelationships tempNode, final HashMap<ParserType, String[]> variableMap, final List<Relationship> relationships, int lineNumber) throws ParsingException { final String uniqueId = tempNode.getUniqueId(); String errorMessageFormat = null; RelationshipType relationshipType; switch (parserType) { case REFER_TO: errorMessageFormat = ProcessorConstants.ERROR_INVALID_REFERS_TO_RELATIONSHIP; relationshipType = RelationshipType.REFER_TO; break; case LINKLIST: errorMessageFormat = ProcessorConstants.ERROR_INVALID_LINK_LIST_RELATIONSHIP; relationshipType = RelationshipType.LINKLIST; break; case PREREQUISITE: errorMessageFormat = ProcessorConstants.ERROR_INVALID_PREREQUISITE_RELATIONSHIP; relationshipType = RelationshipType.PREREQUISITE; break; default: return; } if (variableMap.containsKey(parserType)) { final String[] relationshipList = variableMap.get(parserType); for (final String relationshipId : relationshipList) { if (relationshipId.matches(ProcessorConstants.RELATION_ID_REGEX)) { relationships.add(new Relationship(uniqueId, relationshipId, relationshipType)); } else if (relationshipId.matches(ProcessorConstants.RELATION_ID_LONG_REGEX)) { final Matcher matcher = RELATION_ID_LONG_PATTERN.matcher(relationshipId); matcher.find(); final String id = matcher.group("TopicID"); final String relationshipTitle = matcher.group("TopicTitle"); final String cleanedTitle = ProcessorUtilities.cleanXMLCharacterReferences(relationshipTitle.trim()); relationships.add(new Relationship(uniqueId, id, relationshipType, ProcessorUtilities.replaceEscapeChars(cleanedTitle))); } else { if (relationshipId.matches("^(" + ProcessorConstants.TARGET_BASE_REGEX + "|[0-9]+).*?(" + ProcessorConstants.TARGET_BASE_REGEX + "|[0-9]+).*")) { throw new ParsingException(format(ProcessorConstants.ERROR_MISSING_SEPARATOR_MSG, lineNumber, ',')); } else { throw new ParsingException(format(errorMessageFormat, lineNumber)); } } } } }
java
private void processRelationshipList(final ParserType parserType, final SpecNodeWithRelationships tempNode, final HashMap<ParserType, String[]> variableMap, final List<Relationship> relationships, int lineNumber) throws ParsingException { final String uniqueId = tempNode.getUniqueId(); String errorMessageFormat = null; RelationshipType relationshipType; switch (parserType) { case REFER_TO: errorMessageFormat = ProcessorConstants.ERROR_INVALID_REFERS_TO_RELATIONSHIP; relationshipType = RelationshipType.REFER_TO; break; case LINKLIST: errorMessageFormat = ProcessorConstants.ERROR_INVALID_LINK_LIST_RELATIONSHIP; relationshipType = RelationshipType.LINKLIST; break; case PREREQUISITE: errorMessageFormat = ProcessorConstants.ERROR_INVALID_PREREQUISITE_RELATIONSHIP; relationshipType = RelationshipType.PREREQUISITE; break; default: return; } if (variableMap.containsKey(parserType)) { final String[] relationshipList = variableMap.get(parserType); for (final String relationshipId : relationshipList) { if (relationshipId.matches(ProcessorConstants.RELATION_ID_REGEX)) { relationships.add(new Relationship(uniqueId, relationshipId, relationshipType)); } else if (relationshipId.matches(ProcessorConstants.RELATION_ID_LONG_REGEX)) { final Matcher matcher = RELATION_ID_LONG_PATTERN.matcher(relationshipId); matcher.find(); final String id = matcher.group("TopicID"); final String relationshipTitle = matcher.group("TopicTitle"); final String cleanedTitle = ProcessorUtilities.cleanXMLCharacterReferences(relationshipTitle.trim()); relationships.add(new Relationship(uniqueId, id, relationshipType, ProcessorUtilities.replaceEscapeChars(cleanedTitle))); } else { if (relationshipId.matches("^(" + ProcessorConstants.TARGET_BASE_REGEX + "|[0-9]+).*?(" + ProcessorConstants.TARGET_BASE_REGEX + "|[0-9]+).*")) { throw new ParsingException(format(ProcessorConstants.ERROR_MISSING_SEPARATOR_MSG, lineNumber, ',')); } else { throw new ParsingException(format(errorMessageFormat, lineNumber)); } } } } }
[ "private", "void", "processRelationshipList", "(", "final", "ParserType", "parserType", ",", "final", "SpecNodeWithRelationships", "tempNode", ",", "final", "HashMap", "<", "ParserType", ",", "String", "[", "]", ">", "variableMap", ",", "final", "List", "<", "Rela...
Processes a list of relationships for a specific relationship type from some line processed variables. @param relationshipType The relationship type to be processed. @param tempNode The temporary node that will be turned into a full node once fully parsed. @param variableMap The list of variables containing the parsed relationships. @param lineNumber The number of the line the relationships are on. @param relationships The list of topic relationships. @throws ParsingException Thrown if the variables can't be parsed due to incorrect syntax.
[ "Processes", "a", "list", "of", "relationships", "for", "a", "specific", "relationship", "type", "from", "some", "line", "processed", "variables", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java#L1184-L1233
marklogic/java-client-api
marklogic-client-api/src/main/java/com/marklogic/client/DatabaseClientFactory.java
DatabaseClientFactory.newClient
static public DatabaseClient newClient(String host, int port) { return newClient(host, port, null, null, null, null, null, null); }
java
static public DatabaseClient newClient(String host, int port) { return newClient(host, port, null, null, null, null, null, null); }
[ "static", "public", "DatabaseClient", "newClient", "(", "String", "host", ",", "int", "port", ")", "{", "return", "newClient", "(", "host", ",", "port", ",", "null", ",", "null", ",", "null", ",", "null", ",", "null", ",", "null", ")", ";", "}" ]
Creates a client to access the database by means of a REST server without any authentication. Such clients can be convenient for experimentation but should not be used in production. @param host the host with the REST server @param port the port for the REST server @return a new client for making database requests
[ "Creates", "a", "client", "to", "access", "the", "database", "by", "means", "of", "a", "REST", "server", "without", "any", "authentication", ".", "Such", "clients", "can", "be", "convenient", "for", "experimentation", "but", "should", "not", "be", "used", "i...
train
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/DatabaseClientFactory.java#L1121-L1123
Impetus/Kundera
src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/CQLTranslator.java
CQLTranslator.appendColumnName
public void appendColumnName(StringBuilder builder, String columnName, String dataType) { ensureCase(builder, columnName, false); builder.append(" "); // because only key columns builder.append(dataType); }
java
public void appendColumnName(StringBuilder builder, String columnName, String dataType) { ensureCase(builder, columnName, false); builder.append(" "); // because only key columns builder.append(dataType); }
[ "public", "void", "appendColumnName", "(", "StringBuilder", "builder", ",", "String", "columnName", ",", "String", "dataType", ")", "{", "ensureCase", "(", "builder", ",", "columnName", ",", "false", ")", ";", "builder", ".", "append", "(", "\" \"", ")", ";"...
Appends column name and data type also ensures case sensitivity. @param builder string builder @param columnName column name @param dataType data type.
[ "Appends", "column", "name", "and", "data", "type", "also", "ensures", "case", "sensitivity", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/CQLTranslator.java#L1335-L1340
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/core/repository/index/util/ValidationIndexUtil.java
ValidationIndexUtil.addIndexData
public static void addIndexData(ValidationData data, ValidationDataIndex index) { String key = index.getKey(data); List<ValidationData> datas = index.get(key); if (datas == null) { datas = new ArrayList<>(); } datas.add(data); index.getMap().put(key, datas); }
java
public static void addIndexData(ValidationData data, ValidationDataIndex index) { String key = index.getKey(data); List<ValidationData> datas = index.get(key); if (datas == null) { datas = new ArrayList<>(); } datas.add(data); index.getMap().put(key, datas); }
[ "public", "static", "void", "addIndexData", "(", "ValidationData", "data", ",", "ValidationDataIndex", "index", ")", "{", "String", "key", "=", "index", ".", "getKey", "(", "data", ")", ";", "List", "<", "ValidationData", ">", "datas", "=", "index", ".", "...
Add index data. @param data the data @param index the index
[ "Add", "index", "data", "." ]
train
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/core/repository/index/util/ValidationIndexUtil.java#L21-L29
xebialabs/overcast
src/main/java/com/xebialabs/overcast/support/vagrant/VagrantDriver.java
VagrantDriver.doVagrant
public CommandResponse doVagrant(String vagrantVm, final String... vagrantCommand) { CommandResponse response = commandProcessor.run( aCommand("vagrant").withArguments(vagrantCommand).withOptions(vagrantVm) ); if(!response.isSuccessful()) { throw new RuntimeException("Errors during vagrant execution: \n" + response.getErrors()); } // Check for puppet errors. Not vagrant still returns 0 when puppet fails // May not be needed after this PR released: https://github.com/mitchellh/vagrant/pull/1175 for (String line : response.getOutput().split("\n\u001B")) { if (line.startsWith("[1;35merr:")) { throw new RuntimeException("Error in puppet output: " + line); } } return response; }
java
public CommandResponse doVagrant(String vagrantVm, final String... vagrantCommand) { CommandResponse response = commandProcessor.run( aCommand("vagrant").withArguments(vagrantCommand).withOptions(vagrantVm) ); if(!response.isSuccessful()) { throw new RuntimeException("Errors during vagrant execution: \n" + response.getErrors()); } // Check for puppet errors. Not vagrant still returns 0 when puppet fails // May not be needed after this PR released: https://github.com/mitchellh/vagrant/pull/1175 for (String line : response.getOutput().split("\n\u001B")) { if (line.startsWith("[1;35merr:")) { throw new RuntimeException("Error in puppet output: " + line); } } return response; }
[ "public", "CommandResponse", "doVagrant", "(", "String", "vagrantVm", ",", "final", "String", "...", "vagrantCommand", ")", "{", "CommandResponse", "response", "=", "commandProcessor", ".", "run", "(", "aCommand", "(", "\"vagrant\"", ")", ".", "withArguments", "("...
Executes vagrant command which means that arguments passed here will be prepended with "vagrant" @param vagrantCommand arguments for <i>vagrant</i> command @return vagrant response object
[ "Executes", "vagrant", "command", "which", "means", "that", "arguments", "passed", "here", "will", "be", "prepended", "with", "vagrant" ]
train
https://github.com/xebialabs/overcast/blob/716e57b66870c9afe51edc3b6045863a34fb0061/src/main/java/com/xebialabs/overcast/support/vagrant/VagrantDriver.java#L38-L56
JoeKerouac/utils
src/main/java/com/joe/utils/img/ImgUtil.java
ImgUtil.copy
public static BufferedImage copy(BufferedImage src, BufferedImage dest) { dest.getGraphics().drawImage(src, 0, 0, null); return dest; }
java
public static BufferedImage copy(BufferedImage src, BufferedImage dest) { dest.getGraphics().drawImage(src, 0, 0, null); return dest; }
[ "public", "static", "BufferedImage", "copy", "(", "BufferedImage", "src", ",", "BufferedImage", "dest", ")", "{", "dest", ".", "getGraphics", "(", ")", ".", "drawImage", "(", "src", ",", "0", ",", "0", ",", "null", ")", ";", "return", "dest", ";", "}" ...
将一个image信息复制到另一个image中 @param src 源 @param dest 目标 @return dest
[ "将一个image信息复制到另一个image中" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/img/ImgUtil.java#L214-L217
ujmp/universal-java-matrix-package
ujmp-core/src/main/java/org/ujmp/core/doublematrix/calculation/general/decomposition/Ginv.java
Ginv.addColTimes
public static void addColTimes(Matrix matrix, long diag, long fromRow, long col, double factor) { long rows = matrix.getRowCount(); for (long row = fromRow; row < rows; row++) { matrix.setAsDouble( matrix.getAsDouble(row, col) - factor * matrix.getAsDouble(row, diag), row, col); } }
java
public static void addColTimes(Matrix matrix, long diag, long fromRow, long col, double factor) { long rows = matrix.getRowCount(); for (long row = fromRow; row < rows; row++) { matrix.setAsDouble( matrix.getAsDouble(row, col) - factor * matrix.getAsDouble(row, diag), row, col); } }
[ "public", "static", "void", "addColTimes", "(", "Matrix", "matrix", ",", "long", "diag", ",", "long", "fromRow", ",", "long", "col", ",", "double", "factor", ")", "{", "long", "rows", "=", "matrix", ".", "getRowCount", "(", ")", ";", "for", "(", "long"...
Add a factor times one column to another column @param matrix the matrix to modify @param diag coordinate on the diagonal @param fromRow first row to process @param col column to process @param factor factor to multiply
[ "Add", "a", "factor", "times", "one", "column", "to", "another", "column" ]
train
https://github.com/ujmp/universal-java-matrix-package/blob/b7e1d293adeadaf35d208ffe8884028d6c06b63b/ujmp-core/src/main/java/org/ujmp/core/doublematrix/calculation/general/decomposition/Ginv.java#L540-L546
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java
CommonOps_DDRM.extractColumn
public static DMatrixRMaj extractColumn(DMatrixRMaj a , int column , DMatrixRMaj out ) { if( out == null) out = new DMatrixRMaj(a.numRows,1); else if( !MatrixFeatures_DDRM.isVector(out) || out.getNumElements() != a.numRows ) throw new MatrixDimensionException("Output must be a vector of length "+a.numRows); int index = column; for (int i = 0; i < a.numRows; i++, index += a.numCols ) { out.data[i] = a.data[index]; } return out; }
java
public static DMatrixRMaj extractColumn(DMatrixRMaj a , int column , DMatrixRMaj out ) { if( out == null) out = new DMatrixRMaj(a.numRows,1); else if( !MatrixFeatures_DDRM.isVector(out) || out.getNumElements() != a.numRows ) throw new MatrixDimensionException("Output must be a vector of length "+a.numRows); int index = column; for (int i = 0; i < a.numRows; i++, index += a.numCols ) { out.data[i] = a.data[index]; } return out; }
[ "public", "static", "DMatrixRMaj", "extractColumn", "(", "DMatrixRMaj", "a", ",", "int", "column", ",", "DMatrixRMaj", "out", ")", "{", "if", "(", "out", "==", "null", ")", "out", "=", "new", "DMatrixRMaj", "(", "a", ".", "numRows", ",", "1", ")", ";",...
Extracts the column from a matrix. @param a Input matrix @param column Which column is to be extracted @param out output. Storage for the extracted column. If null then a new vector will be returned. @return The extracted column.
[ "Extracts", "the", "column", "from", "a", "matrix", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L1348-L1359
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/contact/GridCell.java
GridCell.hasContactToAtom
public boolean hasContactToAtom(Point3d[] iAtoms, Point3d[] jAtoms, Point3d query, double cutoff) { for( int i : iIndices ) { double distance = iAtoms[i].distance(query); if( distance<cutoff) return true; } if (jAtoms!=null) { for( int i : jIndices ) { double distance = jAtoms[i].distance(query); if( distance<cutoff) return true; } } return false; }
java
public boolean hasContactToAtom(Point3d[] iAtoms, Point3d[] jAtoms, Point3d query, double cutoff) { for( int i : iIndices ) { double distance = iAtoms[i].distance(query); if( distance<cutoff) return true; } if (jAtoms!=null) { for( int i : jIndices ) { double distance = jAtoms[i].distance(query); if( distance<cutoff) return true; } } return false; }
[ "public", "boolean", "hasContactToAtom", "(", "Point3d", "[", "]", "iAtoms", ",", "Point3d", "[", "]", "jAtoms", ",", "Point3d", "query", ",", "double", "cutoff", ")", "{", "for", "(", "int", "i", ":", "iIndices", ")", "{", "double", "distance", "=", "...
Tests whether any atom in this cell has a contact with the specified query atom @param iAtoms the first set of atoms to which the iIndices correspond @param jAtoms the second set of atoms to which the jIndices correspond, or null @param query test point @param cutoff @return
[ "Tests", "whether", "any", "atom", "in", "this", "cell", "has", "a", "contact", "with", "the", "specified", "query", "atom" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/GridCell.java#L153-L167
cdk/cdk
legacy/src/main/java/org/openscience/cdk/smsd/algorithm/rgraph/CDKMCS.java
CDKMCS.getSubgraphAtomsMap
public static List<CDKRMap> getSubgraphAtomsMap(IAtomContainer sourceGraph, IAtomContainer targetGraph, boolean shouldMatchBonds) throws CDKException { List<CDKRMap> list = checkSingleAtomCases(sourceGraph, targetGraph); if (list == null) { return makeAtomsMapOfBondsMap(CDKMCS.getSubgraphMap(sourceGraph, targetGraph, shouldMatchBonds), sourceGraph, targetGraph); } else if (list.isEmpty()) { return null; } else { return list; } }
java
public static List<CDKRMap> getSubgraphAtomsMap(IAtomContainer sourceGraph, IAtomContainer targetGraph, boolean shouldMatchBonds) throws CDKException { List<CDKRMap> list = checkSingleAtomCases(sourceGraph, targetGraph); if (list == null) { return makeAtomsMapOfBondsMap(CDKMCS.getSubgraphMap(sourceGraph, targetGraph, shouldMatchBonds), sourceGraph, targetGraph); } else if (list.isEmpty()) { return null; } else { return list; } }
[ "public", "static", "List", "<", "CDKRMap", ">", "getSubgraphAtomsMap", "(", "IAtomContainer", "sourceGraph", ",", "IAtomContainer", "targetGraph", ",", "boolean", "shouldMatchBonds", ")", "throws", "CDKException", "{", "List", "<", "CDKRMap", ">", "list", "=", "c...
Returns the first subgraph 'atom mapping' found for targetGraph in sourceGraph. @param sourceGraph first molecule. Must not be an IQueryAtomContainer. @param targetGraph second molecule. May be an IQueryAtomContainer. @param shouldMatchBonds @return the first subgraph atom mapping found projected on sourceGraph. This is atom List of CDKRMap objects containing Ids of matching atoms. @throws CDKException
[ "Returns", "the", "first", "subgraph", "atom", "mapping", "found", "for", "targetGraph", "in", "sourceGraph", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/smsd/algorithm/rgraph/CDKMCS.java#L327-L338
youseries/urule
urule-console/src/main/java/com/bstek/urule/console/repository/database/DbPersistenceManager.java
DbPersistenceManager.store
public synchronized void store(NodeReferences refs) throws ItemStateException { if (!initialized) { throw new IllegalStateException("not initialized"); } // check if insert or update boolean update = existsReferencesTo(refs.getTargetId()); String sql = (update) ? nodeReferenceUpdateSQL : nodeReferenceInsertSQL; try { ByteArrayOutputStream out = new ByteArrayOutputStream(INITIAL_BUFFER_SIZE); // serialize references Serializer.serialize(refs, out); Object[] params = createParams(refs.getTargetId(), out.toByteArray(), true); conHelper.exec(sql, params); // there's no need to close a ByteArrayOutputStream //out.close(); } catch (Exception e) { String msg = "failed to write " + refs; log.error(msg, e); throw new ItemStateException(msg, e); } }
java
public synchronized void store(NodeReferences refs) throws ItemStateException { if (!initialized) { throw new IllegalStateException("not initialized"); } // check if insert or update boolean update = existsReferencesTo(refs.getTargetId()); String sql = (update) ? nodeReferenceUpdateSQL : nodeReferenceInsertSQL; try { ByteArrayOutputStream out = new ByteArrayOutputStream(INITIAL_BUFFER_SIZE); // serialize references Serializer.serialize(refs, out); Object[] params = createParams(refs.getTargetId(), out.toByteArray(), true); conHelper.exec(sql, params); // there's no need to close a ByteArrayOutputStream //out.close(); } catch (Exception e) { String msg = "failed to write " + refs; log.error(msg, e); throw new ItemStateException(msg, e); } }
[ "public", "synchronized", "void", "store", "(", "NodeReferences", "refs", ")", "throws", "ItemStateException", "{", "if", "(", "!", "initialized", ")", "{", "throw", "new", "IllegalStateException", "(", "\"not initialized\"", ")", ";", "}", "// check if insert or up...
{@inheritDoc} This method uses shared <code>PreparedStatements</code>, which must be used strictly sequentially. Because this method synchronizes on the persistence manager instance, there is no need to synchronize on the shared statement. If the method would not be synchronized, the shared statement must be synchronized.
[ "{", "@inheritDoc", "}" ]
train
https://github.com/youseries/urule/blob/3fa0eb4439e97aa292e744bcbd88a9faa36661d8/urule-console/src/main/java/com/bstek/urule/console/repository/database/DbPersistenceManager.java#L1006-L1031
apache/incubator-druid
core/src/main/java/org/apache/druid/java/util/common/Numbers.java
Numbers.parseLong
public static long parseLong(Object val) { if (val instanceof String) { return Long.parseLong((String) val); } else if (val instanceof Number) { return ((Number) val).longValue(); } else { if (val == null) { throw new NullPointerException("Input is null"); } else { throw new ISE("Unknown type [%s]", val.getClass()); } } }
java
public static long parseLong(Object val) { if (val instanceof String) { return Long.parseLong((String) val); } else if (val instanceof Number) { return ((Number) val).longValue(); } else { if (val == null) { throw new NullPointerException("Input is null"); } else { throw new ISE("Unknown type [%s]", val.getClass()); } } }
[ "public", "static", "long", "parseLong", "(", "Object", "val", ")", "{", "if", "(", "val", "instanceof", "String", ")", "{", "return", "Long", ".", "parseLong", "(", "(", "String", ")", "val", ")", ";", "}", "else", "if", "(", "val", "instanceof", "N...
Parse the given object as a {@code long}. The input object can be a {@link String} or one of the implementations of {@link Number}. You may want to use {@code GuavaUtils.tryParseLong()} instead if the input is a nullable string and you want to avoid any exceptions. @throws NumberFormatException if the input is an unparseable string. @throws NullPointerException if the input is null. @throws ISE if the input is not a string or a number.
[ "Parse", "the", "given", "object", "as", "a", "{", "@code", "long", "}", ".", "The", "input", "object", "can", "be", "a", "{", "@link", "String", "}", "or", "one", "of", "the", "implementations", "of", "{", "@link", "Number", "}", ".", "You", "may", ...
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/java/util/common/Numbers.java#L33-L46
threerings/playn
java/src/playn/java/JavaAudio.java
JavaAudio.createSound
public JavaSound createSound(final JavaAssets.Resource rsrc, final boolean music) { final JavaSound sound = new JavaSound(); ((JavaPlatform) platform).invokeAsync(new Runnable() { public void run () { try { AudioInputStream ais = rsrc.openAudioStream(); Clip clip = AudioSystem.getClip(); if (music) { clip = new BigClip(clip); } AudioFormat baseFormat = ais.getFormat(); if (baseFormat.getEncoding() != AudioFormat.Encoding.PCM_SIGNED) { AudioFormat decodedFormat = new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, baseFormat.getSampleRate(), 16, // we have to force sample size to 16 baseFormat.getChannels(), baseFormat.getChannels()*2, baseFormat.getSampleRate(), false // big endian ); ais = AudioSystem.getAudioInputStream(decodedFormat, ais); } clip.open(ais); dispatchLoaded(sound, clip); } catch (Exception e) { dispatchLoadError(sound, e); } } }); return sound; }
java
public JavaSound createSound(final JavaAssets.Resource rsrc, final boolean music) { final JavaSound sound = new JavaSound(); ((JavaPlatform) platform).invokeAsync(new Runnable() { public void run () { try { AudioInputStream ais = rsrc.openAudioStream(); Clip clip = AudioSystem.getClip(); if (music) { clip = new BigClip(clip); } AudioFormat baseFormat = ais.getFormat(); if (baseFormat.getEncoding() != AudioFormat.Encoding.PCM_SIGNED) { AudioFormat decodedFormat = new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, baseFormat.getSampleRate(), 16, // we have to force sample size to 16 baseFormat.getChannels(), baseFormat.getChannels()*2, baseFormat.getSampleRate(), false // big endian ); ais = AudioSystem.getAudioInputStream(decodedFormat, ais); } clip.open(ais); dispatchLoaded(sound, clip); } catch (Exception e) { dispatchLoadError(sound, e); } } }); return sound; }
[ "public", "JavaSound", "createSound", "(", "final", "JavaAssets", ".", "Resource", "rsrc", ",", "final", "boolean", "music", ")", "{", "final", "JavaSound", "sound", "=", "new", "JavaSound", "(", ")", ";", "(", "(", "JavaPlatform", ")", "platform", ")", "....
Creates a sound instance from the audio data available via {@code in}. @param rsrc a resource via which the audio data can be read. @param music if true, a custom {@link Clip} implementation will be used which can handle long audio clips; if false, the default Java clip implementation is used which cannot handle long audio clips.
[ "Creates", "a", "sound", "instance", "from", "the", "audio", "data", "available", "via", "{", "@code", "in", "}", "." ]
train
https://github.com/threerings/playn/blob/c266eeb39188dcada4b00992a0d1199759e03d42/java/src/playn/java/JavaAudio.java#L41-L72
apache/flink
flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/services/MesosServicesUtils.java
MesosServicesUtils.createMesosServices
public static MesosServices createMesosServices(Configuration configuration, String hostname) throws Exception { ActorSystem localActorSystem = AkkaUtils.createLocalActorSystem(configuration); MesosArtifactServer artifactServer = createArtifactServer(configuration, hostname); HighAvailabilityMode highAvailabilityMode = HighAvailabilityMode.fromConfig(configuration); switch (highAvailabilityMode) { case NONE: return new StandaloneMesosServices(localActorSystem, artifactServer); case ZOOKEEPER: final String zkMesosRootPath = configuration.getString( HighAvailabilityOptions.HA_ZOOKEEPER_MESOS_WORKERS_PATH); ZooKeeperUtilityFactory zooKeeperUtilityFactory = new ZooKeeperUtilityFactory( configuration, zkMesosRootPath); return new ZooKeeperMesosServices(localActorSystem, artifactServer, zooKeeperUtilityFactory); default: throw new Exception("High availability mode " + highAvailabilityMode + " is not supported."); } }
java
public static MesosServices createMesosServices(Configuration configuration, String hostname) throws Exception { ActorSystem localActorSystem = AkkaUtils.createLocalActorSystem(configuration); MesosArtifactServer artifactServer = createArtifactServer(configuration, hostname); HighAvailabilityMode highAvailabilityMode = HighAvailabilityMode.fromConfig(configuration); switch (highAvailabilityMode) { case NONE: return new StandaloneMesosServices(localActorSystem, artifactServer); case ZOOKEEPER: final String zkMesosRootPath = configuration.getString( HighAvailabilityOptions.HA_ZOOKEEPER_MESOS_WORKERS_PATH); ZooKeeperUtilityFactory zooKeeperUtilityFactory = new ZooKeeperUtilityFactory( configuration, zkMesosRootPath); return new ZooKeeperMesosServices(localActorSystem, artifactServer, zooKeeperUtilityFactory); default: throw new Exception("High availability mode " + highAvailabilityMode + " is not supported."); } }
[ "public", "static", "MesosServices", "createMesosServices", "(", "Configuration", "configuration", ",", "String", "hostname", ")", "throws", "Exception", "{", "ActorSystem", "localActorSystem", "=", "AkkaUtils", ".", "createLocalActorSystem", "(", "configuration", ")", ...
Creates a {@link MesosServices} instance depending on the high availability settings. @param configuration containing the high availability settings @param hostname the hostname to advertise to remote clients @return a mesos services instance @throws Exception if the mesos services instance could not be created
[ "Creates", "a", "{", "@link", "MesosServices", "}", "instance", "depending", "on", "the", "high", "availability", "settings", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/services/MesosServicesUtils.java#L46-L71
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/Utils.java
Utils.parseLong
public static long parseLong(String val, long defValue){ if(TextUtils.isEmpty(val)) return defValue; try{ return Long.parseLong(val); }catch (NumberFormatException e){ return defValue; } }
java
public static long parseLong(String val, long defValue){ if(TextUtils.isEmpty(val)) return defValue; try{ return Long.parseLong(val); }catch (NumberFormatException e){ return defValue; } }
[ "public", "static", "long", "parseLong", "(", "String", "val", ",", "long", "defValue", ")", "{", "if", "(", "TextUtils", ".", "isEmpty", "(", "val", ")", ")", "return", "defValue", ";", "try", "{", "return", "Long", ".", "parseLong", "(", "val", ")", ...
Parse a long from a String in a safe manner. @param val the string to parse @param defValue the default value to return if parsing fails @return the parsed long, or default value
[ "Parse", "a", "long", "from", "a", "String", "in", "a", "safe", "manner", "." ]
train
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/Utils.java#L278-L285
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.isSubtypeUnchecked
public boolean isSubtypeUnchecked(Type t, List<Type> ts, Warner warn) { for (List<Type> l = ts; l.nonEmpty(); l = l.tail) if (!isSubtypeUnchecked(t, l.head, warn)) return false; return true; }
java
public boolean isSubtypeUnchecked(Type t, List<Type> ts, Warner warn) { for (List<Type> l = ts; l.nonEmpty(); l = l.tail) if (!isSubtypeUnchecked(t, l.head, warn)) return false; return true; }
[ "public", "boolean", "isSubtypeUnchecked", "(", "Type", "t", ",", "List", "<", "Type", ">", "ts", ",", "Warner", "warn", ")", "{", "for", "(", "List", "<", "Type", ">", "l", "=", "ts", ";", "l", ".", "nonEmpty", "(", ")", ";", "l", "=", "l", "....
Is t a subtype of every type in given list `ts'?<br> (not defined for Method and ForAll types)<br> Allows unchecked conversions.
[ "Is", "t", "a", "subtype", "of", "every", "type", "in", "given", "list", "ts", "?<br", ">", "(", "not", "defined", "for", "Method", "and", "ForAll", "types", ")", "<br", ">", "Allows", "unchecked", "conversions", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L915-L920
rhiot/rhiot
lib/utils/src/main/java/io/rhiot/utils/install/DefaultInstaller.java
DefaultInstaller.confirmInstalled
public boolean confirmInstalled(String packageName, List<String> output){ if (output != null) { return output.stream().anyMatch(s -> s != null && s.contains(getInstallSuccess())); } else { return true; //may be successful } }
java
public boolean confirmInstalled(String packageName, List<String> output){ if (output != null) { return output.stream().anyMatch(s -> s != null && s.contains(getInstallSuccess())); } else { return true; //may be successful } }
[ "public", "boolean", "confirmInstalled", "(", "String", "packageName", ",", "List", "<", "String", ">", "output", ")", "{", "if", "(", "output", "!=", "null", ")", "{", "return", "output", ".", "stream", "(", ")", ".", "anyMatch", "(", "s", "->", "s", ...
Checks the output to confirm the package is installed. @param packageName package name, eg gpsd @param output result of the installation process @return returns true if the package is installed, false otherwise.
[ "Checks", "the", "output", "to", "confirm", "the", "package", "is", "installed", "." ]
train
https://github.com/rhiot/rhiot/blob/82eac10e365f72bab9248b8c3bd0ec9a2fc0a721/lib/utils/src/main/java/io/rhiot/utils/install/DefaultInstaller.java#L125-L131
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java
VirtualNetworkGatewaysInner.beginGetVpnclientIpsecParametersAsync
public Observable<VpnClientIPsecParametersInner> beginGetVpnclientIpsecParametersAsync(String resourceGroupName, String virtualNetworkGatewayName) { return beginGetVpnclientIpsecParametersWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).map(new Func1<ServiceResponse<VpnClientIPsecParametersInner>, VpnClientIPsecParametersInner>() { @Override public VpnClientIPsecParametersInner call(ServiceResponse<VpnClientIPsecParametersInner> response) { return response.body(); } }); }
java
public Observable<VpnClientIPsecParametersInner> beginGetVpnclientIpsecParametersAsync(String resourceGroupName, String virtualNetworkGatewayName) { return beginGetVpnclientIpsecParametersWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).map(new Func1<ServiceResponse<VpnClientIPsecParametersInner>, VpnClientIPsecParametersInner>() { @Override public VpnClientIPsecParametersInner call(ServiceResponse<VpnClientIPsecParametersInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VpnClientIPsecParametersInner", ">", "beginGetVpnclientIpsecParametersAsync", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayName", ")", "{", "return", "beginGetVpnclientIpsecParametersWithServiceResponseAsync", "(", "resource...
The Get VpnclientIpsecParameters operation retrieves information about the vpnclient ipsec policy for P2S client of virtual network gateway in the specified resource group through Network resource provider. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The virtual network gateway name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VpnClientIPsecParametersInner object
[ "The", "Get", "VpnclientIpsecParameters", "operation", "retrieves", "information", "about", "the", "vpnclient", "ipsec", "policy", "for", "P2S", "client", "of", "virtual", "network", "gateway", "in", "the", "specified", "resource", "group", "through", "Network", "re...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L2918-L2925
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java
GISCoordinates.L2_L3
@Pure public static Point2d L2_L3(double x, double y) { final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y, LAMBERT_2_N, LAMBERT_2_C, LAMBERT_2_XS, LAMBERT_2_YS); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_3_N, LAMBERT_3_C, LAMBERT_3_XS, LAMBERT_3_YS); }
java
@Pure public static Point2d L2_L3(double x, double y) { final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y, LAMBERT_2_N, LAMBERT_2_C, LAMBERT_2_XS, LAMBERT_2_YS); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_3_N, LAMBERT_3_C, LAMBERT_3_XS, LAMBERT_3_YS); }
[ "@", "Pure", "public", "static", "Point2d", "L2_L3", "(", "double", "x", ",", "double", "y", ")", "{", "final", "Point2d", "ntfLambdaPhi", "=", "NTFLambert_NTFLambdaPhi", "(", "x", ",", "y", ",", "LAMBERT_2_N", ",", "LAMBERT_2_C", ",", "LAMBERT_2_XS", ",", ...
This function convert France Lambert II coordinate to France Lambert III coordinate. @param x is the coordinate in France Lambert II @param y is the coordinate in France Lambert II @return the France Lambert III coordinate.
[ "This", "function", "convert", "France", "Lambert", "II", "coordinate", "to", "France", "Lambert", "III", "coordinate", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L473-L486
steveash/jopenfst
src/main/java/com/github/steveash/jopenfst/FstInputOutput.java
FstInputOutput.writeStringMap
private static void writeStringMap(SymbolTable map, ObjectOutput out) throws IOException { out.writeInt(map.size()); for (ObjectIntCursor<String> cursor : map) { out.writeUTF(cursor.key); out.writeInt(cursor.value); } }
java
private static void writeStringMap(SymbolTable map, ObjectOutput out) throws IOException { out.writeInt(map.size()); for (ObjectIntCursor<String> cursor : map) { out.writeUTF(cursor.key); out.writeInt(cursor.value); } }
[ "private", "static", "void", "writeStringMap", "(", "SymbolTable", "map", ",", "ObjectOutput", "out", ")", "throws", "IOException", "{", "out", ".", "writeInt", "(", "map", ".", "size", "(", ")", ")", ";", "for", "(", "ObjectIntCursor", "<", "String", ">",...
Serializes a symbol map to an ObjectOutput @param map the symbol map to serialize @param out the ObjectOutput. It should be already be initialized by the caller.
[ "Serializes", "a", "symbol", "map", "to", "an", "ObjectOutput" ]
train
https://github.com/steveash/jopenfst/blob/4c675203015c1cfad2072556cb532b6edc73261d/src/main/java/com/github/steveash/jopenfst/FstInputOutput.java#L172-L179
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/BaseListener.java
BaseListener.removeListener
public void removeListener(BaseListener listener, boolean bFreeFlag) { if (m_nextListener != null) { if (m_nextListener == listener) { m_nextListener = listener.getNextListener(); listener.unlink(bFreeFlag); // remove theBehavior from the linked list } else m_nextListener.removeListener(listener, bFreeFlag); } // Remember to free the listener after removing it! }
java
public void removeListener(BaseListener listener, boolean bFreeFlag) { if (m_nextListener != null) { if (m_nextListener == listener) { m_nextListener = listener.getNextListener(); listener.unlink(bFreeFlag); // remove theBehavior from the linked list } else m_nextListener.removeListener(listener, bFreeFlag); } // Remember to free the listener after removing it! }
[ "public", "void", "removeListener", "(", "BaseListener", "listener", ",", "boolean", "bFreeFlag", ")", "{", "if", "(", "m_nextListener", "!=", "null", ")", "{", "if", "(", "m_nextListener", "==", "listener", ")", "{", "m_nextListener", "=", "listener", ".", ...
Remove a specific listener from the chain. @param listener The listener to remove. @param bDeleteFlag If true, free the listener.
[ "Remove", "a", "specific", "listener", "from", "the", "chain", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BaseListener.java#L166-L178
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionScreenList_POST
public OvhOvhPabxDialplanExtensionConditionScreenList billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionScreenList_POST(String billingAccount, String serviceName, Long dialplanId, Long extensionId, String callerIdNumber, String destinationNumber, OvhOvhPabxDialplanExtensionConditionScreenListTypeEnum screenListType) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/conditionScreenList"; StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "callerIdNumber", callerIdNumber); addBody(o, "destinationNumber", destinationNumber); addBody(o, "screenListType", screenListType); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOvhPabxDialplanExtensionConditionScreenList.class); }
java
public OvhOvhPabxDialplanExtensionConditionScreenList billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionScreenList_POST(String billingAccount, String serviceName, Long dialplanId, Long extensionId, String callerIdNumber, String destinationNumber, OvhOvhPabxDialplanExtensionConditionScreenListTypeEnum screenListType) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/conditionScreenList"; StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "callerIdNumber", callerIdNumber); addBody(o, "destinationNumber", destinationNumber); addBody(o, "screenListType", screenListType); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOvhPabxDialplanExtensionConditionScreenList.class); }
[ "public", "OvhOvhPabxDialplanExtensionConditionScreenList", "billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionScreenList_POST", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "dialplanId", ",", "Long", "extensionId", ","...
Create a new screenlist condition for an extension REST: POST /telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/conditionScreenList @param screenListType [required] Type of screenlist @param destinationNumber [required] Add a screenlist based on the destination number @param callerIdNumber [required] Add a screenlist based on the presented caller number @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param dialplanId [required] @param extensionId [required]
[ "Create", "a", "new", "screenlist", "condition", "for", "an", "extension" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7222-L7231
apache/groovy
src/main/java/org/codehaus/groovy/runtime/MetaClassHelper.java
MetaClassHelper.doSetMetaClass
public static void doSetMetaClass(Object self, MetaClass mc) { if (self instanceof GroovyObject) { DefaultGroovyMethods.setMetaClass((GroovyObject)self, mc); } else { DefaultGroovyMethods.setMetaClass(self, mc); } }
java
public static void doSetMetaClass(Object self, MetaClass mc) { if (self instanceof GroovyObject) { DefaultGroovyMethods.setMetaClass((GroovyObject)self, mc); } else { DefaultGroovyMethods.setMetaClass(self, mc); } }
[ "public", "static", "void", "doSetMetaClass", "(", "Object", "self", ",", "MetaClass", "mc", ")", "{", "if", "(", "self", "instanceof", "GroovyObject", ")", "{", "DefaultGroovyMethods", ".", "setMetaClass", "(", "(", "GroovyObject", ")", "self", ",", "mc", "...
Sets the meta class for an object, by delegating to the appropriate {@link DefaultGroovyMethods} helper method. This method was introduced as a breaking change in 2.0 to solve rare cases of stack overflow. See GROOVY-5285. The method is named doSetMetaClass in order to prevent misusages. Do not use this method directly unless you know what you do. @param self the object for which to set the meta class @param mc the metaclass
[ "Sets", "the", "meta", "class", "for", "an", "object", "by", "delegating", "to", "the", "appropriate", "{", "@link", "DefaultGroovyMethods", "}", "helper", "method", ".", "This", "method", "was", "introduced", "as", "a", "breaking", "change", "in", "2", ".",...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/MetaClassHelper.java#L999-L1005
apache/predictionio-sdk-java
client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java
EventClient.userActionItemAsFuture
public FutureAPIResponse userActionItemAsFuture(String action, String uid, String iid, Map<String, Object> properties) throws IOException { return userActionItemAsFuture(action, uid, iid, properties, new DateTime()); }
java
public FutureAPIResponse userActionItemAsFuture(String action, String uid, String iid, Map<String, Object> properties) throws IOException { return userActionItemAsFuture(action, uid, iid, properties, new DateTime()); }
[ "public", "FutureAPIResponse", "userActionItemAsFuture", "(", "String", "action", ",", "String", "uid", ",", "String", "iid", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "throws", "IOException", "{", "return", "userActionItemAsFuture", "(", ...
Sends a user-action-on-item request. Similar to {@link #userActionItemAsFuture(String, String, String, Map, DateTime) #userActionItemAsFuture(String, String, String, Map&lt;String, Object\gt;, DateTime)} except event time is not specified and recorded as the time when the function is called.
[ "Sends", "a", "user", "-", "action", "-", "on", "-", "item", "request", ".", "Similar", "to", "{" ]
train
https://github.com/apache/predictionio-sdk-java/blob/16052c96b136340c175c3f9c2692e720850df219/client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java#L631-L634
kiswanij/jk-util
src/main/java/com/jk/util/thread/JKThreadLocal.java
JKThreadLocal.setValue
public static void setValue(final String name, final Object attribute) { JKThreadLocal.get().put(name, attribute); }
java
public static void setValue(final String name, final Object attribute) { JKThreadLocal.get().put(name, attribute); }
[ "public", "static", "void", "setValue", "(", "final", "String", "name", ",", "final", "Object", "attribute", ")", "{", "JKThreadLocal", ".", "get", "(", ")", ".", "put", "(", "name", ",", "attribute", ")", ";", "}" ]
Sets the value. @param name the name @param attribute the attribute
[ "Sets", "the", "value", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/thread/JKThreadLocal.java#L106-L108
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_portability_id_document_POST
public OvhPortabilityDocument billingAccount_portability_id_document_POST(String billingAccount, Long id, String description, String name) throws IOException { String qPath = "/telephony/{billingAccount}/portability/{id}/document"; StringBuilder sb = path(qPath, billingAccount, id); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); addBody(o, "name", name); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhPortabilityDocument.class); }
java
public OvhPortabilityDocument billingAccount_portability_id_document_POST(String billingAccount, Long id, String description, String name) throws IOException { String qPath = "/telephony/{billingAccount}/portability/{id}/document"; StringBuilder sb = path(qPath, billingAccount, id); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); addBody(o, "name", name); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhPortabilityDocument.class); }
[ "public", "OvhPortabilityDocument", "billingAccount_portability_id_document_POST", "(", "String", "billingAccount", ",", "Long", "id", ",", "String", "description", ",", "String", "name", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAcc...
Create a portability document REST: POST /telephony/{billingAccount}/portability/{id}/document @param description [required] Description of the document @param name [required] Document's name @param billingAccount [required] The name of your billingAccount @param id [required] The ID of the portability
[ "Create", "a", "portability", "document" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L253-L261
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/network/linkset_binding.java
linkset_binding.get
public static linkset_binding get(nitro_service service, String id) throws Exception{ linkset_binding obj = new linkset_binding(); obj.set_id(id); linkset_binding response = (linkset_binding) obj.get_resource(service); return response; }
java
public static linkset_binding get(nitro_service service, String id) throws Exception{ linkset_binding obj = new linkset_binding(); obj.set_id(id); linkset_binding response = (linkset_binding) obj.get_resource(service); return response; }
[ "public", "static", "linkset_binding", "get", "(", "nitro_service", "service", ",", "String", "id", ")", "throws", "Exception", "{", "linkset_binding", "obj", "=", "new", "linkset_binding", "(", ")", ";", "obj", ".", "set_id", "(", "id", ")", ";", "linkset_b...
Use this API to fetch linkset_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "linkset_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/network/linkset_binding.java#L114-L119
google/closure-compiler
src/com/google/javascript/jscomp/TypeInference.java
TypeInference.traverseDestructuringPattern
private FlowScope traverseDestructuringPattern( Node pattern, FlowScope scope, JSType patternType, AssignmentType assignmentType) { return traverseDestructuringPatternHelper( pattern, scope, patternType, (FlowScope flowScope, Node targetNode, JSType targetType) -> { targetType = targetType != null ? targetType : getNativeType(UNKNOWN_TYPE); return updateScopeForAssignment(flowScope, targetNode, targetType, assignmentType); }); }
java
private FlowScope traverseDestructuringPattern( Node pattern, FlowScope scope, JSType patternType, AssignmentType assignmentType) { return traverseDestructuringPatternHelper( pattern, scope, patternType, (FlowScope flowScope, Node targetNode, JSType targetType) -> { targetType = targetType != null ? targetType : getNativeType(UNKNOWN_TYPE); return updateScopeForAssignment(flowScope, targetNode, targetType, assignmentType); }); }
[ "private", "FlowScope", "traverseDestructuringPattern", "(", "Node", "pattern", ",", "FlowScope", "scope", ",", "JSType", "patternType", ",", "AssignmentType", "assignmentType", ")", "{", "return", "traverseDestructuringPatternHelper", "(", "pattern", ",", "scope", ",",...
Traverses a destructuring pattern in an assignment or declaration
[ "Traverses", "a", "destructuring", "pattern", "in", "an", "assignment", "or", "declaration" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInference.java#L1206-L1216
dashbuilder/dashbuilder
dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleTableDisplayer.java
GoogleTableDisplayer.onFilterEnabled
@Override public void onFilterEnabled(Displayer displayer, DataSetGroup groupOp) { currentPage = 1; super.onFilterEnabled(displayer, groupOp); }
java
@Override public void onFilterEnabled(Displayer displayer, DataSetGroup groupOp) { currentPage = 1; super.onFilterEnabled(displayer, groupOp); }
[ "@", "Override", "public", "void", "onFilterEnabled", "(", "Displayer", "displayer", ",", "DataSetGroup", "groupOp", ")", "{", "currentPage", "=", "1", ";", "super", ".", "onFilterEnabled", "(", "displayer", ",", "groupOp", ")", ";", "}" ]
Reset the current navigation status on filter requests from external displayers.
[ "Reset", "the", "current", "navigation", "status", "on", "filter", "requests", "from", "external", "displayers", "." ]
train
https://github.com/dashbuilder/dashbuilder/blob/50ef88210726b4f2f33f1a82eaf0f542e38dedd9/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleTableDisplayer.java#L207-L211
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/SharesInner.java
SharesInner.beginCreateOrUpdateAsync
public Observable<ShareInner> beginCreateOrUpdateAsync(String deviceName, String name, String resourceGroupName, ShareInner share) { return beginCreateOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, share).map(new Func1<ServiceResponse<ShareInner>, ShareInner>() { @Override public ShareInner call(ServiceResponse<ShareInner> response) { return response.body(); } }); }
java
public Observable<ShareInner> beginCreateOrUpdateAsync(String deviceName, String name, String resourceGroupName, ShareInner share) { return beginCreateOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, share).map(new Func1<ServiceResponse<ShareInner>, ShareInner>() { @Override public ShareInner call(ServiceResponse<ShareInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ShareInner", ">", "beginCreateOrUpdateAsync", "(", "String", "deviceName", ",", "String", "name", ",", "String", "resourceGroupName", ",", "ShareInner", "share", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "devic...
Creates a new share or updates an existing share on the device. @param deviceName The device name. @param name The share name. @param resourceGroupName The resource group name. @param share The share properties. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ShareInner object
[ "Creates", "a", "new", "share", "or", "updates", "an", "existing", "share", "on", "the", "device", "." ]
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/SharesInner.java#L444-L451
apache/groovy
subprojects/groovy-xml/src/main/java/groovy/xml/MarkupBuilderHelper.java
MarkupBuilderHelper.xmlDeclaration
public void xmlDeclaration(Map<String, Object> args) { Map<String, Map<String, Object>> map = new HashMap<String, Map<String, Object>>(); map.put("xml", args); pi(map); }
java
public void xmlDeclaration(Map<String, Object> args) { Map<String, Map<String, Object>> map = new HashMap<String, Map<String, Object>>(); map.put("xml", args); pi(map); }
[ "public", "void", "xmlDeclaration", "(", "Map", "<", "String", ",", "Object", ">", "args", ")", "{", "Map", "<", "String", ",", "Map", "<", "String", ",", "Object", ">", ">", "map", "=", "new", "HashMap", "<", "String", ",", "Map", "<", "String", "...
Produce an XML declaration in the output. For example: <pre> mkp.xmlDeclaration(version:'1.0') </pre> @param args the attributes for the declaration
[ "Produce", "an", "XML", "declaration", "in", "the", "output", ".", "For", "example", ":", "<pre", ">", "mkp", ".", "xmlDeclaration", "(", "version", ":", "1", ".", "0", ")", "<", "/", "pre", ">" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-xml/src/main/java/groovy/xml/MarkupBuilderHelper.java#L119-L123
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Spliterators.java
Spliterators.checkFromToBounds
private static void checkFromToBounds(int arrayLength, int origin, int fence) { if (origin > fence) { throw new ArrayIndexOutOfBoundsException( "origin(" + origin + ") > fence(" + fence + ")"); } if (origin < 0) { throw new ArrayIndexOutOfBoundsException(origin); } if (fence > arrayLength) { throw new ArrayIndexOutOfBoundsException(fence); } }
java
private static void checkFromToBounds(int arrayLength, int origin, int fence) { if (origin > fence) { throw new ArrayIndexOutOfBoundsException( "origin(" + origin + ") > fence(" + fence + ")"); } if (origin < 0) { throw new ArrayIndexOutOfBoundsException(origin); } if (fence > arrayLength) { throw new ArrayIndexOutOfBoundsException(fence); } }
[ "private", "static", "void", "checkFromToBounds", "(", "int", "arrayLength", ",", "int", "origin", ",", "int", "fence", ")", "{", "if", "(", "origin", ">", "fence", ")", "{", "throw", "new", "ArrayIndexOutOfBoundsException", "(", "\"origin(\"", "+", "origin", ...
Validate inclusive start index and exclusive end index against the length of an array. @param arrayLength The length of the array @param origin The inclusive start index @param fence The exclusive end index @throws ArrayIndexOutOfBoundsException if the start index is greater than the end index, if the start index is negative, or the end index is greater than the array length
[ "Validate", "inclusive", "start", "index", "and", "exclusive", "end", "index", "against", "the", "length", "of", "an", "array", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Spliterators.java#L385-L396
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/lsh/RandomProjectionLSH.java
RandomProjectionLSH.entropy
public INDArray entropy(INDArray data){ INDArray data2 = Nd4j.getExecutioner().exec(new GaussianDistribution(Nd4j.create(numTables, inDimension), radius)); INDArray norms = Nd4j.norm2(data2.dup(), -1); Preconditions.checkState(norms.rank() == 1 && norms.size(0) == numTables, "Expected norm2 to have shape [%s], is %ndShape", norms.size(0), norms); data2.diviColumnVector(norms); data2.addiRowVector(data); return data2; }
java
public INDArray entropy(INDArray data){ INDArray data2 = Nd4j.getExecutioner().exec(new GaussianDistribution(Nd4j.create(numTables, inDimension), radius)); INDArray norms = Nd4j.norm2(data2.dup(), -1); Preconditions.checkState(norms.rank() == 1 && norms.size(0) == numTables, "Expected norm2 to have shape [%s], is %ndShape", norms.size(0), norms); data2.diviColumnVector(norms); data2.addiRowVector(data); return data2; }
[ "public", "INDArray", "entropy", "(", "INDArray", "data", ")", "{", "INDArray", "data2", "=", "Nd4j", ".", "getExecutioner", "(", ")", ".", "exec", "(", "new", "GaussianDistribution", "(", "Nd4j", ".", "create", "(", "numTables", ",", "inDimension", ")", "...
This picks uniformaly distributed random points on the unit of a sphere using the method of: An efficient method for generating uniformly distributed points on the surface of an n-dimensional sphere JS Hicks, RF Wheeling - Communications of the ACM, 1959 @param data a query to generate multiple probes for @return `numTables`
[ "This", "picks", "uniformaly", "distributed", "random", "points", "on", "the", "unit", "of", "a", "sphere", "using", "the", "method", "of", ":" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/lsh/RandomProjectionLSH.java#L122-L134
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatednasha/src/main/java/net/minidev/ovh/api/ApiOvhDedicatednasha.java
ApiOvhDedicatednasha.serviceName_partition_partitionName_use_GET
public OvhUnitAndValue<Double> serviceName_partition_partitionName_use_GET(String serviceName, String partitionName, OvhPartitionUsageTypeEnum type) throws IOException { String qPath = "/dedicated/nasha/{serviceName}/partition/{partitionName}/use"; StringBuilder sb = path(qPath, serviceName, partitionName); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t5); }
java
public OvhUnitAndValue<Double> serviceName_partition_partitionName_use_GET(String serviceName, String partitionName, OvhPartitionUsageTypeEnum type) throws IOException { String qPath = "/dedicated/nasha/{serviceName}/partition/{partitionName}/use"; StringBuilder sb = path(qPath, serviceName, partitionName); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t5); }
[ "public", "OvhUnitAndValue", "<", "Double", ">", "serviceName_partition_partitionName_use_GET", "(", "String", "serviceName", ",", "String", "partitionName", ",", "OvhPartitionUsageTypeEnum", "type", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated...
Return statistics about the partition REST: GET /dedicated/nasha/{serviceName}/partition/{partitionName}/use @param type [required] The type of statistic to be fetched @param serviceName [required] The internal name of your storage @param partitionName [required] the given name of partition
[ "Return", "statistics", "about", "the", "partition" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatednasha/src/main/java/net/minidev/ovh/api/ApiOvhDedicatednasha.java#L358-L364
google/closure-templates
java/src/com/google/template/soy/jbcsrc/restricted/SoyExpression.java
SoyExpression.unboxAsList
public SoyExpression unboxAsList() { if (alreadyUnboxed(List.class)) { return this; } assertBoxed(List.class); Expression unboxedList; if (delegate.isNonNullable()) { unboxedList = delegate.checkedCast(SOY_LIST_TYPE).invoke(MethodRef.SOY_LIST_AS_JAVA_LIST); } else { unboxedList = new Expression(BytecodeUtils.LIST_TYPE, features()) { @Override protected void doGen(CodeBuilder adapter) { Label end = new Label(); delegate.gen(adapter); BytecodeUtils.nullCoalesce(adapter, end); adapter.checkCast(SOY_LIST_TYPE); MethodRef.SOY_LIST_AS_JAVA_LIST.invokeUnchecked(adapter); adapter.mark(end); }; }; } ListType asListType; if (soyType().getKind() != Kind.NULL && soyRuntimeType.asNonNullable().isKnownListOrUnionOfLists()) { asListType = soyRuntimeType.asNonNullable().asListType(); } else { Kind kind = soyType().getKind(); if (kind == Kind.UNKNOWN || kind == Kind.NULL) { asListType = ListType.of(UnknownType.getInstance()); } else { // The type checker should have already rejected all of these throw new UnsupportedOperationException("Can't convert " + soyRuntimeType + " to List"); } } return forList(asListType, unboxedList); }
java
public SoyExpression unboxAsList() { if (alreadyUnboxed(List.class)) { return this; } assertBoxed(List.class); Expression unboxedList; if (delegate.isNonNullable()) { unboxedList = delegate.checkedCast(SOY_LIST_TYPE).invoke(MethodRef.SOY_LIST_AS_JAVA_LIST); } else { unboxedList = new Expression(BytecodeUtils.LIST_TYPE, features()) { @Override protected void doGen(CodeBuilder adapter) { Label end = new Label(); delegate.gen(adapter); BytecodeUtils.nullCoalesce(adapter, end); adapter.checkCast(SOY_LIST_TYPE); MethodRef.SOY_LIST_AS_JAVA_LIST.invokeUnchecked(adapter); adapter.mark(end); }; }; } ListType asListType; if (soyType().getKind() != Kind.NULL && soyRuntimeType.asNonNullable().isKnownListOrUnionOfLists()) { asListType = soyRuntimeType.asNonNullable().asListType(); } else { Kind kind = soyType().getKind(); if (kind == Kind.UNKNOWN || kind == Kind.NULL) { asListType = ListType.of(UnknownType.getInstance()); } else { // The type checker should have already rejected all of these throw new UnsupportedOperationException("Can't convert " + soyRuntimeType + " to List"); } } return forList(asListType, unboxedList); }
[ "public", "SoyExpression", "unboxAsList", "(", ")", "{", "if", "(", "alreadyUnboxed", "(", "List", ".", "class", ")", ")", "{", "return", "this", ";", "}", "assertBoxed", "(", "List", ".", "class", ")", ";", "Expression", "unboxedList", ";", "if", "(", ...
Unboxes this to a {@link SoyExpression} with a List runtime type. <p>This method is appropriate when you know (likely via inspection of the {@link #soyType()}, or other means) that the value does have the appropriate type but you prefer to interact with it as its unboxed representation.
[ "Unboxes", "this", "to", "a", "{", "@link", "SoyExpression", "}", "with", "a", "List", "runtime", "type", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/SoyExpression.java#L515-L553
pmlopes/yoke
framework/src/main/java/com/jetdrone/vertx/yoke/util/Utils.java
Utils.readResourceToString
public static String readResourceToString(@NotNull Class<?> clazz, @NotNull String resource) { try { try (Reader r = new BufferedReader(new InputStreamReader(clazz.getResourceAsStream(resource), "UTF-8"))) { Writer writer = new StringWriter(); char[] buffer = new char[1024]; int n; while ((n = r.read(buffer)) != -1) { writer.write(buffer, 0, n); } return writer.toString(); } } catch (IOException ioe) { throw new RuntimeException(ioe); } }
java
public static String readResourceToString(@NotNull Class<?> clazz, @NotNull String resource) { try { try (Reader r = new BufferedReader(new InputStreamReader(clazz.getResourceAsStream(resource), "UTF-8"))) { Writer writer = new StringWriter(); char[] buffer = new char[1024]; int n; while ((n = r.read(buffer)) != -1) { writer.write(buffer, 0, n); } return writer.toString(); } } catch (IOException ioe) { throw new RuntimeException(ioe); } }
[ "public", "static", "String", "readResourceToString", "(", "@", "NotNull", "Class", "<", "?", ">", "clazz", ",", "@", "NotNull", "String", "resource", ")", "{", "try", "{", "try", "(", "Reader", "r", "=", "new", "BufferedReader", "(", "new", "InputStreamRe...
Avoid using this method for constant reads, use it only for one time only reads from resources in the classpath
[ "Avoid", "using", "this", "method", "for", "constant", "reads", "use", "it", "only", "for", "one", "time", "only", "reads", "from", "resources", "in", "the", "classpath" ]
train
https://github.com/pmlopes/yoke/blob/fe8a64036f09fb745f0644faddd46162d64faf3c/framework/src/main/java/com/jetdrone/vertx/yoke/util/Utils.java#L60-L77
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeVocabularyValueUrl.java
AttributeVocabularyValueUrl.getAttributeVocabularyValueLocalizedContentsUrl
public static MozuUrl getAttributeVocabularyValueLocalizedContentsUrl(String attributeFQN, String value) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/VocabularyValues/{value}/LocalizedContent"); formatter.formatUrl("attributeFQN", attributeFQN); formatter.formatUrl("value", value); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getAttributeVocabularyValueLocalizedContentsUrl(String attributeFQN, String value) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/VocabularyValues/{value}/LocalizedContent"); formatter.formatUrl("attributeFQN", attributeFQN); formatter.formatUrl("value", value); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getAttributeVocabularyValueLocalizedContentsUrl", "(", "String", "attributeFQN", ",", "String", "value", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/attributedefinition/attributes/{attribut...
Get Resource Url for GetAttributeVocabularyValueLocalizedContents @param attributeFQN Fully qualified name for an attribute. @param value The value string to create. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetAttributeVocabularyValueLocalizedContents" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeVocabularyValueUrl.java#L34-L40
Ordinastie/MalisisCore
src/main/java/net/malisis/core/renderer/font/MalisisFont.java
MalisisFont.getStringWidth
public float getStringWidth(String text, FontOptions options) { if (StringUtils.isEmpty(text)) return 0; StringWalker walker = new StringWalker(text, options); walker.walkToEnd(); return walker.width(); }
java
public float getStringWidth(String text, FontOptions options) { if (StringUtils.isEmpty(text)) return 0; StringWalker walker = new StringWalker(text, options); walker.walkToEnd(); return walker.width(); }
[ "public", "float", "getStringWidth", "(", "String", "text", ",", "FontOptions", "options", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "text", ")", ")", "return", "0", ";", "StringWalker", "walker", "=", "new", "StringWalker", "(", "text", ","...
Gets the rendering width of the text. @param text the text @param options the options @return the string width
[ "Gets", "the", "rendering", "width", "of", "the", "text", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/font/MalisisFont.java#L457-L465
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/JavacState.java
JavacState.addFileToTransform
private void addFileToTransform(Map<Transformer,Map<String,Set<URI>>> gs, Transformer t, Source s) { Map<String,Set<URI>> fs = gs.get(t); if (fs == null) { fs = new HashMap<String,Set<URI>>(); gs.put(t, fs); } Set<URI> ss = fs.get(s.pkg().name()); if (ss == null) { ss = new HashSet<URI>(); fs.put(s.pkg().name(), ss); } ss.add(s.file().toURI()); }
java
private void addFileToTransform(Map<Transformer,Map<String,Set<URI>>> gs, Transformer t, Source s) { Map<String,Set<URI>> fs = gs.get(t); if (fs == null) { fs = new HashMap<String,Set<URI>>(); gs.put(t, fs); } Set<URI> ss = fs.get(s.pkg().name()); if (ss == null) { ss = new HashSet<URI>(); fs.put(s.pkg().name(), ss); } ss.add(s.file().toURI()); }
[ "private", "void", "addFileToTransform", "(", "Map", "<", "Transformer", ",", "Map", "<", "String", ",", "Set", "<", "URI", ">", ">", ">", "gs", ",", "Transformer", "t", ",", "Source", "s", ")", "{", "Map", "<", "String", ",", "Set", "<", "URI", ">...
Store the source into the set of sources belonging to the given transform.
[ "Store", "the", "source", "into", "the", "set", "of", "sources", "belonging", "to", "the", "given", "transform", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/JavacState.java#L679-L691
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/IndexedCollectionCertStore.java
IndexedCollectionCertStore.matchX509CRLs
private void matchX509CRLs(CRLSelector selector, Collection<CRL> matches) { for (Object obj : crlIssuers.values()) { if (obj instanceof X509CRL) { X509CRL crl = (X509CRL)obj; if (selector.match(crl)) { matches.add(crl); } } else { // See crlIssuers javadoc. @SuppressWarnings("unchecked") List<X509CRL> list = (List<X509CRL>)obj; for (X509CRL crl : list) { if (selector.match(crl)) { matches.add(crl); } } } } }
java
private void matchX509CRLs(CRLSelector selector, Collection<CRL> matches) { for (Object obj : crlIssuers.values()) { if (obj instanceof X509CRL) { X509CRL crl = (X509CRL)obj; if (selector.match(crl)) { matches.add(crl); } } else { // See crlIssuers javadoc. @SuppressWarnings("unchecked") List<X509CRL> list = (List<X509CRL>)obj; for (X509CRL crl : list) { if (selector.match(crl)) { matches.add(crl); } } } } }
[ "private", "void", "matchX509CRLs", "(", "CRLSelector", "selector", ",", "Collection", "<", "CRL", ">", "matches", ")", "{", "for", "(", "Object", "obj", ":", "crlIssuers", ".", "values", "(", ")", ")", "{", "if", "(", "obj", "instanceof", "X509CRL", ")"...
Iterate through all the X509CRLs and add matches to the collection.
[ "Iterate", "through", "all", "the", "X509CRLs", "and", "add", "matches", "to", "the", "collection", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/IndexedCollectionCertStore.java#L404-L422
googleapis/google-cloud-java
google-cloud-clients/google-cloud-securitycenter/src/main/java/com/google/cloud/securitycenter/v1/SecurityCenterClient.java
SecurityCenterClient.setFindingState
public final Finding setFindingState(String name, Finding.State state, Timestamp startTime) { SetFindingStateRequest request = SetFindingStateRequest.newBuilder() .setName(name) .setState(state) .setStartTime(startTime) .build(); return setFindingState(request); }
java
public final Finding setFindingState(String name, Finding.State state, Timestamp startTime) { SetFindingStateRequest request = SetFindingStateRequest.newBuilder() .setName(name) .setState(state) .setStartTime(startTime) .build(); return setFindingState(request); }
[ "public", "final", "Finding", "setFindingState", "(", "String", "name", ",", "Finding", ".", "State", "state", ",", "Timestamp", "startTime", ")", "{", "SetFindingStateRequest", "request", "=", "SetFindingStateRequest", ".", "newBuilder", "(", ")", ".", "setName",...
Updates the state of a finding. <p>Sample code: <pre><code> try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) { FindingName name = FindingName.of("[ORGANIZATION]", "[SOURCE]", "[FINDING]"); Finding.State state = Finding.State.STATE_UNSPECIFIED; Timestamp startTime = Timestamp.newBuilder().build(); Finding response = securityCenterClient.setFindingState(name.toString(), state, startTime); } </code></pre> @param name The relative resource name of the finding. See: https://cloud.google.com/apis/design/resource_names#relative_resource_name Example: "organizations/123/sources/456/finding/789". @param state The desired State of the finding. @param startTime The time at which the updated state takes effect. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Updates", "the", "state", "of", "a", "finding", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-securitycenter/src/main/java/com/google/cloud/securitycenter/v1/SecurityCenterClient.java#L1453-L1462
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTElementDef.java
XSLTElementDef.QNameEquals
private boolean QNameEquals(String uri, String localName) { return (equalsMayBeNullOrZeroLen(m_namespace, uri) && (equalsMayBeNullOrZeroLen(m_name, localName) || equalsMayBeNullOrZeroLen(m_nameAlias, localName))); }
java
private boolean QNameEquals(String uri, String localName) { return (equalsMayBeNullOrZeroLen(m_namespace, uri) && (equalsMayBeNullOrZeroLen(m_name, localName) || equalsMayBeNullOrZeroLen(m_nameAlias, localName))); }
[ "private", "boolean", "QNameEquals", "(", "String", "uri", ",", "String", "localName", ")", "{", "return", "(", "equalsMayBeNullOrZeroLen", "(", "m_namespace", ",", "uri", ")", "&&", "(", "equalsMayBeNullOrZeroLen", "(", "m_name", ",", "localName", ")", "||", ...
Tell if the namespace URI and local name match this element. @param uri The namespace uri, which may be null. @param localName The local name of an element, which may be null. @return true if the uri and local name arguments are considered to match the uri and local name of this element def.
[ "Tell", "if", "the", "namespace", "URI", "and", "local", "name", "match", "this", "element", ".", "@param", "uri", "The", "namespace", "uri", "which", "may", "be", "null", ".", "@param", "localName", "The", "local", "name", "of", "an", "element", "which", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTElementDef.java#L445-L451
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFS.java
VFS.mountZipExpanded
public static Closeable mountZipExpanded(InputStream zipData, String zipName, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException { try { boolean ok = false; final TempDir tempDir = tempFileProvider.createTempDir(zipName); try { final File zipFile = File.createTempFile(zipName + "-", ".tmp", tempDir.getRoot()); try { final FileOutputStream os = new FileOutputStream(zipFile); try { // allow an error on close to terminate the unzip VFSUtils.copyStream(zipData, os); zipData.close(); os.close(); } finally { VFSUtils.safeClose(zipData); VFSUtils.safeClose(os); } final File rootFile = tempDir.getRoot(); VFSUtils.unzip(zipFile, rootFile); final MountHandle handle = doMount(new RealFileSystem(rootFile), mountPoint, tempDir); ok = true; return handle; } finally { //noinspection ResultOfMethodCallIgnored zipFile.delete(); } } finally { if (!ok) { VFSUtils.safeClose(tempDir); } } } finally { VFSUtils.safeClose(zipData); } }
java
public static Closeable mountZipExpanded(InputStream zipData, String zipName, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException { try { boolean ok = false; final TempDir tempDir = tempFileProvider.createTempDir(zipName); try { final File zipFile = File.createTempFile(zipName + "-", ".tmp", tempDir.getRoot()); try { final FileOutputStream os = new FileOutputStream(zipFile); try { // allow an error on close to terminate the unzip VFSUtils.copyStream(zipData, os); zipData.close(); os.close(); } finally { VFSUtils.safeClose(zipData); VFSUtils.safeClose(os); } final File rootFile = tempDir.getRoot(); VFSUtils.unzip(zipFile, rootFile); final MountHandle handle = doMount(new RealFileSystem(rootFile), mountPoint, tempDir); ok = true; return handle; } finally { //noinspection ResultOfMethodCallIgnored zipFile.delete(); } } finally { if (!ok) { VFSUtils.safeClose(tempDir); } } } finally { VFSUtils.safeClose(zipData); } }
[ "public", "static", "Closeable", "mountZipExpanded", "(", "InputStream", "zipData", ",", "String", "zipName", ",", "VirtualFile", "mountPoint", ",", "TempFileProvider", "tempFileProvider", ")", "throws", "IOException", "{", "try", "{", "boolean", "ok", "=", "false",...
Create and mount an expanded zip file in a temporary file system, returning a single handle which will unmount and close the filesystem when closed. The given zip data stream is closed. @param zipData an input stream containing the zip data @param zipName the name of the archive @param mountPoint the point at which the filesystem should be mounted @param tempFileProvider the temporary file provider @return a handle @throws IOException if an error occurs
[ "Create", "and", "mount", "an", "expanded", "zip", "file", "in", "a", "temporary", "file", "system", "returning", "a", "single", "handle", "which", "will", "unmount", "and", "close", "the", "filesystem", "when", "closed", ".", "The", "given", "zip", "data", ...
train
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFS.java#L444-L478
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/InstanceOfAndCastMatchWrongType.java
InstanceOfAndCastMatchWrongType.expressionsEqual
private static boolean expressionsEqual(ExpressionTree expr1, ExpressionTree expr2) { if (!expr1.getKind().equals(expr2.getKind())) { return false; } if (!expr1.getKind().equals(Kind.ARRAY_ACCESS) && !expr1.getKind().equals(Kind.IDENTIFIER) && !(expr1 instanceof LiteralTree)) { return false; } if (expr1.getKind() == Kind.ARRAY_ACCESS) { ArrayAccessTree arrayAccessTree1 = (ArrayAccessTree) expr1; ArrayAccessTree arrayAccessTree2 = (ArrayAccessTree) expr2; return expressionsEqual(arrayAccessTree1.getExpression(), arrayAccessTree2.getExpression()) && expressionsEqual(arrayAccessTree1.getIndex(), arrayAccessTree2.getIndex()); } if (expr1 instanceof LiteralTree) { LiteralTree literalTree1 = (LiteralTree) expr1; LiteralTree literalTree2 = (LiteralTree) expr2; return literalTree1.getValue().equals(literalTree2.getValue()); } return Objects.equal(ASTHelpers.getSymbol(expr1), ASTHelpers.getSymbol(expr2)); }
java
private static boolean expressionsEqual(ExpressionTree expr1, ExpressionTree expr2) { if (!expr1.getKind().equals(expr2.getKind())) { return false; } if (!expr1.getKind().equals(Kind.ARRAY_ACCESS) && !expr1.getKind().equals(Kind.IDENTIFIER) && !(expr1 instanceof LiteralTree)) { return false; } if (expr1.getKind() == Kind.ARRAY_ACCESS) { ArrayAccessTree arrayAccessTree1 = (ArrayAccessTree) expr1; ArrayAccessTree arrayAccessTree2 = (ArrayAccessTree) expr2; return expressionsEqual(arrayAccessTree1.getExpression(), arrayAccessTree2.getExpression()) && expressionsEqual(arrayAccessTree1.getIndex(), arrayAccessTree2.getIndex()); } if (expr1 instanceof LiteralTree) { LiteralTree literalTree1 = (LiteralTree) expr1; LiteralTree literalTree2 = (LiteralTree) expr2; return literalTree1.getValue().equals(literalTree2.getValue()); } return Objects.equal(ASTHelpers.getSymbol(expr1), ASTHelpers.getSymbol(expr2)); }
[ "private", "static", "boolean", "expressionsEqual", "(", "ExpressionTree", "expr1", ",", "ExpressionTree", "expr2", ")", "{", "if", "(", "!", "expr1", ".", "getKind", "(", ")", ".", "equals", "(", "expr2", ".", "getKind", "(", ")", ")", ")", "{", "return...
Determines whether two {@link ExpressionTree} instances are equal. Only handles the cases relevant to this checker: array accesses, identifiers, and literals. Returns false for all other cases.
[ "Determines", "whether", "two", "{" ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/InstanceOfAndCastMatchWrongType.java#L203-L228
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java
XNodeSet.greaterThanOrEqual
public boolean greaterThanOrEqual(XObject obj2) throws javax.xml.transform.TransformerException { return compare(obj2, S_GTE); }
java
public boolean greaterThanOrEqual(XObject obj2) throws javax.xml.transform.TransformerException { return compare(obj2, S_GTE); }
[ "public", "boolean", "greaterThanOrEqual", "(", "XObject", "obj2", ")", "throws", "javax", ".", "xml", ".", "transform", ".", "TransformerException", "{", "return", "compare", "(", "obj2", ",", "S_GTE", ")", ";", "}" ]
Tell if one object is less than the other. @param obj2 object to compare this nodeset to @return see this.compare(...) @throws javax.xml.transform.TransformerException
[ "Tell", "if", "one", "object", "is", "less", "than", "the", "other", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java#L686-L690