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
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/parser/ParseUtils.java
ParseUtils.getCompiledPage
private static EngProcessedPage getCompiledPage(String text, String title, long revision) throws LinkTargetException, EngineException, FileNotFoundException, JAXBException { """ Returns CompiledPage produced by the SWEBLE parser using the SimpleWikiConfiguration. @return the parsed page @throws LinkTargetException @throws EngineException if the wiki page could not be compiled by the parser @throws JAXBException @throws FileNotFoundException """ WikiConfig config = DefaultConfigEnWp.generate(); PageTitle pageTitle = PageTitle.make(config, title); PageId pageId = new PageId(pageTitle, revision); // Compile the retrieved page WtEngineImpl engine = new WtEngineImpl(config); // Compile the retrieved page return engine.postprocess(pageId, text, null); }
java
private static EngProcessedPage getCompiledPage(String text, String title, long revision) throws LinkTargetException, EngineException, FileNotFoundException, JAXBException { WikiConfig config = DefaultConfigEnWp.generate(); PageTitle pageTitle = PageTitle.make(config, title); PageId pageId = new PageId(pageTitle, revision); // Compile the retrieved page WtEngineImpl engine = new WtEngineImpl(config); // Compile the retrieved page return engine.postprocess(pageId, text, null); }
[ "private", "static", "EngProcessedPage", "getCompiledPage", "(", "String", "text", ",", "String", "title", ",", "long", "revision", ")", "throws", "LinkTargetException", ",", "EngineException", ",", "FileNotFoundException", ",", "JAXBException", "{", "WikiConfig", "config", "=", "DefaultConfigEnWp", ".", "generate", "(", ")", ";", "PageTitle", "pageTitle", "=", "PageTitle", ".", "make", "(", "config", ",", "title", ")", ";", "PageId", "pageId", "=", "new", "PageId", "(", "pageTitle", ",", "revision", ")", ";", "// Compile the retrieved page", "WtEngineImpl", "engine", "=", "new", "WtEngineImpl", "(", "config", ")", ";", "// Compile the retrieved page", "return", "engine", ".", "postprocess", "(", "pageId", ",", "text", ",", "null", ")", ";", "}" ]
Returns CompiledPage produced by the SWEBLE parser using the SimpleWikiConfiguration. @return the parsed page @throws LinkTargetException @throws EngineException if the wiki page could not be compiled by the parser @throws JAXBException @throws FileNotFoundException
[ "Returns", "CompiledPage", "produced", "by", "the", "SWEBLE", "parser", "using", "the", "SimpleWikiConfiguration", "." ]
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/parser/ParseUtils.java#L107-L117
http-builder-ng/http-builder-ng
http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java
HttpBuilder.deleteAsync
public <T> CompletableFuture<T> deleteAsync(final Class<T> type, final Consumer<HttpConfig> configuration) { """ Executes an asynchronous DELETE request on the configured URI (asynchronous alias to the `delete(Class,Consumer)` method), with additional configuration provided by the configuration function. The result will be cast to the specified `type`. This method is generally used for Java-specific configuration. [source,java] ---- HttpBuilder http = HttpBuilder.configure(config -> { config.getRequest().setUri("http://localhost:10101"); }); CompletableFuture<String> future = http.deleteAsync(String.class, config -> { config.getRequest().getUri().setPath("/foo"); }); String result = future.get(); ---- The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface. @param type the type of the resulting object @param configuration the additional configuration function (delegated to {@link HttpConfig}) @return the {@link CompletableFuture} containing the result of the request """ return CompletableFuture.supplyAsync(() -> delete(type, configuration), getExecutor()); }
java
public <T> CompletableFuture<T> deleteAsync(final Class<T> type, final Consumer<HttpConfig> configuration) { return CompletableFuture.supplyAsync(() -> delete(type, configuration), getExecutor()); }
[ "public", "<", "T", ">", "CompletableFuture", "<", "T", ">", "deleteAsync", "(", "final", "Class", "<", "T", ">", "type", ",", "final", "Consumer", "<", "HttpConfig", ">", "configuration", ")", "{", "return", "CompletableFuture", ".", "supplyAsync", "(", "(", ")", "->", "delete", "(", "type", ",", "configuration", ")", ",", "getExecutor", "(", ")", ")", ";", "}" ]
Executes an asynchronous DELETE request on the configured URI (asynchronous alias to the `delete(Class,Consumer)` method), with additional configuration provided by the configuration function. The result will be cast to the specified `type`. This method is generally used for Java-specific configuration. [source,java] ---- HttpBuilder http = HttpBuilder.configure(config -> { config.getRequest().setUri("http://localhost:10101"); }); CompletableFuture<String> future = http.deleteAsync(String.class, config -> { config.getRequest().getUri().setPath("/foo"); }); String result = future.get(); ---- The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface. @param type the type of the resulting object @param configuration the additional configuration function (delegated to {@link HttpConfig}) @return the {@link CompletableFuture} containing the result of the request
[ "Executes", "an", "asynchronous", "DELETE", "request", "on", "the", "configured", "URI", "(", "asynchronous", "alias", "to", "the", "delete", "(", "Class", "Consumer", ")", "method", ")", "with", "additional", "configuration", "provided", "by", "the", "configuration", "function", ".", "The", "result", "will", "be", "cast", "to", "the", "specified", "type", "." ]
train
https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L1274-L1276
Red5/red5-server-common
src/main/java/org/red5/server/Client.java
Client.from
public static Client from(CompositeData cd) { """ Allows for reconstruction via CompositeData. @param cd composite data @return Client class instance """ Client instance = null; if (cd.containsKey("id")) { String id = (String) cd.get("id"); instance = new Client(id, (Long) cd.get("creationTime"), null); instance.setAttribute(PERMISSIONS, cd.get(PERMISSIONS)); } if (cd.containsKey("attributes")) { AttributeStore attrs = (AttributeStore) cd.get("attributes"); instance.setAttributes(attrs); } return instance; }
java
public static Client from(CompositeData cd) { Client instance = null; if (cd.containsKey("id")) { String id = (String) cd.get("id"); instance = new Client(id, (Long) cd.get("creationTime"), null); instance.setAttribute(PERMISSIONS, cd.get(PERMISSIONS)); } if (cd.containsKey("attributes")) { AttributeStore attrs = (AttributeStore) cd.get("attributes"); instance.setAttributes(attrs); } return instance; }
[ "public", "static", "Client", "from", "(", "CompositeData", "cd", ")", "{", "Client", "instance", "=", "null", ";", "if", "(", "cd", ".", "containsKey", "(", "\"id\"", ")", ")", "{", "String", "id", "=", "(", "String", ")", "cd", ".", "get", "(", "\"id\"", ")", ";", "instance", "=", "new", "Client", "(", "id", ",", "(", "Long", ")", "cd", ".", "get", "(", "\"creationTime\"", ")", ",", "null", ")", ";", "instance", ".", "setAttribute", "(", "PERMISSIONS", ",", "cd", ".", "get", "(", "PERMISSIONS", ")", ")", ";", "}", "if", "(", "cd", ".", "containsKey", "(", "\"attributes\"", ")", ")", "{", "AttributeStore", "attrs", "=", "(", "AttributeStore", ")", "cd", ".", "get", "(", "\"attributes\"", ")", ";", "instance", ".", "setAttributes", "(", "attrs", ")", ";", "}", "return", "instance", ";", "}" ]
Allows for reconstruction via CompositeData. @param cd composite data @return Client class instance
[ "Allows", "for", "reconstruction", "via", "CompositeData", "." ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/Client.java#L369-L381
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java
ManagedDatabasesInner.createOrUpdateAsync
public Observable<ManagedDatabaseInner> createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) { """ Creates a new database or updates an existing database. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param managedInstanceName The name of the managed instance. @param databaseName The name of the database. @param parameters The requested database resource state. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1<ServiceResponse<ManagedDatabaseInner>, ManagedDatabaseInner>() { @Override public ManagedDatabaseInner call(ServiceResponse<ManagedDatabaseInner> response) { return response.body(); } }); }
java
public Observable<ManagedDatabaseInner> createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1<ServiceResponse<ManagedDatabaseInner>, ManagedDatabaseInner>() { @Override public ManagedDatabaseInner call(ServiceResponse<ManagedDatabaseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ManagedDatabaseInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "managedInstanceName", ",", "String", "databaseName", ",", "ManagedDatabaseInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "managedInstanceName", ",", "databaseName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ManagedDatabaseInner", ">", ",", "ManagedDatabaseInner", ">", "(", ")", "{", "@", "Override", "public", "ManagedDatabaseInner", "call", "(", "ServiceResponse", "<", "ManagedDatabaseInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates a new database or updates an existing database. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param managedInstanceName The name of the managed instance. @param databaseName The name of the database. @param parameters The requested database resource state. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "a", "new", "database", "or", "updates", "an", "existing", "database", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java#L544-L551
Azure/azure-sdk-for-java
iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java
IotHubResourcesInner.exportDevicesAsync
public Observable<JobResponseInner> exportDevicesAsync(String resourceGroupName, String resourceName, ExportDevicesRequest exportDevicesParameters) { """ Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @param exportDevicesParameters The parameters that specify the export devices operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the JobResponseInner object """ return exportDevicesWithServiceResponseAsync(resourceGroupName, resourceName, exportDevicesParameters).map(new Func1<ServiceResponse<JobResponseInner>, JobResponseInner>() { @Override public JobResponseInner call(ServiceResponse<JobResponseInner> response) { return response.body(); } }); }
java
public Observable<JobResponseInner> exportDevicesAsync(String resourceGroupName, String resourceName, ExportDevicesRequest exportDevicesParameters) { return exportDevicesWithServiceResponseAsync(resourceGroupName, resourceName, exportDevicesParameters).map(new Func1<ServiceResponse<JobResponseInner>, JobResponseInner>() { @Override public JobResponseInner call(ServiceResponse<JobResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "JobResponseInner", ">", "exportDevicesAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "ExportDevicesRequest", "exportDevicesParameters", ")", "{", "return", "exportDevicesWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ",", "exportDevicesParameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "JobResponseInner", ">", ",", "JobResponseInner", ">", "(", ")", "{", "@", "Override", "public", "JobResponseInner", "call", "(", "ServiceResponse", "<", "JobResponseInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @param exportDevicesParameters The parameters that specify the export devices operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the JobResponseInner object
[ "Exports", "all", "the", "device", "identities", "in", "the", "IoT", "hub", "identity", "registry", "to", "an", "Azure", "Storage", "blob", "container", ".", "For", "more", "information", "see", ":", "https", ":", "//", "docs", ".", "microsoft", ".", "com", "/", "azure", "/", "iot", "-", "hub", "/", "iot", "-", "hub", "-", "devguide", "-", "identity", "-", "registry#import", "-", "and", "-", "export", "-", "device", "-", "identities", ".", "Exports", "all", "the", "device", "identities", "in", "the", "IoT", "hub", "identity", "registry", "to", "an", "Azure", "Storage", "blob", "container", ".", "For", "more", "information", "see", ":", "https", ":", "//", "docs", ".", "microsoft", ".", "com", "/", "azure", "/", "iot", "-", "hub", "/", "iot", "-", "hub", "-", "devguide", "-", "identity", "-", "registry#import", "-", "and", "-", "export", "-", "device", "-", "identities", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L3096-L3103
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/ContentSpec.java
ContentSpec.setAdditionalPublicanCfg
public void setAdditionalPublicanCfg(final String name, final String publicanCfg) { """ Set the data that will be appended to the publican.cfg file when built. @param name The custom configuration name. @param publicanCfg The data to be appended. """ if (publicanCfg == null && !publicanCfgs.containsKey(name)) { return; } else if (publicanCfg == null) { removeChild(publicanCfgs.get(name)); publicanCfgs.remove(name); } else if (!publicanCfgs.containsKey(name)) { final String fixedName = name + "-" + CommonConstants.CS_PUBLICAN_CFG_TITLE; final KeyValueNode<String> publicanCfgMetaData = new KeyValueNode<String>(fixedName, publicanCfg); publicanCfgs.put(name, publicanCfgMetaData); appendChild(publicanCfgMetaData, false); } else { publicanCfgs.get(name).setValue(publicanCfg); } }
java
public void setAdditionalPublicanCfg(final String name, final String publicanCfg) { if (publicanCfg == null && !publicanCfgs.containsKey(name)) { return; } else if (publicanCfg == null) { removeChild(publicanCfgs.get(name)); publicanCfgs.remove(name); } else if (!publicanCfgs.containsKey(name)) { final String fixedName = name + "-" + CommonConstants.CS_PUBLICAN_CFG_TITLE; final KeyValueNode<String> publicanCfgMetaData = new KeyValueNode<String>(fixedName, publicanCfg); publicanCfgs.put(name, publicanCfgMetaData); appendChild(publicanCfgMetaData, false); } else { publicanCfgs.get(name).setValue(publicanCfg); } }
[ "public", "void", "setAdditionalPublicanCfg", "(", "final", "String", "name", ",", "final", "String", "publicanCfg", ")", "{", "if", "(", "publicanCfg", "==", "null", "&&", "!", "publicanCfgs", ".", "containsKey", "(", "name", ")", ")", "{", "return", ";", "}", "else", "if", "(", "publicanCfg", "==", "null", ")", "{", "removeChild", "(", "publicanCfgs", ".", "get", "(", "name", ")", ")", ";", "publicanCfgs", ".", "remove", "(", "name", ")", ";", "}", "else", "if", "(", "!", "publicanCfgs", ".", "containsKey", "(", "name", ")", ")", "{", "final", "String", "fixedName", "=", "name", "+", "\"-\"", "+", "CommonConstants", ".", "CS_PUBLICAN_CFG_TITLE", ";", "final", "KeyValueNode", "<", "String", ">", "publicanCfgMetaData", "=", "new", "KeyValueNode", "<", "String", ">", "(", "fixedName", ",", "publicanCfg", ")", ";", "publicanCfgs", ".", "put", "(", "name", ",", "publicanCfgMetaData", ")", ";", "appendChild", "(", "publicanCfgMetaData", ",", "false", ")", ";", "}", "else", "{", "publicanCfgs", ".", "get", "(", "name", ")", ".", "setValue", "(", "publicanCfg", ")", ";", "}", "}" ]
Set the data that will be appended to the publican.cfg file when built. @param name The custom configuration name. @param publicanCfg The data to be appended.
[ "Set", "the", "data", "that", "will", "be", "appended", "to", "the", "publican", ".", "cfg", "file", "when", "built", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/ContentSpec.java#L595-L609
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/privatejgoodies/common/base/Preconditions.java
Preconditions.checkNotNull
public static <T> T checkNotNull( T reference, String messageFormat, Object... messageArgs) { """ Checks that the given object reference is not {@code null} and throws a customized {@link NullPointerException} if it is. Intended for doing parameter validation in methods and constructors, e.g.: <blockquote><pre> public void foo(Bar bar, Baz baz) { this.bar = Preconditions.checkNotNull(bar, "bar must not be null."); Preconditions.checkNotBull(baz, "The %s must not be null.", "baz"); } </pre></blockquote> @param reference the object reference to check for being {@code null} @param messageFormat a {@link Formatter format} string for the detail message to be used in the event that an exception is thrown. @param messageArgs the arguments referenced by the format specifiers in the {@code messageFormat} @param <T> the type of the reference @return {@code reference} if not {@code null} @throws NullPointerException if {@code reference} is {@code null} """ if (reference == null) { throw new NullPointerException(format(messageFormat, messageArgs)); } return reference; }
java
public static <T> T checkNotNull( T reference, String messageFormat, Object... messageArgs) { if (reference == null) { throw new NullPointerException(format(messageFormat, messageArgs)); } return reference; }
[ "public", "static", "<", "T", ">", "T", "checkNotNull", "(", "T", "reference", ",", "String", "messageFormat", ",", "Object", "...", "messageArgs", ")", "{", "if", "(", "reference", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "format", "(", "messageFormat", ",", "messageArgs", ")", ")", ";", "}", "return", "reference", ";", "}" ]
Checks that the given object reference is not {@code null} and throws a customized {@link NullPointerException} if it is. Intended for doing parameter validation in methods and constructors, e.g.: <blockquote><pre> public void foo(Bar bar, Baz baz) { this.bar = Preconditions.checkNotNull(bar, "bar must not be null."); Preconditions.checkNotBull(baz, "The %s must not be null.", "baz"); } </pre></blockquote> @param reference the object reference to check for being {@code null} @param messageFormat a {@link Formatter format} string for the detail message to be used in the event that an exception is thrown. @param messageArgs the arguments referenced by the format specifiers in the {@code messageFormat} @param <T> the type of the reference @return {@code reference} if not {@code null} @throws NullPointerException if {@code reference} is {@code null}
[ "Checks", "that", "the", "given", "object", "reference", "is", "not", "{", "@code", "null", "}", "and", "throws", "a", "customized", "{", "@link", "NullPointerException", "}", "if", "it", "is", ".", "Intended", "for", "doing", "parameter", "validation", "in", "methods", "and", "constructors", "e", ".", "g", ".", ":", "<blockquote", ">", "<pre", ">", "public", "void", "foo", "(", "Bar", "bar", "Baz", "baz", ")", "{", "this", ".", "bar", "=", "Preconditions", ".", "checkNotNull", "(", "bar", "bar", "must", "not", "be", "null", ".", ")", ";", "Preconditions", ".", "checkNotBull", "(", "baz", "The", "%s", "must", "not", "be", "null", ".", "baz", ")", ";", "}", "<", "/", "pre", ">", "<", "/", "blockquote", ">" ]
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/common/base/Preconditions.java#L137-L143
VoltDB/voltdb
src/frontend/org/voltdb/InternalConnectionHandler.java
InternalConnectionHandler.addAdapter
public synchronized void addAdapter(int pid, InternalClientResponseAdapter adapter) { """ Synchronized in case multiple partitions are added concurrently. """ final ImmutableMap.Builder<Integer, InternalClientResponseAdapter> builder = ImmutableMap.builder(); builder.putAll(m_adapters); builder.put(pid, adapter); m_adapters = builder.build(); }
java
public synchronized void addAdapter(int pid, InternalClientResponseAdapter adapter) { final ImmutableMap.Builder<Integer, InternalClientResponseAdapter> builder = ImmutableMap.builder(); builder.putAll(m_adapters); builder.put(pid, adapter); m_adapters = builder.build(); }
[ "public", "synchronized", "void", "addAdapter", "(", "int", "pid", ",", "InternalClientResponseAdapter", "adapter", ")", "{", "final", "ImmutableMap", ".", "Builder", "<", "Integer", ",", "InternalClientResponseAdapter", ">", "builder", "=", "ImmutableMap", ".", "builder", "(", ")", ";", "builder", ".", "putAll", "(", "m_adapters", ")", ";", "builder", ".", "put", "(", "pid", ",", "adapter", ")", ";", "m_adapters", "=", "builder", ".", "build", "(", ")", ";", "}" ]
Synchronized in case multiple partitions are added concurrently.
[ "Synchronized", "in", "case", "multiple", "partitions", "are", "added", "concurrently", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/InternalConnectionHandler.java#L53-L59
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java
VirtualMachinesInner.getExtensionsAsync
public Observable<VirtualMachineExtensionsListResultInner> getExtensionsAsync(String resourceGroupName, String vmName, String expand) { """ The operation to get all extensions of a Virtual Machine. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine containing the extension. @param expand The expand expression to apply on the operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualMachineExtensionsListResultInner object """ return getExtensionsWithServiceResponseAsync(resourceGroupName, vmName, expand).map(new Func1<ServiceResponse<VirtualMachineExtensionsListResultInner>, VirtualMachineExtensionsListResultInner>() { @Override public VirtualMachineExtensionsListResultInner call(ServiceResponse<VirtualMachineExtensionsListResultInner> response) { return response.body(); } }); }
java
public Observable<VirtualMachineExtensionsListResultInner> getExtensionsAsync(String resourceGroupName, String vmName, String expand) { return getExtensionsWithServiceResponseAsync(resourceGroupName, vmName, expand).map(new Func1<ServiceResponse<VirtualMachineExtensionsListResultInner>, VirtualMachineExtensionsListResultInner>() { @Override public VirtualMachineExtensionsListResultInner call(ServiceResponse<VirtualMachineExtensionsListResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualMachineExtensionsListResultInner", ">", "getExtensionsAsync", "(", "String", "resourceGroupName", ",", "String", "vmName", ",", "String", "expand", ")", "{", "return", "getExtensionsWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmName", ",", "expand", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VirtualMachineExtensionsListResultInner", ">", ",", "VirtualMachineExtensionsListResultInner", ">", "(", ")", "{", "@", "Override", "public", "VirtualMachineExtensionsListResultInner", "call", "(", "ServiceResponse", "<", "VirtualMachineExtensionsListResultInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
The operation to get all extensions of a Virtual Machine. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine containing the extension. @param expand The expand expression to apply on the operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualMachineExtensionsListResultInner object
[ "The", "operation", "to", "get", "all", "extensions", "of", "a", "Virtual", "Machine", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java#L315-L322
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpClient.java
AmqpClient.closeOkConnection
AmqpClient closeOkConnection(Continuation callback, ErrorHandler error) { """ Sends a CloseOkConnection to server. @param callback @param error @return AmqpClient """ Object[] args = {}; AmqpBuffer bodyArg = null; String methodName = "closeOkConnection"; String methodId = "10" + "50"; AmqpMethod amqpMethod = MethodLookup.LookupMethod(methodId); Object[] arguments = {this, amqpMethod, this.id, args, bodyArg}; asyncClient.enqueueAction(methodName, "write", arguments, callback, error); return this; }
java
AmqpClient closeOkConnection(Continuation callback, ErrorHandler error) { Object[] args = {}; AmqpBuffer bodyArg = null; String methodName = "closeOkConnection"; String methodId = "10" + "50"; AmqpMethod amqpMethod = MethodLookup.LookupMethod(methodId); Object[] arguments = {this, amqpMethod, this.id, args, bodyArg}; asyncClient.enqueueAction(methodName, "write", arguments, callback, error); return this; }
[ "AmqpClient", "closeOkConnection", "(", "Continuation", "callback", ",", "ErrorHandler", "error", ")", "{", "Object", "[", "]", "args", "=", "{", "}", ";", "AmqpBuffer", "bodyArg", "=", "null", ";", "String", "methodName", "=", "\"closeOkConnection\"", ";", "String", "methodId", "=", "\"10\"", "+", "\"50\"", ";", "AmqpMethod", "amqpMethod", "=", "MethodLookup", ".", "LookupMethod", "(", "methodId", ")", ";", "Object", "[", "]", "arguments", "=", "{", "this", ",", "amqpMethod", ",", "this", ".", "id", ",", "args", ",", "bodyArg", "}", ";", "asyncClient", ".", "enqueueAction", "(", "methodName", ",", "\"write\"", ",", "arguments", ",", "callback", ",", "error", ")", ";", "return", "this", ";", "}" ]
Sends a CloseOkConnection to server. @param callback @param error @return AmqpClient
[ "Sends", "a", "CloseOkConnection", "to", "server", "." ]
train
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpClient.java#L927-L937
feedzai/pdb
src/main/java/com/feedzai/commons/sql/abstraction/util/AESHelper.java
AESHelper.decryptFile
public static byte[] decryptFile(String path, String key) { """ Decrypts a file encrypted by {@link #encryptToFile(String, byte[], String)} method. @param path The file path to decrypt. @param key The key. @return A decrypted byte[]. """ try { byte[] buf = readFile(path); return decrypt(buf, key); } catch (final Exception e) { logger.warn("Could not decrypt file {}", path, e); return null; } }
java
public static byte[] decryptFile(String path, String key) { try { byte[] buf = readFile(path); return decrypt(buf, key); } catch (final Exception e) { logger.warn("Could not decrypt file {}", path, e); return null; } }
[ "public", "static", "byte", "[", "]", "decryptFile", "(", "String", "path", ",", "String", "key", ")", "{", "try", "{", "byte", "[", "]", "buf", "=", "readFile", "(", "path", ")", ";", "return", "decrypt", "(", "buf", ",", "key", ")", ";", "}", "catch", "(", "final", "Exception", "e", ")", "{", "logger", ".", "warn", "(", "\"Could not decrypt file {}\"", ",", "path", ",", "e", ")", ";", "return", "null", ";", "}", "}" ]
Decrypts a file encrypted by {@link #encryptToFile(String, byte[], String)} method. @param path The file path to decrypt. @param key The key. @return A decrypted byte[].
[ "Decrypts", "a", "file", "encrypted", "by", "{", "@link", "#encryptToFile", "(", "String", "byte", "[]", "String", ")", "}", "method", "." ]
train
https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/util/AESHelper.java#L125-L133
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java
PackageSummaryBuilder.getInstance
public static PackageSummaryBuilder getInstance(Context context, PackageDoc pkg, PackageSummaryWriter packageWriter) { """ Construct a new PackageSummaryBuilder. @param context the build context. @param pkg the package being documented. @param packageWriter the doclet specific writer that will output the result. @return an instance of a PackageSummaryBuilder. """ return new PackageSummaryBuilder(context, pkg, packageWriter); }
java
public static PackageSummaryBuilder getInstance(Context context, PackageDoc pkg, PackageSummaryWriter packageWriter) { return new PackageSummaryBuilder(context, pkg, packageWriter); }
[ "public", "static", "PackageSummaryBuilder", "getInstance", "(", "Context", "context", ",", "PackageDoc", "pkg", ",", "PackageSummaryWriter", "packageWriter", ")", "{", "return", "new", "PackageSummaryBuilder", "(", "context", ",", "pkg", ",", "packageWriter", ")", ";", "}" ]
Construct a new PackageSummaryBuilder. @param context the build context. @param pkg the package being documented. @param packageWriter the doclet specific writer that will output the result. @return an instance of a PackageSummaryBuilder.
[ "Construct", "a", "new", "PackageSummaryBuilder", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java#L93-L96
outbrain/ob1k
ob1k-concurrent/src/main/java/com/outbrain/ob1k/concurrent/ComposableFutures.java
ComposableFutures.toColdObservable
public static <T> Observable<T> toColdObservable(final RecursiveFutureProvider<T> futureProvider) { """ creates new cold observable, given future provider, on each subscribe will consume the provided future and repeat until stop criteria will exists each result will be emitted to the stream @param futureProvider the future provider @param <T> the stream type @return the stream """ return Observable.create(new Observable.OnSubscribe<T>() { @Override public void call(final Subscriber<? super T> subscriber) { recursiveChain(subscriber, futureProvider.createStopCriteria()); } private void recursiveChain(final Subscriber<? super T> subscriber, final Predicate<T> stopCriteria) { futureProvider.provide().consume(result -> { if (result.isSuccess()) { final T value = result.getValue(); subscriber.onNext(value); if (stopCriteria.apply(value)) { subscriber.onCompleted(); } else { recursiveChain(subscriber, stopCriteria); } } else { subscriber.onError(result.getError()); } }); } }); }
java
public static <T> Observable<T> toColdObservable(final RecursiveFutureProvider<T> futureProvider) { return Observable.create(new Observable.OnSubscribe<T>() { @Override public void call(final Subscriber<? super T> subscriber) { recursiveChain(subscriber, futureProvider.createStopCriteria()); } private void recursiveChain(final Subscriber<? super T> subscriber, final Predicate<T> stopCriteria) { futureProvider.provide().consume(result -> { if (result.isSuccess()) { final T value = result.getValue(); subscriber.onNext(value); if (stopCriteria.apply(value)) { subscriber.onCompleted(); } else { recursiveChain(subscriber, stopCriteria); } } else { subscriber.onError(result.getError()); } }); } }); }
[ "public", "static", "<", "T", ">", "Observable", "<", "T", ">", "toColdObservable", "(", "final", "RecursiveFutureProvider", "<", "T", ">", "futureProvider", ")", "{", "return", "Observable", ".", "create", "(", "new", "Observable", ".", "OnSubscribe", "<", "T", ">", "(", ")", "{", "@", "Override", "public", "void", "call", "(", "final", "Subscriber", "<", "?", "super", "T", ">", "subscriber", ")", "{", "recursiveChain", "(", "subscriber", ",", "futureProvider", ".", "createStopCriteria", "(", ")", ")", ";", "}", "private", "void", "recursiveChain", "(", "final", "Subscriber", "<", "?", "super", "T", ">", "subscriber", ",", "final", "Predicate", "<", "T", ">", "stopCriteria", ")", "{", "futureProvider", ".", "provide", "(", ")", ".", "consume", "(", "result", "->", "{", "if", "(", "result", ".", "isSuccess", "(", ")", ")", "{", "final", "T", "value", "=", "result", ".", "getValue", "(", ")", ";", "subscriber", ".", "onNext", "(", "value", ")", ";", "if", "(", "stopCriteria", ".", "apply", "(", "value", ")", ")", "{", "subscriber", ".", "onCompleted", "(", ")", ";", "}", "else", "{", "recursiveChain", "(", "subscriber", ",", "stopCriteria", ")", ";", "}", "}", "else", "{", "subscriber", ".", "onError", "(", "result", ".", "getError", "(", ")", ")", ";", "}", "}", ")", ";", "}", "}", ")", ";", "}" ]
creates new cold observable, given future provider, on each subscribe will consume the provided future and repeat until stop criteria will exists each result will be emitted to the stream @param futureProvider the future provider @param <T> the stream type @return the stream
[ "creates", "new", "cold", "observable", "given", "future", "provider", "on", "each", "subscribe", "will", "consume", "the", "provided", "future", "and", "repeat", "until", "stop", "criteria", "will", "exists", "each", "result", "will", "be", "emitted", "to", "the", "stream" ]
train
https://github.com/outbrain/ob1k/blob/9e43ab39230c5787065053da0f766d822d0fe4e7/ob1k-concurrent/src/main/java/com/outbrain/ob1k/concurrent/ComposableFutures.java#L649-L672
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbSearch.java
TmdbSearch.searchPeople
public ResultList<PersonFind> searchPeople(String query, Integer page, Boolean includeAdult, SearchType searchType) throws MovieDbException { """ This is a good starting point to start finding people on TMDb. The idea is to be a quick and light method so you can iterate through people quickly. @param query @param includeAdult @param page @param searchType @return @throws MovieDbException """ TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.QUERY, query); parameters.add(Param.ADULT, includeAdult); parameters.add(Param.PAGE, page); if (searchType != null) { parameters.add(Param.SEARCH_TYPE, searchType.getPropertyString()); } URL url = new ApiUrl(apiKey, MethodBase.SEARCH).subMethod(MethodSub.PERSON).buildUrl(parameters); WrapperGenericList<PersonFind> wrapper = processWrapper(getTypeReference(PersonFind.class), url, "person"); return wrapper.getResultsList(); }
java
public ResultList<PersonFind> searchPeople(String query, Integer page, Boolean includeAdult, SearchType searchType) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.QUERY, query); parameters.add(Param.ADULT, includeAdult); parameters.add(Param.PAGE, page); if (searchType != null) { parameters.add(Param.SEARCH_TYPE, searchType.getPropertyString()); } URL url = new ApiUrl(apiKey, MethodBase.SEARCH).subMethod(MethodSub.PERSON).buildUrl(parameters); WrapperGenericList<PersonFind> wrapper = processWrapper(getTypeReference(PersonFind.class), url, "person"); return wrapper.getResultsList(); }
[ "public", "ResultList", "<", "PersonFind", ">", "searchPeople", "(", "String", "query", ",", "Integer", "page", ",", "Boolean", "includeAdult", ",", "SearchType", "searchType", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(", "Param", ".", "QUERY", ",", "query", ")", ";", "parameters", ".", "add", "(", "Param", ".", "ADULT", ",", "includeAdult", ")", ";", "parameters", ".", "add", "(", "Param", ".", "PAGE", ",", "page", ")", ";", "if", "(", "searchType", "!=", "null", ")", "{", "parameters", ".", "add", "(", "Param", ".", "SEARCH_TYPE", ",", "searchType", ".", "getPropertyString", "(", ")", ")", ";", "}", "URL", "url", "=", "new", "ApiUrl", "(", "apiKey", ",", "MethodBase", ".", "SEARCH", ")", ".", "subMethod", "(", "MethodSub", ".", "PERSON", ")", ".", "buildUrl", "(", "parameters", ")", ";", "WrapperGenericList", "<", "PersonFind", ">", "wrapper", "=", "processWrapper", "(", "getTypeReference", "(", "PersonFind", ".", "class", ")", ",", "url", ",", "\"person\"", ")", ";", "return", "wrapper", ".", "getResultsList", "(", ")", ";", "}" ]
This is a good starting point to start finding people on TMDb. The idea is to be a quick and light method so you can iterate through people quickly. @param query @param includeAdult @param page @param searchType @return @throws MovieDbException
[ "This", "is", "a", "good", "starting", "point", "to", "start", "finding", "people", "on", "TMDb", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbSearch.java#L206-L217
SeleniumHQ/selenium
java/client/src/org/openqa/selenium/interactions/Actions.java
Actions.clickAndHold
public Actions clickAndHold() { """ Clicks (without releasing) at the current mouse location. @return A self reference. """ if (isBuildingActions()) { action.addAction(new ClickAndHoldAction(jsonMouse, null)); } return tick(defaultMouse.createPointerDown(LEFT.asArg())); }
java
public Actions clickAndHold() { if (isBuildingActions()) { action.addAction(new ClickAndHoldAction(jsonMouse, null)); } return tick(defaultMouse.createPointerDown(LEFT.asArg())); }
[ "public", "Actions", "clickAndHold", "(", ")", "{", "if", "(", "isBuildingActions", "(", ")", ")", "{", "action", ".", "addAction", "(", "new", "ClickAndHoldAction", "(", "jsonMouse", ",", "null", ")", ")", ";", "}", "return", "tick", "(", "defaultMouse", ".", "createPointerDown", "(", "LEFT", ".", "asArg", "(", ")", ")", ")", ";", "}" ]
Clicks (without releasing) at the current mouse location. @return A self reference.
[ "Clicks", "(", "without", "releasing", ")", "at", "the", "current", "mouse", "location", "." ]
train
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/Actions.java#L244-L250
DDTH/ddth-dao
ddth-dao-core/src/main/java/com/github/ddth/dao/BaseJsonBo.java
BaseJsonBo.getSubAttr
public JsonNode getSubAttr(String attrName, String dPath) { """ Get a sub-attribute using d-path. @param attrName @param dPath @return @see DPathUtils """ Lock lock = lockForRead(); try { return JacksonUtils.getValue(getAttribute(attrName), dPath); } finally { lock.unlock(); } }
java
public JsonNode getSubAttr(String attrName, String dPath) { Lock lock = lockForRead(); try { return JacksonUtils.getValue(getAttribute(attrName), dPath); } finally { lock.unlock(); } }
[ "public", "JsonNode", "getSubAttr", "(", "String", "attrName", ",", "String", "dPath", ")", "{", "Lock", "lock", "=", "lockForRead", "(", ")", ";", "try", "{", "return", "JacksonUtils", ".", "getValue", "(", "getAttribute", "(", "attrName", ")", ",", "dPath", ")", ";", "}", "finally", "{", "lock", ".", "unlock", "(", ")", ";", "}", "}" ]
Get a sub-attribute using d-path. @param attrName @param dPath @return @see DPathUtils
[ "Get", "a", "sub", "-", "attribute", "using", "d", "-", "path", "." ]
train
https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/BaseJsonBo.java#L136-L143
wanglinsong/testharness
src/main/java/com/tascape/qa/th/comm/MySqlCommunication.java
MySqlCommunication.replicateTable
public String replicateTable(String tableName, boolean toCopyData) throws SQLException { """ Replicates table structure and data from source to temporary table. @param tableName existing table name @param toCopyData boolean @return new table name @throws SQLException for any issue """ String tempTableName = MySqlCommunication.getTempTableName(tableName); LOG.debug("Replicate table {} into {}", tableName, tempTableName); if (this.tableExists(tempTableName)) { this.truncateTempTable(tempTableName); } else { this.createTempTable(tableName); } if (toCopyData) { final String sql = "INSERT INTO " + tempTableName + " SELECT * FROM " + tableName + ";"; this.executeUpdate(sql); } return tempTableName; }
java
public String replicateTable(String tableName, boolean toCopyData) throws SQLException { String tempTableName = MySqlCommunication.getTempTableName(tableName); LOG.debug("Replicate table {} into {}", tableName, tempTableName); if (this.tableExists(tempTableName)) { this.truncateTempTable(tempTableName); } else { this.createTempTable(tableName); } if (toCopyData) { final String sql = "INSERT INTO " + tempTableName + " SELECT * FROM " + tableName + ";"; this.executeUpdate(sql); } return tempTableName; }
[ "public", "String", "replicateTable", "(", "String", "tableName", ",", "boolean", "toCopyData", ")", "throws", "SQLException", "{", "String", "tempTableName", "=", "MySqlCommunication", ".", "getTempTableName", "(", "tableName", ")", ";", "LOG", ".", "debug", "(", "\"Replicate table {} into {}\"", ",", "tableName", ",", "tempTableName", ")", ";", "if", "(", "this", ".", "tableExists", "(", "tempTableName", ")", ")", "{", "this", ".", "truncateTempTable", "(", "tempTableName", ")", ";", "}", "else", "{", "this", ".", "createTempTable", "(", "tableName", ")", ";", "}", "if", "(", "toCopyData", ")", "{", "final", "String", "sql", "=", "\"INSERT INTO \"", "+", "tempTableName", "+", "\" SELECT * FROM \"", "+", "tableName", "+", "\";\"", ";", "this", ".", "executeUpdate", "(", "sql", ")", ";", "}", "return", "tempTableName", ";", "}" ]
Replicates table structure and data from source to temporary table. @param tableName existing table name @param toCopyData boolean @return new table name @throws SQLException for any issue
[ "Replicates", "table", "structure", "and", "data", "from", "source", "to", "temporary", "table", "." ]
train
https://github.com/wanglinsong/testharness/blob/76f3e4546648e0720f6f87a58cb91a09cd36dfca/src/main/java/com/tascape/qa/th/comm/MySqlCommunication.java#L118-L131
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java
KeyUtil.readKeyStore
public static KeyStore readKeyStore(String type, InputStream in, char[] password) { """ 读取KeyStore文件<br> KeyStore文件用于数字证书的密钥对保存<br> see: http://snowolf.iteye.com/blog/391931 @param type 类型 @param in {@link InputStream} 如果想从文件读取.keystore文件,使用 {@link FileUtil#getInputStream(java.io.File)} 读取 @param password 密码 @return {@link KeyStore} """ KeyStore keyStore = null; try { keyStore = KeyStore.getInstance(type); keyStore.load(in, password); } catch (Exception e) { throw new CryptoException(e); } return keyStore; }
java
public static KeyStore readKeyStore(String type, InputStream in, char[] password) { KeyStore keyStore = null; try { keyStore = KeyStore.getInstance(type); keyStore.load(in, password); } catch (Exception e) { throw new CryptoException(e); } return keyStore; }
[ "public", "static", "KeyStore", "readKeyStore", "(", "String", "type", ",", "InputStream", "in", ",", "char", "[", "]", "password", ")", "{", "KeyStore", "keyStore", "=", "null", ";", "try", "{", "keyStore", "=", "KeyStore", ".", "getInstance", "(", "type", ")", ";", "keyStore", ".", "load", "(", "in", ",", "password", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "CryptoException", "(", "e", ")", ";", "}", "return", "keyStore", ";", "}" ]
读取KeyStore文件<br> KeyStore文件用于数字证书的密钥对保存<br> see: http://snowolf.iteye.com/blog/391931 @param type 类型 @param in {@link InputStream} 如果想从文件读取.keystore文件,使用 {@link FileUtil#getInputStream(java.io.File)} 读取 @param password 密码 @return {@link KeyStore}
[ "读取KeyStore文件<br", ">", "KeyStore文件用于数字证书的密钥对保存<br", ">", "see", ":", "http", ":", "//", "snowolf", ".", "iteye", ".", "com", "/", "blog", "/", "391931" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java#L571-L580
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheMapUtil.java
CacheMapUtil.getAll
public static <K, V> Maybe<Map<K, V>> getAll(String key, Class<K> kClazz, Class<V> vClazz) { """ retrival the cached map @param key the key @param kClazz the key's class @param vClazz the values's class @param <K> the generic type of the key @param <V> the generic type of the value @return the whole map or null if the key does not exist """ return getAll(CacheService.CACHE_CONFIG_BEAN, key, kClazz, vClazz); }
java
public static <K, V> Maybe<Map<K, V>> getAll(String key, Class<K> kClazz, Class<V> vClazz) { return getAll(CacheService.CACHE_CONFIG_BEAN, key, kClazz, vClazz); }
[ "public", "static", "<", "K", ",", "V", ">", "Maybe", "<", "Map", "<", "K", ",", "V", ">", ">", "getAll", "(", "String", "key", ",", "Class", "<", "K", ">", "kClazz", ",", "Class", "<", "V", ">", "vClazz", ")", "{", "return", "getAll", "(", "CacheService", ".", "CACHE_CONFIG_BEAN", ",", "key", ",", "kClazz", ",", "vClazz", ")", ";", "}" ]
retrival the cached map @param key the key @param kClazz the key's class @param vClazz the values's class @param <K> the generic type of the key @param <V> the generic type of the value @return the whole map or null if the key does not exist
[ "retrival", "the", "cached", "map" ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheMapUtil.java#L171-L173
codeprimate-software/cp-elements
src/main/java/org/cp/elements/util/ArrayUtils.java
ArrayUtils.filterAndTransform
@SuppressWarnings("unchecked") public static <T> T[] filterAndTransform(T[] array, FilteringTransformer<T> filteringTransformer) { """ Filters and transforms the elements in the array. @param <T> Class type of the elements in the array. @param array array to filter and transform. @param filteringTransformer {@link FilteringTransformer} used to filter and transform the array elements. @return a new array of the array class component type containing elements from the given array filtered (accepted) and transformed by the {@link FilteringTransformer}. @throws IllegalArgumentException if either the array or {@link FilteringTransformer} are null. @see org.cp.elements.lang.FilteringTransformer @see #filter(Object[], Filter) @see #transform(Object[], Transformer) """ return transform(filter(array, filteringTransformer), filteringTransformer); }
java
@SuppressWarnings("unchecked") public static <T> T[] filterAndTransform(T[] array, FilteringTransformer<T> filteringTransformer) { return transform(filter(array, filteringTransformer), filteringTransformer); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "[", "]", "filterAndTransform", "(", "T", "[", "]", "array", ",", "FilteringTransformer", "<", "T", ">", "filteringTransformer", ")", "{", "return", "transform", "(", "filter", "(", "array", ",", "filteringTransformer", ")", ",", "filteringTransformer", ")", ";", "}" ]
Filters and transforms the elements in the array. @param <T> Class type of the elements in the array. @param array array to filter and transform. @param filteringTransformer {@link FilteringTransformer} used to filter and transform the array elements. @return a new array of the array class component type containing elements from the given array filtered (accepted) and transformed by the {@link FilteringTransformer}. @throws IllegalArgumentException if either the array or {@link FilteringTransformer} are null. @see org.cp.elements.lang.FilteringTransformer @see #filter(Object[], Filter) @see #transform(Object[], Transformer)
[ "Filters", "and", "transforms", "the", "elements", "in", "the", "array", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/ArrayUtils.java#L372-L375
EdwardRaff/JSAT
JSAT/src/jsat/io/LIBSVMLoader.java
LIBSVMLoader.loadR
public static RegressionDataSet loadR(File file, double sparseRatio, int vectorLength) throws FileNotFoundException, IOException { """ Loads a new regression data set from a LIBSVM file, assuming the label is a numeric target value to predict @param file the file to load @param sparseRatio the fraction of non zero values to qualify a data point as sparse @param vectorLength the pre-determined length of each vector. If given a negative value, the largest non-zero index observed in the data will be used as the length. @return a regression data set @throws FileNotFoundException if the file was not found @throws IOException if an error occurred reading the input stream """ return loadR(new FileReader(file), sparseRatio, vectorLength); }
java
public static RegressionDataSet loadR(File file, double sparseRatio, int vectorLength) throws FileNotFoundException, IOException { return loadR(new FileReader(file), sparseRatio, vectorLength); }
[ "public", "static", "RegressionDataSet", "loadR", "(", "File", "file", ",", "double", "sparseRatio", ",", "int", "vectorLength", ")", "throws", "FileNotFoundException", ",", "IOException", "{", "return", "loadR", "(", "new", "FileReader", "(", "file", ")", ",", "sparseRatio", ",", "vectorLength", ")", ";", "}" ]
Loads a new regression data set from a LIBSVM file, assuming the label is a numeric target value to predict @param file the file to load @param sparseRatio the fraction of non zero values to qualify a data point as sparse @param vectorLength the pre-determined length of each vector. If given a negative value, the largest non-zero index observed in the data will be used as the length. @return a regression data set @throws FileNotFoundException if the file was not found @throws IOException if an error occurred reading the input stream
[ "Loads", "a", "new", "regression", "data", "set", "from", "a", "LIBSVM", "file", "assuming", "the", "label", "is", "a", "numeric", "target", "value", "to", "predict" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/io/LIBSVMLoader.java#L98-L101
sagiegurari/fax4j
src/main/java/org/fax4j/spi/http/TemplateFaxJob2HTTPRequestConverter.java
TemplateFaxJob2HTTPRequestConverter.formatHTTPResource
protected String formatHTTPResource(HTTPFaxClientSpi faxClientSpi,FaxActionType faxActionType,FaxJob faxJob) { """ This function formats the HTTP resource. @param faxClientSpi The HTTP fax client SPI @param faxActionType The fax action type @param faxJob The fax job object @return The formatted HTTP resource """ //get resource String resourceTemplate=faxClientSpi.getHTTPResource(faxActionType); //format resource String resource=SpiUtil.formatTemplate(resourceTemplate,faxJob,SpiUtil.URL_ENCODER,false,false); return resource; }
java
protected String formatHTTPResource(HTTPFaxClientSpi faxClientSpi,FaxActionType faxActionType,FaxJob faxJob) { //get resource String resourceTemplate=faxClientSpi.getHTTPResource(faxActionType); //format resource String resource=SpiUtil.formatTemplate(resourceTemplate,faxJob,SpiUtil.URL_ENCODER,false,false); return resource; }
[ "protected", "String", "formatHTTPResource", "(", "HTTPFaxClientSpi", "faxClientSpi", ",", "FaxActionType", "faxActionType", ",", "FaxJob", "faxJob", ")", "{", "//get resource", "String", "resourceTemplate", "=", "faxClientSpi", ".", "getHTTPResource", "(", "faxActionType", ")", ";", "//format resource", "String", "resource", "=", "SpiUtil", ".", "formatTemplate", "(", "resourceTemplate", ",", "faxJob", ",", "SpiUtil", ".", "URL_ENCODER", ",", "false", ",", "false", ")", ";", "return", "resource", ";", "}" ]
This function formats the HTTP resource. @param faxClientSpi The HTTP fax client SPI @param faxActionType The fax action type @param faxJob The fax job object @return The formatted HTTP resource
[ "This", "function", "formats", "the", "HTTP", "resource", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/http/TemplateFaxJob2HTTPRequestConverter.java#L308-L317
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/allocator/concurrency/DeviceAllocationsTracker.java
DeviceAllocationsTracker.reserveAllocationIfPossible
public boolean reserveAllocationIfPossible(Long threadId, Integer deviceId, long memorySize) { """ This method "reserves" memory within allocator @param threadId @param deviceId @param memorySize @return """ ensureThreadRegistered(threadId, deviceId); try { deviceLocks.get(deviceId).writeLock().lock(); /* if (getAllocatedSize(deviceId) + memorySize + getReservedSpace(deviceId)> environment.getDeviceInformation(deviceId).getTotalMemory() * configuration.getMaxDeviceMemoryUsed()) { return false; } else { addToReservedSpace(deviceId, memorySize); return true; } */ addToReservedSpace(deviceId, memorySize); return true; } finally { deviceLocks.get(deviceId).writeLock().unlock(); } }
java
public boolean reserveAllocationIfPossible(Long threadId, Integer deviceId, long memorySize) { ensureThreadRegistered(threadId, deviceId); try { deviceLocks.get(deviceId).writeLock().lock(); /* if (getAllocatedSize(deviceId) + memorySize + getReservedSpace(deviceId)> environment.getDeviceInformation(deviceId).getTotalMemory() * configuration.getMaxDeviceMemoryUsed()) { return false; } else { addToReservedSpace(deviceId, memorySize); return true; } */ addToReservedSpace(deviceId, memorySize); return true; } finally { deviceLocks.get(deviceId).writeLock().unlock(); } }
[ "public", "boolean", "reserveAllocationIfPossible", "(", "Long", "threadId", ",", "Integer", "deviceId", ",", "long", "memorySize", ")", "{", "ensureThreadRegistered", "(", "threadId", ",", "deviceId", ")", ";", "try", "{", "deviceLocks", ".", "get", "(", "deviceId", ")", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "/*\n if (getAllocatedSize(deviceId) + memorySize + getReservedSpace(deviceId)> environment.getDeviceInformation(deviceId).getTotalMemory() * configuration.getMaxDeviceMemoryUsed()) {\n return false;\n } else {\n addToReservedSpace(deviceId, memorySize);\n return true;\n }\n */", "addToReservedSpace", "(", "deviceId", ",", "memorySize", ")", ";", "return", "true", ";", "}", "finally", "{", "deviceLocks", ".", "get", "(", "deviceId", ")", ".", "writeLock", "(", ")", ".", "unlock", "(", ")", ";", "}", "}" ]
This method "reserves" memory within allocator @param threadId @param deviceId @param memorySize @return
[ "This", "method", "reserves", "memory", "within", "allocator" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/allocator/concurrency/DeviceAllocationsTracker.java#L131-L148
matomo-org/piwik-java-tracker
src/main/java/org/piwik/java/tracking/PiwikRequest.java
PiwikRequest.setPageCustomVariable
@Deprecated public void setPageCustomVariable(String key, String value) { """ Set a page custom variable with the specified key and value at the first available index. All page custom variables with this key will be overwritten or deleted @param key the key of the variable to set @param value the value of the variable to set at the specified key. A null value will remove this custom variable @deprecated Use the {@link #setPageCustomVariable(CustomVariable, int)} method instead. """ if (value == null){ removeCustomVariable(PAGE_CUSTOM_VARIABLE, key); } else { setCustomVariable(PAGE_CUSTOM_VARIABLE, new CustomVariable(key, value), null); } }
java
@Deprecated public void setPageCustomVariable(String key, String value){ if (value == null){ removeCustomVariable(PAGE_CUSTOM_VARIABLE, key); } else { setCustomVariable(PAGE_CUSTOM_VARIABLE, new CustomVariable(key, value), null); } }
[ "@", "Deprecated", "public", "void", "setPageCustomVariable", "(", "String", "key", ",", "String", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "removeCustomVariable", "(", "PAGE_CUSTOM_VARIABLE", ",", "key", ")", ";", "}", "else", "{", "setCustomVariable", "(", "PAGE_CUSTOM_VARIABLE", ",", "new", "CustomVariable", "(", "key", ",", "value", ")", ",", "null", ")", ";", "}", "}" ]
Set a page custom variable with the specified key and value at the first available index. All page custom variables with this key will be overwritten or deleted @param key the key of the variable to set @param value the value of the variable to set at the specified key. A null value will remove this custom variable @deprecated Use the {@link #setPageCustomVariable(CustomVariable, int)} method instead.
[ "Set", "a", "page", "custom", "variable", "with", "the", "specified", "key", "and", "value", "at", "the", "first", "available", "index", ".", "All", "page", "custom", "variables", "with", "this", "key", "will", "be", "overwritten", "or", "deleted" ]
train
https://github.com/matomo-org/piwik-java-tracker/blob/23df71d27a89e89dc7a539b2eda88c90a206458b/src/main/java/org/piwik/java/tracking/PiwikRequest.java#L985-L992
bignerdranch/expandable-recycler-view
expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java
ExpandableRecyclerAdapter.expandParentRange
@UiThread public void expandParentRange(int startParentPosition, int parentCount) { """ Expands all parents in a range of indices in the list of parents. @param startParentPosition The index at which to to start expanding parents @param parentCount The number of parents to expand """ int endParentPosition = startParentPosition + parentCount; for (int i = startParentPosition; i < endParentPosition; i++) { expandParent(i); } }
java
@UiThread public void expandParentRange(int startParentPosition, int parentCount) { int endParentPosition = startParentPosition + parentCount; for (int i = startParentPosition; i < endParentPosition; i++) { expandParent(i); } }
[ "@", "UiThread", "public", "void", "expandParentRange", "(", "int", "startParentPosition", ",", "int", "parentCount", ")", "{", "int", "endParentPosition", "=", "startParentPosition", "+", "parentCount", ";", "for", "(", "int", "i", "=", "startParentPosition", ";", "i", "<", "endParentPosition", ";", "i", "++", ")", "{", "expandParent", "(", "i", ")", ";", "}", "}" ]
Expands all parents in a range of indices in the list of parents. @param startParentPosition The index at which to to start expanding parents @param parentCount The number of parents to expand
[ "Expands", "all", "parents", "in", "a", "range", "of", "indices", "in", "the", "list", "of", "parents", "." ]
train
https://github.com/bignerdranch/expandable-recycler-view/blob/930912510620894c531d236856fa79d646e2f1ed/expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java#L497-L503
grpc/grpc-java
alts/src/main/java/io/grpc/alts/internal/RpcProtocolVersionsUtil.java
RpcProtocolVersionsUtil.checkRpcProtocolVersions
static RpcVersionsCheckResult checkRpcProtocolVersions( RpcProtocolVersions localVersions, RpcProtocolVersions peerVersions) { """ Performs check between local and peer Rpc Protocol Versions. This function returns true and the highest common version if there exists a common Rpc Protocol Version to use, and returns false and null otherwise. """ Version maxCommonVersion; Version minCommonVersion; // maxCommonVersion is MIN(local.max, peer.max) if (isGreaterThanOrEqualTo(localVersions.getMaxRpcVersion(), peerVersions.getMaxRpcVersion())) { maxCommonVersion = peerVersions.getMaxRpcVersion(); } else { maxCommonVersion = localVersions.getMaxRpcVersion(); } // minCommonVersion is MAX(local.min, peer.min) if (isGreaterThanOrEqualTo(localVersions.getMinRpcVersion(), peerVersions.getMinRpcVersion())) { minCommonVersion = localVersions.getMinRpcVersion(); } else { minCommonVersion = peerVersions.getMinRpcVersion(); } if (isGreaterThanOrEqualTo(maxCommonVersion, minCommonVersion)) { return new RpcVersionsCheckResult.Builder() .setResult(true) .setHighestCommonVersion(maxCommonVersion) .build(); } return new RpcVersionsCheckResult.Builder().setResult(false).build(); }
java
static RpcVersionsCheckResult checkRpcProtocolVersions( RpcProtocolVersions localVersions, RpcProtocolVersions peerVersions) { Version maxCommonVersion; Version minCommonVersion; // maxCommonVersion is MIN(local.max, peer.max) if (isGreaterThanOrEqualTo(localVersions.getMaxRpcVersion(), peerVersions.getMaxRpcVersion())) { maxCommonVersion = peerVersions.getMaxRpcVersion(); } else { maxCommonVersion = localVersions.getMaxRpcVersion(); } // minCommonVersion is MAX(local.min, peer.min) if (isGreaterThanOrEqualTo(localVersions.getMinRpcVersion(), peerVersions.getMinRpcVersion())) { minCommonVersion = localVersions.getMinRpcVersion(); } else { minCommonVersion = peerVersions.getMinRpcVersion(); } if (isGreaterThanOrEqualTo(maxCommonVersion, minCommonVersion)) { return new RpcVersionsCheckResult.Builder() .setResult(true) .setHighestCommonVersion(maxCommonVersion) .build(); } return new RpcVersionsCheckResult.Builder().setResult(false).build(); }
[ "static", "RpcVersionsCheckResult", "checkRpcProtocolVersions", "(", "RpcProtocolVersions", "localVersions", ",", "RpcProtocolVersions", "peerVersions", ")", "{", "Version", "maxCommonVersion", ";", "Version", "minCommonVersion", ";", "// maxCommonVersion is MIN(local.max, peer.max)", "if", "(", "isGreaterThanOrEqualTo", "(", "localVersions", ".", "getMaxRpcVersion", "(", ")", ",", "peerVersions", ".", "getMaxRpcVersion", "(", ")", ")", ")", "{", "maxCommonVersion", "=", "peerVersions", ".", "getMaxRpcVersion", "(", ")", ";", "}", "else", "{", "maxCommonVersion", "=", "localVersions", ".", "getMaxRpcVersion", "(", ")", ";", "}", "// minCommonVersion is MAX(local.min, peer.min)", "if", "(", "isGreaterThanOrEqualTo", "(", "localVersions", ".", "getMinRpcVersion", "(", ")", ",", "peerVersions", ".", "getMinRpcVersion", "(", ")", ")", ")", "{", "minCommonVersion", "=", "localVersions", ".", "getMinRpcVersion", "(", ")", ";", "}", "else", "{", "minCommonVersion", "=", "peerVersions", ".", "getMinRpcVersion", "(", ")", ";", "}", "if", "(", "isGreaterThanOrEqualTo", "(", "maxCommonVersion", ",", "minCommonVersion", ")", ")", "{", "return", "new", "RpcVersionsCheckResult", ".", "Builder", "(", ")", ".", "setResult", "(", "true", ")", ".", "setHighestCommonVersion", "(", "maxCommonVersion", ")", ".", "build", "(", ")", ";", "}", "return", "new", "RpcVersionsCheckResult", ".", "Builder", "(", ")", ".", "setResult", "(", "false", ")", ".", "build", "(", ")", ";", "}" ]
Performs check between local and peer Rpc Protocol Versions. This function returns true and the highest common version if there exists a common Rpc Protocol Version to use, and returns false and null otherwise.
[ "Performs", "check", "between", "local", "and", "peer", "Rpc", "Protocol", "Versions", ".", "This", "function", "returns", "true", "and", "the", "highest", "common", "version", "if", "there", "exists", "a", "common", "Rpc", "Protocol", "Version", "to", "use", "and", "returns", "false", "and", "null", "otherwise", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/alts/src/main/java/io/grpc/alts/internal/RpcProtocolVersionsUtil.java#L67-L90
JadiraOrg/jadira
bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java
BasicBinder.registerMarshaller
public final <S, T> void registerMarshaller(Class<S> source, Class<T> target, ToMarshaller<S, T> converter) { """ Register a Marshaller with the given source and target class. The marshaller is used as follows: Instances of the source can be marshalled into the target class. @param source The source (input) class @param target The target (output) class @param converter The ToMarshaller to be registered """ Class<? extends Annotation> scope = matchImplementationToScope(converter.getClass()); registerMarshaller(new ConverterKey<S,T>(source, target, scope == null ? DefaultBinding.class : scope), converter); }
java
public final <S, T> void registerMarshaller(Class<S> source, Class<T> target, ToMarshaller<S, T> converter) { Class<? extends Annotation> scope = matchImplementationToScope(converter.getClass()); registerMarshaller(new ConverterKey<S,T>(source, target, scope == null ? DefaultBinding.class : scope), converter); }
[ "public", "final", "<", "S", ",", "T", ">", "void", "registerMarshaller", "(", "Class", "<", "S", ">", "source", ",", "Class", "<", "T", ">", "target", ",", "ToMarshaller", "<", "S", ",", "T", ">", "converter", ")", "{", "Class", "<", "?", "extends", "Annotation", ">", "scope", "=", "matchImplementationToScope", "(", "converter", ".", "getClass", "(", ")", ")", ";", "registerMarshaller", "(", "new", "ConverterKey", "<", "S", ",", "T", ">", "(", "source", ",", "target", ",", "scope", "==", "null", "?", "DefaultBinding", ".", "class", ":", "scope", ")", ",", "converter", ")", ";", "}" ]
Register a Marshaller with the given source and target class. The marshaller is used as follows: Instances of the source can be marshalled into the target class. @param source The source (input) class @param target The target (output) class @param converter The ToMarshaller to be registered
[ "Register", "a", "Marshaller", "with", "the", "given", "source", "and", "target", "class", ".", "The", "marshaller", "is", "used", "as", "follows", ":", "Instances", "of", "the", "source", "can", "be", "marshalled", "into", "the", "target", "class", "." ]
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java#L568-L571
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/protocol/AbstractQueryProtocol.java
AbstractQueryProtocol.readOkPacket
private void readOkPacket(Buffer buffer, Results results) { """ Read OK_Packet. @param buffer current buffer @param results result object @see <a href="https://mariadb.com/kb/en/mariadb/ok_packet/">OK_Packet</a> """ buffer.skipByte(); //fieldCount final long updateCount = buffer.getLengthEncodedNumeric(); final long insertId = buffer.getLengthEncodedNumeric(); serverStatus = buffer.readShort(); hasWarnings = (buffer.readShort() > 0); if ((serverStatus & ServerStatus.SERVER_SESSION_STATE_CHANGED) != 0) { handleStateChange(buffer, results); } results.addStats(updateCount, insertId, hasMoreResults()); }
java
private void readOkPacket(Buffer buffer, Results results) { buffer.skipByte(); //fieldCount final long updateCount = buffer.getLengthEncodedNumeric(); final long insertId = buffer.getLengthEncodedNumeric(); serverStatus = buffer.readShort(); hasWarnings = (buffer.readShort() > 0); if ((serverStatus & ServerStatus.SERVER_SESSION_STATE_CHANGED) != 0) { handleStateChange(buffer, results); } results.addStats(updateCount, insertId, hasMoreResults()); }
[ "private", "void", "readOkPacket", "(", "Buffer", "buffer", ",", "Results", "results", ")", "{", "buffer", ".", "skipByte", "(", ")", ";", "//fieldCount", "final", "long", "updateCount", "=", "buffer", ".", "getLengthEncodedNumeric", "(", ")", ";", "final", "long", "insertId", "=", "buffer", ".", "getLengthEncodedNumeric", "(", ")", ";", "serverStatus", "=", "buffer", ".", "readShort", "(", ")", ";", "hasWarnings", "=", "(", "buffer", ".", "readShort", "(", ")", ">", "0", ")", ";", "if", "(", "(", "serverStatus", "&", "ServerStatus", ".", "SERVER_SESSION_STATE_CHANGED", ")", "!=", "0", ")", "{", "handleStateChange", "(", "buffer", ",", "results", ")", ";", "}", "results", ".", "addStats", "(", "updateCount", ",", "insertId", ",", "hasMoreResults", "(", ")", ")", ";", "}" ]
Read OK_Packet. @param buffer current buffer @param results result object @see <a href="https://mariadb.com/kb/en/mariadb/ok_packet/">OK_Packet</a>
[ "Read", "OK_Packet", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/protocol/AbstractQueryProtocol.java#L1480-L1493
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatWeekdayNumeric
private void formatWeekdayNumeric(StringBuilder b, ZonedDateTime d, int firstDay) { """ Convert from Java's ISO-8601 week number, where Monday = 1 and Sunday = 7. We need to adjust this according to the locale's "first day of the week" which in the US is Sunday = 0. In the US, Tuesday will produce '3' or the 3rd day of the week: weekday = 2 (ISO-8601 Tuesday == 2) int w = (7 - 0 + weekday) % 7 + 1 w == 3 In the US, Saturday will produce '7', ending the week: weekday = 6 (ISO-8601 Saturday == 6) int w = (7 - 0 + weekday) % 7 + 1 w == 7 """ // Java returns ISO-8601 where Monday = 1 and Sunday = 7. int weekday = d.getDayOfWeek().getValue(); // Adjust to the localized "first day of the week" int w = (7 - firstDay + weekday) % 7 + 1; b.append(w); }
java
private void formatWeekdayNumeric(StringBuilder b, ZonedDateTime d, int firstDay) { // Java returns ISO-8601 where Monday = 1 and Sunday = 7. int weekday = d.getDayOfWeek().getValue(); // Adjust to the localized "first day of the week" int w = (7 - firstDay + weekday) % 7 + 1; b.append(w); }
[ "private", "void", "formatWeekdayNumeric", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "firstDay", ")", "{", "// Java returns ISO-8601 where Monday = 1 and Sunday = 7.", "int", "weekday", "=", "d", ".", "getDayOfWeek", "(", ")", ".", "getValue", "(", ")", ";", "// Adjust to the localized \"first day of the week\"", "int", "w", "=", "(", "7", "-", "firstDay", "+", "weekday", ")", "%", "7", "+", "1", ";", "b", ".", "append", "(", "w", ")", ";", "}" ]
Convert from Java's ISO-8601 week number, where Monday = 1 and Sunday = 7. We need to adjust this according to the locale's "first day of the week" which in the US is Sunday = 0. In the US, Tuesday will produce '3' or the 3rd day of the week: weekday = 2 (ISO-8601 Tuesday == 2) int w = (7 - 0 + weekday) % 7 + 1 w == 3 In the US, Saturday will produce '7', ending the week: weekday = 6 (ISO-8601 Saturday == 6) int w = (7 - 0 + weekday) % 7 + 1 w == 7
[ "Convert", "from", "Java", "s", "ISO", "-", "8601", "week", "number", "where", "Monday", "=", "1", "and", "Sunday", "=", "7", ".", "We", "need", "to", "adjust", "this", "according", "to", "the", "locale", "s", "first", "day", "of", "the", "week", "which", "in", "the", "US", "is", "Sunday", "=", "0", "." ]
train
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L653-L660
cdk/cdk
misc/extra/src/main/java/org/openscience/cdk/protein/ProteinPocketFinder.java
ProteinPocketFinder.sitefinder
public void sitefinder() { """ Main method which calls the methods: assignProteinToGrid, GridScan, and FindPockets. """ //logger.debug("SITEFINDER"); try { assignProteinToGrid(); } catch (Exception ex1) { logger.error("Problems with assignProteinToGrid due to:" + ex1.toString()); } // 3. Step scan allong x,y,z axis and the diagonals, if PSP event add +1 // to grid cell int[] dim = gridGenerator.getDim(); // logger.debug(" SITEFINDER-SCAN - dim:" + dim[0] + " grid:" // + this.grid[0].length + " grid point sum:" + this.grid.length // * this.grid[0].length * this.grid[0][0].length); axisScanX(dim[2], dim[1], dim[0]);// x-Axis axisScanY(dim[2], dim[0], dim[1]);// y-Axis axisScanZ(dim[0], dim[1], dim[2]);// z-Axis diagonalAxisScanXZY(dim[0], dim[2], dim[1]);// diagonal1-Axis diagonalAxisScanYZX(dim[1], dim[2], dim[0]);// diagonal2-Axis diagonalAxisScanYXZ(dim[1], dim[0], dim[2]);// diagonal3-Axis diagonalAxisScanXYZ(dim[0], dim[1], dim[2]);// diagonal4-Axis //debuggCheckPSPEvent(); findPockets(); sortPockets(); }
java
public void sitefinder() { //logger.debug("SITEFINDER"); try { assignProteinToGrid(); } catch (Exception ex1) { logger.error("Problems with assignProteinToGrid due to:" + ex1.toString()); } // 3. Step scan allong x,y,z axis and the diagonals, if PSP event add +1 // to grid cell int[] dim = gridGenerator.getDim(); // logger.debug(" SITEFINDER-SCAN - dim:" + dim[0] + " grid:" // + this.grid[0].length + " grid point sum:" + this.grid.length // * this.grid[0].length * this.grid[0][0].length); axisScanX(dim[2], dim[1], dim[0]);// x-Axis axisScanY(dim[2], dim[0], dim[1]);// y-Axis axisScanZ(dim[0], dim[1], dim[2]);// z-Axis diagonalAxisScanXZY(dim[0], dim[2], dim[1]);// diagonal1-Axis diagonalAxisScanYZX(dim[1], dim[2], dim[0]);// diagonal2-Axis diagonalAxisScanYXZ(dim[1], dim[0], dim[2]);// diagonal3-Axis diagonalAxisScanXYZ(dim[0], dim[1], dim[2]);// diagonal4-Axis //debuggCheckPSPEvent(); findPockets(); sortPockets(); }
[ "public", "void", "sitefinder", "(", ")", "{", "//logger.debug(\"SITEFINDER\");", "try", "{", "assignProteinToGrid", "(", ")", ";", "}", "catch", "(", "Exception", "ex1", ")", "{", "logger", ".", "error", "(", "\"Problems with assignProteinToGrid due to:\"", "+", "ex1", ".", "toString", "(", ")", ")", ";", "}", "// 3. Step scan allong x,y,z axis and the diagonals, if PSP event add +1", "// to grid cell", "int", "[", "]", "dim", "=", "gridGenerator", ".", "getDim", "(", ")", ";", "//\t\tlogger.debug(\"\tSITEFINDER-SCAN - dim:\" + dim[0] + \" grid:\"", "//\t\t\t\t+ this.grid[0].length + \" grid point sum:\" + this.grid.length", "//\t\t\t\t* this.grid[0].length * this.grid[0][0].length);", "axisScanX", "(", "dim", "[", "2", "]", ",", "dim", "[", "1", "]", ",", "dim", "[", "0", "]", ")", ";", "// x-Axis", "axisScanY", "(", "dim", "[", "2", "]", ",", "dim", "[", "0", "]", ",", "dim", "[", "1", "]", ")", ";", "// y-Axis", "axisScanZ", "(", "dim", "[", "0", "]", ",", "dim", "[", "1", "]", ",", "dim", "[", "2", "]", ")", ";", "// z-Axis", "diagonalAxisScanXZY", "(", "dim", "[", "0", "]", ",", "dim", "[", "2", "]", ",", "dim", "[", "1", "]", ")", ";", "// diagonal1-Axis", "diagonalAxisScanYZX", "(", "dim", "[", "1", "]", ",", "dim", "[", "2", "]", ",", "dim", "[", "0", "]", ")", ";", "// diagonal2-Axis", "diagonalAxisScanYXZ", "(", "dim", "[", "1", "]", ",", "dim", "[", "0", "]", ",", "dim", "[", "2", "]", ")", ";", "// diagonal3-Axis", "diagonalAxisScanXYZ", "(", "dim", "[", "0", "]", ",", "dim", "[", "1", "]", ",", "dim", "[", "2", "]", ")", ";", "// diagonal4-Axis", "//debuggCheckPSPEvent();", "findPockets", "(", ")", ";", "sortPockets", "(", ")", ";", "}" ]
Main method which calls the methods: assignProteinToGrid, GridScan, and FindPockets.
[ "Main", "method", "which", "calls", "the", "methods", ":", "assignProteinToGrid", "GridScan", "and", "FindPockets", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/misc/extra/src/main/java/org/openscience/cdk/protein/ProteinPocketFinder.java#L298-L325
raydac/meta
meta-utils/src/main/java/com/igormaznitsa/meta/common/utils/TimeGuard.java
TimeGuard.checkPoint
@Weight(value = Weight.Unit.VARIABLE, comment = "Depends on the current call stack depth") public static void checkPoint(@Nonnull final String timePointName) { """ Check named time point(s). Listener registered for the point will be notified and the point will be removed. @param timePointName the name of time point @since 1.0 """ final long time = System.currentTimeMillis(); final int stackDepth = ThreadUtils.stackDepth(); final List<TimeData> list = REGISTRY.get(); final Iterator<TimeData> iterator = list.iterator(); boolean detected = false; while (iterator.hasNext()) { final TimeData timeWatchItem = iterator.next(); if (timeWatchItem.isTimePoint() && timeWatchItem.getDetectedStackDepth() >= stackDepth && timePointName.equals(timeWatchItem.getAlertMessage())) { detected |= true; final long detectedDelay = time - timeWatchItem.getCreationTimeInMilliseconds(); try { timeWatchItem.getAlertListener().onTimeAlert(detectedDelay, timeWatchItem); } catch (Exception ex) { final UnexpectedProcessingError error = new UnexpectedProcessingError("Error during time point processing", ex); MetaErrorListeners.fireError(error.getMessage(), error); } finally { iterator.remove(); } } } if (!detected) { throw new IllegalStateException("Can't find time point [" + timePointName + ']'); } }
java
@Weight(value = Weight.Unit.VARIABLE, comment = "Depends on the current call stack depth") public static void checkPoint(@Nonnull final String timePointName) { final long time = System.currentTimeMillis(); final int stackDepth = ThreadUtils.stackDepth(); final List<TimeData> list = REGISTRY.get(); final Iterator<TimeData> iterator = list.iterator(); boolean detected = false; while (iterator.hasNext()) { final TimeData timeWatchItem = iterator.next(); if (timeWatchItem.isTimePoint() && timeWatchItem.getDetectedStackDepth() >= stackDepth && timePointName.equals(timeWatchItem.getAlertMessage())) { detected |= true; final long detectedDelay = time - timeWatchItem.getCreationTimeInMilliseconds(); try { timeWatchItem.getAlertListener().onTimeAlert(detectedDelay, timeWatchItem); } catch (Exception ex) { final UnexpectedProcessingError error = new UnexpectedProcessingError("Error during time point processing", ex); MetaErrorListeners.fireError(error.getMessage(), error); } finally { iterator.remove(); } } } if (!detected) { throw new IllegalStateException("Can't find time point [" + timePointName + ']'); } }
[ "@", "Weight", "(", "value", "=", "Weight", ".", "Unit", ".", "VARIABLE", ",", "comment", "=", "\"Depends on the current call stack depth\"", ")", "public", "static", "void", "checkPoint", "(", "@", "Nonnull", "final", "String", "timePointName", ")", "{", "final", "long", "time", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "final", "int", "stackDepth", "=", "ThreadUtils", ".", "stackDepth", "(", ")", ";", "final", "List", "<", "TimeData", ">", "list", "=", "REGISTRY", ".", "get", "(", ")", ";", "final", "Iterator", "<", "TimeData", ">", "iterator", "=", "list", ".", "iterator", "(", ")", ";", "boolean", "detected", "=", "false", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "final", "TimeData", "timeWatchItem", "=", "iterator", ".", "next", "(", ")", ";", "if", "(", "timeWatchItem", ".", "isTimePoint", "(", ")", "&&", "timeWatchItem", ".", "getDetectedStackDepth", "(", ")", ">=", "stackDepth", "&&", "timePointName", ".", "equals", "(", "timeWatchItem", ".", "getAlertMessage", "(", ")", ")", ")", "{", "detected", "|=", "true", ";", "final", "long", "detectedDelay", "=", "time", "-", "timeWatchItem", ".", "getCreationTimeInMilliseconds", "(", ")", ";", "try", "{", "timeWatchItem", ".", "getAlertListener", "(", ")", ".", "onTimeAlert", "(", "detectedDelay", ",", "timeWatchItem", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "final", "UnexpectedProcessingError", "error", "=", "new", "UnexpectedProcessingError", "(", "\"Error during time point processing\"", ",", "ex", ")", ";", "MetaErrorListeners", ".", "fireError", "(", "error", ".", "getMessage", "(", ")", ",", "error", ")", ";", "}", "finally", "{", "iterator", ".", "remove", "(", ")", ";", "}", "}", "}", "if", "(", "!", "detected", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Can't find time point [\"", "+", "timePointName", "+", "'", "'", ")", ";", "}", "}" ]
Check named time point(s). Listener registered for the point will be notified and the point will be removed. @param timePointName the name of time point @since 1.0
[ "Check", "named", "time", "point", "(", "s", ")", ".", "Listener", "registered", "for", "the", "point", "will", "be", "notified", "and", "the", "point", "will", "be", "removed", "." ]
train
https://github.com/raydac/meta/blob/0607320ecd0734d69e6496a2714255b64adae435/meta-utils/src/main/java/com/igormaznitsa/meta/common/utils/TimeGuard.java#L255-L284
tvesalainen/util
security/src/main/java/org/vesalainen/net/ssl/SSLSocketChannel.java
SSLSocketChannel.open
public static SSLSocketChannel open(SocketChannel socketChannel, ByteBuffer consumed, boolean autoClose) throws IOException, NoSuchAlgorithmException { """ Creates SSLSocketChannel over connected SocketChannel using default SSLContext. Connection is in server mode, but can be changed before read/write. @param socketChannel @param consumed If not null, ByteBuffer's remaining can contain bytes that are consumed by SocketChannel, but are part of SSL connection. Bytes are moved from this buffer. This buffers hasRemaining is false after call. @param autoClose If true the SocketChannel is closed when SSLSocketChannel is closed. @return @throws IOException @throws java.security.NoSuchAlgorithmException """ return open(socketChannel, SSLContext.getDefault(), consumed, autoClose); }
java
public static SSLSocketChannel open(SocketChannel socketChannel, ByteBuffer consumed, boolean autoClose) throws IOException, NoSuchAlgorithmException { return open(socketChannel, SSLContext.getDefault(), consumed, autoClose); }
[ "public", "static", "SSLSocketChannel", "open", "(", "SocketChannel", "socketChannel", ",", "ByteBuffer", "consumed", ",", "boolean", "autoClose", ")", "throws", "IOException", ",", "NoSuchAlgorithmException", "{", "return", "open", "(", "socketChannel", ",", "SSLContext", ".", "getDefault", "(", ")", ",", "consumed", ",", "autoClose", ")", ";", "}" ]
Creates SSLSocketChannel over connected SocketChannel using default SSLContext. Connection is in server mode, but can be changed before read/write. @param socketChannel @param consumed If not null, ByteBuffer's remaining can contain bytes that are consumed by SocketChannel, but are part of SSL connection. Bytes are moved from this buffer. This buffers hasRemaining is false after call. @param autoClose If true the SocketChannel is closed when SSLSocketChannel is closed. @return @throws IOException @throws java.security.NoSuchAlgorithmException
[ "Creates", "SSLSocketChannel", "over", "connected", "SocketChannel", "using", "default", "SSLContext", ".", "Connection", "is", "in", "server", "mode", "but", "can", "be", "changed", "before", "read", "/", "write", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/security/src/main/java/org/vesalainen/net/ssl/SSLSocketChannel.java#L109-L112
mapsforge/mapsforge
sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java
DatabaseUtils.cursorDoubleToCursorValues
public static void cursorDoubleToCursorValues(Cursor cursor, String field, ContentValues values) { """ Reads a Double out of a field in a Cursor and writes it to a Map. @param cursor The cursor to read from @param field The REAL field to read @param values The {@link ContentValues} to put the value into """ cursorDoubleToContentValues(cursor, field, values, field); }
java
public static void cursorDoubleToCursorValues(Cursor cursor, String field, ContentValues values) { cursorDoubleToContentValues(cursor, field, values, field); }
[ "public", "static", "void", "cursorDoubleToCursorValues", "(", "Cursor", "cursor", ",", "String", "field", ",", "ContentValues", "values", ")", "{", "cursorDoubleToContentValues", "(", "cursor", ",", "field", ",", "values", ",", "field", ")", ";", "}" ]
Reads a Double out of a field in a Cursor and writes it to a Map. @param cursor The cursor to read from @param field The REAL field to read @param values The {@link ContentValues} to put the value into
[ "Reads", "a", "Double", "out", "of", "a", "field", "in", "a", "Cursor", "and", "writes", "it", "to", "a", "Map", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java#L706-L709
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/EvaluationCalibration.java
EvaluationCalibration.getProbabilityHistogram
public Histogram getProbabilityHistogram(int labelClassIdx) { """ Return a probability histogram of the specified label class index. That is, for label class index i, a histogram of P(class_i | input) is returned, only for those examples that are labelled as class i. @param labelClassIdx Index of the label class to get the histogram for @return Probability histogram """ String title = "Network Probabilities Histogram - P(class " + labelClassIdx + ") - Data Labelled Class " + labelClassIdx + " Only"; int[] counts = probHistogramByLabelClass.getColumn(labelClassIdx).dup().data().asInt(); return new Histogram(title, 0.0, 1.0, counts); }
java
public Histogram getProbabilityHistogram(int labelClassIdx) { String title = "Network Probabilities Histogram - P(class " + labelClassIdx + ") - Data Labelled Class " + labelClassIdx + " Only"; int[] counts = probHistogramByLabelClass.getColumn(labelClassIdx).dup().data().asInt(); return new Histogram(title, 0.0, 1.0, counts); }
[ "public", "Histogram", "getProbabilityHistogram", "(", "int", "labelClassIdx", ")", "{", "String", "title", "=", "\"Network Probabilities Histogram - P(class \"", "+", "labelClassIdx", "+", "\") - Data Labelled Class \"", "+", "labelClassIdx", "+", "\" Only\"", ";", "int", "[", "]", "counts", "=", "probHistogramByLabelClass", ".", "getColumn", "(", "labelClassIdx", ")", ".", "dup", "(", ")", ".", "data", "(", ")", ".", "asInt", "(", ")", ";", "return", "new", "Histogram", "(", "title", ",", "0.0", ",", "1.0", ",", "counts", ")", ";", "}" ]
Return a probability histogram of the specified label class index. That is, for label class index i, a histogram of P(class_i | input) is returned, only for those examples that are labelled as class i. @param labelClassIdx Index of the label class to get the histogram for @return Probability histogram
[ "Return", "a", "probability", "histogram", "of", "the", "specified", "label", "class", "index", ".", "That", "is", "for", "label", "class", "index", "i", "a", "histogram", "of", "P", "(", "class_i", "|", "input", ")", "is", "returned", "only", "for", "those", "examples", "that", "are", "labelled", "as", "class", "i", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/EvaluationCalibration.java#L467-L472
auth0/auth0-java
src/main/java/com/auth0/client/mgmt/filter/GrantsFilter.java
GrantsFilter.withPage
public GrantsFilter withPage(int pageNumber, int amountPerPage) { """ Filter by page @param pageNumber the page number to retrieve. @param amountPerPage the amount of items per page to retrieve. @return this filter instance """ parameters.put("page", pageNumber); parameters.put("per_page", amountPerPage); return this; }
java
public GrantsFilter withPage(int pageNumber, int amountPerPage) { parameters.put("page", pageNumber); parameters.put("per_page", amountPerPage); return this; }
[ "public", "GrantsFilter", "withPage", "(", "int", "pageNumber", ",", "int", "amountPerPage", ")", "{", "parameters", ".", "put", "(", "\"page\"", ",", "pageNumber", ")", ";", "parameters", ".", "put", "(", "\"per_page\"", ",", "amountPerPage", ")", ";", "return", "this", ";", "}" ]
Filter by page @param pageNumber the page number to retrieve. @param amountPerPage the amount of items per page to retrieve. @return this filter instance
[ "Filter", "by", "page" ]
train
https://github.com/auth0/auth0-java/blob/b7bc099ee9c6cde5a87c4ecfebc6d811aeb1027c/src/main/java/com/auth0/client/mgmt/filter/GrantsFilter.java#L37-L41
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/ValidationFileUtil.java
ValidationFileUtil.initFileSendHeader
public static void initFileSendHeader(HttpServletResponse res, String filename, String contentType) { """ Init file send header. @param res the res @param filename the filename @param contentType the content type """ filename = getEncodingFileName(filename); if (contentType != null) { res.setContentType(contentType); } else { res.setContentType("applicaiton/download;charset=utf-8"); } res.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\";"); res.setHeader("Content-Transfer-Encoding", "binary"); res.setHeader("file-name", filename); }
java
public static void initFileSendHeader(HttpServletResponse res, String filename, String contentType) { filename = getEncodingFileName(filename); if (contentType != null) { res.setContentType(contentType); } else { res.setContentType("applicaiton/download;charset=utf-8"); } res.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\";"); res.setHeader("Content-Transfer-Encoding", "binary"); res.setHeader("file-name", filename); }
[ "public", "static", "void", "initFileSendHeader", "(", "HttpServletResponse", "res", ",", "String", "filename", ",", "String", "contentType", ")", "{", "filename", "=", "getEncodingFileName", "(", "filename", ")", ";", "if", "(", "contentType", "!=", "null", ")", "{", "res", ".", "setContentType", "(", "contentType", ")", ";", "}", "else", "{", "res", ".", "setContentType", "(", "\"applicaiton/download;charset=utf-8\"", ")", ";", "}", "res", ".", "setHeader", "(", "\"Content-Disposition\"", ",", "\"attachment; filename=\\\"\"", "+", "filename", "+", "\"\\\";\"", ")", ";", "res", ".", "setHeader", "(", "\"Content-Transfer-Encoding\"", ",", "\"binary\"", ")", ";", "res", ".", "setHeader", "(", "\"file-name\"", ",", "filename", ")", ";", "}" ]
Init file send header. @param res the res @param filename the filename @param contentType the content type
[ "Init", "file", "send", "header", "." ]
train
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/ValidationFileUtil.java#L89-L101
albfernandez/itext2
src/main/java/com/lowagie/text/Document.java
Document.addAuthor
public boolean addAuthor(String author) { """ Adds the author to a Document. @param author the name of the author @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise """ try { return add(new Meta(Element.AUTHOR, author)); } catch (DocumentException de) { throw new ExceptionConverter(de); } }
java
public boolean addAuthor(String author) { try { return add(new Meta(Element.AUTHOR, author)); } catch (DocumentException de) { throw new ExceptionConverter(de); } }
[ "public", "boolean", "addAuthor", "(", "String", "author", ")", "{", "try", "{", "return", "add", "(", "new", "Meta", "(", "Element", ".", "AUTHOR", ",", "author", ")", ")", ";", "}", "catch", "(", "DocumentException", "de", ")", "{", "throw", "new", "ExceptionConverter", "(", "de", ")", ";", "}", "}" ]
Adds the author to a Document. @param author the name of the author @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
[ "Adds", "the", "author", "to", "a", "Document", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Document.java#L576-L582
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/util/Utils.java
Utils.isProcessCase
public static boolean isProcessCase(final ProcessCase currentCase, ProcessCase[] cases) { """ 現在の処理ケースが該当するか判定する。 <p>ケースが指定されていないときは、該当すると判定する。</p> @param currentCase 現在の処理ケース @param cases 判定対象のケース @return trueのとき判定対象。 @throws IllegalArgumentException {@code currentCase is null.} """ ArgUtils.notNull(currentCase, "currentCase"); if(currentCase == ProcessCase.Load) { return isLoadCase(cases); } else if(currentCase == ProcessCase.Save) { return isSaveCase(cases); } else { throw new IllegalArgumentException("currentCase is not support:" + currentCase); } }
java
public static boolean isProcessCase(final ProcessCase currentCase, ProcessCase[] cases) { ArgUtils.notNull(currentCase, "currentCase"); if(currentCase == ProcessCase.Load) { return isLoadCase(cases); } else if(currentCase == ProcessCase.Save) { return isSaveCase(cases); } else { throw new IllegalArgumentException("currentCase is not support:" + currentCase); } }
[ "public", "static", "boolean", "isProcessCase", "(", "final", "ProcessCase", "currentCase", ",", "ProcessCase", "[", "]", "cases", ")", "{", "ArgUtils", ".", "notNull", "(", "currentCase", ",", "\"currentCase\"", ")", ";", "if", "(", "currentCase", "==", "ProcessCase", ".", "Load", ")", "{", "return", "isLoadCase", "(", "cases", ")", ";", "}", "else", "if", "(", "currentCase", "==", "ProcessCase", ".", "Save", ")", "{", "return", "isSaveCase", "(", "cases", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"currentCase is not support:\"", "+", "currentCase", ")", ";", "}", "}" ]
現在の処理ケースが該当するか判定する。 <p>ケースが指定されていないときは、該当すると判定する。</p> @param currentCase 現在の処理ケース @param cases 判定対象のケース @return trueのとき判定対象。 @throws IllegalArgumentException {@code currentCase is null.}
[ "現在の処理ケースが該当するか判定する。", "<p", ">", "ケースが指定されていないときは、該当すると判定する。<", "/", "p", ">" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/util/Utils.java#L933-L945
Falydoor/limesurvey-rc
src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java
LimesurveyRC.callRC
public JsonElement callRC(LsApiBody body) throws LimesurveyRCException { """ Call Limesurvey Remote Control. @param body the body of the request. Contains which method to call and the parameters @return the json element containing the result from the call @throws LimesurveyRCException the limesurvey rc exception """ try (CloseableHttpClient client = HttpClientBuilder.create().build()) { HttpPost post = new HttpPost(url); post.setHeader("Content-type", "application/json"); String jsonBody = gson.toJson(body); LOGGER.debug("API CALL JSON => " + jsonBody); post.setEntity(new StringEntity(jsonBody)); HttpResponse response = client.execute(post); if (response.getStatusLine().getStatusCode() == 200) { String jsonResult = EntityUtils.toString(response.getEntity()); LOGGER.debug("API RESPONSE JSON => " + jsonResult); JsonElement result = new JsonParser().parse(jsonResult).getAsJsonObject().get("result"); if (result.isJsonObject() && result.getAsJsonObject().has("status")) { throw new LimesurveyRCException("Error from API : " + result.getAsJsonObject().get("status").getAsString()); } return result; } else { throw new LimesurveyRCException("Expecting status code 200, got " + response.getStatusLine().getStatusCode() + " instead"); } } catch (IOException e) { throw new LimesurveyRCException("Exception while calling API : " + e.getMessage(), e); } }
java
public JsonElement callRC(LsApiBody body) throws LimesurveyRCException { try (CloseableHttpClient client = HttpClientBuilder.create().build()) { HttpPost post = new HttpPost(url); post.setHeader("Content-type", "application/json"); String jsonBody = gson.toJson(body); LOGGER.debug("API CALL JSON => " + jsonBody); post.setEntity(new StringEntity(jsonBody)); HttpResponse response = client.execute(post); if (response.getStatusLine().getStatusCode() == 200) { String jsonResult = EntityUtils.toString(response.getEntity()); LOGGER.debug("API RESPONSE JSON => " + jsonResult); JsonElement result = new JsonParser().parse(jsonResult).getAsJsonObject().get("result"); if (result.isJsonObject() && result.getAsJsonObject().has("status")) { throw new LimesurveyRCException("Error from API : " + result.getAsJsonObject().get("status").getAsString()); } return result; } else { throw new LimesurveyRCException("Expecting status code 200, got " + response.getStatusLine().getStatusCode() + " instead"); } } catch (IOException e) { throw new LimesurveyRCException("Exception while calling API : " + e.getMessage(), e); } }
[ "public", "JsonElement", "callRC", "(", "LsApiBody", "body", ")", "throws", "LimesurveyRCException", "{", "try", "(", "CloseableHttpClient", "client", "=", "HttpClientBuilder", ".", "create", "(", ")", ".", "build", "(", ")", ")", "{", "HttpPost", "post", "=", "new", "HttpPost", "(", "url", ")", ";", "post", ".", "setHeader", "(", "\"Content-type\"", ",", "\"application/json\"", ")", ";", "String", "jsonBody", "=", "gson", ".", "toJson", "(", "body", ")", ";", "LOGGER", ".", "debug", "(", "\"API CALL JSON => \"", "+", "jsonBody", ")", ";", "post", ".", "setEntity", "(", "new", "StringEntity", "(", "jsonBody", ")", ")", ";", "HttpResponse", "response", "=", "client", ".", "execute", "(", "post", ")", ";", "if", "(", "response", ".", "getStatusLine", "(", ")", ".", "getStatusCode", "(", ")", "==", "200", ")", "{", "String", "jsonResult", "=", "EntityUtils", ".", "toString", "(", "response", ".", "getEntity", "(", ")", ")", ";", "LOGGER", ".", "debug", "(", "\"API RESPONSE JSON => \"", "+", "jsonResult", ")", ";", "JsonElement", "result", "=", "new", "JsonParser", "(", ")", ".", "parse", "(", "jsonResult", ")", ".", "getAsJsonObject", "(", ")", ".", "get", "(", "\"result\"", ")", ";", "if", "(", "result", ".", "isJsonObject", "(", ")", "&&", "result", ".", "getAsJsonObject", "(", ")", ".", "has", "(", "\"status\"", ")", ")", "{", "throw", "new", "LimesurveyRCException", "(", "\"Error from API : \"", "+", "result", ".", "getAsJsonObject", "(", ")", ".", "get", "(", "\"status\"", ")", ".", "getAsString", "(", ")", ")", ";", "}", "return", "result", ";", "}", "else", "{", "throw", "new", "LimesurveyRCException", "(", "\"Expecting status code 200, got \"", "+", "response", ".", "getStatusLine", "(", ")", ".", "getStatusCode", "(", ")", "+", "\" instead\"", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "LimesurveyRCException", "(", "\"Exception while calling API : \"", "+", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "}" ]
Call Limesurvey Remote Control. @param body the body of the request. Contains which method to call and the parameters @return the json element containing the result from the call @throws LimesurveyRCException the limesurvey rc exception
[ "Call", "Limesurvey", "Remote", "Control", "." ]
train
https://github.com/Falydoor/limesurvey-rc/blob/b8d573389086395e46a0bdeeddeef4d1c2c0a488/src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java#L89-L111
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/AIStream.java
AIStream.updateToAccepted
public void updateToAccepted(long tick, AIProtocolItem acceptedItem) { """ Turn a tick to L/A. Used to either: (1) turn an assured V/U to L/A, in which case acceptedItemId is valid, or (2) turn an express Q/G to L/A when discarding a message that came in out of order """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "updateToAccepted", new Object[] { Long.valueOf(tick), acceptedItem }); _targetStream.setCursor(tick); TickRange tr = _targetStream.getNext(); if ((tr.type == TickRange.Requested) || (tr.type == TickRange.Value)) { if (acceptedItem != null) { // At this point, the persist of the accepted item has committed so we can add it to the index synchronized(_completedPrefix) { _itemStreamIndex.add(acceptedItem); } } writeAccepted(tick); // This is delayed until ACCEPT_INITIAL_THRESHOLD, writeAccepted batches the accepted tick // When the TOM fires, it sends the initial batch of accepts // long[] ticks = { tick }; // sendDispatcher.sendAccept(ticks); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "updateToAccepted"); }
java
public void updateToAccepted(long tick, AIProtocolItem acceptedItem) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "updateToAccepted", new Object[] { Long.valueOf(tick), acceptedItem }); _targetStream.setCursor(tick); TickRange tr = _targetStream.getNext(); if ((tr.type == TickRange.Requested) || (tr.type == TickRange.Value)) { if (acceptedItem != null) { // At this point, the persist of the accepted item has committed so we can add it to the index synchronized(_completedPrefix) { _itemStreamIndex.add(acceptedItem); } } writeAccepted(tick); // This is delayed until ACCEPT_INITIAL_THRESHOLD, writeAccepted batches the accepted tick // When the TOM fires, it sends the initial batch of accepts // long[] ticks = { tick }; // sendDispatcher.sendAccept(ticks); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "updateToAccepted"); }
[ "public", "void", "updateToAccepted", "(", "long", "tick", ",", "AIProtocolItem", "acceptedItem", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"updateToAccepted\"", ",", "new", "Object", "[", "]", "{", "Long", ".", "valueOf", "(", "tick", ")", ",", "acceptedItem", "}", ")", ";", "_targetStream", ".", "setCursor", "(", "tick", ")", ";", "TickRange", "tr", "=", "_targetStream", ".", "getNext", "(", ")", ";", "if", "(", "(", "tr", ".", "type", "==", "TickRange", ".", "Requested", ")", "||", "(", "tr", ".", "type", "==", "TickRange", ".", "Value", ")", ")", "{", "if", "(", "acceptedItem", "!=", "null", ")", "{", "// At this point, the persist of the accepted item has committed so we can add it to the index", "synchronized", "(", "_completedPrefix", ")", "{", "_itemStreamIndex", ".", "add", "(", "acceptedItem", ")", ";", "}", "}", "writeAccepted", "(", "tick", ")", ";", "// This is delayed until ACCEPT_INITIAL_THRESHOLD, writeAccepted batches the accepted tick", "// When the TOM fires, it sends the initial batch of accepts", "// long[] ticks = { tick };", "// sendDispatcher.sendAccept(ticks);", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"updateToAccepted\"", ")", ";", "}" ]
Turn a tick to L/A. Used to either: (1) turn an assured V/U to L/A, in which case acceptedItemId is valid, or (2) turn an express Q/G to L/A when discarding a message that came in out of order
[ "Turn", "a", "tick", "to", "L", "/", "A", ".", "Used", "to", "either", ":", "(", "1", ")", "turn", "an", "assured", "V", "/", "U", "to", "L", "/", "A", "in", "which", "case", "acceptedItemId", "is", "valid", "or", "(", "2", ")", "turn", "an", "express", "Q", "/", "G", "to", "L", "/", "A", "when", "discarding", "a", "message", "that", "came", "in", "out", "of", "order" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/AIStream.java#L857-L888
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/agent/SpringPlugin.java
SpringPlugin.bytesWithInstanceCreationCaptured
private byte[] bytesWithInstanceCreationCaptured(byte[] bytes, String classToCall, String methodToCall) { """ Modify the supplied bytes such that constructors are intercepted and will invoke the specified class/method so that the instances can be tracked. @return modified bytes for the class """ ClassReader cr = new ClassReader(bytes); ClassVisitingConstructorAppender ca = new ClassVisitingConstructorAppender(classToCall, methodToCall); cr.accept(ca, 0); byte[] newbytes = ca.getBytes(); return newbytes; }
java
private byte[] bytesWithInstanceCreationCaptured(byte[] bytes, String classToCall, String methodToCall) { ClassReader cr = new ClassReader(bytes); ClassVisitingConstructorAppender ca = new ClassVisitingConstructorAppender(classToCall, methodToCall); cr.accept(ca, 0); byte[] newbytes = ca.getBytes(); return newbytes; }
[ "private", "byte", "[", "]", "bytesWithInstanceCreationCaptured", "(", "byte", "[", "]", "bytes", ",", "String", "classToCall", ",", "String", "methodToCall", ")", "{", "ClassReader", "cr", "=", "new", "ClassReader", "(", "bytes", ")", ";", "ClassVisitingConstructorAppender", "ca", "=", "new", "ClassVisitingConstructorAppender", "(", "classToCall", ",", "methodToCall", ")", ";", "cr", ".", "accept", "(", "ca", ",", "0", ")", ";", "byte", "[", "]", "newbytes", "=", "ca", ".", "getBytes", "(", ")", ";", "return", "newbytes", ";", "}" ]
Modify the supplied bytes such that constructors are intercepted and will invoke the specified class/method so that the instances can be tracked. @return modified bytes for the class
[ "Modify", "the", "supplied", "bytes", "such", "that", "constructors", "are", "intercepted", "and", "will", "invoke", "the", "specified", "class", "/", "method", "so", "that", "the", "instances", "can", "be", "tracked", "." ]
train
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/agent/SpringPlugin.java#L515-L521
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingLocatorsInner.java
StreamingLocatorsInner.createAsync
public Observable<StreamingLocatorInner> createAsync(String resourceGroupName, String accountName, String streamingLocatorName, StreamingLocatorInner parameters) { """ Create a Streaming Locator. Create a Streaming Locator in the Media Services account. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param streamingLocatorName The Streaming Locator name. @param parameters The request parameters @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the StreamingLocatorInner object """ return createWithServiceResponseAsync(resourceGroupName, accountName, streamingLocatorName, parameters).map(new Func1<ServiceResponse<StreamingLocatorInner>, StreamingLocatorInner>() { @Override public StreamingLocatorInner call(ServiceResponse<StreamingLocatorInner> response) { return response.body(); } }); }
java
public Observable<StreamingLocatorInner> createAsync(String resourceGroupName, String accountName, String streamingLocatorName, StreamingLocatorInner parameters) { return createWithServiceResponseAsync(resourceGroupName, accountName, streamingLocatorName, parameters).map(new Func1<ServiceResponse<StreamingLocatorInner>, StreamingLocatorInner>() { @Override public StreamingLocatorInner call(ServiceResponse<StreamingLocatorInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "StreamingLocatorInner", ">", "createAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "streamingLocatorName", ",", "StreamingLocatorInner", "parameters", ")", "{", "return", "createWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "streamingLocatorName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "StreamingLocatorInner", ">", ",", "StreamingLocatorInner", ">", "(", ")", "{", "@", "Override", "public", "StreamingLocatorInner", "call", "(", "ServiceResponse", "<", "StreamingLocatorInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Create a Streaming Locator. Create a Streaming Locator in the Media Services account. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param streamingLocatorName The Streaming Locator name. @param parameters The request parameters @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the StreamingLocatorInner object
[ "Create", "a", "Streaming", "Locator", ".", "Create", "a", "Streaming", "Locator", "in", "the", "Media", "Services", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingLocatorsInner.java#L504-L511
trustathsh/ifmapj
src/main/java/de/hshannover/f4/trust/ifmapj/identifier/Identifiers.java
Identifiers.createIp6
public static IpAddress createIp6(String value, String admDom) { """ Create an ip-address identifier for IPv6 with the given parameters. @param value a {@link String} that represents a valid IPv4 address @param admDom the administrative-domain @return the new ip-address identifier """ return createIp(IpAddressType.IPv6, value, admDom); }
java
public static IpAddress createIp6(String value, String admDom) { return createIp(IpAddressType.IPv6, value, admDom); }
[ "public", "static", "IpAddress", "createIp6", "(", "String", "value", ",", "String", "admDom", ")", "{", "return", "createIp", "(", "IpAddressType", ".", "IPv6", ",", "value", ",", "admDom", ")", ";", "}" ]
Create an ip-address identifier for IPv6 with the given parameters. @param value a {@link String} that represents a valid IPv4 address @param admDom the administrative-domain @return the new ip-address identifier
[ "Create", "an", "ip", "-", "address", "identifier", "for", "IPv6", "with", "the", "given", "parameters", "." ]
train
https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/identifier/Identifiers.java#L637-L639
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Assert.java
Assert.isAssignable
public static void isAssignable(Class<?> superType, Class<?> subType) throws IllegalArgumentException { """ 断言 {@code superType.isAssignableFrom(subType)} 是否为 {@code true}. <pre class="code"> Assert.isAssignable(Number.class, myClass); </pre> @param superType 需要检查的父类或接口 @param subType 需要检查的子类 @throws IllegalArgumentException 如果子类非继承父类,抛出此异常 """ isAssignable(superType, subType, "{} is not assignable to {})", subType, superType); }
java
public static void isAssignable(Class<?> superType, Class<?> subType) throws IllegalArgumentException { isAssignable(superType, subType, "{} is not assignable to {})", subType, superType); }
[ "public", "static", "void", "isAssignable", "(", "Class", "<", "?", ">", "superType", ",", "Class", "<", "?", ">", "subType", ")", "throws", "IllegalArgumentException", "{", "isAssignable", "(", "superType", ",", "subType", ",", "\"{} is not assignable to {})\"", ",", "subType", ",", "superType", ")", ";", "}" ]
断言 {@code superType.isAssignableFrom(subType)} 是否为 {@code true}. <pre class="code"> Assert.isAssignable(Number.class, myClass); </pre> @param superType 需要检查的父类或接口 @param subType 需要检查的子类 @throws IllegalArgumentException 如果子类非继承父类,抛出此异常
[ "断言", "{", "@code", "superType", ".", "isAssignableFrom", "(", "subType", ")", "}", "是否为", "{", "@code", "true", "}", "." ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L468-L470
alkacon/opencms-core
src/org/opencms/util/CmsStringUtil.java
CmsStringUtil.substituteContextPath
public static String substituteContextPath(String htmlContent, String context) { """ Substitutes the OpenCms context path (e.g. /opencms/opencms/) in a HTML page with a special variable so that the content also runs if the context path of the server changes.<p> @param htmlContent the HTML to replace the context path in @param context the context path of the server @return the HTML with the replaced context path """ if (m_contextSearch == null) { m_contextSearch = "([^\\w/])" + context; m_contextReplace = "$1" + CmsStringUtil.escapePattern(CmsStringUtil.MACRO_OPENCMS_CONTEXT) + "/"; } return substitutePerl(htmlContent, m_contextSearch, m_contextReplace, "g"); }
java
public static String substituteContextPath(String htmlContent, String context) { if (m_contextSearch == null) { m_contextSearch = "([^\\w/])" + context; m_contextReplace = "$1" + CmsStringUtil.escapePattern(CmsStringUtil.MACRO_OPENCMS_CONTEXT) + "/"; } return substitutePerl(htmlContent, m_contextSearch, m_contextReplace, "g"); }
[ "public", "static", "String", "substituteContextPath", "(", "String", "htmlContent", ",", "String", "context", ")", "{", "if", "(", "m_contextSearch", "==", "null", ")", "{", "m_contextSearch", "=", "\"([^\\\\w/])\"", "+", "context", ";", "m_contextReplace", "=", "\"$1\"", "+", "CmsStringUtil", ".", "escapePattern", "(", "CmsStringUtil", ".", "MACRO_OPENCMS_CONTEXT", ")", "+", "\"/\"", ";", "}", "return", "substitutePerl", "(", "htmlContent", ",", "m_contextSearch", ",", "m_contextReplace", ",", "\"g\"", ")", ";", "}" ]
Substitutes the OpenCms context path (e.g. /opencms/opencms/) in a HTML page with a special variable so that the content also runs if the context path of the server changes.<p> @param htmlContent the HTML to replace the context path in @param context the context path of the server @return the HTML with the replaced context path
[ "Substitutes", "the", "OpenCms", "context", "path", "(", "e", ".", "g", ".", "/", "opencms", "/", "opencms", "/", ")", "in", "a", "HTML", "page", "with", "a", "special", "variable", "so", "that", "the", "content", "also", "runs", "if", "the", "context", "path", "of", "the", "server", "changes", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsStringUtil.java#L1731-L1738
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java
DomHelper.setController
public void setController(Object object, GraphicsController controller, int eventMask) { """ Set the controller on an element of this <code>GraphicsContext</code> so it can react to events. @param object the element on which the controller should be set. @param controller The new <code>GraphicsController</code> @param eventMask a bitmask to specify which events to listen for {@link com.google.gwt.user.client.Event} """ doSetController(getGroup(object), controller, eventMask); }
java
public void setController(Object object, GraphicsController controller, int eventMask) { doSetController(getGroup(object), controller, eventMask); }
[ "public", "void", "setController", "(", "Object", "object", ",", "GraphicsController", "controller", ",", "int", "eventMask", ")", "{", "doSetController", "(", "getGroup", "(", "object", ")", ",", "controller", ",", "eventMask", ")", ";", "}" ]
Set the controller on an element of this <code>GraphicsContext</code> so it can react to events. @param object the element on which the controller should be set. @param controller The new <code>GraphicsController</code> @param eventMask a bitmask to specify which events to listen for {@link com.google.gwt.user.client.Event}
[ "Set", "the", "controller", "on", "an", "element", "of", "this", "<code", ">", "GraphicsContext<", "/", "code", ">", "so", "it", "can", "react", "to", "events", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L583-L585
cdk/cdk
base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/AbstractVFState.java
AbstractVFState.nextM
@Override final int nextM(int n, int m) { """ Given the current target candidate (m), find the next candidate. The next candidate is the next vertex > m (in some ordering) that is unmapped and is adjacent to a mapped vertex (terminal). If there is no such vertex (disconnected) the next unmapped vertex is returned. If there are no more candidates m == |V| of G2. @param m previous candidate m @return the next value of m """ if (size == 0) return m + 1; // if the query vertex 'n' is in the terminal set (t1) then the // target vertex must be in the terminal set (t2) for (int i = m + 1; i < g2.length; i++) if (m2[i] == UNMAPPED && (t1[n] == 0 || t2[i] > 0)) return i; return mMax(); }
java
@Override final int nextM(int n, int m) { if (size == 0) return m + 1; // if the query vertex 'n' is in the terminal set (t1) then the // target vertex must be in the terminal set (t2) for (int i = m + 1; i < g2.length; i++) if (m2[i] == UNMAPPED && (t1[n] == 0 || t2[i] > 0)) return i; return mMax(); }
[ "@", "Override", "final", "int", "nextM", "(", "int", "n", ",", "int", "m", ")", "{", "if", "(", "size", "==", "0", ")", "return", "m", "+", "1", ";", "// if the query vertex 'n' is in the terminal set (t1) then the", "// target vertex must be in the terminal set (t2)", "for", "(", "int", "i", "=", "m", "+", "1", ";", "i", "<", "g2", ".", "length", ";", "i", "++", ")", "if", "(", "m2", "[", "i", "]", "==", "UNMAPPED", "&&", "(", "t1", "[", "n", "]", "==", "0", "||", "t2", "[", "i", "]", ">", "0", ")", ")", "return", "i", ";", "return", "mMax", "(", ")", ";", "}" ]
Given the current target candidate (m), find the next candidate. The next candidate is the next vertex > m (in some ordering) that is unmapped and is adjacent to a mapped vertex (terminal). If there is no such vertex (disconnected) the next unmapped vertex is returned. If there are no more candidates m == |V| of G2. @param m previous candidate m @return the next value of m
[ "Given", "the", "current", "target", "candidate", "(", "m", ")", "find", "the", "next", "candidate", ".", "The", "next", "candidate", "is", "the", "next", "vertex", ">", "m", "(", "in", "some", "ordering", ")", "that", "is", "unmapped", "and", "is", "adjacent", "to", "a", "mapped", "vertex", "(", "terminal", ")", ".", "If", "there", "is", "no", "such", "vertex", "(", "disconnected", ")", "the", "next", "unmapped", "vertex", "is", "returned", ".", "If", "there", "are", "no", "more", "candidates", "m", "==", "|V|", "of", "G2", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/AbstractVFState.java#L104-L112
looly/hutool
hutool-core/src/main/java/cn/hutool/core/comparator/ComparatorChain.java
ComparatorChain.setComparator
public ComparatorChain<E> setComparator(final int index, final Comparator<E> comparator) throws IndexOutOfBoundsException { """ 替换指定位置的比较器,保持原排序方式 @param index 位置 @param comparator {@link Comparator} @return this @exception IndexOutOfBoundsException if index &lt; 0 or index &gt;= size() """ return setComparator(index, comparator, false); }
java
public ComparatorChain<E> setComparator(final int index, final Comparator<E> comparator) throws IndexOutOfBoundsException { return setComparator(index, comparator, false); }
[ "public", "ComparatorChain", "<", "E", ">", "setComparator", "(", "final", "int", "index", ",", "final", "Comparator", "<", "E", ">", "comparator", ")", "throws", "IndexOutOfBoundsException", "{", "return", "setComparator", "(", "index", ",", "comparator", ",", "false", ")", ";", "}" ]
替换指定位置的比较器,保持原排序方式 @param index 位置 @param comparator {@link Comparator} @return this @exception IndexOutOfBoundsException if index &lt; 0 or index &gt;= size()
[ "替换指定位置的比较器,保持原排序方式" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/comparator/ComparatorChain.java#L119-L121
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/value/binary/S3BinaryStore.java
S3BinaryStore.setS3ObjectTag
private void setS3ObjectTag(String objectKey, String tagKey, String tagValue) throws BinaryStoreException { """ Sets a tag on a S3 object, potentially overwriting the existing value. @param objectKey @param tagKey @param tagValue @throws BinaryStoreException """ try { GetObjectTaggingRequest getTaggingRequest = new GetObjectTaggingRequest(bucketName, objectKey); GetObjectTaggingResult getTaggingResult = s3Client.getObjectTagging(getTaggingRequest); List<Tag> initialTagSet = getTaggingResult.getTagSet(); List<Tag> mergedTagSet = mergeS3TagSet(initialTagSet, new Tag(tagKey, tagValue)); if (initialTagSet.size() == mergedTagSet.size() && initialTagSet.containsAll(mergedTagSet)) { return; } SetObjectTaggingRequest setObjectTaggingRequest = new SetObjectTaggingRequest(bucketName, objectKey, new ObjectTagging(mergedTagSet)); s3Client.setObjectTagging(setObjectTaggingRequest); } catch (AmazonClientException e) { throw new BinaryStoreException(e); } }
java
private void setS3ObjectTag(String objectKey, String tagKey, String tagValue) throws BinaryStoreException { try { GetObjectTaggingRequest getTaggingRequest = new GetObjectTaggingRequest(bucketName, objectKey); GetObjectTaggingResult getTaggingResult = s3Client.getObjectTagging(getTaggingRequest); List<Tag> initialTagSet = getTaggingResult.getTagSet(); List<Tag> mergedTagSet = mergeS3TagSet(initialTagSet, new Tag(tagKey, tagValue)); if (initialTagSet.size() == mergedTagSet.size() && initialTagSet.containsAll(mergedTagSet)) { return; } SetObjectTaggingRequest setObjectTaggingRequest = new SetObjectTaggingRequest(bucketName, objectKey, new ObjectTagging(mergedTagSet)); s3Client.setObjectTagging(setObjectTaggingRequest); } catch (AmazonClientException e) { throw new BinaryStoreException(e); } }
[ "private", "void", "setS3ObjectTag", "(", "String", "objectKey", ",", "String", "tagKey", ",", "String", "tagValue", ")", "throws", "BinaryStoreException", "{", "try", "{", "GetObjectTaggingRequest", "getTaggingRequest", "=", "new", "GetObjectTaggingRequest", "(", "bucketName", ",", "objectKey", ")", ";", "GetObjectTaggingResult", "getTaggingResult", "=", "s3Client", ".", "getObjectTagging", "(", "getTaggingRequest", ")", ";", "List", "<", "Tag", ">", "initialTagSet", "=", "getTaggingResult", ".", "getTagSet", "(", ")", ";", "List", "<", "Tag", ">", "mergedTagSet", "=", "mergeS3TagSet", "(", "initialTagSet", ",", "new", "Tag", "(", "tagKey", ",", "tagValue", ")", ")", ";", "if", "(", "initialTagSet", ".", "size", "(", ")", "==", "mergedTagSet", ".", "size", "(", ")", "&&", "initialTagSet", ".", "containsAll", "(", "mergedTagSet", ")", ")", "{", "return", ";", "}", "SetObjectTaggingRequest", "setObjectTaggingRequest", "=", "new", "SetObjectTaggingRequest", "(", "bucketName", ",", "objectKey", ",", "new", "ObjectTagging", "(", "mergedTagSet", ")", ")", ";", "s3Client", ".", "setObjectTagging", "(", "setObjectTaggingRequest", ")", ";", "}", "catch", "(", "AmazonClientException", "e", ")", "{", "throw", "new", "BinaryStoreException", "(", "e", ")", ";", "}", "}" ]
Sets a tag on a S3 object, potentially overwriting the existing value. @param objectKey @param tagKey @param tagValue @throws BinaryStoreException
[ "Sets", "a", "tag", "on", "a", "S3", "object", "potentially", "overwriting", "the", "existing", "value", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/value/binary/S3BinaryStore.java#L338-L357
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java
Widget.findChildByName
public Widget findChildByName(final String name) { """ Finds the Widget in hierarchy @param name Name of the child to find @return The named child {@link Widget} or {@code null} if not found. """ final List<Widget> groups = new ArrayList<>(); groups.add(this); return findChildByNameInAllGroups(name, groups); }
java
public Widget findChildByName(final String name) { final List<Widget> groups = new ArrayList<>(); groups.add(this); return findChildByNameInAllGroups(name, groups); }
[ "public", "Widget", "findChildByName", "(", "final", "String", "name", ")", "{", "final", "List", "<", "Widget", ">", "groups", "=", "new", "ArrayList", "<>", "(", ")", ";", "groups", ".", "add", "(", "this", ")", ";", "return", "findChildByNameInAllGroups", "(", "name", ",", "groups", ")", ";", "}" ]
Finds the Widget in hierarchy @param name Name of the child to find @return The named child {@link Widget} or {@code null} if not found.
[ "Finds", "the", "Widget", "in", "hierarchy" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java#L1974-L1979
apache/flink
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/gateway/local/ProgramDeployer.java
ProgramDeployer.deployJob
private <T> void deployJob(ExecutionContext<T> context, JobGraph jobGraph, Result<T> result) { """ Deploys a job. Depending on the deployment creates a new job cluster. It saves the cluster id in the result and blocks until job completion. """ // create or retrieve cluster and deploy job try (final ClusterDescriptor<T> clusterDescriptor = context.createClusterDescriptor()) { try { // new cluster if (context.getClusterId() == null) { deployJobOnNewCluster(clusterDescriptor, jobGraph, result, context.getClassLoader()); } // reuse existing cluster else { deployJobOnExistingCluster(context.getClusterId(), clusterDescriptor, jobGraph, result); } } catch (Exception e) { throw new SqlExecutionException("Could not retrieve or create a cluster.", e); } } catch (SqlExecutionException e) { throw e; } catch (Exception e) { throw new SqlExecutionException("Could not locate a cluster.", e); } }
java
private <T> void deployJob(ExecutionContext<T> context, JobGraph jobGraph, Result<T> result) { // create or retrieve cluster and deploy job try (final ClusterDescriptor<T> clusterDescriptor = context.createClusterDescriptor()) { try { // new cluster if (context.getClusterId() == null) { deployJobOnNewCluster(clusterDescriptor, jobGraph, result, context.getClassLoader()); } // reuse existing cluster else { deployJobOnExistingCluster(context.getClusterId(), clusterDescriptor, jobGraph, result); } } catch (Exception e) { throw new SqlExecutionException("Could not retrieve or create a cluster.", e); } } catch (SqlExecutionException e) { throw e; } catch (Exception e) { throw new SqlExecutionException("Could not locate a cluster.", e); } }
[ "private", "<", "T", ">", "void", "deployJob", "(", "ExecutionContext", "<", "T", ">", "context", ",", "JobGraph", "jobGraph", ",", "Result", "<", "T", ">", "result", ")", "{", "// create or retrieve cluster and deploy job", "try", "(", "final", "ClusterDescriptor", "<", "T", ">", "clusterDescriptor", "=", "context", ".", "createClusterDescriptor", "(", ")", ")", "{", "try", "{", "// new cluster", "if", "(", "context", ".", "getClusterId", "(", ")", "==", "null", ")", "{", "deployJobOnNewCluster", "(", "clusterDescriptor", ",", "jobGraph", ",", "result", ",", "context", ".", "getClassLoader", "(", ")", ")", ";", "}", "// reuse existing cluster", "else", "{", "deployJobOnExistingCluster", "(", "context", ".", "getClusterId", "(", ")", ",", "clusterDescriptor", ",", "jobGraph", ",", "result", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "SqlExecutionException", "(", "\"Could not retrieve or create a cluster.\"", ",", "e", ")", ";", "}", "}", "catch", "(", "SqlExecutionException", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "SqlExecutionException", "(", "\"Could not locate a cluster.\"", ",", "e", ")", ";", "}", "}" ]
Deploys a job. Depending on the deployment creates a new job cluster. It saves the cluster id in the result and blocks until job completion.
[ "Deploys", "a", "job", ".", "Depending", "on", "the", "deployment", "creates", "a", "new", "job", "cluster", ".", "It", "saves", "the", "cluster", "id", "in", "the", "result", "and", "blocks", "until", "job", "completion", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/gateway/local/ProgramDeployer.java#L89-L109
ModeShape/modeshape
index-providers/modeshape-lucene-index-provider/src/main/java/org/modeshape/jcr/index/lucene/query/CompareNameQuery.java
CompareNameQuery.createQueryForNodesWithNameLessThan
public static CompareNameQuery createQueryForNodesWithNameLessThan( Name constraintValue, String localNameField, ValueFactories factories, Function<String, String> caseOperation ) { """ Construct a {@link Query} implementation that scores documents such that the node represented by the document has a name that is less than the supplied constraint name. @param constraintValue the constraint value; may not be null @param localNameField the name of the document field containing the local name value; may not be null @param factories the value factories that can be used during the scoring; may not be null @param caseOperation the operation that should be performed on the indexed values before the constraint value is being evaluated; may be null which indicates that no case conversion should be done @return the query; never null """ return new CompareNameQuery(localNameField, constraintValue, factories.getNameFactory(), (name1, name2) -> NAME_COMPARATOR.compare(name1, name2) < 0, caseOperation); }
java
public static CompareNameQuery createQueryForNodesWithNameLessThan( Name constraintValue, String localNameField, ValueFactories factories, Function<String, String> caseOperation ) { return new CompareNameQuery(localNameField, constraintValue, factories.getNameFactory(), (name1, name2) -> NAME_COMPARATOR.compare(name1, name2) < 0, caseOperation); }
[ "public", "static", "CompareNameQuery", "createQueryForNodesWithNameLessThan", "(", "Name", "constraintValue", ",", "String", "localNameField", ",", "ValueFactories", "factories", ",", "Function", "<", "String", ",", "String", ">", "caseOperation", ")", "{", "return", "new", "CompareNameQuery", "(", "localNameField", ",", "constraintValue", ",", "factories", ".", "getNameFactory", "(", ")", ",", "(", "name1", ",", "name2", ")", "->", "NAME_COMPARATOR", ".", "compare", "(", "name1", ",", "name2", ")", "<", "0", ",", "caseOperation", ")", ";", "}" ]
Construct a {@link Query} implementation that scores documents such that the node represented by the document has a name that is less than the supplied constraint name. @param constraintValue the constraint value; may not be null @param localNameField the name of the document field containing the local name value; may not be null @param factories the value factories that can be used during the scoring; may not be null @param caseOperation the operation that should be performed on the indexed values before the constraint value is being evaluated; may be null which indicates that no case conversion should be done @return the query; never null
[ "Construct", "a", "{", "@link", "Query", "}", "implementation", "that", "scores", "documents", "such", "that", "the", "node", "represented", "by", "the", "document", "has", "a", "name", "that", "is", "less", "than", "the", "supplied", "constraint", "name", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/index-providers/modeshape-lucene-index-provider/src/main/java/org/modeshape/jcr/index/lucene/query/CompareNameQuery.java#L142-L149
lessthanoptimal/BoofCV
main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/direct/VisOdomDirectColorDepth.java
VisOdomDirectColorDepth.estimateMotion
public boolean estimateMotion(Planar<I> input , Se3_F32 hintKeyToInput ) { """ Estimates the motion relative to the key frame. @param input Next image in the sequence @param hintKeyToInput estimated transform from keyframe to the current input image @return true if it was successful at estimating the motion or false if it failed for some reason """ InputSanityCheck.checkSameShape(derivX,input); initMotion(input); keyToCurrent.set(hintKeyToInput); boolean foundSolution = false; float previousError = Float.MAX_VALUE; for (int i = 0; i < maxIterations; i++) { constructLinearSystem(input, keyToCurrent); if (!solveSystem()) break; if( Math.abs(previousError-errorOptical)/previousError < convergeTol ) break; else { // update the estimated motion from the computed twist previousError = errorOptical; keyToCurrent.concat(motionTwist, tmp); keyToCurrent.set(tmp); foundSolution = true; } } return foundSolution; }
java
public boolean estimateMotion(Planar<I> input , Se3_F32 hintKeyToInput ) { InputSanityCheck.checkSameShape(derivX,input); initMotion(input); keyToCurrent.set(hintKeyToInput); boolean foundSolution = false; float previousError = Float.MAX_VALUE; for (int i = 0; i < maxIterations; i++) { constructLinearSystem(input, keyToCurrent); if (!solveSystem()) break; if( Math.abs(previousError-errorOptical)/previousError < convergeTol ) break; else { // update the estimated motion from the computed twist previousError = errorOptical; keyToCurrent.concat(motionTwist, tmp); keyToCurrent.set(tmp); foundSolution = true; } } return foundSolution; }
[ "public", "boolean", "estimateMotion", "(", "Planar", "<", "I", ">", "input", ",", "Se3_F32", "hintKeyToInput", ")", "{", "InputSanityCheck", ".", "checkSameShape", "(", "derivX", ",", "input", ")", ";", "initMotion", "(", "input", ")", ";", "keyToCurrent", ".", "set", "(", "hintKeyToInput", ")", ";", "boolean", "foundSolution", "=", "false", ";", "float", "previousError", "=", "Float", ".", "MAX_VALUE", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "maxIterations", ";", "i", "++", ")", "{", "constructLinearSystem", "(", "input", ",", "keyToCurrent", ")", ";", "if", "(", "!", "solveSystem", "(", ")", ")", "break", ";", "if", "(", "Math", ".", "abs", "(", "previousError", "-", "errorOptical", ")", "/", "previousError", "<", "convergeTol", ")", "break", ";", "else", "{", "// update the estimated motion from the computed twist", "previousError", "=", "errorOptical", ";", "keyToCurrent", ".", "concat", "(", "motionTwist", ",", "tmp", ")", ";", "keyToCurrent", ".", "set", "(", "tmp", ")", ";", "foundSolution", "=", "true", ";", "}", "}", "return", "foundSolution", ";", "}" ]
Estimates the motion relative to the key frame. @param input Next image in the sequence @param hintKeyToInput estimated transform from keyframe to the current input image @return true if it was successful at estimating the motion or false if it failed for some reason
[ "Estimates", "the", "motion", "relative", "to", "the", "key", "frame", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/direct/VisOdomDirectColorDepth.java#L252-L276
beanshell/beanshell
src/main/java/bsh/Interpreter.java
Interpreter.source
public Object source( String filename ) throws FileNotFoundException, IOException, EvalError { """ Read text from fileName and eval it. Convenience method. Use the global namespace. """ return source( filename, globalNameSpace ); }
java
public Object source( String filename ) throws FileNotFoundException, IOException, EvalError { return source( filename, globalNameSpace ); }
[ "public", "Object", "source", "(", "String", "filename", ")", "throws", "FileNotFoundException", ",", "IOException", ",", "EvalError", "{", "return", "source", "(", "filename", ",", "globalNameSpace", ")", ";", "}" ]
Read text from fileName and eval it. Convenience method. Use the global namespace.
[ "Read", "text", "from", "fileName", "and", "eval", "it", ".", "Convenience", "method", ".", "Use", "the", "global", "namespace", "." ]
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/Interpreter.java#L580-L584
ykrasik/jaci
jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java
ReflectionUtils.getNoArgsMethod
public static ReflectionMethod getNoArgsMethod(Class<?> clazz, String methodName) { """ Returns a method with the provided name that takes no-args. @param clazz Class to search. @param methodName Method name. @return A method with the provided name that takes no-args. @throws RuntimeException If the class doesn't contain a no-args method with the given name. """ assertReflectionAccessor(); try { // TODO: Support inheritance? return accessor.getDeclaredMethod(clazz, methodName, NO_ARGS_TYPE); } catch (Exception e) { throw SneakyException.sneakyThrow(e); } }
java
public static ReflectionMethod getNoArgsMethod(Class<?> clazz, String methodName) { assertReflectionAccessor(); try { // TODO: Support inheritance? return accessor.getDeclaredMethod(clazz, methodName, NO_ARGS_TYPE); } catch (Exception e) { throw SneakyException.sneakyThrow(e); } }
[ "public", "static", "ReflectionMethod", "getNoArgsMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "methodName", ")", "{", "assertReflectionAccessor", "(", ")", ";", "try", "{", "// TODO: Support inheritance?", "return", "accessor", ".", "getDeclaredMethod", "(", "clazz", ",", "methodName", ",", "NO_ARGS_TYPE", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "SneakyException", ".", "sneakyThrow", "(", "e", ")", ";", "}", "}" ]
Returns a method with the provided name that takes no-args. @param clazz Class to search. @param methodName Method name. @return A method with the provided name that takes no-args. @throws RuntimeException If the class doesn't contain a no-args method with the given name.
[ "Returns", "a", "method", "with", "the", "provided", "name", "that", "takes", "no", "-", "args", "." ]
train
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java#L108-L116
StripesFramework/stripes-stuff
src/main/java/org/stripesstuff/plugin/session/SessionStoreInterceptor.java
SessionStoreInterceptor.saveFields
protected void saveFields(Collection<Field> fields, ActionBean actionBean, HttpSession session) throws IllegalAccessException { """ Saves all fields in session. @param fields Fields to save in session. @param actionBean ActionBean. @param session HttpSession. @throws IllegalAccessException Cannot get access to some fields. """ for (Field field : fields) { if (!field.isAccessible()) { field.setAccessible(true); } setAttribute(session, getFieldKey(field, actionBean.getClass()), field.get(actionBean), ((Session)field.getAnnotation(Session.class)).serializable(), ((Session)field.getAnnotation(Session.class)).maxTime()); } }
java
protected void saveFields(Collection<Field> fields, ActionBean actionBean, HttpSession session) throws IllegalAccessException { for (Field field : fields) { if (!field.isAccessible()) { field.setAccessible(true); } setAttribute(session, getFieldKey(field, actionBean.getClass()), field.get(actionBean), ((Session)field.getAnnotation(Session.class)).serializable(), ((Session)field.getAnnotation(Session.class)).maxTime()); } }
[ "protected", "void", "saveFields", "(", "Collection", "<", "Field", ">", "fields", ",", "ActionBean", "actionBean", ",", "HttpSession", "session", ")", "throws", "IllegalAccessException", "{", "for", "(", "Field", "field", ":", "fields", ")", "{", "if", "(", "!", "field", ".", "isAccessible", "(", ")", ")", "{", "field", ".", "setAccessible", "(", "true", ")", ";", "}", "setAttribute", "(", "session", ",", "getFieldKey", "(", "field", ",", "actionBean", ".", "getClass", "(", ")", ")", ",", "field", ".", "get", "(", "actionBean", ")", ",", "(", "(", "Session", ")", "field", ".", "getAnnotation", "(", "Session", ".", "class", ")", ")", ".", "serializable", "(", ")", ",", "(", "(", "Session", ")", "field", ".", "getAnnotation", "(", "Session", ".", "class", ")", ")", ".", "maxTime", "(", ")", ")", ";", "}", "}" ]
Saves all fields in session. @param fields Fields to save in session. @param actionBean ActionBean. @param session HttpSession. @throws IllegalAccessException Cannot get access to some fields.
[ "Saves", "all", "fields", "in", "session", "." ]
train
https://github.com/StripesFramework/stripes-stuff/blob/51ad92b4bd5862ba34d7c18c5829fb00ea3a3811/src/main/java/org/stripesstuff/plugin/session/SessionStoreInterceptor.java#L76-L83
liferay/com-liferay-commerce
commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceEntryPersistenceImpl.java
CommercePriceEntryPersistenceImpl.fetchByC_ERC
@Override public CommercePriceEntry fetchByC_ERC(long companyId, String externalReferenceCode) { """ Returns the commerce price entry where companyId = &#63; and externalReferenceCode = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache. @param companyId the company ID @param externalReferenceCode the external reference code @return the matching commerce price entry, or <code>null</code> if a matching commerce price entry could not be found """ return fetchByC_ERC(companyId, externalReferenceCode, true); }
java
@Override public CommercePriceEntry fetchByC_ERC(long companyId, String externalReferenceCode) { return fetchByC_ERC(companyId, externalReferenceCode, true); }
[ "@", "Override", "public", "CommercePriceEntry", "fetchByC_ERC", "(", "long", "companyId", ",", "String", "externalReferenceCode", ")", "{", "return", "fetchByC_ERC", "(", "companyId", ",", "externalReferenceCode", ",", "true", ")", ";", "}" ]
Returns the commerce price entry where companyId = &#63; and externalReferenceCode = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache. @param companyId the company ID @param externalReferenceCode the external reference code @return the matching commerce price entry, or <code>null</code> if a matching commerce price entry could not be found
[ "Returns", "the", "commerce", "price", "entry", "where", "companyId", "=", "&#63", ";", "and", "externalReferenceCode", "=", "&#63", ";", "or", "returns", "<code", ">", "null<", "/", "code", ">", "if", "it", "could", "not", "be", "found", ".", "Uses", "the", "finder", "cache", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceEntryPersistenceImpl.java#L3912-L3916
apereo/cas
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/EncodingUtils.java
EncodingUtils.encodeBase32
public static String encodeBase32(final byte[] data, final boolean chunked) { """ Base32-encode the given byte[] as a string. @param data the byte array to encode @param chunked the chunked @return the encoded string """ if (chunked) { return BASE32_CHUNKED_ENCODER.encodeToString(data).trim(); } return BASE32_UNCHUNKED_ENCODER.encodeToString(data).trim(); }
java
public static String encodeBase32(final byte[] data, final boolean chunked) { if (chunked) { return BASE32_CHUNKED_ENCODER.encodeToString(data).trim(); } return BASE32_UNCHUNKED_ENCODER.encodeToString(data).trim(); }
[ "public", "static", "String", "encodeBase32", "(", "final", "byte", "[", "]", "data", ",", "final", "boolean", "chunked", ")", "{", "if", "(", "chunked", ")", "{", "return", "BASE32_CHUNKED_ENCODER", ".", "encodeToString", "(", "data", ")", ".", "trim", "(", ")", ";", "}", "return", "BASE32_UNCHUNKED_ENCODER", ".", "encodeToString", "(", "data", ")", ".", "trim", "(", ")", ";", "}" ]
Base32-encode the given byte[] as a string. @param data the byte array to encode @param chunked the chunked @return the encoded string
[ "Base32", "-", "encode", "the", "given", "byte", "[]", "as", "a", "string", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/EncodingUtils.java#L216-L221
spring-projects/spring-android
spring-android-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java
GenericCollectionTypeResolver.getCollectionFieldType
public static Class<?> getCollectionFieldType(Field collectionField, int nestingLevel, Map<Integer, Integer> typeIndexesPerLevel) { """ Determine the generic element type of the given Collection field. @param collectionField the collection field to introspect @param nestingLevel the nesting level of the target type (typically 1; e.g. in case of a List of Lists, 1 would indicate the nested List, whereas 2 would indicate the element of the nested List) @param typeIndexesPerLevel Map keyed by nesting level, with each value expressing the type index for traversal at that level @return the generic type, or {@code null} if none """ return getGenericFieldType(collectionField, Collection.class, 0, typeIndexesPerLevel, nestingLevel); }
java
public static Class<?> getCollectionFieldType(Field collectionField, int nestingLevel, Map<Integer, Integer> typeIndexesPerLevel) { return getGenericFieldType(collectionField, Collection.class, 0, typeIndexesPerLevel, nestingLevel); }
[ "public", "static", "Class", "<", "?", ">", "getCollectionFieldType", "(", "Field", "collectionField", ",", "int", "nestingLevel", ",", "Map", "<", "Integer", ",", "Integer", ">", "typeIndexesPerLevel", ")", "{", "return", "getGenericFieldType", "(", "collectionField", ",", "Collection", ".", "class", ",", "0", ",", "typeIndexesPerLevel", ",", "nestingLevel", ")", ";", "}" ]
Determine the generic element type of the given Collection field. @param collectionField the collection field to introspect @param nestingLevel the nesting level of the target type (typically 1; e.g. in case of a List of Lists, 1 would indicate the nested List, whereas 2 would indicate the element of the nested List) @param typeIndexesPerLevel Map keyed by nesting level, with each value expressing the type index for traversal at that level @return the generic type, or {@code null} if none
[ "Determine", "the", "generic", "element", "type", "of", "the", "given", "Collection", "field", "." ]
train
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java#L104-L106
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/core/variable/scope/AbstractVariableScope.java
AbstractVariableScope.checkJavaSerialization
protected void checkJavaSerialization(String variableName, TypedValue value) { """ Checks, if Java serialization will be used and if it is allowed to be used. @param variableName @param value """ ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); if (value instanceof SerializableValue && !processEngineConfiguration.isJavaSerializationFormatEnabled()) { SerializableValue serializableValue = (SerializableValue) value; // if Java serialization is prohibited if (!serializableValue.isDeserialized()) { String javaSerializationDataFormat = Variables.SerializationDataFormats.JAVA.getName(); String requestedDataFormat = serializableValue.getSerializationDataFormat(); if (requestedDataFormat == null) { // check if Java serializer will be used final TypedValueSerializer serializerForValue = TypedValueField.getSerializers() .findSerializerForValue(serializableValue, processEngineConfiguration.getFallbackSerializerFactory()); if (serializerForValue != null) { requestedDataFormat = serializerForValue.getSerializationDataformat(); } } if (javaSerializationDataFormat.equals(requestedDataFormat)) { throw ProcessEngineLogger.CORE_LOGGER.javaSerializationProhibitedException(variableName); } } } }
java
protected void checkJavaSerialization(String variableName, TypedValue value) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); if (value instanceof SerializableValue && !processEngineConfiguration.isJavaSerializationFormatEnabled()) { SerializableValue serializableValue = (SerializableValue) value; // if Java serialization is prohibited if (!serializableValue.isDeserialized()) { String javaSerializationDataFormat = Variables.SerializationDataFormats.JAVA.getName(); String requestedDataFormat = serializableValue.getSerializationDataFormat(); if (requestedDataFormat == null) { // check if Java serializer will be used final TypedValueSerializer serializerForValue = TypedValueField.getSerializers() .findSerializerForValue(serializableValue, processEngineConfiguration.getFallbackSerializerFactory()); if (serializerForValue != null) { requestedDataFormat = serializerForValue.getSerializationDataformat(); } } if (javaSerializationDataFormat.equals(requestedDataFormat)) { throw ProcessEngineLogger.CORE_LOGGER.javaSerializationProhibitedException(variableName); } } } }
[ "protected", "void", "checkJavaSerialization", "(", "String", "variableName", ",", "TypedValue", "value", ")", "{", "ProcessEngineConfigurationImpl", "processEngineConfiguration", "=", "Context", ".", "getProcessEngineConfiguration", "(", ")", ";", "if", "(", "value", "instanceof", "SerializableValue", "&&", "!", "processEngineConfiguration", ".", "isJavaSerializationFormatEnabled", "(", ")", ")", "{", "SerializableValue", "serializableValue", "=", "(", "SerializableValue", ")", "value", ";", "// if Java serialization is prohibited", "if", "(", "!", "serializableValue", ".", "isDeserialized", "(", ")", ")", "{", "String", "javaSerializationDataFormat", "=", "Variables", ".", "SerializationDataFormats", ".", "JAVA", ".", "getName", "(", ")", ";", "String", "requestedDataFormat", "=", "serializableValue", ".", "getSerializationDataFormat", "(", ")", ";", "if", "(", "requestedDataFormat", "==", "null", ")", "{", "// check if Java serializer will be used", "final", "TypedValueSerializer", "serializerForValue", "=", "TypedValueField", ".", "getSerializers", "(", ")", ".", "findSerializerForValue", "(", "serializableValue", ",", "processEngineConfiguration", ".", "getFallbackSerializerFactory", "(", ")", ")", ";", "if", "(", "serializerForValue", "!=", "null", ")", "{", "requestedDataFormat", "=", "serializerForValue", ".", "getSerializationDataformat", "(", ")", ";", "}", "}", "if", "(", "javaSerializationDataFormat", ".", "equals", "(", "requestedDataFormat", ")", ")", "{", "throw", "ProcessEngineLogger", ".", "CORE_LOGGER", ".", "javaSerializationProhibitedException", "(", "variableName", ")", ";", "}", "}", "}", "}" ]
Checks, if Java serialization will be used and if it is allowed to be used. @param variableName @param value
[ "Checks", "if", "Java", "serialization", "will", "be", "used", "and", "if", "it", "is", "allowed", "to", "be", "used", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/core/variable/scope/AbstractVariableScope.java#L380-L406
JDBDT/jdbdt
src/main/java/org/jdbdt/Log.java
Log.write
void write(CallInfo callInfo, SQLException e) { """ Report a database exception onto the log. @param callInfo Call info. @param e Database exception. """ Element rootNode = root(callInfo); Element exNode = createNode(rootNode, DATABASE_EXCEPTION_TAG); StringWriter sw = new StringWriter(); sw.append('\n'); e.printStackTrace(new PrintWriter(sw)); exNode.appendChild(xmlDoc.createCDATASection(sw.toString())); flush(rootNode); }
java
void write(CallInfo callInfo, SQLException e) { Element rootNode = root(callInfo); Element exNode = createNode(rootNode, DATABASE_EXCEPTION_TAG); StringWriter sw = new StringWriter(); sw.append('\n'); e.printStackTrace(new PrintWriter(sw)); exNode.appendChild(xmlDoc.createCDATASection(sw.toString())); flush(rootNode); }
[ "void", "write", "(", "CallInfo", "callInfo", ",", "SQLException", "e", ")", "{", "Element", "rootNode", "=", "root", "(", "callInfo", ")", ";", "Element", "exNode", "=", "createNode", "(", "rootNode", ",", "DATABASE_EXCEPTION_TAG", ")", ";", "StringWriter", "sw", "=", "new", "StringWriter", "(", ")", ";", "sw", ".", "append", "(", "'", "'", ")", ";", "e", ".", "printStackTrace", "(", "new", "PrintWriter", "(", "sw", ")", ")", ";", "exNode", ".", "appendChild", "(", "xmlDoc", ".", "createCDATASection", "(", "sw", ".", "toString", "(", ")", ")", ")", ";", "flush", "(", "rootNode", ")", ";", "}" ]
Report a database exception onto the log. @param callInfo Call info. @param e Database exception.
[ "Report", "a", "database", "exception", "onto", "the", "log", "." ]
train
https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/Log.java#L180-L188
yavijava/yavijava
src/main/java/com/vmware/vim25/mo/SearchIndex.java
SearchIndex.findByDnsName
public ManagedEntity findByDnsName(Datacenter datacenter, String dnsName, boolean vmOnly) throws RuntimeFault, RemoteException { """ Find a VM or Host by its DNS name @param datacenter The datacenter within which it searches. If null is passed, all inventory is searched. @param dnsName DNS name like "dev.eng.vmware.com" @param vmOnly When set true only searches for VM; otherwise only for Host. @return A ManagedEntity to either HostSystem or VirtualMachine having the DNS name. @throws RemoteException @throws RuntimeFault """ ManagedObjectReference mor = getVimService().findByDnsName(getMOR(), datacenter == null ? null : datacenter.getMOR(), dnsName, vmOnly); return MorUtil.createExactManagedEntity(getServerConnection(), mor); }
java
public ManagedEntity findByDnsName(Datacenter datacenter, String dnsName, boolean vmOnly) throws RuntimeFault, RemoteException { ManagedObjectReference mor = getVimService().findByDnsName(getMOR(), datacenter == null ? null : datacenter.getMOR(), dnsName, vmOnly); return MorUtil.createExactManagedEntity(getServerConnection(), mor); }
[ "public", "ManagedEntity", "findByDnsName", "(", "Datacenter", "datacenter", ",", "String", "dnsName", ",", "boolean", "vmOnly", ")", "throws", "RuntimeFault", ",", "RemoteException", "{", "ManagedObjectReference", "mor", "=", "getVimService", "(", ")", ".", "findByDnsName", "(", "getMOR", "(", ")", ",", "datacenter", "==", "null", "?", "null", ":", "datacenter", ".", "getMOR", "(", ")", ",", "dnsName", ",", "vmOnly", ")", ";", "return", "MorUtil", ".", "createExactManagedEntity", "(", "getServerConnection", "(", ")", ",", "mor", ")", ";", "}" ]
Find a VM or Host by its DNS name @param datacenter The datacenter within which it searches. If null is passed, all inventory is searched. @param dnsName DNS name like "dev.eng.vmware.com" @param vmOnly When set true only searches for VM; otherwise only for Host. @return A ManagedEntity to either HostSystem or VirtualMachine having the DNS name. @throws RemoteException @throws RuntimeFault
[ "Find", "a", "VM", "or", "Host", "by", "its", "DNS", "name" ]
train
https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/SearchIndex.java#L90-L93
spotify/scio
scio-examples/src/main/java/org/apache/beam/examples/complete/TfIdf.java
TfIdf.listInputDocuments
public static Set<URI> listInputDocuments(Options options) throws URISyntaxException, IOException { """ Lists documents contained beneath the {@code options.input} prefix/directory. """ URI baseUri = new URI(options.getInput()); // List all documents in the directory or GCS prefix. URI absoluteUri; if (baseUri.getScheme() != null) { absoluteUri = baseUri; } else { absoluteUri = new URI( "file", baseUri.getAuthority(), baseUri.getPath(), baseUri.getQuery(), baseUri.getFragment()); } Set<URI> uris = new HashSet<>(); if ("file".equals(absoluteUri.getScheme())) { File directory = new File(absoluteUri); for (String entry : Optional.fromNullable(directory.list()).or(new String[] {})) { File path = new File(directory, entry); uris.add(path.toURI()); } } else if ("gs".equals(absoluteUri.getScheme())) { GcsUtil gcsUtil = options.as(GcsOptions.class).getGcsUtil(); URI gcsUriGlob = new URI( absoluteUri.getScheme(), absoluteUri.getAuthority(), absoluteUri.getPath() + "*", absoluteUri.getQuery(), absoluteUri.getFragment()); for (GcsPath entry : gcsUtil.expand(GcsPath.fromUri(gcsUriGlob))) { uris.add(entry.toUri()); } } return uris; }
java
public static Set<URI> listInputDocuments(Options options) throws URISyntaxException, IOException { URI baseUri = new URI(options.getInput()); // List all documents in the directory or GCS prefix. URI absoluteUri; if (baseUri.getScheme() != null) { absoluteUri = baseUri; } else { absoluteUri = new URI( "file", baseUri.getAuthority(), baseUri.getPath(), baseUri.getQuery(), baseUri.getFragment()); } Set<URI> uris = new HashSet<>(); if ("file".equals(absoluteUri.getScheme())) { File directory = new File(absoluteUri); for (String entry : Optional.fromNullable(directory.list()).or(new String[] {})) { File path = new File(directory, entry); uris.add(path.toURI()); } } else if ("gs".equals(absoluteUri.getScheme())) { GcsUtil gcsUtil = options.as(GcsOptions.class).getGcsUtil(); URI gcsUriGlob = new URI( absoluteUri.getScheme(), absoluteUri.getAuthority(), absoluteUri.getPath() + "*", absoluteUri.getQuery(), absoluteUri.getFragment()); for (GcsPath entry : gcsUtil.expand(GcsPath.fromUri(gcsUriGlob))) { uris.add(entry.toUri()); } } return uris; }
[ "public", "static", "Set", "<", "URI", ">", "listInputDocuments", "(", "Options", "options", ")", "throws", "URISyntaxException", ",", "IOException", "{", "URI", "baseUri", "=", "new", "URI", "(", "options", ".", "getInput", "(", ")", ")", ";", "// List all documents in the directory or GCS prefix.", "URI", "absoluteUri", ";", "if", "(", "baseUri", ".", "getScheme", "(", ")", "!=", "null", ")", "{", "absoluteUri", "=", "baseUri", ";", "}", "else", "{", "absoluteUri", "=", "new", "URI", "(", "\"file\"", ",", "baseUri", ".", "getAuthority", "(", ")", ",", "baseUri", ".", "getPath", "(", ")", ",", "baseUri", ".", "getQuery", "(", ")", ",", "baseUri", ".", "getFragment", "(", ")", ")", ";", "}", "Set", "<", "URI", ">", "uris", "=", "new", "HashSet", "<>", "(", ")", ";", "if", "(", "\"file\"", ".", "equals", "(", "absoluteUri", ".", "getScheme", "(", ")", ")", ")", "{", "File", "directory", "=", "new", "File", "(", "absoluteUri", ")", ";", "for", "(", "String", "entry", ":", "Optional", ".", "fromNullable", "(", "directory", ".", "list", "(", ")", ")", ".", "or", "(", "new", "String", "[", "]", "{", "}", ")", ")", "{", "File", "path", "=", "new", "File", "(", "directory", ",", "entry", ")", ";", "uris", ".", "add", "(", "path", ".", "toURI", "(", ")", ")", ";", "}", "}", "else", "if", "(", "\"gs\"", ".", "equals", "(", "absoluteUri", ".", "getScheme", "(", ")", ")", ")", "{", "GcsUtil", "gcsUtil", "=", "options", ".", "as", "(", "GcsOptions", ".", "class", ")", ".", "getGcsUtil", "(", ")", ";", "URI", "gcsUriGlob", "=", "new", "URI", "(", "absoluteUri", ".", "getScheme", "(", ")", ",", "absoluteUri", ".", "getAuthority", "(", ")", ",", "absoluteUri", ".", "getPath", "(", ")", "+", "\"*\"", ",", "absoluteUri", ".", "getQuery", "(", ")", ",", "absoluteUri", ".", "getFragment", "(", ")", ")", ";", "for", "(", "GcsPath", "entry", ":", "gcsUtil", ".", "expand", "(", "GcsPath", ".", "fromUri", "(", "gcsUriGlob", ")", ")", ")", "{", "uris", ".", "add", "(", "entry", ".", "toUri", "(", ")", ")", ";", "}", "}", "return", "uris", ";", "}" ]
Lists documents contained beneath the {@code options.input} prefix/directory.
[ "Lists", "documents", "contained", "beneath", "the", "{" ]
train
https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/complete/TfIdf.java#L104-L142
baratine/baratine
framework/src/main/java/com/caucho/v5/amp/remote/ServiceRefLinkFactory.java
ServiceRefLinkFactory.createLinkService
public ServiceRefAmp createLinkService(String path, PodRef podCaller) { """ Return the serviceRef for a foreign path and calling pod. @param path the service path on the foreign server @param podCaller the name of the calling pod. """ StubLink actorLink; String address = _scheme + "//" + _serviceRefOut.address() + path; ServiceRefAmp parentRef = _actorOut.getServiceRef(); if (_queryMapRef != null) { //String addressSelf = "/system"; //ServiceRefAmp systemRef = _manager.getSystemInbox().getServiceRef(); actorLink = new StubLinkUnidir(_manager, path, parentRef, _queryMapRef, podCaller, _actorOut); } else { actorLink = new StubLink(_manager, path, parentRef, podCaller, _actorOut); } ServiceRefAmp linkRef = _serviceRefOut.pin(actorLink, address); // ServiceRefClient needed to maintain workers, cloud/0420 ServiceRefAmp clientRef = new ServiceRefClient(address, linkRef.stub(), linkRef.inbox()); actorLink.initSelfRef(clientRef); return clientRef; }
java
public ServiceRefAmp createLinkService(String path, PodRef podCaller) { StubLink actorLink; String address = _scheme + "//" + _serviceRefOut.address() + path; ServiceRefAmp parentRef = _actorOut.getServiceRef(); if (_queryMapRef != null) { //String addressSelf = "/system"; //ServiceRefAmp systemRef = _manager.getSystemInbox().getServiceRef(); actorLink = new StubLinkUnidir(_manager, path, parentRef, _queryMapRef, podCaller, _actorOut); } else { actorLink = new StubLink(_manager, path, parentRef, podCaller, _actorOut); } ServiceRefAmp linkRef = _serviceRefOut.pin(actorLink, address); // ServiceRefClient needed to maintain workers, cloud/0420 ServiceRefAmp clientRef = new ServiceRefClient(address, linkRef.stub(), linkRef.inbox()); actorLink.initSelfRef(clientRef); return clientRef; }
[ "public", "ServiceRefAmp", "createLinkService", "(", "String", "path", ",", "PodRef", "podCaller", ")", "{", "StubLink", "actorLink", ";", "String", "address", "=", "_scheme", "+", "\"//\"", "+", "_serviceRefOut", ".", "address", "(", ")", "+", "path", ";", "ServiceRefAmp", "parentRef", "=", "_actorOut", ".", "getServiceRef", "(", ")", ";", "if", "(", "_queryMapRef", "!=", "null", ")", "{", "//String addressSelf = \"/system\";", "//ServiceRefAmp systemRef = _manager.getSystemInbox().getServiceRef();", "actorLink", "=", "new", "StubLinkUnidir", "(", "_manager", ",", "path", ",", "parentRef", ",", "_queryMapRef", ",", "podCaller", ",", "_actorOut", ")", ";", "}", "else", "{", "actorLink", "=", "new", "StubLink", "(", "_manager", ",", "path", ",", "parentRef", ",", "podCaller", ",", "_actorOut", ")", ";", "}", "ServiceRefAmp", "linkRef", "=", "_serviceRefOut", ".", "pin", "(", "actorLink", ",", "address", ")", ";", "// ServiceRefClient needed to maintain workers, cloud/0420", "ServiceRefAmp", "clientRef", "=", "new", "ServiceRefClient", "(", "address", ",", "linkRef", ".", "stub", "(", ")", ",", "linkRef", ".", "inbox", "(", ")", ")", ";", "actorLink", ".", "initSelfRef", "(", "clientRef", ")", ";", "return", "clientRef", ";", "}" ]
Return the serviceRef for a foreign path and calling pod. @param path the service path on the foreign server @param podCaller the name of the calling pod.
[ "Return", "the", "serviceRef", "for", "a", "foreign", "path", "and", "calling", "pod", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/amp/remote/ServiceRefLinkFactory.java#L86-L115
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java
ApiOvhHostingweb.serviceName_database_name_statistics_GET
public ArrayList<OvhChartSerie<OvhChartTimestampValue>> serviceName_database_name_statistics_GET(String serviceName, String name, OvhStatisticsPeriodEnum period, net.minidev.ovh.api.hosting.web.database.OvhStatisticsTypeEnum type) throws IOException { """ Get statistics about this database REST: GET /hosting/web/{serviceName}/database/{name}/statistics @param type [required] Types of statistics available for the database @param period [required] Available periods for statistics @param serviceName [required] The internal name of your hosting @param name [required] Database name (like mydb.mysql.db or mydb.postgres.db) """ String qPath = "/hosting/web/{serviceName}/database/{name}/statistics"; StringBuilder sb = path(qPath, serviceName, name); query(sb, "period", period); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t6); }
java
public ArrayList<OvhChartSerie<OvhChartTimestampValue>> serviceName_database_name_statistics_GET(String serviceName, String name, OvhStatisticsPeriodEnum period, net.minidev.ovh.api.hosting.web.database.OvhStatisticsTypeEnum type) throws IOException { String qPath = "/hosting/web/{serviceName}/database/{name}/statistics"; StringBuilder sb = path(qPath, serviceName, name); query(sb, "period", period); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t6); }
[ "public", "ArrayList", "<", "OvhChartSerie", "<", "OvhChartTimestampValue", ">", ">", "serviceName_database_name_statistics_GET", "(", "String", "serviceName", ",", "String", "name", ",", "OvhStatisticsPeriodEnum", "period", ",", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "hosting", ".", "web", ".", "database", ".", "OvhStatisticsTypeEnum", "type", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/hosting/web/{serviceName}/database/{name}/statistics\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "name", ")", ";", "query", "(", "sb", ",", "\"period\"", ",", "period", ")", ";", "query", "(", "sb", ",", "\"type\"", ",", "type", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t6", ")", ";", "}" ]
Get statistics about this database REST: GET /hosting/web/{serviceName}/database/{name}/statistics @param type [required] Types of statistics available for the database @param period [required] Available periods for statistics @param serviceName [required] The internal name of your hosting @param name [required] Database name (like mydb.mysql.db or mydb.postgres.db)
[ "Get", "statistics", "about", "this", "database" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L1312-L1319
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java
TeaToolsUtils.createPatternString
public String createPatternString(String pattern, int length) { """ Creates a String with the specified pattern repeated length times. """ if (pattern == null) { return null; } int totalLength = pattern.length() * length; StringBuffer sb = new StringBuffer(totalLength); for (int i = 0; i < length; i++) { sb.append(pattern); } return sb.toString(); }
java
public String createPatternString(String pattern, int length) { if (pattern == null) { return null; } int totalLength = pattern.length() * length; StringBuffer sb = new StringBuffer(totalLength); for (int i = 0; i < length; i++) { sb.append(pattern); } return sb.toString(); }
[ "public", "String", "createPatternString", "(", "String", "pattern", ",", "int", "length", ")", "{", "if", "(", "pattern", "==", "null", ")", "{", "return", "null", ";", "}", "int", "totalLength", "=", "pattern", ".", "length", "(", ")", "*", "length", ";", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", "totalLength", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "sb", ".", "append", "(", "pattern", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Creates a String with the specified pattern repeated length times.
[ "Creates", "a", "String", "with", "the", "specified", "pattern", "repeated", "length", "times", "." ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L693-L704
google/closure-compiler
src/com/google/javascript/rhino/jstype/JSTypeRegistry.java
JSTypeRegistry.createOptionalNullableType
public JSType createOptionalNullableType(JSType type) { """ Creates a nullable and undefine-able value of the given type. @return The union of the type and null and undefined. """ return createUnionType(type, getNativeType(JSTypeNative.VOID_TYPE), getNativeType(JSTypeNative.NULL_TYPE)); }
java
public JSType createOptionalNullableType(JSType type) { return createUnionType(type, getNativeType(JSTypeNative.VOID_TYPE), getNativeType(JSTypeNative.NULL_TYPE)); }
[ "public", "JSType", "createOptionalNullableType", "(", "JSType", "type", ")", "{", "return", "createUnionType", "(", "type", ",", "getNativeType", "(", "JSTypeNative", ".", "VOID_TYPE", ")", ",", "getNativeType", "(", "JSTypeNative", ".", "NULL_TYPE", ")", ")", ";", "}" ]
Creates a nullable and undefine-able value of the given type. @return The union of the type and null and undefined.
[ "Creates", "a", "nullable", "and", "undefine", "-", "able", "value", "of", "the", "given", "type", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1510-L1513
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
FSNamesystem.setReplication
public boolean setReplication(String src, short replication) throws IOException { """ Set replication for an existing file. <p/> The NameNode sets new replication and schedules either replication of under-replicated data blocks or removal of the eccessive block copies if the blocks are over-replicated. @param src file name @param replication new replication @return true if successful; false if file does not exist or is a directory @see ClientProtocol#setReplication(String, short) """ boolean status = setReplicationInternal(src, replication); getEditLog().logSync(false); if (status && auditLog.isInfoEnabled()) { logAuditEvent(getCurrentUGI(), Server.getRemoteIp(), "setReplication", src, null, null); } return status; }
java
public boolean setReplication(String src, short replication) throws IOException { boolean status = setReplicationInternal(src, replication); getEditLog().logSync(false); if (status && auditLog.isInfoEnabled()) { logAuditEvent(getCurrentUGI(), Server.getRemoteIp(), "setReplication", src, null, null); } return status; }
[ "public", "boolean", "setReplication", "(", "String", "src", ",", "short", "replication", ")", "throws", "IOException", "{", "boolean", "status", "=", "setReplicationInternal", "(", "src", ",", "replication", ")", ";", "getEditLog", "(", ")", ".", "logSync", "(", "false", ")", ";", "if", "(", "status", "&&", "auditLog", ".", "isInfoEnabled", "(", ")", ")", "{", "logAuditEvent", "(", "getCurrentUGI", "(", ")", ",", "Server", ".", "getRemoteIp", "(", ")", ",", "\"setReplication\"", ",", "src", ",", "null", ",", "null", ")", ";", "}", "return", "status", ";", "}" ]
Set replication for an existing file. <p/> The NameNode sets new replication and schedules either replication of under-replicated data blocks or removal of the eccessive block copies if the blocks are over-replicated. @param src file name @param replication new replication @return true if successful; false if file does not exist or is a directory @see ClientProtocol#setReplication(String, short)
[ "Set", "replication", "for", "an", "existing", "file", ".", "<p", "/", ">", "The", "NameNode", "sets", "new", "replication", "and", "schedules", "either", "replication", "of", "under", "-", "replicated", "data", "blocks", "or", "removal", "of", "the", "eccessive", "block", "copies", "if", "the", "blocks", "are", "over", "-", "replicated", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L1950-L1960
primefaces-extensions/core
src/main/java/org/primefaces/extensions/util/JavascriptVarBuilder.java
JavascriptVarBuilder.appendProperty
public JavascriptVarBuilder appendProperty(final String propertyName, final String propertyValue, final boolean quoted) { """ Appends an Object name/value pair to the object. @param propertyName the property name @param propertyValue the property value @param quoted if true, the value is quoted and escaped. @return this builder """ next(); sb.append(propertyName); sb.append(":"); appendText(propertyValue, quoted); return this; }
java
public JavascriptVarBuilder appendProperty(final String propertyName, final String propertyValue, final boolean quoted) { next(); sb.append(propertyName); sb.append(":"); appendText(propertyValue, quoted); return this; }
[ "public", "JavascriptVarBuilder", "appendProperty", "(", "final", "String", "propertyName", ",", "final", "String", "propertyValue", ",", "final", "boolean", "quoted", ")", "{", "next", "(", ")", ";", "sb", ".", "append", "(", "propertyName", ")", ";", "sb", ".", "append", "(", "\":\"", ")", ";", "appendText", "(", "propertyValue", ",", "quoted", ")", ";", "return", "this", ";", "}" ]
Appends an Object name/value pair to the object. @param propertyName the property name @param propertyValue the property value @param quoted if true, the value is quoted and escaped. @return this builder
[ "Appends", "an", "Object", "name", "/", "value", "pair", "to", "the", "object", "." ]
train
https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/util/JavascriptVarBuilder.java#L78-L84
demidenko05/beigesoft-accounting
src/main/java/org/beigesoft/accounting/service/SrvBalanceStd.java
SrvBalanceStd.evalDateNextPeriodStart
public final synchronized Date evalDateNextPeriodStart( final Map<String, Object> pAddParam, final Date pDateFor) throws Exception { """ <p>Evaluate date start of next balance store period. Tested in beige-common org.beigesoft.test.CalendarTest.</p> @param pAddParam additional param @param pDateFor date for @return Start of next period nearest to pDateFor @throws Exception - an exception """ EPeriod period = evalBalanceStorePeriod(pAddParam); if (!(period.equals(EPeriod.MONTHLY) || period.equals(EPeriod.WEEKLY) || period.equals(EPeriod.DAILY))) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "stored_balance_period_must_be_dwm"); } Calendar cal = Calendar.getInstance(new Locale("en", "US")); cal.setTime(pDateFor); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); if (period.equals(EPeriod.DAILY)) { cal.add(Calendar.DATE, 1); } else if (period.equals(EPeriod.MONTHLY)) { cal.add(Calendar.MONTH, 1); cal.set(Calendar.DAY_OF_MONTH, 1); } else if (period.equals(EPeriod.WEEKLY)) { cal.add(Calendar.DAY_OF_YEAR, 7); cal.set(Calendar.DAY_OF_WEEK, 1); } return cal.getTime(); }
java
public final synchronized Date evalDateNextPeriodStart( final Map<String, Object> pAddParam, final Date pDateFor) throws Exception { EPeriod period = evalBalanceStorePeriod(pAddParam); if (!(period.equals(EPeriod.MONTHLY) || period.equals(EPeriod.WEEKLY) || period.equals(EPeriod.DAILY))) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "stored_balance_period_must_be_dwm"); } Calendar cal = Calendar.getInstance(new Locale("en", "US")); cal.setTime(pDateFor); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); if (period.equals(EPeriod.DAILY)) { cal.add(Calendar.DATE, 1); } else if (period.equals(EPeriod.MONTHLY)) { cal.add(Calendar.MONTH, 1); cal.set(Calendar.DAY_OF_MONTH, 1); } else if (period.equals(EPeriod.WEEKLY)) { cal.add(Calendar.DAY_OF_YEAR, 7); cal.set(Calendar.DAY_OF_WEEK, 1); } return cal.getTime(); }
[ "public", "final", "synchronized", "Date", "evalDateNextPeriodStart", "(", "final", "Map", "<", "String", ",", "Object", ">", "pAddParam", ",", "final", "Date", "pDateFor", ")", "throws", "Exception", "{", "EPeriod", "period", "=", "evalBalanceStorePeriod", "(", "pAddParam", ")", ";", "if", "(", "!", "(", "period", ".", "equals", "(", "EPeriod", ".", "MONTHLY", ")", "||", "period", ".", "equals", "(", "EPeriod", ".", "WEEKLY", ")", "||", "period", ".", "equals", "(", "EPeriod", ".", "DAILY", ")", ")", ")", "{", "throw", "new", "ExceptionWithCode", "(", "ExceptionWithCode", ".", "WRONG_PARAMETER", ",", "\"stored_balance_period_must_be_dwm\"", ")", ";", "}", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", "new", "Locale", "(", "\"en\"", ",", "\"US\"", ")", ")", ";", "cal", ".", "setTime", "(", "pDateFor", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "HOUR_OF_DAY", ",", "0", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "MINUTE", ",", "0", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "SECOND", ",", "0", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "MILLISECOND", ",", "0", ")", ";", "if", "(", "period", ".", "equals", "(", "EPeriod", ".", "DAILY", ")", ")", "{", "cal", ".", "add", "(", "Calendar", ".", "DATE", ",", "1", ")", ";", "}", "else", "if", "(", "period", ".", "equals", "(", "EPeriod", ".", "MONTHLY", ")", ")", "{", "cal", ".", "add", "(", "Calendar", ".", "MONTH", ",", "1", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "1", ")", ";", "}", "else", "if", "(", "period", ".", "equals", "(", "EPeriod", ".", "WEEKLY", ")", ")", "{", "cal", ".", "add", "(", "Calendar", ".", "DAY_OF_YEAR", ",", "7", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "DAY_OF_WEEK", ",", "1", ")", ";", "}", "return", "cal", ".", "getTime", "(", ")", ";", "}" ]
<p>Evaluate date start of next balance store period. Tested in beige-common org.beigesoft.test.CalendarTest.</p> @param pAddParam additional param @param pDateFor date for @return Start of next period nearest to pDateFor @throws Exception - an exception
[ "<p", ">", "Evaluate", "date", "start", "of", "next", "balance", "store", "period", ".", "Tested", "in", "beige", "-", "common", "org", ".", "beigesoft", ".", "test", ".", "CalendarTest", ".", "<", "/", "p", ">" ]
train
https://github.com/demidenko05/beigesoft-accounting/blob/e6f423949008218ddd05953b078f1ea8805095c1/src/main/java/org/beigesoft/accounting/service/SrvBalanceStd.java#L763-L789
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierApplications.java
TypeQualifierApplications.getEffectiveTypeQualifierAnnotation
public static @CheckForNull TypeQualifierAnnotation getEffectiveTypeQualifierAnnotation(final XMethod xmethod, final int parameter, TypeQualifierValue<?> typeQualifierValue) { """ Get the effective TypeQualifierAnnotation on given method parameter. Takes into account inherited and default (outer scope) annotations. Also takes exclusive qualifiers into account. @param xmethod a method @param parameter a parameter (0 == first parameter) @param typeQualifierValue the kind of TypeQualifierValue we are looking for @return effective TypeQualifierAnnotation on the parameter, or null if there is no effective TypeQualifierAnnotation """ TypeQualifierAnnotation tqa = computeEffectiveTypeQualifierAnnotation(typeQualifierValue, xmethod, parameter); if (CHECK_EXCLUSIVE && tqa == null && typeQualifierValue.isExclusiveQualifier()) { tqa = computeExclusiveQualifier(typeQualifierValue, new ComputeEffectiveTypeQualifierAnnotation() { @Override public TypeQualifierAnnotation compute(TypeQualifierValue<?> tqv) { return computeEffectiveTypeQualifierAnnotation(tqv, xmethod, parameter); } @Override public String toString() { return "parameter " + parameter + " of " + xmethod; } }); } return tqa; }
java
public static @CheckForNull TypeQualifierAnnotation getEffectiveTypeQualifierAnnotation(final XMethod xmethod, final int parameter, TypeQualifierValue<?> typeQualifierValue) { TypeQualifierAnnotation tqa = computeEffectiveTypeQualifierAnnotation(typeQualifierValue, xmethod, parameter); if (CHECK_EXCLUSIVE && tqa == null && typeQualifierValue.isExclusiveQualifier()) { tqa = computeExclusiveQualifier(typeQualifierValue, new ComputeEffectiveTypeQualifierAnnotation() { @Override public TypeQualifierAnnotation compute(TypeQualifierValue<?> tqv) { return computeEffectiveTypeQualifierAnnotation(tqv, xmethod, parameter); } @Override public String toString() { return "parameter " + parameter + " of " + xmethod; } }); } return tqa; }
[ "public", "static", "@", "CheckForNull", "TypeQualifierAnnotation", "getEffectiveTypeQualifierAnnotation", "(", "final", "XMethod", "xmethod", ",", "final", "int", "parameter", ",", "TypeQualifierValue", "<", "?", ">", "typeQualifierValue", ")", "{", "TypeQualifierAnnotation", "tqa", "=", "computeEffectiveTypeQualifierAnnotation", "(", "typeQualifierValue", ",", "xmethod", ",", "parameter", ")", ";", "if", "(", "CHECK_EXCLUSIVE", "&&", "tqa", "==", "null", "&&", "typeQualifierValue", ".", "isExclusiveQualifier", "(", ")", ")", "{", "tqa", "=", "computeExclusiveQualifier", "(", "typeQualifierValue", ",", "new", "ComputeEffectiveTypeQualifierAnnotation", "(", ")", "{", "@", "Override", "public", "TypeQualifierAnnotation", "compute", "(", "TypeQualifierValue", "<", "?", ">", "tqv", ")", "{", "return", "computeEffectiveTypeQualifierAnnotation", "(", "tqv", ",", "xmethod", ",", "parameter", ")", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "\"parameter \"", "+", "parameter", "+", "\" of \"", "+", "xmethod", ";", "}", "}", ")", ";", "}", "return", "tqa", ";", "}" ]
Get the effective TypeQualifierAnnotation on given method parameter. Takes into account inherited and default (outer scope) annotations. Also takes exclusive qualifiers into account. @param xmethod a method @param parameter a parameter (0 == first parameter) @param typeQualifierValue the kind of TypeQualifierValue we are looking for @return effective TypeQualifierAnnotation on the parameter, or null if there is no effective TypeQualifierAnnotation
[ "Get", "the", "effective", "TypeQualifierAnnotation", "on", "given", "method", "parameter", ".", "Takes", "into", "account", "inherited", "and", "default", "(", "outer", "scope", ")", "annotations", ".", "Also", "takes", "exclusive", "qualifiers", "into", "account", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierApplications.java#L763-L784
roboconf/roboconf-platform
miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/autocompletion/CompletionUtils.java
CompletionUtils.basicProposal
public static RoboconfCompletionProposal basicProposal( String s, String lastWord ) { """ A convenience method to shorten the creation of a basic proposal. <p> Equivalent to <code>basicProposal( s, lastWord, false )</code>. </p> @param s @param lastWord @return a non-null proposal """ return basicProposal( s, lastWord, false ); }
java
public static RoboconfCompletionProposal basicProposal( String s, String lastWord ) { return basicProposal( s, lastWord, false ); }
[ "public", "static", "RoboconfCompletionProposal", "basicProposal", "(", "String", "s", ",", "String", "lastWord", ")", "{", "return", "basicProposal", "(", "s", ",", "lastWord", ",", "false", ")", ";", "}" ]
A convenience method to shorten the creation of a basic proposal. <p> Equivalent to <code>basicProposal( s, lastWord, false )</code>. </p> @param s @param lastWord @return a non-null proposal
[ "A", "convenience", "method", "to", "shorten", "the", "creation", "of", "a", "basic", "proposal", ".", "<p", ">", "Equivalent", "to", "<code", ">", "basicProposal", "(", "s", "lastWord", "false", ")", "<", "/", "code", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/autocompletion/CompletionUtils.java#L161-L163
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/ConfigReader.java
ConfigReader.getValue
private String getValue(final String value, final String mappedFieldName) { """ This method compare the name of the target field with the DEFAULT_FIELD_VALUE and returns the final value. @param value configuration parameter @param mappedFieldName name of the configured field @return the name of target field @see Constants#DEFAULT_FIELD_VALUE """ if (isNull(value)) return null; return value.equals(DEFAULT_FIELD_VALUE)?mappedFieldName:value; }
java
private String getValue(final String value, final String mappedFieldName) { if (isNull(value)) return null; return value.equals(DEFAULT_FIELD_VALUE)?mappedFieldName:value; }
[ "private", "String", "getValue", "(", "final", "String", "value", ",", "final", "String", "mappedFieldName", ")", "{", "if", "(", "isNull", "(", "value", ")", ")", "return", "null", ";", "return", "value", ".", "equals", "(", "DEFAULT_FIELD_VALUE", ")", "?", "mappedFieldName", ":", "value", ";", "}" ]
This method compare the name of the target field with the DEFAULT_FIELD_VALUE and returns the final value. @param value configuration parameter @param mappedFieldName name of the configured field @return the name of target field @see Constants#DEFAULT_FIELD_VALUE
[ "This", "method", "compare", "the", "name", "of", "the", "target", "field", "with", "the", "DEFAULT_FIELD_VALUE", "and", "returns", "the", "final", "value", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/ConfigReader.java#L70-L75
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/db/GeoPackageCoreConnection.java
GeoPackageCoreConnection.querySingleRowResults
public List<Object> querySingleRowResults(String sql, String[] args) { """ Query for values in a single (first) row @param sql sql statement @param args arguments @return single row results @since 3.1.0 """ return querySingleRowResults(sql, args, null); }
java
public List<Object> querySingleRowResults(String sql, String[] args) { return querySingleRowResults(sql, args, null); }
[ "public", "List", "<", "Object", ">", "querySingleRowResults", "(", "String", "sql", ",", "String", "[", "]", "args", ")", "{", "return", "querySingleRowResults", "(", "sql", ",", "args", ",", "null", ")", ";", "}" ]
Query for values in a single (first) row @param sql sql statement @param args arguments @return single row results @since 3.1.0
[ "Query", "for", "values", "in", "a", "single", "(", "first", ")", "row" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/db/GeoPackageCoreConnection.java#L634-L636
auth0/Auth0.Android
auth0/src/main/java/com/auth0/android/authentication/ParameterBuilder.java
ParameterBuilder.addAll
public ParameterBuilder addAll(Map<String, Object> parameters) { """ Adds all parameter from a map @param parameters map with parameters to add. Null values will be skipped. @return itself """ if (parameters != null) { for (String k : parameters.keySet()) { if (parameters.get(k) != null) { this.parameters.put(k, parameters.get(k)); } } } return this; }
java
public ParameterBuilder addAll(Map<String, Object> parameters) { if (parameters != null) { for (String k : parameters.keySet()) { if (parameters.get(k) != null) { this.parameters.put(k, parameters.get(k)); } } } return this; }
[ "public", "ParameterBuilder", "addAll", "(", "Map", "<", "String", ",", "Object", ">", "parameters", ")", "{", "if", "(", "parameters", "!=", "null", ")", "{", "for", "(", "String", "k", ":", "parameters", ".", "keySet", "(", ")", ")", "{", "if", "(", "parameters", ".", "get", "(", "k", ")", "!=", "null", ")", "{", "this", ".", "parameters", ".", "put", "(", "k", ",", "parameters", ".", "get", "(", "k", ")", ")", ";", "}", "}", "}", "return", "this", ";", "}" ]
Adds all parameter from a map @param parameters map with parameters to add. Null values will be skipped. @return itself
[ "Adds", "all", "parameter", "from", "a", "map" ]
train
https://github.com/auth0/Auth0.Android/blob/ee37b7f94d989c1fbab2cb1378c87fdcaf7a8156/auth0/src/main/java/com/auth0/android/authentication/ParameterBuilder.java#L202-L211
javalite/activeweb
javalite-async/src/main/java/org/javalite/async/Async.java
Async.receiveCommand
public Command receiveCommand(String queueName, long timeout) { """ Receives a command from a queue synchronously. If this queue also has listeners, then commands will be distributed across all consumers. @param queueName name of queue @param timeout timeout in milliseconds. If a command is not received during a timeout, this methods returns null. @return command if found. If command not found, this method will block till a command is present in queue or a timeout expires. """ try { Message message = receiveMessage(queueName, timeout); if(message == null){ return null; }else{ Command command; if(binaryMode){ command = Command.fromBytes(getBytes((BytesMessage) message)); }else { command = Command.fromXml(((TextMessage)message).getText()); } command.setJMSMessageID(message.getJMSMessageID()); return command; } } catch (Exception e) { throw new AsyncException("Could not get command", e); } }
java
public Command receiveCommand(String queueName, long timeout) { try { Message message = receiveMessage(queueName, timeout); if(message == null){ return null; }else{ Command command; if(binaryMode){ command = Command.fromBytes(getBytes((BytesMessage) message)); }else { command = Command.fromXml(((TextMessage)message).getText()); } command.setJMSMessageID(message.getJMSMessageID()); return command; } } catch (Exception e) { throw new AsyncException("Could not get command", e); } }
[ "public", "Command", "receiveCommand", "(", "String", "queueName", ",", "long", "timeout", ")", "{", "try", "{", "Message", "message", "=", "receiveMessage", "(", "queueName", ",", "timeout", ")", ";", "if", "(", "message", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "Command", "command", ";", "if", "(", "binaryMode", ")", "{", "command", "=", "Command", ".", "fromBytes", "(", "getBytes", "(", "(", "BytesMessage", ")", "message", ")", ")", ";", "}", "else", "{", "command", "=", "Command", ".", "fromXml", "(", "(", "(", "TextMessage", ")", "message", ")", ".", "getText", "(", ")", ")", ";", "}", "command", ".", "setJMSMessageID", "(", "message", ".", "getJMSMessageID", "(", ")", ")", ";", "return", "command", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "AsyncException", "(", "\"Could not get command\"", ",", "e", ")", ";", "}", "}" ]
Receives a command from a queue synchronously. If this queue also has listeners, then commands will be distributed across all consumers. @param queueName name of queue @param timeout timeout in milliseconds. If a command is not received during a timeout, this methods returns null. @return command if found. If command not found, this method will block till a command is present in queue or a timeout expires.
[ "Receives", "a", "command", "from", "a", "queue", "synchronously", ".", "If", "this", "queue", "also", "has", "listeners", "then", "commands", "will", "be", "distributed", "across", "all", "consumers", "." ]
train
https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/javalite-async/src/main/java/org/javalite/async/Async.java#L433-L452
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/dynamic/support/ResolvableType.java
ResolvableType.forMethodReturnType
public static ResolvableType forMethodReturnType(Method method, Class<?> implementationClass) { """ Return a {@link ResolvableType} for the specified {@link Method} return type. Use this variant when the class that declares the method includes generic parameter variables that are satisfied by the implementation class. @param method the source for the method return type @param implementationClass the implementation class @return a {@link ResolvableType} for the specified method return @see #forMethodReturnType(Method) """ LettuceAssert.notNull(method, "Method must not be null"); MethodParameter methodParameter = new MethodParameter(method, -1); methodParameter.setContainingClass(implementationClass); return forMethodParameter(methodParameter); }
java
public static ResolvableType forMethodReturnType(Method method, Class<?> implementationClass) { LettuceAssert.notNull(method, "Method must not be null"); MethodParameter methodParameter = new MethodParameter(method, -1); methodParameter.setContainingClass(implementationClass); return forMethodParameter(methodParameter); }
[ "public", "static", "ResolvableType", "forMethodReturnType", "(", "Method", "method", ",", "Class", "<", "?", ">", "implementationClass", ")", "{", "LettuceAssert", ".", "notNull", "(", "method", ",", "\"Method must not be null\"", ")", ";", "MethodParameter", "methodParameter", "=", "new", "MethodParameter", "(", "method", ",", "-", "1", ")", ";", "methodParameter", ".", "setContainingClass", "(", "implementationClass", ")", ";", "return", "forMethodParameter", "(", "methodParameter", ")", ";", "}" ]
Return a {@link ResolvableType} for the specified {@link Method} return type. Use this variant when the class that declares the method includes generic parameter variables that are satisfied by the implementation class. @param method the source for the method return type @param implementationClass the implementation class @return a {@link ResolvableType} for the specified method return @see #forMethodReturnType(Method)
[ "Return", "a", "{", "@link", "ResolvableType", "}", "for", "the", "specified", "{", "@link", "Method", "}", "return", "type", ".", "Use", "this", "variant", "when", "the", "class", "that", "declares", "the", "method", "includes", "generic", "parameter", "variables", "that", "are", "satisfied", "by", "the", "implementation", "class", "." ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/dynamic/support/ResolvableType.java#L933-L938
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/trees/EnglishGrammaticalRelations.java
EnglishGrammaticalRelations.getPrepC
public static GrammaticalRelation getPrepC(String prepositionString) { """ The "prepc" grammatical relation. Used to collapse preposition complements.<p> They will be turned into prep_word, where "word" is a preposition NOTE: Because these relations lack associated GrammaticalRelationAnnotations, they cannot be arcs of a TreeGraphNode. @param prepositionString The preposition to make a GrammaticalRelation out of @return A grammatical relation for this preposition """ GrammaticalRelation result = prepsC.get(prepositionString); if (result == null) { synchronized(prepsC) { result = prepsC.get(prepositionString); if (result == null) { result = new GrammaticalRelation(Language.English, "prepc", "prepc_collapsed", null, DEPENDENT, prepositionString); prepsC.put(prepositionString, result); threadSafeAddRelation(result); } } } return result; }
java
public static GrammaticalRelation getPrepC(String prepositionString) { GrammaticalRelation result = prepsC.get(prepositionString); if (result == null) { synchronized(prepsC) { result = prepsC.get(prepositionString); if (result == null) { result = new GrammaticalRelation(Language.English, "prepc", "prepc_collapsed", null, DEPENDENT, prepositionString); prepsC.put(prepositionString, result); threadSafeAddRelation(result); } } } return result; }
[ "public", "static", "GrammaticalRelation", "getPrepC", "(", "String", "prepositionString", ")", "{", "GrammaticalRelation", "result", "=", "prepsC", ".", "get", "(", "prepositionString", ")", ";", "if", "(", "result", "==", "null", ")", "{", "synchronized", "(", "prepsC", ")", "{", "result", "=", "prepsC", ".", "get", "(", "prepositionString", ")", ";", "if", "(", "result", "==", "null", ")", "{", "result", "=", "new", "GrammaticalRelation", "(", "Language", ".", "English", ",", "\"prepc\"", ",", "\"prepc_collapsed\"", ",", "null", ",", "DEPENDENT", ",", "prepositionString", ")", ";", "prepsC", ".", "put", "(", "prepositionString", ",", "result", ")", ";", "threadSafeAddRelation", "(", "result", ")", ";", "}", "}", "}", "return", "result", ";", "}" ]
The "prepc" grammatical relation. Used to collapse preposition complements.<p> They will be turned into prep_word, where "word" is a preposition NOTE: Because these relations lack associated GrammaticalRelationAnnotations, they cannot be arcs of a TreeGraphNode. @param prepositionString The preposition to make a GrammaticalRelation out of @return A grammatical relation for this preposition
[ "The", "prepc", "grammatical", "relation", ".", "Used", "to", "collapse", "preposition", "complements", ".", "<p", ">", "They", "will", "be", "turned", "into", "prep_word", "where", "word", "is", "a", "preposition" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/EnglishGrammaticalRelations.java#L1655-L1668
Falydoor/limesurvey-rc
src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java
LimesurveyRC.getParticipantProperties
public Map<String, String> getParticipantProperties(int surveyId, String token, List<String> tokenProperties) throws LimesurveyRCException { """ Gets participant properties. @param surveyId the survey id of the participant's survey @param token the token of the participant @param tokenProperties the token properties @return the participant properties @throws LimesurveyRCException the limesurvey rc exception """ LsApiBody.LsApiParams params = getParamsWithKey(surveyId); Map<String, String> queryProperties = new HashMap<>(); queryProperties.put("token", token); params.setTokenQueryProperties(queryProperties); params.setTokenProperties(tokenProperties); return gson.fromJson(callRC(new LsApiBody("get_participant_properties", params)), new TypeToken<Map<String, String>>() { }.getType()); }
java
public Map<String, String> getParticipantProperties(int surveyId, String token, List<String> tokenProperties) throws LimesurveyRCException { LsApiBody.LsApiParams params = getParamsWithKey(surveyId); Map<String, String> queryProperties = new HashMap<>(); queryProperties.put("token", token); params.setTokenQueryProperties(queryProperties); params.setTokenProperties(tokenProperties); return gson.fromJson(callRC(new LsApiBody("get_participant_properties", params)), new TypeToken<Map<String, String>>() { }.getType()); }
[ "public", "Map", "<", "String", ",", "String", ">", "getParticipantProperties", "(", "int", "surveyId", ",", "String", "token", ",", "List", "<", "String", ">", "tokenProperties", ")", "throws", "LimesurveyRCException", "{", "LsApiBody", ".", "LsApiParams", "params", "=", "getParamsWithKey", "(", "surveyId", ")", ";", "Map", "<", "String", ",", "String", ">", "queryProperties", "=", "new", "HashMap", "<>", "(", ")", ";", "queryProperties", ".", "put", "(", "\"token\"", ",", "token", ")", ";", "params", ".", "setTokenQueryProperties", "(", "queryProperties", ")", ";", "params", ".", "setTokenProperties", "(", "tokenProperties", ")", ";", "return", "gson", ".", "fromJson", "(", "callRC", "(", "new", "LsApiBody", "(", "\"get_participant_properties\"", ",", "params", ")", ")", ",", "new", "TypeToken", "<", "Map", "<", "String", ",", "String", ">", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ")", ";", "}" ]
Gets participant properties. @param surveyId the survey id of the participant's survey @param token the token of the participant @param tokenProperties the token properties @return the participant properties @throws LimesurveyRCException the limesurvey rc exception
[ "Gets", "participant", "properties", "." ]
train
https://github.com/Falydoor/limesurvey-rc/blob/b8d573389086395e46a0bdeeddeef4d1c2c0a488/src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java#L384-L393
james-hu/jabb-core
src/main/java/net/sf/jabb/spring/rest/AbstractRestClient.java
AbstractRestClient.buildBasicAuthValue
protected String buildBasicAuthValue(String user, String password) { """ Build the value to be used in HTTP Basic Authentication header @param user the user name, may be null or empty @param password the password, may be null or empty @return the value to be used for header 'Authorization' """ StringBuilder sb = new StringBuilder(); if (StringUtils.isNotEmpty(user)){ sb.append(user); } if (StringUtils.isNotEmpty(password)){ if (sb.length() > 0){ sb.append(':'); } sb.append(password); } return buildBasicAuthValue(sb.toString()); }
java
protected String buildBasicAuthValue(String user, String password){ StringBuilder sb = new StringBuilder(); if (StringUtils.isNotEmpty(user)){ sb.append(user); } if (StringUtils.isNotEmpty(password)){ if (sb.length() > 0){ sb.append(':'); } sb.append(password); } return buildBasicAuthValue(sb.toString()); }
[ "protected", "String", "buildBasicAuthValue", "(", "String", "user", ",", "String", "password", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "StringUtils", ".", "isNotEmpty", "(", "user", ")", ")", "{", "sb", ".", "append", "(", "user", ")", ";", "}", "if", "(", "StringUtils", ".", "isNotEmpty", "(", "password", ")", ")", "{", "if", "(", "sb", ".", "length", "(", ")", ">", "0", ")", "{", "sb", ".", "append", "(", "'", "'", ")", ";", "}", "sb", ".", "append", "(", "password", ")", ";", "}", "return", "buildBasicAuthValue", "(", "sb", ".", "toString", "(", ")", ")", ";", "}" ]
Build the value to be used in HTTP Basic Authentication header @param user the user name, may be null or empty @param password the password, may be null or empty @return the value to be used for header 'Authorization'
[ "Build", "the", "value", "to", "be", "used", "in", "HTTP", "Basic", "Authentication", "header" ]
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/spring/rest/AbstractRestClient.java#L542-L554
f2prateek/dart
henson/src/main/java/dart/henson/Bundler.java
Bundler.putCharSequenceArrayList
public Bundler putCharSequenceArrayList(String key, ArrayList<CharSequence> value) { """ Inserts an ArrayList<CharSequence> value into the mapping of the underlying Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value an ArrayList<CharSequence> object, or null @return this bundler instance to chain method calls """ delegate.putCharSequenceArrayList(key, value); return this; }
java
public Bundler putCharSequenceArrayList(String key, ArrayList<CharSequence> value) { delegate.putCharSequenceArrayList(key, value); return this; }
[ "public", "Bundler", "putCharSequenceArrayList", "(", "String", "key", ",", "ArrayList", "<", "CharSequence", ">", "value", ")", "{", "delegate", ".", "putCharSequenceArrayList", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts an ArrayList<CharSequence> value into the mapping of the underlying Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value an ArrayList<CharSequence> object, or null @return this bundler instance to chain method calls
[ "Inserts", "an", "ArrayList<CharSequence", ">", "value", "into", "the", "mapping", "of", "the", "underlying", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", ".", "Either", "key", "or", "value", "may", "be", "null", "." ]
train
https://github.com/f2prateek/dart/blob/7163b1b148e5141817975ae7dad99d58a8589aeb/henson/src/main/java/dart/henson/Bundler.java#L309-L312
Azure/azure-sdk-for-java
kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/DatabasesInner.java
DatabasesInner.checkNameAvailabilityAsync
public Observable<CheckNameResultInner> checkNameAvailabilityAsync(String resourceGroupName, String clusterName, String name) { """ Checks that the database name is valid and is not already in use. @param resourceGroupName The name of the resource group containing the Kusto cluster. @param clusterName The name of the Kusto cluster. @param name Database name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the CheckNameResultInner object """ return checkNameAvailabilityWithServiceResponseAsync(resourceGroupName, clusterName, name).map(new Func1<ServiceResponse<CheckNameResultInner>, CheckNameResultInner>() { @Override public CheckNameResultInner call(ServiceResponse<CheckNameResultInner> response) { return response.body(); } }); }
java
public Observable<CheckNameResultInner> checkNameAvailabilityAsync(String resourceGroupName, String clusterName, String name) { return checkNameAvailabilityWithServiceResponseAsync(resourceGroupName, clusterName, name).map(new Func1<ServiceResponse<CheckNameResultInner>, CheckNameResultInner>() { @Override public CheckNameResultInner call(ServiceResponse<CheckNameResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "CheckNameResultInner", ">", "checkNameAvailabilityAsync", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "String", "name", ")", "{", "return", "checkNameAvailabilityWithServiceResponseAsync", "(", "resourceGroupName", ",", "clusterName", ",", "name", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "CheckNameResultInner", ">", ",", "CheckNameResultInner", ">", "(", ")", "{", "@", "Override", "public", "CheckNameResultInner", "call", "(", "ServiceResponse", "<", "CheckNameResultInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Checks that the database name is valid and is not already in use. @param resourceGroupName The name of the resource group containing the Kusto cluster. @param clusterName The name of the Kusto cluster. @param name Database name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the CheckNameResultInner object
[ "Checks", "that", "the", "database", "name", "is", "valid", "and", "is", "not", "already", "in", "use", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/DatabasesInner.java#L152-L159
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/io/FileSupport.java
FileSupport.getClassFileFromDirectoryInClassPath
public static File getClassFileFromDirectoryInClassPath(String className) { """ Tries to retrieve a class as File from all directories mentioned in system property java.class.path @param className class name as retrieved in myObject.getClass().getName() @return a File if the class file was found or null otherwise """ String fileName = StringSupport.replaceAll(className, ".", "/"); fileName += ".class"; return getFileFromDirectoryInClassPath(fileName, System.getProperty("java.class.path")); }
java
public static File getClassFileFromDirectoryInClassPath(String className) { String fileName = StringSupport.replaceAll(className, ".", "/"); fileName += ".class"; return getFileFromDirectoryInClassPath(fileName, System.getProperty("java.class.path")); }
[ "public", "static", "File", "getClassFileFromDirectoryInClassPath", "(", "String", "className", ")", "{", "String", "fileName", "=", "StringSupport", ".", "replaceAll", "(", "className", ",", "\".\"", ",", "\"/\"", ")", ";", "fileName", "+=", "\".class\"", ";", "return", "getFileFromDirectoryInClassPath", "(", "fileName", ",", "System", ".", "getProperty", "(", "\"java.class.path\"", ")", ")", ";", "}" ]
Tries to retrieve a class as File from all directories mentioned in system property java.class.path @param className class name as retrieved in myObject.getClass().getName() @return a File if the class file was found or null otherwise
[ "Tries", "to", "retrieve", "a", "class", "as", "File", "from", "all", "directories", "mentioned", "in", "system", "property", "java", ".", "class", ".", "path" ]
train
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/io/FileSupport.java#L207-L211
joniles/mpxj
src/main/java/net/sf/mpxj/json/JsonWriter.java
JsonWriter.writeIntegerField
private void writeIntegerField(String fieldName, Object value) throws IOException { """ Write an integer field to the JSON file. @param fieldName field name @param value field value """ int val = ((Number) value).intValue(); if (val != 0) { m_writer.writeNameValuePair(fieldName, val); } }
java
private void writeIntegerField(String fieldName, Object value) throws IOException { int val = ((Number) value).intValue(); if (val != 0) { m_writer.writeNameValuePair(fieldName, val); } }
[ "private", "void", "writeIntegerField", "(", "String", "fieldName", ",", "Object", "value", ")", "throws", "IOException", "{", "int", "val", "=", "(", "(", "Number", ")", "value", ")", ".", "intValue", "(", ")", ";", "if", "(", "val", "!=", "0", ")", "{", "m_writer", ".", "writeNameValuePair", "(", "fieldName", ",", "val", ")", ";", "}", "}" ]
Write an integer field to the JSON file. @param fieldName field name @param value field value
[ "Write", "an", "integer", "field", "to", "the", "JSON", "file", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonWriter.java#L370-L377
bozaro/git-lfs-java
gitlfs-client/src/main/java/ru/bozaro/gitlfs/client/Client.java
Client.postMeta
@Nullable public ObjectRes postMeta(@NotNull final Meta meta) throws IOException { """ Get metadata for object by hash. @param meta Object meta. @return Object metadata or null, if object not found. @throws IOException """ return doWork(auth -> doRequest(auth, new MetaPost(meta), AuthHelper.join(auth.getHref(), PATH_OBJECTS)), Operation.Upload); }
java
@Nullable public ObjectRes postMeta(@NotNull final Meta meta) throws IOException { return doWork(auth -> doRequest(auth, new MetaPost(meta), AuthHelper.join(auth.getHref(), PATH_OBJECTS)), Operation.Upload); }
[ "@", "Nullable", "public", "ObjectRes", "postMeta", "(", "@", "NotNull", "final", "Meta", "meta", ")", "throws", "IOException", "{", "return", "doWork", "(", "auth", "->", "doRequest", "(", "auth", ",", "new", "MetaPost", "(", "meta", ")", ",", "AuthHelper", ".", "join", "(", "auth", ".", "getHref", "(", ")", ",", "PATH_OBJECTS", ")", ")", ",", "Operation", ".", "Upload", ")", ";", "}" ]
Get metadata for object by hash. @param meta Object meta. @return Object metadata or null, if object not found. @throws IOException
[ "Get", "metadata", "for", "object", "by", "hash", "." ]
train
https://github.com/bozaro/git-lfs-java/blob/ee05bf0472ee61bf362cf93d283e5ee5d44ef685/gitlfs-client/src/main/java/ru/bozaro/gitlfs/client/Client.java#L104-L107
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java
MethodUtils.invokeMethod
public static Object invokeMethod(final Object object, final String methodName, Object... args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { """ <p>Invokes a named method whose parameter type matches the object type.</p> <p>This method delegates the method search to {@link #getMatchingAccessibleMethod(Class, String, Class[])}.</p> <p>This method supports calls to methods taking primitive parameters via passing in wrapping classes. So, for example, a {@code Boolean} object would match a {@code boolean} primitive.</p> <p>This is a convenient wrapper for {@link #invokeMethod(Object object,String methodName, Object[] args, Class[] parameterTypes)}. </p> @param object invoke method on this object @param methodName get method with this name @param args use these arguments - treat null as empty array @return The value returned by the invoked method @throws NoSuchMethodException if there is no such accessible method @throws InvocationTargetException wraps an exception thrown by the method invoked @throws IllegalAccessException if the requested method is not accessible via reflection """ args = ArrayUtils.nullToEmpty(args); final Class<?>[] parameterTypes = ClassUtils.toClass(args); return invokeMethod(object, methodName, args, parameterTypes); }
java
public static Object invokeMethod(final Object object, final String methodName, Object... args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { args = ArrayUtils.nullToEmpty(args); final Class<?>[] parameterTypes = ClassUtils.toClass(args); return invokeMethod(object, methodName, args, parameterTypes); }
[ "public", "static", "Object", "invokeMethod", "(", "final", "Object", "object", ",", "final", "String", "methodName", ",", "Object", "...", "args", ")", "throws", "NoSuchMethodException", ",", "IllegalAccessException", ",", "InvocationTargetException", "{", "args", "=", "ArrayUtils", ".", "nullToEmpty", "(", "args", ")", ";", "final", "Class", "<", "?", ">", "[", "]", "parameterTypes", "=", "ClassUtils", ".", "toClass", "(", "args", ")", ";", "return", "invokeMethod", "(", "object", ",", "methodName", ",", "args", ",", "parameterTypes", ")", ";", "}" ]
<p>Invokes a named method whose parameter type matches the object type.</p> <p>This method delegates the method search to {@link #getMatchingAccessibleMethod(Class, String, Class[])}.</p> <p>This method supports calls to methods taking primitive parameters via passing in wrapping classes. So, for example, a {@code Boolean} object would match a {@code boolean} primitive.</p> <p>This is a convenient wrapper for {@link #invokeMethod(Object object,String methodName, Object[] args, Class[] parameterTypes)}. </p> @param object invoke method on this object @param methodName get method with this name @param args use these arguments - treat null as empty array @return The value returned by the invoked method @throws NoSuchMethodException if there is no such accessible method @throws InvocationTargetException wraps an exception thrown by the method invoked @throws IllegalAccessException if the requested method is not accessible via reflection
[ "<p", ">", "Invokes", "a", "named", "method", "whose", "parameter", "type", "matches", "the", "object", "type", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java#L146-L152
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/module/messagecenter/view/ApptentiveAvatarView.java
ApptentiveAvatarView.scaleImage
private ImageScale scaleImage(int imageX, int imageY, int containerX, int containerY) { """ This scales the image so that it fits within the container. The container may have empty space at the ends, but the entire image will be displayed. """ ImageScale ret = new ImageScale(); // Compare aspects faster by multiplying out the divisors. if (imageX * containerY > imageY * containerX) { // Image aspect wider than container ret.scale = (float) containerX / imageX; ret.deltaY = ((float) containerY - (ret.scale * imageY)) / 2.0f; } else { // Image aspect taller than container ret.scale = (float) containerY / imageY; ret.deltaX = ((float) containerX - (ret.scale * imageX)) / 2.0f; } return ret; }
java
private ImageScale scaleImage(int imageX, int imageY, int containerX, int containerY) { ImageScale ret = new ImageScale(); // Compare aspects faster by multiplying out the divisors. if (imageX * containerY > imageY * containerX) { // Image aspect wider than container ret.scale = (float) containerX / imageX; ret.deltaY = ((float) containerY - (ret.scale * imageY)) / 2.0f; } else { // Image aspect taller than container ret.scale = (float) containerY / imageY; ret.deltaX = ((float) containerX - (ret.scale * imageX)) / 2.0f; } return ret; }
[ "private", "ImageScale", "scaleImage", "(", "int", "imageX", ",", "int", "imageY", ",", "int", "containerX", ",", "int", "containerY", ")", "{", "ImageScale", "ret", "=", "new", "ImageScale", "(", ")", ";", "// Compare aspects faster by multiplying out the divisors.", "if", "(", "imageX", "*", "containerY", ">", "imageY", "*", "containerX", ")", "{", "// Image aspect wider than container", "ret", ".", "scale", "=", "(", "float", ")", "containerX", "/", "imageX", ";", "ret", ".", "deltaY", "=", "(", "(", "float", ")", "containerY", "-", "(", "ret", ".", "scale", "*", "imageY", ")", ")", "/", "2.0f", ";", "}", "else", "{", "// Image aspect taller than container", "ret", ".", "scale", "=", "(", "float", ")", "containerY", "/", "imageY", ";", "ret", ".", "deltaX", "=", "(", "(", "float", ")", "containerX", "-", "(", "ret", ".", "scale", "*", "imageX", ")", ")", "/", "2.0f", ";", "}", "return", "ret", ";", "}" ]
This scales the image so that it fits within the container. The container may have empty space at the ends, but the entire image will be displayed.
[ "This", "scales", "the", "image", "so", "that", "it", "fits", "within", "the", "container", ".", "The", "container", "may", "have", "empty", "space", "at", "the", "ends", "but", "the", "entire", "image", "will", "be", "displayed", "." ]
train
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/module/messagecenter/view/ApptentiveAvatarView.java#L261-L274
xvik/guice-persist-orient
src/main/java/ru/vyarus/guice/persist/orient/db/PersistentContext.java
PersistentContext.doInTransaction
public <T> T doInTransaction(final TxConfig config, final TxAction<T> action) { """ Execute action within transaction. @param config transaction config (ignored in case of ongoing transaction) @param action action to execute within transaction (new or ongoing) @param <T> expected return type @return value produced by action @see ru.vyarus.guice.persist.orient.db.transaction.template.TxTemplate """ return txTemplate.doInTransaction(config, action); }
java
public <T> T doInTransaction(final TxConfig config, final TxAction<T> action) { return txTemplate.doInTransaction(config, action); }
[ "public", "<", "T", ">", "T", "doInTransaction", "(", "final", "TxConfig", "config", ",", "final", "TxAction", "<", "T", ">", "action", ")", "{", "return", "txTemplate", ".", "doInTransaction", "(", "config", ",", "action", ")", ";", "}" ]
Execute action within transaction. @param config transaction config (ignored in case of ongoing transaction) @param action action to execute within transaction (new or ongoing) @param <T> expected return type @return value produced by action @see ru.vyarus.guice.persist.orient.db.transaction.template.TxTemplate
[ "Execute", "action", "within", "transaction", "." ]
train
https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/db/PersistentContext.java#L93-L95
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/AliasChainValidator.java
AliasChainValidator.toStringPlus
public String toStringPlus(String destName, String busName) { """ Return a string representation of the alias chain appended with the destination name given. @param destName @param busName @return """ StringBuffer sb = new StringBuffer(toString()); // Add the destination name which has triggered the exception to the end // of the list, making the problem obvious. String compoundName = new CompoundName(destName, busName).toString(); sb.append(" -> "); sb.append(compoundName); return sb.toString(); }
java
public String toStringPlus(String destName, String busName) { StringBuffer sb = new StringBuffer(toString()); // Add the destination name which has triggered the exception to the end // of the list, making the problem obvious. String compoundName = new CompoundName(destName, busName).toString(); sb.append(" -> "); sb.append(compoundName); return sb.toString(); }
[ "public", "String", "toStringPlus", "(", "String", "destName", ",", "String", "busName", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", "toString", "(", ")", ")", ";", "// Add the destination name which has triggered the exception to the end", "// of the list, making the problem obvious.", "String", "compoundName", "=", "new", "CompoundName", "(", "destName", ",", "busName", ")", ".", "toString", "(", ")", ";", "sb", ".", "append", "(", "\" -> \"", ")", ";", "sb", ".", "append", "(", "compoundName", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Return a string representation of the alias chain appended with the destination name given. @param destName @param busName @return
[ "Return", "a", "string", "representation", "of", "the", "alias", "chain", "appended", "with", "the", "destination", "name", "given", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/AliasChainValidator.java#L148-L159
jboss/jboss-jstl-api_spec
src/main/java/org/apache/taglibs/standard/util/XmlUtil.java
XmlUtil.newTransformer
public static Transformer newTransformer(Source source, JstlUriResolver uriResolver) throws TransformerConfigurationException { """ Create a new Transformer from an XSLT. @param source the source of the XSLT. @param uriResolver @return a new Transformer @throws TransformerConfigurationException if there was a problem creating the Transformer from the XSLT """ TRANSFORMER_FACTORY.setURIResolver(uriResolver); Transformer transformer = TRANSFORMER_FACTORY.newTransformer(source); // Although newTansformer() is not allowed to return null, Xalan does. // Trap that here by throwing the expected TransformerConfigurationException. if (transformer == null) { throw new TransformerConfigurationException("newTransformer returned null. XSLT may be invalid."); } return transformer; }
java
public static Transformer newTransformer(Source source, JstlUriResolver uriResolver) throws TransformerConfigurationException { TRANSFORMER_FACTORY.setURIResolver(uriResolver); Transformer transformer = TRANSFORMER_FACTORY.newTransformer(source); // Although newTansformer() is not allowed to return null, Xalan does. // Trap that here by throwing the expected TransformerConfigurationException. if (transformer == null) { throw new TransformerConfigurationException("newTransformer returned null. XSLT may be invalid."); } return transformer; }
[ "public", "static", "Transformer", "newTransformer", "(", "Source", "source", ",", "JstlUriResolver", "uriResolver", ")", "throws", "TransformerConfigurationException", "{", "TRANSFORMER_FACTORY", ".", "setURIResolver", "(", "uriResolver", ")", ";", "Transformer", "transformer", "=", "TRANSFORMER_FACTORY", ".", "newTransformer", "(", "source", ")", ";", "// Although newTansformer() is not allowed to return null, Xalan does.", "// Trap that here by throwing the expected TransformerConfigurationException.", "if", "(", "transformer", "==", "null", ")", "{", "throw", "new", "TransformerConfigurationException", "(", "\"newTransformer returned null. XSLT may be invalid.\"", ")", ";", "}", "return", "transformer", ";", "}" ]
Create a new Transformer from an XSLT. @param source the source of the XSLT. @param uriResolver @return a new Transformer @throws TransformerConfigurationException if there was a problem creating the Transformer from the XSLT
[ "Create", "a", "new", "Transformer", "from", "an", "XSLT", "." ]
train
https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/util/XmlUtil.java#L195-L204
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/commons/FileUtils.java
FileUtils.getTempFileFor
public static File getTempFileFor(File file) { """ Find a non-existing file in the same directory using the same name as prefix. @param file file used for the name and location (it is not read or written). @return a non-existing file in the same directory using the same name as prefix. """ File parent = file.getParentFile(); String name = file.getName(); File result; int index = 0; do { result = new File(parent, name + "_" + index++); } while (result.exists()); return result; }
java
public static File getTempFileFor(File file) { File parent = file.getParentFile(); String name = file.getName(); File result; int index = 0; do { result = new File(parent, name + "_" + index++); } while (result.exists()); return result; }
[ "public", "static", "File", "getTempFileFor", "(", "File", "file", ")", "{", "File", "parent", "=", "file", ".", "getParentFile", "(", ")", ";", "String", "name", "=", "file", ".", "getName", "(", ")", ";", "File", "result", ";", "int", "index", "=", "0", ";", "do", "{", "result", "=", "new", "File", "(", "parent", ",", "name", "+", "\"_\"", "+", "index", "++", ")", ";", "}", "while", "(", "result", ".", "exists", "(", ")", ")", ";", "return", "result", ";", "}" ]
Find a non-existing file in the same directory using the same name as prefix. @param file file used for the name and location (it is not read or written). @return a non-existing file in the same directory using the same name as prefix.
[ "Find", "a", "non", "-", "existing", "file", "in", "the", "same", "directory", "using", "the", "same", "name", "as", "prefix", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/commons/FileUtils.java#L69-L79
netty/netty
common/src/main/java/io/netty/util/internal/StringUtil.java
StringUtil.byteToHexString
public static <T extends Appendable> T byteToHexString(T buf, int value) { """ Converts the specified byte value into a hexadecimal integer and appends it to the specified buffer. """ try { buf.append(byteToHexString(value)); } catch (IOException e) { PlatformDependent.throwException(e); } return buf; }
java
public static <T extends Appendable> T byteToHexString(T buf, int value) { try { buf.append(byteToHexString(value)); } catch (IOException e) { PlatformDependent.throwException(e); } return buf; }
[ "public", "static", "<", "T", "extends", "Appendable", ">", "T", "byteToHexString", "(", "T", "buf", ",", "int", "value", ")", "{", "try", "{", "buf", ".", "append", "(", "byteToHexString", "(", "value", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "PlatformDependent", ".", "throwException", "(", "e", ")", ";", "}", "return", "buf", ";", "}" ]
Converts the specified byte value into a hexadecimal integer and appends it to the specified buffer.
[ "Converts", "the", "specified", "byte", "value", "into", "a", "hexadecimal", "integer", "and", "appends", "it", "to", "the", "specified", "buffer", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/StringUtil.java#L148-L155
code4everything/util
src/main/java/com/zhazhapan/util/DateUtils.java
DateUtils.addSecond
public static Date addSecond(String date, int amount) throws ParseException { """ 添加秒 @param date 日期 @param amount 数量 @return 添加后的日期 @throws ParseException 异常 """ return add(date, Calendar.SECOND, amount); }
java
public static Date addSecond(String date, int amount) throws ParseException { return add(date, Calendar.SECOND, amount); }
[ "public", "static", "Date", "addSecond", "(", "String", "date", ",", "int", "amount", ")", "throws", "ParseException", "{", "return", "add", "(", "date", ",", "Calendar", ".", "SECOND", ",", "amount", ")", ";", "}" ]
添加秒 @param date 日期 @param amount 数量 @return 添加后的日期 @throws ParseException 异常
[ "添加秒" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/DateUtils.java#L383-L385
Azure/azure-sdk-for-java
compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/LogAnalyticsInner.java
LogAnalyticsInner.beginExportThrottledRequestsAsync
public Observable<LogAnalyticsOperationResultInner> beginExportThrottledRequestsAsync(String location, ThrottledRequestsInput parameters) { """ Export logs that show total throttled Api requests for this subscription in the given time window. @param location The location upon which virtual-machine-sizes is queried. @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the LogAnalyticsOperationResultInner object """ return beginExportThrottledRequestsWithServiceResponseAsync(location, parameters).map(new Func1<ServiceResponse<LogAnalyticsOperationResultInner>, LogAnalyticsOperationResultInner>() { @Override public LogAnalyticsOperationResultInner call(ServiceResponse<LogAnalyticsOperationResultInner> response) { return response.body(); } }); }
java
public Observable<LogAnalyticsOperationResultInner> beginExportThrottledRequestsAsync(String location, ThrottledRequestsInput parameters) { return beginExportThrottledRequestsWithServiceResponseAsync(location, parameters).map(new Func1<ServiceResponse<LogAnalyticsOperationResultInner>, LogAnalyticsOperationResultInner>() { @Override public LogAnalyticsOperationResultInner call(ServiceResponse<LogAnalyticsOperationResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "LogAnalyticsOperationResultInner", ">", "beginExportThrottledRequestsAsync", "(", "String", "location", ",", "ThrottledRequestsInput", "parameters", ")", "{", "return", "beginExportThrottledRequestsWithServiceResponseAsync", "(", "location", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "LogAnalyticsOperationResultInner", ">", ",", "LogAnalyticsOperationResultInner", ">", "(", ")", "{", "@", "Override", "public", "LogAnalyticsOperationResultInner", "call", "(", "ServiceResponse", "<", "LogAnalyticsOperationResultInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Export logs that show total throttled Api requests for this subscription in the given time window. @param location The location upon which virtual-machine-sizes is queried. @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the LogAnalyticsOperationResultInner object
[ "Export", "logs", "that", "show", "total", "throttled", "Api", "requests", "for", "this", "subscription", "in", "the", "given", "time", "window", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/LogAnalyticsInner.java#L339-L346
gallandarakhneorg/afc
core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java
GraphPath.removeUntil
public boolean removeUntil(ST obj, PT pt) { """ Remove the path's elements before the specified one which is starting at the specified point. The specified element will be removed. <p>This function removes until the <i>first occurence</i> of the given object. @param obj is the segment to remove @param pt is the point on which the segment was connected as its first point. @return <code>true</code> on success, otherwise <code>false</code> """ return removeUntil(indexOf(obj, pt), true); }
java
public boolean removeUntil(ST obj, PT pt) { return removeUntil(indexOf(obj, pt), true); }
[ "public", "boolean", "removeUntil", "(", "ST", "obj", ",", "PT", "pt", ")", "{", "return", "removeUntil", "(", "indexOf", "(", "obj", ",", "pt", ")", ",", "true", ")", ";", "}" ]
Remove the path's elements before the specified one which is starting at the specified point. The specified element will be removed. <p>This function removes until the <i>first occurence</i> of the given object. @param obj is the segment to remove @param pt is the point on which the segment was connected as its first point. @return <code>true</code> on success, otherwise <code>false</code>
[ "Remove", "the", "path", "s", "elements", "before", "the", "specified", "one", "which", "is", "starting", "at", "the", "specified", "point", ".", "The", "specified", "element", "will", "be", "removed", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java#L611-L613
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/Function.java
Function.getArgument
public <T> T getArgument(int idx, Class<? extends T> type) { """ Safety return the argument in the position idx. If the element class is not of the requested type it returns null and you don't get casting exeption. """ return getArgument(-1, idx, type); }
java
public <T> T getArgument(int idx, Class<? extends T> type) { return getArgument(-1, idx, type); }
[ "public", "<", "T", ">", "T", "getArgument", "(", "int", "idx", ",", "Class", "<", "?", "extends", "T", ">", "type", ")", "{", "return", "getArgument", "(", "-", "1", ",", "idx", ",", "type", ")", ";", "}" ]
Safety return the argument in the position idx. If the element class is not of the requested type it returns null and you don't get casting exeption.
[ "Safety", "return", "the", "argument", "in", "the", "position", "idx", "." ]
train
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/Function.java#L221-L223
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLReentrantTypeResolver.java
SARLReentrantTypeResolver.createSarlCapacityExtensionProvider
protected XAbstractFeatureCall createSarlCapacityExtensionProvider(JvmIdentifiableElement thisFeature, JvmField field) { """ Create the extension provider dedicated to the access to the used capacity functions. @param thisFeature the current object. @param field the extension field. @return the SARL capacity extension provider, or {@code null}. """ // For capacity call redirection if (thisFeature instanceof JvmDeclaredType) { final JvmAnnotationReference capacityAnnotation = this.annotationLookup.findAnnotation(field, ImportedCapacityFeature.class); if (capacityAnnotation != null) { final String methodName = Utils.createNameForHiddenCapacityImplementationCallingMethodFromFieldName( field.getSimpleName()); final JvmOperation callerOperation = findOperation((JvmDeclaredType) thisFeature, methodName); if (callerOperation != null) { final XbaseFactory baseFactory = getXbaseFactory(); final XMemberFeatureCall extensionProvider = baseFactory.createXMemberFeatureCall(); extensionProvider.setFeature(callerOperation); final XFeatureCall thisAccess = baseFactory.createXFeatureCall(); thisAccess.setFeature(thisFeature); extensionProvider.setMemberCallTarget(thisAccess); return extensionProvider; } } } return null; }
java
protected XAbstractFeatureCall createSarlCapacityExtensionProvider(JvmIdentifiableElement thisFeature, JvmField field) { // For capacity call redirection if (thisFeature instanceof JvmDeclaredType) { final JvmAnnotationReference capacityAnnotation = this.annotationLookup.findAnnotation(field, ImportedCapacityFeature.class); if (capacityAnnotation != null) { final String methodName = Utils.createNameForHiddenCapacityImplementationCallingMethodFromFieldName( field.getSimpleName()); final JvmOperation callerOperation = findOperation((JvmDeclaredType) thisFeature, methodName); if (callerOperation != null) { final XbaseFactory baseFactory = getXbaseFactory(); final XMemberFeatureCall extensionProvider = baseFactory.createXMemberFeatureCall(); extensionProvider.setFeature(callerOperation); final XFeatureCall thisAccess = baseFactory.createXFeatureCall(); thisAccess.setFeature(thisFeature); extensionProvider.setMemberCallTarget(thisAccess); return extensionProvider; } } } return null; }
[ "protected", "XAbstractFeatureCall", "createSarlCapacityExtensionProvider", "(", "JvmIdentifiableElement", "thisFeature", ",", "JvmField", "field", ")", "{", "// For capacity call redirection", "if", "(", "thisFeature", "instanceof", "JvmDeclaredType", ")", "{", "final", "JvmAnnotationReference", "capacityAnnotation", "=", "this", ".", "annotationLookup", ".", "findAnnotation", "(", "field", ",", "ImportedCapacityFeature", ".", "class", ")", ";", "if", "(", "capacityAnnotation", "!=", "null", ")", "{", "final", "String", "methodName", "=", "Utils", ".", "createNameForHiddenCapacityImplementationCallingMethodFromFieldName", "(", "field", ".", "getSimpleName", "(", ")", ")", ";", "final", "JvmOperation", "callerOperation", "=", "findOperation", "(", "(", "JvmDeclaredType", ")", "thisFeature", ",", "methodName", ")", ";", "if", "(", "callerOperation", "!=", "null", ")", "{", "final", "XbaseFactory", "baseFactory", "=", "getXbaseFactory", "(", ")", ";", "final", "XMemberFeatureCall", "extensionProvider", "=", "baseFactory", ".", "createXMemberFeatureCall", "(", ")", ";", "extensionProvider", ".", "setFeature", "(", "callerOperation", ")", ";", "final", "XFeatureCall", "thisAccess", "=", "baseFactory", ".", "createXFeatureCall", "(", ")", ";", "thisAccess", ".", "setFeature", "(", "thisFeature", ")", ";", "extensionProvider", ".", "setMemberCallTarget", "(", "thisAccess", ")", ";", "return", "extensionProvider", ";", "}", "}", "}", "return", "null", ";", "}" ]
Create the extension provider dedicated to the access to the used capacity functions. @param thisFeature the current object. @param field the extension field. @return the SARL capacity extension provider, or {@code null}.
[ "Create", "the", "extension", "provider", "dedicated", "to", "the", "access", "to", "the", "used", "capacity", "functions", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLReentrantTypeResolver.java#L161-L182
zaproxy/zaproxy
src/org/zaproxy/zap/extension/spider/SpiderAPI.java
SpiderAPI.getStartNode
private StructuralNode getStartNode(URI startURI, boolean recurse) throws ApiException { """ Gets a node for the given URI and recurse value, for use as start/seed of the spider. <p> If {@code recurse} is {@code true} it returns a node that represents a directory (if present in the session) otherwise the node represents a GET node of the URI. If neither of the nodes is found in the session it returns {@code null}. @param startURI the starting URI, must not be {@code null}. @param recurse {@code true} if the spider should use existing URLs as seeds, {@code false} otherwise. @return the start node, might be {@code null}. @throws ApiException if an error occurred while obtaining the start node. """ StructuralNode startNode = null; try { if (recurse) { startNode = SessionStructure.find(Model.getSingleton().getSession().getSessionId(), startURI, "", ""); } if (startNode == null) { startNode = SessionStructure.find(Model.getSingleton().getSession().getSessionId(), startURI, "GET", ""); } } catch (Exception e) { throw new ApiException(ApiException.Type.INTERNAL_ERROR, e); } return startNode; }
java
private StructuralNode getStartNode(URI startURI, boolean recurse) throws ApiException { StructuralNode startNode = null; try { if (recurse) { startNode = SessionStructure.find(Model.getSingleton().getSession().getSessionId(), startURI, "", ""); } if (startNode == null) { startNode = SessionStructure.find(Model.getSingleton().getSession().getSessionId(), startURI, "GET", ""); } } catch (Exception e) { throw new ApiException(ApiException.Type.INTERNAL_ERROR, e); } return startNode; }
[ "private", "StructuralNode", "getStartNode", "(", "URI", "startURI", ",", "boolean", "recurse", ")", "throws", "ApiException", "{", "StructuralNode", "startNode", "=", "null", ";", "try", "{", "if", "(", "recurse", ")", "{", "startNode", "=", "SessionStructure", ".", "find", "(", "Model", ".", "getSingleton", "(", ")", ".", "getSession", "(", ")", ".", "getSessionId", "(", ")", ",", "startURI", ",", "\"\"", ",", "\"\"", ")", ";", "}", "if", "(", "startNode", "==", "null", ")", "{", "startNode", "=", "SessionStructure", ".", "find", "(", "Model", ".", "getSingleton", "(", ")", ".", "getSession", "(", ")", ".", "getSessionId", "(", ")", ",", "startURI", ",", "\"GET\"", ",", "\"\"", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "ApiException", "(", "ApiException", ".", "Type", ".", "INTERNAL_ERROR", ",", "e", ")", ";", "}", "return", "startNode", ";", "}" ]
Gets a node for the given URI and recurse value, for use as start/seed of the spider. <p> If {@code recurse} is {@code true} it returns a node that represents a directory (if present in the session) otherwise the node represents a GET node of the URI. If neither of the nodes is found in the session it returns {@code null}. @param startURI the starting URI, must not be {@code null}. @param recurse {@code true} if the spider should use existing URLs as seeds, {@code false} otherwise. @return the start node, might be {@code null}. @throws ApiException if an error occurred while obtaining the start node.
[ "Gets", "a", "node", "for", "the", "given", "URI", "and", "recurse", "value", "for", "use", "as", "start", "/", "seed", "of", "the", "spider", ".", "<p", ">", "If", "{", "@code", "recurse", "}", "is", "{", "@code", "true", "}", "it", "returns", "a", "node", "that", "represents", "a", "directory", "(", "if", "present", "in", "the", "session", ")", "otherwise", "the", "node", "represents", "a", "GET", "node", "of", "the", "URI", ".", "If", "neither", "of", "the", "nodes", "is", "found", "in", "the", "session", "it", "returns", "{", "@code", "null", "}", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/spider/SpiderAPI.java#L534-L547
keyboardsurfer/Crouton
library/src/main/java/de/keyboardsurfer/android/widget/crouton/Crouton.java
Crouton.showText
public static void showText(Activity activity, int textResourceId, Style style) { """ Creates a {@link Crouton} with provided text-resource and style for a given activity and displays it directly. @param activity The {@link Activity} that the {@link Crouton} should be attached to. @param textResourceId The resource id of the text you want to display. @param style The style that this {@link Crouton} should be created with. """ showText(activity, activity.getString(textResourceId), style); }
java
public static void showText(Activity activity, int textResourceId, Style style) { showText(activity, activity.getString(textResourceId), style); }
[ "public", "static", "void", "showText", "(", "Activity", "activity", ",", "int", "textResourceId", ",", "Style", "style", ")", "{", "showText", "(", "activity", ",", "activity", ".", "getString", "(", "textResourceId", ")", ",", "style", ")", ";", "}" ]
Creates a {@link Crouton} with provided text-resource and style for a given activity and displays it directly. @param activity The {@link Activity} that the {@link Crouton} should be attached to. @param textResourceId The resource id of the text you want to display. @param style The style that this {@link Crouton} should be created with.
[ "Creates", "a", "{", "@link", "Crouton", "}", "with", "provided", "text", "-", "resource", "and", "style", "for", "a", "given", "activity", "and", "displays", "it", "directly", "." ]
train
https://github.com/keyboardsurfer/Crouton/blob/7806b15e4d52793e1f5aeaa4a55b1e220289e619/library/src/main/java/de/keyboardsurfer/android/widget/crouton/Crouton.java#L493-L495
Teddy-Zhu/SilentGo
utils/src/main/java/com/silentgo/utils/log/dialect/slf4j/Slf4jLog.java
Slf4jLog.locationAwareLog
private boolean locationAwareLog(String fqcn, int level_int, Throwable t, String msgTemplate, Object[] arguments) { """ 打印日志<br> 此方法用于兼容底层日志实现,通过传入当前包装类名,以解决打印日志中行号错误问题 @param fqcn 完全限定类名(Fully Qualified Class Name),用于纠正定位错误行号 @param level_int 日志级别,使用LocationAwareLogger中的常量 @param t 异常 @param msgTemplate 消息模板 @param arguments 参数 @return 是否支持 LocationAwareLogger对象,如果不支持需要日志方法调用被包装类的相应方法 """ if(this.logger instanceof LocationAwareLogger){ // ((LocationAwareLogger)this.logger).log(null, fqcn, level_int, msgTemplate, arguments, t); //由于slf4j-log4j12中此方法的实现存在bug,故在此拼接参数 ((LocationAwareLogger)this.logger).log(null, fqcn, level_int, StringKit.format(msgTemplate, arguments), null, t); return true; }else{ return false; } }
java
private boolean locationAwareLog(String fqcn, int level_int, Throwable t, String msgTemplate, Object[] arguments) { if(this.logger instanceof LocationAwareLogger){ // ((LocationAwareLogger)this.logger).log(null, fqcn, level_int, msgTemplate, arguments, t); //由于slf4j-log4j12中此方法的实现存在bug,故在此拼接参数 ((LocationAwareLogger)this.logger).log(null, fqcn, level_int, StringKit.format(msgTemplate, arguments), null, t); return true; }else{ return false; } }
[ "private", "boolean", "locationAwareLog", "(", "String", "fqcn", ",", "int", "level_int", ",", "Throwable", "t", ",", "String", "msgTemplate", ",", "Object", "[", "]", "arguments", ")", "{", "if", "(", "this", ".", "logger", "instanceof", "LocationAwareLogger", ")", "{", "//\t\t\t((LocationAwareLogger)this.logger).log(null, fqcn, level_int, msgTemplate, arguments, t);", "//由于slf4j-log4j12中此方法的实现存在bug,故在此拼接参数", "(", "(", "LocationAwareLogger", ")", "this", ".", "logger", ")", ".", "log", "(", "null", ",", "fqcn", ",", "level_int", ",", "StringKit", ".", "format", "(", "msgTemplate", ",", "arguments", ")", ",", "null", ",", "t", ")", ";", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
打印日志<br> 此方法用于兼容底层日志实现,通过传入当前包装类名,以解决打印日志中行号错误问题 @param fqcn 完全限定类名(Fully Qualified Class Name),用于纠正定位错误行号 @param level_int 日志级别,使用LocationAwareLogger中的常量 @param t 异常 @param msgTemplate 消息模板 @param arguments 参数 @return 是否支持 LocationAwareLogger对象,如果不支持需要日志方法调用被包装类的相应方法
[ "打印日志<br", ">", "此方法用于兼容底层日志实现,通过传入当前包装类名,以解决打印日志中行号错误问题" ]
train
https://github.com/Teddy-Zhu/SilentGo/blob/27f58b0cafe56b2eb9fc6993efa9ca2b529661e1/utils/src/main/java/com/silentgo/utils/log/dialect/slf4j/Slf4jLog.java#L214-L223