repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/storefront/ProductUrl.java
ProductUrl.getProductInventoryUrl
public static MozuUrl getProductInventoryUrl(String locationCodes, String productCode, String responseFields) { """ Get Resource Url for GetProductInventory @param locationCodes Array of location codes for which to retrieve product inventory information. @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/storefront/products/{productCode}/locationinventory?locationCodes={locationCodes}&responseFields={responseFields}"); formatter.formatUrl("locationCodes", locationCodes); formatter.formatUrl("productCode", productCode); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getProductInventoryUrl(String locationCodes, String productCode, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/storefront/products/{productCode}/locationinventory?locationCodes={locationCodes}&responseFields={responseFields}"); formatter.formatUrl("locationCodes", locationCodes); formatter.formatUrl("productCode", productCode); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getProductInventoryUrl", "(", "String", "locationCodes", ",", "String", "productCode", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/storefront/products/{productCode}/locationinventory?locationCodes={locationCodes}&responseFields={responseFields}\"", ")", ";", "formatter", ".", "formatUrl", "(", "\"locationCodes\"", ",", "locationCodes", ")", ";", "formatter", ".", "formatUrl", "(", "\"productCode\"", ",", "productCode", ")", ";", "formatter", ".", "formatUrl", "(", "\"responseFields\"", ",", "responseFields", ")", ";", "return", "new", "MozuUrl", "(", "formatter", ".", "getResourceUrl", "(", ")", ",", "MozuUrl", ".", "UrlLocation", ".", "TENANT_POD", ")", ";", "}" ]
Get Resource Url for GetProductInventory @param locationCodes Array of location codes for which to retrieve product inventory information. @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetProductInventory" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/storefront/ProductUrl.java#L49-L56
Azure/azure-sdk-for-java
storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java
StorageAccountsInner.listServiceSASAsync
public Observable<ListServiceSasResponseInner> listServiceSASAsync(String resourceGroupName, String accountName, ServiceSasParameters parameters) { """ List service SAS credentials of a specific resource. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @param parameters The parameters to provide to list service SAS credentials. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ListServiceSasResponseInner object """ return listServiceSASWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<ListServiceSasResponseInner>, ListServiceSasResponseInner>() { @Override public ListServiceSasResponseInner call(ServiceResponse<ListServiceSasResponseInner> response) { return response.body(); } }); }
java
public Observable<ListServiceSasResponseInner> listServiceSASAsync(String resourceGroupName, String accountName, ServiceSasParameters parameters) { return listServiceSASWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<ListServiceSasResponseInner>, ListServiceSasResponseInner>() { @Override public ListServiceSasResponseInner call(ServiceResponse<ListServiceSasResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ListServiceSasResponseInner", ">", "listServiceSASAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "ServiceSasParameters", "parameters", ")", "{", "return", "listServiceSASWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ListServiceSasResponseInner", ">", ",", "ListServiceSasResponseInner", ">", "(", ")", "{", "@", "Override", "public", "ListServiceSasResponseInner", "call", "(", "ServiceResponse", "<", "ListServiceSasResponseInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
List service SAS credentials of a specific resource. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @param parameters The parameters to provide to list service SAS credentials. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ListServiceSasResponseInner object
[ "List", "service", "SAS", "credentials", "of", "a", "specific", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java#L1136-L1143
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/HttpConversionUtil.java
HttpConversionUtil.toHttpRequest
public static HttpRequest toHttpRequest(int streamId, Http2Headers http2Headers, boolean validateHttpHeaders) throws Http2Exception { """ Create a new object to contain the request data. @param streamId The stream associated with the request @param http2Headers The initial set of HTTP/2 headers to create the request with @param validateHttpHeaders <ul> <li>{@code true} to validate HTTP headers in the http-codec</li> <li>{@code false} not to validate HTTP headers in the http-codec</li> </ul> @return A new request object which represents headers for a chunked request @throws Http2Exception see {@link #addHttp2ToHttpHeaders(int, Http2Headers, FullHttpMessage, boolean)} """ // HTTP/2 does not define a way to carry the version identifier that is included in the HTTP/1.1 request line. final CharSequence method = checkNotNull(http2Headers.method(), "method header cannot be null in conversion to HTTP/1.x"); final CharSequence path = checkNotNull(http2Headers.path(), "path header cannot be null in conversion to HTTP/1.x"); HttpRequest msg = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.valueOf(method.toString()), path.toString(), validateHttpHeaders); try { addHttp2ToHttpHeaders(streamId, http2Headers, msg.headers(), msg.protocolVersion(), false, true); } catch (Http2Exception e) { throw e; } catch (Throwable t) { throw streamError(streamId, PROTOCOL_ERROR, t, "HTTP/2 to HTTP/1.x headers conversion error"); } return msg; }
java
public static HttpRequest toHttpRequest(int streamId, Http2Headers http2Headers, boolean validateHttpHeaders) throws Http2Exception { // HTTP/2 does not define a way to carry the version identifier that is included in the HTTP/1.1 request line. final CharSequence method = checkNotNull(http2Headers.method(), "method header cannot be null in conversion to HTTP/1.x"); final CharSequence path = checkNotNull(http2Headers.path(), "path header cannot be null in conversion to HTTP/1.x"); HttpRequest msg = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.valueOf(method.toString()), path.toString(), validateHttpHeaders); try { addHttp2ToHttpHeaders(streamId, http2Headers, msg.headers(), msg.protocolVersion(), false, true); } catch (Http2Exception e) { throw e; } catch (Throwable t) { throw streamError(streamId, PROTOCOL_ERROR, t, "HTTP/2 to HTTP/1.x headers conversion error"); } return msg; }
[ "public", "static", "HttpRequest", "toHttpRequest", "(", "int", "streamId", ",", "Http2Headers", "http2Headers", ",", "boolean", "validateHttpHeaders", ")", "throws", "Http2Exception", "{", "// HTTP/2 does not define a way to carry the version identifier that is included in the HTTP/1.1 request line.", "final", "CharSequence", "method", "=", "checkNotNull", "(", "http2Headers", ".", "method", "(", ")", ",", "\"method header cannot be null in conversion to HTTP/1.x\"", ")", ";", "final", "CharSequence", "path", "=", "checkNotNull", "(", "http2Headers", ".", "path", "(", ")", ",", "\"path header cannot be null in conversion to HTTP/1.x\"", ")", ";", "HttpRequest", "msg", "=", "new", "DefaultHttpRequest", "(", "HttpVersion", ".", "HTTP_1_1", ",", "HttpMethod", ".", "valueOf", "(", "method", ".", "toString", "(", ")", ")", ",", "path", ".", "toString", "(", ")", ",", "validateHttpHeaders", ")", ";", "try", "{", "addHttp2ToHttpHeaders", "(", "streamId", ",", "http2Headers", ",", "msg", ".", "headers", "(", ")", ",", "msg", ".", "protocolVersion", "(", ")", ",", "false", ",", "true", ")", ";", "}", "catch", "(", "Http2Exception", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "throw", "streamError", "(", "streamId", ",", "PROTOCOL_ERROR", ",", "t", ",", "\"HTTP/2 to HTTP/1.x headers conversion error\"", ")", ";", "}", "return", "msg", ";", "}" ]
Create a new object to contain the request data. @param streamId The stream associated with the request @param http2Headers The initial set of HTTP/2 headers to create the request with @param validateHttpHeaders <ul> <li>{@code true} to validate HTTP headers in the http-codec</li> <li>{@code false} not to validate HTTP headers in the http-codec</li> </ul> @return A new request object which represents headers for a chunked request @throws Http2Exception see {@link #addHttp2ToHttpHeaders(int, Http2Headers, FullHttpMessage, boolean)}
[ "Create", "a", "new", "object", "to", "contain", "the", "request", "data", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HttpConversionUtil.java#L280-L297
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java
HadoopUtils.renamePath
public static void renamePath(FileContext fc, Path oldName, Path newName, boolean overwrite) throws IOException { """ A wrapper around {@link FileContext#rename(Path, Path, Options.Rename...)}}. """ Options.Rename renameOptions = (overwrite) ? Options.Rename.OVERWRITE : Options.Rename.NONE; fc.rename(oldName, newName, renameOptions); }
java
public static void renamePath(FileContext fc, Path oldName, Path newName, boolean overwrite) throws IOException { Options.Rename renameOptions = (overwrite) ? Options.Rename.OVERWRITE : Options.Rename.NONE; fc.rename(oldName, newName, renameOptions); }
[ "public", "static", "void", "renamePath", "(", "FileContext", "fc", ",", "Path", "oldName", ",", "Path", "newName", ",", "boolean", "overwrite", ")", "throws", "IOException", "{", "Options", ".", "Rename", "renameOptions", "=", "(", "overwrite", ")", "?", "Options", ".", "Rename", ".", "OVERWRITE", ":", "Options", ".", "Rename", ".", "NONE", ";", "fc", ".", "rename", "(", "oldName", ",", "newName", ",", "renameOptions", ")", ";", "}" ]
A wrapper around {@link FileContext#rename(Path, Path, Options.Rename...)}}.
[ "A", "wrapper", "around", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java#L250-L254
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/core/encoding/ConvertNV21.java
ConvertNV21.nv21ToInterleaved
public static InterleavedU8 nv21ToInterleaved( byte[] data , int width , int height , InterleavedU8 output ) { """ Converts an NV21 image into a {@link InterleavedU8} RGB image. @param data Input: NV21 image data @param width Input: NV21 image width @param height Input: NV21 image height @param output Output: Optional storage for output image. Can be null. """ if( output == null ) { output = new InterleavedU8(width,height,3); } else { output.reshape(width, height, 3); } if(BoofConcurrency.USE_CONCURRENT ) { ImplConvertNV21_MT.nv21ToInterleaved_U8(data, output); } else { ImplConvertNV21.nv21ToInterleaved_U8(data, output); } return output; }
java
public static InterleavedU8 nv21ToInterleaved( byte[] data , int width , int height , InterleavedU8 output ) { if( output == null ) { output = new InterleavedU8(width,height,3); } else { output.reshape(width, height, 3); } if(BoofConcurrency.USE_CONCURRENT ) { ImplConvertNV21_MT.nv21ToInterleaved_U8(data, output); } else { ImplConvertNV21.nv21ToInterleaved_U8(data, output); } return output; }
[ "public", "static", "InterleavedU8", "nv21ToInterleaved", "(", "byte", "[", "]", "data", ",", "int", "width", ",", "int", "height", ",", "InterleavedU8", "output", ")", "{", "if", "(", "output", "==", "null", ")", "{", "output", "=", "new", "InterleavedU8", "(", "width", ",", "height", ",", "3", ")", ";", "}", "else", "{", "output", ".", "reshape", "(", "width", ",", "height", ",", "3", ")", ";", "}", "if", "(", "BoofConcurrency", ".", "USE_CONCURRENT", ")", "{", "ImplConvertNV21_MT", ".", "nv21ToInterleaved_U8", "(", "data", ",", "output", ")", ";", "}", "else", "{", "ImplConvertNV21", ".", "nv21ToInterleaved_U8", "(", "data", ",", "output", ")", ";", "}", "return", "output", ";", "}" ]
Converts an NV21 image into a {@link InterleavedU8} RGB image. @param data Input: NV21 image data @param width Input: NV21 image width @param height Input: NV21 image height @param output Output: Optional storage for output image. Can be null.
[ "Converts", "an", "NV21", "image", "into", "a", "{", "@link", "InterleavedU8", "}", "RGB", "image", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/core/encoding/ConvertNV21.java#L231-L245
google/closure-templates
java/src/com/google/template/soy/parsepasses/contextautoesc/InferenceEngine.java
InferenceEngine.inferTemplateEndContext
public static Context inferTemplateEndContext( TemplateNode templateNode, Context startContext, Inferences inferences, ErrorReporter errorReporter) { """ Infer an end context for the given template and, if requested, choose escaping directives for any <code>{print}</code>. @param templateNode A template that is visited in {@code startContext} and no other. If a template can be reached from multiple contexts, then it should be cloned. This class automatically does that for called templates. @param inferences Receives all suggested changes and inferences to tn. @return The end context when the given template is reached from {@code startContext}. """ InferenceEngine inferenceEngine = new InferenceEngine(inferences, errorReporter); // Context started off as startContext and we have propagated context through all of // template's children, so now return the template's end context. return inferenceEngine.infer(templateNode, startContext); }
java
public static Context inferTemplateEndContext( TemplateNode templateNode, Context startContext, Inferences inferences, ErrorReporter errorReporter) { InferenceEngine inferenceEngine = new InferenceEngine(inferences, errorReporter); // Context started off as startContext and we have propagated context through all of // template's children, so now return the template's end context. return inferenceEngine.infer(templateNode, startContext); }
[ "public", "static", "Context", "inferTemplateEndContext", "(", "TemplateNode", "templateNode", ",", "Context", "startContext", ",", "Inferences", "inferences", ",", "ErrorReporter", "errorReporter", ")", "{", "InferenceEngine", "inferenceEngine", "=", "new", "InferenceEngine", "(", "inferences", ",", "errorReporter", ")", ";", "// Context started off as startContext and we have propagated context through all of", "// template's children, so now return the template's end context.", "return", "inferenceEngine", ".", "infer", "(", "templateNode", ",", "startContext", ")", ";", "}" ]
Infer an end context for the given template and, if requested, choose escaping directives for any <code>{print}</code>. @param templateNode A template that is visited in {@code startContext} and no other. If a template can be reached from multiple contexts, then it should be cloned. This class automatically does that for called templates. @param inferences Receives all suggested changes and inferences to tn. @return The end context when the given template is reached from {@code startContext}.
[ "Infer", "an", "end", "context", "for", "the", "given", "template", "and", "if", "requested", "choose", "escaping", "directives", "for", "any", "<code", ">", "{", "print", "}", "<", "/", "code", ">", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/InferenceEngine.java#L97-L106
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java
BinaryRowProtocol.getInternalTime
public Time getInternalTime(ColumnInformation columnInfo, Calendar cal, TimeZone timeZone) throws SQLException { """ Get time from raw binary format. @param columnInfo column information @param cal calendar @param timeZone time zone @return Time value @throws SQLException if column cannot be converted to Time """ if (lastValueWasNull()) { return null; } switch (columnInfo.getColumnType()) { case TIMESTAMP: case DATETIME: Timestamp ts = getInternalTimestamp(columnInfo, cal, timeZone); return (ts == null) ? null : new Time(ts.getTime()); case DATE: throw new SQLException("Cannot read Time using a Types.DATE field"); default: Calendar calendar = Calendar.getInstance(); calendar.clear(); int day = 0; int hour = 0; int minutes = 0; int seconds = 0; boolean negate = false; if (length > 0) { negate = (buf[pos] & 0xff) == 0x01; } if (length > 4) { day = ((buf[pos + 1] & 0xff) + ((buf[pos + 2] & 0xff) << 8) + ((buf[pos + 3] & 0xff) << 16) + ((buf[pos + 4] & 0xff) << 24)); } if (length > 7) { hour = buf[pos + 5]; minutes = buf[pos + 6]; seconds = buf[pos + 7]; } calendar .set(1970, Calendar.JANUARY, ((negate ? -1 : 1) * day) + 1, (negate ? -1 : 1) * hour, minutes, seconds); int nanoseconds = 0; if (length > 8) { nanoseconds = ((buf[pos + 8] & 0xff) + ((buf[pos + 9] & 0xff) << 8) + ((buf[pos + 10] & 0xff) << 16) + ((buf[pos + 11] & 0xff) << 24)); } calendar.set(Calendar.MILLISECOND, nanoseconds / 1000); return new Time(calendar.getTimeInMillis()); } }
java
public Time getInternalTime(ColumnInformation columnInfo, Calendar cal, TimeZone timeZone) throws SQLException { if (lastValueWasNull()) { return null; } switch (columnInfo.getColumnType()) { case TIMESTAMP: case DATETIME: Timestamp ts = getInternalTimestamp(columnInfo, cal, timeZone); return (ts == null) ? null : new Time(ts.getTime()); case DATE: throw new SQLException("Cannot read Time using a Types.DATE field"); default: Calendar calendar = Calendar.getInstance(); calendar.clear(); int day = 0; int hour = 0; int minutes = 0; int seconds = 0; boolean negate = false; if (length > 0) { negate = (buf[pos] & 0xff) == 0x01; } if (length > 4) { day = ((buf[pos + 1] & 0xff) + ((buf[pos + 2] & 0xff) << 8) + ((buf[pos + 3] & 0xff) << 16) + ((buf[pos + 4] & 0xff) << 24)); } if (length > 7) { hour = buf[pos + 5]; minutes = buf[pos + 6]; seconds = buf[pos + 7]; } calendar .set(1970, Calendar.JANUARY, ((negate ? -1 : 1) * day) + 1, (negate ? -1 : 1) * hour, minutes, seconds); int nanoseconds = 0; if (length > 8) { nanoseconds = ((buf[pos + 8] & 0xff) + ((buf[pos + 9] & 0xff) << 8) + ((buf[pos + 10] & 0xff) << 16) + ((buf[pos + 11] & 0xff) << 24)); } calendar.set(Calendar.MILLISECOND, nanoseconds / 1000); return new Time(calendar.getTimeInMillis()); } }
[ "public", "Time", "getInternalTime", "(", "ColumnInformation", "columnInfo", ",", "Calendar", "cal", ",", "TimeZone", "timeZone", ")", "throws", "SQLException", "{", "if", "(", "lastValueWasNull", "(", ")", ")", "{", "return", "null", ";", "}", "switch", "(", "columnInfo", ".", "getColumnType", "(", ")", ")", "{", "case", "TIMESTAMP", ":", "case", "DATETIME", ":", "Timestamp", "ts", "=", "getInternalTimestamp", "(", "columnInfo", ",", "cal", ",", "timeZone", ")", ";", "return", "(", "ts", "==", "null", ")", "?", "null", ":", "new", "Time", "(", "ts", ".", "getTime", "(", ")", ")", ";", "case", "DATE", ":", "throw", "new", "SQLException", "(", "\"Cannot read Time using a Types.DATE field\"", ")", ";", "default", ":", "Calendar", "calendar", "=", "Calendar", ".", "getInstance", "(", ")", ";", "calendar", ".", "clear", "(", ")", ";", "int", "day", "=", "0", ";", "int", "hour", "=", "0", ";", "int", "minutes", "=", "0", ";", "int", "seconds", "=", "0", ";", "boolean", "negate", "=", "false", ";", "if", "(", "length", ">", "0", ")", "{", "negate", "=", "(", "buf", "[", "pos", "]", "&", "0xff", ")", "==", "0x01", ";", "}", "if", "(", "length", ">", "4", ")", "{", "day", "=", "(", "(", "buf", "[", "pos", "+", "1", "]", "&", "0xff", ")", "+", "(", "(", "buf", "[", "pos", "+", "2", "]", "&", "0xff", ")", "<<", "8", ")", "+", "(", "(", "buf", "[", "pos", "+", "3", "]", "&", "0xff", ")", "<<", "16", ")", "+", "(", "(", "buf", "[", "pos", "+", "4", "]", "&", "0xff", ")", "<<", "24", ")", ")", ";", "}", "if", "(", "length", ">", "7", ")", "{", "hour", "=", "buf", "[", "pos", "+", "5", "]", ";", "minutes", "=", "buf", "[", "pos", "+", "6", "]", ";", "seconds", "=", "buf", "[", "pos", "+", "7", "]", ";", "}", "calendar", ".", "set", "(", "1970", ",", "Calendar", ".", "JANUARY", ",", "(", "(", "negate", "?", "-", "1", ":", "1", ")", "*", "day", ")", "+", "1", ",", "(", "negate", "?", "-", "1", ":", "1", ")", "*", "hour", ",", "minutes", ",", "seconds", ")", ";", "int", "nanoseconds", "=", "0", ";", "if", "(", "length", ">", "8", ")", "{", "nanoseconds", "=", "(", "(", "buf", "[", "pos", "+", "8", "]", "&", "0xff", ")", "+", "(", "(", "buf", "[", "pos", "+", "9", "]", "&", "0xff", ")", "<<", "8", ")", "+", "(", "(", "buf", "[", "pos", "+", "10", "]", "&", "0xff", ")", "<<", "16", ")", "+", "(", "(", "buf", "[", "pos", "+", "11", "]", "&", "0xff", ")", "<<", "24", ")", ")", ";", "}", "calendar", ".", "set", "(", "Calendar", ".", "MILLISECOND", ",", "nanoseconds", "/", "1000", ")", ";", "return", "new", "Time", "(", "calendar", ".", "getTimeInMillis", "(", ")", ")", ";", "}", "}" ]
Get time from raw binary format. @param columnInfo column information @param cal calendar @param timeZone time zone @return Time value @throws SQLException if column cannot be converted to Time
[ "Get", "time", "from", "raw", "binary", "format", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java#L801-L851
apache/flink
flink-formats/flink-avro-confluent-registry/src/main/java/org/apache/flink/formats/avro/registry/confluent/ConfluentRegistryAvroDeserializationSchema.java
ConfluentRegistryAvroDeserializationSchema.forGeneric
public static ConfluentRegistryAvroDeserializationSchema<GenericRecord> forGeneric(Schema schema, String url) { """ Creates {@link ConfluentRegistryAvroDeserializationSchema} that produces {@link GenericRecord} using provided reader schema and looks up writer schema in Confluent Schema Registry. @param schema schema of produced records @param url url of schema registry to connect @return deserialized record in form of {@link GenericRecord} """ return forGeneric(schema, url, DEFAULT_IDENTITY_MAP_CAPACITY); }
java
public static ConfluentRegistryAvroDeserializationSchema<GenericRecord> forGeneric(Schema schema, String url) { return forGeneric(schema, url, DEFAULT_IDENTITY_MAP_CAPACITY); }
[ "public", "static", "ConfluentRegistryAvroDeserializationSchema", "<", "GenericRecord", ">", "forGeneric", "(", "Schema", "schema", ",", "String", "url", ")", "{", "return", "forGeneric", "(", "schema", ",", "url", ",", "DEFAULT_IDENTITY_MAP_CAPACITY", ")", ";", "}" ]
Creates {@link ConfluentRegistryAvroDeserializationSchema} that produces {@link GenericRecord} using provided reader schema and looks up writer schema in Confluent Schema Registry. @param schema schema of produced records @param url url of schema registry to connect @return deserialized record in form of {@link GenericRecord}
[ "Creates", "{", "@link", "ConfluentRegistryAvroDeserializationSchema", "}", "that", "produces", "{", "@link", "GenericRecord", "}", "using", "provided", "reader", "schema", "and", "looks", "up", "writer", "schema", "in", "Confluent", "Schema", "Registry", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-avro-confluent-registry/src/main/java/org/apache/flink/formats/avro/registry/confluent/ConfluentRegistryAvroDeserializationSchema.java#L66-L68
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java
DatatypeConverter.printDurationMandatory
public static final String printDurationMandatory(MSPDIWriter writer, Duration duration) { """ Print duration. Note that Microsoft's xsd:duration parser implementation does not appear to recognise durations other than those expressed in hours. We use the compatibility flag to determine whether the output is adjusted for the benefit of Microsoft Project. @param writer parent MSPDIWriter instance @param duration Duration value @return xsd:duration value """ String result; if (duration == null) { // SF-329: null default required to keep Powerproject happy when importing MSPDI files result = "PT0H0M0S"; } else { TimeUnit durationType = duration.getUnits(); if (durationType == TimeUnit.HOURS || durationType == TimeUnit.ELAPSED_HOURS) { result = new XsdDuration(duration).toString(); } else { duration = duration.convertUnits(TimeUnit.HOURS, writer.getProjectFile().getProjectProperties()); result = new XsdDuration(duration).toString(); } } return (result); }
java
public static final String printDurationMandatory(MSPDIWriter writer, Duration duration) { String result; if (duration == null) { // SF-329: null default required to keep Powerproject happy when importing MSPDI files result = "PT0H0M0S"; } else { TimeUnit durationType = duration.getUnits(); if (durationType == TimeUnit.HOURS || durationType == TimeUnit.ELAPSED_HOURS) { result = new XsdDuration(duration).toString(); } else { duration = duration.convertUnits(TimeUnit.HOURS, writer.getProjectFile().getProjectProperties()); result = new XsdDuration(duration).toString(); } } return (result); }
[ "public", "static", "final", "String", "printDurationMandatory", "(", "MSPDIWriter", "writer", ",", "Duration", "duration", ")", "{", "String", "result", ";", "if", "(", "duration", "==", "null", ")", "{", "// SF-329: null default required to keep Powerproject happy when importing MSPDI files", "result", "=", "\"PT0H0M0S\"", ";", "}", "else", "{", "TimeUnit", "durationType", "=", "duration", ".", "getUnits", "(", ")", ";", "if", "(", "durationType", "==", "TimeUnit", ".", "HOURS", "||", "durationType", "==", "TimeUnit", ".", "ELAPSED_HOURS", ")", "{", "result", "=", "new", "XsdDuration", "(", "duration", ")", ".", "toString", "(", ")", ";", "}", "else", "{", "duration", "=", "duration", ".", "convertUnits", "(", "TimeUnit", ".", "HOURS", ",", "writer", ".", "getProjectFile", "(", ")", ".", "getProjectProperties", "(", ")", ")", ";", "result", "=", "new", "XsdDuration", "(", "duration", ")", ".", "toString", "(", ")", ";", "}", "}", "return", "(", "result", ")", ";", "}" ]
Print duration. Note that Microsoft's xsd:duration parser implementation does not appear to recognise durations other than those expressed in hours. We use the compatibility flag to determine whether the output is adjusted for the benefit of Microsoft Project. @param writer parent MSPDIWriter instance @param duration Duration value @return xsd:duration value
[ "Print", "duration", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L960-L985
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/dataformats/json/jackson/AbstractJsonDeserializer.java
AbstractJsonDeserializer.getBooleanParam
protected Boolean getBooleanParam(String paramName, String errorMessage) throws IOException { """ Convenience method for subclasses. @param paramName the name of the parameter @param errorMessage the errormessage to add to the exception if the param does not exist. @return a stringparameter with given name. If it does not exist and the errormessage is provided, an IOException is thrown with that message. if the errormessage is not provided, null is returned. @throws IOException Exception if the paramname does not exist and an errormessage is provided. """ return getBooleanParam(paramName, errorMessage, (Map<String, Object>) inputParams.get()); }
java
protected Boolean getBooleanParam(String paramName, String errorMessage) throws IOException { return getBooleanParam(paramName, errorMessage, (Map<String, Object>) inputParams.get()); }
[ "protected", "Boolean", "getBooleanParam", "(", "String", "paramName", ",", "String", "errorMessage", ")", "throws", "IOException", "{", "return", "getBooleanParam", "(", "paramName", ",", "errorMessage", ",", "(", "Map", "<", "String", ",", "Object", ">", ")", "inputParams", ".", "get", "(", ")", ")", ";", "}" ]
Convenience method for subclasses. @param paramName the name of the parameter @param errorMessage the errormessage to add to the exception if the param does not exist. @return a stringparameter with given name. If it does not exist and the errormessage is provided, an IOException is thrown with that message. if the errormessage is not provided, null is returned. @throws IOException Exception if the paramname does not exist and an errormessage is provided.
[ "Convenience", "method", "for", "subclasses", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/AbstractJsonDeserializer.java#L258-L260
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.payment_thod_POST
public OvhValidationResult payment_thod_POST(Long billingContactId, OvhCallbackUrl callbackUrl, Boolean _default, String description, Long orderId, String paymentType, Boolean register) throws IOException { """ Pay an order and register a new payment method if necessary REST: POST /me/payment/method @param billingContactId [required] Billing contact id @param callbackUrl [required] URL's necessary to register @param _default [required] Is this payment method set as the default one @param description [required] Customer personalized description @param orderId [required] The ID of one order to pay it @param paymentType [required] Payment type @param register [required] Register this payment method if it's possible (by default it's false and do a oneshot transaction) API beta """ String qPath = "/me/payment/method"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "billingContactId", billingContactId); addBody(o, "callbackUrl", callbackUrl); addBody(o, "default", _default); addBody(o, "description", description); addBody(o, "orderId", orderId); addBody(o, "paymentType", paymentType); addBody(o, "register", register); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhValidationResult.class); }
java
public OvhValidationResult payment_thod_POST(Long billingContactId, OvhCallbackUrl callbackUrl, Boolean _default, String description, Long orderId, String paymentType, Boolean register) throws IOException { String qPath = "/me/payment/method"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "billingContactId", billingContactId); addBody(o, "callbackUrl", callbackUrl); addBody(o, "default", _default); addBody(o, "description", description); addBody(o, "orderId", orderId); addBody(o, "paymentType", paymentType); addBody(o, "register", register); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhValidationResult.class); }
[ "public", "OvhValidationResult", "payment_thod_POST", "(", "Long", "billingContactId", ",", "OvhCallbackUrl", "callbackUrl", ",", "Boolean", "_default", ",", "String", "description", ",", "Long", "orderId", ",", "String", "paymentType", ",", "Boolean", "register", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/payment/method\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"billingContactId\"", ",", "billingContactId", ")", ";", "addBody", "(", "o", ",", "\"callbackUrl\"", ",", "callbackUrl", ")", ";", "addBody", "(", "o", ",", "\"default\"", ",", "_default", ")", ";", "addBody", "(", "o", ",", "\"description\"", ",", "description", ")", ";", "addBody", "(", "o", ",", "\"orderId\"", ",", "orderId", ")", ";", "addBody", "(", "o", ",", "\"paymentType\"", ",", "paymentType", ")", ";", "addBody", "(", "o", ",", "\"register\"", ",", "register", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhValidationResult", ".", "class", ")", ";", "}" ]
Pay an order and register a new payment method if necessary REST: POST /me/payment/method @param billingContactId [required] Billing contact id @param callbackUrl [required] URL's necessary to register @param _default [required] Is this payment method set as the default one @param description [required] Customer personalized description @param orderId [required] The ID of one order to pay it @param paymentType [required] Payment type @param register [required] Register this payment method if it's possible (by default it's false and do a oneshot transaction) API beta
[ "Pay", "an", "order", "and", "register", "a", "new", "payment", "method", "if", "necessary" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1034-L1047
kaazing/gateway
management/src/main/java/org/kaazing/gateway/management/monitoring/configuration/impl/MonitorFileWriterImpl.java
MonitorFileWriterImpl.initializeServiceRefMetadata
private void initializeServiceRefMetadata(int serviceLocationOffset, int serviceOffsetIndex) { """ Method initializing service ref metadata section data @param serviceLocationOffset @param serviceOffsetIndex """ metaDataBuffer.putInt(serviceLocationOffset, serviceRefSection + serviceOffsetIndex * BitUtil.SIZE_OF_INT); // service reference section metaDataBuffer.putInt(serviceRefSection + serviceOffsetIndex * BitUtil.SIZE_OF_INT, 0); metaDataBuffer.putInt(serviceRefSection + (serviceOffsetIndex + 1) * BitUtil.SIZE_OF_INT, SERVICE_COUNTER_LABELS_BUFFER_LENGTH); metaDataBuffer.putInt(serviceRefSection + (serviceOffsetIndex + 2) * BitUtil.SIZE_OF_INT, 0); metaDataBuffer.putInt(serviceRefSection + (serviceOffsetIndex + 3) * BitUtil.SIZE_OF_INT, SERVICE_COUNTER_VALUES_BUFFER_LENGTH); }
java
private void initializeServiceRefMetadata(int serviceLocationOffset, int serviceOffsetIndex) { metaDataBuffer.putInt(serviceLocationOffset, serviceRefSection + serviceOffsetIndex * BitUtil.SIZE_OF_INT); // service reference section metaDataBuffer.putInt(serviceRefSection + serviceOffsetIndex * BitUtil.SIZE_OF_INT, 0); metaDataBuffer.putInt(serviceRefSection + (serviceOffsetIndex + 1) * BitUtil.SIZE_OF_INT, SERVICE_COUNTER_LABELS_BUFFER_LENGTH); metaDataBuffer.putInt(serviceRefSection + (serviceOffsetIndex + 2) * BitUtil.SIZE_OF_INT, 0); metaDataBuffer.putInt(serviceRefSection + (serviceOffsetIndex + 3) * BitUtil.SIZE_OF_INT, SERVICE_COUNTER_VALUES_BUFFER_LENGTH); }
[ "private", "void", "initializeServiceRefMetadata", "(", "int", "serviceLocationOffset", ",", "int", "serviceOffsetIndex", ")", "{", "metaDataBuffer", ".", "putInt", "(", "serviceLocationOffset", ",", "serviceRefSection", "+", "serviceOffsetIndex", "*", "BitUtil", ".", "SIZE_OF_INT", ")", ";", "// service reference section", "metaDataBuffer", ".", "putInt", "(", "serviceRefSection", "+", "serviceOffsetIndex", "*", "BitUtil", ".", "SIZE_OF_INT", ",", "0", ")", ";", "metaDataBuffer", ".", "putInt", "(", "serviceRefSection", "+", "(", "serviceOffsetIndex", "+", "1", ")", "*", "BitUtil", ".", "SIZE_OF_INT", ",", "SERVICE_COUNTER_LABELS_BUFFER_LENGTH", ")", ";", "metaDataBuffer", ".", "putInt", "(", "serviceRefSection", "+", "(", "serviceOffsetIndex", "+", "2", ")", "*", "BitUtil", ".", "SIZE_OF_INT", ",", "0", ")", ";", "metaDataBuffer", ".", "putInt", "(", "serviceRefSection", "+", "(", "serviceOffsetIndex", "+", "3", ")", "*", "BitUtil", ".", "SIZE_OF_INT", ",", "SERVICE_COUNTER_VALUES_BUFFER_LENGTH", ")", ";", "}" ]
Method initializing service ref metadata section data @param serviceLocationOffset @param serviceOffsetIndex
[ "Method", "initializing", "service", "ref", "metadata", "section", "data" ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/monitoring/configuration/impl/MonitorFileWriterImpl.java#L241-L251
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java
SegmentsUtil.setFloat
public static void setFloat(MemorySegment[] segments, int offset, float value) { """ set float from segments. @param segments target segments. @param offset value offset. """ if (inFirstSegment(segments, offset, 4)) { segments[0].putFloat(offset, value); } else { setFloatMultiSegments(segments, offset, value); } }
java
public static void setFloat(MemorySegment[] segments, int offset, float value) { if (inFirstSegment(segments, offset, 4)) { segments[0].putFloat(offset, value); } else { setFloatMultiSegments(segments, offset, value); } }
[ "public", "static", "void", "setFloat", "(", "MemorySegment", "[", "]", "segments", ",", "int", "offset", ",", "float", "value", ")", "{", "if", "(", "inFirstSegment", "(", "segments", ",", "offset", ",", "4", ")", ")", "{", "segments", "[", "0", "]", ".", "putFloat", "(", "offset", ",", "value", ")", ";", "}", "else", "{", "setFloatMultiSegments", "(", "segments", ",", "offset", ",", "value", ")", ";", "}", "}" ]
set float from segments. @param segments target segments. @param offset value offset.
[ "set", "float", "from", "segments", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L878-L884
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java
Hierarchy.findMethod
@Deprecated public static JavaClassAndMethod findMethod(JavaClass[] classList, String methodName, String methodSig) { """ Find a method in given list of classes, searching the classes in order. @param classList list of classes in which to search @param methodName the name of the method @param methodSig the signature of the method @return the JavaClassAndMethod, or null if no such method exists in the class """ return findMethod(classList, methodName, methodSig, ANY_METHOD); }
java
@Deprecated public static JavaClassAndMethod findMethod(JavaClass[] classList, String methodName, String methodSig) { return findMethod(classList, methodName, methodSig, ANY_METHOD); }
[ "@", "Deprecated", "public", "static", "JavaClassAndMethod", "findMethod", "(", "JavaClass", "[", "]", "classList", ",", "String", "methodName", ",", "String", "methodSig", ")", "{", "return", "findMethod", "(", "classList", ",", "methodName", ",", "methodSig", ",", "ANY_METHOD", ")", ";", "}" ]
Find a method in given list of classes, searching the classes in order. @param classList list of classes in which to search @param methodName the name of the method @param methodSig the signature of the method @return the JavaClassAndMethod, or null if no such method exists in the class
[ "Find", "a", "method", "in", "given", "list", "of", "classes", "searching", "the", "classes", "in", "order", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java#L622-L625
youngmonkeys/ezyfox-sfs2x
src/main/java/com/tvd12/ezyfox/sfs2x/command/impl/AddBuddyImpl.java
AddBuddyImpl.checkBuddyManagerIsActive
private void checkBuddyManagerIsActive(BuddyListManager buddyListManager, User sfsOwner) { """ Check whether buddy manager is active @param buddyListManager manager object @param sfsOwner buddy's owner """ if (!buddyListManager.isActive()) { throw new IllegalStateException( String.format("BuddyList operation failure. BuddyListManager is not active. Zone: %s, Sender: %s", new Object[] { sfsOwner.getZone(), sfsOwner })); } }
java
private void checkBuddyManagerIsActive(BuddyListManager buddyListManager, User sfsOwner) { if (!buddyListManager.isActive()) { throw new IllegalStateException( String.format("BuddyList operation failure. BuddyListManager is not active. Zone: %s, Sender: %s", new Object[] { sfsOwner.getZone(), sfsOwner })); } }
[ "private", "void", "checkBuddyManagerIsActive", "(", "BuddyListManager", "buddyListManager", ",", "User", "sfsOwner", ")", "{", "if", "(", "!", "buddyListManager", ".", "isActive", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "String", ".", "format", "(", "\"BuddyList operation failure. BuddyListManager is not active. Zone: %s, Sender: %s\"", ",", "new", "Object", "[", "]", "{", "sfsOwner", ".", "getZone", "(", ")", ",", "sfsOwner", "}", ")", ")", ";", "}", "}" ]
Check whether buddy manager is active @param buddyListManager manager object @param sfsOwner buddy's owner
[ "Check", "whether", "buddy", "manager", "is", "active" ]
train
https://github.com/youngmonkeys/ezyfox-sfs2x/blob/7e004033a3b551c3ae970a0c8f45db7b1ec144de/src/main/java/com/tvd12/ezyfox/sfs2x/command/impl/AddBuddyImpl.java#L174-L179
lightblueseas/swing-components
src/main/java/de/alpharogroup/swing/menu/MenuExtensions.java
MenuExtensions.setAccelerator
public static void setAccelerator(final JMenuItem jmi, final String parsableKeystrokeString) { """ Sets the accelerator for the given menuitem and the given parsable keystroke string. @param jmi The JMenuItem. @param parsableKeystrokeString the parsable keystroke string """ jmi.setAccelerator(KeyStroke.getKeyStroke(parsableKeystrokeString)); }
java
public static void setAccelerator(final JMenuItem jmi, final String parsableKeystrokeString) { jmi.setAccelerator(KeyStroke.getKeyStroke(parsableKeystrokeString)); }
[ "public", "static", "void", "setAccelerator", "(", "final", "JMenuItem", "jmi", ",", "final", "String", "parsableKeystrokeString", ")", "{", "jmi", ".", "setAccelerator", "(", "KeyStroke", ".", "getKeyStroke", "(", "parsableKeystrokeString", ")", ")", ";", "}" ]
Sets the accelerator for the given menuitem and the given parsable keystroke string. @param jmi The JMenuItem. @param parsableKeystrokeString the parsable keystroke string
[ "Sets", "the", "accelerator", "for", "the", "given", "menuitem", "and", "the", "given", "parsable", "keystroke", "string", "." ]
train
https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/menu/MenuExtensions.java#L108-L111
tzaeschke/zoodb
src/org/zoodb/internal/util/FormattedStringBuilder.java
FormattedStringBuilder.fill
public FormattedStringBuilder fill(int newLength, char c) { """ Attempts to append <tt>c</tt> until the current line gets the length <tt> newLength</tt>. If the line is already as long or longer than <tt> newLength</tt>, then nothing is appended. @param newLength Minimal new length of the last line. @param c Character to append. @return The updated instance of FormattedStringBuilder. """ int lineStart = _delegate.lastIndexOf(NL); if (lineStart == -1) { return fillBuffer(newLength, c); } lineStart += NL.length(); return fillBuffer(lineStart + newLength, c); }
java
public FormattedStringBuilder fill(int newLength, char c) { int lineStart = _delegate.lastIndexOf(NL); if (lineStart == -1) { return fillBuffer(newLength, c); } lineStart += NL.length(); return fillBuffer(lineStart + newLength, c); }
[ "public", "FormattedStringBuilder", "fill", "(", "int", "newLength", ",", "char", "c", ")", "{", "int", "lineStart", "=", "_delegate", ".", "lastIndexOf", "(", "NL", ")", ";", "if", "(", "lineStart", "==", "-", "1", ")", "{", "return", "fillBuffer", "(", "newLength", ",", "c", ")", ";", "}", "lineStart", "+=", "NL", ".", "length", "(", ")", ";", "return", "fillBuffer", "(", "lineStart", "+", "newLength", ",", "c", ")", ";", "}" ]
Attempts to append <tt>c</tt> until the current line gets the length <tt> newLength</tt>. If the line is already as long or longer than <tt> newLength</tt>, then nothing is appended. @param newLength Minimal new length of the last line. @param c Character to append. @return The updated instance of FormattedStringBuilder.
[ "Attempts", "to", "append", "<tt", ">", "c<", "/", "tt", ">", "until", "the", "current", "line", "gets", "the", "length", "<tt", ">", "newLength<", "/", "tt", ">", ".", "If", "the", "line", "is", "already", "as", "long", "or", "longer", "than", "<tt", ">", "newLength<", "/", "tt", ">", "then", "nothing", "is", "appended", "." ]
train
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/util/FormattedStringBuilder.java#L191-L198
kiswanij/jk-util
src/main/java/com/jk/util/JKIOUtil.java
JKIOUtil.copResourcesFromJarToDir
public static void copResourcesFromJarToDir(String sourceClassPath, File dest) { """ Cop resources from jar to dir. @param sourceClassPath the source class path @param dest the dest """ try { List<File> resourcesInnPackage = getResourcesInnPackage(sourceClassPath); for (File file : resourcesInnPackage) { JK.printBlock("Copying file: " + file.getName() + " to folder " + dest.getAbsolutePath()); FileUtils.copyFileToDirectory(file, dest); } } catch (IOException e) { JK.throww(e); } }
java
public static void copResourcesFromJarToDir(String sourceClassPath, File dest) { try { List<File> resourcesInnPackage = getResourcesInnPackage(sourceClassPath); for (File file : resourcesInnPackage) { JK.printBlock("Copying file: " + file.getName() + " to folder " + dest.getAbsolutePath()); FileUtils.copyFileToDirectory(file, dest); } } catch (IOException e) { JK.throww(e); } }
[ "public", "static", "void", "copResourcesFromJarToDir", "(", "String", "sourceClassPath", ",", "File", "dest", ")", "{", "try", "{", "List", "<", "File", ">", "resourcesInnPackage", "=", "getResourcesInnPackage", "(", "sourceClassPath", ")", ";", "for", "(", "File", "file", ":", "resourcesInnPackage", ")", "{", "JK", ".", "printBlock", "(", "\"Copying file: \"", "+", "file", ".", "getName", "(", ")", "+", "\" to folder \"", "+", "dest", ".", "getAbsolutePath", "(", ")", ")", ";", "FileUtils", ".", "copyFileToDirectory", "(", "file", ",", "dest", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "JK", ".", "throww", "(", "e", ")", ";", "}", "}" ]
Cop resources from jar to dir. @param sourceClassPath the source class path @param dest the dest
[ "Cop", "resources", "from", "jar", "to", "dir", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKIOUtil.java#L745-L756
igniterealtime/Smack
smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java
Roster.createGroup
public RosterGroup createGroup(String name) { """ Creates a new group. <p> Note: you must add at least one entry to the group for the group to be kept after a logout/login. This is due to the way that XMPP stores group information. </p> @param name the name of the group. @return a new group, or null if the group already exists """ final XMPPConnection connection = connection(); if (groups.containsKey(name)) { return groups.get(name); } RosterGroup group = new RosterGroup(name, connection); groups.put(name, group); return group; }
java
public RosterGroup createGroup(String name) { final XMPPConnection connection = connection(); if (groups.containsKey(name)) { return groups.get(name); } RosterGroup group = new RosterGroup(name, connection); groups.put(name, group); return group; }
[ "public", "RosterGroup", "createGroup", "(", "String", "name", ")", "{", "final", "XMPPConnection", "connection", "=", "connection", "(", ")", ";", "if", "(", "groups", ".", "containsKey", "(", "name", ")", ")", "{", "return", "groups", ".", "get", "(", "name", ")", ";", "}", "RosterGroup", "group", "=", "new", "RosterGroup", "(", "name", ",", "connection", ")", ";", "groups", ".", "put", "(", "name", ",", "group", ")", ";", "return", "group", ";", "}" ]
Creates a new group. <p> Note: you must add at least one entry to the group for the group to be kept after a logout/login. This is due to the way that XMPP stores group information. </p> @param name the name of the group. @return a new group, or null if the group already exists
[ "Creates", "a", "new", "group", ".", "<p", ">", "Note", ":", "you", "must", "add", "at", "least", "one", "entry", "to", "the", "group", "for", "the", "group", "to", "be", "kept", "after", "a", "logout", "/", "login", ".", "This", "is", "due", "to", "the", "way", "that", "XMPP", "stores", "group", "information", ".", "<", "/", "p", ">" ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java#L623-L632
alkacon/opencms-core
src-modules/org/opencms/workplace/commons/CmsPreferences.java
CmsPreferences.buildSelectPublishSiblings
public String buildSelectPublishSiblings(String htmlAttributes) { """ Builds the html for the default publish siblings mode select box.<p> @param htmlAttributes optional html attributes for the &lgt;select&gt; tag @return the html for the default publish siblings mode select box """ List<String> options = new ArrayList<String>(2); options.add(key(Messages.GUI_PREF_PUBLISH_SIBLINGS_0)); options.add(key(Messages.GUI_PREF_PUBLISH_ONLY_SELECTED_0)); List<String> values = new ArrayList<String>(2); values.add(CmsStringUtil.TRUE); values.add(CmsStringUtil.FALSE); int selectedIndex = values.indexOf(getParamTabDiPublishFileMode()); return buildSelect(htmlAttributes, options, values, selectedIndex); }
java
public String buildSelectPublishSiblings(String htmlAttributes) { List<String> options = new ArrayList<String>(2); options.add(key(Messages.GUI_PREF_PUBLISH_SIBLINGS_0)); options.add(key(Messages.GUI_PREF_PUBLISH_ONLY_SELECTED_0)); List<String> values = new ArrayList<String>(2); values.add(CmsStringUtil.TRUE); values.add(CmsStringUtil.FALSE); int selectedIndex = values.indexOf(getParamTabDiPublishFileMode()); return buildSelect(htmlAttributes, options, values, selectedIndex); }
[ "public", "String", "buildSelectPublishSiblings", "(", "String", "htmlAttributes", ")", "{", "List", "<", "String", ">", "options", "=", "new", "ArrayList", "<", "String", ">", "(", "2", ")", ";", "options", ".", "add", "(", "key", "(", "Messages", ".", "GUI_PREF_PUBLISH_SIBLINGS_0", ")", ")", ";", "options", ".", "add", "(", "key", "(", "Messages", ".", "GUI_PREF_PUBLISH_ONLY_SELECTED_0", ")", ")", ";", "List", "<", "String", ">", "values", "=", "new", "ArrayList", "<", "String", ">", "(", "2", ")", ";", "values", ".", "add", "(", "CmsStringUtil", ".", "TRUE", ")", ";", "values", ".", "add", "(", "CmsStringUtil", ".", "FALSE", ")", ";", "int", "selectedIndex", "=", "values", ".", "indexOf", "(", "getParamTabDiPublishFileMode", "(", ")", ")", ";", "return", "buildSelect", "(", "htmlAttributes", ",", "options", ",", "values", ",", "selectedIndex", ")", ";", "}" ]
Builds the html for the default publish siblings mode select box.<p> @param htmlAttributes optional html attributes for the &lgt;select&gt; tag @return the html for the default publish siblings mode select box
[ "Builds", "the", "html", "for", "the", "default", "publish", "siblings", "mode", "select", "box", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsPreferences.java#L810-L820
btrplace/scheduler
api/src/main/java/org/btrplace/model/view/network/Network.java
Network.newSwitch
public Switch newSwitch(int id, int capacity) { """ Create a new switch with a specific identifier and a given maximal capacity @param id the switch identifier @param capacity the switch maximal capacity (put a nul or negative number for non-blocking switch) @return the switch """ Switch s = swBuilder.newSwitch(id, capacity); switches.add(s); return s; }
java
public Switch newSwitch(int id, int capacity) { Switch s = swBuilder.newSwitch(id, capacity); switches.add(s); return s; }
[ "public", "Switch", "newSwitch", "(", "int", "id", ",", "int", "capacity", ")", "{", "Switch", "s", "=", "swBuilder", ".", "newSwitch", "(", "id", ",", "capacity", ")", ";", "switches", ".", "add", "(", "s", ")", ";", "return", "s", ";", "}" ]
Create a new switch with a specific identifier and a given maximal capacity @param id the switch identifier @param capacity the switch maximal capacity (put a nul or negative number for non-blocking switch) @return the switch
[ "Create", "a", "new", "switch", "with", "a", "specific", "identifier", "and", "a", "given", "maximal", "capacity" ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/model/view/network/Network.java#L140-L144
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java
ConditionalFunctions.negInfIf
public static Expression negInfIf(Expression expression1, Expression expression2) { """ Returned expression results in NegInf if expression1 = expression2, otherwise returns expression1. Returns MISSING or NULL if either input is MISSING or NULL. """ return x("NEGINFIF(" + expression1.toString() + ", " + expression2.toString() + ")"); }
java
public static Expression negInfIf(Expression expression1, Expression expression2) { return x("NEGINFIF(" + expression1.toString() + ", " + expression2.toString() + ")"); }
[ "public", "static", "Expression", "negInfIf", "(", "Expression", "expression1", ",", "Expression", "expression2", ")", "{", "return", "x", "(", "\"NEGINFIF(\"", "+", "expression1", ".", "toString", "(", ")", "+", "\", \"", "+", "expression2", ".", "toString", "(", ")", "+", "\")\"", ")", ";", "}" ]
Returned expression results in NegInf if expression1 = expression2, otherwise returns expression1. Returns MISSING or NULL if either input is MISSING or NULL.
[ "Returned", "expression", "results", "in", "NegInf", "if", "expression1", "=", "expression2", "otherwise", "returns", "expression1", ".", "Returns", "MISSING", "or", "NULL", "if", "either", "input", "is", "MISSING", "or", "NULL", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java#L132-L134
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/RouteTablesInner.java
RouteTablesInner.getByResourceGroupAsync
public Observable<RouteTableInner> getByResourceGroupAsync(String resourceGroupName, String routeTableName, String expand) { """ Gets the specified route table. @param resourceGroupName The name of the resource group. @param routeTableName The name of the route table. @param expand Expands referenced resources. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RouteTableInner object """ return getByResourceGroupWithServiceResponseAsync(resourceGroupName, routeTableName, expand).map(new Func1<ServiceResponse<RouteTableInner>, RouteTableInner>() { @Override public RouteTableInner call(ServiceResponse<RouteTableInner> response) { return response.body(); } }); }
java
public Observable<RouteTableInner> getByResourceGroupAsync(String resourceGroupName, String routeTableName, String expand) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, routeTableName, expand).map(new Func1<ServiceResponse<RouteTableInner>, RouteTableInner>() { @Override public RouteTableInner call(ServiceResponse<RouteTableInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RouteTableInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "routeTableName", ",", "String", "expand", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "routeTableName", ",", "expand", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "RouteTableInner", ">", ",", "RouteTableInner", ">", "(", ")", "{", "@", "Override", "public", "RouteTableInner", "call", "(", "ServiceResponse", "<", "RouteTableInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets the specified route table. @param resourceGroupName The name of the resource group. @param routeTableName The name of the route table. @param expand Expands referenced resources. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RouteTableInner object
[ "Gets", "the", "specified", "route", "table", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/RouteTablesInner.java#L383-L390
actorapp/actor-platform
actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java
ImageLoading.loadReuse
public static ReuseResult loadReuse(Uri uri, Context context, Bitmap dest) throws ImageLoadException { """ Loading bitmap with using reuse bitmap with the different size of source image. If it is unable to load with reuse method tries to load without it. Reuse works only for Android 4.4+ @param uri content uri for bitmap @param dest destination bitmap @param context Application Context @return result of loading @throws ImageLoadException if it is unable to load file """ return loadBitmapReuse(new UriSource(uri, context), dest); }
java
public static ReuseResult loadReuse(Uri uri, Context context, Bitmap dest) throws ImageLoadException { return loadBitmapReuse(new UriSource(uri, context), dest); }
[ "public", "static", "ReuseResult", "loadReuse", "(", "Uri", "uri", ",", "Context", "context", ",", "Bitmap", "dest", ")", "throws", "ImageLoadException", "{", "return", "loadBitmapReuse", "(", "new", "UriSource", "(", "uri", ",", "context", ")", ",", "dest", ")", ";", "}" ]
Loading bitmap with using reuse bitmap with the different size of source image. If it is unable to load with reuse method tries to load without it. Reuse works only for Android 4.4+ @param uri content uri for bitmap @param dest destination bitmap @param context Application Context @return result of loading @throws ImageLoadException if it is unable to load file
[ "Loading", "bitmap", "with", "using", "reuse", "bitmap", "with", "the", "different", "size", "of", "source", "image", ".", "If", "it", "is", "unable", "to", "load", "with", "reuse", "method", "tries", "to", "load", "without", "it", ".", "Reuse", "works", "only", "for", "Android", "4", ".", "4", "+" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java#L231-L233
likethecolor/Alchemy-API
src/main/java/com/likethecolor/alchemy/api/parser/json/ConceptParser.java
ConceptParser.isValidConcept
private boolean isValidConcept(final String concept, final Double score) { """ Return true if at least one of the values is not null/empty. @param concept the sentiment concept @param score the sentiment score @return true if at least one of the values is not null/empty """ return !StringUtils.isBlank(concept) || score != null; }
java
private boolean isValidConcept(final String concept, final Double score) { return !StringUtils.isBlank(concept) || score != null; }
[ "private", "boolean", "isValidConcept", "(", "final", "String", "concept", ",", "final", "Double", "score", ")", "{", "return", "!", "StringUtils", ".", "isBlank", "(", "concept", ")", "||", "score", "!=", "null", ";", "}" ]
Return true if at least one of the values is not null/empty. @param concept the sentiment concept @param score the sentiment score @return true if at least one of the values is not null/empty
[ "Return", "true", "if", "at", "least", "one", "of", "the", "values", "is", "not", "null", "/", "empty", "." ]
train
https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/parser/json/ConceptParser.java#L96-L99
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-job/src/main/java/org/xwiki/job/internal/DefaultJobProgressStep.java
DefaultJobProgressStep.addLevel
public DefaultJobProgressStep addLevel(int steps, Object newLevelSource, boolean levelStep) { """ Add children to the step and return the first one. @param steps the number of step @param newLevelSource who asked to create this new level @param levelStep the new level can contains only one step @return the new step """ assertModifiable(); this.maximumChildren = steps; this.levelSource = newLevelSource; if (steps > 0) { this.childSize = 1.0D / steps; } if (this.maximumChildren > 0) { this.children = new ArrayList<>(this.maximumChildren); } else { this.children = new ArrayList<>(); } this.levelStep = levelStep; // Create a virtual child return new DefaultJobProgressStep(null, newLevelSource, this); }
java
public DefaultJobProgressStep addLevel(int steps, Object newLevelSource, boolean levelStep) { assertModifiable(); this.maximumChildren = steps; this.levelSource = newLevelSource; if (steps > 0) { this.childSize = 1.0D / steps; } if (this.maximumChildren > 0) { this.children = new ArrayList<>(this.maximumChildren); } else { this.children = new ArrayList<>(); } this.levelStep = levelStep; // Create a virtual child return new DefaultJobProgressStep(null, newLevelSource, this); }
[ "public", "DefaultJobProgressStep", "addLevel", "(", "int", "steps", ",", "Object", "newLevelSource", ",", "boolean", "levelStep", ")", "{", "assertModifiable", "(", ")", ";", "this", ".", "maximumChildren", "=", "steps", ";", "this", ".", "levelSource", "=", "newLevelSource", ";", "if", "(", "steps", ">", "0", ")", "{", "this", ".", "childSize", "=", "1.0D", "/", "steps", ";", "}", "if", "(", "this", ".", "maximumChildren", ">", "0", ")", "{", "this", ".", "children", "=", "new", "ArrayList", "<>", "(", "this", ".", "maximumChildren", ")", ";", "}", "else", "{", "this", ".", "children", "=", "new", "ArrayList", "<>", "(", ")", ";", "}", "this", ".", "levelStep", "=", "levelStep", ";", "// Create a virtual child", "return", "new", "DefaultJobProgressStep", "(", "null", ",", "newLevelSource", ",", "this", ")", ";", "}" ]
Add children to the step and return the first one. @param steps the number of step @param newLevelSource who asked to create this new level @param levelStep the new level can contains only one step @return the new step
[ "Add", "children", "to", "the", "step", "and", "return", "the", "first", "one", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-job/src/main/java/org/xwiki/job/internal/DefaultJobProgressStep.java#L183-L204
cycorp/api-suite
core-api/src/main/java/com/cyc/session/exception/SessionCommunicationException.java
SessionCommunicationException.fromThrowable
public static SessionCommunicationException fromThrowable(String message, Throwable cause) { """ Converts a Throwable to a SessionCommunicationException with the specified detail message. If the Throwable is a SessionCommunicationException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new SessionCommunicationException with the detail message. @param cause the Throwable to convert @param message the specified detail message @return a SessionCommunicationException """ return (cause instanceof SessionCommunicationException && Objects.equals(message, cause.getMessage())) ? (SessionCommunicationException) cause : new SessionCommunicationException(message, cause); }
java
public static SessionCommunicationException fromThrowable(String message, Throwable cause) { return (cause instanceof SessionCommunicationException && Objects.equals(message, cause.getMessage())) ? (SessionCommunicationException) cause : new SessionCommunicationException(message, cause); }
[ "public", "static", "SessionCommunicationException", "fromThrowable", "(", "String", "message", ",", "Throwable", "cause", ")", "{", "return", "(", "cause", "instanceof", "SessionCommunicationException", "&&", "Objects", ".", "equals", "(", "message", ",", "cause", ".", "getMessage", "(", ")", ")", ")", "?", "(", "SessionCommunicationException", ")", "cause", ":", "new", "SessionCommunicationException", "(", "message", ",", "cause", ")", ";", "}" ]
Converts a Throwable to a SessionCommunicationException with the specified detail message. If the Throwable is a SessionCommunicationException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new SessionCommunicationException with the detail message. @param cause the Throwable to convert @param message the specified detail message @return a SessionCommunicationException
[ "Converts", "a", "Throwable", "to", "a", "SessionCommunicationException", "with", "the", "specified", "detail", "message", ".", "If", "the", "Throwable", "is", "a", "SessionCommunicationException", "and", "if", "the", "Throwable", "s", "message", "is", "identical", "to", "the", "one", "supplied", "the", "Throwable", "will", "be", "passed", "through", "unmodified", ";", "otherwise", "it", "will", "be", "wrapped", "in", "a", "new", "SessionCommunicationException", "with", "the", "detail", "message", "." ]
train
https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionCommunicationException.java#L62-L66
james-hu/jabb-core
src/main/java/net/sf/jabb/util/db/ConnectionUtility.java
ConnectionUtility.createDataSource
public static DataSource createDataSource(String source, String type, String config) { """ Create a data source @param source name of the data source, can be anything @param type type of the data source @param config configurations, normally path to configuration files @return the newly created data source """ DataSourceProvider dsp = dataSourceProviders.get(type); if (dsp == null){ log.error("Unknown data source type for '" + source + "': " + type); return null; } DataSource ds = null; ds = dsp.createDataSource(source, config); if (ds != null){ log.info("Data source created for: " + source); }else{ log.error("Creation of data source failed for: " + source); } return ds; }
java
public static DataSource createDataSource(String source, String type, String config){ DataSourceProvider dsp = dataSourceProviders.get(type); if (dsp == null){ log.error("Unknown data source type for '" + source + "': " + type); return null; } DataSource ds = null; ds = dsp.createDataSource(source, config); if (ds != null){ log.info("Data source created for: " + source); }else{ log.error("Creation of data source failed for: " + source); } return ds; }
[ "public", "static", "DataSource", "createDataSource", "(", "String", "source", ",", "String", "type", ",", "String", "config", ")", "{", "DataSourceProvider", "dsp", "=", "dataSourceProviders", ".", "get", "(", "type", ")", ";", "if", "(", "dsp", "==", "null", ")", "{", "log", ".", "error", "(", "\"Unknown data source type for '\"", "+", "source", "+", "\"': \"", "+", "type", ")", ";", "return", "null", ";", "}", "DataSource", "ds", "=", "null", ";", "ds", "=", "dsp", ".", "createDataSource", "(", "source", ",", "config", ")", ";", "if", "(", "ds", "!=", "null", ")", "{", "log", ".", "info", "(", "\"Data source created for: \"", "+", "source", ")", ";", "}", "else", "{", "log", ".", "error", "(", "\"Creation of data source failed for: \"", "+", "source", ")", ";", "}", "return", "ds", ";", "}" ]
Create a data source @param source name of the data source, can be anything @param type type of the data source @param config configurations, normally path to configuration files @return the newly created data source
[ "Create", "a", "data", "source" ]
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/db/ConnectionUtility.java#L178-L194
google/closure-compiler
src/com/google/javascript/jscomp/FunctionToBlockMutator.java
FunctionToBlockMutator.createAssignStatementNode
private static Node createAssignStatementNode(String name, Node expression) { """ Create a valid statement Node containing an assignment to name of the given expression. """ // Create 'name = result-expression;' statement. // EXPR (ASSIGN (NAME, EXPRESSION)) Node nameNode = IR.name(name); Node assign = IR.assign(nameNode, expression); return NodeUtil.newExpr(assign); }
java
private static Node createAssignStatementNode(String name, Node expression) { // Create 'name = result-expression;' statement. // EXPR (ASSIGN (NAME, EXPRESSION)) Node nameNode = IR.name(name); Node assign = IR.assign(nameNode, expression); return NodeUtil.newExpr(assign); }
[ "private", "static", "Node", "createAssignStatementNode", "(", "String", "name", ",", "Node", "expression", ")", "{", "// Create 'name = result-expression;' statement.", "// EXPR (ASSIGN (NAME, EXPRESSION))", "Node", "nameNode", "=", "IR", ".", "name", "(", "name", ")", ";", "Node", "assign", "=", "IR", ".", "assign", "(", "nameNode", ",", "expression", ")", ";", "return", "NodeUtil", ".", "newExpr", "(", "assign", ")", ";", "}" ]
Create a valid statement Node containing an assignment to name of the given expression.
[ "Create", "a", "valid", "statement", "Node", "containing", "an", "assignment", "to", "name", "of", "the", "given", "expression", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/FunctionToBlockMutator.java#L496-L502
skuzzle/semantic-version
src/main/java/de/skuzzle/semantic/Version.java
Version.compareWithBuildMetaData
public static int compareWithBuildMetaData(Version v1, Version v2) { """ Compares two Versions with additionally considering the build meta data field if all other parts are equal. Note: This is <em>not</em> part of the semantic version specification. <p> Comparison of the build meta data parts happens exactly as for pre release identifiers. Considering of build meta data first kicks in if both versions are equal when using their natural order. <p> This method fulfills the general contract for Java's {@link Comparator Comparators} and {@link Comparable Comparables}. @param v1 The first version for comparison. @param v2 The second version for comparison. @return A value below 0 iff {@code v1 &lt; v2}, a value above 0 iff {@code v1 &gt; v2</tt> and 0 iff <tt>v1 = v2}. @throws NullPointerException If either parameter is null. @since 0.3.0 """ // throw NPE to comply with Comparable specification if (v1 == null) { throw new NullPointerException("v1 is null"); } else if (v2 == null) { throw new NullPointerException("v2 is null"); } return compare(v1, v2, true); }
java
public static int compareWithBuildMetaData(Version v1, Version v2) { // throw NPE to comply with Comparable specification if (v1 == null) { throw new NullPointerException("v1 is null"); } else if (v2 == null) { throw new NullPointerException("v2 is null"); } return compare(v1, v2, true); }
[ "public", "static", "int", "compareWithBuildMetaData", "(", "Version", "v1", ",", "Version", "v2", ")", "{", "// throw NPE to comply with Comparable specification", "if", "(", "v1", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"v1 is null\"", ")", ";", "}", "else", "if", "(", "v2", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"v2 is null\"", ")", ";", "}", "return", "compare", "(", "v1", ",", "v2", ",", "true", ")", ";", "}" ]
Compares two Versions with additionally considering the build meta data field if all other parts are equal. Note: This is <em>not</em> part of the semantic version specification. <p> Comparison of the build meta data parts happens exactly as for pre release identifiers. Considering of build meta data first kicks in if both versions are equal when using their natural order. <p> This method fulfills the general contract for Java's {@link Comparator Comparators} and {@link Comparable Comparables}. @param v1 The first version for comparison. @param v2 The second version for comparison. @return A value below 0 iff {@code v1 &lt; v2}, a value above 0 iff {@code v1 &gt; v2</tt> and 0 iff <tt>v1 = v2}. @throws NullPointerException If either parameter is null. @since 0.3.0
[ "Compares", "two", "Versions", "with", "additionally", "considering", "the", "build", "meta", "data", "field", "if", "all", "other", "parts", "are", "equal", ".", "Note", ":", "This", "is", "<em", ">", "not<", "/", "em", ">", "part", "of", "the", "semantic", "version", "specification", "." ]
train
https://github.com/skuzzle/semantic-version/blob/2ddb66fb80244cd7f67c77ed5f8072d1132ad933/src/main/java/de/skuzzle/semantic/Version.java#L1144-L1152
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/swift/IBANCountryData.java
IBANCountryData.createFromString
@Nonnull public static IBANCountryData createFromString (@Nonnull @Nonempty final String sCountryCode, @Nonnegative final int nExpectedLength, @Nullable final String sLayout, @Nullable final String sFixedCheckDigits, @Nullable final LocalDate aValidFrom, @Nullable final LocalDate aValidTo, @Nonnull final String sDesc) { """ This method is used to create an instance of this class from a string representation. @param sCountryCode Country code to use. Neither <code>null</code> nor empty. @param nExpectedLength The expected length having only validation purpose. @param sLayout <code>null</code> or the layout descriptor @param sFixedCheckDigits <code>null</code> or fixed check digits (of length 2) @param aValidFrom Validity start date. May be <code>null</code>. @param aValidTo Validity end date. May be <code>null</code>. @param sDesc The string description of this country data. May not be <code>null</code>. @return The parsed county data. """ ValueEnforcer.notEmpty (sDesc, "Desc"); if (sDesc.length () < 4) throw new IllegalArgumentException ("Cannot converted passed string because it is too short!"); final ICommonsList <IBANElement> aList = _parseElements (sDesc); final Pattern aPattern = _parseLayout (sCountryCode, nExpectedLength, sFixedCheckDigits, sLayout); // And we're done try { return new IBANCountryData (nExpectedLength, aPattern, sFixedCheckDigits, aValidFrom, aValidTo, aList); } catch (final IllegalArgumentException ex) { throw new IllegalArgumentException ("Failed to parse '" + sDesc + "': " + ex.getMessage ()); } }
java
@Nonnull public static IBANCountryData createFromString (@Nonnull @Nonempty final String sCountryCode, @Nonnegative final int nExpectedLength, @Nullable final String sLayout, @Nullable final String sFixedCheckDigits, @Nullable final LocalDate aValidFrom, @Nullable final LocalDate aValidTo, @Nonnull final String sDesc) { ValueEnforcer.notEmpty (sDesc, "Desc"); if (sDesc.length () < 4) throw new IllegalArgumentException ("Cannot converted passed string because it is too short!"); final ICommonsList <IBANElement> aList = _parseElements (sDesc); final Pattern aPattern = _parseLayout (sCountryCode, nExpectedLength, sFixedCheckDigits, sLayout); // And we're done try { return new IBANCountryData (nExpectedLength, aPattern, sFixedCheckDigits, aValidFrom, aValidTo, aList); } catch (final IllegalArgumentException ex) { throw new IllegalArgumentException ("Failed to parse '" + sDesc + "': " + ex.getMessage ()); } }
[ "@", "Nonnull", "public", "static", "IBANCountryData", "createFromString", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sCountryCode", ",", "@", "Nonnegative", "final", "int", "nExpectedLength", ",", "@", "Nullable", "final", "String", "sLayout", ",", "@", "Nullable", "final", "String", "sFixedCheckDigits", ",", "@", "Nullable", "final", "LocalDate", "aValidFrom", ",", "@", "Nullable", "final", "LocalDate", "aValidTo", ",", "@", "Nonnull", "final", "String", "sDesc", ")", "{", "ValueEnforcer", ".", "notEmpty", "(", "sDesc", ",", "\"Desc\"", ")", ";", "if", "(", "sDesc", ".", "length", "(", ")", "<", "4", ")", "throw", "new", "IllegalArgumentException", "(", "\"Cannot converted passed string because it is too short!\"", ")", ";", "final", "ICommonsList", "<", "IBANElement", ">", "aList", "=", "_parseElements", "(", "sDesc", ")", ";", "final", "Pattern", "aPattern", "=", "_parseLayout", "(", "sCountryCode", ",", "nExpectedLength", ",", "sFixedCheckDigits", ",", "sLayout", ")", ";", "// And we're done", "try", "{", "return", "new", "IBANCountryData", "(", "nExpectedLength", ",", "aPattern", ",", "sFixedCheckDigits", ",", "aValidFrom", ",", "aValidTo", ",", "aList", ")", ";", "}", "catch", "(", "final", "IllegalArgumentException", "ex", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Failed to parse '\"", "+", "sDesc", "+", "\"': \"", "+", "ex", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
This method is used to create an instance of this class from a string representation. @param sCountryCode Country code to use. Neither <code>null</code> nor empty. @param nExpectedLength The expected length having only validation purpose. @param sLayout <code>null</code> or the layout descriptor @param sFixedCheckDigits <code>null</code> or fixed check digits (of length 2) @param aValidFrom Validity start date. May be <code>null</code>. @param aValidTo Validity end date. May be <code>null</code>. @param sDesc The string description of this country data. May not be <code>null</code>. @return The parsed county data.
[ "This", "method", "is", "used", "to", "create", "an", "instance", "of", "this", "class", "from", "a", "string", "representation", "." ]
train
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/swift/IBANCountryData.java#L319-L345
paypal/SeLion
dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/XmlDataProviderImpl.java
XmlDataProviderImpl.loadDataFromXml
private List<?> loadDataFromXml(String xml, Class<?> cls) { """ Generates a list of the declared type after parsing the XML data string. @param xml String containing the XML data. @param cls The declared type modeled by the XML content. @return A {@link List} of object of declared type {@link XmlFileSystemResource#getCls()}. """ logger.entering(new Object[] { xml, cls }); Preconditions.checkArgument(cls != null, "Please provide a valid type."); List<?> returned; try { JAXBContext context = JAXBContext.newInstance(Wrapper.class, cls); Unmarshaller unmarshaller = context.createUnmarshaller(); StringReader xmlStringReader = new StringReader(xml); StreamSource streamSource = new StreamSource(xmlStringReader); Wrapper<?> wrapper = unmarshaller.unmarshal(streamSource, Wrapper.class).getValue(); returned = wrapper.getList(); } catch (JAXBException excp) { logger.exiting(excp.getMessage()); throw new DataProviderException("Error unmarshalling XML string.", excp); } logger.exiting(returned); return returned; }
java
private List<?> loadDataFromXml(String xml, Class<?> cls) { logger.entering(new Object[] { xml, cls }); Preconditions.checkArgument(cls != null, "Please provide a valid type."); List<?> returned; try { JAXBContext context = JAXBContext.newInstance(Wrapper.class, cls); Unmarshaller unmarshaller = context.createUnmarshaller(); StringReader xmlStringReader = new StringReader(xml); StreamSource streamSource = new StreamSource(xmlStringReader); Wrapper<?> wrapper = unmarshaller.unmarshal(streamSource, Wrapper.class).getValue(); returned = wrapper.getList(); } catch (JAXBException excp) { logger.exiting(excp.getMessage()); throw new DataProviderException("Error unmarshalling XML string.", excp); } logger.exiting(returned); return returned; }
[ "private", "List", "<", "?", ">", "loadDataFromXml", "(", "String", "xml", ",", "Class", "<", "?", ">", "cls", ")", "{", "logger", ".", "entering", "(", "new", "Object", "[", "]", "{", "xml", ",", "cls", "}", ")", ";", "Preconditions", ".", "checkArgument", "(", "cls", "!=", "null", ",", "\"Please provide a valid type.\"", ")", ";", "List", "<", "?", ">", "returned", ";", "try", "{", "JAXBContext", "context", "=", "JAXBContext", ".", "newInstance", "(", "Wrapper", ".", "class", ",", "cls", ")", ";", "Unmarshaller", "unmarshaller", "=", "context", ".", "createUnmarshaller", "(", ")", ";", "StringReader", "xmlStringReader", "=", "new", "StringReader", "(", "xml", ")", ";", "StreamSource", "streamSource", "=", "new", "StreamSource", "(", "xmlStringReader", ")", ";", "Wrapper", "<", "?", ">", "wrapper", "=", "unmarshaller", ".", "unmarshal", "(", "streamSource", ",", "Wrapper", ".", "class", ")", ".", "getValue", "(", ")", ";", "returned", "=", "wrapper", ".", "getList", "(", ")", ";", "}", "catch", "(", "JAXBException", "excp", ")", "{", "logger", ".", "exiting", "(", "excp", ".", "getMessage", "(", ")", ")", ";", "throw", "new", "DataProviderException", "(", "\"Error unmarshalling XML string.\"", ",", "excp", ")", ";", "}", "logger", ".", "exiting", "(", "returned", ")", ";", "return", "returned", ";", "}" ]
Generates a list of the declared type after parsing the XML data string. @param xml String containing the XML data. @param cls The declared type modeled by the XML content. @return A {@link List} of object of declared type {@link XmlFileSystemResource#getCls()}.
[ "Generates", "a", "list", "of", "the", "declared", "type", "after", "parsing", "the", "XML", "data", "string", "." ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/XmlDataProviderImpl.java#L372-L391
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java
Util.generateSubclassPattern
public static String generateSubclassPattern(URI origin, URI destination) { """ Generate a pattern for checking if destination is a subclass of origin @param origin @param destination @return """ return new StringBuilder() .append(sparqlWrapUri(destination)).append(" ") .append(sparqlWrapUri(RDFS.subClassOf.getURI())).append("+ ") .append(sparqlWrapUri(origin)).append(" .") .toString(); }
java
public static String generateSubclassPattern(URI origin, URI destination) { return new StringBuilder() .append(sparqlWrapUri(destination)).append(" ") .append(sparqlWrapUri(RDFS.subClassOf.getURI())).append("+ ") .append(sparqlWrapUri(origin)).append(" .") .toString(); }
[ "public", "static", "String", "generateSubclassPattern", "(", "URI", "origin", ",", "URI", "destination", ")", "{", "return", "new", "StringBuilder", "(", ")", ".", "append", "(", "sparqlWrapUri", "(", "destination", ")", ")", ".", "append", "(", "\" \"", ")", ".", "append", "(", "sparqlWrapUri", "(", "RDFS", ".", "subClassOf", ".", "getURI", "(", ")", ")", ")", ".", "append", "(", "\"+ \"", ")", ".", "append", "(", "sparqlWrapUri", "(", "origin", ")", ")", ".", "append", "(", "\" .\"", ")", ".", "toString", "(", ")", ";", "}" ]
Generate a pattern for checking if destination is a subclass of origin @param origin @param destination @return
[ "Generate", "a", "pattern", "for", "checking", "if", "destination", "is", "a", "subclass", "of", "origin" ]
train
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L233-L239
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java
WatchMonitor.create
public static WatchMonitor create(Path path, int maxDepth, WatchEvent.Kind<?>... events) { """ 创建并初始化监听 @param path 路径 @param events 监听事件列表 @param maxDepth 当监听目录时,监听目录的最大深度,当设置值为1(或小于1)时,表示不递归监听子目录 @return 监听对象 """ return new WatchMonitor(path, maxDepth, events); }
java
public static WatchMonitor create(Path path, int maxDepth, WatchEvent.Kind<?>... events){ return new WatchMonitor(path, maxDepth, events); }
[ "public", "static", "WatchMonitor", "create", "(", "Path", "path", ",", "int", "maxDepth", ",", "WatchEvent", ".", "Kind", "<", "?", ">", "...", "events", ")", "{", "return", "new", "WatchMonitor", "(", "path", ",", "maxDepth", ",", "events", ")", ";", "}" ]
创建并初始化监听 @param path 路径 @param events 监听事件列表 @param maxDepth 当监听目录时,监听目录的最大深度,当设置值为1(或小于1)时,表示不递归监听子目录 @return 监听对象
[ "创建并初始化监听" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java#L183-L185
alkacon/opencms-core
src-modules/org/opencms/workplace/commons/CmsPropertyCustom.java
CmsPropertyCustom.dialogButtonsOkCancelAdvanced
@Override public String dialogButtonsOkCancelAdvanced( String okAttributes, String cancelAttributes, String advancedAttributes) { """ Builds a button row with an "ok", a "cancel" and an "advanced" button.<p> @param okAttributes additional attributes for the "ok" button @param cancelAttributes additional attributes for the "cancel" button @param advancedAttributes additional attributes for the "advanced" button @return the button row """ if (isEditable()) { int okButton = BUTTON_OK; if ((getParamDialogmode() != null) && getParamDialogmode().startsWith(MODE_WIZARD)) { // in wizard mode, display finish button instead of ok button okButton = BUTTON_FINISH; } // hide "advanced" button if (isHideButtonAdvanced()) { return dialogButtons( new int[] {okButton, BUTTON_CANCEL}, new String[] {okAttributes, cancelAttributes}); } // show "advanced" button return dialogButtons( new int[] {okButton, BUTTON_CANCEL, BUTTON_ADVANCED}, new String[] {okAttributes, cancelAttributes, advancedAttributes}); } else { // hide "advanced" button if (isHideButtonAdvanced()) { return dialogButtons(new int[] {BUTTON_CLOSE}, new String[] {cancelAttributes}); } // show "advanced" button return dialogButtons( new int[] {BUTTON_CLOSE, BUTTON_ADVANCED}, new String[] {cancelAttributes, advancedAttributes}); } }
java
@Override public String dialogButtonsOkCancelAdvanced( String okAttributes, String cancelAttributes, String advancedAttributes) { if (isEditable()) { int okButton = BUTTON_OK; if ((getParamDialogmode() != null) && getParamDialogmode().startsWith(MODE_WIZARD)) { // in wizard mode, display finish button instead of ok button okButton = BUTTON_FINISH; } // hide "advanced" button if (isHideButtonAdvanced()) { return dialogButtons( new int[] {okButton, BUTTON_CANCEL}, new String[] {okAttributes, cancelAttributes}); } // show "advanced" button return dialogButtons( new int[] {okButton, BUTTON_CANCEL, BUTTON_ADVANCED}, new String[] {okAttributes, cancelAttributes, advancedAttributes}); } else { // hide "advanced" button if (isHideButtonAdvanced()) { return dialogButtons(new int[] {BUTTON_CLOSE}, new String[] {cancelAttributes}); } // show "advanced" button return dialogButtons( new int[] {BUTTON_CLOSE, BUTTON_ADVANCED}, new String[] {cancelAttributes, advancedAttributes}); } }
[ "@", "Override", "public", "String", "dialogButtonsOkCancelAdvanced", "(", "String", "okAttributes", ",", "String", "cancelAttributes", ",", "String", "advancedAttributes", ")", "{", "if", "(", "isEditable", "(", ")", ")", "{", "int", "okButton", "=", "BUTTON_OK", ";", "if", "(", "(", "getParamDialogmode", "(", ")", "!=", "null", ")", "&&", "getParamDialogmode", "(", ")", ".", "startsWith", "(", "MODE_WIZARD", ")", ")", "{", "// in wizard mode, display finish button instead of ok button", "okButton", "=", "BUTTON_FINISH", ";", "}", "// hide \"advanced\" button", "if", "(", "isHideButtonAdvanced", "(", ")", ")", "{", "return", "dialogButtons", "(", "new", "int", "[", "]", "{", "okButton", ",", "BUTTON_CANCEL", "}", ",", "new", "String", "[", "]", "{", "okAttributes", ",", "cancelAttributes", "}", ")", ";", "}", "// show \"advanced\" button", "return", "dialogButtons", "(", "new", "int", "[", "]", "{", "okButton", ",", "BUTTON_CANCEL", ",", "BUTTON_ADVANCED", "}", ",", "new", "String", "[", "]", "{", "okAttributes", ",", "cancelAttributes", ",", "advancedAttributes", "}", ")", ";", "}", "else", "{", "// hide \"advanced\" button", "if", "(", "isHideButtonAdvanced", "(", ")", ")", "{", "return", "dialogButtons", "(", "new", "int", "[", "]", "{", "BUTTON_CLOSE", "}", ",", "new", "String", "[", "]", "{", "cancelAttributes", "}", ")", ";", "}", "// show \"advanced\" button", "return", "dialogButtons", "(", "new", "int", "[", "]", "{", "BUTTON_CLOSE", ",", "BUTTON_ADVANCED", "}", ",", "new", "String", "[", "]", "{", "cancelAttributes", ",", "advancedAttributes", "}", ")", ";", "}", "}" ]
Builds a button row with an "ok", a "cancel" and an "advanced" button.<p> @param okAttributes additional attributes for the "ok" button @param cancelAttributes additional attributes for the "cancel" button @param advancedAttributes additional attributes for the "advanced" button @return the button row
[ "Builds", "a", "button", "row", "with", "an", "ok", "a", "cancel", "and", "an", "advanced", "button", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsPropertyCustom.java#L233-L265
pushbit/sprockets
src/main/java/net/sf/sprockets/sql/SQLite.java
SQLite.groupConcat
public static String groupConcat(String column, String separator) { """ Get an {@link #aliased(String) aliased} group_concat(column) with the separator. @since 2.4.0 """ return groupConcat(column, separator, aliased(column)); }
java
public static String groupConcat(String column, String separator) { return groupConcat(column, separator, aliased(column)); }
[ "public", "static", "String", "groupConcat", "(", "String", "column", ",", "String", "separator", ")", "{", "return", "groupConcat", "(", "column", ",", "separator", ",", "aliased", "(", "column", ")", ")", ";", "}" ]
Get an {@link #aliased(String) aliased} group_concat(column) with the separator. @since 2.4.0
[ "Get", "an", "{", "@link", "#aliased", "(", "String", ")", "aliased", "}", "group_concat", "(", "column", ")", "with", "the", "separator", "." ]
train
https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/sql/SQLite.java#L212-L214
vekexasia/android-edittext-validator
library/src/com/andreabaccega/widget/FormAutoCompleteTextView.java
FormAutoCompleteTextView.setError
@Override public void setError(CharSequence error, Drawable icon) { """ Resolve an issue where the error icon is hidden under some cases in JB due to a bug http://code.google.com/p/android/issues/detail?id=40417 """ super.setError(error, icon); lastErrorIcon = icon; // if the error is not null, and we are in JB, force // the error to show if (error != null /* !isFocused() && */) { showErrorIconHax(icon); } }
java
@Override public void setError(CharSequence error, Drawable icon) { super.setError(error, icon); lastErrorIcon = icon; // if the error is not null, and we are in JB, force // the error to show if (error != null /* !isFocused() && */) { showErrorIconHax(icon); } }
[ "@", "Override", "public", "void", "setError", "(", "CharSequence", "error", ",", "Drawable", "icon", ")", "{", "super", ".", "setError", "(", "error", ",", "icon", ")", ";", "lastErrorIcon", "=", "icon", ";", "// if the error is not null, and we are in JB, force", "// the error to show", "if", "(", "error", "!=", "null", "/* !isFocused() && */", ")", "{", "showErrorIconHax", "(", "icon", ")", ";", "}", "}" ]
Resolve an issue where the error icon is hidden under some cases in JB due to a bug http://code.google.com/p/android/issues/detail?id=40417
[ "Resolve", "an", "issue", "where", "the", "error", "icon", "is", "hidden", "under", "some", "cases", "in", "JB", "due", "to", "a", "bug", "http", ":", "//", "code", ".", "google", ".", "com", "/", "p", "/", "android", "/", "issues", "/", "detail?id", "=", "40417" ]
train
https://github.com/vekexasia/android-edittext-validator/blob/4a100e3d708b232133f4dd8ceb37ad7447fc7a1b/library/src/com/andreabaccega/widget/FormAutoCompleteTextView.java#L92-L102
cdk/cdk
app/depict/src/main/java/org/openscience/cdk/depict/DepictionGenerator.java
DepictionGenerator.withAtomValues
public DepictionGenerator withAtomValues() { """ Display atom values on the molecule or reaction. The values need to be assigned by <pre>{@code atom.setProperty(CDKConstants.COMMENT, myValueToBeDisplayedNextToAtom); }</pre> Note: A depiction can not have both atom numbers and atom maps visible (but this can be achieved by manually setting the annotation). @return new generator for method chaining @see #withAtomMapNumbers() @see StandardGenerator#ANNOTATION_LABEL """ if (annotateAtomNum || annotateAtomMap) throw new IllegalArgumentException("Can not annotated atom values, atom numbers or maps are already annotated"); DepictionGenerator copy = new DepictionGenerator(this); copy.annotateAtomVal = true; return copy; }
java
public DepictionGenerator withAtomValues() { if (annotateAtomNum || annotateAtomMap) throw new IllegalArgumentException("Can not annotated atom values, atom numbers or maps are already annotated"); DepictionGenerator copy = new DepictionGenerator(this); copy.annotateAtomVal = true; return copy; }
[ "public", "DepictionGenerator", "withAtomValues", "(", ")", "{", "if", "(", "annotateAtomNum", "||", "annotateAtomMap", ")", "throw", "new", "IllegalArgumentException", "(", "\"Can not annotated atom values, atom numbers or maps are already annotated\"", ")", ";", "DepictionGenerator", "copy", "=", "new", "DepictionGenerator", "(", "this", ")", ";", "copy", ".", "annotateAtomVal", "=", "true", ";", "return", "copy", ";", "}" ]
Display atom values on the molecule or reaction. The values need to be assigned by <pre>{@code atom.setProperty(CDKConstants.COMMENT, myValueToBeDisplayedNextToAtom); }</pre> Note: A depiction can not have both atom numbers and atom maps visible (but this can be achieved by manually setting the annotation). @return new generator for method chaining @see #withAtomMapNumbers() @see StandardGenerator#ANNOTATION_LABEL
[ "Display", "atom", "values", "on", "the", "molecule", "or", "reaction", ".", "The", "values", "need", "to", "be", "assigned", "by" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/app/depict/src/main/java/org/openscience/cdk/depict/DepictionGenerator.java#L793-L799
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/IdentityHashMap.java
IdentityHashMap.putForCreate
private void putForCreate(K key, V value) throws java.io.StreamCorruptedException { """ The put method for readObject. It does not resize the table, update modCount, etc. """ Object k = maskNull(key); Object[] tab = table; int len = tab.length; int i = hash(k, len); Object item; while ( (item = tab[i]) != null) { if (item == k) throw new java.io.StreamCorruptedException(); i = nextKeyIndex(i, len); } tab[i] = k; tab[i + 1] = value; }
java
private void putForCreate(K key, V value) throws java.io.StreamCorruptedException { Object k = maskNull(key); Object[] tab = table; int len = tab.length; int i = hash(k, len); Object item; while ( (item = tab[i]) != null) { if (item == k) throw new java.io.StreamCorruptedException(); i = nextKeyIndex(i, len); } tab[i] = k; tab[i + 1] = value; }
[ "private", "void", "putForCreate", "(", "K", "key", ",", "V", "value", ")", "throws", "java", ".", "io", ".", "StreamCorruptedException", "{", "Object", "k", "=", "maskNull", "(", "key", ")", ";", "Object", "[", "]", "tab", "=", "table", ";", "int", "len", "=", "tab", ".", "length", ";", "int", "i", "=", "hash", "(", "k", ",", "len", ")", ";", "Object", "item", ";", "while", "(", "(", "item", "=", "tab", "[", "i", "]", ")", "!=", "null", ")", "{", "if", "(", "item", "==", "k", ")", "throw", "new", "java", ".", "io", ".", "StreamCorruptedException", "(", ")", ";", "i", "=", "nextKeyIndex", "(", "i", ",", "len", ")", ";", "}", "tab", "[", "i", "]", "=", "k", ";", "tab", "[", "i", "+", "1", "]", "=", "value", ";", "}" ]
The put method for readObject. It does not resize the table, update modCount, etc.
[ "The", "put", "method", "for", "readObject", ".", "It", "does", "not", "resize", "the", "table", "update", "modCount", "etc", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/IdentityHashMap.java#L1342-L1358
graphql-java/graphql-java
src/main/java/graphql/execution/ExecutionStrategy.java
ExecutionStrategy.fetchField
protected CompletableFuture<FetchedValue> fetchField(ExecutionContext executionContext, ExecutionStrategyParameters parameters) { """ Called to fetch a value for a field from the {@link DataFetcher} associated with the field {@link GraphQLFieldDefinition}. <p> Graphql fragments mean that for any give logical field can have one or more {@link Field} values associated with it in the query, hence the fieldList. However the first entry is representative of the field for most purposes. @param executionContext contains the top level execution parameters @param parameters contains the parameters holding the fields to be executed and source object @return a promise to a fetched object @throws NonNullableFieldWasNullException in the future if a non null field resolves to a null value """ MergedField field = parameters.getField(); GraphQLObjectType parentType = (GraphQLObjectType) parameters.getExecutionStepInfo().getUnwrappedNonNullType(); GraphQLFieldDefinition fieldDef = getFieldDef(executionContext.getGraphQLSchema(), parentType, field.getSingleField()); GraphQLCodeRegistry codeRegistry = executionContext.getGraphQLSchema().getCodeRegistry(); Map<String, Object> argumentValues = valuesResolver.getArgumentValues(codeRegistry, fieldDef.getArguments(), field.getArguments(), executionContext.getVariables()); GraphQLOutputType fieldType = fieldDef.getType(); DataFetchingFieldSelectionSet fieldCollector = DataFetchingFieldSelectionSetImpl.newCollector(executionContext, fieldType, parameters.getField()); ExecutionStepInfo executionStepInfo = createExecutionStepInfo(executionContext, parameters, fieldDef, parentType); DataFetchingEnvironment environment = newDataFetchingEnvironment(executionContext) .source(parameters.getSource()) .localContext(parameters.getLocalContext()) .arguments(argumentValues) .fieldDefinition(fieldDef) .mergedField(parameters.getField()) .fieldType(fieldType) .executionStepInfo(executionStepInfo) .parentType(parentType) .selectionSet(fieldCollector) .build(); DataFetcher dataFetcher = codeRegistry.getDataFetcher(parentType, fieldDef); Instrumentation instrumentation = executionContext.getInstrumentation(); InstrumentationFieldFetchParameters instrumentationFieldFetchParams = new InstrumentationFieldFetchParameters(executionContext, fieldDef, environment, parameters, dataFetcher instanceof TrivialDataFetcher); InstrumentationContext<Object> fetchCtx = instrumentation.beginFieldFetch(instrumentationFieldFetchParams); CompletableFuture<Object> fetchedValue; dataFetcher = instrumentation.instrumentDataFetcher(dataFetcher, instrumentationFieldFetchParams); ExecutionId executionId = executionContext.getExecutionId(); try { log.debug("'{}' fetching field '{}' using data fetcher '{}'...", executionId, executionStepInfo.getPath(), dataFetcher.getClass().getName()); Object fetchedValueRaw = dataFetcher.get(environment); log.debug("'{}' field '{}' fetch returned '{}'", executionId, executionStepInfo.getPath(), fetchedValueRaw == null ? "null" : fetchedValueRaw.getClass().getName()); fetchedValue = Async.toCompletableFuture(fetchedValueRaw); } catch (Exception e) { log.debug(String.format("'%s', field '%s' fetch threw exception", executionId, executionStepInfo.getPath()), e); fetchedValue = new CompletableFuture<>(); fetchedValue.completeExceptionally(e); } fetchCtx.onDispatched(fetchedValue); return fetchedValue .handle((result, exception) -> { fetchCtx.onCompleted(result, exception); if (exception != null) { handleFetchingException(executionContext, parameters, environment, exception); return null; } else { return result; } }) .thenApply(result -> unboxPossibleDataFetcherResult(executionContext, parameters, result)); }
java
protected CompletableFuture<FetchedValue> fetchField(ExecutionContext executionContext, ExecutionStrategyParameters parameters) { MergedField field = parameters.getField(); GraphQLObjectType parentType = (GraphQLObjectType) parameters.getExecutionStepInfo().getUnwrappedNonNullType(); GraphQLFieldDefinition fieldDef = getFieldDef(executionContext.getGraphQLSchema(), parentType, field.getSingleField()); GraphQLCodeRegistry codeRegistry = executionContext.getGraphQLSchema().getCodeRegistry(); Map<String, Object> argumentValues = valuesResolver.getArgumentValues(codeRegistry, fieldDef.getArguments(), field.getArguments(), executionContext.getVariables()); GraphQLOutputType fieldType = fieldDef.getType(); DataFetchingFieldSelectionSet fieldCollector = DataFetchingFieldSelectionSetImpl.newCollector(executionContext, fieldType, parameters.getField()); ExecutionStepInfo executionStepInfo = createExecutionStepInfo(executionContext, parameters, fieldDef, parentType); DataFetchingEnvironment environment = newDataFetchingEnvironment(executionContext) .source(parameters.getSource()) .localContext(parameters.getLocalContext()) .arguments(argumentValues) .fieldDefinition(fieldDef) .mergedField(parameters.getField()) .fieldType(fieldType) .executionStepInfo(executionStepInfo) .parentType(parentType) .selectionSet(fieldCollector) .build(); DataFetcher dataFetcher = codeRegistry.getDataFetcher(parentType, fieldDef); Instrumentation instrumentation = executionContext.getInstrumentation(); InstrumentationFieldFetchParameters instrumentationFieldFetchParams = new InstrumentationFieldFetchParameters(executionContext, fieldDef, environment, parameters, dataFetcher instanceof TrivialDataFetcher); InstrumentationContext<Object> fetchCtx = instrumentation.beginFieldFetch(instrumentationFieldFetchParams); CompletableFuture<Object> fetchedValue; dataFetcher = instrumentation.instrumentDataFetcher(dataFetcher, instrumentationFieldFetchParams); ExecutionId executionId = executionContext.getExecutionId(); try { log.debug("'{}' fetching field '{}' using data fetcher '{}'...", executionId, executionStepInfo.getPath(), dataFetcher.getClass().getName()); Object fetchedValueRaw = dataFetcher.get(environment); log.debug("'{}' field '{}' fetch returned '{}'", executionId, executionStepInfo.getPath(), fetchedValueRaw == null ? "null" : fetchedValueRaw.getClass().getName()); fetchedValue = Async.toCompletableFuture(fetchedValueRaw); } catch (Exception e) { log.debug(String.format("'%s', field '%s' fetch threw exception", executionId, executionStepInfo.getPath()), e); fetchedValue = new CompletableFuture<>(); fetchedValue.completeExceptionally(e); } fetchCtx.onDispatched(fetchedValue); return fetchedValue .handle((result, exception) -> { fetchCtx.onCompleted(result, exception); if (exception != null) { handleFetchingException(executionContext, parameters, environment, exception); return null; } else { return result; } }) .thenApply(result -> unboxPossibleDataFetcherResult(executionContext, parameters, result)); }
[ "protected", "CompletableFuture", "<", "FetchedValue", ">", "fetchField", "(", "ExecutionContext", "executionContext", ",", "ExecutionStrategyParameters", "parameters", ")", "{", "MergedField", "field", "=", "parameters", ".", "getField", "(", ")", ";", "GraphQLObjectType", "parentType", "=", "(", "GraphQLObjectType", ")", "parameters", ".", "getExecutionStepInfo", "(", ")", ".", "getUnwrappedNonNullType", "(", ")", ";", "GraphQLFieldDefinition", "fieldDef", "=", "getFieldDef", "(", "executionContext", ".", "getGraphQLSchema", "(", ")", ",", "parentType", ",", "field", ".", "getSingleField", "(", ")", ")", ";", "GraphQLCodeRegistry", "codeRegistry", "=", "executionContext", ".", "getGraphQLSchema", "(", ")", ".", "getCodeRegistry", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "argumentValues", "=", "valuesResolver", ".", "getArgumentValues", "(", "codeRegistry", ",", "fieldDef", ".", "getArguments", "(", ")", ",", "field", ".", "getArguments", "(", ")", ",", "executionContext", ".", "getVariables", "(", ")", ")", ";", "GraphQLOutputType", "fieldType", "=", "fieldDef", ".", "getType", "(", ")", ";", "DataFetchingFieldSelectionSet", "fieldCollector", "=", "DataFetchingFieldSelectionSetImpl", ".", "newCollector", "(", "executionContext", ",", "fieldType", ",", "parameters", ".", "getField", "(", ")", ")", ";", "ExecutionStepInfo", "executionStepInfo", "=", "createExecutionStepInfo", "(", "executionContext", ",", "parameters", ",", "fieldDef", ",", "parentType", ")", ";", "DataFetchingEnvironment", "environment", "=", "newDataFetchingEnvironment", "(", "executionContext", ")", ".", "source", "(", "parameters", ".", "getSource", "(", ")", ")", ".", "localContext", "(", "parameters", ".", "getLocalContext", "(", ")", ")", ".", "arguments", "(", "argumentValues", ")", ".", "fieldDefinition", "(", "fieldDef", ")", ".", "mergedField", "(", "parameters", ".", "getField", "(", ")", ")", ".", "fieldType", "(", "fieldType", ")", ".", "executionStepInfo", "(", "executionStepInfo", ")", ".", "parentType", "(", "parentType", ")", ".", "selectionSet", "(", "fieldCollector", ")", ".", "build", "(", ")", ";", "DataFetcher", "dataFetcher", "=", "codeRegistry", ".", "getDataFetcher", "(", "parentType", ",", "fieldDef", ")", ";", "Instrumentation", "instrumentation", "=", "executionContext", ".", "getInstrumentation", "(", ")", ";", "InstrumentationFieldFetchParameters", "instrumentationFieldFetchParams", "=", "new", "InstrumentationFieldFetchParameters", "(", "executionContext", ",", "fieldDef", ",", "environment", ",", "parameters", ",", "dataFetcher", "instanceof", "TrivialDataFetcher", ")", ";", "InstrumentationContext", "<", "Object", ">", "fetchCtx", "=", "instrumentation", ".", "beginFieldFetch", "(", "instrumentationFieldFetchParams", ")", ";", "CompletableFuture", "<", "Object", ">", "fetchedValue", ";", "dataFetcher", "=", "instrumentation", ".", "instrumentDataFetcher", "(", "dataFetcher", ",", "instrumentationFieldFetchParams", ")", ";", "ExecutionId", "executionId", "=", "executionContext", ".", "getExecutionId", "(", ")", ";", "try", "{", "log", ".", "debug", "(", "\"'{}' fetching field '{}' using data fetcher '{}'...\"", ",", "executionId", ",", "executionStepInfo", ".", "getPath", "(", ")", ",", "dataFetcher", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "Object", "fetchedValueRaw", "=", "dataFetcher", ".", "get", "(", "environment", ")", ";", "log", ".", "debug", "(", "\"'{}' field '{}' fetch returned '{}'\"", ",", "executionId", ",", "executionStepInfo", ".", "getPath", "(", ")", ",", "fetchedValueRaw", "==", "null", "?", "\"null\"", ":", "fetchedValueRaw", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "fetchedValue", "=", "Async", ".", "toCompletableFuture", "(", "fetchedValueRaw", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "debug", "(", "String", ".", "format", "(", "\"'%s', field '%s' fetch threw exception\"", ",", "executionId", ",", "executionStepInfo", ".", "getPath", "(", ")", ")", ",", "e", ")", ";", "fetchedValue", "=", "new", "CompletableFuture", "<>", "(", ")", ";", "fetchedValue", ".", "completeExceptionally", "(", "e", ")", ";", "}", "fetchCtx", ".", "onDispatched", "(", "fetchedValue", ")", ";", "return", "fetchedValue", ".", "handle", "(", "(", "result", ",", "exception", ")", "->", "{", "fetchCtx", ".", "onCompleted", "(", "result", ",", "exception", ")", ";", "if", "(", "exception", "!=", "null", ")", "{", "handleFetchingException", "(", "executionContext", ",", "parameters", ",", "environment", ",", "exception", ")", ";", "return", "null", ";", "}", "else", "{", "return", "result", ";", "}", "}", ")", ".", "thenApply", "(", "result", "->", "unboxPossibleDataFetcherResult", "(", "executionContext", ",", "parameters", ",", "result", ")", ")", ";", "}" ]
Called to fetch a value for a field from the {@link DataFetcher} associated with the field {@link GraphQLFieldDefinition}. <p> Graphql fragments mean that for any give logical field can have one or more {@link Field} values associated with it in the query, hence the fieldList. However the first entry is representative of the field for most purposes. @param executionContext contains the top level execution parameters @param parameters contains the parameters holding the fields to be executed and source object @return a promise to a fetched object @throws NonNullableFieldWasNullException in the future if a non null field resolves to a null value
[ "Called", "to", "fetch", "a", "value", "for", "a", "field", "from", "the", "{", "@link", "DataFetcher", "}", "associated", "with", "the", "field", "{", "@link", "GraphQLFieldDefinition", "}", ".", "<p", ">", "Graphql", "fragments", "mean", "that", "for", "any", "give", "logical", "field", "can", "have", "one", "or", "more", "{", "@link", "Field", "}", "values", "associated", "with", "it", "in", "the", "query", "hence", "the", "fieldList", ".", "However", "the", "first", "entry", "is", "representative", "of", "the", "field", "for", "most", "purposes", "." ]
train
https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/execution/ExecutionStrategy.java#L222-L280
febit/wit
wit-core/src/main/java/org/febit/wit/loaders/AbstractLoader.java
AbstractLoader.concat
@Override public String concat(final String parent, final String name) { """ get child template name by parent template name and relative name. <pre> example: /path/to/tmpl1.wit , tmpl2.wit =&gt; /path/to/tmpl2.wit /path/to/tmpl1.wit , /tmpl2.wit =&gt; /tmpl2.wit /path/to/tmpl1.wit , ./tmpl2.wit =&gt; /path/to/tmpl2.wit /path/to/tmpl1.wit , ../tmpl2.wit =&gt; /path/tmpl2.wit </pre> @param parent parent template's name @param name relative name @return child template's name """ return parent != null ? FileNameUtil.concat(FileNameUtil.getPath(parent), name) : name; }
java
@Override public String concat(final String parent, final String name) { return parent != null ? FileNameUtil.concat(FileNameUtil.getPath(parent), name) : name; }
[ "@", "Override", "public", "String", "concat", "(", "final", "String", "parent", ",", "final", "String", "name", ")", "{", "return", "parent", "!=", "null", "?", "FileNameUtil", ".", "concat", "(", "FileNameUtil", ".", "getPath", "(", "parent", ")", ",", "name", ")", ":", "name", ";", "}" ]
get child template name by parent template name and relative name. <pre> example: /path/to/tmpl1.wit , tmpl2.wit =&gt; /path/to/tmpl2.wit /path/to/tmpl1.wit , /tmpl2.wit =&gt; /tmpl2.wit /path/to/tmpl1.wit , ./tmpl2.wit =&gt; /path/to/tmpl2.wit /path/to/tmpl1.wit , ../tmpl2.wit =&gt; /path/tmpl2.wit </pre> @param parent parent template's name @param name relative name @return child template's name
[ "get", "child", "template", "name", "by", "parent", "template", "name", "and", "relative", "name", "." ]
train
https://github.com/febit/wit/blob/89ee29efbc5633b79c30c3c7b953c9f4130575af/wit-core/src/main/java/org/febit/wit/loaders/AbstractLoader.java#L43-L48
spotify/async-google-pubsub-client
src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java
Pubsub.deleteSubscription
public PubsubFuture<Void> deleteSubscription(final String project, final String subscription) { """ Delete a Pub/Sub subscription. @param project The Google Cloud project. @param subscription The name of the subscription to delete. @return A future that is completed when this request is completed. The future will be completed with {@code null} if the response is 404. """ return deleteSubscription(canonicalSubscription(project, subscription)); }
java
public PubsubFuture<Void> deleteSubscription(final String project, final String subscription) { return deleteSubscription(canonicalSubscription(project, subscription)); }
[ "public", "PubsubFuture", "<", "Void", ">", "deleteSubscription", "(", "final", "String", "project", ",", "final", "String", "subscription", ")", "{", "return", "deleteSubscription", "(", "canonicalSubscription", "(", "project", ",", "subscription", ")", ")", ";", "}" ]
Delete a Pub/Sub subscription. @param project The Google Cloud project. @param subscription The name of the subscription to delete. @return A future that is completed when this request is completed. The future will be completed with {@code null} if the response is 404.
[ "Delete", "a", "Pub", "/", "Sub", "subscription", "." ]
train
https://github.com/spotify/async-google-pubsub-client/blob/7d021528fa5bc29be458e6f210fa62f59b71d004/src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java#L456-L459
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/model/RuntimeModelIo.java
RuntimeModelIo.loadApplicationFlexibly
public static ApplicationLoadResult loadApplicationFlexibly( File projectDirectory ) { """ Loads an application from a directory. <p> This method allows to load an application which does not have a descriptor. If it has one, it will be read. Otherwise, a default one will be generated. This is convenient for reusable recipes. </p> @param projectDirectory the project directory @return a load result (never null) """ File descDirectory = new File( projectDirectory, Constants.PROJECT_DIR_DESC ); ApplicationLoadResult result; if( descDirectory.exists()) { result = loadApplication( projectDirectory ); } else { ApplicationTemplateDescriptor appDescriptor = new ApplicationTemplateDescriptor(); appDescriptor.setName( Constants.GENERATED ); appDescriptor.setDslId( Constants.GENERATED ); appDescriptor.setVersion( Constants.GENERATED ); ApplicationLoadResult alr = new ApplicationLoadResult(); alr.applicationTemplate = new ApplicationTemplate( Constants.GENERATED ).dslId( Constants.GENERATED ).version( Constants.GENERATED ); File graphDirectory = new File( projectDirectory, Constants.PROJECT_DIR_GRAPH ); File[] graphFiles = graphDirectory.listFiles( new GraphFileFilter()); if( graphFiles != null && graphFiles.length > 0 ) appDescriptor.setGraphEntryPoint( graphFiles[ 0 ].getName()); result = loadApplication( projectDirectory, appDescriptor, alr ); } return result; }
java
public static ApplicationLoadResult loadApplicationFlexibly( File projectDirectory ) { File descDirectory = new File( projectDirectory, Constants.PROJECT_DIR_DESC ); ApplicationLoadResult result; if( descDirectory.exists()) { result = loadApplication( projectDirectory ); } else { ApplicationTemplateDescriptor appDescriptor = new ApplicationTemplateDescriptor(); appDescriptor.setName( Constants.GENERATED ); appDescriptor.setDslId( Constants.GENERATED ); appDescriptor.setVersion( Constants.GENERATED ); ApplicationLoadResult alr = new ApplicationLoadResult(); alr.applicationTemplate = new ApplicationTemplate( Constants.GENERATED ).dslId( Constants.GENERATED ).version( Constants.GENERATED ); File graphDirectory = new File( projectDirectory, Constants.PROJECT_DIR_GRAPH ); File[] graphFiles = graphDirectory.listFiles( new GraphFileFilter()); if( graphFiles != null && graphFiles.length > 0 ) appDescriptor.setGraphEntryPoint( graphFiles[ 0 ].getName()); result = loadApplication( projectDirectory, appDescriptor, alr ); } return result; }
[ "public", "static", "ApplicationLoadResult", "loadApplicationFlexibly", "(", "File", "projectDirectory", ")", "{", "File", "descDirectory", "=", "new", "File", "(", "projectDirectory", ",", "Constants", ".", "PROJECT_DIR_DESC", ")", ";", "ApplicationLoadResult", "result", ";", "if", "(", "descDirectory", ".", "exists", "(", ")", ")", "{", "result", "=", "loadApplication", "(", "projectDirectory", ")", ";", "}", "else", "{", "ApplicationTemplateDescriptor", "appDescriptor", "=", "new", "ApplicationTemplateDescriptor", "(", ")", ";", "appDescriptor", ".", "setName", "(", "Constants", ".", "GENERATED", ")", ";", "appDescriptor", ".", "setDslId", "(", "Constants", ".", "GENERATED", ")", ";", "appDescriptor", ".", "setVersion", "(", "Constants", ".", "GENERATED", ")", ";", "ApplicationLoadResult", "alr", "=", "new", "ApplicationLoadResult", "(", ")", ";", "alr", ".", "applicationTemplate", "=", "new", "ApplicationTemplate", "(", "Constants", ".", "GENERATED", ")", ".", "dslId", "(", "Constants", ".", "GENERATED", ")", ".", "version", "(", "Constants", ".", "GENERATED", ")", ";", "File", "graphDirectory", "=", "new", "File", "(", "projectDirectory", ",", "Constants", ".", "PROJECT_DIR_GRAPH", ")", ";", "File", "[", "]", "graphFiles", "=", "graphDirectory", ".", "listFiles", "(", "new", "GraphFileFilter", "(", ")", ")", ";", "if", "(", "graphFiles", "!=", "null", "&&", "graphFiles", ".", "length", ">", "0", ")", "appDescriptor", ".", "setGraphEntryPoint", "(", "graphFiles", "[", "0", "]", ".", "getName", "(", ")", ")", ";", "result", "=", "loadApplication", "(", "projectDirectory", ",", "appDescriptor", ",", "alr", ")", ";", "}", "return", "result", ";", "}" ]
Loads an application from a directory. <p> This method allows to load an application which does not have a descriptor. If it has one, it will be read. Otherwise, a default one will be generated. This is convenient for reusable recipes. </p> @param projectDirectory the project directory @return a load result (never null)
[ "Loads", "an", "application", "from", "a", "directory", ".", "<p", ">", "This", "method", "allows", "to", "load", "an", "application", "which", "does", "not", "have", "a", "descriptor", ".", "If", "it", "has", "one", "it", "will", "be", "read", ".", "Otherwise", "a", "default", "one", "will", "be", "generated", ".", "This", "is", "convenient", "for", "reusable", "recipes", ".", "<", "/", "p", ">" ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/RuntimeModelIo.java#L153-L178
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Duration.java
Duration.create
private static Duration create(long seconds, int nanoAdjustment) { """ Obtains an instance of {@code Duration} using seconds and nanoseconds. @param seconds the length of the duration in seconds, positive or negative @param nanoAdjustment the nanosecond adjustment within the second, from 0 to 999,999,999 """ if ((seconds | nanoAdjustment) == 0) { return ZERO; } return new Duration(seconds, nanoAdjustment); }
java
private static Duration create(long seconds, int nanoAdjustment) { if ((seconds | nanoAdjustment) == 0) { return ZERO; } return new Duration(seconds, nanoAdjustment); }
[ "private", "static", "Duration", "create", "(", "long", "seconds", ",", "int", "nanoAdjustment", ")", "{", "if", "(", "(", "seconds", "|", "nanoAdjustment", ")", "==", "0", ")", "{", "return", "ZERO", ";", "}", "return", "new", "Duration", "(", "seconds", ",", "nanoAdjustment", ")", ";", "}" ]
Obtains an instance of {@code Duration} using seconds and nanoseconds. @param seconds the length of the duration in seconds, positive or negative @param nanoAdjustment the nanosecond adjustment within the second, from 0 to 999,999,999
[ "Obtains", "an", "instance", "of", "{", "@code", "Duration", "}", "using", "seconds", "and", "nanoseconds", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Duration.java#L492-L497
aspectran/aspectran
core/src/main/java/com/aspectran/core/activity/AdviceActivity.java
AdviceActivity.putAdviceResult
protected void putAdviceResult(AspectAdviceRule aspectAdviceRule, Object adviceActionResult) { """ Puts the result of the advice. @param aspectAdviceRule the aspect advice rule @param adviceActionResult the advice action result """ if (aspectAdviceResult == null) { aspectAdviceResult = new AspectAdviceResult(); } aspectAdviceResult.putAdviceResult(aspectAdviceRule, adviceActionResult); }
java
protected void putAdviceResult(AspectAdviceRule aspectAdviceRule, Object adviceActionResult) { if (aspectAdviceResult == null) { aspectAdviceResult = new AspectAdviceResult(); } aspectAdviceResult.putAdviceResult(aspectAdviceRule, adviceActionResult); }
[ "protected", "void", "putAdviceResult", "(", "AspectAdviceRule", "aspectAdviceRule", ",", "Object", "adviceActionResult", ")", "{", "if", "(", "aspectAdviceResult", "==", "null", ")", "{", "aspectAdviceResult", "=", "new", "AspectAdviceResult", "(", ")", ";", "}", "aspectAdviceResult", ".", "putAdviceResult", "(", "aspectAdviceRule", ",", "adviceActionResult", ")", ";", "}" ]
Puts the result of the advice. @param aspectAdviceRule the aspect advice rule @param adviceActionResult the advice action result
[ "Puts", "the", "result", "of", "the", "advice", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/AdviceActivity.java#L522-L527
landawn/AbacusUtil
src/com/landawn/abacus/util/Matth.java
Matth.subtractExact
public static int subtractExact(int a, int b) { """ Returns the difference of {@code a} and {@code b}, provided it does not overflow. @throws ArithmeticException if {@code a - b} overflows in signed {@code int} arithmetic """ long result = (long) a - b; checkNoOverflow(result == (int) result); return (int) result; }
java
public static int subtractExact(int a, int b) { long result = (long) a - b; checkNoOverflow(result == (int) result); return (int) result; }
[ "public", "static", "int", "subtractExact", "(", "int", "a", ",", "int", "b", ")", "{", "long", "result", "=", "(", "long", ")", "a", "-", "b", ";", "checkNoOverflow", "(", "result", "==", "(", "int", ")", "result", ")", ";", "return", "(", "int", ")", "result", ";", "}" ]
Returns the difference of {@code a} and {@code b}, provided it does not overflow. @throws ArithmeticException if {@code a - b} overflows in signed {@code int} arithmetic
[ "Returns", "the", "difference", "of", "{", "@code", "a", "}", "and", "{", "@code", "b", "}", "provided", "it", "does", "not", "overflow", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Matth.java#L1393-L1397
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/HubVirtualNetworkConnectionsInner.java
HubVirtualNetworkConnectionsInner.listAsync
public Observable<Page<HubVirtualNetworkConnectionInner>> listAsync(final String resourceGroupName, final String virtualHubName) { """ Retrieves the details of all HubVirtualNetworkConnections. @param resourceGroupName The resource group name of the VirtualHub. @param virtualHubName The name of the VirtualHub. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;HubVirtualNetworkConnectionInner&gt; object """ return listWithServiceResponseAsync(resourceGroupName, virtualHubName) .map(new Func1<ServiceResponse<Page<HubVirtualNetworkConnectionInner>>, Page<HubVirtualNetworkConnectionInner>>() { @Override public Page<HubVirtualNetworkConnectionInner> call(ServiceResponse<Page<HubVirtualNetworkConnectionInner>> response) { return response.body(); } }); }
java
public Observable<Page<HubVirtualNetworkConnectionInner>> listAsync(final String resourceGroupName, final String virtualHubName) { return listWithServiceResponseAsync(resourceGroupName, virtualHubName) .map(new Func1<ServiceResponse<Page<HubVirtualNetworkConnectionInner>>, Page<HubVirtualNetworkConnectionInner>>() { @Override public Page<HubVirtualNetworkConnectionInner> call(ServiceResponse<Page<HubVirtualNetworkConnectionInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "HubVirtualNetworkConnectionInner", ">", ">", "listAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "virtualHubName", ")", "{", "return", "listWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualHubName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "HubVirtualNetworkConnectionInner", ">", ">", ",", "Page", "<", "HubVirtualNetworkConnectionInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "HubVirtualNetworkConnectionInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "HubVirtualNetworkConnectionInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Retrieves the details of all HubVirtualNetworkConnections. @param resourceGroupName The resource group name of the VirtualHub. @param virtualHubName The name of the VirtualHub. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;HubVirtualNetworkConnectionInner&gt; object
[ "Retrieves", "the", "details", "of", "all", "HubVirtualNetworkConnections", "." ]
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/HubVirtualNetworkConnectionsInner.java#L214-L222
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/Record.java
Record.makeRecordFromClassName
public static Record makeRecordFromClassName(String strClassName, RecordOwner recordOwner) { """ Create and initialize the record that has this class name. @param strClassName Full class name. @param recordOwner The recordowner to add this record to. @return The new record. """ return Record.makeRecordFromClassName(strClassName, recordOwner, true, true); }
java
public static Record makeRecordFromClassName(String strClassName, RecordOwner recordOwner) { return Record.makeRecordFromClassName(strClassName, recordOwner, true, true); }
[ "public", "static", "Record", "makeRecordFromClassName", "(", "String", "strClassName", ",", "RecordOwner", "recordOwner", ")", "{", "return", "Record", ".", "makeRecordFromClassName", "(", "strClassName", ",", "recordOwner", ",", "true", ",", "true", ")", ";", "}" ]
Create and initialize the record that has this class name. @param strClassName Full class name. @param recordOwner The recordowner to add this record to. @return The new record.
[ "Create", "and", "initialize", "the", "record", "that", "has", "this", "class", "name", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/Record.java#L2614-L2617
unbescape/unbescape
src/main/java/org/unbescape/uri/UriEscape.java
UriEscape.unescapeUriPathSegment
public static void unescapeUriPathSegment(final String text, final Writer writer) throws IOException { """ <p> Perform am URI path segment <strong>unescape</strong> operation on a <tt>String</tt> input using <tt>UTF-8</tt> as encoding, writing results to a <tt>Writer</tt>. </p> <p> This method will unescape every percent-encoded (<tt>%HH</tt>) sequences present in input, even for those characters that do not need to be percent-encoded in this context (unreserved characters can be percent-encoded even if/when this is not required, though it is not generally considered a good practice). </p> <p> This method will use <tt>UTF-8</tt> in order to determine the characters specified in the percent-encoded byte sequences. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>String</tt> to be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped 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.2 """ unescapeUriPathSegment(text, writer, DEFAULT_ENCODING); }
java
public static void unescapeUriPathSegment(final String text, final Writer writer) throws IOException { unescapeUriPathSegment(text, writer, DEFAULT_ENCODING); }
[ "public", "static", "void", "unescapeUriPathSegment", "(", "final", "String", "text", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "unescapeUriPathSegment", "(", "text", ",", "writer", ",", "DEFAULT_ENCODING", ")", ";", "}" ]
<p> Perform am URI path segment <strong>unescape</strong> operation on a <tt>String</tt> input using <tt>UTF-8</tt> as encoding, writing results to a <tt>Writer</tt>. </p> <p> This method will unescape every percent-encoded (<tt>%HH</tt>) sequences present in input, even for those characters that do not need to be percent-encoded in this context (unreserved characters can be percent-encoded even if/when this is not required, though it is not generally considered a good practice). </p> <p> This method will use <tt>UTF-8</tt> in order to determine the characters specified in the percent-encoded byte sequences. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>String</tt> to be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped 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.2
[ "<p", ">", "Perform", "am", "URI", "path", "segment", "<strong", ">", "unescape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "String<", "/", "tt", ">", "input", "using", "<tt", ">", "UTF", "-", "8<", "/", "tt", ">", "as", "encoding", "writing", "results", "to", "a", "<tt", ">", "Writer<", "/", "tt", ">", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "will", "unescape", "every", "percent", "-", "encoded", "(", "<tt", ">", "%HH<", "/", "tt", ">", ")", "sequences", "present", "in", "input", "even", "for", "those", "characters", "that", "do", "not", "need", "to", "be", "percent", "-", "encoded", "in", "this", "context", "(", "unreserved", "characters", "can", "be", "percent", "-", "encoded", "even", "if", "/", "when", "this", "is", "not", "required", "though", "it", "is", "not", "generally", "considered", "a", "good", "practice", ")", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "will", "use", "<tt", ">", "UTF", "-", "8<", "/", "tt", ">", "in", "order", "to", "determine", "the", "characters", "specified", "in", "the", "percent", "-", "encoded", "byte", "sequences", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "is", "<strong", ">", "thread", "-", "safe<", "/", "strong", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L1878-L1881
apptik/jus
jus-java/src/main/java/io/apptik/comm/jus/http/HttpUrl.java
HttpUrl.queryParameterValues
public List<String> queryParameterValues(String name) { """ Returns all values for the query parameter {@code name} ordered by their appearance in this URL. For example this returns {@code ["banana"]} for {@code queryParameterValue("b")} on {@code http://host/?a=apple&b=banana}. <p><table summary=""> <tr><th>URL</th><th>{@code queryParameterValues("a")}</th><th>{@code queryParameterValues("b")}</th></tr> <tr><td>{@code http://host/}</td><td>{@code []}</td><td>{@code []}</td></tr> <tr><td>{@code http://host/?}</td><td>{@code []}</td><td>{@code []}</td></tr> <tr><td>{@code http://host/?a=apple&k=key+lime}</td><td>{@code ["apple"]}</td><td>{@code []}</td></tr> <tr><td>{@code http://host/?a=apple&a=apricot}</td><td>{@code ["apple", "apricot"]}</td><td>{@code []}</td></tr> <tr><td>{@code http://host/?a=apple&b}</td><td>{@code ["apple"]}</td><td>{@code [null]}</td></tr> </table> """ if (queryNamesAndValues == null) return Collections.emptyList(); List<String> result = new ArrayList<>(); for (int i = 0, size = queryNamesAndValues.size(); i < size; i += 2) { if (name.equals(queryNamesAndValues.get(i))) { result.add(queryNamesAndValues.get(i + 1)); } } return Collections.unmodifiableList(result); }
java
public List<String> queryParameterValues(String name) { if (queryNamesAndValues == null) return Collections.emptyList(); List<String> result = new ArrayList<>(); for (int i = 0, size = queryNamesAndValues.size(); i < size; i += 2) { if (name.equals(queryNamesAndValues.get(i))) { result.add(queryNamesAndValues.get(i + 1)); } } return Collections.unmodifiableList(result); }
[ "public", "List", "<", "String", ">", "queryParameterValues", "(", "String", "name", ")", "{", "if", "(", "queryNamesAndValues", "==", "null", ")", "return", "Collections", ".", "emptyList", "(", ")", ";", "List", "<", "String", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "size", "=", "queryNamesAndValues", ".", "size", "(", ")", ";", "i", "<", "size", ";", "i", "+=", "2", ")", "{", "if", "(", "name", ".", "equals", "(", "queryNamesAndValues", ".", "get", "(", "i", ")", ")", ")", "{", "result", ".", "add", "(", "queryNamesAndValues", ".", "get", "(", "i", "+", "1", ")", ")", ";", "}", "}", "return", "Collections", ".", "unmodifiableList", "(", "result", ")", ";", "}" ]
Returns all values for the query parameter {@code name} ordered by their appearance in this URL. For example this returns {@code ["banana"]} for {@code queryParameterValue("b")} on {@code http://host/?a=apple&b=banana}. <p><table summary=""> <tr><th>URL</th><th>{@code queryParameterValues("a")}</th><th>{@code queryParameterValues("b")}</th></tr> <tr><td>{@code http://host/}</td><td>{@code []}</td><td>{@code []}</td></tr> <tr><td>{@code http://host/?}</td><td>{@code []}</td><td>{@code []}</td></tr> <tr><td>{@code http://host/?a=apple&k=key+lime}</td><td>{@code ["apple"]}</td><td>{@code []}</td></tr> <tr><td>{@code http://host/?a=apple&a=apricot}</td><td>{@code ["apple", "apricot"]}</td><td>{@code []}</td></tr> <tr><td>{@code http://host/?a=apple&b}</td><td>{@code ["apple"]}</td><td>{@code [null]}</td></tr> </table>
[ "Returns", "all", "values", "for", "the", "query", "parameter", "{", "@code", "name", "}", "ordered", "by", "their", "appearance", "in", "this", "URL", ".", "For", "example", "this", "returns", "{", "@code", "[", "banana", "]", "}", "for", "{", "@code", "queryParameterValue", "(", "b", ")", "}", "on", "{", "@code", "http", ":", "//", "host", "/", "?a", "=", "apple&b", "=", "banana", "}", "." ]
train
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/http/HttpUrl.java#L757-L766
ansell/restlet-utils
src/main/java/com/github/ansell/restletutils/FixedRedirectCookieAuthenticator.java
FixedRedirectCookieAuthenticator.isLoggingOut
protected boolean isLoggingOut(final Request request, final Response response) { """ Indicates if the request is an attempt to log out and should be intercepted. @param request The current request. @param response The current response. @return True if the request is an attempt to log out and should be intercepted. """ return this.isInterceptingLogout() && this.getLogoutPath().equals(request.getResourceRef().getRemainingPart(false, false)) && (Method.GET.equals(request.getMethod()) || Method.POST.equals(request.getMethod())); }
java
protected boolean isLoggingOut(final Request request, final Response response) { return this.isInterceptingLogout() && this.getLogoutPath().equals(request.getResourceRef().getRemainingPart(false, false)) && (Method.GET.equals(request.getMethod()) || Method.POST.equals(request.getMethod())); }
[ "protected", "boolean", "isLoggingOut", "(", "final", "Request", "request", ",", "final", "Response", "response", ")", "{", "return", "this", ".", "isInterceptingLogout", "(", ")", "&&", "this", ".", "getLogoutPath", "(", ")", ".", "equals", "(", "request", ".", "getResourceRef", "(", ")", ".", "getRemainingPart", "(", "false", ",", "false", ")", ")", "&&", "(", "Method", ".", "GET", ".", "equals", "(", "request", ".", "getMethod", "(", ")", ")", "||", "Method", ".", "POST", ".", "equals", "(", "request", ".", "getMethod", "(", ")", ")", ")", ";", "}" ]
Indicates if the request is an attempt to log out and should be intercepted. @param request The current request. @param response The current response. @return True if the request is an attempt to log out and should be intercepted.
[ "Indicates", "if", "the", "request", "is", "an", "attempt", "to", "log", "out", "and", "should", "be", "intercepted", "." ]
train
https://github.com/ansell/restlet-utils/blob/6c39a3e91aa8295936af1dbfccd6ba27230c40a9/src/main/java/com/github/ansell/restletutils/FixedRedirectCookieAuthenticator.java#L608-L613
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_ovhPabx_serviceName_menu_menuId_GET
public OvhOvhPabxMenu billingAccount_ovhPabx_serviceName_menu_menuId_GET(String billingAccount, String serviceName, Long menuId) throws IOException { """ Get this object properties REST: GET /telephony/{billingAccount}/ovhPabx/{serviceName}/menu/{menuId} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param menuId [required] """ String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/menu/{menuId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, menuId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhPabxMenu.class); }
java
public OvhOvhPabxMenu billingAccount_ovhPabx_serviceName_menu_menuId_GET(String billingAccount, String serviceName, Long menuId) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/menu/{menuId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, menuId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhPabxMenu.class); }
[ "public", "OvhOvhPabxMenu", "billingAccount_ovhPabx_serviceName_menu_menuId_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "menuId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/ovhPabx/{serviceName}/menu/{menuId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ",", "menuId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOvhPabxMenu", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /telephony/{billingAccount}/ovhPabx/{serviceName}/menu/{menuId} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param menuId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7538-L7543
actorapp/actor-platform
actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java
ImageLoading.loadBitmap
public static Bitmap loadBitmap(String fileName, int scale) throws ImageLoadException { """ Loading bitmap with scaling @param fileName Image file name @param scale divider of size, might be factor of two @return loaded bitmap (always not null) @throws ImageLoadException if it is unable to load file """ return loadBitmap(new FileSource(fileName), scale); }
java
public static Bitmap loadBitmap(String fileName, int scale) throws ImageLoadException { return loadBitmap(new FileSource(fileName), scale); }
[ "public", "static", "Bitmap", "loadBitmap", "(", "String", "fileName", ",", "int", "scale", ")", "throws", "ImageLoadException", "{", "return", "loadBitmap", "(", "new", "FileSource", "(", "fileName", ")", ",", "scale", ")", ";", "}" ]
Loading bitmap with scaling @param fileName Image file name @param scale divider of size, might be factor of two @return loaded bitmap (always not null) @throws ImageLoadException if it is unable to load file
[ "Loading", "bitmap", "with", "scaling" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java#L72-L74
redkale/redkale
src/org/redkale/convert/ConvertFactory.java
ConvertFactory.registerIgnoreAll
public final void registerIgnoreAll(final Class type, String... excludeColumns) { """ 屏蔽指定类所有字段,仅仅保留指定字段 <br> <b>注意: 该配置优先级高于skipAllIgnore和ConvertColumnEntry配置</b> @param type 指定的类 @param excludeColumns 需要排除的字段名 """ Set<String> set = ignoreAlls.get(type); if (set == null) { ignoreAlls.put(type, new HashSet<>(Arrays.asList(excludeColumns))); } else { set.addAll(Arrays.asList(excludeColumns)); } }
java
public final void registerIgnoreAll(final Class type, String... excludeColumns) { Set<String> set = ignoreAlls.get(type); if (set == null) { ignoreAlls.put(type, new HashSet<>(Arrays.asList(excludeColumns))); } else { set.addAll(Arrays.asList(excludeColumns)); } }
[ "public", "final", "void", "registerIgnoreAll", "(", "final", "Class", "type", ",", "String", "...", "excludeColumns", ")", "{", "Set", "<", "String", ">", "set", "=", "ignoreAlls", ".", "get", "(", "type", ")", ";", "if", "(", "set", "==", "null", ")", "{", "ignoreAlls", ".", "put", "(", "type", ",", "new", "HashSet", "<>", "(", "Arrays", ".", "asList", "(", "excludeColumns", ")", ")", ")", ";", "}", "else", "{", "set", ".", "addAll", "(", "Arrays", ".", "asList", "(", "excludeColumns", ")", ")", ";", "}", "}" ]
屏蔽指定类所有字段,仅仅保留指定字段 <br> <b>注意: 该配置优先级高于skipAllIgnore和ConvertColumnEntry配置</b> @param type 指定的类 @param excludeColumns 需要排除的字段名
[ "屏蔽指定类所有字段,仅仅保留指定字段", "<br", ">", "<b", ">", "注意", ":", "该配置优先级高于skipAllIgnore和ConvertColumnEntry配置<", "/", "b", ">" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/convert/ConvertFactory.java#L400-L407
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetRowResourcesImpl.java
SheetRowResourcesImpl.getRow
public Row getRow(long sheetId, long rowId, EnumSet<RowInclusion> includes, EnumSet<ObjectExclusion> excludes) throws SmartsheetException { """ Get a row. It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/rows/{rowId} Exceptions: - InvalidRequestException : if there is any problem with the REST API request - AuthorizationException : if there is any problem with the REST API authorization(access token) - ResourceNotFoundException : if the resource can not be found - ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting) - SmartsheetRestException : if there is any other REST API related error occurred during the operation - SmartsheetException : if there is any other error occurred during the operation @param sheetId the id of the sheet @param rowId the id of the row @param includes optional objects to include @param excludes optional objects to exclude @return the row (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null). @throws SmartsheetException the smartsheet exception """ String path = "sheets/" + sheetId + "/rows/" + rowId; HashMap<String, Object> parameters = new HashMap<String, Object>(); parameters.put("include", QueryUtil.generateCommaSeparatedList(includes)); parameters.put("exclude", QueryUtil.generateCommaSeparatedList(excludes)); path += QueryUtil.generateUrl(null, parameters); return this.getResource(path, Row.class); }
java
public Row getRow(long sheetId, long rowId, EnumSet<RowInclusion> includes, EnumSet<ObjectExclusion> excludes) throws SmartsheetException { String path = "sheets/" + sheetId + "/rows/" + rowId; HashMap<String, Object> parameters = new HashMap<String, Object>(); parameters.put("include", QueryUtil.generateCommaSeparatedList(includes)); parameters.put("exclude", QueryUtil.generateCommaSeparatedList(excludes)); path += QueryUtil.generateUrl(null, parameters); return this.getResource(path, Row.class); }
[ "public", "Row", "getRow", "(", "long", "sheetId", ",", "long", "rowId", ",", "EnumSet", "<", "RowInclusion", ">", "includes", ",", "EnumSet", "<", "ObjectExclusion", ">", "excludes", ")", "throws", "SmartsheetException", "{", "String", "path", "=", "\"sheets/\"", "+", "sheetId", "+", "\"/rows/\"", "+", "rowId", ";", "HashMap", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"include\"", ",", "QueryUtil", ".", "generateCommaSeparatedList", "(", "includes", ")", ")", ";", "parameters", ".", "put", "(", "\"exclude\"", ",", "QueryUtil", ".", "generateCommaSeparatedList", "(", "excludes", ")", ")", ";", "path", "+=", "QueryUtil", ".", "generateUrl", "(", "null", ",", "parameters", ")", ";", "return", "this", ".", "getResource", "(", "path", ",", "Row", ".", "class", ")", ";", "}" ]
Get a row. It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/rows/{rowId} Exceptions: - InvalidRequestException : if there is any problem with the REST API request - AuthorizationException : if there is any problem with the REST API authorization(access token) - ResourceNotFoundException : if the resource can not be found - ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting) - SmartsheetRestException : if there is any other REST API related error occurred during the operation - SmartsheetException : if there is any other error occurred during the operation @param sheetId the id of the sheet @param rowId the id of the row @param includes optional objects to include @param excludes optional objects to exclude @return the row (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null). @throws SmartsheetException the smartsheet exception
[ "Get", "a", "row", "." ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetRowResourcesImpl.java#L116-L126
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/isomorphism/mcss/RGraph.java
RGraph.mustContinue
private boolean mustContinue(BitSet potentialNode) { """ Determine if there are potential solution remaining. @param potentialNode set of remaining potential nodes @return true if it is worse to continue the search """ boolean result = true; boolean cancel = false; BitSet projG1 = projectG1(potentialNode); BitSet projG2 = projectG2(potentialNode); // if we reached the maximum number of // search iterations than do not continue if (maxIteration != -1 && nbIteration >= maxIteration) { return false; } // if constrains may no more be fulfilled then stop. if (!isContainedIn(c1, projG1) || !isContainedIn(c2, projG2)) { return false; } // check if the solution potential is not included in an already // existing solution for (Iterator<BitSet> i = solutionList.iterator(); i.hasNext() && !cancel;) { BitSet sol = i.next(); // if we want every 'mappings' do not stop if (findAllMap && (projG1.equals(projectG1(sol)) || projG2.equals(projectG2(sol)))) { // do nothing } // if it is not possible to do better than an already existing solution than stop. else if (isContainedIn(projG1, projectG1(sol)) || isContainedIn(projG2, projectG2(sol))) { result = false; cancel = true; } } return result; }
java
private boolean mustContinue(BitSet potentialNode) { boolean result = true; boolean cancel = false; BitSet projG1 = projectG1(potentialNode); BitSet projG2 = projectG2(potentialNode); // if we reached the maximum number of // search iterations than do not continue if (maxIteration != -1 && nbIteration >= maxIteration) { return false; } // if constrains may no more be fulfilled then stop. if (!isContainedIn(c1, projG1) || !isContainedIn(c2, projG2)) { return false; } // check if the solution potential is not included in an already // existing solution for (Iterator<BitSet> i = solutionList.iterator(); i.hasNext() && !cancel;) { BitSet sol = i.next(); // if we want every 'mappings' do not stop if (findAllMap && (projG1.equals(projectG1(sol)) || projG2.equals(projectG2(sol)))) { // do nothing } // if it is not possible to do better than an already existing solution than stop. else if (isContainedIn(projG1, projectG1(sol)) || isContainedIn(projG2, projectG2(sol))) { result = false; cancel = true; } } return result; }
[ "private", "boolean", "mustContinue", "(", "BitSet", "potentialNode", ")", "{", "boolean", "result", "=", "true", ";", "boolean", "cancel", "=", "false", ";", "BitSet", "projG1", "=", "projectG1", "(", "potentialNode", ")", ";", "BitSet", "projG2", "=", "projectG2", "(", "potentialNode", ")", ";", "// if we reached the maximum number of", "// search iterations than do not continue", "if", "(", "maxIteration", "!=", "-", "1", "&&", "nbIteration", ">=", "maxIteration", ")", "{", "return", "false", ";", "}", "// if constrains may no more be fulfilled then stop.", "if", "(", "!", "isContainedIn", "(", "c1", ",", "projG1", ")", "||", "!", "isContainedIn", "(", "c2", ",", "projG2", ")", ")", "{", "return", "false", ";", "}", "// check if the solution potential is not included in an already", "// existing solution", "for", "(", "Iterator", "<", "BitSet", ">", "i", "=", "solutionList", ".", "iterator", "(", ")", ";", "i", ".", "hasNext", "(", ")", "&&", "!", "cancel", ";", ")", "{", "BitSet", "sol", "=", "i", ".", "next", "(", ")", ";", "// if we want every 'mappings' do not stop", "if", "(", "findAllMap", "&&", "(", "projG1", ".", "equals", "(", "projectG1", "(", "sol", ")", ")", "||", "projG2", ".", "equals", "(", "projectG2", "(", "sol", ")", ")", ")", ")", "{", "// do nothing", "}", "// if it is not possible to do better than an already existing solution than stop.", "else", "if", "(", "isContainedIn", "(", "projG1", ",", "projectG1", "(", "sol", ")", ")", "||", "isContainedIn", "(", "projG2", ",", "projectG2", "(", "sol", ")", ")", ")", "{", "result", "=", "false", ";", "cancel", "=", "true", ";", "}", "}", "return", "result", ";", "}" ]
Determine if there are potential solution remaining. @param potentialNode set of remaining potential nodes @return true if it is worse to continue the search
[ "Determine", "if", "there", "are", "potential", "solution", "remaining", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/isomorphism/mcss/RGraph.java#L375-L409
wildfly-extras/wildfly-camel
subsystem/core/src/main/java/org/wildfly/extension/camel/service/CamelEndpointDeployerService.java
CamelEndpointDeployerService.doDeploy
void doDeploy(URI uri, Consumer<EndpointServlet> endpointServletConsumer, Consumer<DeploymentInfo> deploymentInfoConsumer, Consumer<DeploymentImpl> deploymentConsumer) { """ The stuff common for {@link #deploy(URI, EndpointHttpHandler)} and {@link #deploy(URI, HttpHandler)}. @param uri @param endpointServletConsumer customize the {@link EndpointServlet} @param deploymentInfoConsumer customize the {@link DeploymentInfo} @param deploymentConsumer customize the {@link DeploymentImpl} """ final ServletInfo servletInfo = Servlets.servlet(EndpointServlet.NAME, EndpointServlet.class).addMapping("/*") .setAsyncSupported(true); final DeploymentInfo mainDeploymentInfo = deploymentInfoSupplier.getValue(); DeploymentInfo endPointDeplyomentInfo = adaptDeploymentInfo(mainDeploymentInfo, uri, servletInfo); deploymentInfoConsumer.accept(endPointDeplyomentInfo); CamelLogger.LOGGER.debug("Deploying endpoint {}", endPointDeplyomentInfo.getDeploymentName()); final ClassLoader old = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(endPointDeplyomentInfo.getClassLoader()); try { final DeploymentManager manager = servletContainerServiceSupplier.getValue().getServletContainer() .addDeployment(endPointDeplyomentInfo); manager.deploy(); final Deployment deployment = manager.getDeployment(); try { deploymentConsumer.accept((DeploymentImpl) deployment); manager.start(); hostSupplier.getValue().registerDeployment(deployment, deployment.getHandler()); ManagedServlet managedServlet = deployment.getServlets().getManagedServlet(EndpointServlet.NAME); EndpointServlet servletInstance = (EndpointServlet) managedServlet.getServlet().getInstance(); endpointServletConsumer.accept(servletInstance); } catch (ServletException ex) { throw new IllegalStateException(ex); } synchronized (deployments) { deployments.put(uri, manager); } } finally { Thread.currentThread().setContextClassLoader(old); } }
java
void doDeploy(URI uri, Consumer<EndpointServlet> endpointServletConsumer, Consumer<DeploymentInfo> deploymentInfoConsumer, Consumer<DeploymentImpl> deploymentConsumer) { final ServletInfo servletInfo = Servlets.servlet(EndpointServlet.NAME, EndpointServlet.class).addMapping("/*") .setAsyncSupported(true); final DeploymentInfo mainDeploymentInfo = deploymentInfoSupplier.getValue(); DeploymentInfo endPointDeplyomentInfo = adaptDeploymentInfo(mainDeploymentInfo, uri, servletInfo); deploymentInfoConsumer.accept(endPointDeplyomentInfo); CamelLogger.LOGGER.debug("Deploying endpoint {}", endPointDeplyomentInfo.getDeploymentName()); final ClassLoader old = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(endPointDeplyomentInfo.getClassLoader()); try { final DeploymentManager manager = servletContainerServiceSupplier.getValue().getServletContainer() .addDeployment(endPointDeplyomentInfo); manager.deploy(); final Deployment deployment = manager.getDeployment(); try { deploymentConsumer.accept((DeploymentImpl) deployment); manager.start(); hostSupplier.getValue().registerDeployment(deployment, deployment.getHandler()); ManagedServlet managedServlet = deployment.getServlets().getManagedServlet(EndpointServlet.NAME); EndpointServlet servletInstance = (EndpointServlet) managedServlet.getServlet().getInstance(); endpointServletConsumer.accept(servletInstance); } catch (ServletException ex) { throw new IllegalStateException(ex); } synchronized (deployments) { deployments.put(uri, manager); } } finally { Thread.currentThread().setContextClassLoader(old); } }
[ "void", "doDeploy", "(", "URI", "uri", ",", "Consumer", "<", "EndpointServlet", ">", "endpointServletConsumer", ",", "Consumer", "<", "DeploymentInfo", ">", "deploymentInfoConsumer", ",", "Consumer", "<", "DeploymentImpl", ">", "deploymentConsumer", ")", "{", "final", "ServletInfo", "servletInfo", "=", "Servlets", ".", "servlet", "(", "EndpointServlet", ".", "NAME", ",", "EndpointServlet", ".", "class", ")", ".", "addMapping", "(", "\"/*\"", ")", ".", "setAsyncSupported", "(", "true", ")", ";", "final", "DeploymentInfo", "mainDeploymentInfo", "=", "deploymentInfoSupplier", ".", "getValue", "(", ")", ";", "DeploymentInfo", "endPointDeplyomentInfo", "=", "adaptDeploymentInfo", "(", "mainDeploymentInfo", ",", "uri", ",", "servletInfo", ")", ";", "deploymentInfoConsumer", ".", "accept", "(", "endPointDeplyomentInfo", ")", ";", "CamelLogger", ".", "LOGGER", ".", "debug", "(", "\"Deploying endpoint {}\"", ",", "endPointDeplyomentInfo", ".", "getDeploymentName", "(", ")", ")", ";", "final", "ClassLoader", "old", "=", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ";", "Thread", ".", "currentThread", "(", ")", ".", "setContextClassLoader", "(", "endPointDeplyomentInfo", ".", "getClassLoader", "(", ")", ")", ";", "try", "{", "final", "DeploymentManager", "manager", "=", "servletContainerServiceSupplier", ".", "getValue", "(", ")", ".", "getServletContainer", "(", ")", ".", "addDeployment", "(", "endPointDeplyomentInfo", ")", ";", "manager", ".", "deploy", "(", ")", ";", "final", "Deployment", "deployment", "=", "manager", ".", "getDeployment", "(", ")", ";", "try", "{", "deploymentConsumer", ".", "accept", "(", "(", "DeploymentImpl", ")", "deployment", ")", ";", "manager", ".", "start", "(", ")", ";", "hostSupplier", ".", "getValue", "(", ")", ".", "registerDeployment", "(", "deployment", ",", "deployment", ".", "getHandler", "(", ")", ")", ";", "ManagedServlet", "managedServlet", "=", "deployment", ".", "getServlets", "(", ")", ".", "getManagedServlet", "(", "EndpointServlet", ".", "NAME", ")", ";", "EndpointServlet", "servletInstance", "=", "(", "EndpointServlet", ")", "managedServlet", ".", "getServlet", "(", ")", ".", "getInstance", "(", ")", ";", "endpointServletConsumer", ".", "accept", "(", "servletInstance", ")", ";", "}", "catch", "(", "ServletException", "ex", ")", "{", "throw", "new", "IllegalStateException", "(", "ex", ")", ";", "}", "synchronized", "(", "deployments", ")", "{", "deployments", ".", "put", "(", "uri", ",", "manager", ")", ";", "}", "}", "finally", "{", "Thread", ".", "currentThread", "(", ")", ".", "setContextClassLoader", "(", "old", ")", ";", "}", "}" ]
The stuff common for {@link #deploy(URI, EndpointHttpHandler)} and {@link #deploy(URI, HttpHandler)}. @param uri @param endpointServletConsumer customize the {@link EndpointServlet} @param deploymentInfoConsumer customize the {@link DeploymentInfo} @param deploymentConsumer customize the {@link DeploymentImpl}
[ "The", "stuff", "common", "for", "{", "@link", "#deploy", "(", "URI", "EndpointHttpHandler", ")", "}", "and", "{", "@link", "#deploy", "(", "URI", "HttpHandler", ")", "}", "." ]
train
https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/subsystem/core/src/main/java/org/wildfly/extension/camel/service/CamelEndpointDeployerService.java#L465-L501
bazaarvoice/emodb
web/src/main/java/com/bazaarvoice/emodb/web/scanner/control/ScanPlan.java
ScanPlan.toScanStatus
public ScanStatus toScanStatus() { """ Creates a ScanStatus based on the current state of the plan. All scan ranges are added as pending tasks. """ List<ScanRangeStatus> pendingRangeStatuses = Lists.newArrayList(); // Unique identifier for each scan task int taskId = 0; // Unique identifier for each batch int batchId = 0; // Unique identifier which identifies all tasks which affect the same resources in the ring int concurrencyId = 0; for (PlanBatch batch : _clusterHeads.values()) { // Within a single Cassandra ring each batch runs serially. This is enforced by blocking on the prior batch // from the same cluster. Integer lastBatchId = null; while (batch != null) { List<PlanItem> items = batch.getItems(); if (!items.isEmpty()) { Optional<Integer> blockingBatch = Optional.fromNullable(lastBatchId); for (PlanItem item : items) { String placement = item.getPlacement(); // If the token range is subdivided into more than one scan range then mark all sub-ranges with // the same unique concurrency ID. Optional<Integer> concurrency = item.getScanRanges().size() > 1 ? Optional.of(concurrencyId++) : Optional.<Integer>absent(); for (ScanRange scanRange : item.getScanRanges()) { pendingRangeStatuses.add(new ScanRangeStatus( taskId++, placement, scanRange, batchId, blockingBatch, concurrency)); } } lastBatchId = batchId; batchId++; } batch = batch.getNextBatch(); } } return new ScanStatus(_scanId, _options, false, false, new Date(), pendingRangeStatuses, ImmutableList.<ScanRangeStatus>of(), ImmutableList.<ScanRangeStatus>of()); }
java
public ScanStatus toScanStatus() { List<ScanRangeStatus> pendingRangeStatuses = Lists.newArrayList(); // Unique identifier for each scan task int taskId = 0; // Unique identifier for each batch int batchId = 0; // Unique identifier which identifies all tasks which affect the same resources in the ring int concurrencyId = 0; for (PlanBatch batch : _clusterHeads.values()) { // Within a single Cassandra ring each batch runs serially. This is enforced by blocking on the prior batch // from the same cluster. Integer lastBatchId = null; while (batch != null) { List<PlanItem> items = batch.getItems(); if (!items.isEmpty()) { Optional<Integer> blockingBatch = Optional.fromNullable(lastBatchId); for (PlanItem item : items) { String placement = item.getPlacement(); // If the token range is subdivided into more than one scan range then mark all sub-ranges with // the same unique concurrency ID. Optional<Integer> concurrency = item.getScanRanges().size() > 1 ? Optional.of(concurrencyId++) : Optional.<Integer>absent(); for (ScanRange scanRange : item.getScanRanges()) { pendingRangeStatuses.add(new ScanRangeStatus( taskId++, placement, scanRange, batchId, blockingBatch, concurrency)); } } lastBatchId = batchId; batchId++; } batch = batch.getNextBatch(); } } return new ScanStatus(_scanId, _options, false, false, new Date(), pendingRangeStatuses, ImmutableList.<ScanRangeStatus>of(), ImmutableList.<ScanRangeStatus>of()); }
[ "public", "ScanStatus", "toScanStatus", "(", ")", "{", "List", "<", "ScanRangeStatus", ">", "pendingRangeStatuses", "=", "Lists", ".", "newArrayList", "(", ")", ";", "// Unique identifier for each scan task", "int", "taskId", "=", "0", ";", "// Unique identifier for each batch", "int", "batchId", "=", "0", ";", "// Unique identifier which identifies all tasks which affect the same resources in the ring", "int", "concurrencyId", "=", "0", ";", "for", "(", "PlanBatch", "batch", ":", "_clusterHeads", ".", "values", "(", ")", ")", "{", "// Within a single Cassandra ring each batch runs serially. This is enforced by blocking on the prior batch", "// from the same cluster.", "Integer", "lastBatchId", "=", "null", ";", "while", "(", "batch", "!=", "null", ")", "{", "List", "<", "PlanItem", ">", "items", "=", "batch", ".", "getItems", "(", ")", ";", "if", "(", "!", "items", ".", "isEmpty", "(", ")", ")", "{", "Optional", "<", "Integer", ">", "blockingBatch", "=", "Optional", ".", "fromNullable", "(", "lastBatchId", ")", ";", "for", "(", "PlanItem", "item", ":", "items", ")", "{", "String", "placement", "=", "item", ".", "getPlacement", "(", ")", ";", "// If the token range is subdivided into more than one scan range then mark all sub-ranges with", "// the same unique concurrency ID.", "Optional", "<", "Integer", ">", "concurrency", "=", "item", ".", "getScanRanges", "(", ")", ".", "size", "(", ")", ">", "1", "?", "Optional", ".", "of", "(", "concurrencyId", "++", ")", ":", "Optional", ".", "<", "Integer", ">", "absent", "(", ")", ";", "for", "(", "ScanRange", "scanRange", ":", "item", ".", "getScanRanges", "(", ")", ")", "{", "pendingRangeStatuses", ".", "add", "(", "new", "ScanRangeStatus", "(", "taskId", "++", ",", "placement", ",", "scanRange", ",", "batchId", ",", "blockingBatch", ",", "concurrency", ")", ")", ";", "}", "}", "lastBatchId", "=", "batchId", ";", "batchId", "++", ";", "}", "batch", "=", "batch", ".", "getNextBatch", "(", ")", ";", "}", "}", "return", "new", "ScanStatus", "(", "_scanId", ",", "_options", ",", "false", ",", "false", ",", "new", "Date", "(", ")", ",", "pendingRangeStatuses", ",", "ImmutableList", ".", "<", "ScanRangeStatus", ">", "of", "(", ")", ",", "ImmutableList", ".", "<", "ScanRangeStatus", ">", "of", "(", ")", ")", ";", "}" ]
Creates a ScanStatus based on the current state of the plan. All scan ranges are added as pending tasks.
[ "Creates", "a", "ScanStatus", "based", "on", "the", "current", "state", "of", "the", "plan", ".", "All", "scan", "ranges", "are", "added", "as", "pending", "tasks", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/web/src/main/java/com/bazaarvoice/emodb/web/scanner/control/ScanPlan.java#L94-L133
apereo/cas
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/HttpUtils.java
HttpUtils.executePost
public static HttpResponse executePost(final String url, final String entity, final Map<String, Object> parameters) { """ Execute post http response. @param url the url @param entity the json entity @param parameters the parameters @return the http response """ return executePost(url, null, null, entity, parameters); }
java
public static HttpResponse executePost(final String url, final String entity, final Map<String, Object> parameters) { return executePost(url, null, null, entity, parameters); }
[ "public", "static", "HttpResponse", "executePost", "(", "final", "String", "url", ",", "final", "String", "entity", ",", "final", "Map", "<", "String", ",", "Object", ">", "parameters", ")", "{", "return", "executePost", "(", "url", ",", "null", ",", "null", ",", "entity", ",", "parameters", ")", ";", "}" ]
Execute post http response. @param url the url @param entity the json entity @param parameters the parameters @return the http response
[ "Execute", "post", "http", "response", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/HttpUtils.java#L324-L328
looly/hutool
hutool-socket/src/main/java/cn/hutool/socket/nio/NioServer.java
NioServer.registerChannel
private void registerChannel(Selector selector, SelectableChannel channel, Operation ops) { """ 注册通道到指定Selector上 @param selector Selector @param channel 通道 @param ops 注册的通道监听类型 """ if (channel == null) { return; } try { channel.configureBlocking(false); // 注册通道 channel.register(selector, ops.getValue()); } catch (IOException e) { throw new IORuntimeException(e); } }
java
private void registerChannel(Selector selector, SelectableChannel channel, Operation ops) { if (channel == null) { return; } try { channel.configureBlocking(false); // 注册通道 channel.register(selector, ops.getValue()); } catch (IOException e) { throw new IORuntimeException(e); } }
[ "private", "void", "registerChannel", "(", "Selector", "selector", ",", "SelectableChannel", "channel", ",", "Operation", "ops", ")", "{", "if", "(", "channel", "==", "null", ")", "{", "return", ";", "}", "try", "{", "channel", ".", "configureBlocking", "(", "false", ")", ";", "// 注册通道\r", "channel", ".", "register", "(", "selector", ",", "ops", ".", "getValue", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "IORuntimeException", "(", "e", ")", ";", "}", "}" ]
注册通道到指定Selector上 @param selector Selector @param channel 通道 @param ops 注册的通道监听类型
[ "注册通道到指定Selector上" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-socket/src/main/java/cn/hutool/socket/nio/NioServer.java#L161-L173
deeplearning4j/deeplearning4j
datavec/datavec-spark/src/main/java/org/datavec/spark/transform/AnalyzeSpark.java
AnalyzeSpark.analyzeQualitySequence
public static DataQualityAnalysis analyzeQualitySequence(Schema schema, JavaRDD<List<List<Writable>>> data) { """ Analyze the data quality of sequence data - provides a report on missing values, values that don't comply with schema, etc @param schema Schema for data @param data Data to analyze @return DataQualityAnalysis object """ JavaRDD<List<Writable>> fmSeq = data.flatMap(new SequenceFlatMapFunction()); return analyzeQuality(schema, fmSeq); }
java
public static DataQualityAnalysis analyzeQualitySequence(Schema schema, JavaRDD<List<List<Writable>>> data) { JavaRDD<List<Writable>> fmSeq = data.flatMap(new SequenceFlatMapFunction()); return analyzeQuality(schema, fmSeq); }
[ "public", "static", "DataQualityAnalysis", "analyzeQualitySequence", "(", "Schema", "schema", ",", "JavaRDD", "<", "List", "<", "List", "<", "Writable", ">", ">", ">", "data", ")", "{", "JavaRDD", "<", "List", "<", "Writable", ">>", "fmSeq", "=", "data", ".", "flatMap", "(", "new", "SequenceFlatMapFunction", "(", ")", ")", ";", "return", "analyzeQuality", "(", "schema", ",", "fmSeq", ")", ";", "}" ]
Analyze the data quality of sequence data - provides a report on missing values, values that don't comply with schema, etc @param schema Schema for data @param data Data to analyze @return DataQualityAnalysis object
[ "Analyze", "the", "data", "quality", "of", "sequence", "data", "-", "provides", "a", "report", "on", "missing", "values", "values", "that", "don", "t", "comply", "with", "schema", "etc" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/AnalyzeSpark.java#L277-L280
jakenjarvis/Android-OrmLiteContentProvider
ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java
MatcherController.add
public MatcherController add(Class<?> tableClassType, SubType subType, String pattern, int patternCode) { """ Register a class for table. And registers a pattern for UriMatcher. @param tableClassType Register a class for table. @param subType Contents to be registered in the pattern, specify single or multiple. This is used in the MIME types. * ITEM : If the URI pattern is for a single row : vnd.android.cursor.item/ * DIRECTORY : If the URI pattern is for more than one row : vnd.android.cursor.dir/ @param pattern registers a pattern for UriMatcher. Note: Must not contain the name of path here. ex) content://com.example.app.provider/table1 : pattern = "" content://com.example.app.provider/table1/# : pattern = "#" content://com.example.app.provider/table1/dataset2 : pattern = "dataset2" @param patternCode UriMatcher code is returned @return Instance of the MatcherController class. """ this.addTableClass(tableClassType); this.addMatcherPattern(subType, pattern, patternCode); return this; }
java
public MatcherController add(Class<?> tableClassType, SubType subType, String pattern, int patternCode) { this.addTableClass(tableClassType); this.addMatcherPattern(subType, pattern, patternCode); return this; }
[ "public", "MatcherController", "add", "(", "Class", "<", "?", ">", "tableClassType", ",", "SubType", "subType", ",", "String", "pattern", ",", "int", "patternCode", ")", "{", "this", ".", "addTableClass", "(", "tableClassType", ")", ";", "this", ".", "addMatcherPattern", "(", "subType", ",", "pattern", ",", "patternCode", ")", ";", "return", "this", ";", "}" ]
Register a class for table. And registers a pattern for UriMatcher. @param tableClassType Register a class for table. @param subType Contents to be registered in the pattern, specify single or multiple. This is used in the MIME types. * ITEM : If the URI pattern is for a single row : vnd.android.cursor.item/ * DIRECTORY : If the URI pattern is for more than one row : vnd.android.cursor.dir/ @param pattern registers a pattern for UriMatcher. Note: Must not contain the name of path here. ex) content://com.example.app.provider/table1 : pattern = "" content://com.example.app.provider/table1/# : pattern = "#" content://com.example.app.provider/table1/dataset2 : pattern = "dataset2" @param patternCode UriMatcher code is returned @return Instance of the MatcherController class.
[ "Register", "a", "class", "for", "table", ".", "And", "registers", "a", "pattern", "for", "UriMatcher", "." ]
train
https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java#L86-L90
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java
JobOperations.patchJob
public void patchJob(String jobId, JobPatchParameter jobPatchParameter) throws BatchErrorException, IOException { """ Updates the specified job. This method only replaces the properties specified with non-null values. @param jobId The ID of the job. @param jobPatchParameter The set of changes to be made to a job. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. """ patchJob(jobId, jobPatchParameter, null); }
java
public void patchJob(String jobId, JobPatchParameter jobPatchParameter) throws BatchErrorException, IOException { patchJob(jobId, jobPatchParameter, null); }
[ "public", "void", "patchJob", "(", "String", "jobId", ",", "JobPatchParameter", "jobPatchParameter", ")", "throws", "BatchErrorException", ",", "IOException", "{", "patchJob", "(", "jobId", ",", "jobPatchParameter", ",", "null", ")", ";", "}" ]
Updates the specified job. This method only replaces the properties specified with non-null values. @param jobId The ID of the job. @param jobPatchParameter The set of changes to be made to a job. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Updates", "the", "specified", "job", ".", "This", "method", "only", "replaces", "the", "properties", "specified", "with", "non", "-", "null", "values", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java#L574-L576
terrestris/shogun-core
src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/UserService.java
UserService.registerUser
public E registerUser(E user, HttpServletRequest request) throws Exception { """ Registers a new user. Initially, the user will be inactive. An email with an activation link will be sent to the user. @param user A user with an UNencrypted password (!) @param request @throws Exception """ String email = user.getEmail(); // check if a user with the email already exists E existingUser = dao.findByEmail(email); if (existingUser != null) { final String errorMessage = "User with eMail '" + email + "' already exists."; LOG.info(errorMessage); throw new Exception(errorMessage); } user = (E) this.persistNewUser(user, true); // create a token for the user and send an email with an "activation" link registrationTokenService.sendRegistrationActivationMail(request, user); return user; }
java
public E registerUser(E user, HttpServletRequest request) throws Exception { String email = user.getEmail(); // check if a user with the email already exists E existingUser = dao.findByEmail(email); if (existingUser != null) { final String errorMessage = "User with eMail '" + email + "' already exists."; LOG.info(errorMessage); throw new Exception(errorMessage); } user = (E) this.persistNewUser(user, true); // create a token for the user and send an email with an "activation" link registrationTokenService.sendRegistrationActivationMail(request, user); return user; }
[ "public", "E", "registerUser", "(", "E", "user", ",", "HttpServletRequest", "request", ")", "throws", "Exception", "{", "String", "email", "=", "user", ".", "getEmail", "(", ")", ";", "// check if a user with the email already exists", "E", "existingUser", "=", "dao", ".", "findByEmail", "(", "email", ")", ";", "if", "(", "existingUser", "!=", "null", ")", "{", "final", "String", "errorMessage", "=", "\"User with eMail '\"", "+", "email", "+", "\"' already exists.\"", ";", "LOG", ".", "info", "(", "errorMessage", ")", ";", "throw", "new", "Exception", "(", "errorMessage", ")", ";", "}", "user", "=", "(", "E", ")", "this", ".", "persistNewUser", "(", "user", ",", "true", ")", ";", "// create a token for the user and send an email with an \"activation\" link", "registrationTokenService", ".", "sendRegistrationActivationMail", "(", "request", ",", "user", ")", ";", "return", "user", ";", "}" ]
Registers a new user. Initially, the user will be inactive. An email with an activation link will be sent to the user. @param user A user with an UNencrypted password (!) @param request @throws Exception
[ "Registers", "a", "new", "user", ".", "Initially", "the", "user", "will", "be", "inactive", ".", "An", "email", "with", "an", "activation", "link", "will", "be", "sent", "to", "the", "user", "." ]
train
https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/UserService.java#L122-L141
box/box-java-sdk
src/main/java/com/box/sdk/BoxGroup.java
BoxGroup.getMemberships
public Collection<BoxGroupMembership.Info> getMemberships() { """ Gets information about all of the group memberships for this group. Does not support paging. @return a collection of information about the group memberships for this group. """ final BoxAPIConnection api = this.getAPI(); final String groupID = this.getID(); Iterable<BoxGroupMembership.Info> iter = new Iterable<BoxGroupMembership.Info>() { public Iterator<BoxGroupMembership.Info> iterator() { URL url = MEMBERSHIPS_URL_TEMPLATE.build(api.getBaseURL(), groupID); return new BoxGroupMembershipIterator(api, url); } }; // We need to iterate all results because this method must return a Collection. This logic should be removed in // the next major version, and instead return the Iterable directly. Collection<BoxGroupMembership.Info> memberships = new ArrayList<BoxGroupMembership.Info>(); for (BoxGroupMembership.Info membership : iter) { memberships.add(membership); } return memberships; }
java
public Collection<BoxGroupMembership.Info> getMemberships() { final BoxAPIConnection api = this.getAPI(); final String groupID = this.getID(); Iterable<BoxGroupMembership.Info> iter = new Iterable<BoxGroupMembership.Info>() { public Iterator<BoxGroupMembership.Info> iterator() { URL url = MEMBERSHIPS_URL_TEMPLATE.build(api.getBaseURL(), groupID); return new BoxGroupMembershipIterator(api, url); } }; // We need to iterate all results because this method must return a Collection. This logic should be removed in // the next major version, and instead return the Iterable directly. Collection<BoxGroupMembership.Info> memberships = new ArrayList<BoxGroupMembership.Info>(); for (BoxGroupMembership.Info membership : iter) { memberships.add(membership); } return memberships; }
[ "public", "Collection", "<", "BoxGroupMembership", ".", "Info", ">", "getMemberships", "(", ")", "{", "final", "BoxAPIConnection", "api", "=", "this", ".", "getAPI", "(", ")", ";", "final", "String", "groupID", "=", "this", ".", "getID", "(", ")", ";", "Iterable", "<", "BoxGroupMembership", ".", "Info", ">", "iter", "=", "new", "Iterable", "<", "BoxGroupMembership", ".", "Info", ">", "(", ")", "{", "public", "Iterator", "<", "BoxGroupMembership", ".", "Info", ">", "iterator", "(", ")", "{", "URL", "url", "=", "MEMBERSHIPS_URL_TEMPLATE", ".", "build", "(", "api", ".", "getBaseURL", "(", ")", ",", "groupID", ")", ";", "return", "new", "BoxGroupMembershipIterator", "(", "api", ",", "url", ")", ";", "}", "}", ";", "// We need to iterate all results because this method must return a Collection. This logic should be removed in", "// the next major version, and instead return the Iterable directly.", "Collection", "<", "BoxGroupMembership", ".", "Info", ">", "memberships", "=", "new", "ArrayList", "<", "BoxGroupMembership", ".", "Info", ">", "(", ")", ";", "for", "(", "BoxGroupMembership", ".", "Info", "membership", ":", "iter", ")", "{", "memberships", ".", "add", "(", "membership", ")", ";", "}", "return", "memberships", ";", "}" ]
Gets information about all of the group memberships for this group. Does not support paging. @return a collection of information about the group memberships for this group.
[ "Gets", "information", "about", "all", "of", "the", "group", "memberships", "for", "this", "group", ".", "Does", "not", "support", "paging", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxGroup.java#L200-L218
Azure/azure-sdk-for-java
authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentsInner.java
RoleAssignmentsInner.createAsync
public Observable<RoleAssignmentInner> createAsync(String scope, String roleAssignmentName, RoleAssignmentCreateParameters parameters) { """ Creates a role assignment. @param scope The scope of the role assignment to create. The scope can be any REST resource instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' for a resource. @param roleAssignmentName The name of the role assignment to create. It can be any valid GUID. @param parameters Parameters for the role assignment. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RoleAssignmentInner object """ return createWithServiceResponseAsync(scope, roleAssignmentName, parameters).map(new Func1<ServiceResponse<RoleAssignmentInner>, RoleAssignmentInner>() { @Override public RoleAssignmentInner call(ServiceResponse<RoleAssignmentInner> response) { return response.body(); } }); }
java
public Observable<RoleAssignmentInner> createAsync(String scope, String roleAssignmentName, RoleAssignmentCreateParameters parameters) { return createWithServiceResponseAsync(scope, roleAssignmentName, parameters).map(new Func1<ServiceResponse<RoleAssignmentInner>, RoleAssignmentInner>() { @Override public RoleAssignmentInner call(ServiceResponse<RoleAssignmentInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RoleAssignmentInner", ">", "createAsync", "(", "String", "scope", ",", "String", "roleAssignmentName", ",", "RoleAssignmentCreateParameters", "parameters", ")", "{", "return", "createWithServiceResponseAsync", "(", "scope", ",", "roleAssignmentName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "RoleAssignmentInner", ">", ",", "RoleAssignmentInner", ">", "(", ")", "{", "@", "Override", "public", "RoleAssignmentInner", "call", "(", "ServiceResponse", "<", "RoleAssignmentInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates a role assignment. @param scope The scope of the role assignment to create. The scope can be any REST resource instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' for a resource. @param roleAssignmentName The name of the role assignment to create. It can be any valid GUID. @param parameters Parameters for the role assignment. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RoleAssignmentInner object
[ "Creates", "a", "role", "assignment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentsInner.java#L758-L765
alkacon/opencms-core
src/org/opencms/ui/apps/user/CmsImportExportUserDialog.java
CmsImportExportUserDialog.getExportUserDialogForOU
public static CmsImportExportUserDialog getExportUserDialogForOU( String ou, Window window, boolean allowTechnicalFieldsExport) { """ Gets an dialog instance for fixed group.<p> @param ou ou name @param window window @param allowTechnicalFieldsExport flag indicates if technical field export option should be available @return an instance of this class """ CmsImportExportUserDialog res = new CmsImportExportUserDialog(ou, null, window, allowTechnicalFieldsExport); return res; }
java
public static CmsImportExportUserDialog getExportUserDialogForOU( String ou, Window window, boolean allowTechnicalFieldsExport) { CmsImportExportUserDialog res = new CmsImportExportUserDialog(ou, null, window, allowTechnicalFieldsExport); return res; }
[ "public", "static", "CmsImportExportUserDialog", "getExportUserDialogForOU", "(", "String", "ou", ",", "Window", "window", ",", "boolean", "allowTechnicalFieldsExport", ")", "{", "CmsImportExportUserDialog", "res", "=", "new", "CmsImportExportUserDialog", "(", "ou", ",", "null", ",", "window", ",", "allowTechnicalFieldsExport", ")", ";", "return", "res", ";", "}" ]
Gets an dialog instance for fixed group.<p> @param ou ou name @param window window @param allowTechnicalFieldsExport flag indicates if technical field export option should be available @return an instance of this class
[ "Gets", "an", "dialog", "instance", "for", "fixed", "group", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsImportExportUserDialog.java#L471-L478
box/box-java-sdk
src/main/java/com/box/sdk/BoxItem.java
BoxItem.getSharedItem
public static BoxItem.Info getSharedItem(BoxAPIConnection api, String sharedLink, String password) { """ Gets an item that was shared with a password-protected shared link. @param api the API connection to be used by the shared item. @param sharedLink the shared link to the item. @param password the password for the shared link. @return info about the shared item. """ BoxAPIConnection newAPI = new SharedLinkAPIConnection(api, sharedLink, password); URL url = SHARED_ITEM_URL_TEMPLATE.build(newAPI.getBaseURL()); BoxAPIRequest request = new BoxAPIRequest(newAPI, url, "GET"); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject json = JsonObject.readFrom(response.getJSON()); return (BoxItem.Info) BoxResource.parseInfo(newAPI, json); }
java
public static BoxItem.Info getSharedItem(BoxAPIConnection api, String sharedLink, String password) { BoxAPIConnection newAPI = new SharedLinkAPIConnection(api, sharedLink, password); URL url = SHARED_ITEM_URL_TEMPLATE.build(newAPI.getBaseURL()); BoxAPIRequest request = new BoxAPIRequest(newAPI, url, "GET"); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject json = JsonObject.readFrom(response.getJSON()); return (BoxItem.Info) BoxResource.parseInfo(newAPI, json); }
[ "public", "static", "BoxItem", ".", "Info", "getSharedItem", "(", "BoxAPIConnection", "api", ",", "String", "sharedLink", ",", "String", "password", ")", "{", "BoxAPIConnection", "newAPI", "=", "new", "SharedLinkAPIConnection", "(", "api", ",", "sharedLink", ",", "password", ")", ";", "URL", "url", "=", "SHARED_ITEM_URL_TEMPLATE", ".", "build", "(", "newAPI", ".", "getBaseURL", "(", ")", ")", ";", "BoxAPIRequest", "request", "=", "new", "BoxAPIRequest", "(", "newAPI", ",", "url", ",", "\"GET\"", ")", ";", "BoxJSONResponse", "response", "=", "(", "BoxJSONResponse", ")", "request", ".", "send", "(", ")", ";", "JsonObject", "json", "=", "JsonObject", ".", "readFrom", "(", "response", ".", "getJSON", "(", ")", ")", ";", "return", "(", "BoxItem", ".", "Info", ")", "BoxResource", ".", "parseInfo", "(", "newAPI", ",", "json", ")", ";", "}" ]
Gets an item that was shared with a password-protected shared link. @param api the API connection to be used by the shared item. @param sharedLink the shared link to the item. @param password the password for the shared link. @return info about the shared item.
[ "Gets", "an", "item", "that", "was", "shared", "with", "a", "password", "-", "protected", "shared", "link", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxItem.java#L71-L78
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ConfusingArrayAsList.java
ConfusingArrayAsList.sawOpcode
@Override public void sawOpcode(int seen) { """ implements the visitor to find calls to Arrays.asList with a primitive array @param seen the currently visitor opcode """ try { stack.precomputation(this); if (seen == Const.INVOKESTATIC) { String clsName = getClassConstantOperand(); if ("java/util/Arrays".equals(clsName)) { String methodName = getNameConstantOperand(); if ("asList".equals(methodName) && (stack.getStackDepth() >= 1)) { OpcodeStack.Item item = stack.getStackItem(0); String sig = item.getSignature(); if (PRIMITIVE_ARRAYS.contains(sig)) { Object con = item.getConstant(); if (!(con instanceof Integer) || (((Integer) con).intValue() <= 1)) { bugReporter.reportBug(new BugInstance(this, BugType.CAAL_CONFUSING_ARRAY_AS_LIST.name(), NORMAL_PRIORITY).addClass(this) .addMethod(this).addSourceLine(this)); } } } } } } finally { stack.sawOpcode(this, seen); } }
java
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if (seen == Const.INVOKESTATIC) { String clsName = getClassConstantOperand(); if ("java/util/Arrays".equals(clsName)) { String methodName = getNameConstantOperand(); if ("asList".equals(methodName) && (stack.getStackDepth() >= 1)) { OpcodeStack.Item item = stack.getStackItem(0); String sig = item.getSignature(); if (PRIMITIVE_ARRAYS.contains(sig)) { Object con = item.getConstant(); if (!(con instanceof Integer) || (((Integer) con).intValue() <= 1)) { bugReporter.reportBug(new BugInstance(this, BugType.CAAL_CONFUSING_ARRAY_AS_LIST.name(), NORMAL_PRIORITY).addClass(this) .addMethod(this).addSourceLine(this)); } } } } } } finally { stack.sawOpcode(this, seen); } }
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "if", "(", "seen", "==", "Const", ".", "INVOKESTATIC", ")", "{", "String", "clsName", "=", "getClassConstantOperand", "(", ")", ";", "if", "(", "\"java/util/Arrays\"", ".", "equals", "(", "clsName", ")", ")", "{", "String", "methodName", "=", "getNameConstantOperand", "(", ")", ";", "if", "(", "\"asList\"", ".", "equals", "(", "methodName", ")", "&&", "(", "stack", ".", "getStackDepth", "(", ")", ">=", "1", ")", ")", "{", "OpcodeStack", ".", "Item", "item", "=", "stack", ".", "getStackItem", "(", "0", ")", ";", "String", "sig", "=", "item", ".", "getSignature", "(", ")", ";", "if", "(", "PRIMITIVE_ARRAYS", ".", "contains", "(", "sig", ")", ")", "{", "Object", "con", "=", "item", ".", "getConstant", "(", ")", ";", "if", "(", "!", "(", "con", "instanceof", "Integer", ")", "||", "(", "(", "(", "Integer", ")", "con", ")", ".", "intValue", "(", ")", "<=", "1", ")", ")", "{", "bugReporter", ".", "reportBug", "(", "new", "BugInstance", "(", "this", ",", "BugType", ".", "CAAL_CONFUSING_ARRAY_AS_LIST", ".", "name", "(", ")", ",", "NORMAL_PRIORITY", ")", ".", "addClass", "(", "this", ")", ".", "addMethod", "(", "this", ")", ".", "addSourceLine", "(", "this", ")", ")", ";", "}", "}", "}", "}", "}", "}", "finally", "{", "stack", ".", "sawOpcode", "(", "this", ",", "seen", ")", ";", "}", "}" ]
implements the visitor to find calls to Arrays.asList with a primitive array @param seen the currently visitor opcode
[ "implements", "the", "visitor", "to", "find", "calls", "to", "Arrays", ".", "asList", "with", "a", "primitive", "array" ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ConfusingArrayAsList.java#L97-L122
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/matrix/AtomicGrowingMatrix.java
AtomicGrowingMatrix.getRow
private AtomicVector getRow(int row, int col, boolean createIfAbsent) { """ Gets the {@code AtomicVector} associated with the index, or {@code null} if no row entry is present, or if {@code createIfAbsent} is {@code true}, creates the missing row and returns that. @param row the row to get @param col the column in the row that will be accessed or {@code -1} if the entire row is needed. This value is only used to resize the matrix dimensions if the row is to be created. @param createIfAbsent {@true} if a row that is requested but not present should be created @return the row at the entry or {@code null} if the row is not present and it was not to be created if absent """ rowReadLock.lock(); AtomicVector rowEntry = sparseMatrix.get(row); rowReadLock.unlock(); // If no row existed, create one if (rowEntry == null && createIfAbsent) { rowWriteLock.lock(); // ensure that another thread has not already added this row while // this thread was waiting on the lock rowEntry = sparseMatrix.get(row); if (rowEntry == null) { rowEntry = new AtomicVector(new CompactSparseVector()); // update the bounds as necessary if (row >= rows.get()) { rows.set(row + 1); } if (col >= cols.get()) { cols.set(col + 1); } sparseMatrix.put(row, rowEntry); } rowWriteLock.unlock(); } return rowEntry; }
java
private AtomicVector getRow(int row, int col, boolean createIfAbsent) { rowReadLock.lock(); AtomicVector rowEntry = sparseMatrix.get(row); rowReadLock.unlock(); // If no row existed, create one if (rowEntry == null && createIfAbsent) { rowWriteLock.lock(); // ensure that another thread has not already added this row while // this thread was waiting on the lock rowEntry = sparseMatrix.get(row); if (rowEntry == null) { rowEntry = new AtomicVector(new CompactSparseVector()); // update the bounds as necessary if (row >= rows.get()) { rows.set(row + 1); } if (col >= cols.get()) { cols.set(col + 1); } sparseMatrix.put(row, rowEntry); } rowWriteLock.unlock(); } return rowEntry; }
[ "private", "AtomicVector", "getRow", "(", "int", "row", ",", "int", "col", ",", "boolean", "createIfAbsent", ")", "{", "rowReadLock", ".", "lock", "(", ")", ";", "AtomicVector", "rowEntry", "=", "sparseMatrix", ".", "get", "(", "row", ")", ";", "rowReadLock", ".", "unlock", "(", ")", ";", "// If no row existed, create one", "if", "(", "rowEntry", "==", "null", "&&", "createIfAbsent", ")", "{", "rowWriteLock", ".", "lock", "(", ")", ";", "// ensure that another thread has not already added this row while", "// this thread was waiting on the lock", "rowEntry", "=", "sparseMatrix", ".", "get", "(", "row", ")", ";", "if", "(", "rowEntry", "==", "null", ")", "{", "rowEntry", "=", "new", "AtomicVector", "(", "new", "CompactSparseVector", "(", ")", ")", ";", "// update the bounds as necessary", "if", "(", "row", ">=", "rows", ".", "get", "(", ")", ")", "{", "rows", ".", "set", "(", "row", "+", "1", ")", ";", "}", "if", "(", "col", ">=", "cols", ".", "get", "(", ")", ")", "{", "cols", ".", "set", "(", "col", "+", "1", ")", ";", "}", "sparseMatrix", ".", "put", "(", "row", ",", "rowEntry", ")", ";", "}", "rowWriteLock", ".", "unlock", "(", ")", ";", "}", "return", "rowEntry", ";", "}" ]
Gets the {@code AtomicVector} associated with the index, or {@code null} if no row entry is present, or if {@code createIfAbsent} is {@code true}, creates the missing row and returns that. @param row the row to get @param col the column in the row that will be accessed or {@code -1} if the entire row is needed. This value is only used to resize the matrix dimensions if the row is to be created. @param createIfAbsent {@true} if a row that is requested but not present should be created @return the row at the entry or {@code null} if the row is not present and it was not to be created if absent
[ "Gets", "the", "{", "@code", "AtomicVector", "}", "associated", "with", "the", "index", "or", "{", "@code", "null", "}", "if", "no", "row", "entry", "is", "present", "or", "if", "{", "@code", "createIfAbsent", "}", "is", "{", "@code", "true", "}", "creates", "the", "missing", "row", "and", "returns", "that", "." ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/matrix/AtomicGrowingMatrix.java#L231-L257
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.getCertificateOperationAsync
public Observable<CertificateOperation> getCertificateOperationAsync(String vaultBaseUrl, String certificateName) { """ Gets the creation operation of a certificate. Gets the creation operation associated with a specified certificate. This operation requires the certificates/get permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the CertificateOperation object """ return getCertificateOperationWithServiceResponseAsync(vaultBaseUrl, certificateName).map(new Func1<ServiceResponse<CertificateOperation>, CertificateOperation>() { @Override public CertificateOperation call(ServiceResponse<CertificateOperation> response) { return response.body(); } }); }
java
public Observable<CertificateOperation> getCertificateOperationAsync(String vaultBaseUrl, String certificateName) { return getCertificateOperationWithServiceResponseAsync(vaultBaseUrl, certificateName).map(new Func1<ServiceResponse<CertificateOperation>, CertificateOperation>() { @Override public CertificateOperation call(ServiceResponse<CertificateOperation> response) { return response.body(); } }); }
[ "public", "Observable", "<", "CertificateOperation", ">", "getCertificateOperationAsync", "(", "String", "vaultBaseUrl", ",", "String", "certificateName", ")", "{", "return", "getCertificateOperationWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "certificateName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "CertificateOperation", ">", ",", "CertificateOperation", ">", "(", ")", "{", "@", "Override", "public", "CertificateOperation", "call", "(", "ServiceResponse", "<", "CertificateOperation", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets the creation operation of a certificate. Gets the creation operation associated with a specified certificate. This operation requires the certificates/get permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the CertificateOperation object
[ "Gets", "the", "creation", "operation", "of", "a", "certificate", ".", "Gets", "the", "creation", "operation", "associated", "with", "a", "specified", "certificate", ".", "This", "operation", "requires", "the", "certificates", "/", "get", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L7761-L7768
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java
XmlUtil.xmlToMap
public static Map<String, Object> xmlToMap(String xmlStr, Map<String, Object> result) { """ XML格式字符串转换为Map<br> 只支持第一级别的XML,不支持多级XML @param xmlStr XML字符串 @param result 结果Map类型 @return XML数据转换后的Map @since 4.0.8 """ final Document doc = parseXml(xmlStr); final Element root = getRootElement(doc); root.normalize(); return xmlToMap(root, result); }
java
public static Map<String, Object> xmlToMap(String xmlStr, Map<String, Object> result) { final Document doc = parseXml(xmlStr); final Element root = getRootElement(doc); root.normalize(); return xmlToMap(root, result); }
[ "public", "static", "Map", "<", "String", ",", "Object", ">", "xmlToMap", "(", "String", "xmlStr", ",", "Map", "<", "String", ",", "Object", ">", "result", ")", "{", "final", "Document", "doc", "=", "parseXml", "(", "xmlStr", ")", ";", "final", "Element", "root", "=", "getRootElement", "(", "doc", ")", ";", "root", ".", "normalize", "(", ")", ";", "return", "xmlToMap", "(", "root", ",", "result", ")", ";", "}" ]
XML格式字符串转换为Map<br> 只支持第一级别的XML,不支持多级XML @param xmlStr XML字符串 @param result 结果Map类型 @return XML数据转换后的Map @since 4.0.8
[ "XML格式字符串转换为Map<br", ">", "只支持第一级别的XML,不支持多级XML" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L697-L703
joniles/mpxj
src/main/java/net/sf/mpxj/explorer/ProjectTreeController.java
ProjectTreeController.saveFile
public void saveFile(File file, String type) { """ Save the current file as the given type. @param file target file @param type file type """ try { Class<? extends ProjectWriter> fileClass = WRITER_MAP.get(type); if (fileClass == null) { throw new IllegalArgumentException("Cannot write files of type: " + type); } ProjectWriter writer = fileClass.newInstance(); writer.write(m_projectFile, file); } catch (Exception ex) { throw new RuntimeException(ex); } }
java
public void saveFile(File file, String type) { try { Class<? extends ProjectWriter> fileClass = WRITER_MAP.get(type); if (fileClass == null) { throw new IllegalArgumentException("Cannot write files of type: " + type); } ProjectWriter writer = fileClass.newInstance(); writer.write(m_projectFile, file); } catch (Exception ex) { throw new RuntimeException(ex); } }
[ "public", "void", "saveFile", "(", "File", "file", ",", "String", "type", ")", "{", "try", "{", "Class", "<", "?", "extends", "ProjectWriter", ">", "fileClass", "=", "WRITER_MAP", ".", "get", "(", "type", ")", ";", "if", "(", "fileClass", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Cannot write files of type: \"", "+", "type", ")", ";", "}", "ProjectWriter", "writer", "=", "fileClass", ".", "newInstance", "(", ")", ";", "writer", ".", "write", "(", "m_projectFile", ",", "file", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "new", "RuntimeException", "(", "ex", ")", ";", "}", "}" ]
Save the current file as the given type. @param file target file @param type file type
[ "Save", "the", "current", "file", "as", "the", "given", "type", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/ProjectTreeController.java#L514-L532
BioPAX/Paxtools
pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java
MinerAdapter.getGeneSymbol
protected String getGeneSymbol(Match m, String label) { """ Searches for the gene symbol of the given EntityReference. @param m current match @param label label of the related EntityReference in the pattern @return symbol """ ProteinReference pr = (ProteinReference) m.get(label, getPattern()); return getGeneSymbol(pr); }
java
protected String getGeneSymbol(Match m, String label) { ProteinReference pr = (ProteinReference) m.get(label, getPattern()); return getGeneSymbol(pr); }
[ "protected", "String", "getGeneSymbol", "(", "Match", "m", ",", "String", "label", ")", "{", "ProteinReference", "pr", "=", "(", "ProteinReference", ")", "m", ".", "get", "(", "label", ",", "getPattern", "(", ")", ")", ";", "return", "getGeneSymbol", "(", "pr", ")", ";", "}" ]
Searches for the gene symbol of the given EntityReference. @param m current match @param label label of the related EntityReference in the pattern @return symbol
[ "Searches", "for", "the", "gene", "symbol", "of", "the", "given", "EntityReference", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java#L208-L212
Domo42/saga-lib
saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaKeyReaderExtractor.java
SagaKeyReaderExtractor.tryGetKeyReader
private KeyReader tryGetKeyReader(final Class<? extends Saga> sagaClazz, final Object message) { """ Does not throw an exception when accessing the loading cache for key readers. """ KeyReader reader; try { Optional<KeyReader> cachedReader = knownReaders.get( SagaMessageKey.forMessage(sagaClazz, message), () -> { KeyReader foundReader = findReader(sagaClazz, message); return Optional.fromNullable(foundReader); }); reader = cachedReader.orNull(); } catch (Exception ex) { LOG.error("Error searching for reader to extract saga key. sagatype = {}, message = {}", sagaClazz, message, ex); reader = null; } return reader; }
java
private KeyReader tryGetKeyReader(final Class<? extends Saga> sagaClazz, final Object message) { KeyReader reader; try { Optional<KeyReader> cachedReader = knownReaders.get( SagaMessageKey.forMessage(sagaClazz, message), () -> { KeyReader foundReader = findReader(sagaClazz, message); return Optional.fromNullable(foundReader); }); reader = cachedReader.orNull(); } catch (Exception ex) { LOG.error("Error searching for reader to extract saga key. sagatype = {}, message = {}", sagaClazz, message, ex); reader = null; } return reader; }
[ "private", "KeyReader", "tryGetKeyReader", "(", "final", "Class", "<", "?", "extends", "Saga", ">", "sagaClazz", ",", "final", "Object", "message", ")", "{", "KeyReader", "reader", ";", "try", "{", "Optional", "<", "KeyReader", ">", "cachedReader", "=", "knownReaders", ".", "get", "(", "SagaMessageKey", ".", "forMessage", "(", "sagaClazz", ",", "message", ")", ",", "(", ")", "->", "{", "KeyReader", "foundReader", "=", "findReader", "(", "sagaClazz", ",", "message", ")", ";", "return", "Optional", ".", "fromNullable", "(", "foundReader", ")", ";", "}", ")", ";", "reader", "=", "cachedReader", ".", "orNull", "(", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "LOG", ".", "error", "(", "\"Error searching for reader to extract saga key. sagatype = {}, message = {}\"", ",", "sagaClazz", ",", "message", ",", "ex", ")", ";", "reader", "=", "null", ";", "}", "return", "reader", ";", "}" ]
Does not throw an exception when accessing the loading cache for key readers.
[ "Does", "not", "throw", "an", "exception", "when", "accessing", "the", "loading", "cache", "for", "key", "readers", "." ]
train
https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaKeyReaderExtractor.java#L71-L88
gallandarakhneorg/afc
core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java
GraphPath.splitAtLast
public GP splitAtLast(ST obj, PT startPoint) { """ Split this path and retains the first part of the part in this object and reply the second part. The last occurence of the specified element will be in the second part. <p>This function removes until the <i>last occurence</i> of the given object. @param obj the reference segment. @param startPoint is the starting point of the searched segment. @return the rest of the path after the last occurence of the given element. """ return splitAt(lastIndexOf(obj, startPoint), true); }
java
public GP splitAtLast(ST obj, PT startPoint) { return splitAt(lastIndexOf(obj, startPoint), true); }
[ "public", "GP", "splitAtLast", "(", "ST", "obj", ",", "PT", "startPoint", ")", "{", "return", "splitAt", "(", "lastIndexOf", "(", "obj", ",", "startPoint", ")", ",", "true", ")", ";", "}" ]
Split this path and retains the first part of the part in this object and reply the second part. The last occurence of the specified element will be in the second part. <p>This function removes until the <i>last occurence</i> of the given object. @param obj the reference segment. @param startPoint is the starting point of the searched segment. @return the rest of the path after the last occurence of the given element.
[ "Split", "this", "path", "and", "retains", "the", "first", "part", "of", "the", "part", "in", "this", "object", "and", "reply", "the", "second", "part", ".", "The", "last", "occurence", "of", "the", "specified", "element", "will", "be", "in", "the", "second", "part", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java#L1188-L1190
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java
SqlQueryStatement.appendParameter
private void appendParameter(Object value, StringBuffer buf) { """ Append the Parameter Add the place holder ? or the SubQuery @param value the value of the criteria """ if (value instanceof Query) { appendSubQuery((Query) value, buf); } else { buf.append("?"); } }
java
private void appendParameter(Object value, StringBuffer buf) { if (value instanceof Query) { appendSubQuery((Query) value, buf); } else { buf.append("?"); } }
[ "private", "void", "appendParameter", "(", "Object", "value", ",", "StringBuffer", "buf", ")", "{", "if", "(", "value", "instanceof", "Query", ")", "{", "appendSubQuery", "(", "(", "Query", ")", "value", ",", "buf", ")", ";", "}", "else", "{", "buf", ".", "append", "(", "\"?\"", ")", ";", "}", "}" ]
Append the Parameter Add the place holder ? or the SubQuery @param value the value of the criteria
[ "Append", "the", "Parameter", "Add", "the", "place", "holder", "?", "or", "the", "SubQuery" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L955-L965
jpush/jmessage-api-java-client
src/main/java/cn/jmessage/api/chatroom/ChatRoomClient.java
ChatRoomClient.addChatRoomMember
public ResponseWrapper addChatRoomMember(long roomId, String... members) throws APIConnectionException, APIRequestException { """ Add members to chat room @param roomId chat room id @param members username array @return No content @throws APIConnectionException connect exception @throws APIRequestException request exception """ Preconditions.checkArgument(roomId > 0, "room id is invalid"); Preconditions.checkArgument(members != null && members.length > 0, "member should not be empty"); JsonArray array = new JsonArray(); for (String username : members) { array.add(new JsonPrimitive(username)); } return _httpClient.sendPut(_baseUrl + mChatRoomPath + "/" + roomId + "/members", array.toString()); }
java
public ResponseWrapper addChatRoomMember(long roomId, String... members) throws APIConnectionException, APIRequestException { Preconditions.checkArgument(roomId > 0, "room id is invalid"); Preconditions.checkArgument(members != null && members.length > 0, "member should not be empty"); JsonArray array = new JsonArray(); for (String username : members) { array.add(new JsonPrimitive(username)); } return _httpClient.sendPut(_baseUrl + mChatRoomPath + "/" + roomId + "/members", array.toString()); }
[ "public", "ResponseWrapper", "addChatRoomMember", "(", "long", "roomId", ",", "String", "...", "members", ")", "throws", "APIConnectionException", ",", "APIRequestException", "{", "Preconditions", ".", "checkArgument", "(", "roomId", ">", "0", ",", "\"room id is invalid\"", ")", ";", "Preconditions", ".", "checkArgument", "(", "members", "!=", "null", "&&", "members", ".", "length", ">", "0", ",", "\"member should not be empty\"", ")", ";", "JsonArray", "array", "=", "new", "JsonArray", "(", ")", ";", "for", "(", "String", "username", ":", "members", ")", "{", "array", ".", "add", "(", "new", "JsonPrimitive", "(", "username", ")", ")", ";", "}", "return", "_httpClient", ".", "sendPut", "(", "_baseUrl", "+", "mChatRoomPath", "+", "\"/\"", "+", "roomId", "+", "\"/members\"", ",", "array", ".", "toString", "(", ")", ")", ";", "}" ]
Add members to chat room @param roomId chat room id @param members username array @return No content @throws APIConnectionException connect exception @throws APIRequestException request exception
[ "Add", "members", "to", "chat", "room" ]
train
https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/chatroom/ChatRoomClient.java#L190-L199
zaproxy/zaproxy
src/org/parosproxy/paros/extension/ExtensionLoader.java
ExtensionLoader.startLifeCycle
public void startLifeCycle(Extension ext) throws DatabaseException, DatabaseUnsupportedException { """ Initialize a specific Extension @param ext the Extension that need to be initialized @throws DatabaseUnsupportedException @throws DatabaseException """ ext.init(); ext.databaseOpen(model.getDb()); ext.initModel(model); ext.initXML(model.getSession(), model.getOptionsParam()); ext.initView(view); ExtensionHook extHook = new ExtensionHook(model, view); extensionHooks.put(ext, extHook); try { ext.hook(extHook); hookContextDataFactories(ext, extHook); hookApiImplementors(ext, extHook); if (view != null) { // no need to hook view if no GUI hookView(ext, view, extHook); hookMenu(view, extHook); } hookOptions(extHook); hookProxies(extHook); ext.optionsLoaded(); ext.postInit(); } catch (Exception e) { logExtensionInitError(ext, e); } ext.start(); Proxy proxy = Control.getSingleton().getProxy(); hookProxyListeners(proxy, extHook.getProxyListenerList()); hookOverrideMessageProxyListeners(proxy, extHook.getOverrideMessageProxyListenerList()); hookPersistentConnectionListeners(proxy, extHook.getPersistentConnectionListener()); hookConnectRequestProxyListeners(proxy, extHook.getConnectRequestProxyListeners()); if (view != null) { hookSiteMapListeners(view.getSiteTreePanel(), extHook.getSiteMapListenerList()); } }
java
public void startLifeCycle(Extension ext) throws DatabaseException, DatabaseUnsupportedException { ext.init(); ext.databaseOpen(model.getDb()); ext.initModel(model); ext.initXML(model.getSession(), model.getOptionsParam()); ext.initView(view); ExtensionHook extHook = new ExtensionHook(model, view); extensionHooks.put(ext, extHook); try { ext.hook(extHook); hookContextDataFactories(ext, extHook); hookApiImplementors(ext, extHook); if (view != null) { // no need to hook view if no GUI hookView(ext, view, extHook); hookMenu(view, extHook); } hookOptions(extHook); hookProxies(extHook); ext.optionsLoaded(); ext.postInit(); } catch (Exception e) { logExtensionInitError(ext, e); } ext.start(); Proxy proxy = Control.getSingleton().getProxy(); hookProxyListeners(proxy, extHook.getProxyListenerList()); hookOverrideMessageProxyListeners(proxy, extHook.getOverrideMessageProxyListenerList()); hookPersistentConnectionListeners(proxy, extHook.getPersistentConnectionListener()); hookConnectRequestProxyListeners(proxy, extHook.getConnectRequestProxyListeners()); if (view != null) { hookSiteMapListeners(view.getSiteTreePanel(), extHook.getSiteMapListenerList()); } }
[ "public", "void", "startLifeCycle", "(", "Extension", "ext", ")", "throws", "DatabaseException", ",", "DatabaseUnsupportedException", "{", "ext", ".", "init", "(", ")", ";", "ext", ".", "databaseOpen", "(", "model", ".", "getDb", "(", ")", ")", ";", "ext", ".", "initModel", "(", "model", ")", ";", "ext", ".", "initXML", "(", "model", ".", "getSession", "(", ")", ",", "model", ".", "getOptionsParam", "(", ")", ")", ";", "ext", ".", "initView", "(", "view", ")", ";", "ExtensionHook", "extHook", "=", "new", "ExtensionHook", "(", "model", ",", "view", ")", ";", "extensionHooks", ".", "put", "(", "ext", ",", "extHook", ")", ";", "try", "{", "ext", ".", "hook", "(", "extHook", ")", ";", "hookContextDataFactories", "(", "ext", ",", "extHook", ")", ";", "hookApiImplementors", "(", "ext", ",", "extHook", ")", ";", "if", "(", "view", "!=", "null", ")", "{", "// no need to hook view if no GUI\r", "hookView", "(", "ext", ",", "view", ",", "extHook", ")", ";", "hookMenu", "(", "view", ",", "extHook", ")", ";", "}", "hookOptions", "(", "extHook", ")", ";", "hookProxies", "(", "extHook", ")", ";", "ext", ".", "optionsLoaded", "(", ")", ";", "ext", ".", "postInit", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logExtensionInitError", "(", "ext", ",", "e", ")", ";", "}", "ext", ".", "start", "(", ")", ";", "Proxy", "proxy", "=", "Control", ".", "getSingleton", "(", ")", ".", "getProxy", "(", ")", ";", "hookProxyListeners", "(", "proxy", ",", "extHook", ".", "getProxyListenerList", "(", ")", ")", ";", "hookOverrideMessageProxyListeners", "(", "proxy", ",", "extHook", ".", "getOverrideMessageProxyListenerList", "(", ")", ")", ";", "hookPersistentConnectionListeners", "(", "proxy", ",", "extHook", ".", "getPersistentConnectionListener", "(", ")", ")", ";", "hookConnectRequestProxyListeners", "(", "proxy", ",", "extHook", ".", "getConnectRequestProxyListeners", "(", ")", ")", ";", "if", "(", "view", "!=", "null", ")", "{", "hookSiteMapListeners", "(", "view", ".", "getSiteTreePanel", "(", ")", ",", "extHook", ".", "getSiteMapListenerList", "(", ")", ")", ";", "}", "}" ]
Initialize a specific Extension @param ext the Extension that need to be initialized @throws DatabaseUnsupportedException @throws DatabaseException
[ "Initialize", "a", "specific", "Extension" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/extension/ExtensionLoader.java#L759-L799
ngageoint/geopackage-java
src/main/java/mil/nga/geopackage/tiles/ImageUtils.java
ImageUtils.isTransparent
public static boolean isTransparent(BufferedImage image, int x, int y) { """ Check if the pixel in the image at the x and y is transparent @param image image @param x x location @param y y location @return true if transparent """ int pixel = image.getRGB(x, y); boolean transparent = (pixel >> 24) == 0x00; return transparent; }
java
public static boolean isTransparent(BufferedImage image, int x, int y) { int pixel = image.getRGB(x, y); boolean transparent = (pixel >> 24) == 0x00; return transparent; }
[ "public", "static", "boolean", "isTransparent", "(", "BufferedImage", "image", ",", "int", "x", ",", "int", "y", ")", "{", "int", "pixel", "=", "image", ".", "getRGB", "(", "x", ",", "y", ")", ";", "boolean", "transparent", "=", "(", "pixel", ">>", "24", ")", "==", "0x00", ";", "return", "transparent", ";", "}" ]
Check if the pixel in the image at the x and y is transparent @param image image @param x x location @param y y location @return true if transparent
[ "Check", "if", "the", "pixel", "in", "the", "image", "at", "the", "x", "and", "y", "is", "transparent" ]
train
https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/tiles/ImageUtils.java#L112-L116
stephanenicolas/robospice
robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/request/notifier/SpiceServiceListenerNotifier.java
SpiceServiceListenerNotifier.notifyObserversOfRequestAggregated
public void notifyObserversOfRequestAggregated(CachedSpiceRequest<?> request, Set<RequestListener<?>> requestListeners) { """ Inform the observers of a request. The observers can optionally observe the new request if required. @param request the request that has been aggregated. """ RequestProcessingContext requestProcessingContext = new RequestProcessingContext(); requestProcessingContext.setExecutionThread(Thread.currentThread()); requestProcessingContext.setRequestListeners(requestListeners); post(new RequestAggregatedNotifier(request, spiceServiceListenerList, requestProcessingContext)); }
java
public void notifyObserversOfRequestAggregated(CachedSpiceRequest<?> request, Set<RequestListener<?>> requestListeners) { RequestProcessingContext requestProcessingContext = new RequestProcessingContext(); requestProcessingContext.setExecutionThread(Thread.currentThread()); requestProcessingContext.setRequestListeners(requestListeners); post(new RequestAggregatedNotifier(request, spiceServiceListenerList, requestProcessingContext)); }
[ "public", "void", "notifyObserversOfRequestAggregated", "(", "CachedSpiceRequest", "<", "?", ">", "request", ",", "Set", "<", "RequestListener", "<", "?", ">", ">", "requestListeners", ")", "{", "RequestProcessingContext", "requestProcessingContext", "=", "new", "RequestProcessingContext", "(", ")", ";", "requestProcessingContext", ".", "setExecutionThread", "(", "Thread", ".", "currentThread", "(", ")", ")", ";", "requestProcessingContext", ".", "setRequestListeners", "(", "requestListeners", ")", ";", "post", "(", "new", "RequestAggregatedNotifier", "(", "request", ",", "spiceServiceListenerList", ",", "requestProcessingContext", ")", ")", ";", "}" ]
Inform the observers of a request. The observers can optionally observe the new request if required. @param request the request that has been aggregated.
[ "Inform", "the", "observers", "of", "a", "request", ".", "The", "observers", "can", "optionally", "observe", "the", "new", "request", "if", "required", "." ]
train
https://github.com/stephanenicolas/robospice/blob/8bffde88b3534a961a13cab72a8f07a755f0a0fe/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/request/notifier/SpiceServiceListenerNotifier.java#L79-L84
grpc/grpc-java
core/src/main/java/io/grpc/internal/TransportFrameUtil.java
TransportFrameUtil.toRawSerializedHeaders
@CheckReturnValue public static byte[][] toRawSerializedHeaders(byte[][] http2Headers) { """ Transform HTTP/2-compliant headers to the raw serialized format which can be deserialized by metadata marshallers. It decodes the Base64-encoded binary headers. <p>Warning: This function may partially modify the headers in place by modifying the input array (but not modifying any single byte), so the input reference {@code http2Headers} can not be used again. @param http2Headers the interleaved keys and values of HTTP/2-compliant headers @return the interleaved keys and values in the raw serialized format """ for (int i = 0; i < http2Headers.length; i += 2) { byte[] key = http2Headers[i]; byte[] value = http2Headers[i + 1]; if (endsWith(key, binaryHeaderSuffixBytes)) { // Binary header for (int idx = 0; idx < value.length; idx++) { if (value[idx] == (byte) ',') { return serializeHeadersWithCommasInBin(http2Headers, i); } } byte[] decodedVal = BaseEncoding.base64().decode(new String(value, US_ASCII)); http2Headers[i + 1] = decodedVal; } else { // Non-binary header // Nothing to do, the value is already in the right place. } } return http2Headers; }
java
@CheckReturnValue public static byte[][] toRawSerializedHeaders(byte[][] http2Headers) { for (int i = 0; i < http2Headers.length; i += 2) { byte[] key = http2Headers[i]; byte[] value = http2Headers[i + 1]; if (endsWith(key, binaryHeaderSuffixBytes)) { // Binary header for (int idx = 0; idx < value.length; idx++) { if (value[idx] == (byte) ',') { return serializeHeadersWithCommasInBin(http2Headers, i); } } byte[] decodedVal = BaseEncoding.base64().decode(new String(value, US_ASCII)); http2Headers[i + 1] = decodedVal; } else { // Non-binary header // Nothing to do, the value is already in the right place. } } return http2Headers; }
[ "@", "CheckReturnValue", "public", "static", "byte", "[", "]", "[", "]", "toRawSerializedHeaders", "(", "byte", "[", "]", "[", "]", "http2Headers", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "http2Headers", ".", "length", ";", "i", "+=", "2", ")", "{", "byte", "[", "]", "key", "=", "http2Headers", "[", "i", "]", ";", "byte", "[", "]", "value", "=", "http2Headers", "[", "i", "+", "1", "]", ";", "if", "(", "endsWith", "(", "key", ",", "binaryHeaderSuffixBytes", ")", ")", "{", "// Binary header", "for", "(", "int", "idx", "=", "0", ";", "idx", "<", "value", ".", "length", ";", "idx", "++", ")", "{", "if", "(", "value", "[", "idx", "]", "==", "(", "byte", ")", "'", "'", ")", "{", "return", "serializeHeadersWithCommasInBin", "(", "http2Headers", ",", "i", ")", ";", "}", "}", "byte", "[", "]", "decodedVal", "=", "BaseEncoding", ".", "base64", "(", ")", ".", "decode", "(", "new", "String", "(", "value", ",", "US_ASCII", ")", ")", ";", "http2Headers", "[", "i", "+", "1", "]", "=", "decodedVal", ";", "}", "else", "{", "// Non-binary header", "// Nothing to do, the value is already in the right place.", "}", "}", "return", "http2Headers", ";", "}" ]
Transform HTTP/2-compliant headers to the raw serialized format which can be deserialized by metadata marshallers. It decodes the Base64-encoded binary headers. <p>Warning: This function may partially modify the headers in place by modifying the input array (but not modifying any single byte), so the input reference {@code http2Headers} can not be used again. @param http2Headers the interleaved keys and values of HTTP/2-compliant headers @return the interleaved keys and values in the raw serialized format
[ "Transform", "HTTP", "/", "2", "-", "compliant", "headers", "to", "the", "raw", "serialized", "format", "which", "can", "be", "deserialized", "by", "metadata", "marshallers", ".", "It", "decodes", "the", "Base64", "-", "encoded", "binary", "headers", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/TransportFrameUtil.java#L99-L119
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/MetaClass.java
MetaClass.createInstance
@SuppressWarnings("unchecked") public <E,F extends E> F createInstance(Class<E> type, Object... params) { """ Creates an instance of the class, forcing a cast to a certain type and given an array of objects as constructor parameters NOTE: the resulting instance will [unlike java] invoke the most narrow constructor rather than the one which matches the signature passed to this function @param <E> The type of the object returned @param type The class of the object returned @param params The arguments to the constructor of the class @return An instance of the class """ Object obj = createInstance(params); if (type.isInstance(obj)) { return (F) obj; } else { throw new ClassCreationException("Cannot cast " + classname + " into " + type.getName()); } }
java
@SuppressWarnings("unchecked") public <E,F extends E> F createInstance(Class<E> type, Object... params) { Object obj = createInstance(params); if (type.isInstance(obj)) { return (F) obj; } else { throw new ClassCreationException("Cannot cast " + classname + " into " + type.getName()); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "E", ",", "F", "extends", "E", ">", "F", "createInstance", "(", "Class", "<", "E", ">", "type", ",", "Object", "...", "params", ")", "{", "Object", "obj", "=", "createInstance", "(", "params", ")", ";", "if", "(", "type", ".", "isInstance", "(", "obj", ")", ")", "{", "return", "(", "F", ")", "obj", ";", "}", "else", "{", "throw", "new", "ClassCreationException", "(", "\"Cannot cast \"", "+", "classname", "+", "\" into \"", "+", "type", ".", "getName", "(", ")", ")", ";", "}", "}" ]
Creates an instance of the class, forcing a cast to a certain type and given an array of objects as constructor parameters NOTE: the resulting instance will [unlike java] invoke the most narrow constructor rather than the one which matches the signature passed to this function @param <E> The type of the object returned @param type The class of the object returned @param params The arguments to the constructor of the class @return An instance of the class
[ "Creates", "an", "instance", "of", "the", "class", "forcing", "a", "cast", "to", "a", "certain", "type", "and", "given", "an", "array", "of", "objects", "as", "constructor", "parameters", "NOTE", ":", "the", "resulting", "instance", "will", "[", "unlike", "java", "]", "invoke", "the", "most", "narrow", "constructor", "rather", "than", "the", "one", "which", "matches", "the", "signature", "passed", "to", "this", "function" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/MetaClass.java#L388-L397
spring-projects/spring-retry
src/main/java/org/springframework/classify/util/MethodInvokerUtils.java
MethodInvokerUtils.getMethodInvokerByAnnotation
public static MethodInvoker getMethodInvokerByAnnotation( final Class<? extends Annotation> annotationType, final Object target) { """ Create {@link MethodInvoker} for the method with the provided annotation on the provided object. Annotations that cannot be applied to methods (i.e. that aren't annotated with an element type of METHOD) will cause an exception to be thrown. @param annotationType to be searched for @param target to be invoked @return MethodInvoker for the provided annotation, null if none is found. """ Assert.notNull(target, "Target must not be null"); Assert.notNull(annotationType, "AnnotationType must not be null"); Assert.isTrue(ObjectUtils.containsElement( annotationType.getAnnotation(Target.class).value(), ElementType.METHOD), "Annotation [" + annotationType + "] is not a Method-level annotation."); final Class<?> targetClass = (target instanceof Advised) ? ((Advised) target).getTargetSource().getTargetClass() : target.getClass(); if (targetClass == null) { // Proxy with no target cannot have annotations return null; } final AtomicReference<Method> annotatedMethod = new AtomicReference<Method>(); ReflectionUtils.doWithMethods(targetClass, new ReflectionUtils.MethodCallback() { public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { Annotation annotation = AnnotationUtils.findAnnotation(method, annotationType); if (annotation != null) { Assert.isNull(annotatedMethod.get(), "found more than one method on target class [" + targetClass.getSimpleName() + "] with the annotation type [" + annotationType.getSimpleName() + "]."); annotatedMethod.set(method); } } }); Method method = annotatedMethod.get(); if (method == null) { return null; } else { return new SimpleMethodInvoker(target, annotatedMethod.get()); } }
java
public static MethodInvoker getMethodInvokerByAnnotation( final Class<? extends Annotation> annotationType, final Object target) { Assert.notNull(target, "Target must not be null"); Assert.notNull(annotationType, "AnnotationType must not be null"); Assert.isTrue(ObjectUtils.containsElement( annotationType.getAnnotation(Target.class).value(), ElementType.METHOD), "Annotation [" + annotationType + "] is not a Method-level annotation."); final Class<?> targetClass = (target instanceof Advised) ? ((Advised) target).getTargetSource().getTargetClass() : target.getClass(); if (targetClass == null) { // Proxy with no target cannot have annotations return null; } final AtomicReference<Method> annotatedMethod = new AtomicReference<Method>(); ReflectionUtils.doWithMethods(targetClass, new ReflectionUtils.MethodCallback() { public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { Annotation annotation = AnnotationUtils.findAnnotation(method, annotationType); if (annotation != null) { Assert.isNull(annotatedMethod.get(), "found more than one method on target class [" + targetClass.getSimpleName() + "] with the annotation type [" + annotationType.getSimpleName() + "]."); annotatedMethod.set(method); } } }); Method method = annotatedMethod.get(); if (method == null) { return null; } else { return new SimpleMethodInvoker(target, annotatedMethod.get()); } }
[ "public", "static", "MethodInvoker", "getMethodInvokerByAnnotation", "(", "final", "Class", "<", "?", "extends", "Annotation", ">", "annotationType", ",", "final", "Object", "target", ")", "{", "Assert", ".", "notNull", "(", "target", ",", "\"Target must not be null\"", ")", ";", "Assert", ".", "notNull", "(", "annotationType", ",", "\"AnnotationType must not be null\"", ")", ";", "Assert", ".", "isTrue", "(", "ObjectUtils", ".", "containsElement", "(", "annotationType", ".", "getAnnotation", "(", "Target", ".", "class", ")", ".", "value", "(", ")", ",", "ElementType", ".", "METHOD", ")", ",", "\"Annotation [\"", "+", "annotationType", "+", "\"] is not a Method-level annotation.\"", ")", ";", "final", "Class", "<", "?", ">", "targetClass", "=", "(", "target", "instanceof", "Advised", ")", "?", "(", "(", "Advised", ")", "target", ")", ".", "getTargetSource", "(", ")", ".", "getTargetClass", "(", ")", ":", "target", ".", "getClass", "(", ")", ";", "if", "(", "targetClass", "==", "null", ")", "{", "// Proxy with no target cannot have annotations", "return", "null", ";", "}", "final", "AtomicReference", "<", "Method", ">", "annotatedMethod", "=", "new", "AtomicReference", "<", "Method", ">", "(", ")", ";", "ReflectionUtils", ".", "doWithMethods", "(", "targetClass", ",", "new", "ReflectionUtils", ".", "MethodCallback", "(", ")", "{", "public", "void", "doWith", "(", "Method", "method", ")", "throws", "IllegalArgumentException", ",", "IllegalAccessException", "{", "Annotation", "annotation", "=", "AnnotationUtils", ".", "findAnnotation", "(", "method", ",", "annotationType", ")", ";", "if", "(", "annotation", "!=", "null", ")", "{", "Assert", ".", "isNull", "(", "annotatedMethod", ".", "get", "(", ")", ",", "\"found more than one method on target class [\"", "+", "targetClass", ".", "getSimpleName", "(", ")", "+", "\"] with the annotation type [\"", "+", "annotationType", ".", "getSimpleName", "(", ")", "+", "\"].\"", ")", ";", "annotatedMethod", ".", "set", "(", "method", ")", ";", "}", "}", "}", ")", ";", "Method", "method", "=", "annotatedMethod", ".", "get", "(", ")", ";", "if", "(", "method", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "return", "new", "SimpleMethodInvoker", "(", "target", ",", "annotatedMethod", ".", "get", "(", ")", ")", ";", "}", "}" ]
Create {@link MethodInvoker} for the method with the provided annotation on the provided object. Annotations that cannot be applied to methods (i.e. that aren't annotated with an element type of METHOD) will cause an exception to be thrown. @param annotationType to be searched for @param target to be invoked @return MethodInvoker for the provided annotation, null if none is found.
[ "Create", "{" ]
train
https://github.com/spring-projects/spring-retry/blob/e2b0555f96594c2321990d0deeac45fc44d4f123/src/main/java/org/springframework/classify/util/MethodInvokerUtils.java#L166-L203
GoogleCloudPlatform/bigdata-interop
gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageFileSystem.java
GoogleCloudStorageFileSystem.copyInternal
private void copyInternal(Map<FileInfo, URI> srcToDstItemNames) throws IOException { """ Copies items in given map that maps source items to destination items. """ if (srcToDstItemNames.isEmpty()) { return; } String srcBucketName = null; String dstBucketName = null; List<String> srcObjectNames = new ArrayList<>(srcToDstItemNames.size()); List<String> dstObjectNames = new ArrayList<>(srcToDstItemNames.size()); // Prepare list of items to copy. for (Map.Entry<FileInfo, URI> srcToDstItemName : srcToDstItemNames.entrySet()) { StorageResourceId srcResourceId = srcToDstItemName.getKey().getItemInfo().getResourceId(); srcBucketName = srcResourceId.getBucketName(); String srcObjectName = srcResourceId.getObjectName(); srcObjectNames.add(srcObjectName); StorageResourceId dstResourceId = pathCodec.validatePathAndGetId(srcToDstItemName.getValue(), true); dstBucketName = dstResourceId.getBucketName(); String dstObjectName = dstResourceId.getObjectName(); dstObjectNames.add(dstObjectName); } // Perform copy. gcs.copy(srcBucketName, srcObjectNames, dstBucketName, dstObjectNames); }
java
private void copyInternal(Map<FileInfo, URI> srcToDstItemNames) throws IOException { if (srcToDstItemNames.isEmpty()) { return; } String srcBucketName = null; String dstBucketName = null; List<String> srcObjectNames = new ArrayList<>(srcToDstItemNames.size()); List<String> dstObjectNames = new ArrayList<>(srcToDstItemNames.size()); // Prepare list of items to copy. for (Map.Entry<FileInfo, URI> srcToDstItemName : srcToDstItemNames.entrySet()) { StorageResourceId srcResourceId = srcToDstItemName.getKey().getItemInfo().getResourceId(); srcBucketName = srcResourceId.getBucketName(); String srcObjectName = srcResourceId.getObjectName(); srcObjectNames.add(srcObjectName); StorageResourceId dstResourceId = pathCodec.validatePathAndGetId(srcToDstItemName.getValue(), true); dstBucketName = dstResourceId.getBucketName(); String dstObjectName = dstResourceId.getObjectName(); dstObjectNames.add(dstObjectName); } // Perform copy. gcs.copy(srcBucketName, srcObjectNames, dstBucketName, dstObjectNames); }
[ "private", "void", "copyInternal", "(", "Map", "<", "FileInfo", ",", "URI", ">", "srcToDstItemNames", ")", "throws", "IOException", "{", "if", "(", "srcToDstItemNames", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "String", "srcBucketName", "=", "null", ";", "String", "dstBucketName", "=", "null", ";", "List", "<", "String", ">", "srcObjectNames", "=", "new", "ArrayList", "<>", "(", "srcToDstItemNames", ".", "size", "(", ")", ")", ";", "List", "<", "String", ">", "dstObjectNames", "=", "new", "ArrayList", "<>", "(", "srcToDstItemNames", ".", "size", "(", ")", ")", ";", "// Prepare list of items to copy.", "for", "(", "Map", ".", "Entry", "<", "FileInfo", ",", "URI", ">", "srcToDstItemName", ":", "srcToDstItemNames", ".", "entrySet", "(", ")", ")", "{", "StorageResourceId", "srcResourceId", "=", "srcToDstItemName", ".", "getKey", "(", ")", ".", "getItemInfo", "(", ")", ".", "getResourceId", "(", ")", ";", "srcBucketName", "=", "srcResourceId", ".", "getBucketName", "(", ")", ";", "String", "srcObjectName", "=", "srcResourceId", ".", "getObjectName", "(", ")", ";", "srcObjectNames", ".", "add", "(", "srcObjectName", ")", ";", "StorageResourceId", "dstResourceId", "=", "pathCodec", ".", "validatePathAndGetId", "(", "srcToDstItemName", ".", "getValue", "(", ")", ",", "true", ")", ";", "dstBucketName", "=", "dstResourceId", ".", "getBucketName", "(", ")", ";", "String", "dstObjectName", "=", "dstResourceId", ".", "getObjectName", "(", ")", ";", "dstObjectNames", ".", "add", "(", "dstObjectName", ")", ";", "}", "// Perform copy.", "gcs", ".", "copy", "(", "srcBucketName", ",", "srcObjectNames", ",", "dstBucketName", ",", "dstObjectNames", ")", ";", "}" ]
Copies items in given map that maps source items to destination items.
[ "Copies", "items", "in", "given", "map", "that", "maps", "source", "items", "to", "destination", "items", "." ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageFileSystem.java#L836-L862
orbisgis/poly2tri.java
poly2tri-core/src/main/java/org/poly2tri/triangulation/TriangulationPoint.java
TriangulationPoint.mergeInstances
public static void mergeInstances(Map<TriangulationPoint, TriangulationPoint> uniquePts, List<TriangulationPoint> ptList) { """ Replace points in ptList for all equals object in uniquePts. @param uniquePts Map of triangulation points @param ptList Point list, updated, but always the same size. """ for(int idPoint = 0; idPoint < ptList.size(); idPoint++) { TriangulationPoint pt = ptList.get(idPoint); TriangulationPoint uniquePt = uniquePts.get(pt); if(uniquePt == null) { uniquePts.put(pt, pt); } else { // Duplicate point ptList.set(idPoint, uniquePt); } } }
java
public static void mergeInstances(Map<TriangulationPoint, TriangulationPoint> uniquePts, List<TriangulationPoint> ptList) { for(int idPoint = 0; idPoint < ptList.size(); idPoint++) { TriangulationPoint pt = ptList.get(idPoint); TriangulationPoint uniquePt = uniquePts.get(pt); if(uniquePt == null) { uniquePts.put(pt, pt); } else { // Duplicate point ptList.set(idPoint, uniquePt); } } }
[ "public", "static", "void", "mergeInstances", "(", "Map", "<", "TriangulationPoint", ",", "TriangulationPoint", ">", "uniquePts", ",", "List", "<", "TriangulationPoint", ">", "ptList", ")", "{", "for", "(", "int", "idPoint", "=", "0", ";", "idPoint", "<", "ptList", ".", "size", "(", ")", ";", "idPoint", "++", ")", "{", "TriangulationPoint", "pt", "=", "ptList", ".", "get", "(", "idPoint", ")", ";", "TriangulationPoint", "uniquePt", "=", "uniquePts", ".", "get", "(", "pt", ")", ";", "if", "(", "uniquePt", "==", "null", ")", "{", "uniquePts", ".", "put", "(", "pt", ",", "pt", ")", ";", "}", "else", "{", "// Duplicate point\r", "ptList", ".", "set", "(", "idPoint", ",", "uniquePt", ")", ";", "}", "}", "}" ]
Replace points in ptList for all equals object in uniquePts. @param uniquePts Map of triangulation points @param ptList Point list, updated, but always the same size.
[ "Replace", "points", "in", "ptList", "for", "all", "equals", "object", "in", "uniquePts", "." ]
train
https://github.com/orbisgis/poly2tri.java/blob/8b312c8d5fc23c52ffbacb3a7b66afae328fa827/poly2tri-core/src/main/java/org/poly2tri/triangulation/TriangulationPoint.java#L120-L131
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/jboss/logging/Logger.java
Logger.logf
public void logf(String loggerFqcn, Level level, Throwable t, String format, Object... params) { """ Log a message at the given level. @param loggerFqcn the logger class name @param level the level @param t the throwable cause @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor @param params the message parameters """ doLogf(level, loggerFqcn, format, params, t); }
java
public void logf(String loggerFqcn, Level level, Throwable t, String format, Object... params) { doLogf(level, loggerFqcn, format, params, t); }
[ "public", "void", "logf", "(", "String", "loggerFqcn", ",", "Level", "level", ",", "Throwable", "t", ",", "String", "format", ",", "Object", "...", "params", ")", "{", "doLogf", "(", "level", ",", "loggerFqcn", ",", "format", ",", "params", ",", "t", ")", ";", "}" ]
Log a message at the given level. @param loggerFqcn the logger class name @param level the level @param t the throwable cause @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor @param params the message parameters
[ "Log", "a", "message", "at", "the", "given", "level", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L2444-L2446
jblas-project/jblas
src/main/java/org/jblas/Solve.java
Solve.solveLeastSquares
public static DoubleMatrix solveLeastSquares(DoubleMatrix A, DoubleMatrix B) { """ Computes the Least Squares solution for over or underdetermined linear equations A*X = B In the overdetermined case, when m > n, that is, there are more equations than variables, it computes the least squares solution of X -> ||A*X - B ||_2. In the underdetermined case, when m < n (less equations than variables), there are infinitely many solutions and it computes the minimum norm solution. @param A an (m,n) matrix @param B a (m,k) matrix @return either the minimum norm or least squares solution. """ if (B.rows < A.columns) { DoubleMatrix X = DoubleMatrix.concatVertically(B, new DoubleMatrix(A.columns - B.rows, B.columns)); SimpleBlas.gelsd(A.dup(), X); return X; } else { DoubleMatrix X = B.dup(); SimpleBlas.gelsd(A.dup(), X); return X.getRange(0, A.columns, 0, B.columns); } }
java
public static DoubleMatrix solveLeastSquares(DoubleMatrix A, DoubleMatrix B) { if (B.rows < A.columns) { DoubleMatrix X = DoubleMatrix.concatVertically(B, new DoubleMatrix(A.columns - B.rows, B.columns)); SimpleBlas.gelsd(A.dup(), X); return X; } else { DoubleMatrix X = B.dup(); SimpleBlas.gelsd(A.dup(), X); return X.getRange(0, A.columns, 0, B.columns); } }
[ "public", "static", "DoubleMatrix", "solveLeastSquares", "(", "DoubleMatrix", "A", ",", "DoubleMatrix", "B", ")", "{", "if", "(", "B", ".", "rows", "<", "A", ".", "columns", ")", "{", "DoubleMatrix", "X", "=", "DoubleMatrix", ".", "concatVertically", "(", "B", ",", "new", "DoubleMatrix", "(", "A", ".", "columns", "-", "B", ".", "rows", ",", "B", ".", "columns", ")", ")", ";", "SimpleBlas", ".", "gelsd", "(", "A", ".", "dup", "(", ")", ",", "X", ")", ";", "return", "X", ";", "}", "else", "{", "DoubleMatrix", "X", "=", "B", ".", "dup", "(", ")", ";", "SimpleBlas", ".", "gelsd", "(", "A", ".", "dup", "(", ")", ",", "X", ")", ";", "return", "X", ".", "getRange", "(", "0", ",", "A", ".", "columns", ",", "0", ",", "B", ".", "columns", ")", ";", "}", "}" ]
Computes the Least Squares solution for over or underdetermined linear equations A*X = B In the overdetermined case, when m > n, that is, there are more equations than variables, it computes the least squares solution of X -> ||A*X - B ||_2. In the underdetermined case, when m < n (less equations than variables), there are infinitely many solutions and it computes the minimum norm solution. @param A an (m,n) matrix @param B a (m,k) matrix @return either the minimum norm or least squares solution.
[ "Computes", "the", "Least", "Squares", "solution", "for", "over", "or", "underdetermined", "linear", "equations", "A", "*", "X", "=", "B" ]
train
https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/Solve.java#L83-L93
mapsforge/mapsforge
mapsforge-map-writer/src/main/java/org/mapsforge/map/writer/util/PolyLabel.java
PolyLabel.pointToPolygonDist
private static float pointToPolygonDist(double x, double y, Polygon polygon) { """ Signed distance from point to polygon outline (negative if point is outside) """ boolean inside = false; double minDistSq = Double.POSITIVE_INFINITY; // External ring LineString exterior = polygon.getExteriorRing(); for (int i = 0, n = exterior.getNumPoints() - 1, j = n - 1; i < n; j = i, i++) { Coordinate a = exterior.getCoordinateN(i); Coordinate b = exterior.getCoordinateN(j); if (((a.y > y) ^ (b.y > y)) && (x < (b.x - a.x) * (y - a.y) / (b.y - a.y) + a.x)) inside = !inside; double seqDistSq = getSegDistSq(x, y, a, b); minDistSq = Math.min(minDistSq, seqDistSq); } // Internal rings for (int k = 0; k < polygon.getNumInteriorRing(); k++) { LineString interior = polygon.getInteriorRingN(k); for (int i = 0, n = interior.getNumPoints() - 1, j = n - 1; i < n; j = i, i++) { Coordinate a = interior.getCoordinateN(i); Coordinate b = interior.getCoordinateN(j); if (((a.y > y) ^ (b.y > y)) && (x < (b.x - a.x) * (y - a.y) / (b.y - a.y) + a.x)) inside = !inside; minDistSq = Math.min(minDistSq, getSegDistSq(x, y, a, b)); } } return (float) ((inside ? 1 : -1) * Math.sqrt(minDistSq)); }
java
private static float pointToPolygonDist(double x, double y, Polygon polygon) { boolean inside = false; double minDistSq = Double.POSITIVE_INFINITY; // External ring LineString exterior = polygon.getExteriorRing(); for (int i = 0, n = exterior.getNumPoints() - 1, j = n - 1; i < n; j = i, i++) { Coordinate a = exterior.getCoordinateN(i); Coordinate b = exterior.getCoordinateN(j); if (((a.y > y) ^ (b.y > y)) && (x < (b.x - a.x) * (y - a.y) / (b.y - a.y) + a.x)) inside = !inside; double seqDistSq = getSegDistSq(x, y, a, b); minDistSq = Math.min(minDistSq, seqDistSq); } // Internal rings for (int k = 0; k < polygon.getNumInteriorRing(); k++) { LineString interior = polygon.getInteriorRingN(k); for (int i = 0, n = interior.getNumPoints() - 1, j = n - 1; i < n; j = i, i++) { Coordinate a = interior.getCoordinateN(i); Coordinate b = interior.getCoordinateN(j); if (((a.y > y) ^ (b.y > y)) && (x < (b.x - a.x) * (y - a.y) / (b.y - a.y) + a.x)) inside = !inside; minDistSq = Math.min(minDistSq, getSegDistSq(x, y, a, b)); } } return (float) ((inside ? 1 : -1) * Math.sqrt(minDistSq)); }
[ "private", "static", "float", "pointToPolygonDist", "(", "double", "x", ",", "double", "y", ",", "Polygon", "polygon", ")", "{", "boolean", "inside", "=", "false", ";", "double", "minDistSq", "=", "Double", ".", "POSITIVE_INFINITY", ";", "// External ring", "LineString", "exterior", "=", "polygon", ".", "getExteriorRing", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "n", "=", "exterior", ".", "getNumPoints", "(", ")", "-", "1", ",", "j", "=", "n", "-", "1", ";", "i", "<", "n", ";", "j", "=", "i", ",", "i", "++", ")", "{", "Coordinate", "a", "=", "exterior", ".", "getCoordinateN", "(", "i", ")", ";", "Coordinate", "b", "=", "exterior", ".", "getCoordinateN", "(", "j", ")", ";", "if", "(", "(", "(", "a", ".", "y", ">", "y", ")", "^", "(", "b", ".", "y", ">", "y", ")", ")", "&&", "(", "x", "<", "(", "b", ".", "x", "-", "a", ".", "x", ")", "*", "(", "y", "-", "a", ".", "y", ")", "/", "(", "b", ".", "y", "-", "a", ".", "y", ")", "+", "a", ".", "x", ")", ")", "inside", "=", "!", "inside", ";", "double", "seqDistSq", "=", "getSegDistSq", "(", "x", ",", "y", ",", "a", ",", "b", ")", ";", "minDistSq", "=", "Math", ".", "min", "(", "minDistSq", ",", "seqDistSq", ")", ";", "}", "// Internal rings", "for", "(", "int", "k", "=", "0", ";", "k", "<", "polygon", ".", "getNumInteriorRing", "(", ")", ";", "k", "++", ")", "{", "LineString", "interior", "=", "polygon", ".", "getInteriorRingN", "(", "k", ")", ";", "for", "(", "int", "i", "=", "0", ",", "n", "=", "interior", ".", "getNumPoints", "(", ")", "-", "1", ",", "j", "=", "n", "-", "1", ";", "i", "<", "n", ";", "j", "=", "i", ",", "i", "++", ")", "{", "Coordinate", "a", "=", "interior", ".", "getCoordinateN", "(", "i", ")", ";", "Coordinate", "b", "=", "interior", ".", "getCoordinateN", "(", "j", ")", ";", "if", "(", "(", "(", "a", ".", "y", ">", "y", ")", "^", "(", "b", ".", "y", ">", "y", ")", ")", "&&", "(", "x", "<", "(", "b", ".", "x", "-", "a", ".", "x", ")", "*", "(", "y", "-", "a", ".", "y", ")", "/", "(", "b", ".", "y", "-", "a", ".", "y", ")", "+", "a", ".", "x", ")", ")", "inside", "=", "!", "inside", ";", "minDistSq", "=", "Math", ".", "min", "(", "minDistSq", ",", "getSegDistSq", "(", "x", ",", "y", ",", "a", ",", "b", ")", ")", ";", "}", "}", "return", "(", "float", ")", "(", "(", "inside", "?", "1", ":", "-", "1", ")", "*", "Math", ".", "sqrt", "(", "minDistSq", ")", ")", ";", "}" ]
Signed distance from point to polygon outline (negative if point is outside)
[ "Signed", "distance", "from", "point", "to", "polygon", "outline", "(", "negative", "if", "point", "is", "outside", ")" ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-writer/src/main/java/org/mapsforge/map/writer/util/PolyLabel.java#L155-L188
mnlipp/jgrapes
org.jgrapes.util/src/org/jgrapes/util/events/KeyValueStoreUpdate.java
KeyValueStoreUpdate.clearAll
public KeyValueStoreUpdate clearAll(String... segments) { """ Adds a new deletion action that clears all keys with the given path prefix. @param segments the path segments @return the event for easy chaining """ actions.add(new Deletion("/" + String.join("/", segments))); return this; }
java
public KeyValueStoreUpdate clearAll(String... segments) { actions.add(new Deletion("/" + String.join("/", segments))); return this; }
[ "public", "KeyValueStoreUpdate", "clearAll", "(", "String", "...", "segments", ")", "{", "actions", ".", "add", "(", "new", "Deletion", "(", "\"/\"", "+", "String", ".", "join", "(", "\"/\"", ",", "segments", ")", ")", ")", ";", "return", "this", ";", "}" ]
Adds a new deletion action that clears all keys with the given path prefix. @param segments the path segments @return the event for easy chaining
[ "Adds", "a", "new", "deletion", "action", "that", "clears", "all", "keys", "with", "the", "given", "path", "prefix", "." ]
train
https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.util/src/org/jgrapes/util/events/KeyValueStoreUpdate.java#L78-L81
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/data/Cluster.java
Cluster.writeToText
@Override public void writeToText(TextWriterStream out, String label) { """ Write to a textual representation. Writing the actual group data will be handled by the caller, this is only meant to write the meta information. @param out output writer stream @param label Label to prefix """ String name = getNameAutomatic(); if(name != null) { out.commentPrintLn("Cluster name: " + name); } out.commentPrintLn("Cluster noise flag: " + isNoise()); out.commentPrintLn("Cluster size: " + ids.size()); // also print model, if any and printable if(getModel() != null && (getModel() instanceof TextWriteable)) { ((TextWriteable) getModel()).writeToText(out, label); } }
java
@Override public void writeToText(TextWriterStream out, String label) { String name = getNameAutomatic(); if(name != null) { out.commentPrintLn("Cluster name: " + name); } out.commentPrintLn("Cluster noise flag: " + isNoise()); out.commentPrintLn("Cluster size: " + ids.size()); // also print model, if any and printable if(getModel() != null && (getModel() instanceof TextWriteable)) { ((TextWriteable) getModel()).writeToText(out, label); } }
[ "@", "Override", "public", "void", "writeToText", "(", "TextWriterStream", "out", ",", "String", "label", ")", "{", "String", "name", "=", "getNameAutomatic", "(", ")", ";", "if", "(", "name", "!=", "null", ")", "{", "out", ".", "commentPrintLn", "(", "\"Cluster name: \"", "+", "name", ")", ";", "}", "out", ".", "commentPrintLn", "(", "\"Cluster noise flag: \"", "+", "isNoise", "(", ")", ")", ";", "out", ".", "commentPrintLn", "(", "\"Cluster size: \"", "+", "ids", ".", "size", "(", ")", ")", ";", "// also print model, if any and printable", "if", "(", "getModel", "(", ")", "!=", "null", "&&", "(", "getModel", "(", ")", "instanceof", "TextWriteable", ")", ")", "{", "(", "(", "TextWriteable", ")", "getModel", "(", ")", ")", ".", "writeToText", "(", "out", ",", "label", ")", ";", "}", "}" ]
Write to a textual representation. Writing the actual group data will be handled by the caller, this is only meant to write the meta information. @param out output writer stream @param label Label to prefix
[ "Write", "to", "a", "textual", "representation", ".", "Writing", "the", "actual", "group", "data", "will", "be", "handled", "by", "the", "caller", "this", "is", "only", "meant", "to", "write", "the", "meta", "information", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/data/Cluster.java#L247-L259
JavaMoney/jsr354-ri-bp
src/main/java/org/javamoney/moneta/spi/base/BaseMonetaryRoundingsSingletonSpi.java
BaseMonetaryRoundingsSingletonSpi.getRounding
public MonetaryRounding getRounding(CurrencyUnit currencyUnit, String... providers) { """ Access a {@link javax.money.MonetaryRounding} for rounding {@link javax.money.MonetaryAmount} instances given a currency. @param currencyUnit The currency, which determines the required precision. As {@link java.math.RoundingMode}, by default, {@link java.math.RoundingMode#HALF_UP} is sued. @param providers the optional provider list and ordering to be used @return a new instance {@link javax.money.MonetaryOperator} implementing the rounding, never {@code null}. @throws javax.money.MonetaryException if no such rounding could be provided. """ MonetaryRounding op = getRounding(RoundingQueryBuilder.of().setProviderNames(providers).setCurrency(currencyUnit).build()); if(op==null) { throw new MonetaryException( "No rounding provided for CurrencyUnit: " + currencyUnit.getCurrencyCode()); } return op; }
java
public MonetaryRounding getRounding(CurrencyUnit currencyUnit, String... providers) { MonetaryRounding op = getRounding(RoundingQueryBuilder.of().setProviderNames(providers).setCurrency(currencyUnit).build()); if(op==null) { throw new MonetaryException( "No rounding provided for CurrencyUnit: " + currencyUnit.getCurrencyCode()); } return op; }
[ "public", "MonetaryRounding", "getRounding", "(", "CurrencyUnit", "currencyUnit", ",", "String", "...", "providers", ")", "{", "MonetaryRounding", "op", "=", "getRounding", "(", "RoundingQueryBuilder", ".", "of", "(", ")", ".", "setProviderNames", "(", "providers", ")", ".", "setCurrency", "(", "currencyUnit", ")", ".", "build", "(", ")", ")", ";", "if", "(", "op", "==", "null", ")", "{", "throw", "new", "MonetaryException", "(", "\"No rounding provided for CurrencyUnit: \"", "+", "currencyUnit", ".", "getCurrencyCode", "(", ")", ")", ";", "}", "return", "op", ";", "}" ]
Access a {@link javax.money.MonetaryRounding} for rounding {@link javax.money.MonetaryAmount} instances given a currency. @param currencyUnit The currency, which determines the required precision. As {@link java.math.RoundingMode}, by default, {@link java.math.RoundingMode#HALF_UP} is sued. @param providers the optional provider list and ordering to be used @return a new instance {@link javax.money.MonetaryOperator} implementing the rounding, never {@code null}. @throws javax.money.MonetaryException if no such rounding could be provided.
[ "Access", "a", "{", "@link", "javax", ".", "money", ".", "MonetaryRounding", "}", "for", "rounding", "{", "@link", "javax", ".", "money", ".", "MonetaryAmount", "}", "instances", "given", "a", "currency", "." ]
train
https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/spi/base/BaseMonetaryRoundingsSingletonSpi.java#L44-L52
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/Single.java
Single.concatEager
@BackpressureSupport(BackpressureKind.FULL) @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T> Flowable<T> concatEager(Publisher<? extends SingleSource<? extends T>> sources) { """ Concatenates a Publisher sequence of SingleSources eagerly into a single stream of values. <p> <img width="640" height="307" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.concatEager.p.png" alt=""> <p> Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the emitted source Publishers as they are observed. The operator buffers the values emitted by these Publishers and then drains them in order, each one after the previous one completes. <dl> <dt><b>Backpressure:</b></dt> <dd>Backpressure is honored towards the downstream and the outer Publisher is expected to support backpressure. Violating this assumption, the operator will signal {@link io.reactivex.exceptions.MissingBackpressureException}.</dd> <dt><b>Scheduler:</b></dt> <dd>This method does not operate by default on a particular {@link Scheduler}.</dd> </dl> @param <T> the value type @param sources a sequence of Publishers that need to be eagerly concatenated @return the new Publisher instance with the specified concatenation behavior """ return Flowable.fromPublisher(sources).concatMapEager(SingleInternalHelper.<T>toFlowable()); }
java
@BackpressureSupport(BackpressureKind.FULL) @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T> Flowable<T> concatEager(Publisher<? extends SingleSource<? extends T>> sources) { return Flowable.fromPublisher(sources).concatMapEager(SingleInternalHelper.<T>toFlowable()); }
[ "@", "BackpressureSupport", "(", "BackpressureKind", ".", "FULL", ")", "@", "CheckReturnValue", "@", "SchedulerSupport", "(", "SchedulerSupport", ".", "NONE", ")", "public", "static", "<", "T", ">", "Flowable", "<", "T", ">", "concatEager", "(", "Publisher", "<", "?", "extends", "SingleSource", "<", "?", "extends", "T", ">", ">", "sources", ")", "{", "return", "Flowable", ".", "fromPublisher", "(", "sources", ")", ".", "concatMapEager", "(", "SingleInternalHelper", ".", "<", "T", ">", "toFlowable", "(", ")", ")", ";", "}" ]
Concatenates a Publisher sequence of SingleSources eagerly into a single stream of values. <p> <img width="640" height="307" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.concatEager.p.png" alt=""> <p> Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the emitted source Publishers as they are observed. The operator buffers the values emitted by these Publishers and then drains them in order, each one after the previous one completes. <dl> <dt><b>Backpressure:</b></dt> <dd>Backpressure is honored towards the downstream and the outer Publisher is expected to support backpressure. Violating this assumption, the operator will signal {@link io.reactivex.exceptions.MissingBackpressureException}.</dd> <dt><b>Scheduler:</b></dt> <dd>This method does not operate by default on a particular {@link Scheduler}.</dd> </dl> @param <T> the value type @param sources a sequence of Publishers that need to be eagerly concatenated @return the new Publisher instance with the specified concatenation behavior
[ "Concatenates", "a", "Publisher", "sequence", "of", "SingleSources", "eagerly", "into", "a", "single", "stream", "of", "values", ".", "<p", ">", "<img", "width", "=", "640", "height", "=", "307", "src", "=", "https", ":", "//", "raw", ".", "github", ".", "com", "/", "wiki", "/", "ReactiveX", "/", "RxJava", "/", "images", "/", "rx", "-", "operators", "/", "Single", ".", "concatEager", ".", "p", ".", "png", "alt", "=", ">", "<p", ">", "Eager", "concatenation", "means", "that", "once", "a", "subscriber", "subscribes", "this", "operator", "subscribes", "to", "all", "of", "the", "emitted", "source", "Publishers", "as", "they", "are", "observed", ".", "The", "operator", "buffers", "the", "values", "emitted", "by", "these", "Publishers", "and", "then", "drains", "them", "in", "order", "each", "one", "after", "the", "previous", "one", "completes", ".", "<dl", ">", "<dt", ">", "<b", ">", "Backpressure", ":", "<", "/", "b", ">", "<", "/", "dt", ">", "<dd", ">", "Backpressure", "is", "honored", "towards", "the", "downstream", "and", "the", "outer", "Publisher", "is", "expected", "to", "support", "backpressure", ".", "Violating", "this", "assumption", "the", "operator", "will", "signal", "{" ]
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Single.java#L434-L439
spotbugs/spotbugs
eclipsePlugin/src/de/tobject/findbugs/reporter/Reporter.java
Reporter.reportResultsToConsole
private void reportResultsToConsole() { """ If there is a FB console opened, report results and statistics to it. """ if (!isStreamReportingEnabled()) { return; } printToStream("Finished, found: " + bugCount + " bugs"); ConfigurableXmlOutputStream xmlStream = new ConfigurableXmlOutputStream(stream, true); ProjectStats stats = bugCollection.getProjectStats(); printToStream("\nFootprint: " + new Footprint(stats.getBaseFootprint()).toString()); Profiler profiler = stats.getProfiler(); PrintStream printStream; try { printStream = new PrintStream(stream, false, "UTF-8"); } catch (UnsupportedEncodingException e1) { // can never happen with UTF-8 return; } printToStream("\nTotal time:"); profiler.report(new Profiler.TotalTimeComparator(profiler), new Profiler.FilterByTime(10000000), printStream); printToStream("\nTotal calls:"); int numClasses = stats.getNumClasses(); if(numClasses > 0) { profiler.report(new Profiler.TotalCallsComparator(profiler), new Profiler.FilterByCalls(numClasses), printStream); printToStream("\nTime per call:"); profiler.report(new Profiler.TimePerCallComparator(profiler), new Profiler.FilterByTimePerCall(10000000 / numClasses), printStream); } try { xmlStream.finish(); } catch (IOException e) { FindbugsPlugin.getDefault().logException(e, "Print to console failed"); } }
java
private void reportResultsToConsole() { if (!isStreamReportingEnabled()) { return; } printToStream("Finished, found: " + bugCount + " bugs"); ConfigurableXmlOutputStream xmlStream = new ConfigurableXmlOutputStream(stream, true); ProjectStats stats = bugCollection.getProjectStats(); printToStream("\nFootprint: " + new Footprint(stats.getBaseFootprint()).toString()); Profiler profiler = stats.getProfiler(); PrintStream printStream; try { printStream = new PrintStream(stream, false, "UTF-8"); } catch (UnsupportedEncodingException e1) { // can never happen with UTF-8 return; } printToStream("\nTotal time:"); profiler.report(new Profiler.TotalTimeComparator(profiler), new Profiler.FilterByTime(10000000), printStream); printToStream("\nTotal calls:"); int numClasses = stats.getNumClasses(); if(numClasses > 0) { profiler.report(new Profiler.TotalCallsComparator(profiler), new Profiler.FilterByCalls(numClasses), printStream); printToStream("\nTime per call:"); profiler.report(new Profiler.TimePerCallComparator(profiler), new Profiler.FilterByTimePerCall(10000000 / numClasses), printStream); } try { xmlStream.finish(); } catch (IOException e) { FindbugsPlugin.getDefault().logException(e, "Print to console failed"); } }
[ "private", "void", "reportResultsToConsole", "(", ")", "{", "if", "(", "!", "isStreamReportingEnabled", "(", ")", ")", "{", "return", ";", "}", "printToStream", "(", "\"Finished, found: \"", "+", "bugCount", "+", "\" bugs\"", ")", ";", "ConfigurableXmlOutputStream", "xmlStream", "=", "new", "ConfigurableXmlOutputStream", "(", "stream", ",", "true", ")", ";", "ProjectStats", "stats", "=", "bugCollection", ".", "getProjectStats", "(", ")", ";", "printToStream", "(", "\"\\nFootprint: \"", "+", "new", "Footprint", "(", "stats", ".", "getBaseFootprint", "(", ")", ")", ".", "toString", "(", ")", ")", ";", "Profiler", "profiler", "=", "stats", ".", "getProfiler", "(", ")", ";", "PrintStream", "printStream", ";", "try", "{", "printStream", "=", "new", "PrintStream", "(", "stream", ",", "false", ",", "\"UTF-8\"", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e1", ")", "{", "// can never happen with UTF-8", "return", ";", "}", "printToStream", "(", "\"\\nTotal time:\"", ")", ";", "profiler", ".", "report", "(", "new", "Profiler", ".", "TotalTimeComparator", "(", "profiler", ")", ",", "new", "Profiler", ".", "FilterByTime", "(", "10000000", ")", ",", "printStream", ")", ";", "printToStream", "(", "\"\\nTotal calls:\"", ")", ";", "int", "numClasses", "=", "stats", ".", "getNumClasses", "(", ")", ";", "if", "(", "numClasses", ">", "0", ")", "{", "profiler", ".", "report", "(", "new", "Profiler", ".", "TotalCallsComparator", "(", "profiler", ")", ",", "new", "Profiler", ".", "FilterByCalls", "(", "numClasses", ")", ",", "printStream", ")", ";", "printToStream", "(", "\"\\nTime per call:\"", ")", ";", "profiler", ".", "report", "(", "new", "Profiler", ".", "TimePerCallComparator", "(", "profiler", ")", ",", "new", "Profiler", ".", "FilterByTimePerCall", "(", "10000000", "/", "numClasses", ")", ",", "printStream", ")", ";", "}", "try", "{", "xmlStream", ".", "finish", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "FindbugsPlugin", ".", "getDefault", "(", ")", ".", "logException", "(", "e", ",", "\"Print to console failed\"", ")", ";", "}", "}" ]
If there is a FB console opened, report results and statistics to it.
[ "If", "there", "is", "a", "FB", "console", "opened", "report", "results", "and", "statistics", "to", "it", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/reporter/Reporter.java#L184-L221
mgormley/pacaya
src/main/java/edu/jhu/pacaya/sch/util/ScheduleUtils.java
ScheduleUtils.buildTriggers
public static IntDiGraph buildTriggers(IntDiGraph g, Schedule s) { """ return a DAG, G' = V', E' such that vertecies correspond to indexes in the schedule and there is an edge (i,j) \in E' if s_i triggered s_j """ // return trigger DAG IntDiGraph d = new IntDiGraph(); // map from node to triggering indexes DefaultDict<Integer, List<Integer>> currentTriggers = new DefaultDict<>(i -> new LinkedList<Integer>()); for (Indexed<Integer> s_j : enumerate(s)) { // add in arcs from triggers for (int i : currentTriggers.get(s_j.get())) { d.addEdge(i, s_j.index()); } // remove s_j from the agenda currentTriggers.remove(s_j.get()); // record that j is triggering consequents for (int s_k : g.getSuccessors(s_j.get())) { currentTriggers.get(s_k).add(s_j.index()); } } // add a link to the unpopped version of each node still on the agenda // the integer will be the length of the trajectory plus an index into // the set of nodes for (Entry<Integer, List<Integer>> item : currentTriggers.entrySet()) { int s_k = item.getKey(); List<Integer> triggers = item.getValue(); for (int j : triggers) { d.addEdge(j, s.size() + g.index(s_k)); } } return d; }
java
public static IntDiGraph buildTriggers(IntDiGraph g, Schedule s) { // return trigger DAG IntDiGraph d = new IntDiGraph(); // map from node to triggering indexes DefaultDict<Integer, List<Integer>> currentTriggers = new DefaultDict<>(i -> new LinkedList<Integer>()); for (Indexed<Integer> s_j : enumerate(s)) { // add in arcs from triggers for (int i : currentTriggers.get(s_j.get())) { d.addEdge(i, s_j.index()); } // remove s_j from the agenda currentTriggers.remove(s_j.get()); // record that j is triggering consequents for (int s_k : g.getSuccessors(s_j.get())) { currentTriggers.get(s_k).add(s_j.index()); } } // add a link to the unpopped version of each node still on the agenda // the integer will be the length of the trajectory plus an index into // the set of nodes for (Entry<Integer, List<Integer>> item : currentTriggers.entrySet()) { int s_k = item.getKey(); List<Integer> triggers = item.getValue(); for (int j : triggers) { d.addEdge(j, s.size() + g.index(s_k)); } } return d; }
[ "public", "static", "IntDiGraph", "buildTriggers", "(", "IntDiGraph", "g", ",", "Schedule", "s", ")", "{", "// return trigger DAG", "IntDiGraph", "d", "=", "new", "IntDiGraph", "(", ")", ";", "// map from node to triggering indexes", "DefaultDict", "<", "Integer", ",", "List", "<", "Integer", ">", ">", "currentTriggers", "=", "new", "DefaultDict", "<>", "(", "i", "->", "new", "LinkedList", "<", "Integer", ">", "(", ")", ")", ";", "for", "(", "Indexed", "<", "Integer", ">", "s_j", ":", "enumerate", "(", "s", ")", ")", "{", "// add in arcs from triggers", "for", "(", "int", "i", ":", "currentTriggers", ".", "get", "(", "s_j", ".", "get", "(", ")", ")", ")", "{", "d", ".", "addEdge", "(", "i", ",", "s_j", ".", "index", "(", ")", ")", ";", "}", "// remove s_j from the agenda", "currentTriggers", ".", "remove", "(", "s_j", ".", "get", "(", ")", ")", ";", "// record that j is triggering consequents", "for", "(", "int", "s_k", ":", "g", ".", "getSuccessors", "(", "s_j", ".", "get", "(", ")", ")", ")", "{", "currentTriggers", ".", "get", "(", "s_k", ")", ".", "add", "(", "s_j", ".", "index", "(", ")", ")", ";", "}", "}", "// add a link to the unpopped version of each node still on the agenda", "// the integer will be the length of the trajectory plus an index into", "// the set of nodes", "for", "(", "Entry", "<", "Integer", ",", "List", "<", "Integer", ">", ">", "item", ":", "currentTriggers", ".", "entrySet", "(", ")", ")", "{", "int", "s_k", "=", "item", ".", "getKey", "(", ")", ";", "List", "<", "Integer", ">", "triggers", "=", "item", ".", "getValue", "(", ")", ";", "for", "(", "int", "j", ":", "triggers", ")", "{", "d", ".", "addEdge", "(", "j", ",", "s", ".", "size", "(", ")", "+", "g", ".", "index", "(", "s_k", ")", ")", ";", "}", "}", "return", "d", ";", "}" ]
return a DAG, G' = V', E' such that vertecies correspond to indexes in the schedule and there is an edge (i,j) \in E' if s_i triggered s_j
[ "return", "a", "DAG", "G", "=", "V", "E", "such", "that", "vertecies", "correspond", "to", "indexes", "in", "the", "schedule", "and", "there", "is", "an", "edge", "(", "i", "j", ")", "\\", "in", "E", "if", "s_i", "triggered", "s_j" ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/sch/util/ScheduleUtils.java#L33-L62
Bedework/bw-util
bw-util-config/src/main/java/org/bedework/util/config/ConfigBase.java
ConfigBase.setListProperty
@SuppressWarnings("unchecked") public <L extends List> L setListProperty(final L list, final String name, final String val) { """ Set a property @param list the list - possibly null @param name of property @param val of property @return possibly newly created list """ removeProperty(list, name); return addListProperty(list, name, val); }
java
@SuppressWarnings("unchecked") public <L extends List> L setListProperty(final L list, final String name, final String val) { removeProperty(list, name); return addListProperty(list, name, val); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "L", "extends", "List", ">", "L", "setListProperty", "(", "final", "L", "list", ",", "final", "String", "name", ",", "final", "String", "val", ")", "{", "removeProperty", "(", "list", ",", "name", ")", ";", "return", "addListProperty", "(", "list", ",", "name", ",", "val", ")", ";", "}" ]
Set a property @param list the list - possibly null @param name of property @param val of property @return possibly newly created list
[ "Set", "a", "property" ]
train
https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-config/src/main/java/org/bedework/util/config/ConfigBase.java#L246-L252
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/util/AbstractLog.java
AbstractLog.mandatoryNote
public void mandatoryNote(final JavaFileObject file, String key, Object ... args) { """ Provide a non-fatal notification, unless suppressed by the -nowarn option. @param key The key for the localized notification message. @param args Fields of the notification message. """ report(diags.mandatoryNote(getSource(file), key, args)); }
java
public void mandatoryNote(final JavaFileObject file, String key, Object ... args) { report(diags.mandatoryNote(getSource(file), key, args)); }
[ "public", "void", "mandatoryNote", "(", "final", "JavaFileObject", "file", ",", "String", "key", ",", "Object", "...", "args", ")", "{", "report", "(", "diags", ".", "mandatoryNote", "(", "getSource", "(", "file", ")", ",", "key", ",", "args", ")", ")", ";", "}" ]
Provide a non-fatal notification, unless suppressed by the -nowarn option. @param key The key for the localized notification message. @param args Fields of the notification message.
[ "Provide", "a", "non", "-", "fatal", "notification", "unless", "suppressed", "by", "the", "-", "nowarn", "option", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/util/AbstractLog.java#L238-L240
azkaban/azkaban
azkaban-common/src/main/java/azkaban/utils/RestfulApiClient.java
RestfulApiClient.httpPost
public T httpPost(final URI uri, final List<Pair<String, String>> params) throws IOException { """ function to perform a Post http request. @param uri the URI of the request. @param params the form params to be posted, optional. @return the response object type of which is specified by user. @throws UnsupportedEncodingException, IOException """ // shortcut if the passed url is invalid. if (null == uri) { logger.error(" unable to perform httpPost as the passed uri is null."); return null; } final HttpPost post = new HttpPost(uri); return this.sendAndReturn(completeRequest(post, params)); }
java
public T httpPost(final URI uri, final List<Pair<String, String>> params) throws IOException { // shortcut if the passed url is invalid. if (null == uri) { logger.error(" unable to perform httpPost as the passed uri is null."); return null; } final HttpPost post = new HttpPost(uri); return this.sendAndReturn(completeRequest(post, params)); }
[ "public", "T", "httpPost", "(", "final", "URI", "uri", ",", "final", "List", "<", "Pair", "<", "String", ",", "String", ">", ">", "params", ")", "throws", "IOException", "{", "// shortcut if the passed url is invalid.", "if", "(", "null", "==", "uri", ")", "{", "logger", ".", "error", "(", "\" unable to perform httpPost as the passed uri is null.\"", ")", ";", "return", "null", ";", "}", "final", "HttpPost", "post", "=", "new", "HttpPost", "(", "uri", ")", ";", "return", "this", ".", "sendAndReturn", "(", "completeRequest", "(", "post", ",", "params", ")", ")", ";", "}" ]
function to perform a Post http request. @param uri the URI of the request. @param params the form params to be posted, optional. @return the response object type of which is specified by user. @throws UnsupportedEncodingException, IOException
[ "function", "to", "perform", "a", "Post", "http", "request", "." ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/utils/RestfulApiClient.java#L117-L126
raphw/byte-buddy
byte-buddy-maven-plugin/src/main/java/net/bytebuddy/build/maven/AbstractUserConfiguration.java
AbstractUserConfiguration.asCoordinate
public MavenCoordinate asCoordinate(String groupId, String artifactId, String version, String packaging) { """ Resolves this transformation to a Maven coordinate. @param groupId The current project's build id. @param artifactId The current project's artifact id. @param version The current project's version. @param packaging The current project's packaging @return The resolved Maven coordinate. """ return new MavenCoordinate(getGroupId(groupId), getArtifactId(artifactId), getVersion(version), getPackaging(packaging)); }
java
public MavenCoordinate asCoordinate(String groupId, String artifactId, String version, String packaging) { return new MavenCoordinate(getGroupId(groupId), getArtifactId(artifactId), getVersion(version), getPackaging(packaging)); }
[ "public", "MavenCoordinate", "asCoordinate", "(", "String", "groupId", ",", "String", "artifactId", ",", "String", "version", ",", "String", "packaging", ")", "{", "return", "new", "MavenCoordinate", "(", "getGroupId", "(", "groupId", ")", ",", "getArtifactId", "(", "artifactId", ")", ",", "getVersion", "(", "version", ")", ",", "getPackaging", "(", "packaging", ")", ")", ";", "}" ]
Resolves this transformation to a Maven coordinate. @param groupId The current project's build id. @param artifactId The current project's artifact id. @param version The current project's version. @param packaging The current project's packaging @return The resolved Maven coordinate.
[ "Resolves", "this", "transformation", "to", "a", "Maven", "coordinate", "." ]
train
https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-maven-plugin/src/main/java/net/bytebuddy/build/maven/AbstractUserConfiguration.java#L104-L106
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/TypeUtility.java
TypeUtility.parameterizedTypeName
public static TypeName parameterizedTypeName(ClassName rawClass, TypeName paramClass) { """ Parameterized type name. @param rawClass the raw class @param paramClass the param class @return the type name """ return ParameterizedTypeName.get(rawClass, paramClass); }
java
public static TypeName parameterizedTypeName(ClassName rawClass, TypeName paramClass) { return ParameterizedTypeName.get(rawClass, paramClass); }
[ "public", "static", "TypeName", "parameterizedTypeName", "(", "ClassName", "rawClass", ",", "TypeName", "paramClass", ")", "{", "return", "ParameterizedTypeName", ".", "get", "(", "rawClass", ",", "paramClass", ")", ";", "}" ]
Parameterized type name. @param rawClass the raw class @param paramClass the param class @return the type name
[ "Parameterized", "type", "name", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/TypeUtility.java#L521-L523