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
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/FavoritesApi.java
FavoritesApi.getContext
public Context getContext(String photoId, String userId) throws JinxException { """ Returns next and previous favorites for a photo in a user's favorites. <br> This method does not require authentication. @param photoId Required. The id of the photo to fetch the context for. @param userId Required. The user who counts the photo as a favorite. @return object with context information. @throws JinxException if required parameters are null or empty, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.favorites.getContext.htm">flickr.favorites.getContext</a> """ JinxUtils.validateParams(photoId, userId); Map<String, String> params = new TreeMap<String, String>(); params.put("method", "flickr.favorites.getContext"); params.put("photo_id", photoId); params.put("user_id", userId); return jinx.flickrPost(params, Context.class); }
java
public Context getContext(String photoId, String userId) throws JinxException { JinxUtils.validateParams(photoId, userId); Map<String, String> params = new TreeMap<String, String>(); params.put("method", "flickr.favorites.getContext"); params.put("photo_id", photoId); params.put("user_id", userId); return jinx.flickrPost(params, Context.class); }
[ "public", "Context", "getContext", "(", "String", "photoId", ",", "String", "userId", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validateParams", "(", "photoId", ",", "userId", ")", ";", "Map", "<", "String", ",", "String", ">", "params", "=", "new", "TreeMap", "<", "String", ",", "String", ">", "(", ")", ";", "params", ".", "put", "(", "\"method\"", ",", "\"flickr.favorites.getContext\"", ")", ";", "params", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "params", ".", "put", "(", "\"user_id\"", ",", "userId", ")", ";", "return", "jinx", ".", "flickrPost", "(", "params", ",", "Context", ".", "class", ")", ";", "}" ]
Returns next and previous favorites for a photo in a user's favorites. <br> This method does not require authentication. @param photoId Required. The id of the photo to fetch the context for. @param userId Required. The user who counts the photo as a favorite. @return object with context information. @throws JinxException if required parameters are null or empty, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.favorites.getContext.htm">flickr.favorites.getContext</a>
[ "Returns", "next", "and", "previous", "favorites", "for", "a", "photo", "in", "a", "user", "s", "favorites", ".", "<br", ">", "This", "method", "does", "not", "require", "authentication", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/FavoritesApi.java#L77-L84
voldemort/voldemort
src/java/voldemort/server/VoldemortConfig.java
VoldemortConfig.getDynamicDefaults
private Props getDynamicDefaults(Props userSuppliedConfig) { """ This function returns a set of default configs which cannot be defined statically, because they (at least potentially) depend on the config values provided by the user. """ // Combined set of configs made up of user supplied configs first, while falling back // on statically defined defaults when the value is missing from the user supplied ones. Props combinedConfigs = new Props(userSuppliedConfig, defaultConfig); // Set of dynamic configs which depend on the combined configs in order to be determined. Props dynamicDefaults = new Props(); initializeNodeId(combinedConfigs, dynamicDefaults); // Define various paths String defaultDataDirectory = combinedConfigs.getString(VOLDEMORT_HOME) + File.separator + "data"; String dataDirectory = combinedConfigs.getString(DATA_DIRECTORY, defaultDataDirectory); dynamicDefaults.put(DATA_DIRECTORY, dataDirectory); dynamicDefaults.put(BDB_DATA_DIRECTORY, dataDirectory + File.separator + "bdb"); dynamicDefaults.put(READONLY_DATA_DIRECTORY, dataDirectory + File.separator + "read-only"); dynamicDefaults.put(ROCKSDB_DATA_DIR, dataDirectory + File.separator + "rocksdb"); String metadataDirectory = combinedConfigs.getString(VOLDEMORT_HOME) + File.separator + "config"; dynamicDefaults.put(METADATA_DIRECTORY, metadataDirectory); dynamicDefaults.put(READONLY_KEYTAB_PATH, metadataDirectory + File.separator + "voldemrt.headless.keytab"); dynamicDefaults.put(READONLY_HADOOP_CONFIG_PATH, metadataDirectory + File.separator + "hadoop-conf"); // Other "transitive" config values. dynamicDefaults.put(CORE_THREADS, Math.max(1, combinedConfigs.getInt(MAX_THREADS) / 2)); dynamicDefaults.put(ADMIN_CORE_THREADS, Math.max(1, combinedConfigs.getInt(ADMIN_MAX_THREADS) / 2)); dynamicDefaults.put(CLIENT_ROUTING_GET_TIMEOUT_MS, combinedConfigs.getInt(CLIENT_ROUTING_TIMEOUT_MS)); dynamicDefaults.put(CLIENT_ROUTING_GETALL_TIMEOUT_MS, combinedConfigs.getInt(CLIENT_ROUTING_TIMEOUT_MS)); int clientRoutingPutTimeoutMs = combinedConfigs.getInt(CLIENT_ROUTING_TIMEOUT_MS); dynamicDefaults.put(CLIENT_ROUTING_PUT_TIMEOUT_MS, clientRoutingPutTimeoutMs); dynamicDefaults.put(CLIENT_ROUTING_GETVERSIONS_TIMEOUT_MS, combinedConfigs.getInt(CLIENT_ROUTING_PUT_TIMEOUT_MS, clientRoutingPutTimeoutMs)); dynamicDefaults.put(CLIENT_ROUTING_DELETE_TIMEOUT_MS, combinedConfigs.getInt(CLIENT_ROUTING_TIMEOUT_MS)); dynamicDefaults.put(FAILUREDETECTOR_REQUEST_LENGTH_THRESHOLD, combinedConfigs.getInt(SOCKET_TIMEOUT_MS)); dynamicDefaults.put(REST_SERVICE_STORAGE_THREAD_POOL_QUEUE_SIZE, combinedConfigs.getInt(NUM_REST_SERVICE_STORAGE_THREADS)); // We're changing the property from "client.node.bannage.ms" to // "failuredetector.bannage.period" so if we have the old one, migrate it over. if(userSuppliedConfig.containsKey(CLIENT_NODE_BANNAGE_MS) && !userSuppliedConfig.containsKey(FAILUREDETECTOR_BANNAGE_PERIOD)) { dynamicDefaults.put(FAILUREDETECTOR_BANNAGE_PERIOD, userSuppliedConfig.getInt(CLIENT_NODE_BANNAGE_MS)); } return dynamicDefaults; }
java
private Props getDynamicDefaults(Props userSuppliedConfig) { // Combined set of configs made up of user supplied configs first, while falling back // on statically defined defaults when the value is missing from the user supplied ones. Props combinedConfigs = new Props(userSuppliedConfig, defaultConfig); // Set of dynamic configs which depend on the combined configs in order to be determined. Props dynamicDefaults = new Props(); initializeNodeId(combinedConfigs, dynamicDefaults); // Define various paths String defaultDataDirectory = combinedConfigs.getString(VOLDEMORT_HOME) + File.separator + "data"; String dataDirectory = combinedConfigs.getString(DATA_DIRECTORY, defaultDataDirectory); dynamicDefaults.put(DATA_DIRECTORY, dataDirectory); dynamicDefaults.put(BDB_DATA_DIRECTORY, dataDirectory + File.separator + "bdb"); dynamicDefaults.put(READONLY_DATA_DIRECTORY, dataDirectory + File.separator + "read-only"); dynamicDefaults.put(ROCKSDB_DATA_DIR, dataDirectory + File.separator + "rocksdb"); String metadataDirectory = combinedConfigs.getString(VOLDEMORT_HOME) + File.separator + "config"; dynamicDefaults.put(METADATA_DIRECTORY, metadataDirectory); dynamicDefaults.put(READONLY_KEYTAB_PATH, metadataDirectory + File.separator + "voldemrt.headless.keytab"); dynamicDefaults.put(READONLY_HADOOP_CONFIG_PATH, metadataDirectory + File.separator + "hadoop-conf"); // Other "transitive" config values. dynamicDefaults.put(CORE_THREADS, Math.max(1, combinedConfigs.getInt(MAX_THREADS) / 2)); dynamicDefaults.put(ADMIN_CORE_THREADS, Math.max(1, combinedConfigs.getInt(ADMIN_MAX_THREADS) / 2)); dynamicDefaults.put(CLIENT_ROUTING_GET_TIMEOUT_MS, combinedConfigs.getInt(CLIENT_ROUTING_TIMEOUT_MS)); dynamicDefaults.put(CLIENT_ROUTING_GETALL_TIMEOUT_MS, combinedConfigs.getInt(CLIENT_ROUTING_TIMEOUT_MS)); int clientRoutingPutTimeoutMs = combinedConfigs.getInt(CLIENT_ROUTING_TIMEOUT_MS); dynamicDefaults.put(CLIENT_ROUTING_PUT_TIMEOUT_MS, clientRoutingPutTimeoutMs); dynamicDefaults.put(CLIENT_ROUTING_GETVERSIONS_TIMEOUT_MS, combinedConfigs.getInt(CLIENT_ROUTING_PUT_TIMEOUT_MS, clientRoutingPutTimeoutMs)); dynamicDefaults.put(CLIENT_ROUTING_DELETE_TIMEOUT_MS, combinedConfigs.getInt(CLIENT_ROUTING_TIMEOUT_MS)); dynamicDefaults.put(FAILUREDETECTOR_REQUEST_LENGTH_THRESHOLD, combinedConfigs.getInt(SOCKET_TIMEOUT_MS)); dynamicDefaults.put(REST_SERVICE_STORAGE_THREAD_POOL_QUEUE_SIZE, combinedConfigs.getInt(NUM_REST_SERVICE_STORAGE_THREADS)); // We're changing the property from "client.node.bannage.ms" to // "failuredetector.bannage.period" so if we have the old one, migrate it over. if(userSuppliedConfig.containsKey(CLIENT_NODE_BANNAGE_MS) && !userSuppliedConfig.containsKey(FAILUREDETECTOR_BANNAGE_PERIOD)) { dynamicDefaults.put(FAILUREDETECTOR_BANNAGE_PERIOD, userSuppliedConfig.getInt(CLIENT_NODE_BANNAGE_MS)); } return dynamicDefaults; }
[ "private", "Props", "getDynamicDefaults", "(", "Props", "userSuppliedConfig", ")", "{", "// Combined set of configs made up of user supplied configs first, while falling back", "// on statically defined defaults when the value is missing from the user supplied ones.", "Props", "combinedConfigs", "=", "new", "Props", "(", "userSuppliedConfig", ",", "defaultConfig", ")", ";", "// Set of dynamic configs which depend on the combined configs in order to be determined.", "Props", "dynamicDefaults", "=", "new", "Props", "(", ")", ";", "initializeNodeId", "(", "combinedConfigs", ",", "dynamicDefaults", ")", ";", "// Define various paths", "String", "defaultDataDirectory", "=", "combinedConfigs", ".", "getString", "(", "VOLDEMORT_HOME", ")", "+", "File", ".", "separator", "+", "\"data\"", ";", "String", "dataDirectory", "=", "combinedConfigs", ".", "getString", "(", "DATA_DIRECTORY", ",", "defaultDataDirectory", ")", ";", "dynamicDefaults", ".", "put", "(", "DATA_DIRECTORY", ",", "dataDirectory", ")", ";", "dynamicDefaults", ".", "put", "(", "BDB_DATA_DIRECTORY", ",", "dataDirectory", "+", "File", ".", "separator", "+", "\"bdb\"", ")", ";", "dynamicDefaults", ".", "put", "(", "READONLY_DATA_DIRECTORY", ",", "dataDirectory", "+", "File", ".", "separator", "+", "\"read-only\"", ")", ";", "dynamicDefaults", ".", "put", "(", "ROCKSDB_DATA_DIR", ",", "dataDirectory", "+", "File", ".", "separator", "+", "\"rocksdb\"", ")", ";", "String", "metadataDirectory", "=", "combinedConfigs", ".", "getString", "(", "VOLDEMORT_HOME", ")", "+", "File", ".", "separator", "+", "\"config\"", ";", "dynamicDefaults", ".", "put", "(", "METADATA_DIRECTORY", ",", "metadataDirectory", ")", ";", "dynamicDefaults", ".", "put", "(", "READONLY_KEYTAB_PATH", ",", "metadataDirectory", "+", "File", ".", "separator", "+", "\"voldemrt.headless.keytab\"", ")", ";", "dynamicDefaults", ".", "put", "(", "READONLY_HADOOP_CONFIG_PATH", ",", "metadataDirectory", "+", "File", ".", "separator", "+", "\"hadoop-conf\"", ")", ";", "// Other \"transitive\" config values.", "dynamicDefaults", ".", "put", "(", "CORE_THREADS", ",", "Math", ".", "max", "(", "1", ",", "combinedConfigs", ".", "getInt", "(", "MAX_THREADS", ")", "/", "2", ")", ")", ";", "dynamicDefaults", ".", "put", "(", "ADMIN_CORE_THREADS", ",", "Math", ".", "max", "(", "1", ",", "combinedConfigs", ".", "getInt", "(", "ADMIN_MAX_THREADS", ")", "/", "2", ")", ")", ";", "dynamicDefaults", ".", "put", "(", "CLIENT_ROUTING_GET_TIMEOUT_MS", ",", "combinedConfigs", ".", "getInt", "(", "CLIENT_ROUTING_TIMEOUT_MS", ")", ")", ";", "dynamicDefaults", ".", "put", "(", "CLIENT_ROUTING_GETALL_TIMEOUT_MS", ",", "combinedConfigs", ".", "getInt", "(", "CLIENT_ROUTING_TIMEOUT_MS", ")", ")", ";", "int", "clientRoutingPutTimeoutMs", "=", "combinedConfigs", ".", "getInt", "(", "CLIENT_ROUTING_TIMEOUT_MS", ")", ";", "dynamicDefaults", ".", "put", "(", "CLIENT_ROUTING_PUT_TIMEOUT_MS", ",", "clientRoutingPutTimeoutMs", ")", ";", "dynamicDefaults", ".", "put", "(", "CLIENT_ROUTING_GETVERSIONS_TIMEOUT_MS", ",", "combinedConfigs", ".", "getInt", "(", "CLIENT_ROUTING_PUT_TIMEOUT_MS", ",", "clientRoutingPutTimeoutMs", ")", ")", ";", "dynamicDefaults", ".", "put", "(", "CLIENT_ROUTING_DELETE_TIMEOUT_MS", ",", "combinedConfigs", ".", "getInt", "(", "CLIENT_ROUTING_TIMEOUT_MS", ")", ")", ";", "dynamicDefaults", ".", "put", "(", "FAILUREDETECTOR_REQUEST_LENGTH_THRESHOLD", ",", "combinedConfigs", ".", "getInt", "(", "SOCKET_TIMEOUT_MS", ")", ")", ";", "dynamicDefaults", ".", "put", "(", "REST_SERVICE_STORAGE_THREAD_POOL_QUEUE_SIZE", ",", "combinedConfigs", ".", "getInt", "(", "NUM_REST_SERVICE_STORAGE_THREADS", ")", ")", ";", "// We're changing the property from \"client.node.bannage.ms\" to", "// \"failuredetector.bannage.period\" so if we have the old one, migrate it over.", "if", "(", "userSuppliedConfig", ".", "containsKey", "(", "CLIENT_NODE_BANNAGE_MS", ")", "&&", "!", "userSuppliedConfig", ".", "containsKey", "(", "FAILUREDETECTOR_BANNAGE_PERIOD", ")", ")", "{", "dynamicDefaults", ".", "put", "(", "FAILUREDETECTOR_BANNAGE_PERIOD", ",", "userSuppliedConfig", ".", "getInt", "(", "CLIENT_NODE_BANNAGE_MS", ")", ")", ";", "}", "return", "dynamicDefaults", ";", "}" ]
This function returns a set of default configs which cannot be defined statically, because they (at least potentially) depend on the config values provided by the user.
[ "This", "function", "returns", "a", "set", "of", "default", "configs", "which", "cannot", "be", "defined", "statically", "because", "they", "(", "at", "least", "potentially", ")", "depend", "on", "the", "config", "values", "provided", "by", "the", "user", "." ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/server/VoldemortConfig.java#L761-L803
mygreen/super-csv-annotation
src/main/java/com/github/mygreen/supercsv/builder/time/AbstractTemporalProcessorBuilder.java
AbstractTemporalProcessorBuilder.createFormatter
protected DateTimeFormatter createFormatter(final FieldAccessor field, final Configuration config) { """ 変換規則から、{@link DateTimeFormatter}のインスタンスを作成する。 <p>アノテーション{@link CsvDateTimeFormat}が付与されていない場合は、各種タイプごとの標準の書式で作成する。</p> @param field フィールド情報 @param config システム設定 @return {@link DateTimeFormatter}のインスタンス。 """ final Optional<CsvDateTimeFormat> formatAnno = field.getAnnotation(CsvDateTimeFormat.class); if(!formatAnno.isPresent()) { return DateTimeFormatter.ofPattern(getDefaultPattern()); } String pattern = formatAnno.get().pattern(); if(pattern.isEmpty()) { pattern = getDefaultPattern(); } final ResolverStyle style = formatAnno.get().lenient() ? ResolverStyle.LENIENT : ResolverStyle.STRICT; final Locale locale = Utils.getLocale(formatAnno.get().locale()); final ZoneId zone = formatAnno.get().timezone().isEmpty() ? ZoneId.systemDefault() : TimeZone.getTimeZone(formatAnno.get().timezone()).toZoneId(); return DateTimeFormatter.ofPattern(pattern, locale) .withResolverStyle(style) .withZone(zone); }
java
protected DateTimeFormatter createFormatter(final FieldAccessor field, final Configuration config) { final Optional<CsvDateTimeFormat> formatAnno = field.getAnnotation(CsvDateTimeFormat.class); if(!formatAnno.isPresent()) { return DateTimeFormatter.ofPattern(getDefaultPattern()); } String pattern = formatAnno.get().pattern(); if(pattern.isEmpty()) { pattern = getDefaultPattern(); } final ResolverStyle style = formatAnno.get().lenient() ? ResolverStyle.LENIENT : ResolverStyle.STRICT; final Locale locale = Utils.getLocale(formatAnno.get().locale()); final ZoneId zone = formatAnno.get().timezone().isEmpty() ? ZoneId.systemDefault() : TimeZone.getTimeZone(formatAnno.get().timezone()).toZoneId(); return DateTimeFormatter.ofPattern(pattern, locale) .withResolverStyle(style) .withZone(zone); }
[ "protected", "DateTimeFormatter", "createFormatter", "(", "final", "FieldAccessor", "field", ",", "final", "Configuration", "config", ")", "{", "final", "Optional", "<", "CsvDateTimeFormat", ">", "formatAnno", "=", "field", ".", "getAnnotation", "(", "CsvDateTimeFormat", ".", "class", ")", ";", "if", "(", "!", "formatAnno", ".", "isPresent", "(", ")", ")", "{", "return", "DateTimeFormatter", ".", "ofPattern", "(", "getDefaultPattern", "(", ")", ")", ";", "}", "String", "pattern", "=", "formatAnno", ".", "get", "(", ")", ".", "pattern", "(", ")", ";", "if", "(", "pattern", ".", "isEmpty", "(", ")", ")", "{", "pattern", "=", "getDefaultPattern", "(", ")", ";", "}", "final", "ResolverStyle", "style", "=", "formatAnno", ".", "get", "(", ")", ".", "lenient", "(", ")", "?", "ResolverStyle", ".", "LENIENT", ":", "ResolverStyle", ".", "STRICT", ";", "final", "Locale", "locale", "=", "Utils", ".", "getLocale", "(", "formatAnno", ".", "get", "(", ")", ".", "locale", "(", ")", ")", ";", "final", "ZoneId", "zone", "=", "formatAnno", ".", "get", "(", ")", ".", "timezone", "(", ")", ".", "isEmpty", "(", ")", "?", "ZoneId", ".", "systemDefault", "(", ")", ":", "TimeZone", ".", "getTimeZone", "(", "formatAnno", ".", "get", "(", ")", ".", "timezone", "(", ")", ")", ".", "toZoneId", "(", ")", ";", "return", "DateTimeFormatter", ".", "ofPattern", "(", "pattern", ",", "locale", ")", ".", "withResolverStyle", "(", "style", ")", ".", "withZone", "(", "zone", ")", ";", "}" ]
変換規則から、{@link DateTimeFormatter}のインスタンスを作成する。 <p>アノテーション{@link CsvDateTimeFormat}が付与されていない場合は、各種タイプごとの標準の書式で作成する。</p> @param field フィールド情報 @param config システム設定 @return {@link DateTimeFormatter}のインスタンス。
[ "変換規則から、", "{" ]
train
https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/builder/time/AbstractTemporalProcessorBuilder.java#L60-L81
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/XlsSaver.java
XlsSaver.saveMultiple
public void saveMultiple(final InputStream templateXlsIn, final OutputStream xlsOut, final Object[] beanObjs) throws XlsMapperException, IOException { """ 複数のオブジェクトをそれぞれのシートへ保存する。 @param templateXlsIn 雛形となるExcelファイルの入力 @param xlsOut xlsOut 出力先のストリーム @param beanObjs 書き込むオブジェクトの配列。 @throws IllegalArgumentException {@literal templateXlsIn == null or xlsOut == null or beanObjs == null} @throws XlsMapperException マッピングに失敗した場合 @throws IOException テンプレートのファイルの読み込みやファイルの出力に失敗した場合 """ saveMultipleDetail(templateXlsIn, xlsOut, beanObjs); }
java
public void saveMultiple(final InputStream templateXlsIn, final OutputStream xlsOut, final Object[] beanObjs) throws XlsMapperException, IOException { saveMultipleDetail(templateXlsIn, xlsOut, beanObjs); }
[ "public", "void", "saveMultiple", "(", "final", "InputStream", "templateXlsIn", ",", "final", "OutputStream", "xlsOut", ",", "final", "Object", "[", "]", "beanObjs", ")", "throws", "XlsMapperException", ",", "IOException", "{", "saveMultipleDetail", "(", "templateXlsIn", ",", "xlsOut", ",", "beanObjs", ")", ";", "}" ]
複数のオブジェクトをそれぞれのシートへ保存する。 @param templateXlsIn 雛形となるExcelファイルの入力 @param xlsOut xlsOut 出力先のストリーム @param beanObjs 書き込むオブジェクトの配列。 @throws IllegalArgumentException {@literal templateXlsIn == null or xlsOut == null or beanObjs == null} @throws XlsMapperException マッピングに失敗した場合 @throws IOException テンプレートのファイルの読み込みやファイルの出力に失敗した場合
[ "複数のオブジェクトをそれぞれのシートへ保存する。" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/XlsSaver.java#L160-L164
Azure/azure-sdk-for-java
sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansInner.java
ManagedDatabaseVulnerabilityAssessmentScansInner.getAsync
public Observable<VulnerabilityAssessmentScanRecordInner> getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { """ Gets a vulnerability assessment scan record of a database. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param managedInstanceName The name of the managed instance. @param databaseName The name of the database. @param scanId The vulnerability assessment scan Id of the scan to retrieve. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VulnerabilityAssessmentScanRecordInner object """ return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).map(new Func1<ServiceResponse<VulnerabilityAssessmentScanRecordInner>, VulnerabilityAssessmentScanRecordInner>() { @Override public VulnerabilityAssessmentScanRecordInner call(ServiceResponse<VulnerabilityAssessmentScanRecordInner> response) { return response.body(); } }); }
java
public Observable<VulnerabilityAssessmentScanRecordInner> getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).map(new Func1<ServiceResponse<VulnerabilityAssessmentScanRecordInner>, VulnerabilityAssessmentScanRecordInner>() { @Override public VulnerabilityAssessmentScanRecordInner call(ServiceResponse<VulnerabilityAssessmentScanRecordInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VulnerabilityAssessmentScanRecordInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "managedInstanceName", ",", "String", "databaseName", ",", "String", "scanId", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "managedInstanceName", ",", "databaseName", ",", "scanId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VulnerabilityAssessmentScanRecordInner", ">", ",", "VulnerabilityAssessmentScanRecordInner", ">", "(", ")", "{", "@", "Override", "public", "VulnerabilityAssessmentScanRecordInner", "call", "(", "ServiceResponse", "<", "VulnerabilityAssessmentScanRecordInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets a vulnerability assessment scan record of a database. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param managedInstanceName The name of the managed instance. @param databaseName The name of the database. @param scanId The vulnerability assessment scan Id of the scan to retrieve. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VulnerabilityAssessmentScanRecordInner object
[ "Gets", "a", "vulnerability", "assessment", "scan", "record", "of", "a", "database", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansInner.java#L260-L267
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-parameterserver/src/main/java/org/deeplearning4j/spark/parameterserver/modelimport/elephas/ElephasModelImport.java
ElephasModelImport.importElephasModelAndWeights
public static SparkComputationGraph importElephasModelAndWeights(JavaSparkContext sparkContext, String modelHdf5Filename) throws IOException, UnsupportedKerasConfigurationException, InvalidKerasConfigurationException { """ Load Elephas model stored using model.save(...) in case that the underlying Keras model is a functional `Model` instance, which corresponds to a DL4J SparkComputationGraph. @param sparkContext Java SparkContext @param modelHdf5Filename Path to HDF5 archive storing Elephas Model @return SparkComputationGraph Spark computation graph @throws IOException IO exception @throws InvalidKerasConfigurationException Invalid Keras config @throws UnsupportedKerasConfigurationException Unsupported Keras config @see SparkComputationGraph """ ComputationGraph model = KerasModelImport.importKerasModelAndWeights(modelHdf5Filename, true); Map<String, Object> distributedProperties = distributedTrainingMap(modelHdf5Filename); TrainingMaster tm = getTrainingMaster(distributedProperties); return new SparkComputationGraph(sparkContext, model, tm); }
java
public static SparkComputationGraph importElephasModelAndWeights(JavaSparkContext sparkContext, String modelHdf5Filename) throws IOException, UnsupportedKerasConfigurationException, InvalidKerasConfigurationException { ComputationGraph model = KerasModelImport.importKerasModelAndWeights(modelHdf5Filename, true); Map<String, Object> distributedProperties = distributedTrainingMap(modelHdf5Filename); TrainingMaster tm = getTrainingMaster(distributedProperties); return new SparkComputationGraph(sparkContext, model, tm); }
[ "public", "static", "SparkComputationGraph", "importElephasModelAndWeights", "(", "JavaSparkContext", "sparkContext", ",", "String", "modelHdf5Filename", ")", "throws", "IOException", ",", "UnsupportedKerasConfigurationException", ",", "InvalidKerasConfigurationException", "{", "ComputationGraph", "model", "=", "KerasModelImport", ".", "importKerasModelAndWeights", "(", "modelHdf5Filename", ",", "true", ")", ";", "Map", "<", "String", ",", "Object", ">", "distributedProperties", "=", "distributedTrainingMap", "(", "modelHdf5Filename", ")", ";", "TrainingMaster", "tm", "=", "getTrainingMaster", "(", "distributedProperties", ")", ";", "return", "new", "SparkComputationGraph", "(", "sparkContext", ",", "model", ",", "tm", ")", ";", "}" ]
Load Elephas model stored using model.save(...) in case that the underlying Keras model is a functional `Model` instance, which corresponds to a DL4J SparkComputationGraph. @param sparkContext Java SparkContext @param modelHdf5Filename Path to HDF5 archive storing Elephas Model @return SparkComputationGraph Spark computation graph @throws IOException IO exception @throws InvalidKerasConfigurationException Invalid Keras config @throws UnsupportedKerasConfigurationException Unsupported Keras config @see SparkComputationGraph
[ "Load", "Elephas", "model", "stored", "using", "model", ".", "save", "(", "...", ")", "in", "case", "that", "the", "underlying", "Keras", "model", "is", "a", "functional", "Model", "instance", "which", "corresponds", "to", "a", "DL4J", "SparkComputationGraph", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-parameterserver/src/main/java/org/deeplearning4j/spark/parameterserver/modelimport/elephas/ElephasModelImport.java#L68-L77
aws/aws-sdk-java
aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/CreateUserPoolRequest.java
CreateUserPoolRequest.withUserPoolTags
public CreateUserPoolRequest withUserPoolTags(java.util.Map<String, String> userPoolTags) { """ <p> The tag keys and values to assign to the user pool. A tag is a label that you can use to categorize and manage user pools in different ways, such as by purpose, owner, environment, or other criteria. </p> @param userPoolTags The tag keys and values to assign to the user pool. A tag is a label that you can use to categorize and manage user pools in different ways, such as by purpose, owner, environment, or other criteria. @return Returns a reference to this object so that method calls can be chained together. """ setUserPoolTags(userPoolTags); return this; }
java
public CreateUserPoolRequest withUserPoolTags(java.util.Map<String, String> userPoolTags) { setUserPoolTags(userPoolTags); return this; }
[ "public", "CreateUserPoolRequest", "withUserPoolTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "userPoolTags", ")", "{", "setUserPoolTags", "(", "userPoolTags", ")", ";", "return", "this", ";", "}" ]
<p> The tag keys and values to assign to the user pool. A tag is a label that you can use to categorize and manage user pools in different ways, such as by purpose, owner, environment, or other criteria. </p> @param userPoolTags The tag keys and values to assign to the user pool. A tag is a label that you can use to categorize and manage user pools in different ways, such as by purpose, owner, environment, or other criteria. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "tag", "keys", "and", "values", "to", "assign", "to", "the", "user", "pool", ".", "A", "tag", "is", "a", "label", "that", "you", "can", "use", "to", "categorize", "and", "manage", "user", "pools", "in", "different", "ways", "such", "as", "by", "purpose", "owner", "environment", "or", "other", "criteria", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/CreateUserPoolRequest.java#L1116-L1119
facebookarchive/hadoop-20
src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairScheduler.java
FairScheduler.isStarvedForFairShare
boolean isStarvedForFairShare(JobInfo info, TaskType type) { """ Is a job being starved for fair share for the given task type? This is defined as being below half its fair share *and* having a positive deficit. """ int desiredFairShare = (int) Math.floor(Math.min( (fairTasks(info, type) + 1) / 2, runnableTasks(info, type))); return (runningTasks(info, type) < desiredFairShare); }
java
boolean isStarvedForFairShare(JobInfo info, TaskType type) { int desiredFairShare = (int) Math.floor(Math.min( (fairTasks(info, type) + 1) / 2, runnableTasks(info, type))); return (runningTasks(info, type) < desiredFairShare); }
[ "boolean", "isStarvedForFairShare", "(", "JobInfo", "info", ",", "TaskType", "type", ")", "{", "int", "desiredFairShare", "=", "(", "int", ")", "Math", ".", "floor", "(", "Math", ".", "min", "(", "(", "fairTasks", "(", "info", ",", "type", ")", "+", "1", ")", "/", "2", ",", "runnableTasks", "(", "info", ",", "type", ")", ")", ")", ";", "return", "(", "runningTasks", "(", "info", ",", "type", ")", "<", "desiredFairShare", ")", ";", "}" ]
Is a job being starved for fair share for the given task type? This is defined as being below half its fair share *and* having a positive deficit.
[ "Is", "a", "job", "being", "starved", "for", "fair", "share", "for", "the", "given", "task", "type?", "This", "is", "defined", "as", "being", "below", "half", "its", "fair", "share", "*", "and", "*", "having", "a", "positive", "deficit", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairScheduler.java#L2252-L2256
Azure/autorest-clientruntime-for-java
azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/collection/implementation/ExternalChildResourcesCachedImpl.java
ExternalChildResourcesCachedImpl.prepareInlineDefine
protected final FluentModelTImpl prepareInlineDefine(String name, String key) { """ Prepare for inline definition of a new external child resource (along with the definition or update of parent resource). @param name the name of the new external child resource @param key the key @return the child resource """ if (find(key) != null) { throw new IllegalArgumentException("A child resource ('" + childResourceName + "') with name (key) '" + name + " (" + key + ")' already exists"); } FluentModelTImpl childResource = newChildResource(name); childResource.setPendingOperation(ExternalChildResourceImpl.PendingOperation.ToBeCreated); return super.prepareForFutureCommitOrPostRun(childResource); }
java
protected final FluentModelTImpl prepareInlineDefine(String name, String key) { if (find(key) != null) { throw new IllegalArgumentException("A child resource ('" + childResourceName + "') with name (key) '" + name + " (" + key + ")' already exists"); } FluentModelTImpl childResource = newChildResource(name); childResource.setPendingOperation(ExternalChildResourceImpl.PendingOperation.ToBeCreated); return super.prepareForFutureCommitOrPostRun(childResource); }
[ "protected", "final", "FluentModelTImpl", "prepareInlineDefine", "(", "String", "name", ",", "String", "key", ")", "{", "if", "(", "find", "(", "key", ")", "!=", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"A child resource ('\"", "+", "childResourceName", "+", "\"') with name (key) '\"", "+", "name", "+", "\" (\"", "+", "key", "+", "\")' already exists\"", ")", ";", "}", "FluentModelTImpl", "childResource", "=", "newChildResource", "(", "name", ")", ";", "childResource", ".", "setPendingOperation", "(", "ExternalChildResourceImpl", ".", "PendingOperation", ".", "ToBeCreated", ")", ";", "return", "super", ".", "prepareForFutureCommitOrPostRun", "(", "childResource", ")", ";", "}" ]
Prepare for inline definition of a new external child resource (along with the definition or update of parent resource). @param name the name of the new external child resource @param key the key @return the child resource
[ "Prepare", "for", "inline", "definition", "of", "a", "new", "external", "child", "resource", "(", "along", "with", "the", "definition", "or", "update", "of", "parent", "resource", ")", "." ]
train
https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/collection/implementation/ExternalChildResourcesCachedImpl.java#L92-L99
alkacon/opencms-core
src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java
CmsContainerpageController.addElements
protected void addElements(Map<String, CmsContainerElementData> elements) { """ Adds the given element data to the element cache.<p> @param elements the element data """ for (CmsContainerElementData element : elements.values()) { m_elements.put(element.getClientId(), element); } }
java
protected void addElements(Map<String, CmsContainerElementData> elements) { for (CmsContainerElementData element : elements.values()) { m_elements.put(element.getClientId(), element); } }
[ "protected", "void", "addElements", "(", "Map", "<", "String", ",", "CmsContainerElementData", ">", "elements", ")", "{", "for", "(", "CmsContainerElementData", "element", ":", "elements", ".", "values", "(", ")", ")", "{", "m_elements", ".", "put", "(", "element", ".", "getClientId", "(", ")", ",", "element", ")", ";", "}", "}" ]
Adds the given element data to the element cache.<p> @param elements the element data
[ "Adds", "the", "given", "element", "data", "to", "the", "element", "cache", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java#L3385-L3390
ngageoint/geopackage-java
src/main/java/mil/nga/geopackage/tiles/ImageUtils.java
ImageUtils.createBufferedImage
public static BufferedImage createBufferedImage(int width, int height, String imageFormat) { """ Create a buffered image for the dimensions and image format @param width image width @param height image height @param imageFormat image format @return image """ int imageType; switch (imageFormat.toLowerCase()) { case IMAGE_FORMAT_JPG: case IMAGE_FORMAT_JPEG: imageType = BufferedImage.TYPE_INT_RGB; break; default: imageType = BufferedImage.TYPE_INT_ARGB; } BufferedImage image = new BufferedImage(width, height, imageType); return image; }
java
public static BufferedImage createBufferedImage(int width, int height, String imageFormat) { int imageType; switch (imageFormat.toLowerCase()) { case IMAGE_FORMAT_JPG: case IMAGE_FORMAT_JPEG: imageType = BufferedImage.TYPE_INT_RGB; break; default: imageType = BufferedImage.TYPE_INT_ARGB; } BufferedImage image = new BufferedImage(width, height, imageType); return image; }
[ "public", "static", "BufferedImage", "createBufferedImage", "(", "int", "width", ",", "int", "height", ",", "String", "imageFormat", ")", "{", "int", "imageType", ";", "switch", "(", "imageFormat", ".", "toLowerCase", "(", ")", ")", "{", "case", "IMAGE_FORMAT_JPG", ":", "case", "IMAGE_FORMAT_JPEG", ":", "imageType", "=", "BufferedImage", ".", "TYPE_INT_RGB", ";", "break", ";", "default", ":", "imageType", "=", "BufferedImage", ".", "TYPE_INT_ARGB", ";", "}", "BufferedImage", "image", "=", "new", "BufferedImage", "(", "width", ",", "height", ",", "imageType", ")", ";", "return", "image", ";", "}" ]
Create a buffered image for the dimensions and image format @param width image width @param height image height @param imageFormat image format @return image
[ "Create", "a", "buffered", "image", "for", "the", "dimensions", "and", "image", "format" ]
train
https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/tiles/ImageUtils.java#L58-L75
molgenis/molgenis
molgenis-js/src/main/java/org/molgenis/js/magma/JsMagmaScriptEvaluator.java
JsMagmaScriptEvaluator.toScriptEngineValueMap
private Object toScriptEngineValueMap(Entity entity, int depth) { """ Convert entity to a JavaScript object. Adds "_idValue" as a special key to every level for quick access to the id value of an entity. @param entity The entity to be flattened, should start with non null entity @param depth Represents the number of reference levels being added to the JavaScript object @return A JavaScript object in Tree form, containing entities and there references """ if (entity != null) { Object idValue = toScriptEngineValue(entity, entity.getEntityType().getIdAttribute(), 0); if (depth == 0) { return idValue; } else { Map<String, Object> map = Maps.newHashMap(); entity .getEntityType() .getAtomicAttributes() .forEach(attr -> map.put(attr.getName(), toScriptEngineValue(entity, attr, depth))); map.put(KEY_ID_VALUE, idValue); return map; } } else { return null; } }
java
private Object toScriptEngineValueMap(Entity entity, int depth) { if (entity != null) { Object idValue = toScriptEngineValue(entity, entity.getEntityType().getIdAttribute(), 0); if (depth == 0) { return idValue; } else { Map<String, Object> map = Maps.newHashMap(); entity .getEntityType() .getAtomicAttributes() .forEach(attr -> map.put(attr.getName(), toScriptEngineValue(entity, attr, depth))); map.put(KEY_ID_VALUE, idValue); return map; } } else { return null; } }
[ "private", "Object", "toScriptEngineValueMap", "(", "Entity", "entity", ",", "int", "depth", ")", "{", "if", "(", "entity", "!=", "null", ")", "{", "Object", "idValue", "=", "toScriptEngineValue", "(", "entity", ",", "entity", ".", "getEntityType", "(", ")", ".", "getIdAttribute", "(", ")", ",", "0", ")", ";", "if", "(", "depth", "==", "0", ")", "{", "return", "idValue", ";", "}", "else", "{", "Map", "<", "String", ",", "Object", ">", "map", "=", "Maps", ".", "newHashMap", "(", ")", ";", "entity", ".", "getEntityType", "(", ")", ".", "getAtomicAttributes", "(", ")", ".", "forEach", "(", "attr", "->", "map", ".", "put", "(", "attr", ".", "getName", "(", ")", ",", "toScriptEngineValue", "(", "entity", ",", "attr", ",", "depth", ")", ")", ")", ";", "map", ".", "put", "(", "KEY_ID_VALUE", ",", "idValue", ")", ";", "return", "map", ";", "}", "}", "else", "{", "return", "null", ";", "}", "}" ]
Convert entity to a JavaScript object. Adds "_idValue" as a special key to every level for quick access to the id value of an entity. @param entity The entity to be flattened, should start with non null entity @param depth Represents the number of reference levels being added to the JavaScript object @return A JavaScript object in Tree form, containing entities and there references
[ "Convert", "entity", "to", "a", "JavaScript", "object", ".", "Adds", "_idValue", "as", "a", "special", "key", "to", "every", "level", "for", "quick", "access", "to", "the", "id", "value", "of", "an", "entity", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-js/src/main/java/org/molgenis/js/magma/JsMagmaScriptEvaluator.java#L149-L166
StripesFramework/stripes-stuff
src/main/java/org/stripesstuff/plugin/jstl/JstlBundleInterceptor.java
JstlBundleInterceptor.setMessageResourceBundle
@Override protected void setMessageResourceBundle(HttpServletRequest request, ResourceBundle bundle) { """ Sets the message resource bundle in the request using the JSTL's mechanism. """ Config.set(request, Config.FMT_LOCALIZATION_CONTEXT, new LocalizationContext(bundle, request.getLocale())); LOGGER.debug("Enabled JSTL localization using: ", bundle); LOGGER.debug("Loaded resource bundle ", bundle, " as default bundle"); }
java
@Override protected void setMessageResourceBundle(HttpServletRequest request, ResourceBundle bundle) { Config.set(request, Config.FMT_LOCALIZATION_CONTEXT, new LocalizationContext(bundle, request.getLocale())); LOGGER.debug("Enabled JSTL localization using: ", bundle); LOGGER.debug("Loaded resource bundle ", bundle, " as default bundle"); }
[ "@", "Override", "protected", "void", "setMessageResourceBundle", "(", "HttpServletRequest", "request", ",", "ResourceBundle", "bundle", ")", "{", "Config", ".", "set", "(", "request", ",", "Config", ".", "FMT_LOCALIZATION_CONTEXT", ",", "new", "LocalizationContext", "(", "bundle", ",", "request", ".", "getLocale", "(", ")", ")", ")", ";", "LOGGER", ".", "debug", "(", "\"Enabled JSTL localization using: \"", ",", "bundle", ")", ";", "LOGGER", ".", "debug", "(", "\"Loaded resource bundle \"", ",", "bundle", ",", "\" as default bundle\"", ")", ";", "}" ]
Sets the message resource bundle in the request using the JSTL's mechanism.
[ "Sets", "the", "message", "resource", "bundle", "in", "the", "request", "using", "the", "JSTL", "s", "mechanism", "." ]
train
https://github.com/StripesFramework/stripes-stuff/blob/51ad92b4bd5862ba34d7c18c5829fb00ea3a3811/src/main/java/org/stripesstuff/plugin/jstl/JstlBundleInterceptor.java#L104-L110
js-lib-com/commons
src/main/java/js/io/FilesOutputStream.java
FilesOutputStream.addFile
public void addFile(File file) throws IOException { """ Inject file content into archive using file relative path as archive entry name. File to add is relative to a common base directory. All files from this archive should be part of that base directory hierarchy; it is user code responsibility to enforce this constrain. @param file file to add to this archive. @throws IllegalArgumentException if <code>file</code> does not exist or is a directory. @throws IOException if archive writing operation fails. """ if (!file.exists()) { throw new IllegalArgumentException(String.format("File |%s| does not exist.", file)); } if (file.isDirectory()) { throw new IllegalArgumentException(String.format("File |%s| is a directory.", file)); } addFileEntry(file.getPath(), new FileInputStream(file)); }
java
public void addFile(File file) throws IOException { if (!file.exists()) { throw new IllegalArgumentException(String.format("File |%s| does not exist.", file)); } if (file.isDirectory()) { throw new IllegalArgumentException(String.format("File |%s| is a directory.", file)); } addFileEntry(file.getPath(), new FileInputStream(file)); }
[ "public", "void", "addFile", "(", "File", "file", ")", "throws", "IOException", "{", "if", "(", "!", "file", ".", "exists", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"File |%s| does not exist.\"", ",", "file", ")", ")", ";", "}", "if", "(", "file", ".", "isDirectory", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"File |%s| is a directory.\"", ",", "file", ")", ")", ";", "}", "addFileEntry", "(", "file", ".", "getPath", "(", ")", ",", "new", "FileInputStream", "(", "file", ")", ")", ";", "}" ]
Inject file content into archive using file relative path as archive entry name. File to add is relative to a common base directory. All files from this archive should be part of that base directory hierarchy; it is user code responsibility to enforce this constrain. @param file file to add to this archive. @throws IllegalArgumentException if <code>file</code> does not exist or is a directory. @throws IOException if archive writing operation fails.
[ "Inject", "file", "content", "into", "archive", "using", "file", "relative", "path", "as", "archive", "entry", "name", ".", "File", "to", "add", "is", "relative", "to", "a", "common", "base", "directory", ".", "All", "files", "from", "this", "archive", "should", "be", "part", "of", "that", "base", "directory", "hierarchy", ";", "it", "is", "user", "code", "responsibility", "to", "enforce", "this", "constrain", "." ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/io/FilesOutputStream.java#L144-L152
UrielCh/ovh-java-sdk
ovh-java-sdk-kube/src/main/java/net/minidev/ovh/api/ApiOvhKube.java
ApiOvhKube.serviceName_updatePolicy_PUT
public void serviceName_updatePolicy_PUT(String serviceName, OvhUpdatePolicy updatePolicy) throws IOException { """ Change the update policy of your cluster REST: PUT /kube/{serviceName}/updatePolicy @param serviceName [required] Cluster ID @param updatePolicy [required] Update policy API beta """ String qPath = "/kube/{serviceName}/updatePolicy"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "updatePolicy", updatePolicy); exec(qPath, "PUT", sb.toString(), o); }
java
public void serviceName_updatePolicy_PUT(String serviceName, OvhUpdatePolicy updatePolicy) throws IOException { String qPath = "/kube/{serviceName}/updatePolicy"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "updatePolicy", updatePolicy); exec(qPath, "PUT", sb.toString(), o); }
[ "public", "void", "serviceName_updatePolicy_PUT", "(", "String", "serviceName", ",", "OvhUpdatePolicy", "updatePolicy", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/kube/{serviceName}/updatePolicy\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"updatePolicy\"", ",", "updatePolicy", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "}" ]
Change the update policy of your cluster REST: PUT /kube/{serviceName}/updatePolicy @param serviceName [required] Cluster ID @param updatePolicy [required] Update policy API beta
[ "Change", "the", "update", "policy", "of", "your", "cluster" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-kube/src/main/java/net/minidev/ovh/api/ApiOvhKube.java#L294-L300
landawn/AbacusUtil
src/com/landawn/abacus/util/Multiset.java
Multiset.computeIfPresent
public <E extends Exception> int computeIfPresent(T e, Try.BiFunction<? super T, Integer, Integer, E> remappingFunction) throws E { """ The implementation is equivalent to performing the following steps for this Multiset: <pre> final int oldValue = get(e); if (oldValue == 0) { return oldValue; } final int newValue = remappingFunction.apply(e, oldValue); if (newValue > 0) { set(e, newValue); } else { remove(e); } return newValue; </pre> @param e @param remappingFunction @return """ N.checkArgNotNull(remappingFunction); final int oldValue = get(e); if (oldValue == 0) { return oldValue; } final int newValue = remappingFunction.apply(e, oldValue); if (newValue > 0) { set(e, newValue); } else { remove(e); } return newValue; }
java
public <E extends Exception> int computeIfPresent(T e, Try.BiFunction<? super T, Integer, Integer, E> remappingFunction) throws E { N.checkArgNotNull(remappingFunction); final int oldValue = get(e); if (oldValue == 0) { return oldValue; } final int newValue = remappingFunction.apply(e, oldValue); if (newValue > 0) { set(e, newValue); } else { remove(e); } return newValue; }
[ "public", "<", "E", "extends", "Exception", ">", "int", "computeIfPresent", "(", "T", "e", ",", "Try", ".", "BiFunction", "<", "?", "super", "T", ",", "Integer", ",", "Integer", ",", "E", ">", "remappingFunction", ")", "throws", "E", "{", "N", ".", "checkArgNotNull", "(", "remappingFunction", ")", ";", "final", "int", "oldValue", "=", "get", "(", "e", ")", ";", "if", "(", "oldValue", "==", "0", ")", "{", "return", "oldValue", ";", "}", "final", "int", "newValue", "=", "remappingFunction", ".", "apply", "(", "e", ",", "oldValue", ")", ";", "if", "(", "newValue", ">", "0", ")", "{", "set", "(", "e", ",", "newValue", ")", ";", "}", "else", "{", "remove", "(", "e", ")", ";", "}", "return", "newValue", ";", "}" ]
The implementation is equivalent to performing the following steps for this Multiset: <pre> final int oldValue = get(e); if (oldValue == 0) { return oldValue; } final int newValue = remappingFunction.apply(e, oldValue); if (newValue > 0) { set(e, newValue); } else { remove(e); } return newValue; </pre> @param e @param remappingFunction @return
[ "The", "implementation", "is", "equivalent", "to", "performing", "the", "following", "steps", "for", "this", "Multiset", ":" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Multiset.java#L1282-L1300
Viascom/groundwork
foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/builder/FoxHttpClientBuilder.java
FoxHttpClientBuilder.addFoxHttpPlaceholderEntry
public FoxHttpClientBuilder addFoxHttpPlaceholderEntry(String placeholder, String value) { """ Add a FoxHttpPlaceholderEntry to the FoxHttpPlaceholderStrategy @param placeholder name of the placeholder (without escape char) @param value value of the placeholder @return FoxHttpClientBuilder (this) """ foxHttpClient.getFoxHttpPlaceholderStrategy().addPlaceholder(placeholder, value); return this; }
java
public FoxHttpClientBuilder addFoxHttpPlaceholderEntry(String placeholder, String value) { foxHttpClient.getFoxHttpPlaceholderStrategy().addPlaceholder(placeholder, value); return this; }
[ "public", "FoxHttpClientBuilder", "addFoxHttpPlaceholderEntry", "(", "String", "placeholder", ",", "String", "value", ")", "{", "foxHttpClient", ".", "getFoxHttpPlaceholderStrategy", "(", ")", ".", "addPlaceholder", "(", "placeholder", ",", "value", ")", ";", "return", "this", ";", "}" ]
Add a FoxHttpPlaceholderEntry to the FoxHttpPlaceholderStrategy @param placeholder name of the placeholder (without escape char) @param value value of the placeholder @return FoxHttpClientBuilder (this)
[ "Add", "a", "FoxHttpPlaceholderEntry", "to", "the", "FoxHttpPlaceholderStrategy" ]
train
https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/builder/FoxHttpClientBuilder.java#L292-L295
jOOQ/jOOL
jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java
Agg.minAll
public static <T, U> Collector<T, ?, Seq<U>> minAll(Function<? super T, ? extends U> function, Comparator<? super U> comparator) { """ Get a {@link Collector} that calculates the <code>MIN()</code> function, producing multiple results. """ return collectingAndThen(minAllBy(function, comparator), t -> t.map(function)); }
java
public static <T, U> Collector<T, ?, Seq<U>> minAll(Function<? super T, ? extends U> function, Comparator<? super U> comparator) { return collectingAndThen(minAllBy(function, comparator), t -> t.map(function)); }
[ "public", "static", "<", "T", ",", "U", ">", "Collector", "<", "T", ",", "?", ",", "Seq", "<", "U", ">", ">", "minAll", "(", "Function", "<", "?", "super", "T", ",", "?", "extends", "U", ">", "function", ",", "Comparator", "<", "?", "super", "U", ">", "comparator", ")", "{", "return", "collectingAndThen", "(", "minAllBy", "(", "function", ",", "comparator", ")", ",", "t", "->", "t", ".", "map", "(", "function", ")", ")", ";", "}" ]
Get a {@link Collector} that calculates the <code>MIN()</code> function, producing multiple results.
[ "Get", "a", "{" ]
train
https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java#L242-L244
groovy/groovy-core
subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
Sql.asList
protected List<GroovyRowResult> asList(String sql, ResultSet rs, Closure metaClosure) throws SQLException { """ Hook to allow derived classes to override list of result collection behavior. The default behavior is to return a list of GroovyRowResult objects corresponding to each row in the ResultSet. @param sql query to execute @param rs the ResultSet to process @param metaClosure called for meta data (only once after sql execution) @return the resulting list of rows @throws SQLException if a database error occurs """ return asList(sql, rs, 0, 0, metaClosure); }
java
protected List<GroovyRowResult> asList(String sql, ResultSet rs, Closure metaClosure) throws SQLException { return asList(sql, rs, 0, 0, metaClosure); }
[ "protected", "List", "<", "GroovyRowResult", ">", "asList", "(", "String", "sql", ",", "ResultSet", "rs", ",", "Closure", "metaClosure", ")", "throws", "SQLException", "{", "return", "asList", "(", "sql", ",", "rs", ",", "0", ",", "0", ",", "metaClosure", ")", ";", "}" ]
Hook to allow derived classes to override list of result collection behavior. The default behavior is to return a list of GroovyRowResult objects corresponding to each row in the ResultSet. @param sql query to execute @param rs the ResultSet to process @param metaClosure called for meta data (only once after sql execution) @return the resulting list of rows @throws SQLException if a database error occurs
[ "Hook", "to", "allow", "derived", "classes", "to", "override", "list", "of", "result", "collection", "behavior", ".", "The", "default", "behavior", "is", "to", "return", "a", "list", "of", "GroovyRowResult", "objects", "corresponding", "to", "each", "row", "in", "the", "ResultSet", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L3922-L3924
iipc/webarchive-commons
src/main/java/org/archive/util/ByteOp.java
ByteOp.readToNull
public static byte[] readToNull(InputStream is, int maxSize) throws IOException { """ Read, buffer, and return bytes from is until a null byte is encountered @param is InputStream to read from @param maxSize maximum number of bytes to search for the null @return array of bytes read, INCLUDING TRAILING NULL @throws IOException if the underlying stream throws on, OR if the specified maximum buffer size is reached before a null byte is found @throws ShortByteReadException if EOF is encountered before a null byte """ byte[] bytes = new byte[maxSize]; int i = 0; while(i < maxSize) { int b = is.read(); if(b == -1) { throw new EOFException("NO NULL"); } bytes[i] = (byte) (b & 0xff); i++; if(b == 0) { return copy(bytes,0,i); } } // BUGBUG: This isn't the right exception!!! // TODO: just skip any more bytes until NULL or EOF // throw an EOF if we find it... produce warning, too throw new IOException("Buffer too small"); }
java
public static byte[] readToNull(InputStream is, int maxSize) throws IOException { byte[] bytes = new byte[maxSize]; int i = 0; while(i < maxSize) { int b = is.read(); if(b == -1) { throw new EOFException("NO NULL"); } bytes[i] = (byte) (b & 0xff); i++; if(b == 0) { return copy(bytes,0,i); } } // BUGBUG: This isn't the right exception!!! // TODO: just skip any more bytes until NULL or EOF // throw an EOF if we find it... produce warning, too throw new IOException("Buffer too small"); }
[ "public", "static", "byte", "[", "]", "readToNull", "(", "InputStream", "is", ",", "int", "maxSize", ")", "throws", "IOException", "{", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "maxSize", "]", ";", "int", "i", "=", "0", ";", "while", "(", "i", "<", "maxSize", ")", "{", "int", "b", "=", "is", ".", "read", "(", ")", ";", "if", "(", "b", "==", "-", "1", ")", "{", "throw", "new", "EOFException", "(", "\"NO NULL\"", ")", ";", "}", "bytes", "[", "i", "]", "=", "(", "byte", ")", "(", "b", "&", "0xff", ")", ";", "i", "++", ";", "if", "(", "b", "==", "0", ")", "{", "return", "copy", "(", "bytes", ",", "0", ",", "i", ")", ";", "}", "}", "// BUGBUG: This isn't the right exception!!!", "// TODO: just skip any more bytes until NULL or EOF", "// throw an EOF if we find it... produce warning, too", "throw", "new", "IOException", "(", "\"Buffer too small\"", ")", ";", "}" ]
Read, buffer, and return bytes from is until a null byte is encountered @param is InputStream to read from @param maxSize maximum number of bytes to search for the null @return array of bytes read, INCLUDING TRAILING NULL @throws IOException if the underlying stream throws on, OR if the specified maximum buffer size is reached before a null byte is found @throws ShortByteReadException if EOF is encountered before a null byte
[ "Read", "buffer", "and", "return", "bytes", "from", "is", "until", "a", "null", "byte", "is", "encountered" ]
train
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/ByteOp.java#L196-L216
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/TrueTypeFontUnicode.java
TrueTypeFontUnicode.getFontBaseType
private PdfDictionary getFontBaseType(PdfIndirectReference descendant, String subsetPrefix, PdfIndirectReference toUnicode) { """ Generates the font dictionary. @param descendant the descendant dictionary @param subsetPrefix the subset prefix @param toUnicode the ToUnicode stream @return the stream """ PdfDictionary dic = new PdfDictionary(PdfName.FONT); dic.put(PdfName.SUBTYPE, PdfName.TYPE0); // The PDF Reference manual advises to add -encoding to CID font names if (cff) dic.put(PdfName.BASEFONT, new PdfName(subsetPrefix+fontName+"-"+encoding)); //dic.put(PdfName.BASEFONT, new PdfName(subsetPrefix+fontName)); else dic.put(PdfName.BASEFONT, new PdfName(subsetPrefix + fontName)); //dic.put(PdfName.BASEFONT, new PdfName(fontName)); dic.put(PdfName.ENCODING, new PdfName(encoding)); dic.put(PdfName.DESCENDANTFONTS, new PdfArray(descendant)); if (toUnicode != null) dic.put(PdfName.TOUNICODE, toUnicode); return dic; }
java
private PdfDictionary getFontBaseType(PdfIndirectReference descendant, String subsetPrefix, PdfIndirectReference toUnicode) { PdfDictionary dic = new PdfDictionary(PdfName.FONT); dic.put(PdfName.SUBTYPE, PdfName.TYPE0); // The PDF Reference manual advises to add -encoding to CID font names if (cff) dic.put(PdfName.BASEFONT, new PdfName(subsetPrefix+fontName+"-"+encoding)); //dic.put(PdfName.BASEFONT, new PdfName(subsetPrefix+fontName)); else dic.put(PdfName.BASEFONT, new PdfName(subsetPrefix + fontName)); //dic.put(PdfName.BASEFONT, new PdfName(fontName)); dic.put(PdfName.ENCODING, new PdfName(encoding)); dic.put(PdfName.DESCENDANTFONTS, new PdfArray(descendant)); if (toUnicode != null) dic.put(PdfName.TOUNICODE, toUnicode); return dic; }
[ "private", "PdfDictionary", "getFontBaseType", "(", "PdfIndirectReference", "descendant", ",", "String", "subsetPrefix", ",", "PdfIndirectReference", "toUnicode", ")", "{", "PdfDictionary", "dic", "=", "new", "PdfDictionary", "(", "PdfName", ".", "FONT", ")", ";", "dic", ".", "put", "(", "PdfName", ".", "SUBTYPE", ",", "PdfName", ".", "TYPE0", ")", ";", "// The PDF Reference manual advises to add -encoding to CID font names", "if", "(", "cff", ")", "dic", ".", "put", "(", "PdfName", ".", "BASEFONT", ",", "new", "PdfName", "(", "subsetPrefix", "+", "fontName", "+", "\"-\"", "+", "encoding", ")", ")", ";", "//dic.put(PdfName.BASEFONT, new PdfName(subsetPrefix+fontName));", "else", "dic", ".", "put", "(", "PdfName", ".", "BASEFONT", ",", "new", "PdfName", "(", "subsetPrefix", "+", "fontName", ")", ")", ";", "//dic.put(PdfName.BASEFONT, new PdfName(fontName));", "dic", ".", "put", "(", "PdfName", ".", "ENCODING", ",", "new", "PdfName", "(", "encoding", ")", ")", ";", "dic", ".", "put", "(", "PdfName", ".", "DESCENDANTFONTS", ",", "new", "PdfArray", "(", "descendant", ")", ")", ";", "if", "(", "toUnicode", "!=", "null", ")", "dic", ".", "put", "(", "PdfName", ".", "TOUNICODE", ",", "toUnicode", ")", ";", "return", "dic", ";", "}" ]
Generates the font dictionary. @param descendant the descendant dictionary @param subsetPrefix the subset prefix @param toUnicode the ToUnicode stream @return the stream
[ "Generates", "the", "font", "dictionary", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/TrueTypeFontUnicode.java#L355-L371
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/locks/ZookeeperBasedJobLock.java
ZookeeperBasedJobLock.tryLock
@Override public boolean tryLock() throws JobLockException { """ Try locking the lock. @return <em>true</em> if the lock is successfully locked, <em>false</em> if otherwise. @throws IOException """ try { return this.lock.acquire(lockAcquireTimeoutMilliseconds, TimeUnit.MILLISECONDS); } catch (Exception e) { throw new JobLockException("Failed to acquire lock " + this.lockPath, e); } }
java
@Override public boolean tryLock() throws JobLockException { try { return this.lock.acquire(lockAcquireTimeoutMilliseconds, TimeUnit.MILLISECONDS); } catch (Exception e) { throw new JobLockException("Failed to acquire lock " + this.lockPath, e); } }
[ "@", "Override", "public", "boolean", "tryLock", "(", ")", "throws", "JobLockException", "{", "try", "{", "return", "this", ".", "lock", ".", "acquire", "(", "lockAcquireTimeoutMilliseconds", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "JobLockException", "(", "\"Failed to acquire lock \"", "+", "this", ".", "lockPath", ",", "e", ")", ";", "}", "}" ]
Try locking the lock. @return <em>true</em> if the lock is successfully locked, <em>false</em> if otherwise. @throws IOException
[ "Try", "locking", "the", "lock", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/locks/ZookeeperBasedJobLock.java#L128-L135
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/Compound.java
Compound.out2out
public void out2out(String out, Object to, String to_out) { """ Maps a Compound Output field to a internal simple output field. @param out Compount output field. @param to internal Component @param to_out output field of the internal component """ controller.mapOut(out, to, to_out); }
java
public void out2out(String out, Object to, String to_out) { controller.mapOut(out, to, to_out); }
[ "public", "void", "out2out", "(", "String", "out", ",", "Object", "to", ",", "String", "to_out", ")", "{", "controller", ".", "mapOut", "(", "out", ",", "to", ",", "to_out", ")", ";", "}" ]
Maps a Compound Output field to a internal simple output field. @param out Compount output field. @param to internal Component @param to_out output field of the internal component
[ "Maps", "a", "Compound", "Output", "field", "to", "a", "internal", "simple", "output", "field", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/Compound.java#L241-L243
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/expressions/Expressions.java
Expressions.isBetween
public static DateIsBetween isBetween(ComparableExpression<Date> date, ComparableExpression<Date> lowDate, ComparableExpression<Date> highDate) { """ Creates an IsBetween expression from the given expressions. @param date The date to compare. @param lowDate The low date to compare to. @param highDate The high date to compare to @return A DateIsBetween expression. """ return new DateIsBetween(date, lowDate, highDate); }
java
public static DateIsBetween isBetween(ComparableExpression<Date> date, ComparableExpression<Date> lowDate, ComparableExpression<Date> highDate) { return new DateIsBetween(date, lowDate, highDate); }
[ "public", "static", "DateIsBetween", "isBetween", "(", "ComparableExpression", "<", "Date", ">", "date", ",", "ComparableExpression", "<", "Date", ">", "lowDate", ",", "ComparableExpression", "<", "Date", ">", "highDate", ")", "{", "return", "new", "DateIsBetween", "(", "date", ",", "lowDate", ",", "highDate", ")", ";", "}" ]
Creates an IsBetween expression from the given expressions. @param date The date to compare. @param lowDate The low date to compare to. @param highDate The high date to compare to @return A DateIsBetween expression.
[ "Creates", "an", "IsBetween", "expression", "from", "the", "given", "expressions", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/expressions/Expressions.java#L767-L769
liyiorg/weixin-popular
src/main/java/weixin/popular/api/ShakeAroundAPI.java
ShakeAroundAPI.deviceUpdate
public static DeviceUpdateResult deviceUpdate(String accessToken, DeviceUpdate deviceUpdate) { """ 编辑设备信息 @param accessToken accessToken @param deviceUpdate deviceUpdate @return result """ return deviceUpdate(accessToken, JsonUtil.toJSONString(deviceUpdate)); }
java
public static DeviceUpdateResult deviceUpdate(String accessToken, DeviceUpdate deviceUpdate) { return deviceUpdate(accessToken, JsonUtil.toJSONString(deviceUpdate)); }
[ "public", "static", "DeviceUpdateResult", "deviceUpdate", "(", "String", "accessToken", ",", "DeviceUpdate", "deviceUpdate", ")", "{", "return", "deviceUpdate", "(", "accessToken", ",", "JsonUtil", ".", "toJSONString", "(", "deviceUpdate", ")", ")", ";", "}" ]
编辑设备信息 @param accessToken accessToken @param deviceUpdate deviceUpdate @return result
[ "编辑设备信息" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/ShakeAroundAPI.java#L538-L541
termsuite/termsuite-core
src/main/java/fr/univnantes/termsuite/uima/readers/AbstractTermSuiteCollectionReader.java
AbstractTermSuiteCollectionReader.getFileFilter
protected FilenameFilter getFileFilter() { """ The {@link FilenameFilter} for selecting input files to read. @return """ // accepts all files in default implementation return new FilenameFilter() { @Override public boolean accept(File dir, String name) { return true; } }; }
java
protected FilenameFilter getFileFilter() { // accepts all files in default implementation return new FilenameFilter() { @Override public boolean accept(File dir, String name) { return true; } }; }
[ "protected", "FilenameFilter", "getFileFilter", "(", ")", "{", "// accepts all files in default implementation", "return", "new", "FilenameFilter", "(", ")", "{", "@", "Override", "public", "boolean", "accept", "(", "File", "dir", ",", "String", "name", ")", "{", "return", "true", ";", "}", "}", ";", "}" ]
The {@link FilenameFilter} for selecting input files to read. @return
[ "The", "{" ]
train
https://github.com/termsuite/termsuite-core/blob/731e5d0bc7c14180713c01a9c7dffe1925f26130/src/main/java/fr/univnantes/termsuite/uima/readers/AbstractTermSuiteCollectionReader.java#L232-L241
chhh/MSFTBX
MSFileToolbox/src/main/java/umich/ms/datatypes/LCMSRange.java
LCMSRange.create
public static final LCMSRange create(Range<Integer> scanRange, Integer msLevel, DoubleRange mzRange) { """ A range, containing all scans within the scan number range at a specific MS-Level and a specific precursor range. @param scanRange null means the whole range of scan numbers in the run @param msLevel null means any ms-level @param mzRange null means all ranges. You can't use non-null here, if {@code msLevel} is null """ return new LCMSRange(scanRange, msLevel, mzRange); }
java
public static final LCMSRange create(Range<Integer> scanRange, Integer msLevel, DoubleRange mzRange) { return new LCMSRange(scanRange, msLevel, mzRange); }
[ "public", "static", "final", "LCMSRange", "create", "(", "Range", "<", "Integer", ">", "scanRange", ",", "Integer", "msLevel", ",", "DoubleRange", "mzRange", ")", "{", "return", "new", "LCMSRange", "(", "scanRange", ",", "msLevel", ",", "mzRange", ")", ";", "}" ]
A range, containing all scans within the scan number range at a specific MS-Level and a specific precursor range. @param scanRange null means the whole range of scan numbers in the run @param msLevel null means any ms-level @param mzRange null means all ranges. You can't use non-null here, if {@code msLevel} is null
[ "A", "range", "containing", "all", "scans", "within", "the", "scan", "number", "range", "at", "a", "specific", "MS", "-", "Level", "and", "a", "specific", "precursor", "range", "." ]
train
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/datatypes/LCMSRange.java#L110-L113
jcuda/jcusparse
JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java
JCusparse.cusparseXbsrsv2_zeroPivot
public static int cusparseXbsrsv2_zeroPivot( cusparseHandle handle, bsrsv2Info info, Pointer position) { """ <pre> Description: Solution of triangular linear system op(A) * x = alpha * f, where A is a sparse matrix in block-CSR storage format, rhs f and solution y are dense vectors. This routine implements algorithm 2 for this problem. Also, it provides a utility function to query size of buffer used. </pre> """ return checkResult(cusparseXbsrsv2_zeroPivotNative(handle, info, position)); }
java
public static int cusparseXbsrsv2_zeroPivot( cusparseHandle handle, bsrsv2Info info, Pointer position) { return checkResult(cusparseXbsrsv2_zeroPivotNative(handle, info, position)); }
[ "public", "static", "int", "cusparseXbsrsv2_zeroPivot", "(", "cusparseHandle", "handle", ",", "bsrsv2Info", "info", ",", "Pointer", "position", ")", "{", "return", "checkResult", "(", "cusparseXbsrsv2_zeroPivotNative", "(", "handle", ",", "info", ",", "position", ")", ")", ";", "}" ]
<pre> Description: Solution of triangular linear system op(A) * x = alpha * f, where A is a sparse matrix in block-CSR storage format, rhs f and solution y are dense vectors. This routine implements algorithm 2 for this problem. Also, it provides a utility function to query size of buffer used. </pre>
[ "<pre", ">", "Description", ":", "Solution", "of", "triangular", "linear", "system", "op", "(", "A", ")", "*", "x", "=", "alpha", "*", "f", "where", "A", "is", "a", "sparse", "matrix", "in", "block", "-", "CSR", "storage", "format", "rhs", "f", "and", "solution", "y", "are", "dense", "vectors", ".", "This", "routine", "implements", "algorithm", "2", "for", "this", "problem", ".", "Also", "it", "provides", "a", "utility", "function", "to", "query", "size", "of", "buffer", "used", ".", "<", "/", "pre", ">" ]
train
https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L2928-L2934
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.getCouponRedemptionsByInvoice
public Redemptions getCouponRedemptionsByInvoice(final String invoiceId, final QueryParams params) { """ Lookup all coupon redemptions on an invoice given query params. @param invoiceId String invoice id @param params {@link QueryParams} @return the coupon redemptions for this invoice on success, null otherwise """ return doGET(Invoices.INVOICES_RESOURCE + "/" + invoiceId + Redemption.REDEMPTION_RESOURCE, Redemptions.class, params); }
java
public Redemptions getCouponRedemptionsByInvoice(final String invoiceId, final QueryParams params) { return doGET(Invoices.INVOICES_RESOURCE + "/" + invoiceId + Redemption.REDEMPTION_RESOURCE, Redemptions.class, params); }
[ "public", "Redemptions", "getCouponRedemptionsByInvoice", "(", "final", "String", "invoiceId", ",", "final", "QueryParams", "params", ")", "{", "return", "doGET", "(", "Invoices", ".", "INVOICES_RESOURCE", "+", "\"/\"", "+", "invoiceId", "+", "Redemption", ".", "REDEMPTION_RESOURCE", ",", "Redemptions", ".", "class", ",", "params", ")", ";", "}" ]
Lookup all coupon redemptions on an invoice given query params. @param invoiceId String invoice id @param params {@link QueryParams} @return the coupon redemptions for this invoice on success, null otherwise
[ "Lookup", "all", "coupon", "redemptions", "on", "an", "invoice", "given", "query", "params", "." ]
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1689-L1692
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/StringUtils.java
StringUtils.laxSubstringByCodepoints
public static String laxSubstringByCodepoints(String s, int startIndexInclusive, int endIndexExclusive) { """ Acts just like {@link #laxSubstringByCodepoints(String, int, int)} except that if either index is out-of-bounds, it is clipped to the most extreme legal value. This guarantees that as long as {@code s} is non-null and {@code endIndexExclusive>=startIndexInclusive}, no exception will be thrown when calling this method. """ return substringByCodepoints(s, startIndexInclusive, endIndexExclusive, true); }
java
public static String laxSubstringByCodepoints(String s, int startIndexInclusive, int endIndexExclusive) { return substringByCodepoints(s, startIndexInclusive, endIndexExclusive, true); }
[ "public", "static", "String", "laxSubstringByCodepoints", "(", "String", "s", ",", "int", "startIndexInclusive", ",", "int", "endIndexExclusive", ")", "{", "return", "substringByCodepoints", "(", "s", ",", "startIndexInclusive", ",", "endIndexExclusive", ",", "true", ")", ";", "}" ]
Acts just like {@link #laxSubstringByCodepoints(String, int, int)} except that if either index is out-of-bounds, it is clipped to the most extreme legal value. This guarantees that as long as {@code s} is non-null and {@code endIndexExclusive>=startIndexInclusive}, no exception will be thrown when calling this method.
[ "Acts", "just", "like", "{" ]
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/StringUtils.java#L530-L533
jglobus/JGlobus
gridftp/src/main/java/org/globus/ftp/FTPClient.java
FTPClient.authorize
public void authorize(String user, String password) throws IOException, ServerException { """ Performs user authorization with specified user and password. @param user username @param password user password @exception ServerException on server refusal """ Reply userReply = null; try { userReply = controlChannel.exchange(new Command("USER", user)); } catch (FTPReplyParseException rpe) { throw ServerException.embedFTPReplyParseException(rpe); } if (Reply.isPositiveIntermediate(userReply)) { Reply passReply = null; try { passReply = controlChannel.exchange(new Command("PASS", password)); } catch (FTPReplyParseException rpe) { throw ServerException.embedFTPReplyParseException(rpe); } if (!Reply.isPositiveCompletion(passReply)) { throw ServerException.embedUnexpectedReplyCodeException( new UnexpectedReplyCodeException(passReply), "Bad password."); } // i'm logged in } else if (Reply.isPositiveCompletion(userReply)) { // i'm logged in } else { throw ServerException.embedUnexpectedReplyCodeException( new UnexpectedReplyCodeException(userReply), "Bad user."); } this.session.authorized = true; this.username = user; }
java
public void authorize(String user, String password) throws IOException, ServerException { Reply userReply = null; try { userReply = controlChannel.exchange(new Command("USER", user)); } catch (FTPReplyParseException rpe) { throw ServerException.embedFTPReplyParseException(rpe); } if (Reply.isPositiveIntermediate(userReply)) { Reply passReply = null; try { passReply = controlChannel.exchange(new Command("PASS", password)); } catch (FTPReplyParseException rpe) { throw ServerException.embedFTPReplyParseException(rpe); } if (!Reply.isPositiveCompletion(passReply)) { throw ServerException.embedUnexpectedReplyCodeException( new UnexpectedReplyCodeException(passReply), "Bad password."); } // i'm logged in } else if (Reply.isPositiveCompletion(userReply)) { // i'm logged in } else { throw ServerException.embedUnexpectedReplyCodeException( new UnexpectedReplyCodeException(userReply), "Bad user."); } this.session.authorized = true; this.username = user; }
[ "public", "void", "authorize", "(", "String", "user", ",", "String", "password", ")", "throws", "IOException", ",", "ServerException", "{", "Reply", "userReply", "=", "null", ";", "try", "{", "userReply", "=", "controlChannel", ".", "exchange", "(", "new", "Command", "(", "\"USER\"", ",", "user", ")", ")", ";", "}", "catch", "(", "FTPReplyParseException", "rpe", ")", "{", "throw", "ServerException", ".", "embedFTPReplyParseException", "(", "rpe", ")", ";", "}", "if", "(", "Reply", ".", "isPositiveIntermediate", "(", "userReply", ")", ")", "{", "Reply", "passReply", "=", "null", ";", "try", "{", "passReply", "=", "controlChannel", ".", "exchange", "(", "new", "Command", "(", "\"PASS\"", ",", "password", ")", ")", ";", "}", "catch", "(", "FTPReplyParseException", "rpe", ")", "{", "throw", "ServerException", ".", "embedFTPReplyParseException", "(", "rpe", ")", ";", "}", "if", "(", "!", "Reply", ".", "isPositiveCompletion", "(", "passReply", ")", ")", "{", "throw", "ServerException", ".", "embedUnexpectedReplyCodeException", "(", "new", "UnexpectedReplyCodeException", "(", "passReply", ")", ",", "\"Bad password.\"", ")", ";", "}", "// i'm logged in", "}", "else", "if", "(", "Reply", ".", "isPositiveCompletion", "(", "userReply", ")", ")", "{", "// i'm logged in", "}", "else", "{", "throw", "ServerException", ".", "embedUnexpectedReplyCodeException", "(", "new", "UnexpectedReplyCodeException", "(", "userReply", ")", ",", "\"Bad user.\"", ")", ";", "}", "this", ".", "session", ".", "authorized", "=", "true", ";", "this", ".", "username", "=", "user", ";", "}" ]
Performs user authorization with specified user and password. @param user username @param password user password @exception ServerException on server refusal
[ "Performs", "user", "authorization", "with", "specified", "user", "and", "password", "." ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gridftp/src/main/java/org/globus/ftp/FTPClient.java#L1193-L1232
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/function/Actions.java
Actions.toFunc
public static <T1, T2, T3, T4, T5> Func5<T1, T2, T3, T4, T5, Void> toFunc( final Action5<T1, T2, T3, T4, T5> action) { """ Converts an {@link Action5} to a function that calls the action and returns {@code null}. @param action the {@link Action5} to convert @return a {@link Func5} that calls {@code action} and returns {@code null} """ return toFunc(action, (Void) null); }
java
public static <T1, T2, T3, T4, T5> Func5<T1, T2, T3, T4, T5, Void> toFunc( final Action5<T1, T2, T3, T4, T5> action) { return toFunc(action, (Void) null); }
[ "public", "static", "<", "T1", ",", "T2", ",", "T3", ",", "T4", ",", "T5", ">", "Func5", "<", "T1", ",", "T2", ",", "T3", ",", "T4", ",", "T5", ",", "Void", ">", "toFunc", "(", "final", "Action5", "<", "T1", ",", "T2", ",", "T3", ",", "T4", ",", "T5", ">", "action", ")", "{", "return", "toFunc", "(", "action", ",", "(", "Void", ")", "null", ")", ";", "}" ]
Converts an {@link Action5} to a function that calls the action and returns {@code null}. @param action the {@link Action5} to convert @return a {@link Func5} that calls {@code action} and returns {@code null}
[ "Converts", "an", "{", "@link", "Action5", "}", "to", "a", "function", "that", "calls", "the", "action", "and", "returns", "{", "@code", "null", "}", "." ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/function/Actions.java#L135-L138
palatable/lambda
src/main/java/com/jnape/palatable/lambda/adt/Try.java
Try.withResources
public static <A extends AutoCloseable, B extends AutoCloseable, C extends AutoCloseable, D> Try<Exception, D> withResources( CheckedSupplier<? extends Exception, ? extends A> aSupplier, CheckedFn1<? extends Exception, ? super A, ? extends B> bFn, CheckedFn1<? extends Exception, ? super B, ? extends C> cFn, CheckedFn1<? extends Exception, ? super C, ? extends Try<? extends Exception, ? extends D>> fn) { """ Convenience overload of {@link Try#withResources(CheckedSupplier, CheckedFn1, CheckedFn1) withResources} that cascades two dependent resource creations via nested calls. @param aSupplier the first resource supplier @param bFn the second resource function @param cFn the final resource function @param fn the function body @param <A> the first resource type @param <B> the second resource type @param <C> the final resource type @param <D> the function return type @return a {@link Try} representing the result of the function's application to the final dependent resource """ return withResources(aSupplier, bFn, b -> withResources(() -> cFn.apply(b), fn::apply)); }
java
public static <A extends AutoCloseable, B extends AutoCloseable, C extends AutoCloseable, D> Try<Exception, D> withResources( CheckedSupplier<? extends Exception, ? extends A> aSupplier, CheckedFn1<? extends Exception, ? super A, ? extends B> bFn, CheckedFn1<? extends Exception, ? super B, ? extends C> cFn, CheckedFn1<? extends Exception, ? super C, ? extends Try<? extends Exception, ? extends D>> fn) { return withResources(aSupplier, bFn, b -> withResources(() -> cFn.apply(b), fn::apply)); }
[ "public", "static", "<", "A", "extends", "AutoCloseable", ",", "B", "extends", "AutoCloseable", ",", "C", "extends", "AutoCloseable", ",", "D", ">", "Try", "<", "Exception", ",", "D", ">", "withResources", "(", "CheckedSupplier", "<", "?", "extends", "Exception", ",", "?", "extends", "A", ">", "aSupplier", ",", "CheckedFn1", "<", "?", "extends", "Exception", ",", "?", "super", "A", ",", "?", "extends", "B", ">", "bFn", ",", "CheckedFn1", "<", "?", "extends", "Exception", ",", "?", "super", "B", ",", "?", "extends", "C", ">", "cFn", ",", "CheckedFn1", "<", "?", "extends", "Exception", ",", "?", "super", "C", ",", "?", "extends", "Try", "<", "?", "extends", "Exception", ",", "?", "extends", "D", ">", ">", "fn", ")", "{", "return", "withResources", "(", "aSupplier", ",", "bFn", ",", "b", "->", "withResources", "(", "(", ")", "->", "cFn", ".", "apply", "(", "b", ")", ",", "fn", "::", "apply", ")", ")", ";", "}" ]
Convenience overload of {@link Try#withResources(CheckedSupplier, CheckedFn1, CheckedFn1) withResources} that cascades two dependent resource creations via nested calls. @param aSupplier the first resource supplier @param bFn the second resource function @param cFn the final resource function @param fn the function body @param <A> the first resource type @param <B> the second resource type @param <C> the final resource type @param <D> the function return type @return a {@link Try} representing the result of the function's application to the final dependent resource
[ "Convenience", "overload", "of", "{", "@link", "Try#withResources", "(", "CheckedSupplier", "CheckedFn1", "CheckedFn1", ")", "withResources", "}", "that", "cascades", "two", "dependent", "resource", "creations", "via", "nested", "calls", "." ]
train
https://github.com/palatable/lambda/blob/b643ba836c5916d1d8193822e5efb4e7b40c489a/src/main/java/com/jnape/palatable/lambda/adt/Try.java#L364-L370
fabric8io/ipaas-quickstarts
archetype-builder/src/main/java/io/fabric8/tooling/archetype/builder/ArchetypeBuilder.java
ArchetypeBuilder.copyFile
protected void copyFile(File src, File dest, Replacement replaceFn) throws IOException { """ Copies single file from <code>src</code> to <code>dest</code>. If the file is source file, variable references will be escaped, so they'll survive Velocity template merging. """ boolean isSource = isSourceFile(src); copyFile(src, dest, replaceFn, isSource); }
java
protected void copyFile(File src, File dest, Replacement replaceFn) throws IOException { boolean isSource = isSourceFile(src); copyFile(src, dest, replaceFn, isSource); }
[ "protected", "void", "copyFile", "(", "File", "src", ",", "File", "dest", ",", "Replacement", "replaceFn", ")", "throws", "IOException", "{", "boolean", "isSource", "=", "isSourceFile", "(", "src", ")", ";", "copyFile", "(", "src", ",", "dest", ",", "replaceFn", ",", "isSource", ")", ";", "}" ]
Copies single file from <code>src</code> to <code>dest</code>. If the file is source file, variable references will be escaped, so they'll survive Velocity template merging.
[ "Copies", "single", "file", "from", "<code", ">", "src<", "/", "code", ">", "to", "<code", ">", "dest<", "/", "code", ">", ".", "If", "the", "file", "is", "source", "file", "variable", "references", "will", "be", "escaped", "so", "they", "ll", "survive", "Velocity", "template", "merging", "." ]
train
https://github.com/fabric8io/ipaas-quickstarts/blob/cf9a9aa09204a82ac996304ab8c96791f7e5db22/archetype-builder/src/main/java/io/fabric8/tooling/archetype/builder/ArchetypeBuilder.java#L714-L717
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SerializationUtils.java
SerializationUtils.fromByteArray
public static <T> T fromByteArray(byte[] data, Class<T> clazz) { """ Deserialize a byte array back to an object. <p> If the target class implements {@link ISerializationSupport}, this method calls its {@link ISerializationSupport#toBytes()} method; otherwise FST library is used to serialize the object. </p> @param data @param clazz @return @deprecated since 0.9.2 with no replacement, use {@link #fromByteArrayFst(byte[], Class)} or {@link #fromByteArrayKryo(byte[], Class)} """ return fromByteArray(data, clazz, null); }
java
public static <T> T fromByteArray(byte[] data, Class<T> clazz) { return fromByteArray(data, clazz, null); }
[ "public", "static", "<", "T", ">", "T", "fromByteArray", "(", "byte", "[", "]", "data", ",", "Class", "<", "T", ">", "clazz", ")", "{", "return", "fromByteArray", "(", "data", ",", "clazz", ",", "null", ")", ";", "}" ]
Deserialize a byte array back to an object. <p> If the target class implements {@link ISerializationSupport}, this method calls its {@link ISerializationSupport#toBytes()} method; otherwise FST library is used to serialize the object. </p> @param data @param clazz @return @deprecated since 0.9.2 with no replacement, use {@link #fromByteArrayFst(byte[], Class)} or {@link #fromByteArrayKryo(byte[], Class)}
[ "Deserialize", "a", "byte", "array", "back", "to", "an", "object", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SerializationUtils.java#L111-L113
astrapi69/jaulp-wicket
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java
WicketUrlExtensions.absoluteUrlFor
public static <C extends Page> String absoluteUrlFor(final Class<C> page, final boolean withServerPort) { """ Returns the absolute url for the given page and optionally with the server port. @param <C> the generic type @param page the page @param withServerPort the with server port @return the string """ return absoluteUrlFor(page, null, withServerPort); }
java
public static <C extends Page> String absoluteUrlFor(final Class<C> page, final boolean withServerPort) { return absoluteUrlFor(page, null, withServerPort); }
[ "public", "static", "<", "C", "extends", "Page", ">", "String", "absoluteUrlFor", "(", "final", "Class", "<", "C", ">", "page", ",", "final", "boolean", "withServerPort", ")", "{", "return", "absoluteUrlFor", "(", "page", ",", "null", ",", "withServerPort", ")", ";", "}" ]
Returns the absolute url for the given page and optionally with the server port. @param <C> the generic type @param page the page @param withServerPort the with server port @return the string
[ "Returns", "the", "absolute", "url", "for", "the", "given", "page", "and", "optionally", "with", "the", "server", "port", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java#L57-L61
apache/incubator-heron
heron/packing/src/java/org/apache/heron/packing/binpacking/FirstFitDecreasingPacking.java
FirstFitDecreasingPacking.placeFFDInstance
private void placeFFDInstance(PackingPlanBuilder planBuilder, String componentName) throws ConstraintViolationException { """ Assign a particular instance to an existing container or to a new container """ if (this.numContainers == 0) { planBuilder.updateNumContainers(++numContainers); } try { planBuilder.addInstance(new ContainerIdScorer(), componentName); } catch (ResourceExceededException e) { planBuilder.updateNumContainers(++numContainers); planBuilder.addInstance(numContainers, componentName); } }
java
private void placeFFDInstance(PackingPlanBuilder planBuilder, String componentName) throws ConstraintViolationException { if (this.numContainers == 0) { planBuilder.updateNumContainers(++numContainers); } try { planBuilder.addInstance(new ContainerIdScorer(), componentName); } catch (ResourceExceededException e) { planBuilder.updateNumContainers(++numContainers); planBuilder.addInstance(numContainers, componentName); } }
[ "private", "void", "placeFFDInstance", "(", "PackingPlanBuilder", "planBuilder", ",", "String", "componentName", ")", "throws", "ConstraintViolationException", "{", "if", "(", "this", ".", "numContainers", "==", "0", ")", "{", "planBuilder", ".", "updateNumContainers", "(", "++", "numContainers", ")", ";", "}", "try", "{", "planBuilder", ".", "addInstance", "(", "new", "ContainerIdScorer", "(", ")", ",", "componentName", ")", ";", "}", "catch", "(", "ResourceExceededException", "e", ")", "{", "planBuilder", ".", "updateNumContainers", "(", "++", "numContainers", ")", ";", "planBuilder", ".", "addInstance", "(", "numContainers", ",", "componentName", ")", ";", "}", "}" ]
Assign a particular instance to an existing container or to a new container
[ "Assign", "a", "particular", "instance", "to", "an", "existing", "container", "or", "to", "a", "new", "container" ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/packing/src/java/org/apache/heron/packing/binpacking/FirstFitDecreasingPacking.java#L286-L298
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/FirstNonNullHelper.java
FirstNonNullHelper.firstNonNull
public static <T, R> R firstNonNull(T input, Function<T, R> function, Function<T, R>... functions) { """ Gets first result of set of function which is not null. @param <T> type of values. @param <R> element to return. @param input input to provide to all functions. @param function first function to apply (separate to indicate at least one should be provided) @param functions all possible functions that might be able to supply a value. @return first result which was not null, OR <code>null</code> if result for each function's results was <code>null</code>. """ return firstNonNull(f -> f.apply(input), Stream.concat(Stream.of(function), Stream.of(functions))); }
java
public static <T, R> R firstNonNull(T input, Function<T, R> function, Function<T, R>... functions) { return firstNonNull(f -> f.apply(input), Stream.concat(Stream.of(function), Stream.of(functions))); }
[ "public", "static", "<", "T", ",", "R", ">", "R", "firstNonNull", "(", "T", "input", ",", "Function", "<", "T", ",", "R", ">", "function", ",", "Function", "<", "T", ",", "R", ">", "...", "functions", ")", "{", "return", "firstNonNull", "(", "f", "->", "f", ".", "apply", "(", "input", ")", ",", "Stream", ".", "concat", "(", "Stream", ".", "of", "(", "function", ")", ",", "Stream", ".", "of", "(", "functions", ")", ")", ")", ";", "}" ]
Gets first result of set of function which is not null. @param <T> type of values. @param <R> element to return. @param input input to provide to all functions. @param function first function to apply (separate to indicate at least one should be provided) @param functions all possible functions that might be able to supply a value. @return first result which was not null, OR <code>null</code> if result for each function's results was <code>null</code>.
[ "Gets", "first", "result", "of", "set", "of", "function", "which", "is", "not", "null", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/FirstNonNullHelper.java#L81-L83
codelibs/fess
src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java
FessMessages.addErrorsCrudFailedToCreateCrudTable
public FessMessages addErrorsCrudFailedToCreateCrudTable(String property, String arg0) { """ Add the created action message for the key 'errors.crud_failed_to_create_crud_table' with parameters. <pre> message: Failed to create a new data. ({0}) </pre> @param property The property name for the message. (NotNull) @param arg0 The parameter arg0 for message. (NotNull) @return this. (NotNull) """ assertPropertyNotNull(property); add(property, new UserMessage(ERRORS_crud_failed_to_create_crud_table, arg0)); return this; }
java
public FessMessages addErrorsCrudFailedToCreateCrudTable(String property, String arg0) { assertPropertyNotNull(property); add(property, new UserMessage(ERRORS_crud_failed_to_create_crud_table, arg0)); return this; }
[ "public", "FessMessages", "addErrorsCrudFailedToCreateCrudTable", "(", "String", "property", ",", "String", "arg0", ")", "{", "assertPropertyNotNull", "(", "property", ")", ";", "add", "(", "property", ",", "new", "UserMessage", "(", "ERRORS_crud_failed_to_create_crud_table", ",", "arg0", ")", ")", ";", "return", "this", ";", "}" ]
Add the created action message for the key 'errors.crud_failed_to_create_crud_table' with parameters. <pre> message: Failed to create a new data. ({0}) </pre> @param property The property name for the message. (NotNull) @param arg0 The parameter arg0 for message. (NotNull) @return this. (NotNull)
[ "Add", "the", "created", "action", "message", "for", "the", "key", "errors", ".", "crud_failed_to_create_crud_table", "with", "parameters", ".", "<pre", ">", "message", ":", "Failed", "to", "create", "a", "new", "data", ".", "(", "{", "0", "}", ")", "<", "/", "pre", ">" ]
train
https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L2125-L2129
houbb/log-integration
src/main/java/com/github/houbb/log/integration/adaptors/jdbc/ResultSetLogger.java
ResultSetLogger.newInstance
public static ResultSet newInstance(ResultSet rs, Log statementLog, int queryStack) { """ /* Creates a logging version of a ResultSet @param rs - the ResultSet to proxy @return - the ResultSet with logging """ InvocationHandler handler = new ResultSetLogger(rs, statementLog, queryStack); ClassLoader cl = ResultSet.class.getClassLoader(); return (ResultSet) Proxy.newProxyInstance(cl, new Class[]{ResultSet.class}, handler); }
java
public static ResultSet newInstance(ResultSet rs, Log statementLog, int queryStack) { InvocationHandler handler = new ResultSetLogger(rs, statementLog, queryStack); ClassLoader cl = ResultSet.class.getClassLoader(); return (ResultSet) Proxy.newProxyInstance(cl, new Class[]{ResultSet.class}, handler); }
[ "public", "static", "ResultSet", "newInstance", "(", "ResultSet", "rs", ",", "Log", "statementLog", ",", "int", "queryStack", ")", "{", "InvocationHandler", "handler", "=", "new", "ResultSetLogger", "(", "rs", ",", "statementLog", ",", "queryStack", ")", ";", "ClassLoader", "cl", "=", "ResultSet", ".", "class", ".", "getClassLoader", "(", ")", ";", "return", "(", "ResultSet", ")", "Proxy", ".", "newProxyInstance", "(", "cl", ",", "new", "Class", "[", "]", "{", "ResultSet", ".", "class", "}", ",", "handler", ")", ";", "}" ]
/* Creates a logging version of a ResultSet @param rs - the ResultSet to proxy @return - the ResultSet with logging
[ "/", "*", "Creates", "a", "logging", "version", "of", "a", "ResultSet" ]
train
https://github.com/houbb/log-integration/blob/c5e979719aec12a02f7d22b24b04b6fbb1789ca5/src/main/java/com/github/houbb/log/integration/adaptors/jdbc/ResultSetLogger.java#L131-L135
Red5/red5-server-common
src/main/java/org/red5/server/Server.java
Server.lookupGlobal
public IGlobalScope lookupGlobal(String hostName, String contextPath) { """ Does global scope lookup for host name and context path @param hostName Host name @param contextPath Context path @return Global scope """ log.trace("{}", this); log.debug("Lookup global scope - host name: {} context path: {}", hostName, contextPath); // Init mappings key String key = getKey(hostName, contextPath); // If context path contains slashes get complex key and look for it in mappings while (contextPath.indexOf(SLASH) != -1) { key = getKey(hostName, contextPath); log.trace("Check: {}", key); String globalName = mapping.get(key); if (globalName != null) { return getGlobal(globalName); } final int slashIndex = contextPath.lastIndexOf(SLASH); // Context path is substring from the beginning and till last slash index contextPath = contextPath.substring(0, slashIndex); } // Get global scope key key = getKey(hostName, contextPath); log.trace("Check host and path: {}", key); // Look up for global scope switching keys if still not found String globalName = mapping.get(key); if (globalName != null) { return getGlobal(globalName); } key = getKey(EMPTY, contextPath); log.trace("Check wildcard host with path: {}", key); globalName = mapping.get(key); if (globalName != null) { return getGlobal(globalName); } key = getKey(hostName, EMPTY); log.trace("Check host with no path: {}", key); globalName = mapping.get(key); if (globalName != null) { return getGlobal(globalName); } key = getKey(EMPTY, EMPTY); log.trace("Check default host, default path: {}", key); return getGlobal(mapping.get(key)); }
java
public IGlobalScope lookupGlobal(String hostName, String contextPath) { log.trace("{}", this); log.debug("Lookup global scope - host name: {} context path: {}", hostName, contextPath); // Init mappings key String key = getKey(hostName, contextPath); // If context path contains slashes get complex key and look for it in mappings while (contextPath.indexOf(SLASH) != -1) { key = getKey(hostName, contextPath); log.trace("Check: {}", key); String globalName = mapping.get(key); if (globalName != null) { return getGlobal(globalName); } final int slashIndex = contextPath.lastIndexOf(SLASH); // Context path is substring from the beginning and till last slash index contextPath = contextPath.substring(0, slashIndex); } // Get global scope key key = getKey(hostName, contextPath); log.trace("Check host and path: {}", key); // Look up for global scope switching keys if still not found String globalName = mapping.get(key); if (globalName != null) { return getGlobal(globalName); } key = getKey(EMPTY, contextPath); log.trace("Check wildcard host with path: {}", key); globalName = mapping.get(key); if (globalName != null) { return getGlobal(globalName); } key = getKey(hostName, EMPTY); log.trace("Check host with no path: {}", key); globalName = mapping.get(key); if (globalName != null) { return getGlobal(globalName); } key = getKey(EMPTY, EMPTY); log.trace("Check default host, default path: {}", key); return getGlobal(mapping.get(key)); }
[ "public", "IGlobalScope", "lookupGlobal", "(", "String", "hostName", ",", "String", "contextPath", ")", "{", "log", ".", "trace", "(", "\"{}\"", ",", "this", ")", ";", "log", ".", "debug", "(", "\"Lookup global scope - host name: {} context path: {}\"", ",", "hostName", ",", "contextPath", ")", ";", "// Init mappings key\r", "String", "key", "=", "getKey", "(", "hostName", ",", "contextPath", ")", ";", "// If context path contains slashes get complex key and look for it in mappings\r", "while", "(", "contextPath", ".", "indexOf", "(", "SLASH", ")", "!=", "-", "1", ")", "{", "key", "=", "getKey", "(", "hostName", ",", "contextPath", ")", ";", "log", ".", "trace", "(", "\"Check: {}\"", ",", "key", ")", ";", "String", "globalName", "=", "mapping", ".", "get", "(", "key", ")", ";", "if", "(", "globalName", "!=", "null", ")", "{", "return", "getGlobal", "(", "globalName", ")", ";", "}", "final", "int", "slashIndex", "=", "contextPath", ".", "lastIndexOf", "(", "SLASH", ")", ";", "// Context path is substring from the beginning and till last slash index\r", "contextPath", "=", "contextPath", ".", "substring", "(", "0", ",", "slashIndex", ")", ";", "}", "// Get global scope key\r", "key", "=", "getKey", "(", "hostName", ",", "contextPath", ")", ";", "log", ".", "trace", "(", "\"Check host and path: {}\"", ",", "key", ")", ";", "// Look up for global scope switching keys if still not found\r", "String", "globalName", "=", "mapping", ".", "get", "(", "key", ")", ";", "if", "(", "globalName", "!=", "null", ")", "{", "return", "getGlobal", "(", "globalName", ")", ";", "}", "key", "=", "getKey", "(", "EMPTY", ",", "contextPath", ")", ";", "log", ".", "trace", "(", "\"Check wildcard host with path: {}\"", ",", "key", ")", ";", "globalName", "=", "mapping", ".", "get", "(", "key", ")", ";", "if", "(", "globalName", "!=", "null", ")", "{", "return", "getGlobal", "(", "globalName", ")", ";", "}", "key", "=", "getKey", "(", "hostName", ",", "EMPTY", ")", ";", "log", ".", "trace", "(", "\"Check host with no path: {}\"", ",", "key", ")", ";", "globalName", "=", "mapping", ".", "get", "(", "key", ")", ";", "if", "(", "globalName", "!=", "null", ")", "{", "return", "getGlobal", "(", "globalName", ")", ";", "}", "key", "=", "getKey", "(", "EMPTY", ",", "EMPTY", ")", ";", "log", ".", "trace", "(", "\"Check default host, default path: {}\"", ",", "key", ")", ";", "return", "getGlobal", "(", "mapping", ".", "get", "(", "key", ")", ")", ";", "}" ]
Does global scope lookup for host name and context path @param hostName Host name @param contextPath Context path @return Global scope
[ "Does", "global", "scope", "lookup", "for", "host", "name", "and", "context", "path" ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/Server.java#L131-L171
k3po/k3po
specification/socks5/src/main/java/org/kaazing/specification/socks5/internal/Functions.java
Functions.createServerGSSContext
@Function public static GSSContext createServerGSSContext() { """ Create a GSS Context not tied to any server name. Peers acting as a server create their context this way. @return the newly created GSS Context """ System.out.println("createServerGSSContext()..."); try { final GSSManager manager = GSSManager.getInstance(); // // Create server credentials to accept kerberos tokens. This should // make use of the sun.security.krb5.principal system property to // authenticate with the KDC. // GSSCredential serverCreds; try { serverCreds = Subject.doAs(new Subject(), new PrivilegedExceptionAction<GSSCredential>() { public GSSCredential run() throws GSSException { return manager.createCredential(null, GSSCredential.INDEFINITE_LIFETIME, krb5Oid, GSSCredential.ACCEPT_ONLY); } }); } catch (PrivilegedActionException e) { throw new RuntimeException("Exception creating server credentials", e); } // // Create the GSSContext used to process requests from clients. The client // requets should use Kerberos since the server credentials are Kerberos // based. // GSSContext retVal = manager.createContext(serverCreds); System.out.println("createServerGSSContext(), context: " + retVal); return retVal; } catch (GSSException ex) { System.out.println("createServerGSSContext(), finished with exception"); throw new RuntimeException("Exception creating server GSSContext", ex); } }
java
@Function public static GSSContext createServerGSSContext() { System.out.println("createServerGSSContext()..."); try { final GSSManager manager = GSSManager.getInstance(); // // Create server credentials to accept kerberos tokens. This should // make use of the sun.security.krb5.principal system property to // authenticate with the KDC. // GSSCredential serverCreds; try { serverCreds = Subject.doAs(new Subject(), new PrivilegedExceptionAction<GSSCredential>() { public GSSCredential run() throws GSSException { return manager.createCredential(null, GSSCredential.INDEFINITE_LIFETIME, krb5Oid, GSSCredential.ACCEPT_ONLY); } }); } catch (PrivilegedActionException e) { throw new RuntimeException("Exception creating server credentials", e); } // // Create the GSSContext used to process requests from clients. The client // requets should use Kerberos since the server credentials are Kerberos // based. // GSSContext retVal = manager.createContext(serverCreds); System.out.println("createServerGSSContext(), context: " + retVal); return retVal; } catch (GSSException ex) { System.out.println("createServerGSSContext(), finished with exception"); throw new RuntimeException("Exception creating server GSSContext", ex); } }
[ "@", "Function", "public", "static", "GSSContext", "createServerGSSContext", "(", ")", "{", "System", ".", "out", ".", "println", "(", "\"createServerGSSContext()...\"", ")", ";", "try", "{", "final", "GSSManager", "manager", "=", "GSSManager", ".", "getInstance", "(", ")", ";", "//", "// Create server credentials to accept kerberos tokens. This should", "// make use of the sun.security.krb5.principal system property to", "// authenticate with the KDC.", "//", "GSSCredential", "serverCreds", ";", "try", "{", "serverCreds", "=", "Subject", ".", "doAs", "(", "new", "Subject", "(", ")", ",", "new", "PrivilegedExceptionAction", "<", "GSSCredential", ">", "(", ")", "{", "public", "GSSCredential", "run", "(", ")", "throws", "GSSException", "{", "return", "manager", ".", "createCredential", "(", "null", ",", "GSSCredential", ".", "INDEFINITE_LIFETIME", ",", "krb5Oid", ",", "GSSCredential", ".", "ACCEPT_ONLY", ")", ";", "}", "}", ")", ";", "}", "catch", "(", "PrivilegedActionException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Exception creating server credentials\"", ",", "e", ")", ";", "}", "//", "// Create the GSSContext used to process requests from clients. The client", "// requets should use Kerberos since the server credentials are Kerberos", "// based.", "//", "GSSContext", "retVal", "=", "manager", ".", "createContext", "(", "serverCreds", ")", ";", "System", ".", "out", ".", "println", "(", "\"createServerGSSContext(), context: \"", "+", "retVal", ")", ";", "return", "retVal", ";", "}", "catch", "(", "GSSException", "ex", ")", "{", "System", ".", "out", ".", "println", "(", "\"createServerGSSContext(), finished with exception\"", ")", ";", "throw", "new", "RuntimeException", "(", "\"Exception creating server GSSContext\"", ",", "ex", ")", ";", "}", "}" ]
Create a GSS Context not tied to any server name. Peers acting as a server create their context this way. @return the newly created GSS Context
[ "Create", "a", "GSS", "Context", "not", "tied", "to", "any", "server", "name", ".", "Peers", "acting", "as", "a", "server", "create", "their", "context", "this", "way", "." ]
train
https://github.com/k3po/k3po/blob/3ca4fd31ab4a397893aa640c62ada0e485c8bbd4/specification/socks5/src/main/java/org/kaazing/specification/socks5/internal/Functions.java#L175-L210
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java
AnnotationTypeBuilder.getInstance
public static AnnotationTypeBuilder getInstance(Context context, AnnotationTypeDoc annotationTypeDoc, AnnotationTypeWriter writer) throws Exception { """ Construct a new ClassBuilder. @param context the build context. @param annotationTypeDoc the class being documented. @param writer the doclet specific writer. """ return new AnnotationTypeBuilder(context, annotationTypeDoc, writer); }
java
public static AnnotationTypeBuilder getInstance(Context context, AnnotationTypeDoc annotationTypeDoc, AnnotationTypeWriter writer) throws Exception { return new AnnotationTypeBuilder(context, annotationTypeDoc, writer); }
[ "public", "static", "AnnotationTypeBuilder", "getInstance", "(", "Context", "context", ",", "AnnotationTypeDoc", "annotationTypeDoc", ",", "AnnotationTypeWriter", "writer", ")", "throws", "Exception", "{", "return", "new", "AnnotationTypeBuilder", "(", "context", ",", "annotationTypeDoc", ",", "writer", ")", ";", "}" ]
Construct a new ClassBuilder. @param context the build context. @param annotationTypeDoc the class being documented. @param writer the doclet specific writer.
[ "Construct", "a", "new", "ClassBuilder", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java#L90-L95
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/enhance/GEnhanceImageOps.java
GEnhanceImageOps.sharpen4
public static <T extends ImageBase<T>> void sharpen4(T input , T output ) { """ Applies a Laplacian-4 based sharpen filter to the image. @param input Input image. @param output Output image. """ if( input instanceof Planar ) { Planar pi = (Planar)input; Planar po = (Planar)output; for (int i = 0; i < pi.getNumBands(); i++) { sharpen4(pi.getBand(i),po.getBand(i)); } } else { if (input instanceof GrayU8) { EnhanceImageOps.sharpen4((GrayU8) input, (GrayU8) output); } else if (input instanceof GrayF32) { EnhanceImageOps.sharpen4((GrayF32) input, (GrayF32) output); } else { throw new IllegalArgumentException("Image type not supported. " + input.getClass().getSimpleName()); } } }
java
public static <T extends ImageBase<T>> void sharpen4(T input , T output ) { if( input instanceof Planar ) { Planar pi = (Planar)input; Planar po = (Planar)output; for (int i = 0; i < pi.getNumBands(); i++) { sharpen4(pi.getBand(i),po.getBand(i)); } } else { if (input instanceof GrayU8) { EnhanceImageOps.sharpen4((GrayU8) input, (GrayU8) output); } else if (input instanceof GrayF32) { EnhanceImageOps.sharpen4((GrayF32) input, (GrayF32) output); } else { throw new IllegalArgumentException("Image type not supported. " + input.getClass().getSimpleName()); } } }
[ "public", "static", "<", "T", "extends", "ImageBase", "<", "T", ">", ">", "void", "sharpen4", "(", "T", "input", ",", "T", "output", ")", "{", "if", "(", "input", "instanceof", "Planar", ")", "{", "Planar", "pi", "=", "(", "Planar", ")", "input", ";", "Planar", "po", "=", "(", "Planar", ")", "output", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "pi", ".", "getNumBands", "(", ")", ";", "i", "++", ")", "{", "sharpen4", "(", "pi", ".", "getBand", "(", "i", ")", ",", "po", ".", "getBand", "(", "i", ")", ")", ";", "}", "}", "else", "{", "if", "(", "input", "instanceof", "GrayU8", ")", "{", "EnhanceImageOps", ".", "sharpen4", "(", "(", "GrayU8", ")", "input", ",", "(", "GrayU8", ")", "output", ")", ";", "}", "else", "if", "(", "input", "instanceof", "GrayF32", ")", "{", "EnhanceImageOps", ".", "sharpen4", "(", "(", "GrayF32", ")", "input", ",", "(", "GrayF32", ")", "output", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"Image type not supported. \"", "+", "input", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ")", ";", "}", "}", "}" ]
Applies a Laplacian-4 based sharpen filter to the image. @param input Input image. @param output Output image.
[ "Applies", "a", "Laplacian", "-", "4", "based", "sharpen", "filter", "to", "the", "image", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/enhance/GEnhanceImageOps.java#L93-L109
lucee/Lucee
core/src/main/java/lucee/runtime/op/Caster.java
Caster.toDate
public static DateTime toDate(Object o, boolean alsoNumbers, TimeZone tz) throws PageException { """ cast a Object to a DateTime Object @param o Object to cast @param alsoNumbers define if also numbers will casted to a datetime value @param tz @return casted DateTime Object @throws PageException """ return DateCaster.toDateAdvanced(o, alsoNumbers ? DateCaster.CONVERTING_TYPE_OFFSET : DateCaster.CONVERTING_TYPE_NONE, tz); }
java
public static DateTime toDate(Object o, boolean alsoNumbers, TimeZone tz) throws PageException { return DateCaster.toDateAdvanced(o, alsoNumbers ? DateCaster.CONVERTING_TYPE_OFFSET : DateCaster.CONVERTING_TYPE_NONE, tz); }
[ "public", "static", "DateTime", "toDate", "(", "Object", "o", ",", "boolean", "alsoNumbers", ",", "TimeZone", "tz", ")", "throws", "PageException", "{", "return", "DateCaster", ".", "toDateAdvanced", "(", "o", ",", "alsoNumbers", "?", "DateCaster", ".", "CONVERTING_TYPE_OFFSET", ":", "DateCaster", ".", "CONVERTING_TYPE_NONE", ",", "tz", ")", ";", "}" ]
cast a Object to a DateTime Object @param o Object to cast @param alsoNumbers define if also numbers will casted to a datetime value @param tz @return casted DateTime Object @throws PageException
[ "cast", "a", "Object", "to", "a", "DateTime", "Object" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L2898-L2900
mapbox/mapbox-java
services-geojson/src/main/java/com/mapbox/geojson/Feature.java
Feature.fromGeometry
public static Feature fromGeometry(@Nullable Geometry geometry) { """ Create a new instance of this class by giving the feature a {@link Geometry}. @param geometry a single geometry which makes up this feature object @return a new instance of this class defined by the values passed inside this static factory method @since 1.0.0 """ return new Feature(TYPE, null, null, geometry, new JsonObject()); }
java
public static Feature fromGeometry(@Nullable Geometry geometry) { return new Feature(TYPE, null, null, geometry, new JsonObject()); }
[ "public", "static", "Feature", "fromGeometry", "(", "@", "Nullable", "Geometry", "geometry", ")", "{", "return", "new", "Feature", "(", "TYPE", ",", "null", ",", "null", ",", "geometry", ",", "new", "JsonObject", "(", ")", ")", ";", "}" ]
Create a new instance of this class by giving the feature a {@link Geometry}. @param geometry a single geometry which makes up this feature object @return a new instance of this class defined by the values passed inside this static factory method @since 1.0.0
[ "Create", "a", "new", "instance", "of", "this", "class", "by", "giving", "the", "feature", "a", "{", "@link", "Geometry", "}", "." ]
train
https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/Feature.java#L102-L104
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/FdfWriter.java
FdfWriter.writeTo
public void writeTo(OutputStream os) throws IOException { """ Writes the content to a stream. @param os the stream @throws IOException on error """ Wrt wrt = new Wrt(os, this); wrt.writeTo(); }
java
public void writeTo(OutputStream os) throws IOException { Wrt wrt = new Wrt(os, this); wrt.writeTo(); }
[ "public", "void", "writeTo", "(", "OutputStream", "os", ")", "throws", "IOException", "{", "Wrt", "wrt", "=", "new", "Wrt", "(", "os", ",", "this", ")", ";", "wrt", ".", "writeTo", "(", ")", ";", "}" ]
Writes the content to a stream. @param os the stream @throws IOException on error
[ "Writes", "the", "content", "to", "a", "stream", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/FdfWriter.java#L77-L80
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java
BootstrapConfig.processIncludes
protected void processIncludes(Map<String, String> mergeProps, URL rootURL, String includeProps) { """ Process included/referenced bootstrap properties. Properties resources should be specified using a) relative path from the containing bootstrap.properties, b) absolute path, or c) full URI/URLs. @param mergeProps @param includeProps """ if (includeProps == null) return; String props[] = includeProps.trim().split("\\s*,\\s*"); for (String pname : props) { mergeProperties(mergeProps, rootURL, pname); } }
java
protected void processIncludes(Map<String, String> mergeProps, URL rootURL, String includeProps) { if (includeProps == null) return; String props[] = includeProps.trim().split("\\s*,\\s*"); for (String pname : props) { mergeProperties(mergeProps, rootURL, pname); } }
[ "protected", "void", "processIncludes", "(", "Map", "<", "String", ",", "String", ">", "mergeProps", ",", "URL", "rootURL", ",", "String", "includeProps", ")", "{", "if", "(", "includeProps", "==", "null", ")", "return", ";", "String", "props", "[", "]", "=", "includeProps", ".", "trim", "(", ")", ".", "split", "(", "\"\\\\s*,\\\\s*\"", ")", ";", "for", "(", "String", "pname", ":", "props", ")", "{", "mergeProperties", "(", "mergeProps", ",", "rootURL", ",", "pname", ")", ";", "}", "}" ]
Process included/referenced bootstrap properties. Properties resources should be specified using a) relative path from the containing bootstrap.properties, b) absolute path, or c) full URI/URLs. @param mergeProps @param includeProps
[ "Process", "included", "/", "referenced", "bootstrap", "properties", ".", "Properties", "resources", "should", "be", "specified", "using", "a", ")", "relative", "path", "from", "the", "containing", "bootstrap", ".", "properties", "b", ")", "absolute", "path", "or", "c", ")", "full", "URI", "/", "URLs", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java#L733-L741
elki-project/elki
elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/kd/SmallMemoryKDTree.java
SmallMemoryKDTree.buildTree
private void buildTree(int left, int right, int axis, DoubleDBIDListMIter iter) { """ Recursively build the tree by partial sorting. O(n log n) complexity. Apparently there exists a variant in only O(n log log n)? Please contribute! @param left Interval minimum @param right Interval maximum @param axis Current splitting axis @param iter Iterator """ assert (left < right); for(iter.seek(left); iter.getOffset() < right; iter.advance()) { iter.setDouble(relation.get(iter).doubleValue(axis)); countObjectAccess(); } if(right - left <= leafsize) { return; } int middle = (left + right) >>> 1; QuickSelectDBIDs.quickSelect(sorted, left, right, middle); final int next = (axis + 1) % dims; if(left < middle) { buildTree(left, middle, next, iter); } ++middle; if(middle < right) { buildTree(middle, right, next, iter); } }
java
private void buildTree(int left, int right, int axis, DoubleDBIDListMIter iter) { assert (left < right); for(iter.seek(left); iter.getOffset() < right; iter.advance()) { iter.setDouble(relation.get(iter).doubleValue(axis)); countObjectAccess(); } if(right - left <= leafsize) { return; } int middle = (left + right) >>> 1; QuickSelectDBIDs.quickSelect(sorted, left, right, middle); final int next = (axis + 1) % dims; if(left < middle) { buildTree(left, middle, next, iter); } ++middle; if(middle < right) { buildTree(middle, right, next, iter); } }
[ "private", "void", "buildTree", "(", "int", "left", ",", "int", "right", ",", "int", "axis", ",", "DoubleDBIDListMIter", "iter", ")", "{", "assert", "(", "left", "<", "right", ")", ";", "for", "(", "iter", ".", "seek", "(", "left", ")", ";", "iter", ".", "getOffset", "(", ")", "<", "right", ";", "iter", ".", "advance", "(", ")", ")", "{", "iter", ".", "setDouble", "(", "relation", ".", "get", "(", "iter", ")", ".", "doubleValue", "(", "axis", ")", ")", ";", "countObjectAccess", "(", ")", ";", "}", "if", "(", "right", "-", "left", "<=", "leafsize", ")", "{", "return", ";", "}", "int", "middle", "=", "(", "left", "+", "right", ")", ">>>", "1", ";", "QuickSelectDBIDs", ".", "quickSelect", "(", "sorted", ",", "left", ",", "right", ",", "middle", ")", ";", "final", "int", "next", "=", "(", "axis", "+", "1", ")", "%", "dims", ";", "if", "(", "left", "<", "middle", ")", "{", "buildTree", "(", "left", ",", "middle", ",", "next", ",", "iter", ")", ";", "}", "++", "middle", ";", "if", "(", "middle", "<", "right", ")", "{", "buildTree", "(", "middle", ",", "right", ",", "next", ",", "iter", ")", ";", "}", "}" ]
Recursively build the tree by partial sorting. O(n log n) complexity. Apparently there exists a variant in only O(n log log n)? Please contribute! @param left Interval minimum @param right Interval maximum @param axis Current splitting axis @param iter Iterator
[ "Recursively", "build", "the", "tree", "by", "partial", "sorting", ".", "O", "(", "n", "log", "n", ")", "complexity", ".", "Apparently", "there", "exists", "a", "variant", "in", "only", "O", "(", "n", "log", "log", "n", ")", "?", "Please", "contribute!" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/kd/SmallMemoryKDTree.java#L155-L175
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/HeaderElement.java
HeaderElement.updateLastCRLFInfo
protected void updateLastCRLFInfo(int index, int pos, boolean isCR) { """ Set the relevant information for the CRLF position information from the parsing code. @param index @param pos @param isCR """ this.lastCRLFBufferIndex = index; this.lastCRLFPosition = pos; this.lastCRLFisCR = isCR; }
java
protected void updateLastCRLFInfo(int index, int pos, boolean isCR) { this.lastCRLFBufferIndex = index; this.lastCRLFPosition = pos; this.lastCRLFisCR = isCR; }
[ "protected", "void", "updateLastCRLFInfo", "(", "int", "index", ",", "int", "pos", ",", "boolean", "isCR", ")", "{", "this", ".", "lastCRLFBufferIndex", "=", "index", ";", "this", ".", "lastCRLFPosition", "=", "pos", ";", "this", ".", "lastCRLFisCR", "=", "isCR", ";", "}" ]
Set the relevant information for the CRLF position information from the parsing code. @param index @param pos @param isCR
[ "Set", "the", "relevant", "information", "for", "the", "CRLF", "position", "information", "from", "the", "parsing", "code", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/HeaderElement.java#L566-L570
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/TilesExtractor.java
TilesExtractor.getTilesNumber
private static int getTilesNumber(int tileWidth, int tileHeight, Collection<Media> levelRips) { """ Get the total number of tiles. @param tileWidth The tile width. @param tileHeight The tile height. @param levelRips The levels rip used. @return The total number of tiles. """ int tiles = 0; for (final Media levelRip : levelRips) { final ImageHeader info = ImageInfo.get(levelRip); final int horizontalTiles = info.getWidth() / tileWidth; final int verticalTiles = info.getHeight() / tileHeight; tiles += horizontalTiles * verticalTiles; } return tiles; }
java
private static int getTilesNumber(int tileWidth, int tileHeight, Collection<Media> levelRips) { int tiles = 0; for (final Media levelRip : levelRips) { final ImageHeader info = ImageInfo.get(levelRip); final int horizontalTiles = info.getWidth() / tileWidth; final int verticalTiles = info.getHeight() / tileHeight; tiles += horizontalTiles * verticalTiles; } return tiles; }
[ "private", "static", "int", "getTilesNumber", "(", "int", "tileWidth", ",", "int", "tileHeight", ",", "Collection", "<", "Media", ">", "levelRips", ")", "{", "int", "tiles", "=", "0", ";", "for", "(", "final", "Media", "levelRip", ":", "levelRips", ")", "{", "final", "ImageHeader", "info", "=", "ImageInfo", ".", "get", "(", "levelRip", ")", ";", "final", "int", "horizontalTiles", "=", "info", ".", "getWidth", "(", ")", "/", "tileWidth", ";", "final", "int", "verticalTiles", "=", "info", ".", "getHeight", "(", ")", "/", "tileHeight", ";", "tiles", "+=", "horizontalTiles", "*", "verticalTiles", ";", "}", "return", "tiles", ";", "}" ]
Get the total number of tiles. @param tileWidth The tile width. @param tileHeight The tile height. @param levelRips The levels rip used. @return The total number of tiles.
[ "Get", "the", "total", "number", "of", "tiles", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/TilesExtractor.java#L132-L143
Coveros/selenified
src/main/java/com/coveros/selenified/application/WaitFor.java
WaitFor.cookieMatches
@Override public void cookieMatches(String cookieName, String expectedCookiePattern) { """ Waits up to the default wait time (5 seconds unless changed) for a cookies with the provided name has a value matching the expected pattern. This information will be logged and recorded, with a screenshot for traceability and added debugging support. @param cookieName the name of the cookie @param expectedCookiePattern the expected value of the cookie """ cookieMatches(defaultWait, cookieName, expectedCookiePattern); }
java
@Override public void cookieMatches(String cookieName, String expectedCookiePattern) { cookieMatches(defaultWait, cookieName, expectedCookiePattern); }
[ "@", "Override", "public", "void", "cookieMatches", "(", "String", "cookieName", ",", "String", "expectedCookiePattern", ")", "{", "cookieMatches", "(", "defaultWait", ",", "cookieName", ",", "expectedCookiePattern", ")", ";", "}" ]
Waits up to the default wait time (5 seconds unless changed) for a cookies with the provided name has a value matching the expected pattern. This information will be logged and recorded, with a screenshot for traceability and added debugging support. @param cookieName the name of the cookie @param expectedCookiePattern the expected value of the cookie
[ "Waits", "up", "to", "the", "default", "wait", "time", "(", "5", "seconds", "unless", "changed", ")", "for", "a", "cookies", "with", "the", "provided", "name", "has", "a", "value", "matching", "the", "expected", "pattern", ".", "This", "information", "will", "be", "logged", "and", "recorded", "with", "a", "screenshot", "for", "traceability", "and", "added", "debugging", "support", "." ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/application/WaitFor.java#L331-L334
VoltDB/voltdb
src/frontend/org/voltdb/compilereport/ReportMaker.java
ReportMaker.liveReport
public static String liveReport() { """ Find the pre-compild catalog report in the jarfile, and modify it for use in the the built-in web portal. """ byte[] reportbytes = VoltDB.instance().getCatalogContext().getFileInJar(VoltCompiler.CATLOG_REPORT); String report = new String(reportbytes, Charsets.UTF_8); // remove commented out code report = report.replace("<!--##RESOURCES", ""); report = report.replace("##RESOURCES-->", ""); // inject the cluster overview //String clusterStr = "<h4>System Overview</h4>\n<p>" + getLiveSystemOverview() + "</p><br/>\n"; //report = report.replace("<!--##CLUSTER##-->", clusterStr); // inject the running system platform properties PlatformProperties pp = PlatformProperties.getPlatformProperties(); String ppStr = "<h4>Cluster Platform</h4>\n<p>" + pp.toHTML() + "</p><br/>\n"; report = report.replace("<!--##PLATFORM2##-->", ppStr); // change the live/static var to live if (VoltDB.instance().getConfig().m_isEnterprise) { report = report.replace("&b=r&", "&b=e&"); } else { report = report.replace("&b=r&", "&b=c&"); } return report; }
java
public static String liveReport() { byte[] reportbytes = VoltDB.instance().getCatalogContext().getFileInJar(VoltCompiler.CATLOG_REPORT); String report = new String(reportbytes, Charsets.UTF_8); // remove commented out code report = report.replace("<!--##RESOURCES", ""); report = report.replace("##RESOURCES-->", ""); // inject the cluster overview //String clusterStr = "<h4>System Overview</h4>\n<p>" + getLiveSystemOverview() + "</p><br/>\n"; //report = report.replace("<!--##CLUSTER##-->", clusterStr); // inject the running system platform properties PlatformProperties pp = PlatformProperties.getPlatformProperties(); String ppStr = "<h4>Cluster Platform</h4>\n<p>" + pp.toHTML() + "</p><br/>\n"; report = report.replace("<!--##PLATFORM2##-->", ppStr); // change the live/static var to live if (VoltDB.instance().getConfig().m_isEnterprise) { report = report.replace("&b=r&", "&b=e&"); } else { report = report.replace("&b=r&", "&b=c&"); } return report; }
[ "public", "static", "String", "liveReport", "(", ")", "{", "byte", "[", "]", "reportbytes", "=", "VoltDB", ".", "instance", "(", ")", ".", "getCatalogContext", "(", ")", ".", "getFileInJar", "(", "VoltCompiler", ".", "CATLOG_REPORT", ")", ";", "String", "report", "=", "new", "String", "(", "reportbytes", ",", "Charsets", ".", "UTF_8", ")", ";", "// remove commented out code", "report", "=", "report", ".", "replace", "(", "\"<!--##RESOURCES\"", ",", "\"\"", ")", ";", "report", "=", "report", ".", "replace", "(", "\"##RESOURCES-->\"", ",", "\"\"", ")", ";", "// inject the cluster overview", "//String clusterStr = \"<h4>System Overview</h4>\\n<p>\" + getLiveSystemOverview() + \"</p><br/>\\n\";", "//report = report.replace(\"<!--##CLUSTER##-->\", clusterStr);", "// inject the running system platform properties", "PlatformProperties", "pp", "=", "PlatformProperties", ".", "getPlatformProperties", "(", ")", ";", "String", "ppStr", "=", "\"<h4>Cluster Platform</h4>\\n<p>\"", "+", "pp", ".", "toHTML", "(", ")", "+", "\"</p><br/>\\n\"", ";", "report", "=", "report", ".", "replace", "(", "\"<!--##PLATFORM2##-->\"", ",", "ppStr", ")", ";", "// change the live/static var to live", "if", "(", "VoltDB", ".", "instance", "(", ")", ".", "getConfig", "(", ")", ".", "m_isEnterprise", ")", "{", "report", "=", "report", ".", "replace", "(", "\"&b=r&\"", ",", "\"&b=e&\"", ")", ";", "}", "else", "{", "report", "=", "report", ".", "replace", "(", "\"&b=r&\"", ",", "\"&b=c&\"", ")", ";", "}", "return", "report", ";", "}" ]
Find the pre-compild catalog report in the jarfile, and modify it for use in the the built-in web portal.
[ "Find", "the", "pre", "-", "compild", "catalog", "report", "in", "the", "jarfile", "and", "modify", "it", "for", "use", "in", "the", "the", "built", "-", "in", "web", "portal", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compilereport/ReportMaker.java#L1150-L1176
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/util/Threads.java
Threads.par_ief
private static void par_ief(CompList<?> t, int numproc) throws Exception { """ Runs a set of Compounds in parallel. there are always numproc + 1 threads active. @param comp @param numproc @throws java.lang.Exception """ if (numproc < 1) { throw new IllegalArgumentException("numproc"); } final CountDownLatch latch = new CountDownLatch(t.list().size()); // final ExecutorService e = Executors.newFixedThreadPool(numproc); for (final Compound c : t) { e.submit(new Runnable() { @Override public void run() { try { ComponentAccess.callAnnotated(c, Initialize.class, true); c.execute(); ComponentAccess.callAnnotated(c, Finalize.class, true); } catch (Throwable E) { e.shutdownNow(); } latch.countDown(); } }); } latch.await(); // e.shutdown(); }
java
private static void par_ief(CompList<?> t, int numproc) throws Exception { if (numproc < 1) { throw new IllegalArgumentException("numproc"); } final CountDownLatch latch = new CountDownLatch(t.list().size()); // final ExecutorService e = Executors.newFixedThreadPool(numproc); for (final Compound c : t) { e.submit(new Runnable() { @Override public void run() { try { ComponentAccess.callAnnotated(c, Initialize.class, true); c.execute(); ComponentAccess.callAnnotated(c, Finalize.class, true); } catch (Throwable E) { e.shutdownNow(); } latch.countDown(); } }); } latch.await(); // e.shutdown(); }
[ "private", "static", "void", "par_ief", "(", "CompList", "<", "?", ">", "t", ",", "int", "numproc", ")", "throws", "Exception", "{", "if", "(", "numproc", "<", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"numproc\"", ")", ";", "}", "final", "CountDownLatch", "latch", "=", "new", "CountDownLatch", "(", "t", ".", "list", "(", ")", ".", "size", "(", ")", ")", ";", "// final ExecutorService e = Executors.newFixedThreadPool(numproc);", "for", "(", "final", "Compound", "c", ":", "t", ")", "{", "e", ".", "submit", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "try", "{", "ComponentAccess", ".", "callAnnotated", "(", "c", ",", "Initialize", ".", "class", ",", "true", ")", ";", "c", ".", "execute", "(", ")", ";", "ComponentAccess", ".", "callAnnotated", "(", "c", ",", "Finalize", ".", "class", ",", "true", ")", ";", "}", "catch", "(", "Throwable", "E", ")", "{", "e", ".", "shutdownNow", "(", ")", ";", "}", "latch", ".", "countDown", "(", ")", ";", "}", "}", ")", ";", "}", "latch", ".", "await", "(", ")", ";", "// e.shutdown();", "}" ]
Runs a set of Compounds in parallel. there are always numproc + 1 threads active. @param comp @param numproc @throws java.lang.Exception
[ "Runs", "a", "set", "of", "Compounds", "in", "parallel", ".", "there", "are", "always", "numproc", "+", "1", "threads", "active", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/util/Threads.java#L98-L122
omise/omise-java
src/main/java/co/omise/Serializer.java
Serializer.serializeParams
public <T extends Params> void serializeParams(OutputStream output, T param) throws IOException { """ Serializes the given parameter object to the output stream. @param output The {@link OutputStream} to serialize the parameter into. @param param The {@link Params} to serialize. @param <T> The type of the parameter object to serialize. @throws IOException on general I/O error. """ // TODO: Add params-specific options. objectMapper.writerFor(param.getClass()).writeValue(output, param); }
java
public <T extends Params> void serializeParams(OutputStream output, T param) throws IOException { // TODO: Add params-specific options. objectMapper.writerFor(param.getClass()).writeValue(output, param); }
[ "public", "<", "T", "extends", "Params", ">", "void", "serializeParams", "(", "OutputStream", "output", ",", "T", "param", ")", "throws", "IOException", "{", "// TODO: Add params-specific options.", "objectMapper", ".", "writerFor", "(", "param", ".", "getClass", "(", ")", ")", ".", "writeValue", "(", "output", ",", "param", ")", ";", "}" ]
Serializes the given parameter object to the output stream. @param output The {@link OutputStream} to serialize the parameter into. @param param The {@link Params} to serialize. @param <T> The type of the parameter object to serialize. @throws IOException on general I/O error.
[ "Serializes", "the", "given", "parameter", "object", "to", "the", "output", "stream", "." ]
train
https://github.com/omise/omise-java/blob/95aafc5e8c21b44e6d00a5a9080b9e353fe98042/src/main/java/co/omise/Serializer.java#L176-L179
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/update/NvdCveUpdater.java
NvdCveUpdater.retrieveLastModifiedDates
@SuppressFBWarnings(justification = "This is only called from within a synchronized method", value = { """ Retrieves the timestamps from the NVD CVE by checking the last modified date. @param startYear the first year whose item to check for the timestamp @param endYear the last year whose item to check for the timestamp @return the timestamps from the currently published NVD CVE downloads page @throws MalformedURLException thrown if the URL for the NVD CVE data is incorrect. @throws DownloadFailedException thrown if there is an error retrieving the time stamps from the NVD CVE """"IS2_INCONSISTENT_SYNC"}) private Map<String, Long> retrieveLastModifiedDates(int startYear, int endYear) throws MalformedURLException, DownloadFailedException { final Set<String> urls = new HashSet<>(); final String baseUrl = settings.getString(Settings.KEYS.CVE_BASE_JSON); for (int i = startYear; i <= endYear; i++) { final String url = String.format(baseUrl, i); urls.add(url); } urls.add(settings.getString(Settings.KEYS.CVE_MODIFIED_JSON)); final Map<String, Future<Long>> timestampFutures = new HashMap<>(); urls.forEach((url) -> { final TimestampRetriever timestampRetriever = new TimestampRetriever(url, settings); final Future<Long> future = downloadExecutorService.submit(timestampRetriever); timestampFutures.put(url, future); }
java
@SuppressFBWarnings(justification = "This is only called from within a synchronized method", value = {"IS2_INCONSISTENT_SYNC"}) private Map<String, Long> retrieveLastModifiedDates(int startYear, int endYear) throws MalformedURLException, DownloadFailedException { final Set<String> urls = new HashSet<>(); final String baseUrl = settings.getString(Settings.KEYS.CVE_BASE_JSON); for (int i = startYear; i <= endYear; i++) { final String url = String.format(baseUrl, i); urls.add(url); } urls.add(settings.getString(Settings.KEYS.CVE_MODIFIED_JSON)); final Map<String, Future<Long>> timestampFutures = new HashMap<>(); urls.forEach((url) -> { final TimestampRetriever timestampRetriever = new TimestampRetriever(url, settings); final Future<Long> future = downloadExecutorService.submit(timestampRetriever); timestampFutures.put(url, future); }
[ "@", "SuppressFBWarnings", "(", "justification", "=", "\"This is only called from within a synchronized method\"", ",", "value", "=", "{", "\"IS2_INCONSISTENT_SYNC\"", "}", ")", "private", "Map", "<", "String", ",", "Long", ">", "retrieveLastModifiedDates", "(", "int", "startYear", ",", "int", "endYear", ")", "throws", "MalformedURLException", ",", "DownloadFailedException", "{", "final", "Set", "<", "String", ">", "urls", "=", "new", "HashSet", "<>", "(", ")", ";", "final", "String", "baseUrl", "=", "settings", ".", "getString", "(", "Settings", ".", "KEYS", ".", "CVE_BASE_JSON", ")", ";", "for", "(", "int", "i", "=", "startYear", ";", "i", "<=", "endYear", ";", "i", "++", ")", "{", "final", "String", "url", "=", "String", ".", "format", "(", "baseUrl", ",", "i", ")", ";", "urls", ".", "add", "(", "url", ")", ";", "}", "urls", ".", "add", "(", "settings", ".", "getString", "(", "Settings", ".", "KEYS", ".", "CVE_MODIFIED_JSON", ")", ")", ";", "final", "Map", "<", "String", ",", "Future", "<", "Long", ">", ">", "timestampFutures", "=", "new", "HashMap", "<>", "(", ")", ";", "urls", ".", "forEach", "(", "(", "url", ")", "-", ">", "{", "final", "TimestampRetriever", "timestampRetriever", "=", "new", "TimestampRetriever", "(", "url", ",", "settings", ")", "", ";", "final", "Future", "<", "Long", ">", "future", "=", "downloadExecutorService", ".", "submit", "(", "timestampRetriever", ")", ";", "timestampFutures", ".", "put", "(", "url", ",", "future", ")", ";", "}" ]
Retrieves the timestamps from the NVD CVE by checking the last modified date. @param startYear the first year whose item to check for the timestamp @param endYear the last year whose item to check for the timestamp @return the timestamps from the currently published NVD CVE downloads page @throws MalformedURLException thrown if the URL for the NVD CVE data is incorrect. @throws DownloadFailedException thrown if there is an error retrieving the time stamps from the NVD CVE
[ "Retrieves", "the", "timestamps", "from", "the", "NVD", "CVE", "by", "checking", "the", "last", "modified", "date", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/update/NvdCveUpdater.java#L451-L468
spring-projects/spring-security-oauth
spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/endpoint/FrameworkEndpointHandlerMapping.java
FrameworkEndpointHandlerMapping.setMappings
public void setMappings(Map<String, String> patternMap) { """ Custom mappings for framework endpoint paths. The keys in the map are the default framework endpoint path, e.g. "/oauth/authorize", and the values are the desired runtime paths. @param patternMap the mappings to set """ this.mappings = new HashMap<String, String>(patternMap); for (String key : mappings.keySet()) { String result = mappings.get(key); if (result.startsWith(FORWARD)) { result = result.substring(FORWARD.length()); } if (result.startsWith(REDIRECT)) { result = result.substring(REDIRECT.length()); } mappings.put(key, result); } }
java
public void setMappings(Map<String, String> patternMap) { this.mappings = new HashMap<String, String>(patternMap); for (String key : mappings.keySet()) { String result = mappings.get(key); if (result.startsWith(FORWARD)) { result = result.substring(FORWARD.length()); } if (result.startsWith(REDIRECT)) { result = result.substring(REDIRECT.length()); } mappings.put(key, result); } }
[ "public", "void", "setMappings", "(", "Map", "<", "String", ",", "String", ">", "patternMap", ")", "{", "this", ".", "mappings", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", "patternMap", ")", ";", "for", "(", "String", "key", ":", "mappings", ".", "keySet", "(", ")", ")", "{", "String", "result", "=", "mappings", ".", "get", "(", "key", ")", ";", "if", "(", "result", ".", "startsWith", "(", "FORWARD", ")", ")", "{", "result", "=", "result", ".", "substring", "(", "FORWARD", ".", "length", "(", ")", ")", ";", "}", "if", "(", "result", ".", "startsWith", "(", "REDIRECT", ")", ")", "{", "result", "=", "result", ".", "substring", "(", "REDIRECT", ".", "length", "(", ")", ")", ";", "}", "mappings", ".", "put", "(", "key", ",", "result", ")", ";", "}", "}" ]
Custom mappings for framework endpoint paths. The keys in the map are the default framework endpoint path, e.g. "/oauth/authorize", and the values are the desired runtime paths. @param patternMap the mappings to set
[ "Custom", "mappings", "for", "framework", "endpoint", "paths", ".", "The", "keys", "in", "the", "map", "are", "the", "default", "framework", "endpoint", "path", "e", ".", "g", ".", "/", "oauth", "/", "authorize", "and", "the", "values", "are", "the", "desired", "runtime", "paths", "." ]
train
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/endpoint/FrameworkEndpointHandlerMapping.java#L73-L85
aws/aws-sdk-java
aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/model/WeeklyAutoScalingSchedule.java
WeeklyAutoScalingSchedule.withTuesday
public WeeklyAutoScalingSchedule withTuesday(java.util.Map<String, String> tuesday) { """ <p> The schedule for Tuesday. </p> @param tuesday The schedule for Tuesday. @return Returns a reference to this object so that method calls can be chained together. """ setTuesday(tuesday); return this; }
java
public WeeklyAutoScalingSchedule withTuesday(java.util.Map<String, String> tuesday) { setTuesday(tuesday); return this; }
[ "public", "WeeklyAutoScalingSchedule", "withTuesday", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tuesday", ")", "{", "setTuesday", "(", "tuesday", ")", ";", "return", "this", ";", "}" ]
<p> The schedule for Tuesday. </p> @param tuesday The schedule for Tuesday. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "schedule", "for", "Tuesday", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/model/WeeklyAutoScalingSchedule.java#L201-L204
cdapio/tigon
tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java
Bytes.toLong
public static long toLong(byte[] bytes, int offset, final int length) { """ Converts a byte array to a long value. @param bytes array of bytes @param offset offset into array @param length length of data (must be {@link #SIZEOF_LONG}) @return the long value @throws IllegalArgumentException if length is not {@link #SIZEOF_LONG} or if there's not enough room in the array at the offset indicated. """ if (length != SIZEOF_LONG || offset + length > bytes.length) { throw explainWrongLengthOrOffset(bytes, offset, length, SIZEOF_LONG); } long l = 0; for (int i = offset; i < offset + length; i++) { l <<= 8; l ^= bytes[i] & 0xFF; } return l; }
java
public static long toLong(byte[] bytes, int offset, final int length) { if (length != SIZEOF_LONG || offset + length > bytes.length) { throw explainWrongLengthOrOffset(bytes, offset, length, SIZEOF_LONG); } long l = 0; for (int i = offset; i < offset + length; i++) { l <<= 8; l ^= bytes[i] & 0xFF; } return l; }
[ "public", "static", "long", "toLong", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ",", "final", "int", "length", ")", "{", "if", "(", "length", "!=", "SIZEOF_LONG", "||", "offset", "+", "length", ">", "bytes", ".", "length", ")", "{", "throw", "explainWrongLengthOrOffset", "(", "bytes", ",", "offset", ",", "length", ",", "SIZEOF_LONG", ")", ";", "}", "long", "l", "=", "0", ";", "for", "(", "int", "i", "=", "offset", ";", "i", "<", "offset", "+", "length", ";", "i", "++", ")", "{", "l", "<<=", "8", ";", "l", "^=", "bytes", "[", "i", "]", "&", "0xFF", ";", "}", "return", "l", ";", "}" ]
Converts a byte array to a long value. @param bytes array of bytes @param offset offset into array @param length length of data (must be {@link #SIZEOF_LONG}) @return the long value @throws IllegalArgumentException if length is not {@link #SIZEOF_LONG} or if there's not enough room in the array at the offset indicated.
[ "Converts", "a", "byte", "array", "to", "a", "long", "value", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java#L394-L404
sebastiangraf/perfidix
src/main/java/org/perfidix/ouput/asciitable/NiceTable.java
NiceTable.addRow
public void addRow(final String[] data) { """ Adds a string row. checks that the strings added do not contain newlines, because if so, it has to split them in order to make them fit the row. @param data the array of data. """ if (anyStringContainsNewLine(data)) { final String[][] theMatrix = Util.createMatrix(data); for (int i = 0; i < theMatrix.length; i++) { addRow(theMatrix[i]); } } else { final Row myRow = new Row(this, data); rows.add(myRow); } }
java
public void addRow(final String[] data) { if (anyStringContainsNewLine(data)) { final String[][] theMatrix = Util.createMatrix(data); for (int i = 0; i < theMatrix.length; i++) { addRow(theMatrix[i]); } } else { final Row myRow = new Row(this, data); rows.add(myRow); } }
[ "public", "void", "addRow", "(", "final", "String", "[", "]", "data", ")", "{", "if", "(", "anyStringContainsNewLine", "(", "data", ")", ")", "{", "final", "String", "[", "]", "[", "]", "theMatrix", "=", "Util", ".", "createMatrix", "(", "data", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "theMatrix", ".", "length", ";", "i", "++", ")", "{", "addRow", "(", "theMatrix", "[", "i", "]", ")", ";", "}", "}", "else", "{", "final", "Row", "myRow", "=", "new", "Row", "(", "this", ",", "data", ")", ";", "rows", ".", "add", "(", "myRow", ")", ";", "}", "}" ]
Adds a string row. checks that the strings added do not contain newlines, because if so, it has to split them in order to make them fit the row. @param data the array of data.
[ "Adds", "a", "string", "row", ".", "checks", "that", "the", "strings", "added", "do", "not", "contain", "newlines", "because", "if", "so", "it", "has", "to", "split", "them", "in", "order", "to", "make", "them", "fit", "the", "row", "." ]
train
https://github.com/sebastiangraf/perfidix/blob/f13aa793b6a3055215ed4edbb946c1bb5d564886/src/main/java/org/perfidix/ouput/asciitable/NiceTable.java#L106-L117
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java
ArrayUtil.join
public static <T> String join(T[] array, CharSequence conjunction) { """ 以 conjunction 为分隔符将数组转换为字符串 @param <T> 被处理的集合 @param array 数组 @param conjunction 分隔符 @return 连接后的字符串 """ return join(array, conjunction, null, null); }
java
public static <T> String join(T[] array, CharSequence conjunction) { return join(array, conjunction, null, null); }
[ "public", "static", "<", "T", ">", "String", "join", "(", "T", "[", "]", "array", ",", "CharSequence", "conjunction", ")", "{", "return", "join", "(", "array", ",", "conjunction", ",", "null", ",", "null", ")", ";", "}" ]
以 conjunction 为分隔符将数组转换为字符串 @param <T> 被处理的集合 @param array 数组 @param conjunction 分隔符 @return 连接后的字符串
[ "以", "conjunction", "为分隔符将数组转换为字符串" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L2293-L2295
google/closure-templates
java/src/com/google/template/soy/data/SoyValueConverter.java
SoyValueConverter.newSoyMapFromJavaMap
private SoyMap newSoyMapFromJavaMap(Map<?, ?> javaMap) { """ Creates a Soy map from a Java map. While this is O(n) in the map's shallow size, the Java values are converted into Soy values lazily and only once. The keys are converted eagerly. """ Map<SoyValue, SoyValueProvider> map = Maps.newHashMapWithExpectedSize(javaMap.size()); for (Map.Entry<?, ?> entry : javaMap.entrySet()) { map.put(convert(entry.getKey()).resolve(), convertLazy(entry.getValue())); } return SoyMapImpl.forProviderMap(map); }
java
private SoyMap newSoyMapFromJavaMap(Map<?, ?> javaMap) { Map<SoyValue, SoyValueProvider> map = Maps.newHashMapWithExpectedSize(javaMap.size()); for (Map.Entry<?, ?> entry : javaMap.entrySet()) { map.put(convert(entry.getKey()).resolve(), convertLazy(entry.getValue())); } return SoyMapImpl.forProviderMap(map); }
[ "private", "SoyMap", "newSoyMapFromJavaMap", "(", "Map", "<", "?", ",", "?", ">", "javaMap", ")", "{", "Map", "<", "SoyValue", ",", "SoyValueProvider", ">", "map", "=", "Maps", ".", "newHashMapWithExpectedSize", "(", "javaMap", ".", "size", "(", ")", ")", ";", "for", "(", "Map", ".", "Entry", "<", "?", ",", "?", ">", "entry", ":", "javaMap", ".", "entrySet", "(", ")", ")", "{", "map", ".", "put", "(", "convert", "(", "entry", ".", "getKey", "(", ")", ")", ".", "resolve", "(", ")", ",", "convertLazy", "(", "entry", ".", "getValue", "(", ")", ")", ")", ";", "}", "return", "SoyMapImpl", ".", "forProviderMap", "(", "map", ")", ";", "}" ]
Creates a Soy map from a Java map. While this is O(n) in the map's shallow size, the Java values are converted into Soy values lazily and only once. The keys are converted eagerly.
[ "Creates", "a", "Soy", "map", "from", "a", "Java", "map", ".", "While", "this", "is", "O", "(", "n", ")", "in", "the", "map", "s", "shallow", "size", "the", "Java", "values", "are", "converted", "into", "Soy", "values", "lazily", "and", "only", "once", ".", "The", "keys", "are", "converted", "eagerly", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/data/SoyValueConverter.java#L370-L376
jglobus/JGlobus
gss/src/main/java/org/globus/gsi/gssapi/SSLUtil.java
SSLUtil.toLong
public static long toLong(byte[]buf, int off) { """ Converts 8 bytes to a <code>long</code> at the specified offset in the given byte array. @param buf the byte array containing the 8 bytes to be converted to a <code>long</code>. @param off offset in the byte array @return the <code>long</code> value of the 8 bytes. """ return ((long)(toInt(buf, off)) << 32) + (toInt(buf, off+4) & 0xFFFFFFFFL); }
java
public static long toLong(byte[]buf, int off) { return ((long)(toInt(buf, off)) << 32) + (toInt(buf, off+4) & 0xFFFFFFFFL); }
[ "public", "static", "long", "toLong", "(", "byte", "[", "]", "buf", ",", "int", "off", ")", "{", "return", "(", "(", "long", ")", "(", "toInt", "(", "buf", ",", "off", ")", ")", "<<", "32", ")", "+", "(", "toInt", "(", "buf", ",", "off", "+", "4", ")", "&", "0xFFFFFFFF", "L", ")", ";", "}" ]
Converts 8 bytes to a <code>long</code> at the specified offset in the given byte array. @param buf the byte array containing the 8 bytes to be converted to a <code>long</code>. @param off offset in the byte array @return the <code>long</code> value of the 8 bytes.
[ "Converts", "8", "bytes", "to", "a", "<code", ">", "long<", "/", "code", ">", "at", "the", "specified", "offset", "in", "the", "given", "byte", "array", "." ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gss/src/main/java/org/globus/gsi/gssapi/SSLUtil.java#L201-L203
haraldk/TwelveMonkeys
imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickDrawContext.java
QuickDrawContext.invertRoundRect
public void invertRoundRect(final Rectangle2D pRectangle, int pArcW, int pArcH) { """ InvertRoundRect(r,int,int) // reverses the color of all pixels in the rect @param pRectangle the rectangle to invert @param pArcW width of the oval defining the rounded corner. @param pArcH height of the oval defining the rounded corner. """ invertShape(toRoundRect(pRectangle, pArcW, pArcH)); }
java
public void invertRoundRect(final Rectangle2D pRectangle, int pArcW, int pArcH) { invertShape(toRoundRect(pRectangle, pArcW, pArcH)); }
[ "public", "void", "invertRoundRect", "(", "final", "Rectangle2D", "pRectangle", ",", "int", "pArcW", ",", "int", "pArcH", ")", "{", "invertShape", "(", "toRoundRect", "(", "pRectangle", ",", "pArcW", ",", "pArcH", ")", ")", ";", "}" ]
InvertRoundRect(r,int,int) // reverses the color of all pixels in the rect @param pRectangle the rectangle to invert @param pArcW width of the oval defining the rounded corner. @param pArcH height of the oval defining the rounded corner.
[ "InvertRoundRect", "(", "r", "int", "int", ")", "//", "reverses", "the", "color", "of", "all", "pixels", "in", "the", "rect" ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickDrawContext.java#L642-L644
crawljax/crawljax
core/src/main/java/com/crawljax/core/plugin/Plugins.java
Plugins.runPostCrawlingPlugins
public void runPostCrawlingPlugins(CrawlSession session, ExitStatus exitReason) { """ load and run the postCrawlingPlugins. PostCrawlingPlugins are executed after the crawling is finished Warning: changing the session can change the behavior of other post crawl plugins. It is not a clone! @param exitReason The reason Crawljax has stopped. @param session the current {@link CrawlSession} for this crawler. """ LOGGER.debug("Running PostCrawlingPlugins..."); counters.get(PostCrawlingPlugin.class).inc(); for (Plugin plugin : plugins.get(PostCrawlingPlugin.class)) { if (plugin instanceof PostCrawlingPlugin) { try { LOGGER.debug("Calling plugin {}", plugin); ((PostCrawlingPlugin) plugin).postCrawling(session, exitReason); } catch (RuntimeException e) { reportFailingPlugin(plugin, e); } } } }
java
public void runPostCrawlingPlugins(CrawlSession session, ExitStatus exitReason) { LOGGER.debug("Running PostCrawlingPlugins..."); counters.get(PostCrawlingPlugin.class).inc(); for (Plugin plugin : plugins.get(PostCrawlingPlugin.class)) { if (plugin instanceof PostCrawlingPlugin) { try { LOGGER.debug("Calling plugin {}", plugin); ((PostCrawlingPlugin) plugin).postCrawling(session, exitReason); } catch (RuntimeException e) { reportFailingPlugin(plugin, e); } } } }
[ "public", "void", "runPostCrawlingPlugins", "(", "CrawlSession", "session", ",", "ExitStatus", "exitReason", ")", "{", "LOGGER", ".", "debug", "(", "\"Running PostCrawlingPlugins...\"", ")", ";", "counters", ".", "get", "(", "PostCrawlingPlugin", ".", "class", ")", ".", "inc", "(", ")", ";", "for", "(", "Plugin", "plugin", ":", "plugins", ".", "get", "(", "PostCrawlingPlugin", ".", "class", ")", ")", "{", "if", "(", "plugin", "instanceof", "PostCrawlingPlugin", ")", "{", "try", "{", "LOGGER", ".", "debug", "(", "\"Calling plugin {}\"", ",", "plugin", ")", ";", "(", "(", "PostCrawlingPlugin", ")", "plugin", ")", ".", "postCrawling", "(", "session", ",", "exitReason", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "reportFailingPlugin", "(", "plugin", ",", "e", ")", ";", "}", "}", "}", "}" ]
load and run the postCrawlingPlugins. PostCrawlingPlugins are executed after the crawling is finished Warning: changing the session can change the behavior of other post crawl plugins. It is not a clone! @param exitReason The reason Crawljax has stopped. @param session the current {@link CrawlSession} for this crawler.
[ "load", "and", "run", "the", "postCrawlingPlugins", ".", "PostCrawlingPlugins", "are", "executed", "after", "the", "crawling", "is", "finished", "Warning", ":", "changing", "the", "session", "can", "change", "the", "behavior", "of", "other", "post", "crawl", "plugins", ".", "It", "is", "not", "a", "clone!" ]
train
https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/core/src/main/java/com/crawljax/core/plugin/Plugins.java#L203-L217
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/hoverbar/CmsEditModelPageMenuEntry.java
CmsEditModelPageMenuEntry.editModelPage
public static void editModelPage(final String resourcePath, boolean isModelGroup) { """ Opens the editor for a model page menu entry.<p> @param resourcePath the resource path of the model page @param isModelGroup if the given entry is a model group page """ if (CmsSitemapView.getInstance().getController().getData().isShowModelEditConfirm()) { I_CmsConfirmDialogHandler handler = new I_CmsConfirmDialogHandler() { public void onClose() { // noop } public void onOk() { openEditor(resourcePath); } }; String dialogTitle; String dialogContent; if (isModelGroup) { dialogTitle = Messages.get().key(Messages.GUI_EDIT_MODEL_GROUPS_CONFIRM_TITLE_0); dialogContent = Messages.get().key(Messages.GUI_EDIT_MODEL_GROUP_CONFIRM_CONTENT_0); } else { dialogTitle = Messages.get().key(Messages.GUI_EDIT_MODELPAGE_CONFIRM_TITLE_0); dialogContent = Messages.get().key(Messages.GUI_EDIT_MODELPAGE_CONFIRM_CONTENT_0); } String buttonText = Messages.get().key(Messages.GUI_EDIT_MODELPAGE_OK_0); CmsConfirmDialog dialog = new CmsConfirmDialog(dialogTitle, dialogContent); dialog.getOkButton().setText(buttonText); dialog.setHandler(handler); dialog.center(); } else { openEditor(resourcePath); } }
java
public static void editModelPage(final String resourcePath, boolean isModelGroup) { if (CmsSitemapView.getInstance().getController().getData().isShowModelEditConfirm()) { I_CmsConfirmDialogHandler handler = new I_CmsConfirmDialogHandler() { public void onClose() { // noop } public void onOk() { openEditor(resourcePath); } }; String dialogTitle; String dialogContent; if (isModelGroup) { dialogTitle = Messages.get().key(Messages.GUI_EDIT_MODEL_GROUPS_CONFIRM_TITLE_0); dialogContent = Messages.get().key(Messages.GUI_EDIT_MODEL_GROUP_CONFIRM_CONTENT_0); } else { dialogTitle = Messages.get().key(Messages.GUI_EDIT_MODELPAGE_CONFIRM_TITLE_0); dialogContent = Messages.get().key(Messages.GUI_EDIT_MODELPAGE_CONFIRM_CONTENT_0); } String buttonText = Messages.get().key(Messages.GUI_EDIT_MODELPAGE_OK_0); CmsConfirmDialog dialog = new CmsConfirmDialog(dialogTitle, dialogContent); dialog.getOkButton().setText(buttonText); dialog.setHandler(handler); dialog.center(); } else { openEditor(resourcePath); } }
[ "public", "static", "void", "editModelPage", "(", "final", "String", "resourcePath", ",", "boolean", "isModelGroup", ")", "{", "if", "(", "CmsSitemapView", ".", "getInstance", "(", ")", ".", "getController", "(", ")", ".", "getData", "(", ")", ".", "isShowModelEditConfirm", "(", ")", ")", "{", "I_CmsConfirmDialogHandler", "handler", "=", "new", "I_CmsConfirmDialogHandler", "(", ")", "{", "public", "void", "onClose", "(", ")", "{", "// noop", "}", "public", "void", "onOk", "(", ")", "{", "openEditor", "(", "resourcePath", ")", ";", "}", "}", ";", "String", "dialogTitle", ";", "String", "dialogContent", ";", "if", "(", "isModelGroup", ")", "{", "dialogTitle", "=", "Messages", ".", "get", "(", ")", ".", "key", "(", "Messages", ".", "GUI_EDIT_MODEL_GROUPS_CONFIRM_TITLE_0", ")", ";", "dialogContent", "=", "Messages", ".", "get", "(", ")", ".", "key", "(", "Messages", ".", "GUI_EDIT_MODEL_GROUP_CONFIRM_CONTENT_0", ")", ";", "}", "else", "{", "dialogTitle", "=", "Messages", ".", "get", "(", ")", ".", "key", "(", "Messages", ".", "GUI_EDIT_MODELPAGE_CONFIRM_TITLE_0", ")", ";", "dialogContent", "=", "Messages", ".", "get", "(", ")", ".", "key", "(", "Messages", ".", "GUI_EDIT_MODELPAGE_CONFIRM_CONTENT_0", ")", ";", "}", "String", "buttonText", "=", "Messages", ".", "get", "(", ")", ".", "key", "(", "Messages", ".", "GUI_EDIT_MODELPAGE_OK_0", ")", ";", "CmsConfirmDialog", "dialog", "=", "new", "CmsConfirmDialog", "(", "dialogTitle", ",", "dialogContent", ")", ";", "dialog", ".", "getOkButton", "(", ")", ".", "setText", "(", "buttonText", ")", ";", "dialog", ".", "setHandler", "(", "handler", ")", ";", "dialog", ".", "center", "(", ")", ";", "}", "else", "{", "openEditor", "(", "resourcePath", ")", ";", "}", "}" ]
Opens the editor for a model page menu entry.<p> @param resourcePath the resource path of the model page @param isModelGroup if the given entry is a model group page
[ "Opens", "the", "editor", "for", "a", "model", "page", "menu", "entry", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/hoverbar/CmsEditModelPageMenuEntry.java#L80-L113
JavaEden/Orchid
OrchidCore/src/main/java/com/eden/orchid/utilities/OrchidUtils.java
OrchidUtils.getRelativeFilename
public static String getRelativeFilename(String sourcePath, String baseDir) { """ Removes the base directory from a file path. Leading slashes are also removed from the resulting file path. @param sourcePath The original file path @param baseDir the base directory that should be removed from the original file path @return the file path relative to the base directory """ if (sourcePath.contains(baseDir)) { int indexOf = sourcePath.indexOf(baseDir); if (indexOf + baseDir.length() < sourcePath.length()) { String relative = sourcePath.substring((indexOf + baseDir.length())); if (relative.startsWith("/")) { relative = relative.substring(1); } else if (relative.startsWith("\\")) { relative = relative.substring(1); } return relative; } } return sourcePath; }
java
public static String getRelativeFilename(String sourcePath, String baseDir) { if (sourcePath.contains(baseDir)) { int indexOf = sourcePath.indexOf(baseDir); if (indexOf + baseDir.length() < sourcePath.length()) { String relative = sourcePath.substring((indexOf + baseDir.length())); if (relative.startsWith("/")) { relative = relative.substring(1); } else if (relative.startsWith("\\")) { relative = relative.substring(1); } return relative; } } return sourcePath; }
[ "public", "static", "String", "getRelativeFilename", "(", "String", "sourcePath", ",", "String", "baseDir", ")", "{", "if", "(", "sourcePath", ".", "contains", "(", "baseDir", ")", ")", "{", "int", "indexOf", "=", "sourcePath", ".", "indexOf", "(", "baseDir", ")", ";", "if", "(", "indexOf", "+", "baseDir", ".", "length", "(", ")", "<", "sourcePath", ".", "length", "(", ")", ")", "{", "String", "relative", "=", "sourcePath", ".", "substring", "(", "(", "indexOf", "+", "baseDir", ".", "length", "(", ")", ")", ")", ";", "if", "(", "relative", ".", "startsWith", "(", "\"/\"", ")", ")", "{", "relative", "=", "relative", ".", "substring", "(", "1", ")", ";", "}", "else", "if", "(", "relative", ".", "startsWith", "(", "\"\\\\\"", ")", ")", "{", "relative", "=", "relative", ".", "substring", "(", "1", ")", ";", "}", "return", "relative", ";", "}", "}", "return", "sourcePath", ";", "}" ]
Removes the base directory from a file path. Leading slashes are also removed from the resulting file path. @param sourcePath The original file path @param baseDir the base directory that should be removed from the original file path @return the file path relative to the base directory
[ "Removes", "the", "base", "directory", "from", "a", "file", "path", ".", "Leading", "slashes", "are", "also", "removed", "from", "the", "resulting", "file", "path", "." ]
train
https://github.com/JavaEden/Orchid/blob/47cde156fc3a7aea894cde41b7f76c503dad9811/OrchidCore/src/main/java/com/eden/orchid/utilities/OrchidUtils.java#L79-L98
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/ScanStream.java
ScanStream.zscan
public static <K, V> Flux<ScoredValue<V>> zscan(RedisSortedSetReactiveCommands<K, V> commands, K key) { """ Sequentially iterate over elements in a set identified by {@code key}. This method uses {@code SSCAN} to perform an iterative scan. @param commands the commands interface, must not be {@literal null}. @param key the sorted set to scan. @param <K> Key type. @param <V> Value type. @return a new {@link Flux}. """ return zscan(commands, key, Optional.empty()); }
java
public static <K, V> Flux<ScoredValue<V>> zscan(RedisSortedSetReactiveCommands<K, V> commands, K key) { return zscan(commands, key, Optional.empty()); }
[ "public", "static", "<", "K", ",", "V", ">", "Flux", "<", "ScoredValue", "<", "V", ">", ">", "zscan", "(", "RedisSortedSetReactiveCommands", "<", "K", ",", "V", ">", "commands", ",", "K", "key", ")", "{", "return", "zscan", "(", "commands", ",", "key", ",", "Optional", ".", "empty", "(", ")", ")", ";", "}" ]
Sequentially iterate over elements in a set identified by {@code key}. This method uses {@code SSCAN} to perform an iterative scan. @param commands the commands interface, must not be {@literal null}. @param key the sorted set to scan. @param <K> Key type. @param <V> Value type. @return a new {@link Flux}.
[ "Sequentially", "iterate", "over", "elements", "in", "a", "set", "identified", "by", "{", "@code", "key", "}", ".", "This", "method", "uses", "{", "@code", "SSCAN", "}", "to", "perform", "an", "iterative", "scan", "." ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/ScanStream.java#L208-L210
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/AbstractRegionPainter.java
AbstractRegionPainter.decodeColor
protected final Color decodeColor(Color color1, Color color2, float midPoint) { """ Decodes and returns a color, which is derived from a offset between two other colors. @param color1 The first color @param color2 The second color @param midPoint The offset between color 1 and color 2, a value of 0.0 is color 1 and 1.0 is color 2; @return The derived color """ return new Color(deriveARGB(color1, color2, midPoint)); }
java
protected final Color decodeColor(Color color1, Color color2, float midPoint) { return new Color(deriveARGB(color1, color2, midPoint)); }
[ "protected", "final", "Color", "decodeColor", "(", "Color", "color1", ",", "Color", "color2", ",", "float", "midPoint", ")", "{", "return", "new", "Color", "(", "deriveARGB", "(", "color1", ",", "color2", ",", "midPoint", ")", ")", ";", "}" ]
Decodes and returns a color, which is derived from a offset between two other colors. @param color1 The first color @param color2 The second color @param midPoint The offset between color 1 and color 2, a value of 0.0 is color 1 and 1.0 is color 2; @return The derived color
[ "Decodes", "and", "returns", "a", "color", "which", "is", "derived", "from", "a", "offset", "between", "two", "other", "colors", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/AbstractRegionPainter.java#L296-L298
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.setOrtho2D
public Matrix4f setOrtho2D(float left, float right, float bottom, float top) { """ Set this matrix to be an orthographic projection transformation for a right-handed coordinate system. <p> This method is equivalent to calling {@link #setOrtho(float, float, float, float, float, float) setOrtho()} with <code>zNear=-1</code> and <code>zFar=+1</code>. <p> In order to apply the orthographic projection to an already existing transformation, use {@link #ortho2D(float, float, float, float) ortho2D()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #setOrtho(float, float, float, float, float, float) @see #ortho2D(float, float, float, float) @param left the distance from the center to the left frustum edge @param right the distance from the center to the right frustum edge @param bottom the distance from the center to the bottom frustum edge @param top the distance from the center to the top frustum edge @return this """ if ((properties & PROPERTY_IDENTITY) == 0) MemUtil.INSTANCE.identity(this); this._m00(2.0f / (right - left)); this._m11(2.0f / (top - bottom)); this._m22(-1.0f); this._m30((right + left) / (left - right)); this._m31((top + bottom) / (bottom - top)); _properties(PROPERTY_AFFINE); return this; }
java
public Matrix4f setOrtho2D(float left, float right, float bottom, float top) { if ((properties & PROPERTY_IDENTITY) == 0) MemUtil.INSTANCE.identity(this); this._m00(2.0f / (right - left)); this._m11(2.0f / (top - bottom)); this._m22(-1.0f); this._m30((right + left) / (left - right)); this._m31((top + bottom) / (bottom - top)); _properties(PROPERTY_AFFINE); return this; }
[ "public", "Matrix4f", "setOrtho2D", "(", "float", "left", ",", "float", "right", ",", "float", "bottom", ",", "float", "top", ")", "{", "if", "(", "(", "properties", "&", "PROPERTY_IDENTITY", ")", "==", "0", ")", "MemUtil", ".", "INSTANCE", ".", "identity", "(", "this", ")", ";", "this", ".", "_m00", "(", "2.0f", "/", "(", "right", "-", "left", ")", ")", ";", "this", ".", "_m11", "(", "2.0f", "/", "(", "top", "-", "bottom", ")", ")", ";", "this", ".", "_m22", "(", "-", "1.0f", ")", ";", "this", ".", "_m30", "(", "(", "right", "+", "left", ")", "/", "(", "left", "-", "right", ")", ")", ";", "this", ".", "_m31", "(", "(", "top", "+", "bottom", ")", "/", "(", "bottom", "-", "top", ")", ")", ";", "_properties", "(", "PROPERTY_AFFINE", ")", ";", "return", "this", ";", "}" ]
Set this matrix to be an orthographic projection transformation for a right-handed coordinate system. <p> This method is equivalent to calling {@link #setOrtho(float, float, float, float, float, float) setOrtho()} with <code>zNear=-1</code> and <code>zFar=+1</code>. <p> In order to apply the orthographic projection to an already existing transformation, use {@link #ortho2D(float, float, float, float) ortho2D()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #setOrtho(float, float, float, float, float, float) @see #ortho2D(float, float, float, float) @param left the distance from the center to the left frustum edge @param right the distance from the center to the right frustum edge @param bottom the distance from the center to the bottom frustum edge @param top the distance from the center to the top frustum edge @return this
[ "Set", "this", "matrix", "to", "be", "an", "orthographic", "projection", "transformation", "for", "a", "right", "-", "handed", "coordinate", "system", ".", "<p", ">", "This", "method", "is", "equivalent", "to", "calling", "{", "@link", "#setOrtho", "(", "float", "float", "float", "float", "float", "float", ")", "setOrtho", "()", "}", "with", "<code", ">", "zNear", "=", "-", "1<", "/", "code", ">", "and", "<code", ">", "zFar", "=", "+", "1<", "/", "code", ">", ".", "<p", ">", "In", "order", "to", "apply", "the", "orthographic", "projection", "to", "an", "already", "existing", "transformation", "use", "{", "@link", "#ortho2D", "(", "float", "float", "float", "float", ")", "ortho2D", "()", "}", ".", "<p", ">", "Reference", ":", "<a", "href", "=", "http", ":", "//", "www", ".", "songho", ".", "ca", "/", "opengl", "/", "gl_projectionmatrix", ".", "html#ortho", ">", "http", ":", "//", "www", ".", "songho", ".", "ca<", "/", "a", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L7993-L8003
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java
ComputeNodesImpl.rebootAsync
public Observable<Void> rebootAsync(String poolId, String nodeId, ComputeNodeRebootOption nodeRebootOption, ComputeNodeRebootOptions computeNodeRebootOptions) { """ Restarts the specified compute node. You can restart a node only if it is in an idle or running state. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node that you want to restart. @param nodeRebootOption When to reboot the compute node and what to do with currently running tasks. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData' @param computeNodeRebootOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful. """ return rebootWithServiceResponseAsync(poolId, nodeId, nodeRebootOption, computeNodeRebootOptions).map(new Func1<ServiceResponseWithHeaders<Void, ComputeNodeRebootHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, ComputeNodeRebootHeaders> response) { return response.body(); } }); }
java
public Observable<Void> rebootAsync(String poolId, String nodeId, ComputeNodeRebootOption nodeRebootOption, ComputeNodeRebootOptions computeNodeRebootOptions) { return rebootWithServiceResponseAsync(poolId, nodeId, nodeRebootOption, computeNodeRebootOptions).map(new Func1<ServiceResponseWithHeaders<Void, ComputeNodeRebootHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, ComputeNodeRebootHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "rebootAsync", "(", "String", "poolId", ",", "String", "nodeId", ",", "ComputeNodeRebootOption", "nodeRebootOption", ",", "ComputeNodeRebootOptions", "computeNodeRebootOptions", ")", "{", "return", "rebootWithServiceResponseAsync", "(", "poolId", ",", "nodeId", ",", "nodeRebootOption", ",", "computeNodeRebootOptions", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponseWithHeaders", "<", "Void", ",", "ComputeNodeRebootHeaders", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponseWithHeaders", "<", "Void", ",", "ComputeNodeRebootHeaders", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Restarts the specified compute node. You can restart a node only if it is in an idle or running state. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node that you want to restart. @param nodeRebootOption When to reboot the compute node and what to do with currently running tasks. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData' @param computeNodeRebootOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful.
[ "Restarts", "the", "specified", "compute", "node", ".", "You", "can", "restart", "a", "node", "only", "if", "it", "is", "in", "an", "idle", "or", "running", "state", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java#L1192-L1199
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java
MonitoringProxyActivator.createBootProxyJar
JarFile createBootProxyJar() throws IOException { """ Create a jar file that contains the proxy code that will live in the boot delegation package. @return the jar file containing the proxy code to append to the boot class path @throws IOException if a file I/O error occurs """ File dataFile = bundleContext.getDataFile("boot-proxy.jar"); // Create the file if it doesn't already exist if (!dataFile.exists()) { dataFile.createNewFile(); } // Generate a manifest Manifest manifest = createBootJarManifest(); // Create the file FileOutputStream fileOutputStream = new FileOutputStream(dataFile, false); JarOutputStream jarOutputStream = new JarOutputStream(fileOutputStream, manifest); // Add the jar path entries to reduce class load times createDirectoryEntries(jarOutputStream, BOOT_DELEGATED_PACKAGE); // Map the template classes into the delegation package and add to the jar Bundle bundle = bundleContext.getBundle(); Enumeration<?> entryPaths = bundle.getEntryPaths(TEMPLATE_CLASSES_PATH); if (entryPaths != null) { while (entryPaths.hasMoreElements()) { URL sourceClassResource = bundle.getEntry((String) entryPaths.nextElement()); if (sourceClassResource != null) writeRemappedClass(sourceClassResource, jarOutputStream, BOOT_DELEGATED_PACKAGE); } } jarOutputStream.close(); fileOutputStream.close(); return new JarFile(dataFile); }
java
JarFile createBootProxyJar() throws IOException { File dataFile = bundleContext.getDataFile("boot-proxy.jar"); // Create the file if it doesn't already exist if (!dataFile.exists()) { dataFile.createNewFile(); } // Generate a manifest Manifest manifest = createBootJarManifest(); // Create the file FileOutputStream fileOutputStream = new FileOutputStream(dataFile, false); JarOutputStream jarOutputStream = new JarOutputStream(fileOutputStream, manifest); // Add the jar path entries to reduce class load times createDirectoryEntries(jarOutputStream, BOOT_DELEGATED_PACKAGE); // Map the template classes into the delegation package and add to the jar Bundle bundle = bundleContext.getBundle(); Enumeration<?> entryPaths = bundle.getEntryPaths(TEMPLATE_CLASSES_PATH); if (entryPaths != null) { while (entryPaths.hasMoreElements()) { URL sourceClassResource = bundle.getEntry((String) entryPaths.nextElement()); if (sourceClassResource != null) writeRemappedClass(sourceClassResource, jarOutputStream, BOOT_DELEGATED_PACKAGE); } } jarOutputStream.close(); fileOutputStream.close(); return new JarFile(dataFile); }
[ "JarFile", "createBootProxyJar", "(", ")", "throws", "IOException", "{", "File", "dataFile", "=", "bundleContext", ".", "getDataFile", "(", "\"boot-proxy.jar\"", ")", ";", "// Create the file if it doesn't already exist", "if", "(", "!", "dataFile", ".", "exists", "(", ")", ")", "{", "dataFile", ".", "createNewFile", "(", ")", ";", "}", "// Generate a manifest", "Manifest", "manifest", "=", "createBootJarManifest", "(", ")", ";", "// Create the file", "FileOutputStream", "fileOutputStream", "=", "new", "FileOutputStream", "(", "dataFile", ",", "false", ")", ";", "JarOutputStream", "jarOutputStream", "=", "new", "JarOutputStream", "(", "fileOutputStream", ",", "manifest", ")", ";", "// Add the jar path entries to reduce class load times", "createDirectoryEntries", "(", "jarOutputStream", ",", "BOOT_DELEGATED_PACKAGE", ")", ";", "// Map the template classes into the delegation package and add to the jar", "Bundle", "bundle", "=", "bundleContext", ".", "getBundle", "(", ")", ";", "Enumeration", "<", "?", ">", "entryPaths", "=", "bundle", ".", "getEntryPaths", "(", "TEMPLATE_CLASSES_PATH", ")", ";", "if", "(", "entryPaths", "!=", "null", ")", "{", "while", "(", "entryPaths", ".", "hasMoreElements", "(", ")", ")", "{", "URL", "sourceClassResource", "=", "bundle", ".", "getEntry", "(", "(", "String", ")", "entryPaths", ".", "nextElement", "(", ")", ")", ";", "if", "(", "sourceClassResource", "!=", "null", ")", "writeRemappedClass", "(", "sourceClassResource", ",", "jarOutputStream", ",", "BOOT_DELEGATED_PACKAGE", ")", ";", "}", "}", "jarOutputStream", ".", "close", "(", ")", ";", "fileOutputStream", ".", "close", "(", ")", ";", "return", "new", "JarFile", "(", "dataFile", ")", ";", "}" ]
Create a jar file that contains the proxy code that will live in the boot delegation package. @return the jar file containing the proxy code to append to the boot class path @throws IOException if a file I/O error occurs
[ "Create", "a", "jar", "file", "that", "contains", "the", "proxy", "code", "that", "will", "live", "in", "the", "boot", "delegation", "package", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java#L228-L261
patka/cassandra-migration
cassandra-migration/src/main/java/org/cognitor/cassandra/migration/scanner/FileSystemLocationScanner.java
FileSystemLocationScanner.findResourceNames
public Set<String> findResourceNames(String location, URI locationUri) throws IOException { """ Scans a path on the filesystem for resources inside the given classpath location. @param location The system-independent location on the classpath. @param locationUri The system-specific physical location URI. @return a sorted set containing all the resources inside the given location @throws IOException if an error accessing the filesystem happens """ String filePath = toFilePath(locationUri); File folder = new File(filePath); if (!folder.isDirectory()) { LOGGER.debug("Skipping path as it is not a directory: " + filePath); return new TreeSet<>(); } String classPathRootOnDisk = filePath.substring(0, filePath.length() - location.length()); if (!classPathRootOnDisk.endsWith(File.separator)) { classPathRootOnDisk = classPathRootOnDisk + File.separator; } LOGGER.debug("Scanning starting at classpath root in filesystem: " + classPathRootOnDisk); return findResourceNamesFromFileSystem(classPathRootOnDisk, location, folder); }
java
public Set<String> findResourceNames(String location, URI locationUri) throws IOException { String filePath = toFilePath(locationUri); File folder = new File(filePath); if (!folder.isDirectory()) { LOGGER.debug("Skipping path as it is not a directory: " + filePath); return new TreeSet<>(); } String classPathRootOnDisk = filePath.substring(0, filePath.length() - location.length()); if (!classPathRootOnDisk.endsWith(File.separator)) { classPathRootOnDisk = classPathRootOnDisk + File.separator; } LOGGER.debug("Scanning starting at classpath root in filesystem: " + classPathRootOnDisk); return findResourceNamesFromFileSystem(classPathRootOnDisk, location, folder); }
[ "public", "Set", "<", "String", ">", "findResourceNames", "(", "String", "location", ",", "URI", "locationUri", ")", "throws", "IOException", "{", "String", "filePath", "=", "toFilePath", "(", "locationUri", ")", ";", "File", "folder", "=", "new", "File", "(", "filePath", ")", ";", "if", "(", "!", "folder", ".", "isDirectory", "(", ")", ")", "{", "LOGGER", ".", "debug", "(", "\"Skipping path as it is not a directory: \"", "+", "filePath", ")", ";", "return", "new", "TreeSet", "<>", "(", ")", ";", "}", "String", "classPathRootOnDisk", "=", "filePath", ".", "substring", "(", "0", ",", "filePath", ".", "length", "(", ")", "-", "location", ".", "length", "(", ")", ")", ";", "if", "(", "!", "classPathRootOnDisk", ".", "endsWith", "(", "File", ".", "separator", ")", ")", "{", "classPathRootOnDisk", "=", "classPathRootOnDisk", "+", "File", ".", "separator", ";", "}", "LOGGER", ".", "debug", "(", "\"Scanning starting at classpath root in filesystem: \"", "+", "classPathRootOnDisk", ")", ";", "return", "findResourceNamesFromFileSystem", "(", "classPathRootOnDisk", ",", "location", ",", "folder", ")", ";", "}" ]
Scans a path on the filesystem for resources inside the given classpath location. @param location The system-independent location on the classpath. @param locationUri The system-specific physical location URI. @return a sorted set containing all the resources inside the given location @throws IOException if an error accessing the filesystem happens
[ "Scans", "a", "path", "on", "the", "filesystem", "for", "resources", "inside", "the", "given", "classpath", "location", "." ]
train
https://github.com/patka/cassandra-migration/blob/c61840c23b17a18df704d136909c26ff46bd5c77/cassandra-migration/src/main/java/org/cognitor/cassandra/migration/scanner/FileSystemLocationScanner.java#L34-L48
headius/invokebinder
src/main/java/com/headius/invokebinder/Binder.java
Binder.from
public static Binder from(Class<?> returnType, Class<?> argType0, Class<?>... argTypes) { """ Construct a new Binder using a return type and argument types. @param returnType the return type of the incoming signature @param argType0 the first argument type of the incoming signature @param argTypes the remaining argument types of the incoming signature @return the Binder object """ return from(MethodType.methodType(returnType, argType0, argTypes)); }
java
public static Binder from(Class<?> returnType, Class<?> argType0, Class<?>... argTypes) { return from(MethodType.methodType(returnType, argType0, argTypes)); }
[ "public", "static", "Binder", "from", "(", "Class", "<", "?", ">", "returnType", ",", "Class", "<", "?", ">", "argType0", ",", "Class", "<", "?", ">", "...", "argTypes", ")", "{", "return", "from", "(", "MethodType", ".", "methodType", "(", "returnType", ",", "argType0", ",", "argTypes", ")", ")", ";", "}" ]
Construct a new Binder using a return type and argument types. @param returnType the return type of the incoming signature @param argType0 the first argument type of the incoming signature @param argTypes the remaining argument types of the incoming signature @return the Binder object
[ "Construct", "a", "new", "Binder", "using", "a", "return", "type", "and", "argument", "types", "." ]
train
https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Binder.java#L228-L230
alkacon/opencms-core
src/org/opencms/relations/CmsCategoryService.java
CmsCategoryService.clearCategoriesForResource
public void clearCategoriesForResource(CmsObject cms, String resourcePath) throws CmsException { """ Removes the given resource from all categories.<p> @param cms the cms context @param resourcePath the resource to reset the categories for @throws CmsException if something goes wrong """ CmsRelationFilter filter = CmsRelationFilter.TARGETS; filter = filter.filterType(CmsRelationType.CATEGORY); cms.deleteRelationsFromResource(resourcePath, filter); }
java
public void clearCategoriesForResource(CmsObject cms, String resourcePath) throws CmsException { CmsRelationFilter filter = CmsRelationFilter.TARGETS; filter = filter.filterType(CmsRelationType.CATEGORY); cms.deleteRelationsFromResource(resourcePath, filter); }
[ "public", "void", "clearCategoriesForResource", "(", "CmsObject", "cms", ",", "String", "resourcePath", ")", "throws", "CmsException", "{", "CmsRelationFilter", "filter", "=", "CmsRelationFilter", ".", "TARGETS", ";", "filter", "=", "filter", ".", "filterType", "(", "CmsRelationType", ".", "CATEGORY", ")", ";", "cms", ".", "deleteRelationsFromResource", "(", "resourcePath", ",", "filter", ")", ";", "}" ]
Removes the given resource from all categories.<p> @param cms the cms context @param resourcePath the resource to reset the categories for @throws CmsException if something goes wrong
[ "Removes", "the", "given", "resource", "from", "all", "categories", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsCategoryService.java#L150-L155
davidmoten/rxjava-jdbc
src/main/java/com/github/davidmoten/rx/jdbc/QueryUpdateOnSubscribe.java
QueryUpdateOnSubscribe.close
private void close(State state) { """ Cancels a running PreparedStatement, closing it and the current Connection but only if auto commit mode. """ // ensure close happens once only to avoid race conditions if (state.closed.compareAndSet(false, true)) { Util.closeQuietly(state.ps); if (isCommit() || isRollback()) Util.closeQuietly(state.con); else Util.closeQuietlyIfAutoCommit(state.con); } }
java
private void close(State state) { // ensure close happens once only to avoid race conditions if (state.closed.compareAndSet(false, true)) { Util.closeQuietly(state.ps); if (isCommit() || isRollback()) Util.closeQuietly(state.con); else Util.closeQuietlyIfAutoCommit(state.con); } }
[ "private", "void", "close", "(", "State", "state", ")", "{", "// ensure close happens once only to avoid race conditions", "if", "(", "state", ".", "closed", ".", "compareAndSet", "(", "false", ",", "true", ")", ")", "{", "Util", ".", "closeQuietly", "(", "state", ".", "ps", ")", ";", "if", "(", "isCommit", "(", ")", "||", "isRollback", "(", ")", ")", "Util", ".", "closeQuietly", "(", "state", ".", "con", ")", ";", "else", "Util", ".", "closeQuietlyIfAutoCommit", "(", "state", ".", "con", ")", ";", "}", "}" ]
Cancels a running PreparedStatement, closing it and the current Connection but only if auto commit mode.
[ "Cancels", "a", "running", "PreparedStatement", "closing", "it", "and", "the", "current", "Connection", "but", "only", "if", "auto", "commit", "mode", "." ]
train
https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/QueryUpdateOnSubscribe.java#L318-L327
google/closure-templates
java/src/com/google/template/soy/pysrc/internal/GenPyCallExprVisitor.java
GenPyCallExprVisitor.visitCallBasicNode
@Override protected PyExpr visitCallBasicNode(CallBasicNode node) { """ Visits basic call nodes and builds the call expression. If the callee is in the file, it can be accessed directly, but if it's in another file, the module name must be prefixed. @param node The basic call node. @return The call Python expression. """ String calleeName = node.getCalleeName(); // Build the Python expr text for the callee. String calleeExprText; TemplateNode template = getTemplateIfInSameFile(node); if (template != null) { // If in the same module no namespace is required. calleeExprText = getLocalTemplateName(template); } else { // If in another module, the module name is required along with the function name. int secondToLastDotIndex = calleeName.lastIndexOf('.', calleeName.lastIndexOf('.') - 1); calleeExprText = calleeName.substring(secondToLastDotIndex + 1); } String callExprText = calleeExprText + "(" + genObjToPass(node) + ", ijData)"; return escapeCall(callExprText, node.getEscapingDirectives()); }
java
@Override protected PyExpr visitCallBasicNode(CallBasicNode node) { String calleeName = node.getCalleeName(); // Build the Python expr text for the callee. String calleeExprText; TemplateNode template = getTemplateIfInSameFile(node); if (template != null) { // If in the same module no namespace is required. calleeExprText = getLocalTemplateName(template); } else { // If in another module, the module name is required along with the function name. int secondToLastDotIndex = calleeName.lastIndexOf('.', calleeName.lastIndexOf('.') - 1); calleeExprText = calleeName.substring(secondToLastDotIndex + 1); } String callExprText = calleeExprText + "(" + genObjToPass(node) + ", ijData)"; return escapeCall(callExprText, node.getEscapingDirectives()); }
[ "@", "Override", "protected", "PyExpr", "visitCallBasicNode", "(", "CallBasicNode", "node", ")", "{", "String", "calleeName", "=", "node", ".", "getCalleeName", "(", ")", ";", "// Build the Python expr text for the callee.", "String", "calleeExprText", ";", "TemplateNode", "template", "=", "getTemplateIfInSameFile", "(", "node", ")", ";", "if", "(", "template", "!=", "null", ")", "{", "// If in the same module no namespace is required.", "calleeExprText", "=", "getLocalTemplateName", "(", "template", ")", ";", "}", "else", "{", "// If in another module, the module name is required along with the function name.", "int", "secondToLastDotIndex", "=", "calleeName", ".", "lastIndexOf", "(", "'", "'", ",", "calleeName", ".", "lastIndexOf", "(", "'", "'", ")", "-", "1", ")", ";", "calleeExprText", "=", "calleeName", ".", "substring", "(", "secondToLastDotIndex", "+", "1", ")", ";", "}", "String", "callExprText", "=", "calleeExprText", "+", "\"(\"", "+", "genObjToPass", "(", "node", ")", "+", "\", ijData)\"", ";", "return", "escapeCall", "(", "callExprText", ",", "node", ".", "getEscapingDirectives", "(", ")", ")", ";", "}" ]
Visits basic call nodes and builds the call expression. If the callee is in the file, it can be accessed directly, but if it's in another file, the module name must be prefixed. @param node The basic call node. @return The call Python expression.
[ "Visits", "basic", "call", "nodes", "and", "builds", "the", "call", "expression", ".", "If", "the", "callee", "is", "in", "the", "file", "it", "can", "be", "accessed", "directly", "but", "if", "it", "s", "in", "another", "file", "the", "module", "name", "must", "be", "prefixed", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/pysrc/internal/GenPyCallExprVisitor.java#L130-L148
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/fastoptics/RandomProjectedNeighborsAndDensities.java
RandomProjectedNeighborsAndDensities.getNeighs
public DataStore<? extends DBIDs> getNeighs() { """ Compute list of neighbors for each point from sets resulting from projection @return list of neighbors for each point """ final DBIDs ids = points.getDBIDs(); // init lists WritableDataStore<ModifiableDBIDs> neighs = DataStoreUtil.makeStorage(ids, DataStoreFactory.HINT_HOT, ModifiableDBIDs.class); for(DBIDIter it = ids.iter(); it.valid(); it.advance()) { neighs.put(it, DBIDUtil.newHashSet()); } FiniteProgress splitp = LOG.isVerbose() ? new FiniteProgress("Processing splits for neighborhoods", splitsets.size(), LOG) : null; // go through all sets Iterator<ArrayDBIDs> it1 = splitsets.iterator(); DBIDVar v = DBIDUtil.newVar(); while(it1.hasNext()) { ArrayDBIDs pinSet = it1.next(); final int indoff = pinSet.size() >> 1; // middle point of projection pinSet.assignVar(indoff, v); // add all points as neighbors to middle point neighs.get(v).addDBIDs(pinSet); // and the the middle point to all other points in set for(DBIDIter it = pinSet.iter(); it.valid(); it.advance()) { neighs.get(it).add(v); } LOG.incrementProcessed(splitp); } LOG.ensureCompleted(splitp); return neighs; }
java
public DataStore<? extends DBIDs> getNeighs() { final DBIDs ids = points.getDBIDs(); // init lists WritableDataStore<ModifiableDBIDs> neighs = DataStoreUtil.makeStorage(ids, DataStoreFactory.HINT_HOT, ModifiableDBIDs.class); for(DBIDIter it = ids.iter(); it.valid(); it.advance()) { neighs.put(it, DBIDUtil.newHashSet()); } FiniteProgress splitp = LOG.isVerbose() ? new FiniteProgress("Processing splits for neighborhoods", splitsets.size(), LOG) : null; // go through all sets Iterator<ArrayDBIDs> it1 = splitsets.iterator(); DBIDVar v = DBIDUtil.newVar(); while(it1.hasNext()) { ArrayDBIDs pinSet = it1.next(); final int indoff = pinSet.size() >> 1; // middle point of projection pinSet.assignVar(indoff, v); // add all points as neighbors to middle point neighs.get(v).addDBIDs(pinSet); // and the the middle point to all other points in set for(DBIDIter it = pinSet.iter(); it.valid(); it.advance()) { neighs.get(it).add(v); } LOG.incrementProcessed(splitp); } LOG.ensureCompleted(splitp); return neighs; }
[ "public", "DataStore", "<", "?", "extends", "DBIDs", ">", "getNeighs", "(", ")", "{", "final", "DBIDs", "ids", "=", "points", ".", "getDBIDs", "(", ")", ";", "// init lists", "WritableDataStore", "<", "ModifiableDBIDs", ">", "neighs", "=", "DataStoreUtil", ".", "makeStorage", "(", "ids", ",", "DataStoreFactory", ".", "HINT_HOT", ",", "ModifiableDBIDs", ".", "class", ")", ";", "for", "(", "DBIDIter", "it", "=", "ids", ".", "iter", "(", ")", ";", "it", ".", "valid", "(", ")", ";", "it", ".", "advance", "(", ")", ")", "{", "neighs", ".", "put", "(", "it", ",", "DBIDUtil", ".", "newHashSet", "(", ")", ")", ";", "}", "FiniteProgress", "splitp", "=", "LOG", ".", "isVerbose", "(", ")", "?", "new", "FiniteProgress", "(", "\"Processing splits for neighborhoods\"", ",", "splitsets", ".", "size", "(", ")", ",", "LOG", ")", ":", "null", ";", "// go through all sets", "Iterator", "<", "ArrayDBIDs", ">", "it1", "=", "splitsets", ".", "iterator", "(", ")", ";", "DBIDVar", "v", "=", "DBIDUtil", ".", "newVar", "(", ")", ";", "while", "(", "it1", ".", "hasNext", "(", ")", ")", "{", "ArrayDBIDs", "pinSet", "=", "it1", ".", "next", "(", ")", ";", "final", "int", "indoff", "=", "pinSet", ".", "size", "(", ")", ">>", "1", ";", "// middle point of projection", "pinSet", ".", "assignVar", "(", "indoff", ",", "v", ")", ";", "// add all points as neighbors to middle point", "neighs", ".", "get", "(", "v", ")", ".", "addDBIDs", "(", "pinSet", ")", ";", "// and the the middle point to all other points in set", "for", "(", "DBIDIter", "it", "=", "pinSet", ".", "iter", "(", ")", ";", "it", ".", "valid", "(", ")", ";", "it", ".", "advance", "(", ")", ")", "{", "neighs", ".", "get", "(", "it", ")", ".", "add", "(", "v", ")", ";", "}", "LOG", ".", "incrementProcessed", "(", "splitp", ")", ";", "}", "LOG", ".", "ensureCompleted", "(", "splitp", ")", ";", "return", "neighs", ";", "}" ]
Compute list of neighbors for each point from sets resulting from projection @return list of neighbors for each point
[ "Compute", "list", "of", "neighbors", "for", "each", "point", "from", "sets", "resulting", "from", "projection" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/fastoptics/RandomProjectedNeighborsAndDensities.java#L371-L399
liferay/com-liferay-commerce
commerce-price-list-api/src/main/java/com/liferay/commerce/price/list/service/persistence/CommercePriceEntryUtil.java
CommercePriceEntryUtil.findByUUID_G
public static CommercePriceEntry findByUUID_G(String uuid, long groupId) throws com.liferay.commerce.price.list.exception.NoSuchPriceEntryException { """ Returns the commerce price entry where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchPriceEntryException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching commerce price entry @throws NoSuchPriceEntryException if a matching commerce price entry could not be found """ return getPersistence().findByUUID_G(uuid, groupId); }
java
public static CommercePriceEntry findByUUID_G(String uuid, long groupId) throws com.liferay.commerce.price.list.exception.NoSuchPriceEntryException { return getPersistence().findByUUID_G(uuid, groupId); }
[ "public", "static", "CommercePriceEntry", "findByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "com", ".", "liferay", ".", "commerce", ".", "price", ".", "list", ".", "exception", ".", "NoSuchPriceEntryException", "{", "return", "getPersistence", "(", ")", ".", "findByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "}" ]
Returns the commerce price entry where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchPriceEntryException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching commerce price entry @throws NoSuchPriceEntryException if a matching commerce price entry could not be found
[ "Returns", "the", "commerce", "price", "entry", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchPriceEntryException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-api/src/main/java/com/liferay/commerce/price/list/service/persistence/CommercePriceEntryUtil.java#L280-L283
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/io/Resource.java
Resource.withDefaultType
public static File withDefaultType( File file, Type defaultType) { """ Returns the given file name, assigning the default type if no type defined. """ return file != null && FilenameUtils.getExtension( file.getName()).isEmpty() ? new File( String.format( "%s.%s", file.getPath(), String.valueOf( defaultType).toLowerCase())) : file; }
java
public static File withDefaultType( File file, Type defaultType) { return file != null && FilenameUtils.getExtension( file.getName()).isEmpty() ? new File( String.format( "%s.%s", file.getPath(), String.valueOf( defaultType).toLowerCase())) : file; }
[ "public", "static", "File", "withDefaultType", "(", "File", "file", ",", "Type", "defaultType", ")", "{", "return", "file", "!=", "null", "&&", "FilenameUtils", ".", "getExtension", "(", "file", ".", "getName", "(", ")", ")", ".", "isEmpty", "(", ")", "?", "new", "File", "(", "String", ".", "format", "(", "\"%s.%s\"", ",", "file", ".", "getPath", "(", ")", ",", "String", ".", "valueOf", "(", "defaultType", ")", ".", "toLowerCase", "(", ")", ")", ")", ":", "file", ";", "}" ]
Returns the given file name, assigning the default type if no type defined.
[ "Returns", "the", "given", "file", "name", "assigning", "the", "default", "type", "if", "no", "type", "defined", "." ]
train
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/io/Resource.java#L176-L182
OwlPlatform/java-owl-worldmodel
src/main/java/com/owlplatform/worldmodel/solver/SolverWorldModelInterface.java
SolverWorldModelInterface.expireId
public boolean expireId(final String identifier, final long expirationTime) { """ Expires all Attributes for an Identifier in the world model. @param identifier the identifier to expire. @param expirationTime the expiration timestamp. @return {@code true} if the message is sent successfully, else {@code false}. """ if (identifier == null) { log.error("Unable to expire a null Identifier value."); return false; } if (this.originString == null) { log.error("Origin has not been set. Cannot expire Ids without a valid origin."); return false; } ExpireIdentifierMessage message = new ExpireIdentifierMessage(); message.setOrigin(this.originString); message.setId(identifier); message.setExpirationTime(expirationTime); this.session.write(message); log.debug("Sent {}", message); return true; }
java
public boolean expireId(final String identifier, final long expirationTime) { if (identifier == null) { log.error("Unable to expire a null Identifier value."); return false; } if (this.originString == null) { log.error("Origin has not been set. Cannot expire Ids without a valid origin."); return false; } ExpireIdentifierMessage message = new ExpireIdentifierMessage(); message.setOrigin(this.originString); message.setId(identifier); message.setExpirationTime(expirationTime); this.session.write(message); log.debug("Sent {}", message); return true; }
[ "public", "boolean", "expireId", "(", "final", "String", "identifier", ",", "final", "long", "expirationTime", ")", "{", "if", "(", "identifier", "==", "null", ")", "{", "log", ".", "error", "(", "\"Unable to expire a null Identifier value.\"", ")", ";", "return", "false", ";", "}", "if", "(", "this", ".", "originString", "==", "null", ")", "{", "log", ".", "error", "(", "\"Origin has not been set. Cannot expire Ids without a valid origin.\"", ")", ";", "return", "false", ";", "}", "ExpireIdentifierMessage", "message", "=", "new", "ExpireIdentifierMessage", "(", ")", ";", "message", ".", "setOrigin", "(", "this", ".", "originString", ")", ";", "message", ".", "setId", "(", "identifier", ")", ";", "message", ".", "setExpirationTime", "(", "expirationTime", ")", ";", "this", ".", "session", ".", "write", "(", "message", ")", ";", "log", ".", "debug", "(", "\"Sent {}\"", ",", "message", ")", ";", "return", "true", ";", "}" ]
Expires all Attributes for an Identifier in the world model. @param identifier the identifier to expire. @param expirationTime the expiration timestamp. @return {@code true} if the message is sent successfully, else {@code false}.
[ "Expires", "all", "Attributes", "for", "an", "Identifier", "in", "the", "world", "model", "." ]
train
https://github.com/OwlPlatform/java-owl-worldmodel/blob/a850e8b930c6e9787c7cad30c0de887858ca563d/src/main/java/com/owlplatform/worldmodel/solver/SolverWorldModelInterface.java#L1005-L1025
joniles/mpxj
src/main/java/net/sf/mpxj/planner/PlannerWriter.java
PlannerWriter.processWorkingHours
private void processWorkingHours(ProjectCalendar mpxjCalendar, Sequence uniqueID, Day day, List<OverriddenDayType> typeList) { """ Process the standard working hours for a given day. @param mpxjCalendar MPXJ Calendar instance @param uniqueID unique ID sequence generation @param day Day instance @param typeList Planner list of days """ if (isWorkingDay(mpxjCalendar, day)) { ProjectCalendarHours mpxjHours = mpxjCalendar.getCalendarHours(day); if (mpxjHours != null) { OverriddenDayType odt = m_factory.createOverriddenDayType(); typeList.add(odt); odt.setId(getIntegerString(uniqueID.next())); List<Interval> intervalList = odt.getInterval(); for (DateRange mpxjRange : mpxjHours) { Date rangeStart = mpxjRange.getStart(); Date rangeEnd = mpxjRange.getEnd(); if (rangeStart != null && rangeEnd != null) { Interval interval = m_factory.createInterval(); intervalList.add(interval); interval.setStart(getTimeString(rangeStart)); interval.setEnd(getTimeString(rangeEnd)); } } } } }
java
private void processWorkingHours(ProjectCalendar mpxjCalendar, Sequence uniqueID, Day day, List<OverriddenDayType> typeList) { if (isWorkingDay(mpxjCalendar, day)) { ProjectCalendarHours mpxjHours = mpxjCalendar.getCalendarHours(day); if (mpxjHours != null) { OverriddenDayType odt = m_factory.createOverriddenDayType(); typeList.add(odt); odt.setId(getIntegerString(uniqueID.next())); List<Interval> intervalList = odt.getInterval(); for (DateRange mpxjRange : mpxjHours) { Date rangeStart = mpxjRange.getStart(); Date rangeEnd = mpxjRange.getEnd(); if (rangeStart != null && rangeEnd != null) { Interval interval = m_factory.createInterval(); intervalList.add(interval); interval.setStart(getTimeString(rangeStart)); interval.setEnd(getTimeString(rangeEnd)); } } } } }
[ "private", "void", "processWorkingHours", "(", "ProjectCalendar", "mpxjCalendar", ",", "Sequence", "uniqueID", ",", "Day", "day", ",", "List", "<", "OverriddenDayType", ">", "typeList", ")", "{", "if", "(", "isWorkingDay", "(", "mpxjCalendar", ",", "day", ")", ")", "{", "ProjectCalendarHours", "mpxjHours", "=", "mpxjCalendar", ".", "getCalendarHours", "(", "day", ")", ";", "if", "(", "mpxjHours", "!=", "null", ")", "{", "OverriddenDayType", "odt", "=", "m_factory", ".", "createOverriddenDayType", "(", ")", ";", "typeList", ".", "add", "(", "odt", ")", ";", "odt", ".", "setId", "(", "getIntegerString", "(", "uniqueID", ".", "next", "(", ")", ")", ")", ";", "List", "<", "Interval", ">", "intervalList", "=", "odt", ".", "getInterval", "(", ")", ";", "for", "(", "DateRange", "mpxjRange", ":", "mpxjHours", ")", "{", "Date", "rangeStart", "=", "mpxjRange", ".", "getStart", "(", ")", ";", "Date", "rangeEnd", "=", "mpxjRange", ".", "getEnd", "(", ")", ";", "if", "(", "rangeStart", "!=", "null", "&&", "rangeEnd", "!=", "null", ")", "{", "Interval", "interval", "=", "m_factory", ".", "createInterval", "(", ")", ";", "intervalList", ".", "add", "(", "interval", ")", ";", "interval", ".", "setStart", "(", "getTimeString", "(", "rangeStart", ")", ")", ";", "interval", ".", "setEnd", "(", "getTimeString", "(", "rangeEnd", ")", ")", ";", "}", "}", "}", "}", "}" ]
Process the standard working hours for a given day. @param mpxjCalendar MPXJ Calendar instance @param uniqueID unique ID sequence generation @param day Day instance @param typeList Planner list of days
[ "Process", "the", "standard", "working", "hours", "for", "a", "given", "day", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/planner/PlannerWriter.java#L295-L321
rterp/GMapsFX
GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/JavascriptRuntime.java
JavascriptRuntime.getConstructor
@Override public String getConstructor(String javascriptObjectType, Object... args) { """ Gets a constructor as a string which then can be passed to the execute(). @param javascriptObjectType The type of JavaScript object to create @param args The args of the constructor @return A string which can be passed to the JavaScript environment to create a new object. """ return getFunction("new " + javascriptObjectType, args); }
java
@Override public String getConstructor(String javascriptObjectType, Object... args) { return getFunction("new " + javascriptObjectType, args); }
[ "@", "Override", "public", "String", "getConstructor", "(", "String", "javascriptObjectType", ",", "Object", "...", "args", ")", "{", "return", "getFunction", "(", "\"new \"", "+", "javascriptObjectType", ",", "args", ")", ";", "}" ]
Gets a constructor as a string which then can be passed to the execute(). @param javascriptObjectType The type of JavaScript object to create @param args The args of the constructor @return A string which can be passed to the JavaScript environment to create a new object.
[ "Gets", "a", "constructor", "as", "a", "string", "which", "then", "can", "be", "passed", "to", "the", "execute", "()", "." ]
train
https://github.com/rterp/GMapsFX/blob/4623d3f768e8ad78fc50ee32dd204d236e01059f/GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/JavascriptRuntime.java#L79-L82
paypal/SeLion
dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/XmlDataProviderImpl.java
XmlDataProviderImpl.getDocument
private Document getDocument() { """ Loads the XML data from the {@link XmlFileSystemResource} into a {@link org.dom4j.Document}. @return A Document object. """ logger.entering(); DOMDocumentFactory domFactory = new DOMDocumentFactory(); SAXReader reader = new SAXReader(domFactory); Document doc; try { doc = reader.read(resource.getInputStream()); } catch (DocumentException excp) { logger.exiting(excp.getMessage()); throw new DataProviderException("Error reading XML data.", excp); } logger.exiting(doc.asXML()); return doc; }
java
private Document getDocument() { logger.entering(); DOMDocumentFactory domFactory = new DOMDocumentFactory(); SAXReader reader = new SAXReader(domFactory); Document doc; try { doc = reader.read(resource.getInputStream()); } catch (DocumentException excp) { logger.exiting(excp.getMessage()); throw new DataProviderException("Error reading XML data.", excp); } logger.exiting(doc.asXML()); return doc; }
[ "private", "Document", "getDocument", "(", ")", "{", "logger", ".", "entering", "(", ")", ";", "DOMDocumentFactory", "domFactory", "=", "new", "DOMDocumentFactory", "(", ")", ";", "SAXReader", "reader", "=", "new", "SAXReader", "(", "domFactory", ")", ";", "Document", "doc", ";", "try", "{", "doc", "=", "reader", ".", "read", "(", "resource", ".", "getInputStream", "(", ")", ")", ";", "}", "catch", "(", "DocumentException", "excp", ")", "{", "logger", ".", "exiting", "(", "excp", ".", "getMessage", "(", ")", ")", ";", "throw", "new", "DataProviderException", "(", "\"Error reading XML data.\"", ",", "excp", ")", ";", "}", "logger", ".", "exiting", "(", "doc", ".", "asXML", "(", ")", ")", ";", "return", "doc", ";", "}" ]
Loads the XML data from the {@link XmlFileSystemResource} into a {@link org.dom4j.Document}. @return A Document object.
[ "Loads", "the", "XML", "data", "from", "the", "{", "@link", "XmlFileSystemResource", "}", "into", "a", "{", "@link", "org", ".", "dom4j", ".", "Document", "}", "." ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/XmlDataProviderImpl.java#L398-L413
jamesdbloom/mockserver
mockserver-core/src/main/java/org/mockserver/model/HttpResponse.java
HttpResponse.withBody
public HttpResponse withBody(String body, Charset charset) { """ Set response body to return a string response body with the specified encoding. <b>Note:</b> The character set of the response will be forced to the specified charset, even if the Content-Type header specifies otherwise. @param body a string @param charset character set the string will be encoded in """ if (body != null) { this.body = new StringBody(body, charset); } return this; }
java
public HttpResponse withBody(String body, Charset charset) { if (body != null) { this.body = new StringBody(body, charset); } return this; }
[ "public", "HttpResponse", "withBody", "(", "String", "body", ",", "Charset", "charset", ")", "{", "if", "(", "body", "!=", "null", ")", "{", "this", ".", "body", "=", "new", "StringBody", "(", "body", ",", "charset", ")", ";", "}", "return", "this", ";", "}" ]
Set response body to return a string response body with the specified encoding. <b>Note:</b> The character set of the response will be forced to the specified charset, even if the Content-Type header specifies otherwise. @param body a string @param charset character set the string will be encoded in
[ "Set", "response", "body", "to", "return", "a", "string", "response", "body", "with", "the", "specified", "encoding", ".", "<b", ">", "Note", ":", "<", "/", "b", ">", "The", "character", "set", "of", "the", "response", "will", "be", "forced", "to", "the", "specified", "charset", "even", "if", "the", "Content", "-", "Type", "header", "specifies", "otherwise", "." ]
train
https://github.com/jamesdbloom/mockserver/blob/8b84fdd877e57b4eb780c9f8c8b1d65bcb448025/mockserver-core/src/main/java/org/mockserver/model/HttpResponse.java#L100-L105
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/html/inliner/impl/jsoup/ImageInlineUtils.java
ImageInlineUtils.isInlineModeAllowed
public static boolean isInlineModeAllowed(Element img, InlineMode mode) { """ Checks if inlining mode is allowed on the provided element. @param img the image element to check if the actual inlining mode is allowed @param mode the actual mode @return true if this mode is allowed, false otherwise """ // if already inlined => reject (do not inline twice) if (!img.attr(INLINED_ATTR).isEmpty()) { return false; } // if inline mode defined but not the wanted mode => reject if (!img.attr(INLINE_MODE_ATTR).isEmpty() && !img.attr(INLINE_MODE_ATTR).equals(mode.mode())) { return false; } // if inline mode defined and matches the wanted mode => allow // if no inline mode defined => allow (any mode allowed) return true; }
java
public static boolean isInlineModeAllowed(Element img, InlineMode mode) { // if already inlined => reject (do not inline twice) if (!img.attr(INLINED_ATTR).isEmpty()) { return false; } // if inline mode defined but not the wanted mode => reject if (!img.attr(INLINE_MODE_ATTR).isEmpty() && !img.attr(INLINE_MODE_ATTR).equals(mode.mode())) { return false; } // if inline mode defined and matches the wanted mode => allow // if no inline mode defined => allow (any mode allowed) return true; }
[ "public", "static", "boolean", "isInlineModeAllowed", "(", "Element", "img", ",", "InlineMode", "mode", ")", "{", "// if already inlined => reject (do not inline twice)", "if", "(", "!", "img", ".", "attr", "(", "INLINED_ATTR", ")", ".", "isEmpty", "(", ")", ")", "{", "return", "false", ";", "}", "// if inline mode defined but not the wanted mode => reject", "if", "(", "!", "img", ".", "attr", "(", "INLINE_MODE_ATTR", ")", ".", "isEmpty", "(", ")", "&&", "!", "img", ".", "attr", "(", "INLINE_MODE_ATTR", ")", ".", "equals", "(", "mode", ".", "mode", "(", ")", ")", ")", "{", "return", "false", ";", "}", "// if inline mode defined and matches the wanted mode => allow", "// if no inline mode defined => allow (any mode allowed)", "return", "true", ";", "}" ]
Checks if inlining mode is allowed on the provided element. @param img the image element to check if the actual inlining mode is allowed @param mode the actual mode @return true if this mode is allowed, false otherwise
[ "Checks", "if", "inlining", "mode", "is", "allowed", "on", "the", "provided", "element", "." ]
train
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/html/inliner/impl/jsoup/ImageInlineUtils.java#L31-L43
signalapp/libsignal-service-java
java/src/main/java/org/whispersystems/signalservice/api/SignalServiceMessageReceiver.java
SignalServiceMessageReceiver.retrieveAttachment
public InputStream retrieveAttachment(SignalServiceAttachmentPointer pointer, File destination, int maxSizeBytes) throws IOException, InvalidMessageException { """ Retrieves a SignalServiceAttachment. @param pointer The {@link SignalServiceAttachmentPointer} received in a {@link SignalServiceDataMessage}. @param destination The download destination for this attachment. @return An InputStream that streams the plaintext attachment contents. @throws IOException @throws InvalidMessageException """ return retrieveAttachment(pointer, destination, maxSizeBytes, null); }
java
public InputStream retrieveAttachment(SignalServiceAttachmentPointer pointer, File destination, int maxSizeBytes) throws IOException, InvalidMessageException { return retrieveAttachment(pointer, destination, maxSizeBytes, null); }
[ "public", "InputStream", "retrieveAttachment", "(", "SignalServiceAttachmentPointer", "pointer", ",", "File", "destination", ",", "int", "maxSizeBytes", ")", "throws", "IOException", ",", "InvalidMessageException", "{", "return", "retrieveAttachment", "(", "pointer", ",", "destination", ",", "maxSizeBytes", ",", "null", ")", ";", "}" ]
Retrieves a SignalServiceAttachment. @param pointer The {@link SignalServiceAttachmentPointer} received in a {@link SignalServiceDataMessage}. @param destination The download destination for this attachment. @return An InputStream that streams the plaintext attachment contents. @throws IOException @throws InvalidMessageException
[ "Retrieves", "a", "SignalServiceAttachment", "." ]
train
https://github.com/signalapp/libsignal-service-java/blob/64f1150c5e4062d67d31c9a2a9c3a0237d022902/java/src/main/java/org/whispersystems/signalservice/api/SignalServiceMessageReceiver.java#L99-L103
junit-team/junit4
src/main/java/org/junit/internal/ComparisonCriteria.java
ComparisonCriteria.arrayEquals
public void arrayEquals(String message, Object expecteds, Object actuals) throws ArrayComparisonFailure { """ Asserts that two arrays are equal, according to the criteria defined by the concrete subclass. If they are not, an {@link AssertionError} is thrown with the given message. If <code>expecteds</code> and <code>actuals</code> are <code>null</code>, they are considered equal. @param message the identifying message for the {@link AssertionError} ( <code>null</code> okay) @param expecteds Object array or array of arrays (multi-dimensional array) with expected values. @param actuals Object array or array of arrays (multi-dimensional array) with actual values """ arrayEquals(message, expecteds, actuals, true); }
java
public void arrayEquals(String message, Object expecteds, Object actuals) throws ArrayComparisonFailure { arrayEquals(message, expecteds, actuals, true); }
[ "public", "void", "arrayEquals", "(", "String", "message", ",", "Object", "expecteds", ",", "Object", "actuals", ")", "throws", "ArrayComparisonFailure", "{", "arrayEquals", "(", "message", ",", "expecteds", ",", "actuals", ",", "true", ")", ";", "}" ]
Asserts that two arrays are equal, according to the criteria defined by the concrete subclass. If they are not, an {@link AssertionError} is thrown with the given message. If <code>expecteds</code> and <code>actuals</code> are <code>null</code>, they are considered equal. @param message the identifying message for the {@link AssertionError} ( <code>null</code> okay) @param expecteds Object array or array of arrays (multi-dimensional array) with expected values. @param actuals Object array or array of arrays (multi-dimensional array) with actual values
[ "Asserts", "that", "two", "arrays", "are", "equal", "according", "to", "the", "criteria", "defined", "by", "the", "concrete", "subclass", ".", "If", "they", "are", "not", "an", "{", "@link", "AssertionError", "}", "is", "thrown", "with", "the", "given", "message", ".", "If", "<code", ">", "expecteds<", "/", "code", ">", "and", "<code", ">", "actuals<", "/", "code", ">", "are", "<code", ">", "null<", "/", "code", ">", "they", "are", "considered", "equal", "." ]
train
https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/internal/ComparisonCriteria.java#L26-L29
Ordinastie/MalisisCore
src/main/java/net/malisis/core/client/gui/render/GuiRenderer.java
GuiRenderer.drawRectangle
public void drawRectangle(int x, int y, int z, int width, int height, int color, int alpha) { """ Draws an non-textured rectangle in the GUI at a position relative to {@link #currentComponent}. @param x the x @param y the y @param z the z @param width the width @param height the height @param color the color @param alpha the alpha """ drawRectangle(x, y, z, width, height, color, alpha, true); }
java
public void drawRectangle(int x, int y, int z, int width, int height, int color, int alpha) { drawRectangle(x, y, z, width, height, color, alpha, true); }
[ "public", "void", "drawRectangle", "(", "int", "x", ",", "int", "y", ",", "int", "z", ",", "int", "width", ",", "int", "height", ",", "int", "color", ",", "int", "alpha", ")", "{", "drawRectangle", "(", "x", ",", "y", ",", "z", ",", "width", ",", "height", ",", "color", ",", "alpha", ",", "true", ")", ";", "}" ]
Draws an non-textured rectangle in the GUI at a position relative to {@link #currentComponent}. @param x the x @param y the y @param z the z @param width the width @param height the height @param color the color @param alpha the alpha
[ "Draws", "an", "non", "-", "textured", "rectangle", "in", "the", "GUI", "at", "a", "position", "relative", "to", "{", "@link", "#currentComponent", "}", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/client/gui/render/GuiRenderer.java#L312-L315
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.saas_csp2_new_duration_GET
public OvhOrder saas_csp2_new_duration_GET(String duration, String giftCode, Long officeBusinessQuantity, Long officeProPlusQuantity) throws IOException { """ Get prices and contracts information REST: GET /order/saas/csp2/new/{duration} @param giftCode [required] Gift code for office license @param officeProPlusQuantity [required] Number of prepaid office pro plus license @param officeBusinessQuantity [required] Number of prepaid office business license @param duration [required] Duration """ String qPath = "/order/saas/csp2/new/{duration}"; StringBuilder sb = path(qPath, duration); query(sb, "giftCode", giftCode); query(sb, "officeBusinessQuantity", officeBusinessQuantity); query(sb, "officeProPlusQuantity", officeProPlusQuantity); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder saas_csp2_new_duration_GET(String duration, String giftCode, Long officeBusinessQuantity, Long officeProPlusQuantity) throws IOException { String qPath = "/order/saas/csp2/new/{duration}"; StringBuilder sb = path(qPath, duration); query(sb, "giftCode", giftCode); query(sb, "officeBusinessQuantity", officeBusinessQuantity); query(sb, "officeProPlusQuantity", officeProPlusQuantity); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "saas_csp2_new_duration_GET", "(", "String", "duration", ",", "String", "giftCode", ",", "Long", "officeBusinessQuantity", ",", "Long", "officeProPlusQuantity", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/saas/csp2/new/{duration}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "duration", ")", ";", "query", "(", "sb", ",", "\"giftCode\"", ",", "giftCode", ")", ";", "query", "(", "sb", ",", "\"officeBusinessQuantity\"", ",", "officeBusinessQuantity", ")", ";", "query", "(", "sb", ",", "\"officeProPlusQuantity\"", ",", "officeProPlusQuantity", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOrder", ".", "class", ")", ";", "}" ]
Get prices and contracts information REST: GET /order/saas/csp2/new/{duration} @param giftCode [required] Gift code for office license @param officeProPlusQuantity [required] Number of prepaid office pro plus license @param officeBusinessQuantity [required] Number of prepaid office business license @param duration [required] Duration
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L4173-L4181
JodaOrg/joda-money
src/main/java/org/joda/money/format/MoneyFormatterBuilder.java
MoneyFormatterBuilder.appendLiteral
public MoneyFormatterBuilder appendLiteral(CharSequence literal) { """ Appends a literal to the builder. <p> The localized currency symbol is the symbol as chosen by the locale of the formatter. @param literal the literal to append, null or empty ignored @return this, for chaining, never null """ if (literal == null || literal.length() == 0) { return this; } LiteralPrinterParser pp = new LiteralPrinterParser(literal.toString()); return appendInternal(pp, pp); }
java
public MoneyFormatterBuilder appendLiteral(CharSequence literal) { if (literal == null || literal.length() == 0) { return this; } LiteralPrinterParser pp = new LiteralPrinterParser(literal.toString()); return appendInternal(pp, pp); }
[ "public", "MoneyFormatterBuilder", "appendLiteral", "(", "CharSequence", "literal", ")", "{", "if", "(", "literal", "==", "null", "||", "literal", ".", "length", "(", ")", "==", "0", ")", "{", "return", "this", ";", "}", "LiteralPrinterParser", "pp", "=", "new", "LiteralPrinterParser", "(", "literal", ".", "toString", "(", ")", ")", ";", "return", "appendInternal", "(", "pp", ",", "pp", ")", ";", "}" ]
Appends a literal to the builder. <p> The localized currency symbol is the symbol as chosen by the locale of the formatter. @param literal the literal to append, null or empty ignored @return this, for chaining, never null
[ "Appends", "a", "literal", "to", "the", "builder", ".", "<p", ">", "The", "localized", "currency", "symbol", "is", "the", "symbol", "as", "chosen", "by", "the", "locale", "of", "the", "formatter", "." ]
train
https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/format/MoneyFormatterBuilder.java#L156-L162
micronaut-projects/micronaut-core
http-server/src/main/java/io/micronaut/http/server/cors/CorsFilter.java
CorsFilter.handleResponse
protected void handleResponse(HttpRequest<?> request, MutableHttpResponse<?> response) { """ Handles a CORS response. @param request The {@link HttpRequest} object @param response The {@link MutableHttpResponse} object """ HttpHeaders headers = request.getHeaders(); Optional<String> originHeader = headers.getOrigin(); originHeader.ifPresent(requestOrigin -> { Optional<CorsOriginConfiguration> optionalConfig = getConfiguration(requestOrigin); if (optionalConfig.isPresent()) { CorsOriginConfiguration config = optionalConfig.get(); if (CorsUtil.isPreflightRequest(request)) { Optional<HttpMethod> result = headers.getFirst(ACCESS_CONTROL_REQUEST_METHOD, HttpMethod.class); setAllowMethods(result.get(), response); Argument<List> type = Argument.of(List.class, String.class); Optional<List> allowedHeaders = headers.get(ACCESS_CONTROL_REQUEST_HEADERS, type); allowedHeaders.ifPresent(val -> setAllowHeaders(val, response) ); setMaxAge(config.getMaxAge(), response); } setOrigin(requestOrigin, response); setVary(response); setExposeHeaders(config.getExposedHeaders(), response); setAllowCredentials(config, response); } }); }
java
protected void handleResponse(HttpRequest<?> request, MutableHttpResponse<?> response) { HttpHeaders headers = request.getHeaders(); Optional<String> originHeader = headers.getOrigin(); originHeader.ifPresent(requestOrigin -> { Optional<CorsOriginConfiguration> optionalConfig = getConfiguration(requestOrigin); if (optionalConfig.isPresent()) { CorsOriginConfiguration config = optionalConfig.get(); if (CorsUtil.isPreflightRequest(request)) { Optional<HttpMethod> result = headers.getFirst(ACCESS_CONTROL_REQUEST_METHOD, HttpMethod.class); setAllowMethods(result.get(), response); Argument<List> type = Argument.of(List.class, String.class); Optional<List> allowedHeaders = headers.get(ACCESS_CONTROL_REQUEST_HEADERS, type); allowedHeaders.ifPresent(val -> setAllowHeaders(val, response) ); setMaxAge(config.getMaxAge(), response); } setOrigin(requestOrigin, response); setVary(response); setExposeHeaders(config.getExposedHeaders(), response); setAllowCredentials(config, response); } }); }
[ "protected", "void", "handleResponse", "(", "HttpRequest", "<", "?", ">", "request", ",", "MutableHttpResponse", "<", "?", ">", "response", ")", "{", "HttpHeaders", "headers", "=", "request", ".", "getHeaders", "(", ")", ";", "Optional", "<", "String", ">", "originHeader", "=", "headers", ".", "getOrigin", "(", ")", ";", "originHeader", ".", "ifPresent", "(", "requestOrigin", "->", "{", "Optional", "<", "CorsOriginConfiguration", ">", "optionalConfig", "=", "getConfiguration", "(", "requestOrigin", ")", ";", "if", "(", "optionalConfig", ".", "isPresent", "(", ")", ")", "{", "CorsOriginConfiguration", "config", "=", "optionalConfig", ".", "get", "(", ")", ";", "if", "(", "CorsUtil", ".", "isPreflightRequest", "(", "request", ")", ")", "{", "Optional", "<", "HttpMethod", ">", "result", "=", "headers", ".", "getFirst", "(", "ACCESS_CONTROL_REQUEST_METHOD", ",", "HttpMethod", ".", "class", ")", ";", "setAllowMethods", "(", "result", ".", "get", "(", ")", ",", "response", ")", ";", "Argument", "<", "List", ">", "type", "=", "Argument", ".", "of", "(", "List", ".", "class", ",", "String", ".", "class", ")", ";", "Optional", "<", "List", ">", "allowedHeaders", "=", "headers", ".", "get", "(", "ACCESS_CONTROL_REQUEST_HEADERS", ",", "type", ")", ";", "allowedHeaders", ".", "ifPresent", "(", "val", "->", "setAllowHeaders", "(", "val", ",", "response", ")", ")", ";", "setMaxAge", "(", "config", ".", "getMaxAge", "(", ")", ",", "response", ")", ";", "}", "setOrigin", "(", "requestOrigin", ",", "response", ")", ";", "setVary", "(", "response", ")", ";", "setExposeHeaders", "(", "config", ".", "getExposedHeaders", "(", ")", ",", "response", ")", ";", "setAllowCredentials", "(", "config", ",", "response", ")", ";", "}", "}", ")", ";", "}" ]
Handles a CORS response. @param request The {@link HttpRequest} object @param response The {@link MutableHttpResponse} object
[ "Handles", "a", "CORS", "response", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/http-server/src/main/java/io/micronaut/http/server/cors/CorsFilter.java#L98-L126
googleapis/google-cloud-java
google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/MetricsClient.java
MetricsClient.updateLogMetric
public final LogMetric updateLogMetric(String metricName, LogMetric metric) { """ Creates or updates a logs-based metric. <p>Sample code: <pre><code> try (MetricsClient metricsClient = MetricsClient.create()) { MetricName metricName = ProjectMetricName.of("[PROJECT]", "[METRIC]"); LogMetric metric = LogMetric.newBuilder().build(); LogMetric response = metricsClient.updateLogMetric(metricName.toString(), metric); } </code></pre> @param metricName The resource name of the metric to update: <p>"projects/[PROJECT_ID]/metrics/[METRIC_ID]" <p>The updated metric must be provided in the request and it's `name` field must be the same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is created. @param metric The updated metric. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ UpdateLogMetricRequest request = UpdateLogMetricRequest.newBuilder().setMetricName(metricName).setMetric(metric).build(); return updateLogMetric(request); }
java
public final LogMetric updateLogMetric(String metricName, LogMetric metric) { UpdateLogMetricRequest request = UpdateLogMetricRequest.newBuilder().setMetricName(metricName).setMetric(metric).build(); return updateLogMetric(request); }
[ "public", "final", "LogMetric", "updateLogMetric", "(", "String", "metricName", ",", "LogMetric", "metric", ")", "{", "UpdateLogMetricRequest", "request", "=", "UpdateLogMetricRequest", ".", "newBuilder", "(", ")", ".", "setMetricName", "(", "metricName", ")", ".", "setMetric", "(", "metric", ")", ".", "build", "(", ")", ";", "return", "updateLogMetric", "(", "request", ")", ";", "}" ]
Creates or updates a logs-based metric. <p>Sample code: <pre><code> try (MetricsClient metricsClient = MetricsClient.create()) { MetricName metricName = ProjectMetricName.of("[PROJECT]", "[METRIC]"); LogMetric metric = LogMetric.newBuilder().build(); LogMetric response = metricsClient.updateLogMetric(metricName.toString(), metric); } </code></pre> @param metricName The resource name of the metric to update: <p>"projects/[PROJECT_ID]/metrics/[METRIC_ID]" <p>The updated metric must be provided in the request and it's `name` field must be the same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is created. @param metric The updated metric. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "or", "updates", "a", "logs", "-", "based", "metric", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/MetricsClient.java#L552-L557
phax/ph-oton
ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/typeahead/TypeaheadDatum.java
TypeaheadDatum.createWithID
@Nonnull public static TypeaheadDatum createWithID (@Nonnull final String sValue, @Nullable final String sID) { """ Create a new TypeaheadDatum with a text and an ID using {@link #getTokensFromValue(String)} to tokenize the string. @param sValue Value to display. Must not be <code>null</code>. @param sID Optional ID of the element. May be <code>null</code>. @return New {@link TypeaheadDatum}. """ return new TypeaheadDatum (sValue, getTokensFromValue (sValue), sID); }
java
@Nonnull public static TypeaheadDatum createWithID (@Nonnull final String sValue, @Nullable final String sID) { return new TypeaheadDatum (sValue, getTokensFromValue (sValue), sID); }
[ "@", "Nonnull", "public", "static", "TypeaheadDatum", "createWithID", "(", "@", "Nonnull", "final", "String", "sValue", ",", "@", "Nullable", "final", "String", "sID", ")", "{", "return", "new", "TypeaheadDatum", "(", "sValue", ",", "getTokensFromValue", "(", "sValue", ")", ",", "sID", ")", ";", "}" ]
Create a new TypeaheadDatum with a text and an ID using {@link #getTokensFromValue(String)} to tokenize the string. @param sValue Value to display. Must not be <code>null</code>. @param sID Optional ID of the element. May be <code>null</code>. @return New {@link TypeaheadDatum}.
[ "Create", "a", "new", "TypeaheadDatum", "with", "a", "text", "and", "an", "ID", "using", "{", "@link", "#getTokensFromValue", "(", "String", ")", "}", "to", "tokenize", "the", "string", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/typeahead/TypeaheadDatum.java#L208-L212
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/impl/WSJobOperatorImpl.java
WSJobOperatorImpl.createJobInstance
@Override public WSJobInstance createJobInstance(String appName, String jobXMLName, String jsl, String correlationId) { """ @param appName @param jobXMLName @return newly created JobInstance (Note: job instance must be started separately) Note: Inline JSL takes precedence over JSL within .war """ if (authService != null) { authService.authorizedJobSubmission(); } return batchKernelService.createJobInstance(appName, jobXMLName, batchSecurityHelper.getRunAsUser(), jsl, correlationId); }
java
@Override public WSJobInstance createJobInstance(String appName, String jobXMLName, String jsl, String correlationId) { if (authService != null) { authService.authorizedJobSubmission(); } return batchKernelService.createJobInstance(appName, jobXMLName, batchSecurityHelper.getRunAsUser(), jsl, correlationId); }
[ "@", "Override", "public", "WSJobInstance", "createJobInstance", "(", "String", "appName", ",", "String", "jobXMLName", ",", "String", "jsl", ",", "String", "correlationId", ")", "{", "if", "(", "authService", "!=", "null", ")", "{", "authService", ".", "authorizedJobSubmission", "(", ")", ";", "}", "return", "batchKernelService", ".", "createJobInstance", "(", "appName", ",", "jobXMLName", ",", "batchSecurityHelper", ".", "getRunAsUser", "(", ")", ",", "jsl", ",", "correlationId", ")", ";", "}" ]
@param appName @param jobXMLName @return newly created JobInstance (Note: job instance must be started separately) Note: Inline JSL takes precedence over JSL within .war
[ "@param", "appName", "@param", "jobXMLName" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/impl/WSJobOperatorImpl.java#L156-L165
Frostman/dropbox4j
src/main/java/ru/frostman/dropbox/api/DropboxClient.java
DropboxClient.getMetadata
public Entry getMetadata(String path, String hash) { """ Returns metadata information about specified resource with checking for its hash. If nothing changes (hash isn't changed) then 304 will returns. @param path to file or directory @param hash to check smth changed @return metadata of specified resource @see Entry """ return getMetadata(path, FILE_LIMIT, hash, true); }
java
public Entry getMetadata(String path, String hash) { return getMetadata(path, FILE_LIMIT, hash, true); }
[ "public", "Entry", "getMetadata", "(", "String", "path", ",", "String", "hash", ")", "{", "return", "getMetadata", "(", "path", ",", "FILE_LIMIT", ",", "hash", ",", "true", ")", ";", "}" ]
Returns metadata information about specified resource with checking for its hash. If nothing changes (hash isn't changed) then 304 will returns. @param path to file or directory @param hash to check smth changed @return metadata of specified resource @see Entry
[ "Returns", "metadata", "information", "about", "specified", "resource", "with", "checking", "for", "its", "hash", ".", "If", "nothing", "changes", "(", "hash", "isn", "t", "changed", ")", "then", "304", "will", "returns", "." ]
train
https://github.com/Frostman/dropbox4j/blob/774c817e5bf294d0139ecb5ac81399be50ada5e0/src/main/java/ru/frostman/dropbox/api/DropboxClient.java#L133-L135
zaproxy/zaproxy
src/org/parosproxy/paros/view/WorkbenchPanel.java
WorkbenchPanel.removePanels
public void removePanels(List<AbstractPanel> panels, PanelType panelType) { """ Removes the given panels of given panel type from the workbench panel. @param panels the panels to remove from the workbench panel @param panelType the type of the panels @throws IllegalArgumentException if any of the parameters is {@code null}. @since 2.5.0 @see #addPanels(List, PanelType) @see #removePanel(AbstractPanel, PanelType) """ validateNotNull(panels, "panels"); validateNotNull(panelType, "panelType"); removePanels(getTabbedFull(), panels); switch (panelType) { case SELECT: removePanels(getTabbedSelect(), panels); break; case STATUS: removePanels(getTabbedStatus(), panels); break; case WORK: removePanels(getTabbedWork(), panels); break; default: break; } }
java
public void removePanels(List<AbstractPanel> panels, PanelType panelType) { validateNotNull(panels, "panels"); validateNotNull(panelType, "panelType"); removePanels(getTabbedFull(), panels); switch (panelType) { case SELECT: removePanels(getTabbedSelect(), panels); break; case STATUS: removePanels(getTabbedStatus(), panels); break; case WORK: removePanels(getTabbedWork(), panels); break; default: break; } }
[ "public", "void", "removePanels", "(", "List", "<", "AbstractPanel", ">", "panels", ",", "PanelType", "panelType", ")", "{", "validateNotNull", "(", "panels", ",", "\"panels\"", ")", ";", "validateNotNull", "(", "panelType", ",", "\"panelType\"", ")", ";", "removePanels", "(", "getTabbedFull", "(", ")", ",", "panels", ")", ";", "switch", "(", "panelType", ")", "{", "case", "SELECT", ":", "removePanels", "(", "getTabbedSelect", "(", ")", ",", "panels", ")", ";", "break", ";", "case", "STATUS", ":", "removePanels", "(", "getTabbedStatus", "(", ")", ",", "panels", ")", ";", "break", ";", "case", "WORK", ":", "removePanels", "(", "getTabbedWork", "(", ")", ",", "panels", ")", ";", "break", ";", "default", ":", "break", ";", "}", "}" ]
Removes the given panels of given panel type from the workbench panel. @param panels the panels to remove from the workbench panel @param panelType the type of the panels @throws IllegalArgumentException if any of the parameters is {@code null}. @since 2.5.0 @see #addPanels(List, PanelType) @see #removePanel(AbstractPanel, PanelType)
[ "Removes", "the", "given", "panels", "of", "given", "panel", "type", "from", "the", "workbench", "panel", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/WorkbenchPanel.java#L947-L966
facebookarchive/hadoop-20
src/contrib/corona/src/java/org/apache/hadoop/mapred/TrackerStats.java
TrackerStats.getReportUnprotected
private NodeUsageReport getReportUnprotected(String trackerName) { """ Get the usage report for a tracker. @param trackerName The name of the tracker. @return The {@link NodeUsageReport} for the tracker. """ NodeUsageReport usageReport = usageReports.get(trackerName); if (usageReport == null) { usageReport = new NodeUsageReport(trackerName, 0, 0, 0, 0, 0, 0, 0); usageReports.put(trackerName, usageReport); } return usageReport; }
java
private NodeUsageReport getReportUnprotected(String trackerName) { NodeUsageReport usageReport = usageReports.get(trackerName); if (usageReport == null) { usageReport = new NodeUsageReport(trackerName, 0, 0, 0, 0, 0, 0, 0); usageReports.put(trackerName, usageReport); } return usageReport; }
[ "private", "NodeUsageReport", "getReportUnprotected", "(", "String", "trackerName", ")", "{", "NodeUsageReport", "usageReport", "=", "usageReports", ".", "get", "(", "trackerName", ")", ";", "if", "(", "usageReport", "==", "null", ")", "{", "usageReport", "=", "new", "NodeUsageReport", "(", "trackerName", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ")", ";", "usageReports", ".", "put", "(", "trackerName", ",", "usageReport", ")", ";", "}", "return", "usageReport", ";", "}" ]
Get the usage report for a tracker. @param trackerName The name of the tracker. @return The {@link NodeUsageReport} for the tracker.
[ "Get", "the", "usage", "report", "for", "a", "tracker", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/TrackerStats.java#L217-L224
vvakame/JsonPullParser
jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonUtil.java
JsonUtil.putDateList
public static void putDateList(Writer writer, List<Date> values) throws IOException { """ Writes the given value with the given writer. @param writer @param values @throws IOException @author vvakame """ if (values == null) { writer.write("null"); } else { startArray(writer); for (int i = 0; i < values.size(); i++) { put(writer, values.get(i)); if (i != values.size() - 1) { addSeparator(writer); } } endArray(writer); } }
java
public static void putDateList(Writer writer, List<Date> values) throws IOException { if (values == null) { writer.write("null"); } else { startArray(writer); for (int i = 0; i < values.size(); i++) { put(writer, values.get(i)); if (i != values.size() - 1) { addSeparator(writer); } } endArray(writer); } }
[ "public", "static", "void", "putDateList", "(", "Writer", "writer", ",", "List", "<", "Date", ">", "values", ")", "throws", "IOException", "{", "if", "(", "values", "==", "null", ")", "{", "writer", ".", "write", "(", "\"null\"", ")", ";", "}", "else", "{", "startArray", "(", "writer", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "values", ".", "size", "(", ")", ";", "i", "++", ")", "{", "put", "(", "writer", ",", "values", ".", "get", "(", "i", ")", ")", ";", "if", "(", "i", "!=", "values", ".", "size", "(", ")", "-", "1", ")", "{", "addSeparator", "(", "writer", ")", ";", "}", "}", "endArray", "(", "writer", ")", ";", "}", "}" ]
Writes the given value with the given writer. @param writer @param values @throws IOException @author vvakame
[ "Writes", "the", "given", "value", "with", "the", "given", "writer", "." ]
train
https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonUtil.java#L626-L639
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/classifiers/CNFContextClassifier.java
CNFContextClassifier.toCNF
public static String toCNF(INode in, String formula) throws ContextClassifierException { """ Converts the formula into CNF. @param in the owner of the formula @param formula the formula to convert @return formula in CNF form @throws ContextClassifierException ContextClassifierException """ PEParser parser = new PEParser(); CNFTransformer transformer = new CNFTransformer(); String result = formula; if ((formula.contains("&") && formula.contains("|")) || formula.contains("~")) { String tmpFormula = formula; tmpFormula = tmpFormula.trim(); tmpFormula = tmpFormula.replace("&", "AND"); tmpFormula = tmpFormula.replace("|", "OR"); tmpFormula = tmpFormula.replace("~", "NOT"); tmpFormula = "(" + tmpFormula + ")"; if (!tmpFormula.isEmpty()) { tmpFormula = tmpFormula.replace('.', 'P'); Sentence f = (Sentence) parser.parse(tmpFormula); Sentence cnf = transformer.transform(f); tmpFormula = cnf.toString(); tmpFormula = tmpFormula.replace("AND", "&"); tmpFormula = tmpFormula.replace("OR", "|"); tmpFormula = tmpFormula.replace("NOT", "~"); result = tmpFormula.replace('P', '.'); } else { result = tmpFormula; } } return result; }
java
public static String toCNF(INode in, String formula) throws ContextClassifierException { PEParser parser = new PEParser(); CNFTransformer transformer = new CNFTransformer(); String result = formula; if ((formula.contains("&") && formula.contains("|")) || formula.contains("~")) { String tmpFormula = formula; tmpFormula = tmpFormula.trim(); tmpFormula = tmpFormula.replace("&", "AND"); tmpFormula = tmpFormula.replace("|", "OR"); tmpFormula = tmpFormula.replace("~", "NOT"); tmpFormula = "(" + tmpFormula + ")"; if (!tmpFormula.isEmpty()) { tmpFormula = tmpFormula.replace('.', 'P'); Sentence f = (Sentence) parser.parse(tmpFormula); Sentence cnf = transformer.transform(f); tmpFormula = cnf.toString(); tmpFormula = tmpFormula.replace("AND", "&"); tmpFormula = tmpFormula.replace("OR", "|"); tmpFormula = tmpFormula.replace("NOT", "~"); result = tmpFormula.replace('P', '.'); } else { result = tmpFormula; } } return result; }
[ "public", "static", "String", "toCNF", "(", "INode", "in", ",", "String", "formula", ")", "throws", "ContextClassifierException", "{", "PEParser", "parser", "=", "new", "PEParser", "(", ")", ";", "CNFTransformer", "transformer", "=", "new", "CNFTransformer", "(", ")", ";", "String", "result", "=", "formula", ";", "if", "(", "(", "formula", ".", "contains", "(", "\"&\"", ")", "&&", "formula", ".", "contains", "(", "\"|\"", ")", ")", "||", "formula", ".", "contains", "(", "\"~\"", ")", ")", "{", "String", "tmpFormula", "=", "formula", ";", "tmpFormula", "=", "tmpFormula", ".", "trim", "(", ")", ";", "tmpFormula", "=", "tmpFormula", ".", "replace", "(", "\"&\"", ",", "\"AND\"", ")", ";", "tmpFormula", "=", "tmpFormula", ".", "replace", "(", "\"|\"", ",", "\"OR\"", ")", ";", "tmpFormula", "=", "tmpFormula", ".", "replace", "(", "\"~\"", ",", "\"NOT\"", ")", ";", "tmpFormula", "=", "\"(\"", "+", "tmpFormula", "+", "\")\"", ";", "if", "(", "!", "tmpFormula", ".", "isEmpty", "(", ")", ")", "{", "tmpFormula", "=", "tmpFormula", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ";", "Sentence", "f", "=", "(", "Sentence", ")", "parser", ".", "parse", "(", "tmpFormula", ")", ";", "Sentence", "cnf", "=", "transformer", ".", "transform", "(", "f", ")", ";", "tmpFormula", "=", "cnf", ".", "toString", "(", ")", ";", "tmpFormula", "=", "tmpFormula", ".", "replace", "(", "\"AND\"", ",", "\"&\"", ")", ";", "tmpFormula", "=", "tmpFormula", ".", "replace", "(", "\"OR\"", ",", "\"|\"", ")", ";", "tmpFormula", "=", "tmpFormula", ".", "replace", "(", "\"NOT\"", ",", "\"~\"", ")", ";", "result", "=", "tmpFormula", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ";", "}", "else", "{", "result", "=", "tmpFormula", ";", "}", "}", "return", "result", ";", "}" ]
Converts the formula into CNF. @param in the owner of the formula @param formula the formula to convert @return formula in CNF form @throws ContextClassifierException ContextClassifierException
[ "Converts", "the", "formula", "into", "CNF", "." ]
train
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/classifiers/CNFContextClassifier.java#L66-L97