repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectHasSelfImpl_CustomFieldSerializer.java
OWLObjectHasSelfImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectHasSelfImpl instance) throws SerializationException { """ Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful """ deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectHasSelfImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLObjectHasSelfImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", "}" ]
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectHasSelfImpl_CustomFieldSerializer.java#L89-L92
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/Single.java
Single.fromPublisher
@BackpressureSupport(BackpressureKind.UNBOUNDED_IN) @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T> Single<T> fromPublisher(final Publisher<? extends T> publisher) { """ Wraps a specific Publisher into a Single and signals its single element or error. <p>If the source Publisher is empty, a NoSuchElementException is signalled. If the source has more than one element, an IndexOutOfBoundsException is signalled. <p> The {@link Publisher} must follow the <a href="https://github.com/reactive-streams/reactive-streams-jvm#reactive-streams">Reactive-Streams specification</a>. Violating the specification may result in undefined behavior. <p> If possible, use {@link #create(SingleOnSubscribe)} to create a source-like {@code Single} instead. <p> Note that even though {@link Publisher} appears to be a functional interface, it is not recommended to implement it through a lambda as the specification requires state management that is not achievable with a stateless lambda. <p> <img width="640" height="322" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.fromPublisher.png" alt=""> <dl> <dt><b>Backpressure:</b></dt> <dd>The {@code publisher} is consumed in an unbounded fashion but will be cancelled if it produced more than one item.</dd> <dt><b>Scheduler:</b></dt> <dd>{@code fromPublisher} does not operate by default on a particular {@link Scheduler}.</dd> </dl> @param <T> the value type @param publisher the source Publisher instance, not null @return the new Single instance @see #create(SingleOnSubscribe) """ ObjectHelper.requireNonNull(publisher, "publisher is null"); return RxJavaPlugins.onAssembly(new SingleFromPublisher<T>(publisher)); }
java
@BackpressureSupport(BackpressureKind.UNBOUNDED_IN) @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T> Single<T> fromPublisher(final Publisher<? extends T> publisher) { ObjectHelper.requireNonNull(publisher, "publisher is null"); return RxJavaPlugins.onAssembly(new SingleFromPublisher<T>(publisher)); }
[ "@", "BackpressureSupport", "(", "BackpressureKind", ".", "UNBOUNDED_IN", ")", "@", "CheckReturnValue", "@", "SchedulerSupport", "(", "SchedulerSupport", ".", "NONE", ")", "public", "static", "<", "T", ">", "Single", "<", "T", ">", "fromPublisher", "(", "final", "Publisher", "<", "?", "extends", "T", ">", "publisher", ")", "{", "ObjectHelper", ".", "requireNonNull", "(", "publisher", ",", "\"publisher is null\"", ")", ";", "return", "RxJavaPlugins", ".", "onAssembly", "(", "new", "SingleFromPublisher", "<", "T", ">", "(", "publisher", ")", ")", ";", "}" ]
Wraps a specific Publisher into a Single and signals its single element or error. <p>If the source Publisher is empty, a NoSuchElementException is signalled. If the source has more than one element, an IndexOutOfBoundsException is signalled. <p> The {@link Publisher} must follow the <a href="https://github.com/reactive-streams/reactive-streams-jvm#reactive-streams">Reactive-Streams specification</a>. Violating the specification may result in undefined behavior. <p> If possible, use {@link #create(SingleOnSubscribe)} to create a source-like {@code Single} instead. <p> Note that even though {@link Publisher} appears to be a functional interface, it is not recommended to implement it through a lambda as the specification requires state management that is not achievable with a stateless lambda. <p> <img width="640" height="322" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.fromPublisher.png" alt=""> <dl> <dt><b>Backpressure:</b></dt> <dd>The {@code publisher} is consumed in an unbounded fashion but will be cancelled if it produced more than one item.</dd> <dt><b>Scheduler:</b></dt> <dd>{@code fromPublisher} does not operate by default on a particular {@link Scheduler}.</dd> </dl> @param <T> the value type @param publisher the source Publisher instance, not null @return the new Single instance @see #create(SingleOnSubscribe)
[ "Wraps", "a", "specific", "Publisher", "into", "a", "Single", "and", "signals", "its", "single", "element", "or", "error", ".", "<p", ">", "If", "the", "source", "Publisher", "is", "empty", "a", "NoSuchElementException", "is", "signalled", ".", "If", "the", "source", "has", "more", "than", "one", "element", "an", "IndexOutOfBoundsException", "is", "signalled", ".", "<p", ">", "The", "{" ]
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Single.java#L764-L770
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/read/ReadFileExtensions.java
ReadFileExtensions.readFromFile
public static String readFromFile(final File file, final Charset encoding) throws IOException { """ Read from file. @param file the file @param encoding the encoding @return the string @throws IOException Signals that an I/O exception has occurred. """ return inputStream2String(StreamExtensions.getInputStream(file), encoding); }
java
public static String readFromFile(final File file, final Charset encoding) throws IOException { return inputStream2String(StreamExtensions.getInputStream(file), encoding); }
[ "public", "static", "String", "readFromFile", "(", "final", "File", "file", ",", "final", "Charset", "encoding", ")", "throws", "IOException", "{", "return", "inputStream2String", "(", "StreamExtensions", ".", "getInputStream", "(", "file", ")", ",", "encoding", ")", ";", "}" ]
Read from file. @param file the file @param encoding the encoding @return the string @throws IOException Signals that an I/O exception has occurred.
[ "Read", "from", "file", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/read/ReadFileExtensions.java#L184-L187
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.setStorageAccountAsync
public Observable<StorageBundle> setStorageAccountAsync(String vaultBaseUrl, String storageAccountName, String resourceId, String activeKeyName, boolean autoRegenerateKey) { """ Creates or updates a new storage account. This operation requires the storage/set permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @param resourceId Storage account resource id. @param activeKeyName Current active storage account key name. @param autoRegenerateKey whether keyvault should manage the storage account for the user. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the StorageBundle object """ return setStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName, resourceId, activeKeyName, autoRegenerateKey).map(new Func1<ServiceResponse<StorageBundle>, StorageBundle>() { @Override public StorageBundle call(ServiceResponse<StorageBundle> response) { return response.body(); } }); }
java
public Observable<StorageBundle> setStorageAccountAsync(String vaultBaseUrl, String storageAccountName, String resourceId, String activeKeyName, boolean autoRegenerateKey) { return setStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName, resourceId, activeKeyName, autoRegenerateKey).map(new Func1<ServiceResponse<StorageBundle>, StorageBundle>() { @Override public StorageBundle call(ServiceResponse<StorageBundle> response) { return response.body(); } }); }
[ "public", "Observable", "<", "StorageBundle", ">", "setStorageAccountAsync", "(", "String", "vaultBaseUrl", ",", "String", "storageAccountName", ",", "String", "resourceId", ",", "String", "activeKeyName", ",", "boolean", "autoRegenerateKey", ")", "{", "return", "setStorageAccountWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "storageAccountName", ",", "resourceId", ",", "activeKeyName", ",", "autoRegenerateKey", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "StorageBundle", ">", ",", "StorageBundle", ">", "(", ")", "{", "@", "Override", "public", "StorageBundle", "call", "(", "ServiceResponse", "<", "StorageBundle", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates or updates a new storage account. This operation requires the storage/set permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @param resourceId Storage account resource id. @param activeKeyName Current active storage account key name. @param autoRegenerateKey whether keyvault should manage the storage account for the user. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the StorageBundle object
[ "Creates", "or", "updates", "a", "new", "storage", "account", ".", "This", "operation", "requires", "the", "storage", "/", "set", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L9899-L9906
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsInner.java
SyncAgentsInner.generateKey
public SyncAgentKeyPropertiesInner generateKey(String resourceGroupName, String serverName, String syncAgentName) { """ Generates a sync agent key. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server on which the sync agent is hosted. @param syncAgentName The name of the sync agent. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SyncAgentKeyPropertiesInner object if successful. """ return generateKeyWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).toBlocking().single().body(); }
java
public SyncAgentKeyPropertiesInner generateKey(String resourceGroupName, String serverName, String syncAgentName) { return generateKeyWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).toBlocking().single().body(); }
[ "public", "SyncAgentKeyPropertiesInner", "generateKey", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "syncAgentName", ")", "{", "return", "generateKeyWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "syncAgentName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Generates a sync agent key. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server on which the sync agent is hosted. @param syncAgentName The name of the sync agent. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SyncAgentKeyPropertiesInner object if successful.
[ "Generates", "a", "sync", "agent", "key", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsInner.java#L852-L854
JetBrains/xodus
vfs/src/main/java/jetbrains/exodus/vfs/VirtualFileSystem.java
VirtualFileSystem.readFile
public VfsInputStream readFile(@NotNull final Transaction txn, @NotNull final File file) { """ Returns {@linkplain InputStream} to read contents of the specified file from the beginning. @param txn {@linkplain Transaction} instance @param file {@linkplain File} instance @return {@linkplain java.io.InputStream} to read contents of the specified file from the beginning @see #readFile(Transaction, long) @see #readFile(Transaction, File, long) @see #writeFile(Transaction, File) @see #writeFile(Transaction, long) @see #writeFile(Transaction, File, long) @see #writeFile(Transaction, long, long) @see #appendFile(Transaction, File) @see #touchFile(Transaction, File) """ return new VfsInputStream(this, txn, file.getDescriptor()); }
java
public VfsInputStream readFile(@NotNull final Transaction txn, @NotNull final File file) { return new VfsInputStream(this, txn, file.getDescriptor()); }
[ "public", "VfsInputStream", "readFile", "(", "@", "NotNull", "final", "Transaction", "txn", ",", "@", "NotNull", "final", "File", "file", ")", "{", "return", "new", "VfsInputStream", "(", "this", ",", "txn", ",", "file", ".", "getDescriptor", "(", ")", ")", ";", "}" ]
Returns {@linkplain InputStream} to read contents of the specified file from the beginning. @param txn {@linkplain Transaction} instance @param file {@linkplain File} instance @return {@linkplain java.io.InputStream} to read contents of the specified file from the beginning @see #readFile(Transaction, long) @see #readFile(Transaction, File, long) @see #writeFile(Transaction, File) @see #writeFile(Transaction, long) @see #writeFile(Transaction, File, long) @see #writeFile(Transaction, long, long) @see #appendFile(Transaction, File) @see #touchFile(Transaction, File)
[ "Returns", "{", "@linkplain", "InputStream", "}", "to", "read", "contents", "of", "the", "specified", "file", "from", "the", "beginning", "." ]
train
https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/vfs/src/main/java/jetbrains/exodus/vfs/VirtualFileSystem.java#L412-L414
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/shp/SHPWrite.java
SHPWrite.exportTable
public static void exportTable(Connection connection, String fileName, String tableReference, String encoding) throws IOException, SQLException { """ Read a table and write it into a shape file. @param connection Active connection @param fileName Shape file name or URI @param tableReference Table name or select query Note : The select query must be enclosed in parenthesis @param encoding File encoding @throws IOException @throws SQLException """ SHPDriverFunction shpDriverFunction = new SHPDriverFunction(); shpDriverFunction.exportTable(connection, tableReference, URIUtilities.fileFromString(fileName), new EmptyProgressVisitor(), encoding); }
java
public static void exportTable(Connection connection, String fileName, String tableReference, String encoding) throws IOException, SQLException { SHPDriverFunction shpDriverFunction = new SHPDriverFunction(); shpDriverFunction.exportTable(connection, tableReference, URIUtilities.fileFromString(fileName), new EmptyProgressVisitor(), encoding); }
[ "public", "static", "void", "exportTable", "(", "Connection", "connection", ",", "String", "fileName", ",", "String", "tableReference", ",", "String", "encoding", ")", "throws", "IOException", ",", "SQLException", "{", "SHPDriverFunction", "shpDriverFunction", "=", "new", "SHPDriverFunction", "(", ")", ";", "shpDriverFunction", ".", "exportTable", "(", "connection", ",", "tableReference", ",", "URIUtilities", ".", "fileFromString", "(", "fileName", ")", ",", "new", "EmptyProgressVisitor", "(", ")", ",", "encoding", ")", ";", "}" ]
Read a table and write it into a shape file. @param connection Active connection @param fileName Shape file name or URI @param tableReference Table name or select query Note : The select query must be enclosed in parenthesis @param encoding File encoding @throws IOException @throws SQLException
[ "Read", "a", "table", "and", "write", "it", "into", "a", "shape", "file", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/shp/SHPWrite.java#L69-L72
apache/incubator-gobblin
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/converter/AbstractAvroToOrcConverter.java
AbstractAvroToOrcConverter.getViewWhiteBackListFromWorkUnit
@VisibleForTesting public static Optional<WhitelistBlacklist> getViewWhiteBackListFromWorkUnit(WorkUnitState workUnit) { """ * Get Hive view registration whitelist blacklist from Workunit state @param workUnit Workunit containing view whitelist blacklist property @return Optional WhitelistBlacklist if Workunit contains it """ Optional<WhitelistBlacklist> optionalViewWhiteBlacklist = Optional.absent(); if (workUnit == null) { return optionalViewWhiteBlacklist; } if (workUnit.contains(HIVE_CONVERSION_VIEW_REGISTRATION_WHITELIST) || workUnit.contains(HIVE_CONVERSION_VIEW_REGISTRATION_BLACKLIST)) { String viewWhiteList = workUnit.getProp(HIVE_CONVERSION_VIEW_REGISTRATION_WHITELIST, StringUtils.EMPTY); String viewBlackList = workUnit.getProp(HIVE_CONVERSION_VIEW_REGISTRATION_BLACKLIST, StringUtils.EMPTY); try { optionalViewWhiteBlacklist = Optional.of(new WhitelistBlacklist(viewWhiteList, viewBlackList)); } catch (IOException e) { Throwables.propagate(e); } } return optionalViewWhiteBlacklist; }
java
@VisibleForTesting public static Optional<WhitelistBlacklist> getViewWhiteBackListFromWorkUnit(WorkUnitState workUnit) { Optional<WhitelistBlacklist> optionalViewWhiteBlacklist = Optional.absent(); if (workUnit == null) { return optionalViewWhiteBlacklist; } if (workUnit.contains(HIVE_CONVERSION_VIEW_REGISTRATION_WHITELIST) || workUnit.contains(HIVE_CONVERSION_VIEW_REGISTRATION_BLACKLIST)) { String viewWhiteList = workUnit.getProp(HIVE_CONVERSION_VIEW_REGISTRATION_WHITELIST, StringUtils.EMPTY); String viewBlackList = workUnit.getProp(HIVE_CONVERSION_VIEW_REGISTRATION_BLACKLIST, StringUtils.EMPTY); try { optionalViewWhiteBlacklist = Optional.of(new WhitelistBlacklist(viewWhiteList, viewBlackList)); } catch (IOException e) { Throwables.propagate(e); } } return optionalViewWhiteBlacklist; }
[ "@", "VisibleForTesting", "public", "static", "Optional", "<", "WhitelistBlacklist", ">", "getViewWhiteBackListFromWorkUnit", "(", "WorkUnitState", "workUnit", ")", "{", "Optional", "<", "WhitelistBlacklist", ">", "optionalViewWhiteBlacklist", "=", "Optional", ".", "absent", "(", ")", ";", "if", "(", "workUnit", "==", "null", ")", "{", "return", "optionalViewWhiteBlacklist", ";", "}", "if", "(", "workUnit", ".", "contains", "(", "HIVE_CONVERSION_VIEW_REGISTRATION_WHITELIST", ")", "||", "workUnit", ".", "contains", "(", "HIVE_CONVERSION_VIEW_REGISTRATION_BLACKLIST", ")", ")", "{", "String", "viewWhiteList", "=", "workUnit", ".", "getProp", "(", "HIVE_CONVERSION_VIEW_REGISTRATION_WHITELIST", ",", "StringUtils", ".", "EMPTY", ")", ";", "String", "viewBlackList", "=", "workUnit", ".", "getProp", "(", "HIVE_CONVERSION_VIEW_REGISTRATION_BLACKLIST", ",", "StringUtils", ".", "EMPTY", ")", ";", "try", "{", "optionalViewWhiteBlacklist", "=", "Optional", ".", "of", "(", "new", "WhitelistBlacklist", "(", "viewWhiteList", ",", "viewBlackList", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "Throwables", ".", "propagate", "(", "e", ")", ";", "}", "}", "return", "optionalViewWhiteBlacklist", ";", "}" ]
* Get Hive view registration whitelist blacklist from Workunit state @param workUnit Workunit containing view whitelist blacklist property @return Optional WhitelistBlacklist if Workunit contains it
[ "*", "Get", "Hive", "view", "registration", "whitelist", "blacklist", "from", "Workunit", "state" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/converter/AbstractAvroToOrcConverter.java#L592-L611
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.serviceName_pca_pcaServiceName_tasks_POST
public OvhTask serviceName_pca_pcaServiceName_tasks_POST(String serviceName, String pcaServiceName, String[] fileIds, String sessionId, OvhTaskTypeEnum taskFunction) throws IOException { """ Create a cloud archives task REST: POST /cloud/{serviceName}/pca/{pcaServiceName}/tasks @param taskFunction [required] cloud archives task type @param fileIds [required] cloud archives file identifiers @param sessionId [required] cloud archives session identifier @param serviceName [required] The internal name of your public cloud passport @param pcaServiceName [required] The internal name of your PCA offer @deprecated """ String qPath = "/cloud/{serviceName}/pca/{pcaServiceName}/tasks"; StringBuilder sb = path(qPath, serviceName, pcaServiceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "fileIds", fileIds); addBody(o, "sessionId", sessionId); addBody(o, "taskFunction", taskFunction); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_pca_pcaServiceName_tasks_POST(String serviceName, String pcaServiceName, String[] fileIds, String sessionId, OvhTaskTypeEnum taskFunction) throws IOException { String qPath = "/cloud/{serviceName}/pca/{pcaServiceName}/tasks"; StringBuilder sb = path(qPath, serviceName, pcaServiceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "fileIds", fileIds); addBody(o, "sessionId", sessionId); addBody(o, "taskFunction", taskFunction); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_pca_pcaServiceName_tasks_POST", "(", "String", "serviceName", ",", "String", "pcaServiceName", ",", "String", "[", "]", "fileIds", ",", "String", "sessionId", ",", "OvhTaskTypeEnum", "taskFunction", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/{serviceName}/pca/{pcaServiceName}/tasks\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "pcaServiceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"fileIds\"", ",", "fileIds", ")", ";", "addBody", "(", "o", ",", "\"sessionId\"", ",", "sessionId", ")", ";", "addBody", "(", "o", ",", "\"taskFunction\"", ",", "taskFunction", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhTask", ".", "class", ")", ";", "}" ]
Create a cloud archives task REST: POST /cloud/{serviceName}/pca/{pcaServiceName}/tasks @param taskFunction [required] cloud archives task type @param fileIds [required] cloud archives file identifiers @param sessionId [required] cloud archives session identifier @param serviceName [required] The internal name of your public cloud passport @param pcaServiceName [required] The internal name of your PCA offer @deprecated
[ "Create", "a", "cloud", "archives", "task" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L2673-L2682
square/wire
wire-java-generator/src/main/java/com/squareup/wire/java/ProfileLoader.java
ProfileLoader.pathsToAttempt
void pathsToAttempt(Multimap<Path, String> sink, Location location) { """ Computes all possible {@code .wire} profile files for the {@code .proto} at {@code location} and adds them to {@code result}. """ Path base = fileSystem.getPath(location.getBase()); String path = location.getPath(); while (!path.isEmpty()) { String parent = path.substring(0, path.lastIndexOf('/', path.length() - 2) + 1); String profilePath = parent + name + ".wire"; sink.put(base, profilePath); path = parent; } }
java
void pathsToAttempt(Multimap<Path, String> sink, Location location) { Path base = fileSystem.getPath(location.getBase()); String path = location.getPath(); while (!path.isEmpty()) { String parent = path.substring(0, path.lastIndexOf('/', path.length() - 2) + 1); String profilePath = parent + name + ".wire"; sink.put(base, profilePath); path = parent; } }
[ "void", "pathsToAttempt", "(", "Multimap", "<", "Path", ",", "String", ">", "sink", ",", "Location", "location", ")", "{", "Path", "base", "=", "fileSystem", ".", "getPath", "(", "location", ".", "getBase", "(", ")", ")", ";", "String", "path", "=", "location", ".", "getPath", "(", ")", ";", "while", "(", "!", "path", ".", "isEmpty", "(", ")", ")", "{", "String", "parent", "=", "path", ".", "substring", "(", "0", ",", "path", ".", "lastIndexOf", "(", "'", "'", ",", "path", ".", "length", "(", ")", "-", "2", ")", "+", "1", ")", ";", "String", "profilePath", "=", "parent", "+", "name", "+", "\".wire\"", ";", "sink", ".", "put", "(", "base", ",", "profilePath", ")", ";", "path", "=", "parent", ";", "}", "}" ]
Computes all possible {@code .wire} profile files for the {@code .proto} at {@code location} and adds them to {@code result}.
[ "Computes", "all", "possible", "{" ]
train
https://github.com/square/wire/blob/4a9a00dfadfc14d6a0780b85810418f9cbc78a49/wire-java-generator/src/main/java/com/squareup/wire/java/ProfileLoader.java#L122-L132
raydac/java-comment-preprocessor
jcp/src/main/java/com/igormaznitsa/meta/common/utils/Assertions.java
Assertions.assertEquals
public static <T> T assertEquals(@Nullable final T etalon, @Nullable final T value) { """ Assert that value is equal to some etalon value. @param <T> type of object to be checked. @param etalon etalon value @param value value to check @return value if it is equal to etalon @throws AssertionError if the value id not equal to the etalon @since 1.1.1 """ if (etalon == null) { assertNull(value); } else { if (!(etalon == value || etalon.equals(value))) { final AssertionError error = new AssertionError("Value is not equal to etalon"); MetaErrorListeners.fireError(error.getMessage(), error); throw error; } } return value; }
java
public static <T> T assertEquals(@Nullable final T etalon, @Nullable final T value) { if (etalon == null) { assertNull(value); } else { if (!(etalon == value || etalon.equals(value))) { final AssertionError error = new AssertionError("Value is not equal to etalon"); MetaErrorListeners.fireError(error.getMessage(), error); throw error; } } return value; }
[ "public", "static", "<", "T", ">", "T", "assertEquals", "(", "@", "Nullable", "final", "T", "etalon", ",", "@", "Nullable", "final", "T", "value", ")", "{", "if", "(", "etalon", "==", "null", ")", "{", "assertNull", "(", "value", ")", ";", "}", "else", "{", "if", "(", "!", "(", "etalon", "==", "value", "||", "etalon", ".", "equals", "(", "value", ")", ")", ")", "{", "final", "AssertionError", "error", "=", "new", "AssertionError", "(", "\"Value is not equal to etalon\"", ")", ";", "MetaErrorListeners", ".", "fireError", "(", "error", ".", "getMessage", "(", ")", ",", "error", ")", ";", "throw", "error", ";", "}", "}", "return", "value", ";", "}" ]
Assert that value is equal to some etalon value. @param <T> type of object to be checked. @param etalon etalon value @param value value to check @return value if it is equal to etalon @throws AssertionError if the value id not equal to the etalon @since 1.1.1
[ "Assert", "that", "value", "is", "equal", "to", "some", "etalon", "value", "." ]
train
https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/meta/common/utils/Assertions.java#L183-L194
apache/incubator-gobblin
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/HiveCopyEntityHelper.java
HiveCopyEntityHelper.getTargetLocation
Path getTargetLocation(FileSystem sourceFs, FileSystem targetFs, Path path, Optional<Partition> partition) throws IOException { """ Compute the target location for a Hive location. @param sourceFs Source {@link FileSystem}. @param path source {@link Path} in Hive location. @param partition partition these paths correspond to. @return transformed location in the target. @throws IOException if cannot generate a single target location. """ return getTargetPathHelper().getTargetPath(path, targetFs, partition, false); }
java
Path getTargetLocation(FileSystem sourceFs, FileSystem targetFs, Path path, Optional<Partition> partition) throws IOException { return getTargetPathHelper().getTargetPath(path, targetFs, partition, false); }
[ "Path", "getTargetLocation", "(", "FileSystem", "sourceFs", ",", "FileSystem", "targetFs", ",", "Path", "path", ",", "Optional", "<", "Partition", ">", "partition", ")", "throws", "IOException", "{", "return", "getTargetPathHelper", "(", ")", ".", "getTargetPath", "(", "path", ",", "targetFs", ",", "partition", ",", "false", ")", ";", "}" ]
Compute the target location for a Hive location. @param sourceFs Source {@link FileSystem}. @param path source {@link Path} in Hive location. @param partition partition these paths correspond to. @return transformed location in the target. @throws IOException if cannot generate a single target location.
[ "Compute", "the", "target", "location", "for", "a", "Hive", "location", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/HiveCopyEntityHelper.java#L780-L783
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/persist/LockFile.java
LockFile.closeRAF
private final void closeRAF() throws LockFile.UnexpectedFileIOException { """ Closes this object's {@link #raf RandomAccessFile}. <p> As a side-effect, the associated <tt>FileChannel</tt> object, if any, is closed as well. @throws UnexpectedFileIOException if an <tt>IOException</tt> is thrown """ if (raf != null) { try { raf.close(); } catch (IOException ex) { throw new UnexpectedFileIOException(this, "closeRAF", ex); } finally { raf = null; } } }
java
private final void closeRAF() throws LockFile.UnexpectedFileIOException { if (raf != null) { try { raf.close(); } catch (IOException ex) { throw new UnexpectedFileIOException(this, "closeRAF", ex); } finally { raf = null; } } }
[ "private", "final", "void", "closeRAF", "(", ")", "throws", "LockFile", ".", "UnexpectedFileIOException", "{", "if", "(", "raf", "!=", "null", ")", "{", "try", "{", "raf", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "UnexpectedFileIOException", "(", "this", ",", "\"closeRAF\"", ",", "ex", ")", ";", "}", "finally", "{", "raf", "=", "null", ";", "}", "}", "}" ]
Closes this object's {@link #raf RandomAccessFile}. <p> As a side-effect, the associated <tt>FileChannel</tt> object, if any, is closed as well. @throws UnexpectedFileIOException if an <tt>IOException</tt> is thrown
[ "Closes", "this", "object", "s", "{", "@link", "#raf", "RandomAccessFile", "}", ".", "<p", ">" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/persist/LockFile.java#L870-L881
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkPeeringsInner.java
VirtualNetworkPeeringsInner.getAsync
public Observable<VirtualNetworkPeeringInner> getAsync(String resourceGroupName, String virtualNetworkName, String virtualNetworkPeeringName) { """ Gets the specified virtual network peering. @param resourceGroupName The name of the resource group. @param virtualNetworkName The name of the virtual network. @param virtualNetworkPeeringName The name of the virtual network peering. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualNetworkPeeringInner object """ return getWithServiceResponseAsync(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName).map(new Func1<ServiceResponse<VirtualNetworkPeeringInner>, VirtualNetworkPeeringInner>() { @Override public VirtualNetworkPeeringInner call(ServiceResponse<VirtualNetworkPeeringInner> response) { return response.body(); } }); }
java
public Observable<VirtualNetworkPeeringInner> getAsync(String resourceGroupName, String virtualNetworkName, String virtualNetworkPeeringName) { return getWithServiceResponseAsync(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName).map(new Func1<ServiceResponse<VirtualNetworkPeeringInner>, VirtualNetworkPeeringInner>() { @Override public VirtualNetworkPeeringInner call(ServiceResponse<VirtualNetworkPeeringInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualNetworkPeeringInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkName", ",", "String", "virtualNetworkPeeringName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkName", ",", "virtualNetworkPeeringName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VirtualNetworkPeeringInner", ">", ",", "VirtualNetworkPeeringInner", ">", "(", ")", "{", "@", "Override", "public", "VirtualNetworkPeeringInner", "call", "(", "ServiceResponse", "<", "VirtualNetworkPeeringInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets the specified virtual network peering. @param resourceGroupName The name of the resource group. @param virtualNetworkName The name of the virtual network. @param virtualNetworkPeeringName The name of the virtual network peering. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualNetworkPeeringInner object
[ "Gets", "the", "specified", "virtual", "network", "peering", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkPeeringsInner.java#L297-L304
alkacon/opencms-core
src/org/opencms/ui/actions/CmsResourceInfoAction.java
CmsResourceInfoAction.openDialog
public void openDialog(final I_CmsDialogContext context, String tabId) { """ Opens the resource info dialog with the given start tab.<p> @param context the dialog context @param tabId the tab to open """ CmsGwtDialogExtension extension = new CmsGwtDialogExtension(A_CmsUI.get(), new I_CmsUpdateListener<String>() { public void onUpdate(List<String> updatedItems) { List<CmsUUID> ids = Lists.newArrayList(); for (String item : updatedItems) { ids.add(new CmsUUID(item)); } context.finish(ids); } }); extension.openInfoDialog(context.getResources().get(0), tabId); }
java
public void openDialog(final I_CmsDialogContext context, String tabId) { CmsGwtDialogExtension extension = new CmsGwtDialogExtension(A_CmsUI.get(), new I_CmsUpdateListener<String>() { public void onUpdate(List<String> updatedItems) { List<CmsUUID> ids = Lists.newArrayList(); for (String item : updatedItems) { ids.add(new CmsUUID(item)); } context.finish(ids); } }); extension.openInfoDialog(context.getResources().get(0), tabId); }
[ "public", "void", "openDialog", "(", "final", "I_CmsDialogContext", "context", ",", "String", "tabId", ")", "{", "CmsGwtDialogExtension", "extension", "=", "new", "CmsGwtDialogExtension", "(", "A_CmsUI", ".", "get", "(", ")", ",", "new", "I_CmsUpdateListener", "<", "String", ">", "(", ")", "{", "public", "void", "onUpdate", "(", "List", "<", "String", ">", "updatedItems", ")", "{", "List", "<", "CmsUUID", ">", "ids", "=", "Lists", ".", "newArrayList", "(", ")", ";", "for", "(", "String", "item", ":", "updatedItems", ")", "{", "ids", ".", "add", "(", "new", "CmsUUID", "(", "item", ")", ")", ";", "}", "context", ".", "finish", "(", "ids", ")", ";", "}", "}", ")", ";", "extension", ".", "openInfoDialog", "(", "context", ".", "getResources", "(", ")", ".", "get", "(", "0", ")", ",", "tabId", ")", ";", "}" ]
Opens the resource info dialog with the given start tab.<p> @param context the dialog context @param tabId the tab to open
[ "Opens", "the", "resource", "info", "dialog", "with", "the", "given", "start", "tab", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/actions/CmsResourceInfoAction.java#L121-L135
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java
HexUtil.toHexString
public static String toHexString(byte[] bytes, int offset, int length) { """ Creates a String from a byte array with each byte in a "Big Endian" hexidecimal format. For example, a byte 0x34 will return a String "34". A byte array of { 0x34, 035 } would return "3435". @param buffer The StringBuilder the byte array in hexidecimal format will be appended to. If the buffer is null, this method will throw a NullPointerException. @param bytes The byte array that will be converted to a hexidecimal String. If the byte array is null, this method will append nothing (a noop) @param offset The offset in the byte array to start from. If the offset or length combination is invalid, this method will throw an IllegalArgumentException. @param length The length (from the offset) to conver the bytes. If the offset or length combination is invalid, this method will throw an IllegalArgumentException. """ if (bytes == null) { return ""; } assertOffsetLengthValid(offset, length, bytes.length); // each byte is 2 chars in string StringBuilder buffer = new StringBuilder(length * 2); appendHexString(buffer, bytes, offset, length); return buffer.toString(); }
java
public static String toHexString(byte[] bytes, int offset, int length) { if (bytes == null) { return ""; } assertOffsetLengthValid(offset, length, bytes.length); // each byte is 2 chars in string StringBuilder buffer = new StringBuilder(length * 2); appendHexString(buffer, bytes, offset, length); return buffer.toString(); }
[ "public", "static", "String", "toHexString", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ",", "int", "length", ")", "{", "if", "(", "bytes", "==", "null", ")", "{", "return", "\"\"", ";", "}", "assertOffsetLengthValid", "(", "offset", ",", "length", ",", "bytes", ".", "length", ")", ";", "// each byte is 2 chars in string", "StringBuilder", "buffer", "=", "new", "StringBuilder", "(", "length", "*", "2", ")", ";", "appendHexString", "(", "buffer", ",", "bytes", ",", "offset", ",", "length", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}" ]
Creates a String from a byte array with each byte in a "Big Endian" hexidecimal format. For example, a byte 0x34 will return a String "34". A byte array of { 0x34, 035 } would return "3435". @param buffer The StringBuilder the byte array in hexidecimal format will be appended to. If the buffer is null, this method will throw a NullPointerException. @param bytes The byte array that will be converted to a hexidecimal String. If the byte array is null, this method will append nothing (a noop) @param offset The offset in the byte array to start from. If the offset or length combination is invalid, this method will throw an IllegalArgumentException. @param length The length (from the offset) to conver the bytes. If the offset or length combination is invalid, this method will throw an IllegalArgumentException.
[ "Creates", "a", "String", "from", "a", "byte", "array", "with", "each", "byte", "in", "a", "Big", "Endian", "hexidecimal", "format", ".", "For", "example", "a", "byte", "0x34", "will", "return", "a", "String", "34", ".", "A", "byte", "array", "of", "{", "0x34", "035", "}", "would", "return", "3435", "." ]
train
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java#L65-L74
voldemort/voldemort
src/java/voldemort/store/stats/ClientSocketStats.java
ClientSocketStats.recordCheckoutQueueLength
public void recordCheckoutQueueLength(SocketDestination dest, int queueLength) { """ Record the checkout queue length @param dest Destination of the socket to checkout. Will actually record if null. Otherwise will call this on self and corresponding child with this param null. @param queueLength The number of entries in the "synchronous" checkout queue. """ if(dest != null) { getOrCreateNodeStats(dest).recordCheckoutQueueLength(null, queueLength); recordCheckoutQueueLength(null, queueLength); } else { this.checkoutQueueLengthHistogram.insert(queueLength); checkMonitoringInterval(); } }
java
public void recordCheckoutQueueLength(SocketDestination dest, int queueLength) { if(dest != null) { getOrCreateNodeStats(dest).recordCheckoutQueueLength(null, queueLength); recordCheckoutQueueLength(null, queueLength); } else { this.checkoutQueueLengthHistogram.insert(queueLength); checkMonitoringInterval(); } }
[ "public", "void", "recordCheckoutQueueLength", "(", "SocketDestination", "dest", ",", "int", "queueLength", ")", "{", "if", "(", "dest", "!=", "null", ")", "{", "getOrCreateNodeStats", "(", "dest", ")", ".", "recordCheckoutQueueLength", "(", "null", ",", "queueLength", ")", ";", "recordCheckoutQueueLength", "(", "null", ",", "queueLength", ")", ";", "}", "else", "{", "this", ".", "checkoutQueueLengthHistogram", ".", "insert", "(", "queueLength", ")", ";", "checkMonitoringInterval", "(", ")", ";", "}", "}" ]
Record the checkout queue length @param dest Destination of the socket to checkout. Will actually record if null. Otherwise will call this on self and corresponding child with this param null. @param queueLength The number of entries in the "synchronous" checkout queue.
[ "Record", "the", "checkout", "queue", "length" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/stats/ClientSocketStats.java#L283-L291
ehcache/ehcache3
impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java
CacheConfigurationBuilder.withKeySerializer
public CacheConfigurationBuilder<K, V> withKeySerializer(Serializer<K> keySerializer) { """ Adds a {@link Serializer} for cache keys to the configured builder. <p> {@link Serializer}s are what enables cache storage beyond the heap tier. @param keySerializer the key serializer to use @return a new builder with the added key serializer """ return withSerializer(new DefaultSerializerConfiguration<>(requireNonNull(keySerializer, "Null key serializer"), DefaultSerializerConfiguration.Type.KEY)); }
java
public CacheConfigurationBuilder<K, V> withKeySerializer(Serializer<K> keySerializer) { return withSerializer(new DefaultSerializerConfiguration<>(requireNonNull(keySerializer, "Null key serializer"), DefaultSerializerConfiguration.Type.KEY)); }
[ "public", "CacheConfigurationBuilder", "<", "K", ",", "V", ">", "withKeySerializer", "(", "Serializer", "<", "K", ">", "keySerializer", ")", "{", "return", "withSerializer", "(", "new", "DefaultSerializerConfiguration", "<>", "(", "requireNonNull", "(", "keySerializer", ",", "\"Null key serializer\"", ")", ",", "DefaultSerializerConfiguration", ".", "Type", ".", "KEY", ")", ")", ";", "}" ]
Adds a {@link Serializer} for cache keys to the configured builder. <p> {@link Serializer}s are what enables cache storage beyond the heap tier. @param keySerializer the key serializer to use @return a new builder with the added key serializer
[ "Adds", "a", "{", "@link", "Serializer", "}", "for", "cache", "keys", "to", "the", "configured", "builder", ".", "<p", ">", "{", "@link", "Serializer", "}", "s", "are", "what", "enables", "cache", "storage", "beyond", "the", "heap", "tier", "." ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java#L456-L458
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Validator.java
Validator.validateFalse
public static boolean validateFalse(boolean value, String errorMsgTemplate, Object... params) throws ValidateException { """ 检查指定值是否为<code>false</code> @param value 值 @param errorMsgTemplate 错误消息内容模板(变量使用{}表示) @param params 模板中变量替换后的值 @return 检查过后的值 @throws ValidateException 检查不满足条件抛出的异常 @since 4.4.5 """ if (isTrue(value)) { throw new ValidateException(errorMsgTemplate, params); } return value; }
java
public static boolean validateFalse(boolean value, String errorMsgTemplate, Object... params) throws ValidateException { if (isTrue(value)) { throw new ValidateException(errorMsgTemplate, params); } return value; }
[ "public", "static", "boolean", "validateFalse", "(", "boolean", "value", ",", "String", "errorMsgTemplate", ",", "Object", "...", "params", ")", "throws", "ValidateException", "{", "if", "(", "isTrue", "(", "value", ")", ")", "{", "throw", "new", "ValidateException", "(", "errorMsgTemplate", ",", "params", ")", ";", "}", "return", "value", ";", "}" ]
检查指定值是否为<code>false</code> @param value 值 @param errorMsgTemplate 错误消息内容模板(变量使用{}表示) @param params 模板中变量替换后的值 @return 检查过后的值 @throws ValidateException 检查不满足条件抛出的异常 @since 4.4.5
[ "检查指定值是否为<code", ">", "false<", "/", "code", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L109-L114
google/closure-templates
java/src/com/google/template/soy/soytree/SoyTreeUtils.java
SoyTreeUtils.hasNodesOfType
@SafeVarargs public static boolean hasNodesOfType(Node node, final Class<? extends Node>... types) { """ Returns true if the given {@code node} contains any children of the given types. """ class Visitor implements NodeVisitor<Node, VisitDirective> { boolean found; @Override public VisitDirective exec(Node node) { for (Class<?> type : types) { if (type.isInstance(node)) { found = true; return VisitDirective.ABORT; } } return VisitDirective.CONTINUE; } } Visitor v = new Visitor(); visitAllNodes(node, v); return v.found; }
java
@SafeVarargs public static boolean hasNodesOfType(Node node, final Class<? extends Node>... types) { class Visitor implements NodeVisitor<Node, VisitDirective> { boolean found; @Override public VisitDirective exec(Node node) { for (Class<?> type : types) { if (type.isInstance(node)) { found = true; return VisitDirective.ABORT; } } return VisitDirective.CONTINUE; } } Visitor v = new Visitor(); visitAllNodes(node, v); return v.found; }
[ "@", "SafeVarargs", "public", "static", "boolean", "hasNodesOfType", "(", "Node", "node", ",", "final", "Class", "<", "?", "extends", "Node", ">", "...", "types", ")", "{", "class", "Visitor", "implements", "NodeVisitor", "<", "Node", ",", "VisitDirective", ">", "{", "boolean", "found", ";", "@", "Override", "public", "VisitDirective", "exec", "(", "Node", "node", ")", "{", "for", "(", "Class", "<", "?", ">", "type", ":", "types", ")", "{", "if", "(", "type", ".", "isInstance", "(", "node", ")", ")", "{", "found", "=", "true", ";", "return", "VisitDirective", ".", "ABORT", ";", "}", "}", "return", "VisitDirective", ".", "CONTINUE", ";", "}", "}", "Visitor", "v", "=", "new", "Visitor", "(", ")", ";", "visitAllNodes", "(", "node", ",", "v", ")", ";", "return", "v", ".", "found", ";", "}" ]
Returns true if the given {@code node} contains any children of the given types.
[ "Returns", "true", "if", "the", "given", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/SoyTreeUtils.java#L54-L73
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_abbreviatedNumber_abbreviatedNumber_DELETE
public void billingAccount_abbreviatedNumber_abbreviatedNumber_DELETE(String billingAccount, Long abbreviatedNumber) throws IOException { """ Delete the given abbreviated number REST: DELETE /telephony/{billingAccount}/abbreviatedNumber/{abbreviatedNumber} @param billingAccount [required] The name of your billingAccount @param abbreviatedNumber [required] The abbreviated number which must start with "7" and must have a length of 3 or 4 digits """ String qPath = "/telephony/{billingAccount}/abbreviatedNumber/{abbreviatedNumber}"; StringBuilder sb = path(qPath, billingAccount, abbreviatedNumber); exec(qPath, "DELETE", sb.toString(), null); }
java
public void billingAccount_abbreviatedNumber_abbreviatedNumber_DELETE(String billingAccount, Long abbreviatedNumber) throws IOException { String qPath = "/telephony/{billingAccount}/abbreviatedNumber/{abbreviatedNumber}"; StringBuilder sb = path(qPath, billingAccount, abbreviatedNumber); exec(qPath, "DELETE", sb.toString(), null); }
[ "public", "void", "billingAccount_abbreviatedNumber_abbreviatedNumber_DELETE", "(", "String", "billingAccount", ",", "Long", "abbreviatedNumber", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/abbreviatedNumber/{abbreviatedNumber}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "abbreviatedNumber", ")", ";", "exec", "(", "qPath", ",", "\"DELETE\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "}" ]
Delete the given abbreviated number REST: DELETE /telephony/{billingAccount}/abbreviatedNumber/{abbreviatedNumber} @param billingAccount [required] The name of your billingAccount @param abbreviatedNumber [required] The abbreviated number which must start with "7" and must have a length of 3 or 4 digits
[ "Delete", "the", "given", "abbreviated", "number" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L4573-L4577
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java
Graph.fromCsvReader
public static <K, VV> GraphCsvReader fromCsvReader(String edgesPath, final MapFunction<K, VV> vertexValueInitializer, ExecutionEnvironment context) { """ Creates a graph from a CSV file of edges. Vertices will be created automatically and Vertex values can be initialized using a user-defined mapper. @param edgesPath a path to a CSV file with the Edge data @param vertexValueInitializer the mapper function that initializes the vertex values. It allows to apply a map transformation on the vertex ID to produce an initial vertex value. @param context the execution environment. @return An instance of {@link org.apache.flink.graph.GraphCsvReader}, on which calling methods to specify types of the Vertex ID, Vertex Value and Edge value returns a Graph. @see org.apache.flink.graph.GraphCsvReader#types(Class, Class, Class) @see org.apache.flink.graph.GraphCsvReader#vertexTypes(Class, Class) @see org.apache.flink.graph.GraphCsvReader#edgeTypes(Class, Class) @see org.apache.flink.graph.GraphCsvReader#keyType(Class) """ return new GraphCsvReader(edgesPath, vertexValueInitializer, context); }
java
public static <K, VV> GraphCsvReader fromCsvReader(String edgesPath, final MapFunction<K, VV> vertexValueInitializer, ExecutionEnvironment context) { return new GraphCsvReader(edgesPath, vertexValueInitializer, context); }
[ "public", "static", "<", "K", ",", "VV", ">", "GraphCsvReader", "fromCsvReader", "(", "String", "edgesPath", ",", "final", "MapFunction", "<", "K", ",", "VV", ">", "vertexValueInitializer", ",", "ExecutionEnvironment", "context", ")", "{", "return", "new", "GraphCsvReader", "(", "edgesPath", ",", "vertexValueInitializer", ",", "context", ")", ";", "}" ]
Creates a graph from a CSV file of edges. Vertices will be created automatically and Vertex values can be initialized using a user-defined mapper. @param edgesPath a path to a CSV file with the Edge data @param vertexValueInitializer the mapper function that initializes the vertex values. It allows to apply a map transformation on the vertex ID to produce an initial vertex value. @param context the execution environment. @return An instance of {@link org.apache.flink.graph.GraphCsvReader}, on which calling methods to specify types of the Vertex ID, Vertex Value and Edge value returns a Graph. @see org.apache.flink.graph.GraphCsvReader#types(Class, Class, Class) @see org.apache.flink.graph.GraphCsvReader#vertexTypes(Class, Class) @see org.apache.flink.graph.GraphCsvReader#edgeTypes(Class, Class) @see org.apache.flink.graph.GraphCsvReader#keyType(Class)
[ "Creates", "a", "graph", "from", "a", "CSV", "file", "of", "edges", ".", "Vertices", "will", "be", "created", "automatically", "and", "Vertex", "values", "can", "be", "initialized", "using", "a", "user", "-", "defined", "mapper", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L428-L431
openengsb/openengsb
components/services/src/main/java/org/openengsb/core/services/xlink/XLinkUtils.java
XLinkUtils.setValueOfModel
public static void setValueOfModel(Object model, OpenEngSBModelEntry entry, Object value) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException { """ Sets the value, of the field defined in the OpenEngSBModelEntry, the the given model, with reflection. """ Class clazz = model.getClass(); Field field = clazz.getDeclaredField(entry.getKey()); field.setAccessible(true); field.set(model, value); }
java
public static void setValueOfModel(Object model, OpenEngSBModelEntry entry, Object value) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException { Class clazz = model.getClass(); Field field = clazz.getDeclaredField(entry.getKey()); field.setAccessible(true); field.set(model, value); }
[ "public", "static", "void", "setValueOfModel", "(", "Object", "model", ",", "OpenEngSBModelEntry", "entry", ",", "Object", "value", ")", "throws", "NoSuchFieldException", ",", "IllegalArgumentException", ",", "IllegalAccessException", "{", "Class", "clazz", "=", "model", ".", "getClass", "(", ")", ";", "Field", "field", "=", "clazz", ".", "getDeclaredField", "(", "entry", ".", "getKey", "(", ")", ")", ";", "field", ".", "setAccessible", "(", "true", ")", ";", "field", ".", "set", "(", "model", ",", "value", ")", ";", "}" ]
Sets the value, of the field defined in the OpenEngSBModelEntry, the the given model, with reflection.
[ "Sets", "the", "value", "of", "the", "field", "defined", "in", "the", "OpenEngSBModelEntry", "the", "the", "given", "model", "with", "reflection", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/services/src/main/java/org/openengsb/core/services/xlink/XLinkUtils.java#L120-L128
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/parsing/ParseUtils.java
ParseUtils.readBooleanAttributeElement
public static boolean readBooleanAttributeElement(final XMLExtendedStreamReader reader, final String attributeName) throws XMLStreamException { """ Read an element which contains only a single boolean attribute. @param reader the reader @param attributeName the attribute name, usually "value" @return the boolean value @throws javax.xml.stream.XMLStreamException if an error occurs or if the element does not contain the specified attribute, contains other attributes, or contains child elements. """ requireSingleAttribute(reader, attributeName); final boolean value = Boolean.parseBoolean(reader.getAttributeValue(0)); requireNoContent(reader); return value; }
java
public static boolean readBooleanAttributeElement(final XMLExtendedStreamReader reader, final String attributeName) throws XMLStreamException { requireSingleAttribute(reader, attributeName); final boolean value = Boolean.parseBoolean(reader.getAttributeValue(0)); requireNoContent(reader); return value; }
[ "public", "static", "boolean", "readBooleanAttributeElement", "(", "final", "XMLExtendedStreamReader", "reader", ",", "final", "String", "attributeName", ")", "throws", "XMLStreamException", "{", "requireSingleAttribute", "(", "reader", ",", "attributeName", ")", ";", "final", "boolean", "value", "=", "Boolean", ".", "parseBoolean", "(", "reader", ".", "getAttributeValue", "(", "0", ")", ")", ";", "requireNoContent", "(", "reader", ")", ";", "return", "value", ";", "}" ]
Read an element which contains only a single boolean attribute. @param reader the reader @param attributeName the attribute name, usually "value" @return the boolean value @throws javax.xml.stream.XMLStreamException if an error occurs or if the element does not contain the specified attribute, contains other attributes, or contains child elements.
[ "Read", "an", "element", "which", "contains", "only", "a", "single", "boolean", "attribute", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/parsing/ParseUtils.java#L384-L390
alkacon/opencms-core
src/org/opencms/ui/components/extensions/CmsScrollPositionCss.java
CmsScrollPositionCss.addTo
@SuppressWarnings("unused") public static void addTo( AbstractSingleComponentContainer componentContainer, int scrollBarrier, int barrierMargin, String styleName) { """ Adds the scroll position CSS extension to the given component @param componentContainer the component to extend @param scrollBarrier the scroll barrier @param barrierMargin the margin @param styleName the style name to set beyond the scroll barrier """ new CmsScrollPositionCss(componentContainer, scrollBarrier, barrierMargin, styleName); }
java
@SuppressWarnings("unused") public static void addTo( AbstractSingleComponentContainer componentContainer, int scrollBarrier, int barrierMargin, String styleName) { new CmsScrollPositionCss(componentContainer, scrollBarrier, barrierMargin, styleName); }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "public", "static", "void", "addTo", "(", "AbstractSingleComponentContainer", "componentContainer", ",", "int", "scrollBarrier", ",", "int", "barrierMargin", ",", "String", "styleName", ")", "{", "new", "CmsScrollPositionCss", "(", "componentContainer", ",", "scrollBarrier", ",", "barrierMargin", ",", "styleName", ")", ";", "}" ]
Adds the scroll position CSS extension to the given component @param componentContainer the component to extend @param scrollBarrier the scroll barrier @param barrierMargin the margin @param styleName the style name to set beyond the scroll barrier
[ "Adds", "the", "scroll", "position", "CSS", "extension", "to", "the", "given", "component" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/extensions/CmsScrollPositionCss.java#L71-L79
FXMisc/RichTextFX
richtextfx/src/main/java/org/fxmisc/richtext/util/UndoUtils.java
UndoUtils.defaultUndoManager
public static <PS, SEG, S> UndoManager defaultUndoManager(GenericStyledArea<PS, SEG, S> area) { """ Constructs an UndoManager with an unlimited history: if {@link GenericStyledArea#isPreserveStyle() the area's preserveStyle flag is true}, the returned UndoManager can undo/redo multiple {@link RichTextChange}s; otherwise, it can undo/redo multiple {@link PlainTextChange}s. """ return area.isPreserveStyle() ? richTextUndoManager(area) : plainTextUndoManager(area); }
java
public static <PS, SEG, S> UndoManager defaultUndoManager(GenericStyledArea<PS, SEG, S> area) { return area.isPreserveStyle() ? richTextUndoManager(area) : plainTextUndoManager(area); }
[ "public", "static", "<", "PS", ",", "SEG", ",", "S", ">", "UndoManager", "defaultUndoManager", "(", "GenericStyledArea", "<", "PS", ",", "SEG", ",", "S", ">", "area", ")", "{", "return", "area", ".", "isPreserveStyle", "(", ")", "?", "richTextUndoManager", "(", "area", ")", ":", "plainTextUndoManager", "(", "area", ")", ";", "}" ]
Constructs an UndoManager with an unlimited history: if {@link GenericStyledArea#isPreserveStyle() the area's preserveStyle flag is true}, the returned UndoManager can undo/redo multiple {@link RichTextChange}s; otherwise, it can undo/redo multiple {@link PlainTextChange}s.
[ "Constructs", "an", "UndoManager", "with", "an", "unlimited", "history", ":", "if", "{" ]
train
https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/util/UndoUtils.java#L32-L36
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java
DiagnosticsInner.listSiteAnalysesSlotAsync
public Observable<Page<AnalysisDefinitionInner>> listSiteAnalysesSlotAsync(final String resourceGroupName, final String siteName, final String diagnosticCategory, final String slot) { """ Get Site Analyses. Get Site Analyses. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Site Name @param diagnosticCategory Diagnostic Category @param slot Slot Name @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;AnalysisDefinitionInner&gt; object """ return listSiteAnalysesSlotWithServiceResponseAsync(resourceGroupName, siteName, diagnosticCategory, slot) .map(new Func1<ServiceResponse<Page<AnalysisDefinitionInner>>, Page<AnalysisDefinitionInner>>() { @Override public Page<AnalysisDefinitionInner> call(ServiceResponse<Page<AnalysisDefinitionInner>> response) { return response.body(); } }); }
java
public Observable<Page<AnalysisDefinitionInner>> listSiteAnalysesSlotAsync(final String resourceGroupName, final String siteName, final String diagnosticCategory, final String slot) { return listSiteAnalysesSlotWithServiceResponseAsync(resourceGroupName, siteName, diagnosticCategory, slot) .map(new Func1<ServiceResponse<Page<AnalysisDefinitionInner>>, Page<AnalysisDefinitionInner>>() { @Override public Page<AnalysisDefinitionInner> call(ServiceResponse<Page<AnalysisDefinitionInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "AnalysisDefinitionInner", ">", ">", "listSiteAnalysesSlotAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "siteName", ",", "final", "String", "diagnosticCategory", ",", "final", "String", "slot", ")", "{", "return", "listSiteAnalysesSlotWithServiceResponseAsync", "(", "resourceGroupName", ",", "siteName", ",", "diagnosticCategory", ",", "slot", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "AnalysisDefinitionInner", ">", ">", ",", "Page", "<", "AnalysisDefinitionInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "AnalysisDefinitionInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "AnalysisDefinitionInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Get Site Analyses. Get Site Analyses. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Site Name @param diagnosticCategory Diagnostic Category @param slot Slot Name @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;AnalysisDefinitionInner&gt; object
[ "Get", "Site", "Analyses", ".", "Get", "Site", "Analyses", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java#L1635-L1643
OpenLiberty/open-liberty
dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java
ManagedCompletableFuture.completedFuture
@Trivial public static <U> CompletableFuture<U> completedFuture(U value) { """ Because CompletableFuture.completedFuture is static, this is not a true override. It will be difficult for the user to invoke this method because they would need to get the class of the CompletableFuture implementation and locate the static completedFuture method on that. @throws UnsupportedOperationException directing the user to use the ManagedExecutor spec interface instead. """ throw new UnsupportedOperationException(Tr.formatMessage(tc, "CWWKC1156.not.supported", "ManagedExecutor.completedFuture")); }
java
@Trivial public static <U> CompletableFuture<U> completedFuture(U value) { throw new UnsupportedOperationException(Tr.formatMessage(tc, "CWWKC1156.not.supported", "ManagedExecutor.completedFuture")); }
[ "@", "Trivial", "public", "static", "<", "U", ">", "CompletableFuture", "<", "U", ">", "completedFuture", "(", "U", "value", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "Tr", ".", "formatMessage", "(", "tc", ",", "\"CWWKC1156.not.supported\"", ",", "\"ManagedExecutor.completedFuture\"", ")", ")", ";", "}" ]
Because CompletableFuture.completedFuture is static, this is not a true override. It will be difficult for the user to invoke this method because they would need to get the class of the CompletableFuture implementation and locate the static completedFuture method on that. @throws UnsupportedOperationException directing the user to use the ManagedExecutor spec interface instead.
[ "Because", "CompletableFuture", ".", "completedFuture", "is", "static", "this", "is", "not", "a", "true", "override", ".", "It", "will", "be", "difficult", "for", "the", "user", "to", "invoke", "this", "method", "because", "they", "would", "need", "to", "get", "the", "class", "of", "the", "CompletableFuture", "implementation", "and", "locate", "the", "static", "completedFuture", "method", "on", "that", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java#L272-L275
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/tx/narayana/XATerminatorImpl.java
XATerminatorImpl.registerWork
public void registerWork(Work work, Xid xid, long timeout) throws WorkCompletedException { """ Invoked for transaction inflow of work @param work The work starting @param xid The xid of the work @param timeout The transaction timeout @throws WorkCompletedException with error code WorkException.TX_CONCURRENT_WORK_DISALLOWED when work is already present for the xid or whose completion is in progress, only the global part of the xid must be used for this check. """ delegator.registerWork(work, xid, timeout); }
java
public void registerWork(Work work, Xid xid, long timeout) throws WorkCompletedException { delegator.registerWork(work, xid, timeout); }
[ "public", "void", "registerWork", "(", "Work", "work", ",", "Xid", "xid", ",", "long", "timeout", ")", "throws", "WorkCompletedException", "{", "delegator", ".", "registerWork", "(", "work", ",", "xid", ",", "timeout", ")", ";", "}" ]
Invoked for transaction inflow of work @param work The work starting @param xid The xid of the work @param timeout The transaction timeout @throws WorkCompletedException with error code WorkException.TX_CONCURRENT_WORK_DISALLOWED when work is already present for the xid or whose completion is in progress, only the global part of the xid must be used for this check.
[ "Invoked", "for", "transaction", "inflow", "of", "work" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/tx/narayana/XATerminatorImpl.java#L100-L103
kiegroup/drools
drools-core/src/main/java/org/drools/core/util/DroolsStreamUtils.java
DroolsStreamUtils.streamOut
public static void streamOut(OutputStream out, Object object, boolean compressed) throws IOException { """ This method would stream out the given object to the given output stream uncompressed or compressed depending on the given flag. The output contents could only be read by the corresponding "streamIn" methods of this class. @param out @param object @throws IOException """ if (compressed) { out = new GZIPOutputStream(out); } DroolsObjectOutputStream doos = null; try { doos = new DroolsObjectOutputStream(out); doos.writeObject(object); } finally { if( doos != null ) { doos.close(); } if (compressed) { out.close(); } } }
java
public static void streamOut(OutputStream out, Object object, boolean compressed) throws IOException { if (compressed) { out = new GZIPOutputStream(out); } DroolsObjectOutputStream doos = null; try { doos = new DroolsObjectOutputStream(out); doos.writeObject(object); } finally { if( doos != null ) { doos.close(); } if (compressed) { out.close(); } } }
[ "public", "static", "void", "streamOut", "(", "OutputStream", "out", ",", "Object", "object", ",", "boolean", "compressed", ")", "throws", "IOException", "{", "if", "(", "compressed", ")", "{", "out", "=", "new", "GZIPOutputStream", "(", "out", ")", ";", "}", "DroolsObjectOutputStream", "doos", "=", "null", ";", "try", "{", "doos", "=", "new", "DroolsObjectOutputStream", "(", "out", ")", ";", "doos", ".", "writeObject", "(", "object", ")", ";", "}", "finally", "{", "if", "(", "doos", "!=", "null", ")", "{", "doos", ".", "close", "(", ")", ";", "}", "if", "(", "compressed", ")", "{", "out", ".", "close", "(", ")", ";", "}", "}", "}" ]
This method would stream out the given object to the given output stream uncompressed or compressed depending on the given flag. The output contents could only be read by the corresponding "streamIn" methods of this class. @param out @param object @throws IOException
[ "This", "method", "would", "stream", "out", "the", "given", "object", "to", "the", "given", "output", "stream", "uncompressed", "or", "compressed", "depending", "on", "the", "given", "flag", ".", "The", "output", "contents", "could", "only", "be", "read", "by", "the", "corresponding", "streamIn", "methods", "of", "this", "class", "." ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/util/DroolsStreamUtils.java#L88-L104
zxing/zxing
core/src/main/java/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java
DecodedBitStreamParser.textCompaction
private static int textCompaction(int[] codewords, int codeIndex, StringBuilder result) { """ Text Compaction mode (see 5.4.1.5) permits all printable ASCII characters to be encoded, i.e. values 32 - 126 inclusive in accordance with ISO/IEC 646 (IRV), as well as selected control characters. @param codewords The array of codewords (data + error) @param codeIndex The current index into the codeword array. @param result The decoded data is appended to the result. @return The next index into the codeword array. """ // 2 character per codeword int[] textCompactionData = new int[(codewords[0] - codeIndex) * 2]; // Used to hold the byte compaction value if there is a mode shift int[] byteCompactionData = new int[(codewords[0] - codeIndex) * 2]; int index = 0; boolean end = false; while ((codeIndex < codewords[0]) && !end) { int code = codewords[codeIndex++]; if (code < TEXT_COMPACTION_MODE_LATCH) { textCompactionData[index] = code / 30; textCompactionData[index + 1] = code % 30; index += 2; } else { switch (code) { case TEXT_COMPACTION_MODE_LATCH: // reinitialize text compaction mode to alpha sub mode textCompactionData[index++] = TEXT_COMPACTION_MODE_LATCH; break; case BYTE_COMPACTION_MODE_LATCH: case BYTE_COMPACTION_MODE_LATCH_6: case NUMERIC_COMPACTION_MODE_LATCH: case BEGIN_MACRO_PDF417_CONTROL_BLOCK: case BEGIN_MACRO_PDF417_OPTIONAL_FIELD: case MACRO_PDF417_TERMINATOR: codeIndex--; end = true; break; case MODE_SHIFT_TO_BYTE_COMPACTION_MODE: // The Mode Shift codeword 913 shall cause a temporary // switch from Text Compaction mode to Byte Compaction mode. // This switch shall be in effect for only the next codeword, // after which the mode shall revert to the prevailing sub-mode // of the Text Compaction mode. Codeword 913 is only available // in Text Compaction mode; its use is described in 5.4.2.4. textCompactionData[index] = MODE_SHIFT_TO_BYTE_COMPACTION_MODE; code = codewords[codeIndex++]; byteCompactionData[index] = code; index++; break; } } } decodeTextCompaction(textCompactionData, byteCompactionData, index, result); return codeIndex; }
java
private static int textCompaction(int[] codewords, int codeIndex, StringBuilder result) { // 2 character per codeword int[] textCompactionData = new int[(codewords[0] - codeIndex) * 2]; // Used to hold the byte compaction value if there is a mode shift int[] byteCompactionData = new int[(codewords[0] - codeIndex) * 2]; int index = 0; boolean end = false; while ((codeIndex < codewords[0]) && !end) { int code = codewords[codeIndex++]; if (code < TEXT_COMPACTION_MODE_LATCH) { textCompactionData[index] = code / 30; textCompactionData[index + 1] = code % 30; index += 2; } else { switch (code) { case TEXT_COMPACTION_MODE_LATCH: // reinitialize text compaction mode to alpha sub mode textCompactionData[index++] = TEXT_COMPACTION_MODE_LATCH; break; case BYTE_COMPACTION_MODE_LATCH: case BYTE_COMPACTION_MODE_LATCH_6: case NUMERIC_COMPACTION_MODE_LATCH: case BEGIN_MACRO_PDF417_CONTROL_BLOCK: case BEGIN_MACRO_PDF417_OPTIONAL_FIELD: case MACRO_PDF417_TERMINATOR: codeIndex--; end = true; break; case MODE_SHIFT_TO_BYTE_COMPACTION_MODE: // The Mode Shift codeword 913 shall cause a temporary // switch from Text Compaction mode to Byte Compaction mode. // This switch shall be in effect for only the next codeword, // after which the mode shall revert to the prevailing sub-mode // of the Text Compaction mode. Codeword 913 is only available // in Text Compaction mode; its use is described in 5.4.2.4. textCompactionData[index] = MODE_SHIFT_TO_BYTE_COMPACTION_MODE; code = codewords[codeIndex++]; byteCompactionData[index] = code; index++; break; } } } decodeTextCompaction(textCompactionData, byteCompactionData, index, result); return codeIndex; }
[ "private", "static", "int", "textCompaction", "(", "int", "[", "]", "codewords", ",", "int", "codeIndex", ",", "StringBuilder", "result", ")", "{", "// 2 character per codeword", "int", "[", "]", "textCompactionData", "=", "new", "int", "[", "(", "codewords", "[", "0", "]", "-", "codeIndex", ")", "*", "2", "]", ";", "// Used to hold the byte compaction value if there is a mode shift", "int", "[", "]", "byteCompactionData", "=", "new", "int", "[", "(", "codewords", "[", "0", "]", "-", "codeIndex", ")", "*", "2", "]", ";", "int", "index", "=", "0", ";", "boolean", "end", "=", "false", ";", "while", "(", "(", "codeIndex", "<", "codewords", "[", "0", "]", ")", "&&", "!", "end", ")", "{", "int", "code", "=", "codewords", "[", "codeIndex", "++", "]", ";", "if", "(", "code", "<", "TEXT_COMPACTION_MODE_LATCH", ")", "{", "textCompactionData", "[", "index", "]", "=", "code", "/", "30", ";", "textCompactionData", "[", "index", "+", "1", "]", "=", "code", "%", "30", ";", "index", "+=", "2", ";", "}", "else", "{", "switch", "(", "code", ")", "{", "case", "TEXT_COMPACTION_MODE_LATCH", ":", "// reinitialize text compaction mode to alpha sub mode", "textCompactionData", "[", "index", "++", "]", "=", "TEXT_COMPACTION_MODE_LATCH", ";", "break", ";", "case", "BYTE_COMPACTION_MODE_LATCH", ":", "case", "BYTE_COMPACTION_MODE_LATCH_6", ":", "case", "NUMERIC_COMPACTION_MODE_LATCH", ":", "case", "BEGIN_MACRO_PDF417_CONTROL_BLOCK", ":", "case", "BEGIN_MACRO_PDF417_OPTIONAL_FIELD", ":", "case", "MACRO_PDF417_TERMINATOR", ":", "codeIndex", "--", ";", "end", "=", "true", ";", "break", ";", "case", "MODE_SHIFT_TO_BYTE_COMPACTION_MODE", ":", "// The Mode Shift codeword 913 shall cause a temporary", "// switch from Text Compaction mode to Byte Compaction mode.", "// This switch shall be in effect for only the next codeword,", "// after which the mode shall revert to the prevailing sub-mode", "// of the Text Compaction mode. Codeword 913 is only available", "// in Text Compaction mode; its use is described in 5.4.2.4.", "textCompactionData", "[", "index", "]", "=", "MODE_SHIFT_TO_BYTE_COMPACTION_MODE", ";", "code", "=", "codewords", "[", "codeIndex", "++", "]", ";", "byteCompactionData", "[", "index", "]", "=", "code", ";", "index", "++", ";", "break", ";", "}", "}", "}", "decodeTextCompaction", "(", "textCompactionData", ",", "byteCompactionData", ",", "index", ",", "result", ")", ";", "return", "codeIndex", ";", "}" ]
Text Compaction mode (see 5.4.1.5) permits all printable ASCII characters to be encoded, i.e. values 32 - 126 inclusive in accordance with ISO/IEC 646 (IRV), as well as selected control characters. @param codewords The array of codewords (data + error) @param codeIndex The current index into the codeword array. @param result The decoded data is appended to the result. @return The next index into the codeword array.
[ "Text", "Compaction", "mode", "(", "see", "5", ".", "4", ".", "1", ".", "5", ")", "permits", "all", "printable", "ASCII", "characters", "to", "be", "encoded", "i", ".", "e", ".", "values", "32", "-", "126", "inclusive", "in", "accordance", "with", "ISO", "/", "IEC", "646", "(", "IRV", ")", "as", "well", "as", "selected", "control", "characters", "." ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java#L266-L312
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java
DateUtils.parseEndingDateOrDateTime
@CheckForNull public static Date parseEndingDateOrDateTime(@Nullable String stringDate) { """ Return the datetime if @param stringDate is a datetime, date + 1 day if stringDate is a date. So '2016-09-01' would return a date equivalent to '2016-09-02T00:00:00+0000' in GMT (Warning: relies on default timezone!) @return the datetime, {@code null} if stringDate is null @throws IllegalArgumentException if stringDate is not a correctly formed date or datetime @see #parseDateOrDateTime(String) @since 6.1 """ if (stringDate == null) { return null; } Date date = parseDateTimeQuietly(stringDate); if (date != null) { return date; } date = parseDateQuietly(stringDate); checkArgument(date != null, "Date '%s' cannot be parsed as either a date or date+time", stringDate); return addDays(date, 1); }
java
@CheckForNull public static Date parseEndingDateOrDateTime(@Nullable String stringDate) { if (stringDate == null) { return null; } Date date = parseDateTimeQuietly(stringDate); if (date != null) { return date; } date = parseDateQuietly(stringDate); checkArgument(date != null, "Date '%s' cannot be parsed as either a date or date+time", stringDate); return addDays(date, 1); }
[ "@", "CheckForNull", "public", "static", "Date", "parseEndingDateOrDateTime", "(", "@", "Nullable", "String", "stringDate", ")", "{", "if", "(", "stringDate", "==", "null", ")", "{", "return", "null", ";", "}", "Date", "date", "=", "parseDateTimeQuietly", "(", "stringDate", ")", ";", "if", "(", "date", "!=", "null", ")", "{", "return", "date", ";", "}", "date", "=", "parseDateQuietly", "(", "stringDate", ")", ";", "checkArgument", "(", "date", "!=", "null", ",", "\"Date '%s' cannot be parsed as either a date or date+time\"", ",", "stringDate", ")", ";", "return", "addDays", "(", "date", ",", "1", ")", ";", "}" ]
Return the datetime if @param stringDate is a datetime, date + 1 day if stringDate is a date. So '2016-09-01' would return a date equivalent to '2016-09-02T00:00:00+0000' in GMT (Warning: relies on default timezone!) @return the datetime, {@code null} if stringDate is null @throws IllegalArgumentException if stringDate is not a correctly formed date or datetime @see #parseDateOrDateTime(String) @since 6.1
[ "Return", "the", "datetime", "if", "@param", "stringDate", "is", "a", "datetime", "date", "+", "1", "day", "if", "stringDate", "is", "a", "date", ".", "So", "2016", "-", "09", "-", "01", "would", "return", "a", "date", "equivalent", "to", "2016", "-", "09", "-", "02T00", ":", "00", ":", "00", "+", "0000", "in", "GMT", "(", "Warning", ":", "relies", "on", "default", "timezone!", ")" ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java#L272-L287
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/locale/InternalLocaleBuilder.java
InternalLocaleBuilder.removePrivateuseVariant
static String removePrivateuseVariant(String privuseVal) { """ /* Remove special private use subtag sequence identified by "lvariant" and return the rest. Only used by LocaleExtensions """ StringTokenIterator itr = new StringTokenIterator(privuseVal, LanguageTag.SEP); // Note: privateuse value "abc-lvariant" is unchanged // because no subtags after "lvariant". int prefixStart = -1; boolean sawPrivuseVar = false; while (!itr.isDone()) { if (prefixStart != -1) { // Note: privateuse value "abc-lvariant" is unchanged // because no subtags after "lvariant". sawPrivuseVar = true; break; } if (AsciiUtil.caseIgnoreMatch(itr.current(), LanguageTag.PRIVUSE_VARIANT_PREFIX)) { prefixStart = itr.currentStart(); } itr.next(); } if (!sawPrivuseVar) { return privuseVal; } assert(prefixStart == 0 || prefixStart > 1); return (prefixStart == 0) ? null : privuseVal.substring(0, prefixStart -1); }
java
static String removePrivateuseVariant(String privuseVal) { StringTokenIterator itr = new StringTokenIterator(privuseVal, LanguageTag.SEP); // Note: privateuse value "abc-lvariant" is unchanged // because no subtags after "lvariant". int prefixStart = -1; boolean sawPrivuseVar = false; while (!itr.isDone()) { if (prefixStart != -1) { // Note: privateuse value "abc-lvariant" is unchanged // because no subtags after "lvariant". sawPrivuseVar = true; break; } if (AsciiUtil.caseIgnoreMatch(itr.current(), LanguageTag.PRIVUSE_VARIANT_PREFIX)) { prefixStart = itr.currentStart(); } itr.next(); } if (!sawPrivuseVar) { return privuseVal; } assert(prefixStart == 0 || prefixStart > 1); return (prefixStart == 0) ? null : privuseVal.substring(0, prefixStart -1); }
[ "static", "String", "removePrivateuseVariant", "(", "String", "privuseVal", ")", "{", "StringTokenIterator", "itr", "=", "new", "StringTokenIterator", "(", "privuseVal", ",", "LanguageTag", ".", "SEP", ")", ";", "// Note: privateuse value \"abc-lvariant\" is unchanged", "// because no subtags after \"lvariant\".", "int", "prefixStart", "=", "-", "1", ";", "boolean", "sawPrivuseVar", "=", "false", ";", "while", "(", "!", "itr", ".", "isDone", "(", ")", ")", "{", "if", "(", "prefixStart", "!=", "-", "1", ")", "{", "// Note: privateuse value \"abc-lvariant\" is unchanged", "// because no subtags after \"lvariant\".", "sawPrivuseVar", "=", "true", ";", "break", ";", "}", "if", "(", "AsciiUtil", ".", "caseIgnoreMatch", "(", "itr", ".", "current", "(", ")", ",", "LanguageTag", ".", "PRIVUSE_VARIANT_PREFIX", ")", ")", "{", "prefixStart", "=", "itr", ".", "currentStart", "(", ")", ";", "}", "itr", ".", "next", "(", ")", ";", "}", "if", "(", "!", "sawPrivuseVar", ")", "{", "return", "privuseVal", ";", "}", "assert", "(", "prefixStart", "==", "0", "||", "prefixStart", ">", "1", ")", ";", "return", "(", "prefixStart", "==", "0", ")", "?", "null", ":", "privuseVal", ".", "substring", "(", "0", ",", "prefixStart", "-", "1", ")", ";", "}" ]
/* Remove special private use subtag sequence identified by "lvariant" and return the rest. Only used by LocaleExtensions
[ "/", "*", "Remove", "special", "private", "use", "subtag", "sequence", "identified", "by", "lvariant", "and", "return", "the", "rest", ".", "Only", "used", "by", "LocaleExtensions" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/locale/InternalLocaleBuilder.java#L513-L539
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.writeResource
public void writeResource(CmsDbContext dbc, CmsResource resource) throws CmsException { """ Writes a resource to the OpenCms VFS.<p> @param dbc the current database context @param resource the resource to write @throws CmsException if something goes wrong """ // access was granted - write the resource resource.setUserLastModified(dbc.currentUser().getId()); CmsUUID projectId = ((dbc.getProjectId() == null) || dbc.getProjectId().isNullUUID()) ? dbc.currentProject().getUuid() : dbc.getProjectId(); getVfsDriver(dbc).writeResource(dbc, projectId, resource, UPDATE_RESOURCE_STATE); // make sure the written resource has the state correctly set if (resource.getState().isUnchanged()) { resource.setState(CmsResource.STATE_CHANGED); } // delete in content relations if the new type is not parseable if (!(OpenCms.getResourceManager().getResourceType(resource.getTypeId()) instanceof I_CmsLinkParseable)) { deleteRelationsWithSiblings(dbc, resource); } // update the cache m_monitor.clearResourceCache(); Map<String, Object> data = new HashMap<String, Object>(2); data.put(I_CmsEventListener.KEY_RESOURCE, resource); data.put(I_CmsEventListener.KEY_CHANGE, new Integer(CHANGED_RESOURCE)); OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_RESOURCE_MODIFIED, data)); }
java
public void writeResource(CmsDbContext dbc, CmsResource resource) throws CmsException { // access was granted - write the resource resource.setUserLastModified(dbc.currentUser().getId()); CmsUUID projectId = ((dbc.getProjectId() == null) || dbc.getProjectId().isNullUUID()) ? dbc.currentProject().getUuid() : dbc.getProjectId(); getVfsDriver(dbc).writeResource(dbc, projectId, resource, UPDATE_RESOURCE_STATE); // make sure the written resource has the state correctly set if (resource.getState().isUnchanged()) { resource.setState(CmsResource.STATE_CHANGED); } // delete in content relations if the new type is not parseable if (!(OpenCms.getResourceManager().getResourceType(resource.getTypeId()) instanceof I_CmsLinkParseable)) { deleteRelationsWithSiblings(dbc, resource); } // update the cache m_monitor.clearResourceCache(); Map<String, Object> data = new HashMap<String, Object>(2); data.put(I_CmsEventListener.KEY_RESOURCE, resource); data.put(I_CmsEventListener.KEY_CHANGE, new Integer(CHANGED_RESOURCE)); OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_RESOURCE_MODIFIED, data)); }
[ "public", "void", "writeResource", "(", "CmsDbContext", "dbc", ",", "CmsResource", "resource", ")", "throws", "CmsException", "{", "// access was granted - write the resource", "resource", ".", "setUserLastModified", "(", "dbc", ".", "currentUser", "(", ")", ".", "getId", "(", ")", ")", ";", "CmsUUID", "projectId", "=", "(", "(", "dbc", ".", "getProjectId", "(", ")", "==", "null", ")", "||", "dbc", ".", "getProjectId", "(", ")", ".", "isNullUUID", "(", ")", ")", "?", "dbc", ".", "currentProject", "(", ")", ".", "getUuid", "(", ")", ":", "dbc", ".", "getProjectId", "(", ")", ";", "getVfsDriver", "(", "dbc", ")", ".", "writeResource", "(", "dbc", ",", "projectId", ",", "resource", ",", "UPDATE_RESOURCE_STATE", ")", ";", "// make sure the written resource has the state correctly set", "if", "(", "resource", ".", "getState", "(", ")", ".", "isUnchanged", "(", ")", ")", "{", "resource", ".", "setState", "(", "CmsResource", ".", "STATE_CHANGED", ")", ";", "}", "// delete in content relations if the new type is not parseable", "if", "(", "!", "(", "OpenCms", ".", "getResourceManager", "(", ")", ".", "getResourceType", "(", "resource", ".", "getTypeId", "(", ")", ")", "instanceof", "I_CmsLinkParseable", ")", ")", "{", "deleteRelationsWithSiblings", "(", "dbc", ",", "resource", ")", ";", "}", "// update the cache", "m_monitor", ".", "clearResourceCache", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "data", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", "2", ")", ";", "data", ".", "put", "(", "I_CmsEventListener", ".", "KEY_RESOURCE", ",", "resource", ")", ";", "data", ".", "put", "(", "I_CmsEventListener", ".", "KEY_CHANGE", ",", "new", "Integer", "(", "CHANGED_RESOURCE", ")", ")", ";", "OpenCms", ".", "fireCmsEvent", "(", "new", "CmsEvent", "(", "I_CmsEventListener", ".", "EVENT_RESOURCE_MODIFIED", ",", "data", ")", ")", ";", "}" ]
Writes a resource to the OpenCms VFS.<p> @param dbc the current database context @param resource the resource to write @throws CmsException if something goes wrong
[ "Writes", "a", "resource", "to", "the", "OpenCms", "VFS", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L10142-L10168
BlueBrain/bluima
modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/types/Cooccurrence.java
Cooccurrence.setSecondIds
public void setSecondIds(int i, String v) { """ indexed setter for secondIds - sets an indexed value - a list of string ids to identify the second occurrence @generated @param i index in the array to set @param v value to set into the array """ if (Cooccurrence_Type.featOkTst && ((Cooccurrence_Type)jcasType).casFeat_secondIds == null) jcasType.jcas.throwFeatMissing("secondIds", "ch.epfl.bbp.uima.types.Cooccurrence"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Cooccurrence_Type)jcasType).casFeatCode_secondIds), i); jcasType.ll_cas.ll_setStringArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Cooccurrence_Type)jcasType).casFeatCode_secondIds), i, v);}
java
public void setSecondIds(int i, String v) { if (Cooccurrence_Type.featOkTst && ((Cooccurrence_Type)jcasType).casFeat_secondIds == null) jcasType.jcas.throwFeatMissing("secondIds", "ch.epfl.bbp.uima.types.Cooccurrence"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Cooccurrence_Type)jcasType).casFeatCode_secondIds), i); jcasType.ll_cas.ll_setStringArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Cooccurrence_Type)jcasType).casFeatCode_secondIds), i, v);}
[ "public", "void", "setSecondIds", "(", "int", "i", ",", "String", "v", ")", "{", "if", "(", "Cooccurrence_Type", ".", "featOkTst", "&&", "(", "(", "Cooccurrence_Type", ")", "jcasType", ")", ".", "casFeat_secondIds", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"secondIds\"", ",", "\"ch.epfl.bbp.uima.types.Cooccurrence\"", ")", ";", "jcasType", ".", "jcas", ".", "checkArrayBounds", "(", "jcasType", ".", "ll_cas", ".", "ll_getRefValue", "(", "addr", ",", "(", "(", "Cooccurrence_Type", ")", "jcasType", ")", ".", "casFeatCode_secondIds", ")", ",", "i", ")", ";", "jcasType", ".", "ll_cas", ".", "ll_setStringArrayValue", "(", "jcasType", ".", "ll_cas", ".", "ll_getRefValue", "(", "addr", ",", "(", "(", "Cooccurrence_Type", ")", "jcasType", ")", ".", "casFeatCode_secondIds", ")", ",", "i", ",", "v", ")", ";", "}" ]
indexed setter for secondIds - sets an indexed value - a list of string ids to identify the second occurrence @generated @param i index in the array to set @param v value to set into the array
[ "indexed", "setter", "for", "secondIds", "-", "sets", "an", "indexed", "value", "-", "a", "list", "of", "string", "ids", "to", "identify", "the", "second", "occurrence" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/types/Cooccurrence.java#L249-L253
liferay/com-liferay-commerce
commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListItemPersistenceImpl.java
CommerceWishListItemPersistenceImpl.removeByCW_CPI
@Override public void removeByCW_CPI(long commerceWishListId, String CPInstanceUuid) { """ Removes all the commerce wish list items where commerceWishListId = &#63; and CPInstanceUuid = &#63; from the database. @param commerceWishListId the commerce wish list ID @param CPInstanceUuid the cp instance uuid """ for (CommerceWishListItem commerceWishListItem : findByCW_CPI( commerceWishListId, CPInstanceUuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceWishListItem); } }
java
@Override public void removeByCW_CPI(long commerceWishListId, String CPInstanceUuid) { for (CommerceWishListItem commerceWishListItem : findByCW_CPI( commerceWishListId, CPInstanceUuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceWishListItem); } }
[ "@", "Override", "public", "void", "removeByCW_CPI", "(", "long", "commerceWishListId", ",", "String", "CPInstanceUuid", ")", "{", "for", "(", "CommerceWishListItem", "commerceWishListItem", ":", "findByCW_CPI", "(", "commerceWishListId", ",", "CPInstanceUuid", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ")", "{", "remove", "(", "commerceWishListItem", ")", ";", "}", "}" ]
Removes all the commerce wish list items where commerceWishListId = &#63; and CPInstanceUuid = &#63; from the database. @param commerceWishListId the commerce wish list ID @param CPInstanceUuid the cp instance uuid
[ "Removes", "all", "the", "commerce", "wish", "list", "items", "where", "commerceWishListId", "=", "&#63", ";", "and", "CPInstanceUuid", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListItemPersistenceImpl.java#L2226-L2233
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.getStorageAccountAsync
public Observable<StorageBundle> getStorageAccountAsync(String vaultBaseUrl, String storageAccountName) { """ Gets information about a specified storage account. This operation requires the storage/get permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the StorageBundle object """ return getStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName).map(new Func1<ServiceResponse<StorageBundle>, StorageBundle>() { @Override public StorageBundle call(ServiceResponse<StorageBundle> response) { return response.body(); } }); }
java
public Observable<StorageBundle> getStorageAccountAsync(String vaultBaseUrl, String storageAccountName) { return getStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName).map(new Func1<ServiceResponse<StorageBundle>, StorageBundle>() { @Override public StorageBundle call(ServiceResponse<StorageBundle> response) { return response.body(); } }); }
[ "public", "Observable", "<", "StorageBundle", ">", "getStorageAccountAsync", "(", "String", "vaultBaseUrl", ",", "String", "storageAccountName", ")", "{", "return", "getStorageAccountWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "storageAccountName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "StorageBundle", ">", ",", "StorageBundle", ">", "(", ")", "{", "@", "Override", "public", "StorageBundle", "call", "(", "ServiceResponse", "<", "StorageBundle", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets information about a specified storage account. This operation requires the storage/get permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the StorageBundle object
[ "Gets", "information", "about", "a", "specified", "storage", "account", ".", "This", "operation", "requires", "the", "storage", "/", "get", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L9806-L9813
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/Http2Exception.java
Http2Exception.connectionError
public static Http2Exception connectionError(Http2Error error, String fmt, Object... args) { """ Use if an error has occurred which can not be isolated to a single stream, but instead applies to the entire connection. @param error The type of error as defined by the HTTP/2 specification. @param fmt String with the content and format for the additional debug data. @param args Objects which fit into the format defined by {@code fmt}. @return An exception which can be translated into a HTTP/2 error. """ return new Http2Exception(error, String.format(fmt, args)); }
java
public static Http2Exception connectionError(Http2Error error, String fmt, Object... args) { return new Http2Exception(error, String.format(fmt, args)); }
[ "public", "static", "Http2Exception", "connectionError", "(", "Http2Error", "error", ",", "String", "fmt", ",", "Object", "...", "args", ")", "{", "return", "new", "Http2Exception", "(", "error", ",", "String", ".", "format", "(", "fmt", ",", "args", ")", ")", ";", "}" ]
Use if an error has occurred which can not be isolated to a single stream, but instead applies to the entire connection. @param error The type of error as defined by the HTTP/2 specification. @param fmt String with the content and format for the additional debug data. @param args Objects which fit into the format defined by {@code fmt}. @return An exception which can be translated into a HTTP/2 error.
[ "Use", "if", "an", "error", "has", "occurred", "which", "can", "not", "be", "isolated", "to", "a", "single", "stream", "but", "instead", "applies", "to", "the", "entire", "connection", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2Exception.java#L84-L86
trustathsh/ifmapj
src/main/java/de/hshannover/f4/trust/ifmapj/identifier/Identifiers.java
Identifiers.createArPubPrefixed
public static AccessRequest createArPubPrefixed(String name, String pubId, String admDom) { """ Create an access-request identifier with with "pubId:name" as name and the given administrative-domain. @param name the name of the access-request @param admDom the administrative-domain of the access-request @param pubId the publisher id @return the new {@link AccessRequest} instance """ return new AccessRequest(pubId + ":" + name, admDom); }
java
public static AccessRequest createArPubPrefixed(String name, String pubId, String admDom) { return new AccessRequest(pubId + ":" + name, admDom); }
[ "public", "static", "AccessRequest", "createArPubPrefixed", "(", "String", "name", ",", "String", "pubId", ",", "String", "admDom", ")", "{", "return", "new", "AccessRequest", "(", "pubId", "+", "\":\"", "+", "name", ",", "admDom", ")", ";", "}" ]
Create an access-request identifier with with "pubId:name" as name and the given administrative-domain. @param name the name of the access-request @param admDom the administrative-domain of the access-request @param pubId the publisher id @return the new {@link AccessRequest} instance
[ "Create", "an", "access", "-", "request", "identifier", "with", "with", "pubId", ":", "name", "as", "name", "and", "the", "given", "administrative", "-", "domain", "." ]
train
https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/identifier/Identifiers.java#L419-L422
TGIO/RNCryptorNative
rncryptor-native/src/main/java/tgio/rncryptor/RNCryptorNative.java
RNCryptorNative.decryptAsync
public static void decryptAsync(String encrypted, String password, RNCryptorNativeCallback RNCryptorNativeCallback) { """ Decrypts encrypted base64 string and returns via callback @param encrypted base64 string @param password strong generated password @param RNCryptorNativeCallback just a callback """ String decrypted; try { decrypted = new RNCryptorNative().decrypt(encrypted, password); RNCryptorNativeCallback.done(decrypted, null); } catch (Exception e) { RNCryptorNativeCallback.done(null, e); } }
java
public static void decryptAsync(String encrypted, String password, RNCryptorNativeCallback RNCryptorNativeCallback) { String decrypted; try { decrypted = new RNCryptorNative().decrypt(encrypted, password); RNCryptorNativeCallback.done(decrypted, null); } catch (Exception e) { RNCryptorNativeCallback.done(null, e); } }
[ "public", "static", "void", "decryptAsync", "(", "String", "encrypted", ",", "String", "password", ",", "RNCryptorNativeCallback", "RNCryptorNativeCallback", ")", "{", "String", "decrypted", ";", "try", "{", "decrypted", "=", "new", "RNCryptorNative", "(", ")", ".", "decrypt", "(", "encrypted", ",", "password", ")", ";", "RNCryptorNativeCallback", ".", "done", "(", "decrypted", ",", "null", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "RNCryptorNativeCallback", ".", "done", "(", "null", ",", "e", ")", ";", "}", "}" ]
Decrypts encrypted base64 string and returns via callback @param encrypted base64 string @param password strong generated password @param RNCryptorNativeCallback just a callback
[ "Decrypts", "encrypted", "base64", "string", "and", "returns", "via", "callback" ]
train
https://github.com/TGIO/RNCryptorNative/blob/5209f10b988e4033c0b769a40b0d6cc99ea16af7/rncryptor-native/src/main/java/tgio/rncryptor/RNCryptorNative.java#L64-L72
nextreports/nextreports-engine
src/ro/nextreports/engine/exporter/util/XlsUtil.java
XlsUtil.copyToSheet
public static int copyToSheet(HSSFSheet parentSheet, int parentSheetRow, int parentSheetColumn, HSSFSheet sheet) { """ Copy a sheet to another sheet at a specific (row, column) position @param parentSheet the sheet to copy into @param parentSheetRow the row inside parentSheet where we start to copy @param parentSheetColumn the column inside parentSheet where we start to copy @param sheet the sheet that is copied @return column number """ return copyToSheet(parentSheet, parentSheetRow, parentSheetColumn, sheet, true); }
java
public static int copyToSheet(HSSFSheet parentSheet, int parentSheetRow, int parentSheetColumn, HSSFSheet sheet) { return copyToSheet(parentSheet, parentSheetRow, parentSheetColumn, sheet, true); }
[ "public", "static", "int", "copyToSheet", "(", "HSSFSheet", "parentSheet", ",", "int", "parentSheetRow", ",", "int", "parentSheetColumn", ",", "HSSFSheet", "sheet", ")", "{", "return", "copyToSheet", "(", "parentSheet", ",", "parentSheetRow", ",", "parentSheetColumn", ",", "sheet", ",", "true", ")", ";", "}" ]
Copy a sheet to another sheet at a specific (row, column) position @param parentSheet the sheet to copy into @param parentSheetRow the row inside parentSheet where we start to copy @param parentSheetColumn the column inside parentSheet where we start to copy @param sheet the sheet that is copied @return column number
[ "Copy", "a", "sheet", "to", "another", "sheet", "at", "a", "specific", "(", "row", "column", ")", "position" ]
train
https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/exporter/util/XlsUtil.java#L47-L49
keyboardsurfer/Crouton
library/src/main/java/de/keyboardsurfer/android/widget/crouton/Crouton.java
Crouton.make
public static Crouton make(Activity activity, View customView, int viewGroupResId) { """ Creates a {@link Crouton} with provided text-resource and style for a given activity. @param activity The {@link Activity} that represents the context in which the Crouton should exist. @param customView The custom {@link View} to display @param viewGroupResId The resource id of the {@link ViewGroup} that this {@link Crouton} should be added to. @return The created {@link Crouton}. """ return new Crouton(activity, customView, (ViewGroup) activity.findViewById(viewGroupResId)); }
java
public static Crouton make(Activity activity, View customView, int viewGroupResId) { return new Crouton(activity, customView, (ViewGroup) activity.findViewById(viewGroupResId)); }
[ "public", "static", "Crouton", "make", "(", "Activity", "activity", ",", "View", "customView", ",", "int", "viewGroupResId", ")", "{", "return", "new", "Crouton", "(", "activity", ",", "customView", ",", "(", "ViewGroup", ")", "activity", ".", "findViewById", "(", "viewGroupResId", ")", ")", ";", "}" ]
Creates a {@link Crouton} with provided text-resource and style for a given activity. @param activity The {@link Activity} that represents the context in which the Crouton should exist. @param customView The custom {@link View} to display @param viewGroupResId The resource id of the {@link ViewGroup} that this {@link Crouton} should be added to. @return The created {@link Crouton}.
[ "Creates", "a", "{", "@link", "Crouton", "}", "with", "provided", "text", "-", "resource", "and", "style", "for", "a", "given", "activity", "." ]
train
https://github.com/keyboardsurfer/Crouton/blob/7806b15e4d52793e1f5aeaa4a55b1e220289e619/library/src/main/java/de/keyboardsurfer/android/widget/crouton/Crouton.java#L341-L343
FudanNLP/fnlp
fnlp-core/src/main/java/org/fnlp/nlp/langmodel/lda/LdaGibbsSampler.java
LdaGibbsSampler.sampleFullConditional
private int sampleFullConditional(int m, int n) { """ Sample a topic z_i from the full conditional distribution: p(z_i = j | z_-i, w) = (n_-i,j(w_i) + beta)/(n_-i,j(.) + W * beta) * (n_-i,j(d_i) + alpha)/(n_-i,.(d_i) + K * alpha) @param m document @param n word """ // remove z_i from the count variables int topic = z[m][n]; word_topic_matrix[documents[m][n]][topic]--; nd[m][topic]--; nwsum[topic]--; ndsum[m]--; // do multinomial sampling via cumulative method: float[] p = new float[K]; for (int k = 0; k < K; k++) { p[k] = (word_topic_matrix[documents[m][n]][k] + beta) / (nwsum[k] + V * beta) * (nd[m][k] + alpha) / (ndsum[m] + K * alpha); } topic = drawFromProbability(p); // add newly estimated z_i to count variables word_topic_matrix[documents[m][n]][topic]++; nd[m][topic]++; nwsum[topic]++; ndsum[m]++; return topic; }
java
private int sampleFullConditional(int m, int n) { // remove z_i from the count variables int topic = z[m][n]; word_topic_matrix[documents[m][n]][topic]--; nd[m][topic]--; nwsum[topic]--; ndsum[m]--; // do multinomial sampling via cumulative method: float[] p = new float[K]; for (int k = 0; k < K; k++) { p[k] = (word_topic_matrix[documents[m][n]][k] + beta) / (nwsum[k] + V * beta) * (nd[m][k] + alpha) / (ndsum[m] + K * alpha); } topic = drawFromProbability(p); // add newly estimated z_i to count variables word_topic_matrix[documents[m][n]][topic]++; nd[m][topic]++; nwsum[topic]++; ndsum[m]++; return topic; }
[ "private", "int", "sampleFullConditional", "(", "int", "m", ",", "int", "n", ")", "{", "// remove z_i from the count variables\r", "int", "topic", "=", "z", "[", "m", "]", "[", "n", "]", ";", "word_topic_matrix", "[", "documents", "[", "m", "]", "[", "n", "]", "]", "[", "topic", "]", "--", ";", "nd", "[", "m", "]", "[", "topic", "]", "--", ";", "nwsum", "[", "topic", "]", "--", ";", "ndsum", "[", "m", "]", "--", ";", "// do multinomial sampling via cumulative method:\r", "float", "[", "]", "p", "=", "new", "float", "[", "K", "]", ";", "for", "(", "int", "k", "=", "0", ";", "k", "<", "K", ";", "k", "++", ")", "{", "p", "[", "k", "]", "=", "(", "word_topic_matrix", "[", "documents", "[", "m", "]", "[", "n", "]", "]", "[", "k", "]", "+", "beta", ")", "/", "(", "nwsum", "[", "k", "]", "+", "V", "*", "beta", ")", "*", "(", "nd", "[", "m", "]", "[", "k", "]", "+", "alpha", ")", "/", "(", "ndsum", "[", "m", "]", "+", "K", "*", "alpha", ")", ";", "}", "topic", "=", "drawFromProbability", "(", "p", ")", ";", "// add newly estimated z_i to count variables\r", "word_topic_matrix", "[", "documents", "[", "m", "]", "[", "n", "]", "]", "[", "topic", "]", "++", ";", "nd", "[", "m", "]", "[", "topic", "]", "++", ";", "nwsum", "[", "topic", "]", "++", ";", "ndsum", "[", "m", "]", "++", ";", "return", "topic", ";", "}" ]
Sample a topic z_i from the full conditional distribution: p(z_i = j | z_-i, w) = (n_-i,j(w_i) + beta)/(n_-i,j(.) + W * beta) * (n_-i,j(d_i) + alpha)/(n_-i,.(d_i) + K * alpha) @param m document @param n word
[ "Sample", "a", "topic", "z_i", "from", "the", "full", "conditional", "distribution", ":", "p", "(", "z_i", "=", "j", "|", "z_", "-", "i", "w", ")", "=", "(", "n_", "-", "i", "j", "(", "w_i", ")", "+", "beta", ")", "/", "(", "n_", "-", "i", "j", "(", ".", ")", "+", "W", "*", "beta", ")", "*", "(", "n_", "-", "i", "j", "(", "d_i", ")", "+", "alpha", ")", "/", "(", "n_", "-", "i", ".", "(", "d_i", ")", "+", "K", "*", "alpha", ")" ]
train
https://github.com/FudanNLP/fnlp/blob/ce258f3e4a5add2ba0b5e4cbac7cab2190af6659/fnlp-core/src/main/java/org/fnlp/nlp/langmodel/lda/LdaGibbsSampler.java#L255-L280
OpenBEL/openbel-framework
org.openbel.framework.api/src/main/java/org/openbel/framework/api/Namespaces.java
Namespaces.findNamespaceHeader
public NamespaceHeader findNamespaceHeader(final String rloc) { """ Finds the {@link NamespaceHeader namespace header} for the namespace's {@link String resource location}. @param rloc namespace {@link String resource location}, which cannot be {@code null} @return {@link NamespaceHeader namespace header} or {@code null} if one is not found @throws InvalidArgument Thrown if {@code rloc} is {@code null} or empty """ if (noLength(rloc)) { throw new InvalidArgument("rloc", rloc); } return headers.get(rloc); }
java
public NamespaceHeader findNamespaceHeader(final String rloc) { if (noLength(rloc)) { throw new InvalidArgument("rloc", rloc); } return headers.get(rloc); }
[ "public", "NamespaceHeader", "findNamespaceHeader", "(", "final", "String", "rloc", ")", "{", "if", "(", "noLength", "(", "rloc", ")", ")", "{", "throw", "new", "InvalidArgument", "(", "\"rloc\"", ",", "rloc", ")", ";", "}", "return", "headers", ".", "get", "(", "rloc", ")", ";", "}" ]
Finds the {@link NamespaceHeader namespace header} for the namespace's {@link String resource location}. @param rloc namespace {@link String resource location}, which cannot be {@code null} @return {@link NamespaceHeader namespace header} or {@code null} if one is not found @throws InvalidArgument Thrown if {@code rloc} is {@code null} or empty
[ "Finds", "the", "{", "@link", "NamespaceHeader", "namespace", "header", "}", "for", "the", "namespace", "s", "{", "@link", "String", "resource", "location", "}", "." ]
train
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.api/src/main/java/org/openbel/framework/api/Namespaces.java#L114-L120
zandero/cmd
src/main/java/com/zandero/cmd/ConfigFileReader.java
ConfigFileReader.parse
private Settings parse(ArrayList<String> list, CommandBuilder builder) throws CommandLineException { """ Expects name = value in each line ignores lines starting with '#' or '//' @param list of strings """ Settings settings = new Settings(); if (list != null && list.size() > 0) { for (String line : list) { line = StringUtils.trimToNull(line); if (line != null && !isComment(line)) { String[] items = line.split("="); if (items.length == 2) { String name = items[0]; String value = items[1]; Pair<String, Object> found = parseAndAdd(builder, name, value); if (found != null) { settings.put(found.getKey(), found.getValue()); } } } } } return settings; }
java
private Settings parse(ArrayList<String> list, CommandBuilder builder) throws CommandLineException { Settings settings = new Settings(); if (list != null && list.size() > 0) { for (String line : list) { line = StringUtils.trimToNull(line); if (line != null && !isComment(line)) { String[] items = line.split("="); if (items.length == 2) { String name = items[0]; String value = items[1]; Pair<String, Object> found = parseAndAdd(builder, name, value); if (found != null) { settings.put(found.getKey(), found.getValue()); } } } } } return settings; }
[ "private", "Settings", "parse", "(", "ArrayList", "<", "String", ">", "list", ",", "CommandBuilder", "builder", ")", "throws", "CommandLineException", "{", "Settings", "settings", "=", "new", "Settings", "(", ")", ";", "if", "(", "list", "!=", "null", "&&", "list", ".", "size", "(", ")", ">", "0", ")", "{", "for", "(", "String", "line", ":", "list", ")", "{", "line", "=", "StringUtils", ".", "trimToNull", "(", "line", ")", ";", "if", "(", "line", "!=", "null", "&&", "!", "isComment", "(", "line", ")", ")", "{", "String", "[", "]", "items", "=", "line", ".", "split", "(", "\"=\"", ")", ";", "if", "(", "items", ".", "length", "==", "2", ")", "{", "String", "name", "=", "items", "[", "0", "]", ";", "String", "value", "=", "items", "[", "1", "]", ";", "Pair", "<", "String", ",", "Object", ">", "found", "=", "parseAndAdd", "(", "builder", ",", "name", ",", "value", ")", ";", "if", "(", "found", "!=", "null", ")", "{", "settings", ".", "put", "(", "found", ".", "getKey", "(", ")", ",", "found", ".", "getValue", "(", ")", ")", ";", "}", "}", "}", "}", "}", "return", "settings", ";", "}" ]
Expects name = value in each line ignores lines starting with '#' or '//' @param list of strings
[ "Expects", "name", "=", "value", "in", "each", "line", "ignores", "lines", "starting", "with", "#", "or", "//" ]
train
https://github.com/zandero/cmd/blob/cf0c3b0afdd413f9f52243164bdf28e1db3e523f/src/main/java/com/zandero/cmd/ConfigFileReader.java#L67-L94
landawn/AbacusUtil
src/com/landawn/abacus/util/PropertiesUtil.java
PropertiesUtil.xml2Java
public static void xml2Java(String xml, String srcPath, String packageName, String className, boolean isPublicField) { """ Generate java code by the specified xml. @param xml @param srcPath @param packageName @param className @param isPublicField """ xml2Java(IOUtil.string2InputStream(xml), srcPath, packageName, className, isPublicField); }
java
public static void xml2Java(String xml, String srcPath, String packageName, String className, boolean isPublicField) { xml2Java(IOUtil.string2InputStream(xml), srcPath, packageName, className, isPublicField); }
[ "public", "static", "void", "xml2Java", "(", "String", "xml", ",", "String", "srcPath", ",", "String", "packageName", ",", "String", "className", ",", "boolean", "isPublicField", ")", "{", "xml2Java", "(", "IOUtil", ".", "string2InputStream", "(", "xml", ")", ",", "srcPath", ",", "packageName", ",", "className", ",", "isPublicField", ")", ";", "}" ]
Generate java code by the specified xml. @param xml @param srcPath @param packageName @param className @param isPublicField
[ "Generate", "java", "code", "by", "the", "specified", "xml", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/PropertiesUtil.java#L824-L826
cdk/cdk
base/core/src/main/java/org/openscience/cdk/graph/Cycles.java
Cycles.getBond
private static IBond getBond(IAtomContainer container, EdgeToBondMap bondMap, int u, int v) { """ Obtain the bond between the atoms at index 'u' and 'v'. If the 'bondMap' is non-null it is used for direct lookup otherwise the slower linear lookup in 'container' is used. @param container a structure @param bondMap optimised map of atom indices to bond instances @param u an atom index @param v an atom index (connected to u) @return the bond between u and v """ if (bondMap != null) return bondMap.get(u, v); return container.getBond(container.getAtom(u), container.getAtom(v)); }
java
private static IBond getBond(IAtomContainer container, EdgeToBondMap bondMap, int u, int v) { if (bondMap != null) return bondMap.get(u, v); return container.getBond(container.getAtom(u), container.getAtom(v)); }
[ "private", "static", "IBond", "getBond", "(", "IAtomContainer", "container", ",", "EdgeToBondMap", "bondMap", ",", "int", "u", ",", "int", "v", ")", "{", "if", "(", "bondMap", "!=", "null", ")", "return", "bondMap", ".", "get", "(", "u", ",", "v", ")", ";", "return", "container", ".", "getBond", "(", "container", ".", "getAtom", "(", "u", ")", ",", "container", ".", "getAtom", "(", "v", ")", ")", ";", "}" ]
Obtain the bond between the atoms at index 'u' and 'v'. If the 'bondMap' is non-null it is used for direct lookup otherwise the slower linear lookup in 'container' is used. @param container a structure @param bondMap optimised map of atom indices to bond instances @param u an atom index @param v an atom index (connected to u) @return the bond between u and v
[ "Obtain", "the", "bond", "between", "the", "atoms", "at", "index", "u", "and", "v", ".", "If", "the", "bondMap", "is", "non", "-", "null", "it", "is", "used", "for", "direct", "lookup", "otherwise", "the", "slower", "linear", "lookup", "in", "container", "is", "used", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/core/src/main/java/org/openscience/cdk/graph/Cycles.java#L969-L972
steveohara/j2mod
src/main/java/com/ghgande/j2mod/modbus/facade/AbstractModbusMaster.java
AbstractModbusMaster.writeMultipleRegisters
public int writeMultipleRegisters(int unitId, int ref, Register[] registers) throws ModbusException { """ Writes a number of registers to the slave. @param unitId the slave unit id. @param ref the offset of the register to start writing to. @param registers a <tt>Register[]</tt> holding the values of the registers to be written. @return the number of registers that have been written. @throws ModbusException if an I/O error, a slave exception or a transaction error occurs. """ checkTransaction(); if (writeMultipleRegistersRequest == null) { writeMultipleRegistersRequest = new WriteMultipleRegistersRequest(); } writeMultipleRegistersRequest.setUnitID(unitId); writeMultipleRegistersRequest.setReference(ref); writeMultipleRegistersRequest.setRegisters(registers); transaction.setRequest(writeMultipleRegistersRequest); transaction.execute(); return ((WriteMultipleRegistersResponse) transaction.getResponse()).getWordCount(); }
java
public int writeMultipleRegisters(int unitId, int ref, Register[] registers) throws ModbusException { checkTransaction(); if (writeMultipleRegistersRequest == null) { writeMultipleRegistersRequest = new WriteMultipleRegistersRequest(); } writeMultipleRegistersRequest.setUnitID(unitId); writeMultipleRegistersRequest.setReference(ref); writeMultipleRegistersRequest.setRegisters(registers); transaction.setRequest(writeMultipleRegistersRequest); transaction.execute(); return ((WriteMultipleRegistersResponse) transaction.getResponse()).getWordCount(); }
[ "public", "int", "writeMultipleRegisters", "(", "int", "unitId", ",", "int", "ref", ",", "Register", "[", "]", "registers", ")", "throws", "ModbusException", "{", "checkTransaction", "(", ")", ";", "if", "(", "writeMultipleRegistersRequest", "==", "null", ")", "{", "writeMultipleRegistersRequest", "=", "new", "WriteMultipleRegistersRequest", "(", ")", ";", "}", "writeMultipleRegistersRequest", ".", "setUnitID", "(", "unitId", ")", ";", "writeMultipleRegistersRequest", ".", "setReference", "(", "ref", ")", ";", "writeMultipleRegistersRequest", ".", "setRegisters", "(", "registers", ")", ";", "transaction", ".", "setRequest", "(", "writeMultipleRegistersRequest", ")", ";", "transaction", ".", "execute", "(", ")", ";", "return", "(", "(", "WriteMultipleRegistersResponse", ")", "transaction", ".", "getResponse", "(", ")", ")", ".", "getWordCount", "(", ")", ";", "}" ]
Writes a number of registers to the slave. @param unitId the slave unit id. @param ref the offset of the register to start writing to. @param registers a <tt>Register[]</tt> holding the values of the registers to be written. @return the number of registers that have been written. @throws ModbusException if an I/O error, a slave exception or a transaction error occurs.
[ "Writes", "a", "number", "of", "registers", "to", "the", "slave", "." ]
train
https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/facade/AbstractModbusMaster.java#L280-L291
bwkimmel/java-util
src/main/java/ca/eandb/util/sql/DbUtil.java
DbUtil.queryInt
public static int queryInt(PreparedStatement stmt, int def) throws SQLException { """ Runs a SQL query that returns a single integer value. @param stmt The <code>PreparedStatement</code> to run. @param def The default value to return if the query returns no results. @return The value returned by the query, or <code>def</code> if the query returns no results. It is assumed that the query returns a result set consisting of a single row and column, and that this value is an integer. Any additional rows or columns returned will be ignored. @throws SQLException If an error occurs while attempting to communicate with the database. """ ResultSet rs = null; try { rs = stmt.executeQuery(); if (rs.next()) { int value = rs.getInt(1); if (!rs.wasNull()) { return value; } } return def; } finally { close(rs); } }
java
public static int queryInt(PreparedStatement stmt, int def) throws SQLException { ResultSet rs = null; try { rs = stmt.executeQuery(); if (rs.next()) { int value = rs.getInt(1); if (!rs.wasNull()) { return value; } } return def; } finally { close(rs); } }
[ "public", "static", "int", "queryInt", "(", "PreparedStatement", "stmt", ",", "int", "def", ")", "throws", "SQLException", "{", "ResultSet", "rs", "=", "null", ";", "try", "{", "rs", "=", "stmt", ".", "executeQuery", "(", ")", ";", "if", "(", "rs", ".", "next", "(", ")", ")", "{", "int", "value", "=", "rs", ".", "getInt", "(", "1", ")", ";", "if", "(", "!", "rs", ".", "wasNull", "(", ")", ")", "{", "return", "value", ";", "}", "}", "return", "def", ";", "}", "finally", "{", "close", "(", "rs", ")", ";", "}", "}" ]
Runs a SQL query that returns a single integer value. @param stmt The <code>PreparedStatement</code> to run. @param def The default value to return if the query returns no results. @return The value returned by the query, or <code>def</code> if the query returns no results. It is assumed that the query returns a result set consisting of a single row and column, and that this value is an integer. Any additional rows or columns returned will be ignored. @throws SQLException If an error occurs while attempting to communicate with the database.
[ "Runs", "a", "SQL", "query", "that", "returns", "a", "single", "integer", "value", "." ]
train
https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/sql/DbUtil.java#L109-L123
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/ProjectApi.java
ProjectApi.addHook
public ProjectHook addHook(String projectName, String url, ProjectHook enabledHooks, boolean enableSslVerification, String secretToken) throws GitLabApiException { """ Adds a hook to project. <pre><code>POST /projects/:id/hooks</code></pre> @param projectName the name of the project @param url the callback URL for the hook @param enabledHooks a ProjectHook instance specifying which hooks to enable @param enableSslVerification enable SSL verification @param secretToken the secret token to pass back to the hook @return the added ProjectHook instance @throws GitLabApiException if any exception occurs """ if (projectName == null) { return (null); } GitLabApiForm formData = new GitLabApiForm() .withParam("url", url, true) .withParam("push_events", enabledHooks.getPushEvents(), false) .withParam("issues_events", enabledHooks.getIssuesEvents(), false) .withParam("merge_requests_events", enabledHooks.getMergeRequestsEvents(), false) .withParam("tag_push_events", enabledHooks.getTagPushEvents(), false) .withParam("note_events", enabledHooks.getNoteEvents(), false) .withParam("job_events", enabledHooks.getJobEvents(), false) .withParam("pipeline_events", enabledHooks.getPipelineEvents(), false) .withParam("wiki_events", enabledHooks.getWikiPageEvents(), false) .withParam("enable_ssl_verification", enabledHooks.getEnableSslVerification()) .withParam("token", secretToken, false); Response response = post(Response.Status.CREATED, formData, "projects", projectName, "hooks"); return (response.readEntity(ProjectHook.class)); }
java
public ProjectHook addHook(String projectName, String url, ProjectHook enabledHooks, boolean enableSslVerification, String secretToken) throws GitLabApiException { if (projectName == null) { return (null); } GitLabApiForm formData = new GitLabApiForm() .withParam("url", url, true) .withParam("push_events", enabledHooks.getPushEvents(), false) .withParam("issues_events", enabledHooks.getIssuesEvents(), false) .withParam("merge_requests_events", enabledHooks.getMergeRequestsEvents(), false) .withParam("tag_push_events", enabledHooks.getTagPushEvents(), false) .withParam("note_events", enabledHooks.getNoteEvents(), false) .withParam("job_events", enabledHooks.getJobEvents(), false) .withParam("pipeline_events", enabledHooks.getPipelineEvents(), false) .withParam("wiki_events", enabledHooks.getWikiPageEvents(), false) .withParam("enable_ssl_verification", enabledHooks.getEnableSslVerification()) .withParam("token", secretToken, false); Response response = post(Response.Status.CREATED, formData, "projects", projectName, "hooks"); return (response.readEntity(ProjectHook.class)); }
[ "public", "ProjectHook", "addHook", "(", "String", "projectName", ",", "String", "url", ",", "ProjectHook", "enabledHooks", ",", "boolean", "enableSslVerification", ",", "String", "secretToken", ")", "throws", "GitLabApiException", "{", "if", "(", "projectName", "==", "null", ")", "{", "return", "(", "null", ")", ";", "}", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"url\"", ",", "url", ",", "true", ")", ".", "withParam", "(", "\"push_events\"", ",", "enabledHooks", ".", "getPushEvents", "(", ")", ",", "false", ")", ".", "withParam", "(", "\"issues_events\"", ",", "enabledHooks", ".", "getIssuesEvents", "(", ")", ",", "false", ")", ".", "withParam", "(", "\"merge_requests_events\"", ",", "enabledHooks", ".", "getMergeRequestsEvents", "(", ")", ",", "false", ")", ".", "withParam", "(", "\"tag_push_events\"", ",", "enabledHooks", ".", "getTagPushEvents", "(", ")", ",", "false", ")", ".", "withParam", "(", "\"note_events\"", ",", "enabledHooks", ".", "getNoteEvents", "(", ")", ",", "false", ")", ".", "withParam", "(", "\"job_events\"", ",", "enabledHooks", ".", "getJobEvents", "(", ")", ",", "false", ")", ".", "withParam", "(", "\"pipeline_events\"", ",", "enabledHooks", ".", "getPipelineEvents", "(", ")", ",", "false", ")", ".", "withParam", "(", "\"wiki_events\"", ",", "enabledHooks", ".", "getWikiPageEvents", "(", ")", ",", "false", ")", ".", "withParam", "(", "\"enable_ssl_verification\"", ",", "enabledHooks", ".", "getEnableSslVerification", "(", ")", ")", ".", "withParam", "(", "\"token\"", ",", "secretToken", ",", "false", ")", ";", "Response", "response", "=", "post", "(", "Response", ".", "Status", ".", "CREATED", ",", "formData", ",", "\"projects\"", ",", "projectName", ",", "\"hooks\"", ")", ";", "return", "(", "response", ".", "readEntity", "(", "ProjectHook", ".", "class", ")", ")", ";", "}" ]
Adds a hook to project. <pre><code>POST /projects/:id/hooks</code></pre> @param projectName the name of the project @param url the callback URL for the hook @param enabledHooks a ProjectHook instance specifying which hooks to enable @param enableSslVerification enable SSL verification @param secretToken the secret token to pass back to the hook @return the added ProjectHook instance @throws GitLabApiException if any exception occurs
[ "Adds", "a", "hook", "to", "project", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProjectApi.java#L1648-L1669
gallandarakhneorg/afc
advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/Path3ifx.java
Path3ifx.isMultiPartsProperty
public BooleanProperty isMultiPartsProperty() { """ Replies the isMultiParts property. @return the isMultiParts property. """ if (this.isMultipart == null) { this.isMultipart = new ReadOnlyBooleanWrapper(this, MathFXAttributeNames.IS_MULTIPARTS, false); this.isMultipart.bind(Bindings.createBooleanBinding(() -> { boolean foundOne = false; for (final PathElementType type : innerTypesProperty()) { if (type == PathElementType.MOVE_TO) { if (foundOne) { return true; } foundOne = true; } } return false; }, innerTypesProperty())); } return this.isMultipart; }
java
public BooleanProperty isMultiPartsProperty() { if (this.isMultipart == null) { this.isMultipart = new ReadOnlyBooleanWrapper(this, MathFXAttributeNames.IS_MULTIPARTS, false); this.isMultipart.bind(Bindings.createBooleanBinding(() -> { boolean foundOne = false; for (final PathElementType type : innerTypesProperty()) { if (type == PathElementType.MOVE_TO) { if (foundOne) { return true; } foundOne = true; } } return false; }, innerTypesProperty())); } return this.isMultipart; }
[ "public", "BooleanProperty", "isMultiPartsProperty", "(", ")", "{", "if", "(", "this", ".", "isMultipart", "==", "null", ")", "{", "this", ".", "isMultipart", "=", "new", "ReadOnlyBooleanWrapper", "(", "this", ",", "MathFXAttributeNames", ".", "IS_MULTIPARTS", ",", "false", ")", ";", "this", ".", "isMultipart", ".", "bind", "(", "Bindings", ".", "createBooleanBinding", "(", "(", ")", "->", "{", "boolean", "foundOne", "=", "false", ";", "for", "(", "final", "PathElementType", "type", ":", "innerTypesProperty", "(", ")", ")", "{", "if", "(", "type", "==", "PathElementType", ".", "MOVE_TO", ")", "{", "if", "(", "foundOne", ")", "{", "return", "true", ";", "}", "foundOne", "=", "true", ";", "}", "}", "return", "false", ";", "}", ",", "innerTypesProperty", "(", ")", ")", ")", ";", "}", "return", "this", ".", "isMultipart", ";", "}" ]
Replies the isMultiParts property. @return the isMultiParts property.
[ "Replies", "the", "isMultiParts", "property", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/Path3ifx.java#L388-L406
cdk/cdk
tool/forcefield/src/main/java/org/openscience/cdk/modeling/builder3d/ForceFieldConfigurator.java
ForceFieldConfigurator.setForceFieldConfigurator
public void setForceFieldConfigurator(String ffname, IChemObjectBuilder builder) throws CDKException { """ Constructor for the ForceFieldConfigurator object @param ffname name of the force field data file """ ffname = ffname.toLowerCase(); boolean check = false; if (ffname == ffName && parameterSet != null) { } else { check = this.checkForceFieldType(ffname); ffName = ffname; if (ffName.equals("mm2")) { //logger.debug("ForceFieldConfigurator: open Force Field mm2"); //f = new File(mm2File); //readFile(f); ins = this.getClass().getClassLoader() .getResourceAsStream("org/openscience/cdk/modeling/forcefield/data/mm2.prm"); //logger.debug("ForceFieldConfigurator: open Force Field mm2 ... READY"); mm2 = new MM2BasedParameterSetReader(); mm2.setInputStream(ins); //logger.debug("ForceFieldConfigurator: mm2 set input stream ... READY"); try { this.setMM2Parameters(builder); } catch (Exception ex1) { throw new CDKException("Problems with set MM2Parameters due to " + ex1.toString(), ex1); } } else if (ffName.equals("mmff94") || !check) { //logger.debug("ForceFieldConfigurator: open Force Field mmff94"); //f = new File(mmff94File); //readFile(f); ins = this.getClass().getClassLoader() .getResourceAsStream("org/openscience/cdk/modeling/forcefield/data/mmff94.prm"); mmff94 = new MMFF94BasedParameterSetReader(); mmff94.setInputStream(ins); try { this.setMMFF94Parameters(builder); } catch (Exception ex2) { throw new CDKException("Problems with set MM2Parameters due to" + ex2.toString(), ex2); } } } //throw new CDKException("Data file for "+ffName+" force field could not be found"); }
java
public void setForceFieldConfigurator(String ffname, IChemObjectBuilder builder) throws CDKException { ffname = ffname.toLowerCase(); boolean check = false; if (ffname == ffName && parameterSet != null) { } else { check = this.checkForceFieldType(ffname); ffName = ffname; if (ffName.equals("mm2")) { //logger.debug("ForceFieldConfigurator: open Force Field mm2"); //f = new File(mm2File); //readFile(f); ins = this.getClass().getClassLoader() .getResourceAsStream("org/openscience/cdk/modeling/forcefield/data/mm2.prm"); //logger.debug("ForceFieldConfigurator: open Force Field mm2 ... READY"); mm2 = new MM2BasedParameterSetReader(); mm2.setInputStream(ins); //logger.debug("ForceFieldConfigurator: mm2 set input stream ... READY"); try { this.setMM2Parameters(builder); } catch (Exception ex1) { throw new CDKException("Problems with set MM2Parameters due to " + ex1.toString(), ex1); } } else if (ffName.equals("mmff94") || !check) { //logger.debug("ForceFieldConfigurator: open Force Field mmff94"); //f = new File(mmff94File); //readFile(f); ins = this.getClass().getClassLoader() .getResourceAsStream("org/openscience/cdk/modeling/forcefield/data/mmff94.prm"); mmff94 = new MMFF94BasedParameterSetReader(); mmff94.setInputStream(ins); try { this.setMMFF94Parameters(builder); } catch (Exception ex2) { throw new CDKException("Problems with set MM2Parameters due to" + ex2.toString(), ex2); } } } //throw new CDKException("Data file for "+ffName+" force field could not be found"); }
[ "public", "void", "setForceFieldConfigurator", "(", "String", "ffname", ",", "IChemObjectBuilder", "builder", ")", "throws", "CDKException", "{", "ffname", "=", "ffname", ".", "toLowerCase", "(", ")", ";", "boolean", "check", "=", "false", ";", "if", "(", "ffname", "==", "ffName", "&&", "parameterSet", "!=", "null", ")", "{", "}", "else", "{", "check", "=", "this", ".", "checkForceFieldType", "(", "ffname", ")", ";", "ffName", "=", "ffname", ";", "if", "(", "ffName", ".", "equals", "(", "\"mm2\"", ")", ")", "{", "//logger.debug(\"ForceFieldConfigurator: open Force Field mm2\");", "//f = new File(mm2File);", "//readFile(f);", "ins", "=", "this", ".", "getClass", "(", ")", ".", "getClassLoader", "(", ")", ".", "getResourceAsStream", "(", "\"org/openscience/cdk/modeling/forcefield/data/mm2.prm\"", ")", ";", "//logger.debug(\"ForceFieldConfigurator: open Force Field mm2 ... READY\");", "mm2", "=", "new", "MM2BasedParameterSetReader", "(", ")", ";", "mm2", ".", "setInputStream", "(", "ins", ")", ";", "//logger.debug(\"ForceFieldConfigurator: mm2 set input stream ... READY\");", "try", "{", "this", ".", "setMM2Parameters", "(", "builder", ")", ";", "}", "catch", "(", "Exception", "ex1", ")", "{", "throw", "new", "CDKException", "(", "\"Problems with set MM2Parameters due to \"", "+", "ex1", ".", "toString", "(", ")", ",", "ex1", ")", ";", "}", "}", "else", "if", "(", "ffName", ".", "equals", "(", "\"mmff94\"", ")", "||", "!", "check", ")", "{", "//logger.debug(\"ForceFieldConfigurator: open Force Field mmff94\");", "//f = new File(mmff94File);", "//readFile(f);", "ins", "=", "this", ".", "getClass", "(", ")", ".", "getClassLoader", "(", ")", ".", "getResourceAsStream", "(", "\"org/openscience/cdk/modeling/forcefield/data/mmff94.prm\"", ")", ";", "mmff94", "=", "new", "MMFF94BasedParameterSetReader", "(", ")", ";", "mmff94", ".", "setInputStream", "(", "ins", ")", ";", "try", "{", "this", ".", "setMMFF94Parameters", "(", "builder", ")", ";", "}", "catch", "(", "Exception", "ex2", ")", "{", "throw", "new", "CDKException", "(", "\"Problems with set MM2Parameters due to\"", "+", "ex2", ".", "toString", "(", ")", ",", "ex2", ")", ";", "}", "}", "}", "//throw new CDKException(\"Data file for \"+ffName+\" force field could not be found\");", "}" ]
Constructor for the ForceFieldConfigurator object @param ffname name of the force field data file
[ "Constructor", "for", "the", "ForceFieldConfigurator", "object" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/forcefield/src/main/java/org/openscience/cdk/modeling/builder3d/ForceFieldConfigurator.java#L122-L162
Netflix/eureka
eureka-client/src/main/java/com/netflix/discovery/shared/Applications.java
Applications.getNextIndex
public AtomicLong getNextIndex(String virtualHostname, boolean secure) { """ Gets the next round-robin index for the given virtual host name. This index is reset after every registry fetch cycle. @param virtualHostname the virtual host name. @param secure indicates whether it is a secure request or a non-secure request. @return AtomicLong value representing the next round-robin index. """ Map<String, VipIndexSupport> index = (secure) ? secureVirtualHostNameAppMap : virtualHostNameAppMap; return Optional.ofNullable(index.get(virtualHostname.toUpperCase(Locale.ROOT))) .map(VipIndexSupport::getRoundRobinIndex) .orElse(null); }
java
public AtomicLong getNextIndex(String virtualHostname, boolean secure) { Map<String, VipIndexSupport> index = (secure) ? secureVirtualHostNameAppMap : virtualHostNameAppMap; return Optional.ofNullable(index.get(virtualHostname.toUpperCase(Locale.ROOT))) .map(VipIndexSupport::getRoundRobinIndex) .orElse(null); }
[ "public", "AtomicLong", "getNextIndex", "(", "String", "virtualHostname", ",", "boolean", "secure", ")", "{", "Map", "<", "String", ",", "VipIndexSupport", ">", "index", "=", "(", "secure", ")", "?", "secureVirtualHostNameAppMap", ":", "virtualHostNameAppMap", ";", "return", "Optional", ".", "ofNullable", "(", "index", ".", "get", "(", "virtualHostname", ".", "toUpperCase", "(", "Locale", ".", "ROOT", ")", ")", ")", ".", "map", "(", "VipIndexSupport", "::", "getRoundRobinIndex", ")", ".", "orElse", "(", "null", ")", ";", "}" ]
Gets the next round-robin index for the given virtual host name. This index is reset after every registry fetch cycle. @param virtualHostname the virtual host name. @param secure indicates whether it is a secure request or a non-secure request. @return AtomicLong value representing the next round-robin index.
[ "Gets", "the", "next", "round", "-", "robin", "index", "for", "the", "given", "virtual", "host", "name", ".", "This", "index", "is", "reset", "after", "every", "registry", "fetch", "cycle", "." ]
train
https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-client/src/main/java/com/netflix/discovery/shared/Applications.java#L338-L343
bmwcarit/joynr
java/messaging/bounceproxy/controlled-bounceproxy/src/main/java/io/joynr/messaging/bounceproxy/monitoring/BounceProxyPerformanceReporter.java
BounceProxyPerformanceReporter.sendPerformanceReportAsHttpRequest
private void sendPerformanceReportAsHttpRequest() throws IOException { """ Sends an HTTP request to the monitoring service to report performance measures of a bounce proxy instance. @throws IOException """ final String url = bounceProxyControllerUrl.buildReportPerformanceUrl(); logger.debug("Using monitoring service URL: {}", url); Map<String, Integer> performanceMap = bounceProxyPerformanceMonitor.getAsKeyValuePairs(); String serializedMessage = objectMapper.writeValueAsString(performanceMap); HttpPost postReportPerformance = new HttpPost(url.trim()); // using http apache constants here because JOYNr constants are in // libjoynr which should not be included here postReportPerformance.addHeader(HttpHeaders.CONTENT_TYPE, "application/json"); postReportPerformance.setEntity(new StringEntity(serializedMessage, "UTF-8")); CloseableHttpResponse response = null; try { response = httpclient.execute(postReportPerformance); StatusLine statusLine = response.getStatusLine(); int statusCode = statusLine.getStatusCode(); if (statusCode != HttpURLConnection.HTTP_NO_CONTENT) { logger.error("Failed to send performance report: {}", response); throw new JoynrHttpException(statusCode, "Failed to send performance report."); } } finally { if (response != null) { response.close(); } } }
java
private void sendPerformanceReportAsHttpRequest() throws IOException { final String url = bounceProxyControllerUrl.buildReportPerformanceUrl(); logger.debug("Using monitoring service URL: {}", url); Map<String, Integer> performanceMap = bounceProxyPerformanceMonitor.getAsKeyValuePairs(); String serializedMessage = objectMapper.writeValueAsString(performanceMap); HttpPost postReportPerformance = new HttpPost(url.trim()); // using http apache constants here because JOYNr constants are in // libjoynr which should not be included here postReportPerformance.addHeader(HttpHeaders.CONTENT_TYPE, "application/json"); postReportPerformance.setEntity(new StringEntity(serializedMessage, "UTF-8")); CloseableHttpResponse response = null; try { response = httpclient.execute(postReportPerformance); StatusLine statusLine = response.getStatusLine(); int statusCode = statusLine.getStatusCode(); if (statusCode != HttpURLConnection.HTTP_NO_CONTENT) { logger.error("Failed to send performance report: {}", response); throw new JoynrHttpException(statusCode, "Failed to send performance report."); } } finally { if (response != null) { response.close(); } } }
[ "private", "void", "sendPerformanceReportAsHttpRequest", "(", ")", "throws", "IOException", "{", "final", "String", "url", "=", "bounceProxyControllerUrl", ".", "buildReportPerformanceUrl", "(", ")", ";", "logger", ".", "debug", "(", "\"Using monitoring service URL: {}\"", ",", "url", ")", ";", "Map", "<", "String", ",", "Integer", ">", "performanceMap", "=", "bounceProxyPerformanceMonitor", ".", "getAsKeyValuePairs", "(", ")", ";", "String", "serializedMessage", "=", "objectMapper", ".", "writeValueAsString", "(", "performanceMap", ")", ";", "HttpPost", "postReportPerformance", "=", "new", "HttpPost", "(", "url", ".", "trim", "(", ")", ")", ";", "// using http apache constants here because JOYNr constants are in", "// libjoynr which should not be included here", "postReportPerformance", ".", "addHeader", "(", "HttpHeaders", ".", "CONTENT_TYPE", ",", "\"application/json\"", ")", ";", "postReportPerformance", ".", "setEntity", "(", "new", "StringEntity", "(", "serializedMessage", ",", "\"UTF-8\"", ")", ")", ";", "CloseableHttpResponse", "response", "=", "null", ";", "try", "{", "response", "=", "httpclient", ".", "execute", "(", "postReportPerformance", ")", ";", "StatusLine", "statusLine", "=", "response", ".", "getStatusLine", "(", ")", ";", "int", "statusCode", "=", "statusLine", ".", "getStatusCode", "(", ")", ";", "if", "(", "statusCode", "!=", "HttpURLConnection", ".", "HTTP_NO_CONTENT", ")", "{", "logger", ".", "error", "(", "\"Failed to send performance report: {}\"", ",", "response", ")", ";", "throw", "new", "JoynrHttpException", "(", "statusCode", ",", "\"Failed to send performance report.\"", ")", ";", "}", "}", "finally", "{", "if", "(", "response", "!=", "null", ")", "{", "response", ".", "close", "(", ")", ";", "}", "}", "}" ]
Sends an HTTP request to the monitoring service to report performance measures of a bounce proxy instance. @throws IOException
[ "Sends", "an", "HTTP", "request", "to", "the", "monitoring", "service", "to", "report", "performance", "measures", "of", "a", "bounce", "proxy", "instance", "." ]
train
https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/controlled-bounceproxy/src/main/java/io/joynr/messaging/bounceproxy/monitoring/BounceProxyPerformanceReporter.java#L135-L165
headius/invokebinder
src/main/java/com/headius/invokebinder/SmartBinder.java
SmartBinder.dropLast
public SmartBinder dropLast(int count) { """ Drop the last N arguments. @param count the count of arguments to drop @return a new SmartBinder with the drop applied """ return new SmartBinder(this, signature().dropLast(count), binder.dropLast(count)); }
java
public SmartBinder dropLast(int count) { return new SmartBinder(this, signature().dropLast(count), binder.dropLast(count)); }
[ "public", "SmartBinder", "dropLast", "(", "int", "count", ")", "{", "return", "new", "SmartBinder", "(", "this", ",", "signature", "(", ")", ".", "dropLast", "(", "count", ")", ",", "binder", ".", "dropLast", "(", "count", ")", ")", ";", "}" ]
Drop the last N arguments. @param count the count of arguments to drop @return a new SmartBinder with the drop applied
[ "Drop", "the", "last", "N", "arguments", "." ]
train
https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/SmartBinder.java#L809-L811
Alluxio/alluxio
core/server/worker/src/main/java/alluxio/worker/block/meta/StorageDir.java
StorageDir.resizeTempBlockMeta
public void resizeTempBlockMeta(TempBlockMeta tempBlockMeta, long newSize) throws InvalidWorkerStateException { """ Changes the size of a temp block. @param tempBlockMeta the metadata of the temp block to resize @param newSize the new size after change in bytes @throws InvalidWorkerStateException when newSize is smaller than oldSize """ long oldSize = tempBlockMeta.getBlockSize(); if (newSize > oldSize) { reserveSpace(newSize - oldSize, false); tempBlockMeta.setBlockSize(newSize); } else if (newSize < oldSize) { throw new InvalidWorkerStateException("Shrinking block, not supported!"); } }
java
public void resizeTempBlockMeta(TempBlockMeta tempBlockMeta, long newSize) throws InvalidWorkerStateException { long oldSize = tempBlockMeta.getBlockSize(); if (newSize > oldSize) { reserveSpace(newSize - oldSize, false); tempBlockMeta.setBlockSize(newSize); } else if (newSize < oldSize) { throw new InvalidWorkerStateException("Shrinking block, not supported!"); } }
[ "public", "void", "resizeTempBlockMeta", "(", "TempBlockMeta", "tempBlockMeta", ",", "long", "newSize", ")", "throws", "InvalidWorkerStateException", "{", "long", "oldSize", "=", "tempBlockMeta", ".", "getBlockSize", "(", ")", ";", "if", "(", "newSize", ">", "oldSize", ")", "{", "reserveSpace", "(", "newSize", "-", "oldSize", ",", "false", ")", ";", "tempBlockMeta", ".", "setBlockSize", "(", "newSize", ")", ";", "}", "else", "if", "(", "newSize", "<", "oldSize", ")", "{", "throw", "new", "InvalidWorkerStateException", "(", "\"Shrinking block, not supported!\"", ")", ";", "}", "}" ]
Changes the size of a temp block. @param tempBlockMeta the metadata of the temp block to resize @param newSize the new size after change in bytes @throws InvalidWorkerStateException when newSize is smaller than oldSize
[ "Changes", "the", "size", "of", "a", "temp", "block", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/meta/StorageDir.java#L372-L381
OpenLiberty/open-liberty
dev/com.ibm.ws.javamail/src/com/ibm/ws/javamail/internal/injection/MailSessionDefinitionInjectionProcessor.java
MailSessionDefinitionInjectionProcessor.processXML
@Override public void processXML() throws InjectionException { """ Processes {@link ComponentNameSpaceConfiguration#getJNDIEnvironmnetRefs} for MailSessions. </ul> @throws InjectionException if an error is found processing the XML. """ final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "processXML : " + this); List<? extends MailSession> mailSessionDefinitions = ivNameSpaceConfig.getJNDIEnvironmentRefs(MailSession.class); if (mailSessionDefinitions != null) { for (MailSession mailSession : mailSessionDefinitions) { String jndiName = mailSession.getName(); InjectionBinding<MailSessionDefinition> injectionBinding = ivAllAnnotationsCollection.get(jndiName); MailSessionDefinitionInjectionBinding binding; if (injectionBinding != null) { binding = (MailSessionDefinitionInjectionBinding) injectionBinding; } else { binding = new MailSessionDefinitionInjectionBinding(jndiName, ivNameSpaceConfig); addInjectionBinding(binding); } binding.mergeXML(mailSession); } } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "processXML : " + this); }
java
@Override public void processXML() throws InjectionException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "processXML : " + this); List<? extends MailSession> mailSessionDefinitions = ivNameSpaceConfig.getJNDIEnvironmentRefs(MailSession.class); if (mailSessionDefinitions != null) { for (MailSession mailSession : mailSessionDefinitions) { String jndiName = mailSession.getName(); InjectionBinding<MailSessionDefinition> injectionBinding = ivAllAnnotationsCollection.get(jndiName); MailSessionDefinitionInjectionBinding binding; if (injectionBinding != null) { binding = (MailSessionDefinitionInjectionBinding) injectionBinding; } else { binding = new MailSessionDefinitionInjectionBinding(jndiName, ivNameSpaceConfig); addInjectionBinding(binding); } binding.mergeXML(mailSession); } } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "processXML : " + this); }
[ "@", "Override", "public", "void", "processXML", "(", ")", "throws", "InjectionException", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"processXML : \"", "+", "this", ")", ";", "List", "<", "?", "extends", "MailSession", ">", "mailSessionDefinitions", "=", "ivNameSpaceConfig", ".", "getJNDIEnvironmentRefs", "(", "MailSession", ".", "class", ")", ";", "if", "(", "mailSessionDefinitions", "!=", "null", ")", "{", "for", "(", "MailSession", "mailSession", ":", "mailSessionDefinitions", ")", "{", "String", "jndiName", "=", "mailSession", ".", "getName", "(", ")", ";", "InjectionBinding", "<", "MailSessionDefinition", ">", "injectionBinding", "=", "ivAllAnnotationsCollection", ".", "get", "(", "jndiName", ")", ";", "MailSessionDefinitionInjectionBinding", "binding", ";", "if", "(", "injectionBinding", "!=", "null", ")", "{", "binding", "=", "(", "MailSessionDefinitionInjectionBinding", ")", "injectionBinding", ";", "}", "else", "{", "binding", "=", "new", "MailSessionDefinitionInjectionBinding", "(", "jndiName", ",", "ivNameSpaceConfig", ")", ";", "addInjectionBinding", "(", "binding", ")", ";", "}", "binding", ".", "mergeXML", "(", "mailSession", ")", ";", "}", "}", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"processXML : \"", "+", "this", ")", ";", "}" ]
Processes {@link ComponentNameSpaceConfiguration#getJNDIEnvironmnetRefs} for MailSessions. </ul> @throws InjectionException if an error is found processing the XML.
[ "Processes", "{", "@link", "ComponentNameSpaceConfiguration#getJNDIEnvironmnetRefs", "}", "for", "MailSessions", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javamail/src/com/ibm/ws/javamail/internal/injection/MailSessionDefinitionInjectionProcessor.java#L55-L90
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/servlet/GenericServletWrapper.java
GenericServletWrapper.handleRequest
public void handleRequest(ServletRequest req, ServletResponse res) throws Exception { """ Method that processes the request, and ultimately invokes the service() on the Servlet target. Subclasses may override this method to put in additional logic (eg., reload/retranslation logic in the case of JSP containers). Subclasses must call this method by invoking super.handleRequest() if they want the webcontainer to handle initialization and servicing of the target in a proper way. An example scenario: <tt> class SimpleJSPServletWrapper extends GenericServletWrapper { ... public void handleRequest(ServletRequest req, ServletResponse res) { String jspFile = getFileFromRequest(req); // get the JSP target if (hasFileChangedOnDisk(jspFile)) { prepareForReload(); // invalidate the target and targetClassLoader setTargetClassLoader(null); setTarget(null); JSPServlet jsp = compileJSP(jspFile); ClassLoader loader = getLoaderForServlet(jsp); setTarget(jsp.getClassName()); setTargetClassLoader(loader); } super.handleRequest(req, res); } ... } </tt> """ wrapper.handleRequest(req, res); }
java
public void handleRequest(ServletRequest req, ServletResponse res) throws Exception { wrapper.handleRequest(req, res); }
[ "public", "void", "handleRequest", "(", "ServletRequest", "req", ",", "ServletResponse", "res", ")", "throws", "Exception", "{", "wrapper", ".", "handleRequest", "(", "req", ",", "res", ")", ";", "}" ]
Method that processes the request, and ultimately invokes the service() on the Servlet target. Subclasses may override this method to put in additional logic (eg., reload/retranslation logic in the case of JSP containers). Subclasses must call this method by invoking super.handleRequest() if they want the webcontainer to handle initialization and servicing of the target in a proper way. An example scenario: <tt> class SimpleJSPServletWrapper extends GenericServletWrapper { ... public void handleRequest(ServletRequest req, ServletResponse res) { String jspFile = getFileFromRequest(req); // get the JSP target if (hasFileChangedOnDisk(jspFile)) { prepareForReload(); // invalidate the target and targetClassLoader setTargetClassLoader(null); setTarget(null); JSPServlet jsp = compileJSP(jspFile); ClassLoader loader = getLoaderForServlet(jsp); setTarget(jsp.getClassName()); setTargetClassLoader(loader); } super.handleRequest(req, res); } ... } </tt>
[ "Method", "that", "processes", "the", "request", "and", "ultimately", "invokes", "the", "service", "()", "on", "the", "Servlet", "target", ".", "Subclasses", "may", "override", "this", "method", "to", "put", "in", "additional", "logic", "(", "eg", ".", "reload", "/", "retranslation", "logic", "in", "the", "case", "of", "JSP", "containers", ")", ".", "Subclasses", "must", "call", "this", "method", "by", "invoking", "super", ".", "handleRequest", "()", "if", "they", "want", "the", "webcontainer", "to", "handle", "initialization", "and", "servicing", "of", "the", "target", "in", "a", "proper", "way", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/servlet/GenericServletWrapper.java#L116-L119
jurmous/etcd4j
src/main/java/mousio/etcd4j/security/SecurityContextBuilder.java
SecurityContextBuilder.forKeystoreAndTruststore
public static SslContext forKeystoreAndTruststore(String keystorePath, String keystorePassword, String truststorePath, String truststorePassword) throws SecurityContextException { """ Builds SslContext using protected keystore and truststores. Adequate for mutual TLS connections. @param keystorePath Path for keystore file @param keystorePassword Password for protected keystore file @param truststorePath Path for truststore file @param truststorePassword Password for protected truststore file @return SslContext ready to use @throws SecurityContextException """ return forKeystoreAndTruststore(keystorePath, keystorePassword, truststorePath, truststorePassword, "SunX509"); }
java
public static SslContext forKeystoreAndTruststore(String keystorePath, String keystorePassword, String truststorePath, String truststorePassword) throws SecurityContextException { return forKeystoreAndTruststore(keystorePath, keystorePassword, truststorePath, truststorePassword, "SunX509"); }
[ "public", "static", "SslContext", "forKeystoreAndTruststore", "(", "String", "keystorePath", ",", "String", "keystorePassword", ",", "String", "truststorePath", ",", "String", "truststorePassword", ")", "throws", "SecurityContextException", "{", "return", "forKeystoreAndTruststore", "(", "keystorePath", ",", "keystorePassword", ",", "truststorePath", ",", "truststorePassword", ",", "\"SunX509\"", ")", ";", "}" ]
Builds SslContext using protected keystore and truststores. Adequate for mutual TLS connections. @param keystorePath Path for keystore file @param keystorePassword Password for protected keystore file @param truststorePath Path for truststore file @param truststorePassword Password for protected truststore file @return SslContext ready to use @throws SecurityContextException
[ "Builds", "SslContext", "using", "protected", "keystore", "and", "truststores", ".", "Adequate", "for", "mutual", "TLS", "connections", "." ]
train
https://github.com/jurmous/etcd4j/blob/ffb1d574cf85bbab025dd566ce250f1860bbcbc7/src/main/java/mousio/etcd4j/security/SecurityContextBuilder.java#L86-L89
threerings/nenya
core/src/main/java/com/threerings/miso/client/DirtyItemList.java
DirtyItemList.appendDirtySprite
public void appendDirtySprite (Sprite sprite, int tx, int ty) { """ Appends the dirty sprite at the given coordinates to the dirty item list. @param sprite the dirty sprite itself. @param tx the sprite's x tile position. @param ty the sprite's y tile position. """ DirtyItem item = getDirtyItem(); item.init(sprite, tx, ty); _items.add(item); }
java
public void appendDirtySprite (Sprite sprite, int tx, int ty) { DirtyItem item = getDirtyItem(); item.init(sprite, tx, ty); _items.add(item); }
[ "public", "void", "appendDirtySprite", "(", "Sprite", "sprite", ",", "int", "tx", ",", "int", "ty", ")", "{", "DirtyItem", "item", "=", "getDirtyItem", "(", ")", ";", "item", ".", "init", "(", "sprite", ",", "tx", ",", "ty", ")", ";", "_items", ".", "add", "(", "item", ")", ";", "}" ]
Appends the dirty sprite at the given coordinates to the dirty item list. @param sprite the dirty sprite itself. @param tx the sprite's x tile position. @param ty the sprite's y tile position.
[ "Appends", "the", "dirty", "sprite", "at", "the", "given", "coordinates", "to", "the", "dirty", "item", "list", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/DirtyItemList.java#L56-L61
hdbeukel/james-core
src/main/java/org/jamesframework/core/problems/GenericProblem.java
GenericProblem.setObjective
public void setObjective(Objective<? super SolutionType, ? super DataType> objective) { """ Set the objective function. Any objective designed for the solution and data types of the problem, or more general types, is accepted. The objective can not be <code>null</code>. @param objective objective function @throws NullPointerException if <code>objective</code> is <code>null</code> """ // check not null if(objective == null){ throw new NullPointerException("Error while setting objective: null is not allowed."); } this.objective = objective; }
java
public void setObjective(Objective<? super SolutionType, ? super DataType> objective) { // check not null if(objective == null){ throw new NullPointerException("Error while setting objective: null is not allowed."); } this.objective = objective; }
[ "public", "void", "setObjective", "(", "Objective", "<", "?", "super", "SolutionType", ",", "?", "super", "DataType", ">", "objective", ")", "{", "// check not null", "if", "(", "objective", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Error while setting objective: null is not allowed.\"", ")", ";", "}", "this", ".", "objective", "=", "objective", ";", "}" ]
Set the objective function. Any objective designed for the solution and data types of the problem, or more general types, is accepted. The objective can not be <code>null</code>. @param objective objective function @throws NullPointerException if <code>objective</code> is <code>null</code>
[ "Set", "the", "objective", "function", ".", "Any", "objective", "designed", "for", "the", "solution", "and", "data", "types", "of", "the", "problem", "or", "more", "general", "types", "is", "accepted", ".", "The", "objective", "can", "not", "be", "<code", ">", "null<", "/", "code", ">", "." ]
train
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/problems/GenericProblem.java#L146-L152
keenon/loglinear
src/main/java/com/github/keenon/loglinear/model/GraphicalModel.java
GraphicalModel.setTrainingLabel
public void setTrainingLabel(int variable, int value) { """ Set a training value for this variable in the graphical model. @param variable The variable to set. @param value The value to set on the variable. """ getVariableMetaDataByReference(variable).put(LogLikelihoodDifferentiableFunction.VARIABLE_TRAINING_VALUE, Integer.toString(value)); }
java
public void setTrainingLabel(int variable, int value) { getVariableMetaDataByReference(variable).put(LogLikelihoodDifferentiableFunction.VARIABLE_TRAINING_VALUE, Integer.toString(value)); }
[ "public", "void", "setTrainingLabel", "(", "int", "variable", ",", "int", "value", ")", "{", "getVariableMetaDataByReference", "(", "variable", ")", ".", "put", "(", "LogLikelihoodDifferentiableFunction", ".", "VARIABLE_TRAINING_VALUE", ",", "Integer", ".", "toString", "(", "value", ")", ")", ";", "}" ]
Set a training value for this variable in the graphical model. @param variable The variable to set. @param value The value to set on the variable.
[ "Set", "a", "training", "value", "for", "this", "variable", "in", "the", "graphical", "model", "." ]
train
https://github.com/keenon/loglinear/blob/fa0c370ab6782015412f676ef2ab11c97be58e29/src/main/java/com/github/keenon/loglinear/model/GraphicalModel.java#L500-L502
attribyte/wpdb
src/main/java/org/attribyte/wp/model/User.java
User.withMetadata
public User withMetadata(final List<Meta> metadata) { """ Creates a user with added metadata. @param metadata The metadata. @return The user with metadata added. """ return new User(id, username, displayName, slug, email, createTimestamp, url, metadata); }
java
public User withMetadata(final List<Meta> metadata) { return new User(id, username, displayName, slug, email, createTimestamp, url, metadata); }
[ "public", "User", "withMetadata", "(", "final", "List", "<", "Meta", ">", "metadata", ")", "{", "return", "new", "User", "(", "id", ",", "username", ",", "displayName", ",", "slug", ",", "email", ",", "createTimestamp", ",", "url", ",", "metadata", ")", ";", "}" ]
Creates a user with added metadata. @param metadata The metadata. @return The user with metadata added.
[ "Creates", "a", "user", "with", "added", "metadata", "." ]
train
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/model/User.java#L147-L149
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/store/ServiceBuilder.java
ServiceBuilder.createTableStoreService
public TableStore createTableStoreService() { """ Creates a new instance of TableStore using the components generated by this class. @return The new instance of TableStore using the components generated by this class. """ return getSingleton(this.tableStoreService, setup -> new TableService(setup.getContainerRegistry(), setup.getSegmentToContainerMapper())); }
java
public TableStore createTableStoreService() { return getSingleton(this.tableStoreService, setup -> new TableService(setup.getContainerRegistry(), setup.getSegmentToContainerMapper())); }
[ "public", "TableStore", "createTableStoreService", "(", ")", "{", "return", "getSingleton", "(", "this", ".", "tableStoreService", ",", "setup", "->", "new", "TableService", "(", "setup", ".", "getContainerRegistry", "(", ")", ",", "setup", ".", "getSegmentToContainerMapper", "(", ")", ")", ")", ";", "}" ]
Creates a new instance of TableStore using the components generated by this class. @return The new instance of TableStore using the components generated by this class.
[ "Creates", "a", "new", "instance", "of", "TableStore", "using", "the", "components", "generated", "by", "this", "class", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/store/ServiceBuilder.java#L244-L246
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/structure/ProjectiveStructureByFactorization.java
ProjectiveStructureByFactorization.setDepthsFrom3D
public void setDepthsFrom3D(int view , List<Point3D_F64> locations ) { """ Assigns depth to the z value of all the features in the list. Features must be in the coordinate system of the view for this to be correct @param view which view is features are in @param locations Location of features in the view's reference frame """ if( locations.size() != pixels.numCols ) throw new IllegalArgumentException("Pixel count must be constant and match "+pixels.numCols); int N = depths.numCols; for (int i = 0; i < N; i++) { depths.set(view,i, locations.get(i).z ); } }
java
public void setDepthsFrom3D(int view , List<Point3D_F64> locations ) { if( locations.size() != pixels.numCols ) throw new IllegalArgumentException("Pixel count must be constant and match "+pixels.numCols); int N = depths.numCols; for (int i = 0; i < N; i++) { depths.set(view,i, locations.get(i).z ); } }
[ "public", "void", "setDepthsFrom3D", "(", "int", "view", ",", "List", "<", "Point3D_F64", ">", "locations", ")", "{", "if", "(", "locations", ".", "size", "(", ")", "!=", "pixels", ".", "numCols", ")", "throw", "new", "IllegalArgumentException", "(", "\"Pixel count must be constant and match \"", "+", "pixels", ".", "numCols", ")", ";", "int", "N", "=", "depths", ".", "numCols", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "N", ";", "i", "++", ")", "{", "depths", ".", "set", "(", "view", ",", "i", ",", "locations", ".", "get", "(", "i", ")", ".", "z", ")", ";", "}", "}" ]
Assigns depth to the z value of all the features in the list. Features must be in the coordinate system of the view for this to be correct @param view which view is features are in @param locations Location of features in the view's reference frame
[ "Assigns", "depth", "to", "the", "z", "value", "of", "all", "the", "features", "in", "the", "list", ".", "Features", "must", "be", "in", "the", "coordinate", "system", "of", "the", "view", "for", "this", "to", "be", "correct" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/structure/ProjectiveStructureByFactorization.java#L151-L159
apache/incubator-heron
heron/api/src/java/org/apache/heron/api/Config.java
Config.setContainerDiskRequested
@Deprecated public static void setContainerDiskRequested(Map<String, Object> conf, long nbytes) { """ Users should use the version of this method at uses ByteAmount @deprecated use setContainerDiskRequested(Map&lt;String, Object&gt; conf, ByteAmount nbytes) """ setContainerDiskRequested(conf, ByteAmount.fromBytes(nbytes)); }
java
@Deprecated public static void setContainerDiskRequested(Map<String, Object> conf, long nbytes) { setContainerDiskRequested(conf, ByteAmount.fromBytes(nbytes)); }
[ "@", "Deprecated", "public", "static", "void", "setContainerDiskRequested", "(", "Map", "<", "String", ",", "Object", ">", "conf", ",", "long", "nbytes", ")", "{", "setContainerDiskRequested", "(", "conf", ",", "ByteAmount", ".", "fromBytes", "(", "nbytes", ")", ")", ";", "}" ]
Users should use the version of this method at uses ByteAmount @deprecated use setContainerDiskRequested(Map&lt;String, Object&gt; conf, ByteAmount nbytes)
[ "Users", "should", "use", "the", "version", "of", "this", "method", "at", "uses", "ByteAmount" ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/api/src/java/org/apache/heron/api/Config.java#L465-L468
aws/aws-cloudtrail-processing-library
src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/serializer/AbstractEventSerializer.java
AbstractEventSerializer.convertToDate
private Date convertToDate(String dateInString) throws IOException { """ This method convert a String to Date type. When parse error happened return current date. @param dateInString the String to convert to Date @return Date the date and time in coordinated universal time @throws IOException """ Date date = null; if (dateInString != null) { try { date = LibraryUtils.getUtcSdf().parse(dateInString); } catch (ParseException e) { throw new IOException("Cannot parse " + dateInString + " as Date", e); } } return date; }
java
private Date convertToDate(String dateInString) throws IOException { Date date = null; if (dateInString != null) { try { date = LibraryUtils.getUtcSdf().parse(dateInString); } catch (ParseException e) { throw new IOException("Cannot parse " + dateInString + " as Date", e); } } return date; }
[ "private", "Date", "convertToDate", "(", "String", "dateInString", ")", "throws", "IOException", "{", "Date", "date", "=", "null", ";", "if", "(", "dateInString", "!=", "null", ")", "{", "try", "{", "date", "=", "LibraryUtils", ".", "getUtcSdf", "(", ")", ".", "parse", "(", "dateInString", ")", ";", "}", "catch", "(", "ParseException", "e", ")", "{", "throw", "new", "IOException", "(", "\"Cannot parse \"", "+", "dateInString", "+", "\" as Date\"", ",", "e", ")", ";", "}", "}", "return", "date", ";", "}" ]
This method convert a String to Date type. When parse error happened return current date. @param dateInString the String to convert to Date @return Date the date and time in coordinated universal time @throws IOException
[ "This", "method", "convert", "a", "String", "to", "Date", "type", ".", "When", "parse", "error", "happened", "return", "current", "date", "." ]
train
https://github.com/aws/aws-cloudtrail-processing-library/blob/411315808d8d3dc6b45e4182212e3e04d82e3782/src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/serializer/AbstractEventSerializer.java#L530-L540
baasbox/Android-SDK
library/src/main/java/com/baasbox/android/BaasUser.java
BaasUser.fetchAll
public static RequestToken fetchAll(BaasHandler<List<BaasUser>> handler) { """ Asynchronously fetches the list of users from the server. @param handler an handler to be invoked upon completion of the request @return a {@link com.baasbox.android.RequestToken} to manage the request """ return fetchAll(null, RequestOptions.DEFAULT, handler); }
java
public static RequestToken fetchAll(BaasHandler<List<BaasUser>> handler) { return fetchAll(null, RequestOptions.DEFAULT, handler); }
[ "public", "static", "RequestToken", "fetchAll", "(", "BaasHandler", "<", "List", "<", "BaasUser", ">", ">", "handler", ")", "{", "return", "fetchAll", "(", "null", ",", "RequestOptions", ".", "DEFAULT", ",", "handler", ")", ";", "}" ]
Asynchronously fetches the list of users from the server. @param handler an handler to be invoked upon completion of the request @return a {@link com.baasbox.android.RequestToken} to manage the request
[ "Asynchronously", "fetches", "the", "list", "of", "users", "from", "the", "server", "." ]
train
https://github.com/baasbox/Android-SDK/blob/6bb2203246b885b2ad63a7bfaf37c83caf15e0d8/library/src/main/java/com/baasbox/android/BaasUser.java#L450-L452
theHilikus/JRoboCom
jrobocom-core/src/main/java/com/github/thehilikus/jrobocom/timing/Delayer.java
Delayer.waitFor
public void waitFor(Integer clientId, int turns, String reason) { """ Blocks the calling thread for the specified number of cycles @param clientId unique ID of the client. @param turns the number of clock ticks to block @param reason explanation for the wait """ // for safety, check if we know the robot, otherwise fail if (!registered.contains(clientId)) { throw new IllegalArgumentException("Unknown robot. All robots must first register with clock"); } synchronized (waitingList) { if (waitingList.contains(clientId)) { throw new IllegalArgumentException("Client " + clientId + " is already waiting, no multithreading is allowed"); } waitingList.add(clientId); } // we are in the robot's thread log.trace("[waitFor] Blocking {} for {} turns. Reason: {}", clientId, turns, reason); blockMe(turns); log.trace("[waitFor] Unblocked {} - {}", clientId, reason); synchronized (waitingList) { waitingList.remove(clientId); } }
java
public void waitFor(Integer clientId, int turns, String reason) { // for safety, check if we know the robot, otherwise fail if (!registered.contains(clientId)) { throw new IllegalArgumentException("Unknown robot. All robots must first register with clock"); } synchronized (waitingList) { if (waitingList.contains(clientId)) { throw new IllegalArgumentException("Client " + clientId + " is already waiting, no multithreading is allowed"); } waitingList.add(clientId); } // we are in the robot's thread log.trace("[waitFor] Blocking {} for {} turns. Reason: {}", clientId, turns, reason); blockMe(turns); log.trace("[waitFor] Unblocked {} - {}", clientId, reason); synchronized (waitingList) { waitingList.remove(clientId); } }
[ "public", "void", "waitFor", "(", "Integer", "clientId", ",", "int", "turns", ",", "String", "reason", ")", "{", "// for safety, check if we know the robot, otherwise fail", "if", "(", "!", "registered", ".", "contains", "(", "clientId", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Unknown robot. All robots must first register with clock\"", ")", ";", "}", "synchronized", "(", "waitingList", ")", "{", "if", "(", "waitingList", ".", "contains", "(", "clientId", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Client \"", "+", "clientId", "+", "\" is already waiting, no multithreading is allowed\"", ")", ";", "}", "waitingList", ".", "add", "(", "clientId", ")", ";", "}", "// we are in the robot's thread", "log", ".", "trace", "(", "\"[waitFor] Blocking {} for {} turns. Reason: {}\"", ",", "clientId", ",", "turns", ",", "reason", ")", ";", "blockMe", "(", "turns", ")", ";", "log", ".", "trace", "(", "\"[waitFor] Unblocked {} - {}\"", ",", "clientId", ",", "reason", ")", ";", "synchronized", "(", "waitingList", ")", "{", "waitingList", ".", "remove", "(", "clientId", ")", ";", "}", "}" ]
Blocks the calling thread for the specified number of cycles @param clientId unique ID of the client. @param turns the number of clock ticks to block @param reason explanation for the wait
[ "Blocks", "the", "calling", "thread", "for", "the", "specified", "number", "of", "cycles" ]
train
https://github.com/theHilikus/JRoboCom/blob/0e31c1ecf1006e35f68c229ff66c37640effffac/jrobocom-core/src/main/java/com/github/thehilikus/jrobocom/timing/Delayer.java#L92-L118
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/AssetsInner.java
AssetsInner.listContainerSasAsync
public Observable<AssetContainerSasInner> listContainerSasAsync(String resourceGroupName, String accountName, String assetName, ListContainerSasInput parameters) { """ List the Asset URLs. Lists storage container URLs with shared access signatures (SAS) for uploading and downloading Asset content. The signatures are derived from the storage account keys. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param assetName The Asset name. @param parameters The request parameters @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AssetContainerSasInner object """ return listContainerSasWithServiceResponseAsync(resourceGroupName, accountName, assetName, parameters).map(new Func1<ServiceResponse<AssetContainerSasInner>, AssetContainerSasInner>() { @Override public AssetContainerSasInner call(ServiceResponse<AssetContainerSasInner> response) { return response.body(); } }); }
java
public Observable<AssetContainerSasInner> listContainerSasAsync(String resourceGroupName, String accountName, String assetName, ListContainerSasInput parameters) { return listContainerSasWithServiceResponseAsync(resourceGroupName, accountName, assetName, parameters).map(new Func1<ServiceResponse<AssetContainerSasInner>, AssetContainerSasInner>() { @Override public AssetContainerSasInner call(ServiceResponse<AssetContainerSasInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AssetContainerSasInner", ">", "listContainerSasAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "assetName", ",", "ListContainerSasInput", "parameters", ")", "{", "return", "listContainerSasWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "assetName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "AssetContainerSasInner", ">", ",", "AssetContainerSasInner", ">", "(", ")", "{", "@", "Override", "public", "AssetContainerSasInner", "call", "(", "ServiceResponse", "<", "AssetContainerSasInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
List the Asset URLs. Lists storage container URLs with shared access signatures (SAS) for uploading and downloading Asset content. The signatures are derived from the storage account keys. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param assetName The Asset name. @param parameters The request parameters @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AssetContainerSasInner object
[ "List", "the", "Asset", "URLs", ".", "Lists", "storage", "container", "URLs", "with", "shared", "access", "signatures", "(", "SAS", ")", "for", "uploading", "and", "downloading", "Asset", "content", ".", "The", "signatures", "are", "derived", "from", "the", "storage", "account", "keys", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/AssetsInner.java#L818-L825
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.createCertificateAsync
public ServiceFuture<CertificateOperation> createCertificateAsync(String vaultBaseUrl, String certificateName, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map<String, String> tags, final ServiceCallback<CertificateOperation> serviceCallback) { """ Creates a new certificate. If this is the first version, the certificate resource is created. This operation requires the certificates/create permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate. @param certificatePolicy The management policy for the certificate. @param certificateAttributes The attributes of the certificate (optional). @param tags Application specific metadata in the form of key-value pairs. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object """ return ServiceFuture.fromResponse(createCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, certificatePolicy, certificateAttributes, tags), serviceCallback); }
java
public ServiceFuture<CertificateOperation> createCertificateAsync(String vaultBaseUrl, String certificateName, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map<String, String> tags, final ServiceCallback<CertificateOperation> serviceCallback) { return ServiceFuture.fromResponse(createCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, certificatePolicy, certificateAttributes, tags), serviceCallback); }
[ "public", "ServiceFuture", "<", "CertificateOperation", ">", "createCertificateAsync", "(", "String", "vaultBaseUrl", ",", "String", "certificateName", ",", "CertificatePolicy", "certificatePolicy", ",", "CertificateAttributes", "certificateAttributes", ",", "Map", "<", "String", ",", "String", ">", "tags", ",", "final", "ServiceCallback", "<", "CertificateOperation", ">", "serviceCallback", ")", "{", "return", "ServiceFuture", ".", "fromResponse", "(", "createCertificateWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "certificateName", ",", "certificatePolicy", ",", "certificateAttributes", ",", "tags", ")", ",", "serviceCallback", ")", ";", "}" ]
Creates a new certificate. If this is the first version, the certificate resource is created. This operation requires the certificates/create permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate. @param certificatePolicy The management policy for the certificate. @param certificateAttributes The attributes of the certificate (optional). @param tags Application specific metadata in the form of key-value pairs. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Creates", "a", "new", "certificate", ".", "If", "this", "is", "the", "first", "version", "the", "certificate", "resource", "is", "created", ".", "This", "operation", "requires", "the", "certificates", "/", "create", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L6596-L6598
FasterXML/woodstox
src/main/java/com/ctc/wstx/sr/TypedStreamReader.java
TypedStreamReader._constructTypeException
protected TypedXMLStreamException _constructTypeException(IllegalArgumentException iae, String lexicalValue) { """ Method called to wrap or convert given conversion-fail exception into a full {@link TypedXMLStreamException}, @param iae Problem as reported by converter @param lexicalValue Lexical value (element content, attribute value) that could not be converted succesfully. """ return new TypedXMLStreamException(lexicalValue, iae.getMessage(), getStartLocation(), iae); }
java
protected TypedXMLStreamException _constructTypeException(IllegalArgumentException iae, String lexicalValue) { return new TypedXMLStreamException(lexicalValue, iae.getMessage(), getStartLocation(), iae); }
[ "protected", "TypedXMLStreamException", "_constructTypeException", "(", "IllegalArgumentException", "iae", ",", "String", "lexicalValue", ")", "{", "return", "new", "TypedXMLStreamException", "(", "lexicalValue", ",", "iae", ".", "getMessage", "(", ")", ",", "getStartLocation", "(", ")", ",", "iae", ")", ";", "}" ]
Method called to wrap or convert given conversion-fail exception into a full {@link TypedXMLStreamException}, @param iae Problem as reported by converter @param lexicalValue Lexical value (element content, attribute value) that could not be converted succesfully.
[ "Method", "called", "to", "wrap", "or", "convert", "given", "conversion", "-", "fail", "exception", "into", "a", "full", "{", "@link", "TypedXMLStreamException", "}" ]
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/TypedStreamReader.java#L782-L785
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/maven3/Maven3Builder.java
Maven3Builder.copyClassWorldsFile
private FilePath copyClassWorldsFile(FilePath ws, URL resource) { """ Copies a classworlds file to a temporary location either on the local filesystem or on a slave depending on the node type. @return The path of the classworlds.conf file """ try { FilePath remoteClassworlds = ws.createTextTempFile("classworlds", "conf", ""); remoteClassworlds.copyFrom(resource); return remoteClassworlds; } catch (Exception e) { throw new RuntimeException(e); } }
java
private FilePath copyClassWorldsFile(FilePath ws, URL resource) { try { FilePath remoteClassworlds = ws.createTextTempFile("classworlds", "conf", ""); remoteClassworlds.copyFrom(resource); return remoteClassworlds; } catch (Exception e) { throw new RuntimeException(e); } }
[ "private", "FilePath", "copyClassWorldsFile", "(", "FilePath", "ws", ",", "URL", "resource", ")", "{", "try", "{", "FilePath", "remoteClassworlds", "=", "ws", ".", "createTextTempFile", "(", "\"classworlds\"", ",", "\"conf\"", ",", "\"\"", ")", ";", "remoteClassworlds", ".", "copyFrom", "(", "resource", ")", ";", "return", "remoteClassworlds", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Copies a classworlds file to a temporary location either on the local filesystem or on a slave depending on the node type. @return The path of the classworlds.conf file
[ "Copies", "a", "classworlds", "file", "to", "a", "temporary", "location", "either", "on", "the", "local", "filesystem", "or", "on", "a", "slave", "depending", "on", "the", "node", "type", "." ]
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/maven3/Maven3Builder.java#L284-L293
cucumber/cucumber-jvm
java/src/main/java/cucumber/runtime/java/ObjectFactoryLoader.java
ObjectFactoryLoader.loadObjectFactory
public static ObjectFactory loadObjectFactory(ClassFinder classFinder, String objectFactoryClassName) { """ Loads an instance of {@link ObjectFactory}. The class name can be explicit, or it can be null. When it's null, the implementation is searched for in the <pre>cucumber.runtime</pre> packahe. @param classFinder where to load classes from @param objectFactoryClassName specific class name of {@link ObjectFactory} implementation. May be null. @return an instance of {@link ObjectFactory} """ ObjectFactory objectFactory; try { Reflections reflections = new Reflections(classFinder); if (objectFactoryClassName != null) { Class<ObjectFactory> objectFactoryClass = (Class<ObjectFactory>) classFinder.loadClass(objectFactoryClassName); objectFactory = reflections.newInstance(new Class[0], new Object[0], objectFactoryClass); } else { List<URI> packages = asList(URI.create("classpath:cucumber/runtime")); objectFactory = reflections.instantiateExactlyOneSubclass(ObjectFactory.class, packages, new Class[0], new Object[0], null); } } catch (TooManyInstancesException e) { log.warn(e.getMessage()); log.warn(getMultipleObjectFactoryLogMessage()); objectFactory = new DefaultJavaObjectFactory(); } catch (NoInstancesException e) { objectFactory = new DefaultJavaObjectFactory(); } catch (ClassNotFoundException e) { throw new CucumberException("Couldn't instantiate custom ObjectFactory", e); } return objectFactory; }
java
public static ObjectFactory loadObjectFactory(ClassFinder classFinder, String objectFactoryClassName) { ObjectFactory objectFactory; try { Reflections reflections = new Reflections(classFinder); if (objectFactoryClassName != null) { Class<ObjectFactory> objectFactoryClass = (Class<ObjectFactory>) classFinder.loadClass(objectFactoryClassName); objectFactory = reflections.newInstance(new Class[0], new Object[0], objectFactoryClass); } else { List<URI> packages = asList(URI.create("classpath:cucumber/runtime")); objectFactory = reflections.instantiateExactlyOneSubclass(ObjectFactory.class, packages, new Class[0], new Object[0], null); } } catch (TooManyInstancesException e) { log.warn(e.getMessage()); log.warn(getMultipleObjectFactoryLogMessage()); objectFactory = new DefaultJavaObjectFactory(); } catch (NoInstancesException e) { objectFactory = new DefaultJavaObjectFactory(); } catch (ClassNotFoundException e) { throw new CucumberException("Couldn't instantiate custom ObjectFactory", e); } return objectFactory; }
[ "public", "static", "ObjectFactory", "loadObjectFactory", "(", "ClassFinder", "classFinder", ",", "String", "objectFactoryClassName", ")", "{", "ObjectFactory", "objectFactory", ";", "try", "{", "Reflections", "reflections", "=", "new", "Reflections", "(", "classFinder", ")", ";", "if", "(", "objectFactoryClassName", "!=", "null", ")", "{", "Class", "<", "ObjectFactory", ">", "objectFactoryClass", "=", "(", "Class", "<", "ObjectFactory", ">", ")", "classFinder", ".", "loadClass", "(", "objectFactoryClassName", ")", ";", "objectFactory", "=", "reflections", ".", "newInstance", "(", "new", "Class", "[", "0", "]", ",", "new", "Object", "[", "0", "]", ",", "objectFactoryClass", ")", ";", "}", "else", "{", "List", "<", "URI", ">", "packages", "=", "asList", "(", "URI", ".", "create", "(", "\"classpath:cucumber/runtime\"", ")", ")", ";", "objectFactory", "=", "reflections", ".", "instantiateExactlyOneSubclass", "(", "ObjectFactory", ".", "class", ",", "packages", ",", "new", "Class", "[", "0", "]", ",", "new", "Object", "[", "0", "]", ",", "null", ")", ";", "}", "}", "catch", "(", "TooManyInstancesException", "e", ")", "{", "log", ".", "warn", "(", "e", ".", "getMessage", "(", ")", ")", ";", "log", ".", "warn", "(", "getMultipleObjectFactoryLogMessage", "(", ")", ")", ";", "objectFactory", "=", "new", "DefaultJavaObjectFactory", "(", ")", ";", "}", "catch", "(", "NoInstancesException", "e", ")", "{", "objectFactory", "=", "new", "DefaultJavaObjectFactory", "(", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "throw", "new", "CucumberException", "(", "\"Couldn't instantiate custom ObjectFactory\"", ",", "e", ")", ";", "}", "return", "objectFactory", ";", "}" ]
Loads an instance of {@link ObjectFactory}. The class name can be explicit, or it can be null. When it's null, the implementation is searched for in the <pre>cucumber.runtime</pre> packahe. @param classFinder where to load classes from @param objectFactoryClassName specific class name of {@link ObjectFactory} implementation. May be null. @return an instance of {@link ObjectFactory}
[ "Loads", "an", "instance", "of", "{", "@link", "ObjectFactory", "}", ".", "The", "class", "name", "can", "be", "explicit", "or", "it", "can", "be", "null", ".", "When", "it", "s", "null", "the", "implementation", "is", "searched", "for", "in", "the", "<pre", ">", "cucumber", ".", "runtime<", "/", "pre", ">", "packahe", "." ]
train
https://github.com/cucumber/cucumber-jvm/blob/437bb3a1f1d91b56f44059c835765b395eefc777/java/src/main/java/cucumber/runtime/java/ObjectFactoryLoader.java#L32-L54
datasalt/pangool
core/src/main/java/com/datasalt/pangool/io/Mutator.java
Mutator.minusFields
public static Schema minusFields(Schema schema, String... minusFields) { """ Creates a new schema which has exactly the same fields as the input Schema minus the field names that are specified as "minusFields". This is equivalent to calling {@link #subSetOf(Schema, String...)} with the list of Fields that must remain, but instead here we specify the fields that should NOT remain. <p> The name of the schema is auto-generated with a static counter. """ return minusFields("minusSchema" + (COUNTER++), schema, minusFields); }
java
public static Schema minusFields(Schema schema, String... minusFields) { return minusFields("minusSchema" + (COUNTER++), schema, minusFields); }
[ "public", "static", "Schema", "minusFields", "(", "Schema", "schema", ",", "String", "...", "minusFields", ")", "{", "return", "minusFields", "(", "\"minusSchema\"", "+", "(", "COUNTER", "++", ")", ",", "schema", ",", "minusFields", ")", ";", "}" ]
Creates a new schema which has exactly the same fields as the input Schema minus the field names that are specified as "minusFields". This is equivalent to calling {@link #subSetOf(Schema, String...)} with the list of Fields that must remain, but instead here we specify the fields that should NOT remain. <p> The name of the schema is auto-generated with a static counter.
[ "Creates", "a", "new", "schema", "which", "has", "exactly", "the", "same", "fields", "as", "the", "input", "Schema", "minus", "the", "field", "names", "that", "are", "specified", "as", "minusFields", ".", "This", "is", "equivalent", "to", "calling", "{" ]
train
https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/io/Mutator.java#L24-L26
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/util/Utils.java
Utils.join
@SuppressWarnings( { """ Collectionの要素を指定した区切り文字で繋げて1つの文字列とする。 @param col 結合対象のコレクション @param separator 区切り文字 @param elementConverter 要素を変換するクラス。 @return 結合した文字列 """"rawtypes", "unchecked"}) public static String join(final Collection<?> col, final String separator, final ElementConverter elementConverter) { if(col == null) { return ""; } final int size = col.size(); if(size == 0) { return ""; } StringBuilder sb = new StringBuilder(); for(Iterator<?> itr = col.iterator(); itr.hasNext();) { final Object element = itr.next(); String text = elementConverter.convertToString(element); sb.append(text); if(separator != null && itr.hasNext()) { sb.append(separator); } } return sb.toString(); }
java
@SuppressWarnings({"rawtypes", "unchecked"}) public static String join(final Collection<?> col, final String separator, final ElementConverter elementConverter) { if(col == null) { return ""; } final int size = col.size(); if(size == 0) { return ""; } StringBuilder sb = new StringBuilder(); for(Iterator<?> itr = col.iterator(); itr.hasNext();) { final Object element = itr.next(); String text = elementConverter.convertToString(element); sb.append(text); if(separator != null && itr.hasNext()) { sb.append(separator); } } return sb.toString(); }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "static", "String", "join", "(", "final", "Collection", "<", "?", ">", "col", ",", "final", "String", "separator", ",", "final", "ElementConverter", "elementConverter", ")", "{", "if", "(", "col", "==", "null", ")", "{", "return", "\"\"", ";", "}", "final", "int", "size", "=", "col", ".", "size", "(", ")", ";", "if", "(", "size", "==", "0", ")", "{", "return", "\"\"", ";", "}", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Iterator", "<", "?", ">", "itr", "=", "col", ".", "iterator", "(", ")", ";", "itr", ".", "hasNext", "(", ")", ";", ")", "{", "final", "Object", "element", "=", "itr", ".", "next", "(", ")", ";", "String", "text", "=", "elementConverter", ".", "convertToString", "(", "element", ")", ";", "sb", ".", "append", "(", "text", ")", ";", "if", "(", "separator", "!=", "null", "&&", "itr", ".", "hasNext", "(", ")", ")", "{", "sb", ".", "append", "(", "separator", ")", ";", "}", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Collectionの要素を指定した区切り文字で繋げて1つの文字列とする。 @param col 結合対象のコレクション @param separator 区切り文字 @param elementConverter 要素を変換するクラス。 @return 結合した文字列
[ "Collectionの要素を指定した区切り文字で繋げて1つの文字列とする。" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/util/Utils.java#L162-L187
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMessages.java
WMessages.addMessage
private void addMessage(final WMessageBox box, final Message message, final boolean encode) { """ Convenience method to add a message to a message box. @param box the message box to add the message to @param message the message to add @param encode true to encode the message, false otherwise. """ String code = message.getMessage(); if (!Util.empty(code)) { box.addMessage(encode, code, message.getArgs()); } }
java
private void addMessage(final WMessageBox box, final Message message, final boolean encode) { String code = message.getMessage(); if (!Util.empty(code)) { box.addMessage(encode, code, message.getArgs()); } }
[ "private", "void", "addMessage", "(", "final", "WMessageBox", "box", ",", "final", "Message", "message", ",", "final", "boolean", "encode", ")", "{", "String", "code", "=", "message", ".", "getMessage", "(", ")", ";", "if", "(", "!", "Util", ".", "empty", "(", "code", ")", ")", "{", "box", ".", "addMessage", "(", "encode", ",", "code", ",", "message", ".", "getArgs", "(", ")", ")", ";", "}", "}" ]
Convenience method to add a message to a message box. @param box the message box to add the message to @param message the message to add @param encode true to encode the message, false otherwise.
[ "Convenience", "method", "to", "add", "a", "message", "to", "a", "message", "box", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMessages.java#L398-L404
Azure/azure-sdk-for-java
servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/TokenProvider.java
TokenProvider.createAzureActiveDirectoryTokenProvider
public static TokenProvider createAzureActiveDirectoryTokenProvider(String authorityUrl, String clientId, String userName, String password) throws MalformedURLException { """ Creates an Azure Active Directory token provider that acquires a token from the given active directory instance using the given clientId, username and password. This is a utility method. @param authorityUrl URL of the Azure Active Directory instance @param clientId client id of the application @param userName user name @param password password @return an instance of Azure Active Directory token provider @throws MalformedURLException if the authority URL is not well formed """ AuthenticationContext authContext = createAuthenticationContext(authorityUrl); return new AzureActiveDirectoryTokenProvider(authContext, clientId, userName, password); }
java
public static TokenProvider createAzureActiveDirectoryTokenProvider(String authorityUrl, String clientId, String userName, String password) throws MalformedURLException { AuthenticationContext authContext = createAuthenticationContext(authorityUrl); return new AzureActiveDirectoryTokenProvider(authContext, clientId, userName, password); }
[ "public", "static", "TokenProvider", "createAzureActiveDirectoryTokenProvider", "(", "String", "authorityUrl", ",", "String", "clientId", ",", "String", "userName", ",", "String", "password", ")", "throws", "MalformedURLException", "{", "AuthenticationContext", "authContext", "=", "createAuthenticationContext", "(", "authorityUrl", ")", ";", "return", "new", "AzureActiveDirectoryTokenProvider", "(", "authContext", ",", "clientId", ",", "userName", ",", "password", ")", ";", "}" ]
Creates an Azure Active Directory token provider that acquires a token from the given active directory instance using the given clientId, username and password. This is a utility method. @param authorityUrl URL of the Azure Active Directory instance @param clientId client id of the application @param userName user name @param password password @return an instance of Azure Active Directory token provider @throws MalformedURLException if the authority URL is not well formed
[ "Creates", "an", "Azure", "Active", "Directory", "token", "provider", "that", "acquires", "a", "token", "from", "the", "given", "active", "directory", "instance", "using", "the", "given", "clientId", "username", "and", "password", ".", "This", "is", "a", "utility", "method", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/TokenProvider.java#L60-L64
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java
ClassBuilder.buildClassDoc
public void buildClassDoc(XMLNode node, Content contentTree) throws Exception { """ Handles the {@literal <ClassDoc>} tag. @param node the XML element that specifies which components to document @param contentTree the content tree to which the documentation will be added """ String key; if (isInterface) { key = "doclet.Interface"; } else if (isEnum) { key = "doclet.Enum"; } else { key = "doclet.Class"; } contentTree = writer.getHeader(configuration.getText(key) + " " + classDoc.name()); Content classContentTree = writer.getClassContentHeader(); buildChildren(node, classContentTree); writer.addClassContentTree(contentTree, classContentTree); writer.addFooter(contentTree); writer.printDocument(contentTree); writer.close(); copyDocFiles(); }
java
public void buildClassDoc(XMLNode node, Content contentTree) throws Exception { String key; if (isInterface) { key = "doclet.Interface"; } else if (isEnum) { key = "doclet.Enum"; } else { key = "doclet.Class"; } contentTree = writer.getHeader(configuration.getText(key) + " " + classDoc.name()); Content classContentTree = writer.getClassContentHeader(); buildChildren(node, classContentTree); writer.addClassContentTree(contentTree, classContentTree); writer.addFooter(contentTree); writer.printDocument(contentTree); writer.close(); copyDocFiles(); }
[ "public", "void", "buildClassDoc", "(", "XMLNode", "node", ",", "Content", "contentTree", ")", "throws", "Exception", "{", "String", "key", ";", "if", "(", "isInterface", ")", "{", "key", "=", "\"doclet.Interface\"", ";", "}", "else", "if", "(", "isEnum", ")", "{", "key", "=", "\"doclet.Enum\"", ";", "}", "else", "{", "key", "=", "\"doclet.Class\"", ";", "}", "contentTree", "=", "writer", ".", "getHeader", "(", "configuration", ".", "getText", "(", "key", ")", "+", "\" \"", "+", "classDoc", ".", "name", "(", ")", ")", ";", "Content", "classContentTree", "=", "writer", ".", "getClassContentHeader", "(", ")", ";", "buildChildren", "(", "node", ",", "classContentTree", ")", ";", "writer", ".", "addClassContentTree", "(", "contentTree", ",", "classContentTree", ")", ";", "writer", ".", "addFooter", "(", "contentTree", ")", ";", "writer", ".", "printDocument", "(", "contentTree", ")", ";", "writer", ".", "close", "(", ")", ";", "copyDocFiles", "(", ")", ";", "}" ]
Handles the {@literal <ClassDoc>} tag. @param node the XML element that specifies which components to document @param contentTree the content tree to which the documentation will be added
[ "Handles", "the", "{", "@literal", "<ClassDoc", ">", "}", "tag", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java#L135-L153
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/util/type/TypeUtils.java
TypeUtils.convertToObject
public static final Object convertToObject(String value, Class type) { """ Convert an object from a String to the given type. @deprecated @param value the String to convert @param type the type to which to convert the String @return the Object result of converting the String to the type. @throws TypeConverterNotFoundException if a TypeConverter for the target type can not be found. """ return convertToObject(value, type, null); }
java
public static final Object convertToObject(String value, Class type) { return convertToObject(value, type, null); }
[ "public", "static", "final", "Object", "convertToObject", "(", "String", "value", ",", "Class", "type", ")", "{", "return", "convertToObject", "(", "value", ",", "type", ",", "null", ")", ";", "}" ]
Convert an object from a String to the given type. @deprecated @param value the String to convert @param type the type to which to convert the String @return the Object result of converting the String to the type. @throws TypeConverterNotFoundException if a TypeConverter for the target type can not be found.
[ "Convert", "an", "object", "from", "a", "String", "to", "the", "given", "type", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/util/type/TypeUtils.java#L81-L83
Red5/red5-io
src/main/java/org/red5/io/flv/meta/MetaService.java
MetaService.injectMetaCue
private static ITag injectMetaCue(IMetaCue meta, ITag tag) { """ Injects metadata (Cue Points) into a tag @param meta Metadata (cue points) @param tag Tag @return ITag tag New tag with injected metadata """ // IMeta meta = (MetaCue) cue; Output out = new Output(IoBuffer.allocate(1000)); Serializer.serialize(out, "onCuePoint"); Serializer.serialize(out, meta); IoBuffer tmpBody = out.buf().flip(); int tmpBodySize = out.buf().limit(); int tmpPreviousTagSize = tag.getPreviousTagSize(); int tmpTimestamp = getTimeInMilliseconds(meta); return new Tag(IoConstants.TYPE_METADATA, tmpTimestamp, tmpBodySize, tmpBody, tmpPreviousTagSize); }
java
private static ITag injectMetaCue(IMetaCue meta, ITag tag) { // IMeta meta = (MetaCue) cue; Output out = new Output(IoBuffer.allocate(1000)); Serializer.serialize(out, "onCuePoint"); Serializer.serialize(out, meta); IoBuffer tmpBody = out.buf().flip(); int tmpBodySize = out.buf().limit(); int tmpPreviousTagSize = tag.getPreviousTagSize(); int tmpTimestamp = getTimeInMilliseconds(meta); return new Tag(IoConstants.TYPE_METADATA, tmpTimestamp, tmpBodySize, tmpBody, tmpPreviousTagSize); }
[ "private", "static", "ITag", "injectMetaCue", "(", "IMetaCue", "meta", ",", "ITag", "tag", ")", "{", "// IMeta meta = (MetaCue) cue;", "Output", "out", "=", "new", "Output", "(", "IoBuffer", ".", "allocate", "(", "1000", ")", ")", ";", "Serializer", ".", "serialize", "(", "out", ",", "\"onCuePoint\"", ")", ";", "Serializer", ".", "serialize", "(", "out", ",", "meta", ")", ";", "IoBuffer", "tmpBody", "=", "out", ".", "buf", "(", ")", ".", "flip", "(", ")", ";", "int", "tmpBodySize", "=", "out", ".", "buf", "(", ")", ".", "limit", "(", ")", ";", "int", "tmpPreviousTagSize", "=", "tag", ".", "getPreviousTagSize", "(", ")", ";", "int", "tmpTimestamp", "=", "getTimeInMilliseconds", "(", "meta", ")", ";", "return", "new", "Tag", "(", "IoConstants", ".", "TYPE_METADATA", ",", "tmpTimestamp", ",", "tmpBodySize", ",", "tmpBody", ",", "tmpPreviousTagSize", ")", ";", "}" ]
Injects metadata (Cue Points) into a tag @param meta Metadata (cue points) @param tag Tag @return ITag tag New tag with injected metadata
[ "Injects", "metadata", "(", "Cue", "Points", ")", "into", "a", "tag" ]
train
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/flv/meta/MetaService.java#L232-L244
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java
MPD9AbstractReader.getDefaultOnNull
public Integer getDefaultOnNull(Integer value, Integer defaultValue) { """ Returns a default value if a null value is found. @param value value under test @param defaultValue default if value is null @return value """ return (value == null ? defaultValue : value); }
java
public Integer getDefaultOnNull(Integer value, Integer defaultValue) { return (value == null ? defaultValue : value); }
[ "public", "Integer", "getDefaultOnNull", "(", "Integer", "value", ",", "Integer", "defaultValue", ")", "{", "return", "(", "value", "==", "null", "?", "defaultValue", ":", "value", ")", ";", "}" ]
Returns a default value if a null value is found. @param value value under test @param defaultValue default if value is null @return value
[ "Returns", "a", "default", "value", "if", "a", "null", "value", "is", "found", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java#L1307-L1310
kirgor/enklib
common/src/main/java/com/kirgor/enklib/common/NamingUtils.java
NamingUtils.snakeToCamel
public static String snakeToCamel(String snake, boolean upper) { """ Converts snake case string (lower or upper) to camel case, for example 'hello_world' or 'HELLO_WORLD' -> 'helloWorld' or 'HelloWorld'. @param snake Input string. @param upper True if result snake cased string should be upper cased like 'HelloWorld'. """ StringBuilder sb = new StringBuilder(); boolean firstWord = true; for (String word : snake.split("_")) { if (!word.isEmpty()) { if (firstWord && !upper) { sb.append(word.toLowerCase()); } else { sb.append(Character.toUpperCase(word.charAt(0))).append(word.substring(1).toLowerCase()); } firstWord = false; } } return sb.toString(); }
java
public static String snakeToCamel(String snake, boolean upper) { StringBuilder sb = new StringBuilder(); boolean firstWord = true; for (String word : snake.split("_")) { if (!word.isEmpty()) { if (firstWord && !upper) { sb.append(word.toLowerCase()); } else { sb.append(Character.toUpperCase(word.charAt(0))).append(word.substring(1).toLowerCase()); } firstWord = false; } } return sb.toString(); }
[ "public", "static", "String", "snakeToCamel", "(", "String", "snake", ",", "boolean", "upper", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "boolean", "firstWord", "=", "true", ";", "for", "(", "String", "word", ":", "snake", ".", "split", "(", "\"_\"", ")", ")", "{", "if", "(", "!", "word", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "firstWord", "&&", "!", "upper", ")", "{", "sb", ".", "append", "(", "word", ".", "toLowerCase", "(", ")", ")", ";", "}", "else", "{", "sb", ".", "append", "(", "Character", ".", "toUpperCase", "(", "word", ".", "charAt", "(", "0", ")", ")", ")", ".", "append", "(", "word", ".", "substring", "(", "1", ")", ".", "toLowerCase", "(", ")", ")", ";", "}", "firstWord", "=", "false", ";", "}", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Converts snake case string (lower or upper) to camel case, for example 'hello_world' or 'HELLO_WORLD' -> 'helloWorld' or 'HelloWorld'. @param snake Input string. @param upper True if result snake cased string should be upper cased like 'HelloWorld'.
[ "Converts", "snake", "case", "string", "(", "lower", "or", "upper", ")", "to", "camel", "case", "for", "example", "hello_world", "or", "HELLO_WORLD", "-", ">", "helloWorld", "or", "HelloWorld", "." ]
train
https://github.com/kirgor/enklib/blob/8a24db296dc43db5d8fe509cf64ace0a0c7be8f2/common/src/main/java/com/kirgor/enklib/common/NamingUtils.java#L82-L96
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/randomizers/range/OffsetTimeRangeRandomizer.java
OffsetTimeRangeRandomizer.aNewOffsetTimeRangeRandomizer
public static OffsetTimeRangeRandomizer aNewOffsetTimeRangeRandomizer(final OffsetTime min, final OffsetTime max, final long seed) { """ Create a new {@link OffsetTimeRangeRandomizer}. @param min min value @param max max value @param seed initial seed @return a new {@link OffsetTimeRangeRandomizer}. """ return new OffsetTimeRangeRandomizer(min, max, seed); }
java
public static OffsetTimeRangeRandomizer aNewOffsetTimeRangeRandomizer(final OffsetTime min, final OffsetTime max, final long seed) { return new OffsetTimeRangeRandomizer(min, max, seed); }
[ "public", "static", "OffsetTimeRangeRandomizer", "aNewOffsetTimeRangeRandomizer", "(", "final", "OffsetTime", "min", ",", "final", "OffsetTime", "max", ",", "final", "long", "seed", ")", "{", "return", "new", "OffsetTimeRangeRandomizer", "(", "min", ",", "max", ",", "seed", ")", ";", "}" ]
Create a new {@link OffsetTimeRangeRandomizer}. @param min min value @param max max value @param seed initial seed @return a new {@link OffsetTimeRangeRandomizer}.
[ "Create", "a", "new", "{", "@link", "OffsetTimeRangeRandomizer", "}", "." ]
train
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/randomizers/range/OffsetTimeRangeRandomizer.java#L77-L79
micronaut-projects/micronaut-core
http-server-netty/src/main/java/io/micronaut/http/server/netty/EpollEventLoopGroupFactory.java
EpollEventLoopGroupFactory.createEventLoopGroup
@Override public EventLoopGroup createEventLoopGroup(int threads, @Nullable Integer ioRatio) { """ Creates an EpollEventLoopGroup. @param threads The number of threads to use. @param ioRatio The io ratio. @return An EpollEventLoopGroup. """ return withIoRatio(new EpollEventLoopGroup(threads), ioRatio); }
java
@Override public EventLoopGroup createEventLoopGroup(int threads, @Nullable Integer ioRatio) { return withIoRatio(new EpollEventLoopGroup(threads), ioRatio); }
[ "@", "Override", "public", "EventLoopGroup", "createEventLoopGroup", "(", "int", "threads", ",", "@", "Nullable", "Integer", "ioRatio", ")", "{", "return", "withIoRatio", "(", "new", "EpollEventLoopGroup", "(", "threads", ")", ",", "ioRatio", ")", ";", "}" ]
Creates an EpollEventLoopGroup. @param threads The number of threads to use. @param ioRatio The io ratio. @return An EpollEventLoopGroup.
[ "Creates", "an", "EpollEventLoopGroup", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/http-server-netty/src/main/java/io/micronaut/http/server/netty/EpollEventLoopGroupFactory.java#L58-L61
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/VoiceApi.java
VoiceApi.sendUserEventWithHttpInfo
public ApiResponse<ApiSuccessResponse> sendUserEventWithHttpInfo(SendUserEventData userEventData) throws ApiException { """ Send a userEvent event to T-Server Send EventUserEvent to T-Server with the provided attached data. For details about EventUserEvent, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System). @param userEventData The data to send. This is an array of objects with the properties key, type, and value. (required) @return ApiResponse&lt;ApiSuccessResponse&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ com.squareup.okhttp.Call call = sendUserEventValidateBeforeCall(userEventData, null, null); Type localVarReturnType = new TypeToken<ApiSuccessResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
public ApiResponse<ApiSuccessResponse> sendUserEventWithHttpInfo(SendUserEventData userEventData) throws ApiException { com.squareup.okhttp.Call call = sendUserEventValidateBeforeCall(userEventData, null, null); Type localVarReturnType = new TypeToken<ApiSuccessResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
[ "public", "ApiResponse", "<", "ApiSuccessResponse", ">", "sendUserEventWithHttpInfo", "(", "SendUserEventData", "userEventData", ")", "throws", "ApiException", "{", "com", ".", "squareup", ".", "okhttp", ".", "Call", "call", "=", "sendUserEventValidateBeforeCall", "(", "userEventData", ",", "null", ",", "null", ")", ";", "Type", "localVarReturnType", "=", "new", "TypeToken", "<", "ApiSuccessResponse", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ";", "return", "apiClient", ".", "execute", "(", "call", ",", "localVarReturnType", ")", ";", "}" ]
Send a userEvent event to T-Server Send EventUserEvent to T-Server with the provided attached data. For details about EventUserEvent, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System). @param userEventData The data to send. This is an array of objects with the properties key, type, and value. (required) @return ApiResponse&lt;ApiSuccessResponse&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Send", "a", "userEvent", "event", "to", "T", "-", "Server", "Send", "EventUserEvent", "to", "T", "-", "Server", "with", "the", "provided", "attached", "data", ".", "For", "details", "about", "EventUserEvent", "refer", "to", "the", "[", "*", "Genesys", "Events", "and", "Models", "Reference", "Manual", "*", "]", "(", "https", ":", "//", "docs", ".", "genesys", ".", "com", "/", "Documentation", "/", "System", ")", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/VoiceApi.java#L3497-L3501
prestodb/presto
presto-accumulo/src/main/java/com/facebook/presto/accumulo/index/Indexer.java
Indexer.getIndexColumnFamily
public static ByteBuffer getIndexColumnFamily(byte[] columnFamily, byte[] columnQualifier) { """ Gets the column family of the index table based on the given column family and qualifier. @param columnFamily Presto column family @param columnQualifier Presto column qualifier @return ByteBuffer of the given index column family """ return wrap(ArrayUtils.addAll(ArrayUtils.add(columnFamily, UNDERSCORE), columnQualifier)); }
java
public static ByteBuffer getIndexColumnFamily(byte[] columnFamily, byte[] columnQualifier) { return wrap(ArrayUtils.addAll(ArrayUtils.add(columnFamily, UNDERSCORE), columnQualifier)); }
[ "public", "static", "ByteBuffer", "getIndexColumnFamily", "(", "byte", "[", "]", "columnFamily", ",", "byte", "[", "]", "columnQualifier", ")", "{", "return", "wrap", "(", "ArrayUtils", ".", "addAll", "(", "ArrayUtils", ".", "add", "(", "columnFamily", ",", "UNDERSCORE", ")", ",", "columnQualifier", ")", ")", ";", "}" ]
Gets the column family of the index table based on the given column family and qualifier. @param columnFamily Presto column family @param columnQualifier Presto column qualifier @return ByteBuffer of the given index column family
[ "Gets", "the", "column", "family", "of", "the", "index", "table", "based", "on", "the", "given", "column", "family", "and", "qualifier", "." ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/index/Indexer.java#L397-L400
j256/ormlite-core
src/main/java/com/j256/ormlite/table/TableUtils.java
TableUtils.createTableIfNotExists
public static <T> int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig) throws SQLException { """ Create a table if it does not already exist. This is not supported by all databases. """ Dao<T, ?> dao = DaoManager.createDao(connectionSource, tableConfig); return doCreateTable(dao, true); }
java
public static <T> int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, tableConfig); return doCreateTable(dao, true); }
[ "public", "static", "<", "T", ">", "int", "createTableIfNotExists", "(", "ConnectionSource", "connectionSource", ",", "DatabaseTableConfig", "<", "T", ">", "tableConfig", ")", "throws", "SQLException", "{", "Dao", "<", "T", ",", "?", ">", "dao", "=", "DaoManager", ".", "createDao", "(", "connectionSource", ",", "tableConfig", ")", ";", "return", "doCreateTable", "(", "dao", ",", "true", ")", ";", "}" ]
Create a table if it does not already exist. This is not supported by all databases.
[ "Create", "a", "table", "if", "it", "does", "not", "already", "exist", ".", "This", "is", "not", "supported", "by", "all", "databases", "." ]
train
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/table/TableUtils.java#L97-L101
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.faulttolerance.spi/src/com/ibm/ws/microprofile/faulttolerance/utils/FTDebug.java
FTDebug.relativeSeconds
@Trivial public static double relativeSeconds(long relativePointA, long relativePointB) { """ in seconds, how long between two a relative points (nanoTime) """ long diff = relativePointB - relativePointA; double seconds = toSeconds(diff); return seconds; }
java
@Trivial public static double relativeSeconds(long relativePointA, long relativePointB) { long diff = relativePointB - relativePointA; double seconds = toSeconds(diff); return seconds; }
[ "@", "Trivial", "public", "static", "double", "relativeSeconds", "(", "long", "relativePointA", ",", "long", "relativePointB", ")", "{", "long", "diff", "=", "relativePointB", "-", "relativePointA", ";", "double", "seconds", "=", "toSeconds", "(", "diff", ")", ";", "return", "seconds", ";", "}" ]
in seconds, how long between two a relative points (nanoTime)
[ "in", "seconds", "how", "long", "between", "two", "a", "relative", "points", "(", "nanoTime", ")" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance.spi/src/com/ibm/ws/microprofile/faulttolerance/utils/FTDebug.java#L83-L88
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.containsAll
public static boolean containsAll(Iterable self, Object[] items) { """ Returns <tt>true</tt> if this iterable contains all of the elements in the specified array. @param self an Iterable to be checked for containment @param items array to be checked for containment in this iterable @return <tt>true</tt> if this collection contains all of the elements in the specified array @see Collection#containsAll(Collection) @since 2.4.0 """ return asCollection(self).containsAll(Arrays.asList(items)); }
java
public static boolean containsAll(Iterable self, Object[] items) { return asCollection(self).containsAll(Arrays.asList(items)); }
[ "public", "static", "boolean", "containsAll", "(", "Iterable", "self", ",", "Object", "[", "]", "items", ")", "{", "return", "asCollection", "(", "self", ")", ".", "containsAll", "(", "Arrays", ".", "asList", "(", "items", ")", ")", ";", "}" ]
Returns <tt>true</tt> if this iterable contains all of the elements in the specified array. @param self an Iterable to be checked for containment @param items array to be checked for containment in this iterable @return <tt>true</tt> if this collection contains all of the elements in the specified array @see Collection#containsAll(Collection) @since 2.4.0
[ "Returns", "<tt", ">", "true<", "/", "tt", ">", "if", "this", "iterable", "contains", "all", "of", "the", "elements", "in", "the", "specified", "array", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L4941-L4943
wisdom-framework/wisdom
extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/wisdom/ControllerModel.java
ControllerModel.from
public static JsonNode from(Controller controller, Router router, Json json) { """ Creates the Json representation for a valid (exposed) controller. @param controller the controller @param router the router @param json the json service @return the json representation """ ObjectNode node = json.newObject(); node.put("classname", controller.getClass().getName()) .put("invalid", false) .put("routes", getRoutes(controller, router, json)); return node; }
java
public static JsonNode from(Controller controller, Router router, Json json) { ObjectNode node = json.newObject(); node.put("classname", controller.getClass().getName()) .put("invalid", false) .put("routes", getRoutes(controller, router, json)); return node; }
[ "public", "static", "JsonNode", "from", "(", "Controller", "controller", ",", "Router", "router", ",", "Json", "json", ")", "{", "ObjectNode", "node", "=", "json", ".", "newObject", "(", ")", ";", "node", ".", "put", "(", "\"classname\"", ",", "controller", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ".", "put", "(", "\"invalid\"", ",", "false", ")", ".", "put", "(", "\"routes\"", ",", "getRoutes", "(", "controller", ",", "router", ",", "json", ")", ")", ";", "return", "node", ";", "}" ]
Creates the Json representation for a valid (exposed) controller. @param controller the controller @param router the router @param json the json service @return the json representation
[ "Creates", "the", "Json", "representation", "for", "a", "valid", "(", "exposed", ")", "controller", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/wisdom/ControllerModel.java#L79-L85
VoltDB/voltdb
third_party/java/src/com/google_voltpatches/common/util/concurrent/AbstractFuture.java
AbstractFuture.getFutureValue
private static Object getFutureValue(ListenableFuture<?> future) { """ Returns a value, suitable for storing in the {@link #value} field. From the given future, which is assumed to be done. <p>This is approximately the inverse of {@link #getDoneValue(Object)} """ Object valueToSet; if (future instanceof TrustedFuture) { // Break encapsulation for TrustedFuture instances since we know that subclasses cannot // override .get() (since it is final) and therefore this is equivalent to calling .get() // and unpacking the exceptions like we do below (just much faster because it is a single // field read instead of a read, several branches and possibly creating exceptions). return ((AbstractFuture<?>) future).value; } else { // Otherwise calculate valueToSet by calling .get() try { Object v = getDone(future); valueToSet = v == null ? NULL : v; } catch (ExecutionException exception) { valueToSet = new Failure(exception.getCause()); } catch (CancellationException cancellation) { valueToSet = new Cancellation(false, cancellation); } catch (Throwable t) { valueToSet = new Failure(t); } } return valueToSet; }
java
private static Object getFutureValue(ListenableFuture<?> future) { Object valueToSet; if (future instanceof TrustedFuture) { // Break encapsulation for TrustedFuture instances since we know that subclasses cannot // override .get() (since it is final) and therefore this is equivalent to calling .get() // and unpacking the exceptions like we do below (just much faster because it is a single // field read instead of a read, several branches and possibly creating exceptions). return ((AbstractFuture<?>) future).value; } else { // Otherwise calculate valueToSet by calling .get() try { Object v = getDone(future); valueToSet = v == null ? NULL : v; } catch (ExecutionException exception) { valueToSet = new Failure(exception.getCause()); } catch (CancellationException cancellation) { valueToSet = new Cancellation(false, cancellation); } catch (Throwable t) { valueToSet = new Failure(t); } } return valueToSet; }
[ "private", "static", "Object", "getFutureValue", "(", "ListenableFuture", "<", "?", ">", "future", ")", "{", "Object", "valueToSet", ";", "if", "(", "future", "instanceof", "TrustedFuture", ")", "{", "// Break encapsulation for TrustedFuture instances since we know that subclasses cannot", "// override .get() (since it is final) and therefore this is equivalent to calling .get()", "// and unpacking the exceptions like we do below (just much faster because it is a single", "// field read instead of a read, several branches and possibly creating exceptions).", "return", "(", "(", "AbstractFuture", "<", "?", ">", ")", "future", ")", ".", "value", ";", "}", "else", "{", "// Otherwise calculate valueToSet by calling .get()", "try", "{", "Object", "v", "=", "getDone", "(", "future", ")", ";", "valueToSet", "=", "v", "==", "null", "?", "NULL", ":", "v", ";", "}", "catch", "(", "ExecutionException", "exception", ")", "{", "valueToSet", "=", "new", "Failure", "(", "exception", ".", "getCause", "(", ")", ")", ";", "}", "catch", "(", "CancellationException", "cancellation", ")", "{", "valueToSet", "=", "new", "Cancellation", "(", "false", ",", "cancellation", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "valueToSet", "=", "new", "Failure", "(", "t", ")", ";", "}", "}", "return", "valueToSet", ";", "}" ]
Returns a value, suitable for storing in the {@link #value} field. From the given future, which is assumed to be done. <p>This is approximately the inverse of {@link #getDoneValue(Object)}
[ "Returns", "a", "value", "suitable", "for", "storing", "in", "the", "{", "@link", "#value", "}", "field", ".", "From", "the", "given", "future", "which", "is", "assumed", "to", "be", "done", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/util/concurrent/AbstractFuture.java#L770-L792
keenon/loglinear
src/main/java/com/github/keenon/loglinear/model/NDArrayDoubles.java
NDArrayDoubles.setAssignmentValue
public void setAssignmentValue(int[] assignment, double value) { """ Set a single value in the factor table. @param assignment a list of variable settings, in the same order as the neighbors array of the factor @param value the value to put into the factor table """ assert !Double.isNaN(value); values[getTableAccessOffset(assignment)] = value; }
java
public void setAssignmentValue(int[] assignment, double value) { assert !Double.isNaN(value); values[getTableAccessOffset(assignment)] = value; }
[ "public", "void", "setAssignmentValue", "(", "int", "[", "]", "assignment", ",", "double", "value", ")", "{", "assert", "!", "Double", ".", "isNaN", "(", "value", ")", ";", "values", "[", "getTableAccessOffset", "(", "assignment", ")", "]", "=", "value", ";", "}" ]
Set a single value in the factor table. @param assignment a list of variable settings, in the same order as the neighbors array of the factor @param value the value to put into the factor table
[ "Set", "a", "single", "value", "in", "the", "factor", "table", "." ]
train
https://github.com/keenon/loglinear/blob/fa0c370ab6782015412f676ef2ab11c97be58e29/src/main/java/com/github/keenon/loglinear/model/NDArrayDoubles.java#L71-L74
offbynull/coroutines
maven-plugin/src/main/java/com/offbynull/coroutines/mavenplugin/AbstractInstrumentMojo.java
AbstractInstrumentMojo.instrumentPath
protected final void instrumentPath(Log log, List<String> classpath, File path) throws MojoExecutionException { """ Instruments all classes in a path recursively. @param log maven logger @param classpath classpath for classes being instrumented @param path directory containing files to instrument @throws MojoExecutionException if any exception occurs """ try { Instrumenter instrumenter = getInstrumenter(log, classpath); InstrumentationSettings settings = new InstrumentationSettings(markerType, debugMode, autoSerializable); PluginHelper.instrument(instrumenter, settings, path, path, log::info); } catch (Exception ex) { throw new MojoExecutionException("Unable to get compile classpath elements", ex); } }
java
protected final void instrumentPath(Log log, List<String> classpath, File path) throws MojoExecutionException { try { Instrumenter instrumenter = getInstrumenter(log, classpath); InstrumentationSettings settings = new InstrumentationSettings(markerType, debugMode, autoSerializable); PluginHelper.instrument(instrumenter, settings, path, path, log::info); } catch (Exception ex) { throw new MojoExecutionException("Unable to get compile classpath elements", ex); } }
[ "protected", "final", "void", "instrumentPath", "(", "Log", "log", ",", "List", "<", "String", ">", "classpath", ",", "File", "path", ")", "throws", "MojoExecutionException", "{", "try", "{", "Instrumenter", "instrumenter", "=", "getInstrumenter", "(", "log", ",", "classpath", ")", ";", "InstrumentationSettings", "settings", "=", "new", "InstrumentationSettings", "(", "markerType", ",", "debugMode", ",", "autoSerializable", ")", ";", "PluginHelper", ".", "instrument", "(", "instrumenter", ",", "settings", ",", "path", ",", "path", ",", "log", "::", "info", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "new", "MojoExecutionException", "(", "\"Unable to get compile classpath elements\"", ",", "ex", ")", ";", "}", "}" ]
Instruments all classes in a path recursively. @param log maven logger @param classpath classpath for classes being instrumented @param path directory containing files to instrument @throws MojoExecutionException if any exception occurs
[ "Instruments", "all", "classes", "in", "a", "path", "recursively", "." ]
train
https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/maven-plugin/src/main/java/com/offbynull/coroutines/mavenplugin/AbstractInstrumentMojo.java#L57-L67
tootedom/related
app/domain/src/main/java/org/greencheek/related/api/RelatedItemAdditionalProperties.java
RelatedItemAdditionalProperties.setProperty
public void setProperty(String name, String value, int propertyIndex) { """ Sets the property, at the given index, to the given name, and value. @param name The property name @param value the property value @param propertyIndex the property that is to be set or written over. """ additionalProperties[propertyIndex].setName(name); additionalProperties[propertyIndex].setValue(value); }
java
public void setProperty(String name, String value, int propertyIndex) { additionalProperties[propertyIndex].setName(name); additionalProperties[propertyIndex].setValue(value); }
[ "public", "void", "setProperty", "(", "String", "name", ",", "String", "value", ",", "int", "propertyIndex", ")", "{", "additionalProperties", "[", "propertyIndex", "]", ".", "setName", "(", "name", ")", ";", "additionalProperties", "[", "propertyIndex", "]", ".", "setValue", "(", "value", ")", ";", "}" ]
Sets the property, at the given index, to the given name, and value. @param name The property name @param value the property value @param propertyIndex the property that is to be set or written over.
[ "Sets", "the", "property", "at", "the", "given", "index", "to", "the", "given", "name", "and", "value", "." ]
train
https://github.com/tootedom/related/blob/3782dd5a839bbcdc15661d598e8b895aae8aabb7/app/domain/src/main/java/org/greencheek/related/api/RelatedItemAdditionalProperties.java#L128-L131
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/TableBuilder.java
TableBuilder.getRow
public TableRow getRow(final Table table, final TableAppender appender, final String pos) throws FastOdsException, IOException { """ get a row from a table @param table the table @param appender the appender @param pos a pos, e.G. A5 @return the table row @throws FastOdsException if the index is invalid @throws IOException if an I/O error occurs """ final int row = this.positionUtil.getPosition(pos).getRow(); return this.getRow(table, appender, row); }
java
public TableRow getRow(final Table table, final TableAppender appender, final String pos) throws FastOdsException, IOException { final int row = this.positionUtil.getPosition(pos).getRow(); return this.getRow(table, appender, row); }
[ "public", "TableRow", "getRow", "(", "final", "Table", "table", ",", "final", "TableAppender", "appender", ",", "final", "String", "pos", ")", "throws", "FastOdsException", ",", "IOException", "{", "final", "int", "row", "=", "this", ".", "positionUtil", ".", "getPosition", "(", "pos", ")", ".", "getRow", "(", ")", ";", "return", "this", ".", "getRow", "(", "table", ",", "appender", ",", "row", ")", ";", "}" ]
get a row from a table @param table the table @param appender the appender @param pos a pos, e.G. A5 @return the table row @throws FastOdsException if the index is invalid @throws IOException if an I/O error occurs
[ "get", "a", "row", "from", "a", "table" ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/TableBuilder.java#L252-L256
googleads/googleads-java-lib
examples/admanager_axis/src/main/java/admanager/axis/v201902/labelservice/GetActiveLabels.java
GetActiveLabels.runExample
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { """ Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors. """ LabelServiceInterface labelService = adManagerServices.get(session, LabelServiceInterface.class); // Create a statement to select labels. StatementBuilder statementBuilder = new StatementBuilder() .where("isActive = :isActive") .orderBy("id ASC") .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT) .withBindVariableValue("isActive", true); // Retrieve a small amount of labels at a time, paging through // until all labels have been retrieved. int totalResultSetSize = 0; do { LabelPage page = labelService.getLabelsByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { // Print out some information for each label. totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (Label label : page.getResults()) { System.out.printf( "%d) Label with ID %d and name '%s' was found.%n", i++, label.getId(), label.getName()); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); }
java
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { LabelServiceInterface labelService = adManagerServices.get(session, LabelServiceInterface.class); // Create a statement to select labels. StatementBuilder statementBuilder = new StatementBuilder() .where("isActive = :isActive") .orderBy("id ASC") .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT) .withBindVariableValue("isActive", true); // Retrieve a small amount of labels at a time, paging through // until all labels have been retrieved. int totalResultSetSize = 0; do { LabelPage page = labelService.getLabelsByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { // Print out some information for each label. totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (Label label : page.getResults()) { System.out.printf( "%d) Label with ID %d and name '%s' was found.%n", i++, label.getId(), label.getName()); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); }
[ "public", "static", "void", "runExample", "(", "AdManagerServices", "adManagerServices", ",", "AdManagerSession", "session", ")", "throws", "RemoteException", "{", "LabelServiceInterface", "labelService", "=", "adManagerServices", ".", "get", "(", "session", ",", "LabelServiceInterface", ".", "class", ")", ";", "// Create a statement to select labels.", "StatementBuilder", "statementBuilder", "=", "new", "StatementBuilder", "(", ")", ".", "where", "(", "\"isActive = :isActive\"", ")", ".", "orderBy", "(", "\"id ASC\"", ")", ".", "limit", "(", "StatementBuilder", ".", "SUGGESTED_PAGE_LIMIT", ")", ".", "withBindVariableValue", "(", "\"isActive\"", ",", "true", ")", ";", "// Retrieve a small amount of labels at a time, paging through", "// until all labels have been retrieved.", "int", "totalResultSetSize", "=", "0", ";", "do", "{", "LabelPage", "page", "=", "labelService", ".", "getLabelsByStatement", "(", "statementBuilder", ".", "toStatement", "(", ")", ")", ";", "if", "(", "page", ".", "getResults", "(", ")", "!=", "null", ")", "{", "// Print out some information for each label.", "totalResultSetSize", "=", "page", ".", "getTotalResultSetSize", "(", ")", ";", "int", "i", "=", "page", ".", "getStartIndex", "(", ")", ";", "for", "(", "Label", "label", ":", "page", ".", "getResults", "(", ")", ")", "{", "System", ".", "out", ".", "printf", "(", "\"%d) Label with ID %d and name '%s' was found.%n\"", ",", "i", "++", ",", "label", ".", "getId", "(", ")", ",", "label", ".", "getName", "(", ")", ")", ";", "}", "}", "statementBuilder", ".", "increaseOffsetBy", "(", "StatementBuilder", ".", "SUGGESTED_PAGE_LIMIT", ")", ";", "}", "while", "(", "statementBuilder", ".", "getOffset", "(", ")", "<", "totalResultSetSize", ")", ";", "System", ".", "out", ".", "printf", "(", "\"Number of results found: %d%n\"", ",", "totalResultSetSize", ")", ";", "}" ]
Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors.
[ "Runs", "the", "example", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201902/labelservice/GetActiveLabels.java#L51-L85
ronmamo/reflections
src/main/java/org/reflections/serializers/JavaCodeSerializer.java
JavaCodeSerializer.save
public File save(Reflections reflections, String name) { """ name should be in the pattern: path/path/path/package.package.classname, for example <pre>/data/projects/my/src/main/java/org.my.project.MyStore</pre> would create class MyStore in package org.my.project in the path /data/projects/my/src/main/java """ if (name.endsWith("/")) { name = name.substring(0, name.length() - 1); //trim / at the end } //prepare file String filename = name.replace('.', '/').concat(".java"); File file = prepareFile(filename); //get package and class names String packageName; String className; int lastDot = name.lastIndexOf('.'); if (lastDot == -1) { packageName = ""; className = name.substring(name.lastIndexOf('/') + 1); } else { packageName = name.substring(name.lastIndexOf('/') + 1, lastDot); className = name.substring(lastDot + 1); } //generate try { StringBuilder sb = new StringBuilder(); sb.append("//generated using Reflections JavaCodeSerializer") .append(" [").append(new Date()).append("]") .append("\n"); if (packageName.length() != 0) { sb.append("package ").append(packageName).append(";\n"); sb.append("\n"); } sb.append("public interface ").append(className).append(" {\n\n"); sb.append(toString(reflections)); sb.append("}\n"); Files.write(sb.toString(), new File(filename), Charset.defaultCharset()); } catch (IOException e) { throw new RuntimeException(); } return file; }
java
public File save(Reflections reflections, String name) { if (name.endsWith("/")) { name = name.substring(0, name.length() - 1); //trim / at the end } //prepare file String filename = name.replace('.', '/').concat(".java"); File file = prepareFile(filename); //get package and class names String packageName; String className; int lastDot = name.lastIndexOf('.'); if (lastDot == -1) { packageName = ""; className = name.substring(name.lastIndexOf('/') + 1); } else { packageName = name.substring(name.lastIndexOf('/') + 1, lastDot); className = name.substring(lastDot + 1); } //generate try { StringBuilder sb = new StringBuilder(); sb.append("//generated using Reflections JavaCodeSerializer") .append(" [").append(new Date()).append("]") .append("\n"); if (packageName.length() != 0) { sb.append("package ").append(packageName).append(";\n"); sb.append("\n"); } sb.append("public interface ").append(className).append(" {\n\n"); sb.append(toString(reflections)); sb.append("}\n"); Files.write(sb.toString(), new File(filename), Charset.defaultCharset()); } catch (IOException e) { throw new RuntimeException(); } return file; }
[ "public", "File", "save", "(", "Reflections", "reflections", ",", "String", "name", ")", "{", "if", "(", "name", ".", "endsWith", "(", "\"/\"", ")", ")", "{", "name", "=", "name", ".", "substring", "(", "0", ",", "name", ".", "length", "(", ")", "-", "1", ")", ";", "//trim / at the end", "}", "//prepare file", "String", "filename", "=", "name", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ".", "concat", "(", "\".java\"", ")", ";", "File", "file", "=", "prepareFile", "(", "filename", ")", ";", "//get package and class names", "String", "packageName", ";", "String", "className", ";", "int", "lastDot", "=", "name", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "lastDot", "==", "-", "1", ")", "{", "packageName", "=", "\"\"", ";", "className", "=", "name", ".", "substring", "(", "name", ".", "lastIndexOf", "(", "'", "'", ")", "+", "1", ")", ";", "}", "else", "{", "packageName", "=", "name", ".", "substring", "(", "name", ".", "lastIndexOf", "(", "'", "'", ")", "+", "1", ",", "lastDot", ")", ";", "className", "=", "name", ".", "substring", "(", "lastDot", "+", "1", ")", ";", "}", "//generate", "try", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "\"//generated using Reflections JavaCodeSerializer\"", ")", ".", "append", "(", "\" [\"", ")", ".", "append", "(", "new", "Date", "(", ")", ")", ".", "append", "(", "\"]\"", ")", ".", "append", "(", "\"\\n\"", ")", ";", "if", "(", "packageName", ".", "length", "(", ")", "!=", "0", ")", "{", "sb", ".", "append", "(", "\"package \"", ")", ".", "append", "(", "packageName", ")", ".", "append", "(", "\";\\n\"", ")", ";", "sb", ".", "append", "(", "\"\\n\"", ")", ";", "}", "sb", ".", "append", "(", "\"public interface \"", ")", ".", "append", "(", "className", ")", ".", "append", "(", "\" {\\n\\n\"", ")", ";", "sb", ".", "append", "(", "toString", "(", "reflections", ")", ")", ";", "sb", ".", "append", "(", "\"}\\n\"", ")", ";", "Files", ".", "write", "(", "sb", ".", "toString", "(", ")", ",", "new", "File", "(", "filename", ")", ",", "Charset", ".", "defaultCharset", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", ")", ";", "}", "return", "file", ";", "}" ]
name should be in the pattern: path/path/path/package.package.classname, for example <pre>/data/projects/my/src/main/java/org.my.project.MyStore</pre> would create class MyStore in package org.my.project in the path /data/projects/my/src/main/java
[ "name", "should", "be", "in", "the", "pattern", ":", "path", "/", "path", "/", "path", "/", "package", ".", "package", ".", "classname", "for", "example", "<pre", ">", "/", "data", "/", "projects", "/", "my", "/", "src", "/", "main", "/", "java", "/", "org", ".", "my", ".", "project", ".", "MyStore<", "/", "pre", ">", "would", "create", "class", "MyStore", "in", "package", "org", ".", "my", ".", "project", "in", "the", "path", "/", "data", "/", "projects", "/", "my", "/", "src", "/", "main", "/", "java" ]
train
https://github.com/ronmamo/reflections/blob/084cf4a759a06d88e88753ac00397478c2e0ed52/src/main/java/org/reflections/serializers/JavaCodeSerializer.java#L85-L127
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/h/HomographyInducedStereo2Line.java
HomographyInducedStereo2Line.setFundamental
public void setFundamental( DMatrixRMaj F , Point3D_F64 e2 ) { """ Specify the fundamental matrix and the camera 2 epipole. @param F Fundamental matrix. @param e2 Epipole for camera 2. If null it will be computed internally. """ if( e2 != null ) this.e2.set(e2); else { MultiViewOps.extractEpipoles(F,new Point3D_F64(),this.e2); } GeometryMath_F64.multCrossA(this.e2,F,A); }
java
public void setFundamental( DMatrixRMaj F , Point3D_F64 e2 ) { if( e2 != null ) this.e2.set(e2); else { MultiViewOps.extractEpipoles(F,new Point3D_F64(),this.e2); } GeometryMath_F64.multCrossA(this.e2,F,A); }
[ "public", "void", "setFundamental", "(", "DMatrixRMaj", "F", ",", "Point3D_F64", "e2", ")", "{", "if", "(", "e2", "!=", "null", ")", "this", ".", "e2", ".", "set", "(", "e2", ")", ";", "else", "{", "MultiViewOps", ".", "extractEpipoles", "(", "F", ",", "new", "Point3D_F64", "(", ")", ",", "this", ".", "e2", ")", ";", "}", "GeometryMath_F64", ".", "multCrossA", "(", "this", ".", "e2", ",", "F", ",", "A", ")", ";", "}" ]
Specify the fundamental matrix and the camera 2 epipole. @param F Fundamental matrix. @param e2 Epipole for camera 2. If null it will be computed internally.
[ "Specify", "the", "fundamental", "matrix", "and", "the", "camera", "2", "epipole", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/h/HomographyInducedStereo2Line.java#L95-L102
hal/core
gui/src/main/java/org/jboss/as/console/client/v3/elemento/Elements.java
Elements.setVisible
public static void setVisible(Element element, boolean visible) { """ shows / hide the specified element by modifying the {@code display} property. """ if (element != null) { element.getStyle().setDisplay(visible ? "" : "none"); } }
java
public static void setVisible(Element element, boolean visible) { if (element != null) { element.getStyle().setDisplay(visible ? "" : "none"); } }
[ "public", "static", "void", "setVisible", "(", "Element", "element", ",", "boolean", "visible", ")", "{", "if", "(", "element", "!=", "null", ")", "{", "element", ".", "getStyle", "(", ")", ".", "setDisplay", "(", "visible", "?", "\"\"", ":", "\"none\"", ")", ";", "}", "}" ]
shows / hide the specified element by modifying the {@code display} property.
[ "shows", "/", "hide", "the", "specified", "element", "by", "modifying", "the", "{" ]
train
https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/v3/elemento/Elements.java#L597-L601