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
SeleniumHQ/selenium
java/client/src/org/openqa/selenium/remote/http/HttpRequest.java
HttpRequest.addQueryParameter
public HttpRequest addQueryParameter(String name, String value) { """ Set a query parameter, adding to existing values if present. The implementation will ensure that the name and value are properly encoded. """ queryParameters.put( Objects.requireNonNull(name, "Name must be set"), Objects.requireNonNull(value, "Value must be set")); return this; }
java
public HttpRequest addQueryParameter(String name, String value) { queryParameters.put( Objects.requireNonNull(name, "Name must be set"), Objects.requireNonNull(value, "Value must be set")); return this; }
[ "public", "HttpRequest", "addQueryParameter", "(", "String", "name", ",", "String", "value", ")", "{", "queryParameters", ".", "put", "(", "Objects", ".", "requireNonNull", "(", "name", ",", "\"Name must be set\"", ")", ",", "Objects", ".", "requireNonNull", "(", "value", ",", "\"Value must be set\"", ")", ")", ";", "return", "this", ";", "}" ]
Set a query parameter, adding to existing values if present. The implementation will ensure that the name and value are properly encoded.
[ "Set", "a", "query", "parameter", "adding", "to", "existing", "values", "if", "present", ".", "The", "implementation", "will", "ensure", "that", "the", "name", "and", "value", "are", "properly", "encoded", "." ]
train
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/remote/http/HttpRequest.java#L61-L66
ManfredTremmel/gwt-bean-validators
mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/util/BeanPropertyReaderUtil.java
BeanPropertyReaderUtil.getNullSaveProperty
public static Object getNullSaveProperty(final Object pbean, final String pname) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { """ <p> Return the value of the specified property of the specified bean, no matter which property reference format is used, as a String. </p> <p> If there is a null value in path hierarchy, exception is cached and null returned. </p> @param pbean Bean whose property is to be extracted @param pname Possibly indexed and/or nested name of the property to be extracted @return The property's value, converted to a String @exception IllegalAccessException if the caller does not have access to the property accessor method @exception InvocationTargetException if the property accessor method throws an exception @exception NoSuchMethodException if an accessor method for this property cannot be found @see BeanUtilsBean#getProperty """ Object property; try { property = PropertyUtils.getProperty(pbean, pname); } catch (final NestedNullException pexception) { property = null; } return property; }
java
public static Object getNullSaveProperty(final Object pbean, final String pname) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { Object property; try { property = PropertyUtils.getProperty(pbean, pname); } catch (final NestedNullException pexception) { property = null; } return property; }
[ "public", "static", "Object", "getNullSaveProperty", "(", "final", "Object", "pbean", ",", "final", "String", "pname", ")", "throws", "IllegalAccessException", ",", "InvocationTargetException", ",", "NoSuchMethodException", "{", "Object", "property", ";", "try", "{", "property", "=", "PropertyUtils", ".", "getProperty", "(", "pbean", ",", "pname", ")", ";", "}", "catch", "(", "final", "NestedNullException", "pexception", ")", "{", "property", "=", "null", ";", "}", "return", "property", ";", "}" ]
<p> Return the value of the specified property of the specified bean, no matter which property reference format is used, as a String. </p> <p> If there is a null value in path hierarchy, exception is cached and null returned. </p> @param pbean Bean whose property is to be extracted @param pname Possibly indexed and/or nested name of the property to be extracted @return The property's value, converted to a String @exception IllegalAccessException if the caller does not have access to the property accessor method @exception InvocationTargetException if the property accessor method throws an exception @exception NoSuchMethodException if an accessor method for this property cannot be found @see BeanUtilsBean#getProperty
[ "<p", ">", "Return", "the", "value", "of", "the", "specified", "property", "of", "the", "specified", "bean", "no", "matter", "which", "property", "reference", "format", "is", "used", "as", "a", "String", ".", "<", "/", "p", ">", "<p", ">", "If", "there", "is", "a", "null", "value", "in", "path", "hierarchy", "exception", "is", "cached", "and", "null", "returned", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/util/BeanPropertyReaderUtil.java#L89-L98
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuDeviceComputeCapability
@Deprecated public static int cuDeviceComputeCapability(int major[], int minor[], CUdevice dev) { """ Returns the compute capability of the device. <pre> CUresult cuDeviceComputeCapability ( int* major, int* minor, CUdevice dev ) </pre> <div> <p>Returns the compute capability of the device. DeprecatedThis function was deprecated as of CUDA 5.0 and its functionality superceded by cuDeviceGetAttribute(). </p> <p>Returns in <tt>*major</tt> and <tt>*minor</tt> the major and minor revision numbers that define the compute capability of the device <tt>dev</tt>. </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param major Major revision number @param minor Minor revision number @param dev Device handle @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_INVALID_DEVICE @see JCudaDriver#cuDeviceGetAttribute @see JCudaDriver#cuDeviceGetCount @see JCudaDriver#cuDeviceGetName @see JCudaDriver#cuDeviceGet @see JCudaDriver#cuDeviceTotalMem @deprecated Deprecated as of CUDA 5.0, replaced with {@link JCudaDriver#cuDeviceGetAttribute(int[], int, CUdevice)} """ return checkResult(cuDeviceComputeCapabilityNative(major, minor, dev)); }
java
@Deprecated public static int cuDeviceComputeCapability(int major[], int minor[], CUdevice dev) { return checkResult(cuDeviceComputeCapabilityNative(major, minor, dev)); }
[ "@", "Deprecated", "public", "static", "int", "cuDeviceComputeCapability", "(", "int", "major", "[", "]", ",", "int", "minor", "[", "]", ",", "CUdevice", "dev", ")", "{", "return", "checkResult", "(", "cuDeviceComputeCapabilityNative", "(", "major", ",", "minor", ",", "dev", ")", ")", ";", "}" ]
Returns the compute capability of the device. <pre> CUresult cuDeviceComputeCapability ( int* major, int* minor, CUdevice dev ) </pre> <div> <p>Returns the compute capability of the device. DeprecatedThis function was deprecated as of CUDA 5.0 and its functionality superceded by cuDeviceGetAttribute(). </p> <p>Returns in <tt>*major</tt> and <tt>*minor</tt> the major and minor revision numbers that define the compute capability of the device <tt>dev</tt>. </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param major Major revision number @param minor Minor revision number @param dev Device handle @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_INVALID_DEVICE @see JCudaDriver#cuDeviceGetAttribute @see JCudaDriver#cuDeviceGetCount @see JCudaDriver#cuDeviceGetName @see JCudaDriver#cuDeviceGet @see JCudaDriver#cuDeviceTotalMem @deprecated Deprecated as of CUDA 5.0, replaced with {@link JCudaDriver#cuDeviceGetAttribute(int[], int, CUdevice)}
[ "Returns", "the", "compute", "capability", "of", "the", "device", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L763-L767
gsi-upm/Shanks
shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/creation/CreationShanksAgentCapability.java
CreationShanksAgentCapability.removeAgent
public static void removeAgent(ShanksSimulation sim, String agentID) throws ShanksException { """ "Removes" an agent with the given name from the simulation Be careful: what this actually do is to stop the agent execution. @param sim -The Shanks Simulation @param agentID - The name of the agent to remove @throws ShanksException An UnkownAgentException if the Agent ID is not found on the simulation. """ sim.logger.info("Stoppable not fount. Attempting direct stop..."); sim.unregisterShanksAgent(agentID); sim.logger.info("Agent " + agentID + " stopped."); }
java
public static void removeAgent(ShanksSimulation sim, String agentID) throws ShanksException { sim.logger.info("Stoppable not fount. Attempting direct stop..."); sim.unregisterShanksAgent(agentID); sim.logger.info("Agent " + agentID + " stopped."); }
[ "public", "static", "void", "removeAgent", "(", "ShanksSimulation", "sim", ",", "String", "agentID", ")", "throws", "ShanksException", "{", "sim", ".", "logger", ".", "info", "(", "\"Stoppable not fount. Attempting direct stop...\"", ")", ";", "sim", ".", "unregisterShanksAgent", "(", "agentID", ")", ";", "sim", ".", "logger", ".", "info", "(", "\"Agent \"", "+", "agentID", "+", "\" stopped.\"", ")", ";", "}" ]
"Removes" an agent with the given name from the simulation Be careful: what this actually do is to stop the agent execution. @param sim -The Shanks Simulation @param agentID - The name of the agent to remove @throws ShanksException An UnkownAgentException if the Agent ID is not found on the simulation.
[ "Removes", "an", "agent", "with", "the", "given", "name", "from", "the", "simulation" ]
train
https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/creation/CreationShanksAgentCapability.java#L73-L78
BlueBrain/bluima
modules/bluima_pdf/src/main/java/ch/epfl/bbp/uima/pdf/grobid/diff_match_patch.java
diff_match_patch.diff_linesToChars
protected LinesToCharsResult diff_linesToChars(String text1, String text2) { """ Split two texts into a list of strings. Reduce the texts to a string of hashes where each Unicode character represents one line. @param text1 First string. @param text2 Second string. @return An object containing the encoded text1, the encoded text2 and the List of unique strings. The zeroth element of the List of unique strings is intentionally blank. """ List<String> lineArray = new ArrayList<String>(); Map<String, Integer> lineHash = new HashMap<String, Integer>(); // e.g. linearray[4] == "Hello\n" // e.g. linehash.get("Hello\n") == 4 // "\x00" is a valid character, but various debuggers don't like it. // So we'll insert a junk entry to avoid generating a null character. lineArray.add(""); String chars1 = diff_linesToCharsMunge(text1, lineArray, lineHash); String chars2 = diff_linesToCharsMunge(text2, lineArray, lineHash); return new LinesToCharsResult(chars1, chars2, lineArray); }
java
protected LinesToCharsResult diff_linesToChars(String text1, String text2) { List<String> lineArray = new ArrayList<String>(); Map<String, Integer> lineHash = new HashMap<String, Integer>(); // e.g. linearray[4] == "Hello\n" // e.g. linehash.get("Hello\n") == 4 // "\x00" is a valid character, but various debuggers don't like it. // So we'll insert a junk entry to avoid generating a null character. lineArray.add(""); String chars1 = diff_linesToCharsMunge(text1, lineArray, lineHash); String chars2 = diff_linesToCharsMunge(text2, lineArray, lineHash); return new LinesToCharsResult(chars1, chars2, lineArray); }
[ "protected", "LinesToCharsResult", "diff_linesToChars", "(", "String", "text1", ",", "String", "text2", ")", "{", "List", "<", "String", ">", "lineArray", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "Map", "<", "String", ",", "Integer", ">", "lineHash", "=", "new", "HashMap", "<", "String", ",", "Integer", ">", "(", ")", ";", "// e.g. linearray[4] == \"Hello\\n\"", "// e.g. linehash.get(\"Hello\\n\") == 4", "// \"\\x00\" is a valid character, but various debuggers don't like it.", "// So we'll insert a junk entry to avoid generating a null character.", "lineArray", ".", "add", "(", "\"\"", ")", ";", "String", "chars1", "=", "diff_linesToCharsMunge", "(", "text1", ",", "lineArray", ",", "lineHash", ")", ";", "String", "chars2", "=", "diff_linesToCharsMunge", "(", "text2", ",", "lineArray", ",", "lineHash", ")", ";", "return", "new", "LinesToCharsResult", "(", "chars1", ",", "chars2", ",", "lineArray", ")", ";", "}" ]
Split two texts into a list of strings. Reduce the texts to a string of hashes where each Unicode character represents one line. @param text1 First string. @param text2 Second string. @return An object containing the encoded text1, the encoded text2 and the List of unique strings. The zeroth element of the List of unique strings is intentionally blank.
[ "Split", "two", "texts", "into", "a", "list", "of", "strings", ".", "Reduce", "the", "texts", "to", "a", "string", "of", "hashes", "where", "each", "Unicode", "character", "represents", "one", "line", "." ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_pdf/src/main/java/ch/epfl/bbp/uima/pdf/grobid/diff_match_patch.java#L551-L564
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImplFloat_CustomFieldSerializer.java
OWLLiteralImplFloat_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLLiteralImplFloat instance) throws SerializationException { """ Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful """ serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLLiteralImplFloat instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLLiteralImplFloat", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{" ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImplFloat_CustomFieldSerializer.java#L66-L69
aalmiray/Json-lib
src/main/java/net/sf/json/JSONObject.java
JSONObject.element
public JSONObject element( String key, boolean value ) { """ Put a key/boolean pair in the JSONObject. @param key A key string. @param value A boolean which is the value. @return this. @throws JSONException If the key is null. """ verifyIsNull(); return element( key, value ? Boolean.TRUE : Boolean.FALSE ); }
java
public JSONObject element( String key, boolean value ) { verifyIsNull(); return element( key, value ? Boolean.TRUE : Boolean.FALSE ); }
[ "public", "JSONObject", "element", "(", "String", "key", ",", "boolean", "value", ")", "{", "verifyIsNull", "(", ")", ";", "return", "element", "(", "key", ",", "value", "?", "Boolean", ".", "TRUE", ":", "Boolean", ".", "FALSE", ")", ";", "}" ]
Put a key/boolean pair in the JSONObject. @param key A key string. @param value A boolean which is the value. @return this. @throws JSONException If the key is null.
[ "Put", "a", "key", "/", "boolean", "pair", "in", "the", "JSONObject", "." ]
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONObject.java#L1569-L1572
katharsis-project/katharsis-framework
katharsis-core/src/main/java/io/katharsis/legacy/registry/ResourceRegistryBuilder.java
ResourceRegistryBuilder.build
public ResourceRegistry build(ResourceLookup resourceLookup, ModuleRegistry moduleRegistry, ServiceUrlProvider serviceUrl) { """ Uses a {@link ResourceLookup} to get all resources and repositories associated with found resource. @param resourceLookup Lookup for getting all resource classes. @param serviceUrl URL to the service @return an instance of ResourceRegistry """ Set<Class<?>> jsonApiResources = resourceLookup.getResourceClasses(); Set<ResourceInformation> resourceInformationSet = new HashSet<>(jsonApiResources.size()); for (Class<?> clazz : jsonApiResources) { resourceInformationSet.add(resourceInformationBuilder.build(clazz)); LOGGER.trace("{} registered as a resource", clazz); } Set<RegistryEntry> registryEntries = new HashSet<>(resourceInformationSet.size()); for (ResourceInformation resourceInformation : resourceInformationSet) { Class<?> resourceClass = resourceInformation.getResourceClass(); ResourceEntry resourceEntry = repositoryEntryBuilder.buildResourceRepository(resourceLookup, resourceClass); LOGGER.trace("{} has a resource repository {}", resourceInformation.getResourceClass(), resourceEntry); List<ResponseRelationshipEntry> relationshipEntries = repositoryEntryBuilder.buildRelationshipRepositories(resourceLookup, resourceClass); LOGGER.trace("{} has relationship repositories {}", resourceInformation.getResourceClass(), relationshipEntries); ResourceRepositoryInformation repositoryInformation = new ResourceRepositoryInformationImpl(null, resourceInformation.getResourceType(), resourceInformation); registryEntries.add(new RegistryEntry(repositoryInformation, resourceEntry, relationshipEntries)); } ResourceRegistry resourceRegistry = new ResourceRegistryImpl(moduleRegistry, serviceUrl); for (RegistryEntry registryEntry : registryEntries) { Class<?> resourceClass = registryEntry.getResourceInformation().getResourceClass(); RegistryEntry registryEntryParent = findParent(resourceClass, registryEntries); registryEntry.setParentRegistryEntry(registryEntryParent); resourceRegistry.addEntry(resourceClass, registryEntry); } return resourceRegistry; }
java
public ResourceRegistry build(ResourceLookup resourceLookup, ModuleRegistry moduleRegistry, ServiceUrlProvider serviceUrl) { Set<Class<?>> jsonApiResources = resourceLookup.getResourceClasses(); Set<ResourceInformation> resourceInformationSet = new HashSet<>(jsonApiResources.size()); for (Class<?> clazz : jsonApiResources) { resourceInformationSet.add(resourceInformationBuilder.build(clazz)); LOGGER.trace("{} registered as a resource", clazz); } Set<RegistryEntry> registryEntries = new HashSet<>(resourceInformationSet.size()); for (ResourceInformation resourceInformation : resourceInformationSet) { Class<?> resourceClass = resourceInformation.getResourceClass(); ResourceEntry resourceEntry = repositoryEntryBuilder.buildResourceRepository(resourceLookup, resourceClass); LOGGER.trace("{} has a resource repository {}", resourceInformation.getResourceClass(), resourceEntry); List<ResponseRelationshipEntry> relationshipEntries = repositoryEntryBuilder.buildRelationshipRepositories(resourceLookup, resourceClass); LOGGER.trace("{} has relationship repositories {}", resourceInformation.getResourceClass(), relationshipEntries); ResourceRepositoryInformation repositoryInformation = new ResourceRepositoryInformationImpl(null, resourceInformation.getResourceType(), resourceInformation); registryEntries.add(new RegistryEntry(repositoryInformation, resourceEntry, relationshipEntries)); } ResourceRegistry resourceRegistry = new ResourceRegistryImpl(moduleRegistry, serviceUrl); for (RegistryEntry registryEntry : registryEntries) { Class<?> resourceClass = registryEntry.getResourceInformation().getResourceClass(); RegistryEntry registryEntryParent = findParent(resourceClass, registryEntries); registryEntry.setParentRegistryEntry(registryEntryParent); resourceRegistry.addEntry(resourceClass, registryEntry); } return resourceRegistry; }
[ "public", "ResourceRegistry", "build", "(", "ResourceLookup", "resourceLookup", ",", "ModuleRegistry", "moduleRegistry", ",", "ServiceUrlProvider", "serviceUrl", ")", "{", "Set", "<", "Class", "<", "?", ">", ">", "jsonApiResources", "=", "resourceLookup", ".", "getResourceClasses", "(", ")", ";", "Set", "<", "ResourceInformation", ">", "resourceInformationSet", "=", "new", "HashSet", "<>", "(", "jsonApiResources", ".", "size", "(", ")", ")", ";", "for", "(", "Class", "<", "?", ">", "clazz", ":", "jsonApiResources", ")", "{", "resourceInformationSet", ".", "add", "(", "resourceInformationBuilder", ".", "build", "(", "clazz", ")", ")", ";", "LOGGER", ".", "trace", "(", "\"{} registered as a resource\"", ",", "clazz", ")", ";", "}", "Set", "<", "RegistryEntry", ">", "registryEntries", "=", "new", "HashSet", "<>", "(", "resourceInformationSet", ".", "size", "(", ")", ")", ";", "for", "(", "ResourceInformation", "resourceInformation", ":", "resourceInformationSet", ")", "{", "Class", "<", "?", ">", "resourceClass", "=", "resourceInformation", ".", "getResourceClass", "(", ")", ";", "ResourceEntry", "resourceEntry", "=", "repositoryEntryBuilder", ".", "buildResourceRepository", "(", "resourceLookup", ",", "resourceClass", ")", ";", "LOGGER", ".", "trace", "(", "\"{} has a resource repository {}\"", ",", "resourceInformation", ".", "getResourceClass", "(", ")", ",", "resourceEntry", ")", ";", "List", "<", "ResponseRelationshipEntry", ">", "relationshipEntries", "=", "repositoryEntryBuilder", ".", "buildRelationshipRepositories", "(", "resourceLookup", ",", "resourceClass", ")", ";", "LOGGER", ".", "trace", "(", "\"{} has relationship repositories {}\"", ",", "resourceInformation", ".", "getResourceClass", "(", ")", ",", "relationshipEntries", ")", ";", "ResourceRepositoryInformation", "repositoryInformation", "=", "new", "ResourceRepositoryInformationImpl", "(", "null", ",", "resourceInformation", ".", "getResourceType", "(", ")", ",", "resourceInformation", ")", ";", "registryEntries", ".", "add", "(", "new", "RegistryEntry", "(", "repositoryInformation", ",", "resourceEntry", ",", "relationshipEntries", ")", ")", ";", "}", "ResourceRegistry", "resourceRegistry", "=", "new", "ResourceRegistryImpl", "(", "moduleRegistry", ",", "serviceUrl", ")", ";", "for", "(", "RegistryEntry", "registryEntry", ":", "registryEntries", ")", "{", "Class", "<", "?", ">", "resourceClass", "=", "registryEntry", ".", "getResourceInformation", "(", ")", ".", "getResourceClass", "(", ")", ";", "RegistryEntry", "registryEntryParent", "=", "findParent", "(", "resourceClass", ",", "registryEntries", ")", ";", "registryEntry", ".", "setParentRegistryEntry", "(", "registryEntryParent", ")", ";", "resourceRegistry", ".", "addEntry", "(", "resourceClass", ",", "registryEntry", ")", ";", "}", "return", "resourceRegistry", ";", "}" ]
Uses a {@link ResourceLookup} to get all resources and repositories associated with found resource. @param resourceLookup Lookup for getting all resource classes. @param serviceUrl URL to the service @return an instance of ResourceRegistry
[ "Uses", "a", "{", "@link", "ResourceLookup", "}", "to", "get", "all", "resources", "and", "repositories", "associated", "with", "found", "resource", "." ]
train
https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/legacy/registry/ResourceRegistryBuilder.java#L69-L102
infinispan/infinispan
cdi/embedded/src/main/java/org/infinispan/cdi/embedded/InfinispanExtensionEmbedded.java
InfinispanExtensionEmbedded.createDefaultEmbeddedCacheManagerBean
private Bean<EmbeddedCacheManager> createDefaultEmbeddedCacheManagerBean(BeanManager beanManager) { """ The default cache manager is an instance of {@link DefaultCacheManager} initialized with the default configuration (either produced by {@link #createDefaultEmbeddedConfigurationBean(BeanManager)} or provided by user). The default cache manager can be overridden by creating a producer which produces the new default cache manager. The cache manager produced must have the scope {@link ApplicationScoped} and the {@linkplain javax.enterprise.inject.Default Default} qualifier. @param beanManager @return a custom bean """ return new BeanBuilder<EmbeddedCacheManager>(beanManager).beanClass(InfinispanExtensionEmbedded.class) .addTypes(Object.class, EmbeddedCacheManager.class) .scope(ApplicationScoped.class) .qualifiers(defaultQualifiers()) .passivationCapable(true) .id(InfinispanExtensionEmbedded.class.getSimpleName() + "#" + EmbeddedCacheManager.class.getSimpleName()) .beanLifecycle(new ContextualLifecycle<EmbeddedCacheManager>() { @Override public EmbeddedCacheManager create(Bean<EmbeddedCacheManager> bean, CreationalContext<EmbeddedCacheManager> creationalContext) { GlobalConfiguration globalConfiguration = new GlobalConfigurationBuilder().globalJmxStatistics() .cacheManagerName(CACHE_NAME).build(); @SuppressWarnings("unchecked") Bean<Configuration> configurationBean = (Bean<Configuration>) beanManager .resolve(beanManager.getBeans(Configuration.class)); Configuration defaultConfiguration = (Configuration) beanManager.getReference(configurationBean, Configuration.class, beanManager.createCreationalContext(configurationBean)); return new DefaultCacheManager(globalConfiguration, defaultConfiguration); } @Override public void destroy(Bean<EmbeddedCacheManager> bean, EmbeddedCacheManager instance, CreationalContext<EmbeddedCacheManager> creationalContext) { instance.stop(); } }).create(); }
java
private Bean<EmbeddedCacheManager> createDefaultEmbeddedCacheManagerBean(BeanManager beanManager) { return new BeanBuilder<EmbeddedCacheManager>(beanManager).beanClass(InfinispanExtensionEmbedded.class) .addTypes(Object.class, EmbeddedCacheManager.class) .scope(ApplicationScoped.class) .qualifiers(defaultQualifiers()) .passivationCapable(true) .id(InfinispanExtensionEmbedded.class.getSimpleName() + "#" + EmbeddedCacheManager.class.getSimpleName()) .beanLifecycle(new ContextualLifecycle<EmbeddedCacheManager>() { @Override public EmbeddedCacheManager create(Bean<EmbeddedCacheManager> bean, CreationalContext<EmbeddedCacheManager> creationalContext) { GlobalConfiguration globalConfiguration = new GlobalConfigurationBuilder().globalJmxStatistics() .cacheManagerName(CACHE_NAME).build(); @SuppressWarnings("unchecked") Bean<Configuration> configurationBean = (Bean<Configuration>) beanManager .resolve(beanManager.getBeans(Configuration.class)); Configuration defaultConfiguration = (Configuration) beanManager.getReference(configurationBean, Configuration.class, beanManager.createCreationalContext(configurationBean)); return new DefaultCacheManager(globalConfiguration, defaultConfiguration); } @Override public void destroy(Bean<EmbeddedCacheManager> bean, EmbeddedCacheManager instance, CreationalContext<EmbeddedCacheManager> creationalContext) { instance.stop(); } }).create(); }
[ "private", "Bean", "<", "EmbeddedCacheManager", ">", "createDefaultEmbeddedCacheManagerBean", "(", "BeanManager", "beanManager", ")", "{", "return", "new", "BeanBuilder", "<", "EmbeddedCacheManager", ">", "(", "beanManager", ")", ".", "beanClass", "(", "InfinispanExtensionEmbedded", ".", "class", ")", ".", "addTypes", "(", "Object", ".", "class", ",", "EmbeddedCacheManager", ".", "class", ")", ".", "scope", "(", "ApplicationScoped", ".", "class", ")", ".", "qualifiers", "(", "defaultQualifiers", "(", ")", ")", ".", "passivationCapable", "(", "true", ")", ".", "id", "(", "InfinispanExtensionEmbedded", ".", "class", ".", "getSimpleName", "(", ")", "+", "\"#\"", "+", "EmbeddedCacheManager", ".", "class", ".", "getSimpleName", "(", ")", ")", ".", "beanLifecycle", "(", "new", "ContextualLifecycle", "<", "EmbeddedCacheManager", ">", "(", ")", "{", "@", "Override", "public", "EmbeddedCacheManager", "create", "(", "Bean", "<", "EmbeddedCacheManager", ">", "bean", ",", "CreationalContext", "<", "EmbeddedCacheManager", ">", "creationalContext", ")", "{", "GlobalConfiguration", "globalConfiguration", "=", "new", "GlobalConfigurationBuilder", "(", ")", ".", "globalJmxStatistics", "(", ")", ".", "cacheManagerName", "(", "CACHE_NAME", ")", ".", "build", "(", ")", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Bean", "<", "Configuration", ">", "configurationBean", "=", "(", "Bean", "<", "Configuration", ">", ")", "beanManager", ".", "resolve", "(", "beanManager", ".", "getBeans", "(", "Configuration", ".", "class", ")", ")", ";", "Configuration", "defaultConfiguration", "=", "(", "Configuration", ")", "beanManager", ".", "getReference", "(", "configurationBean", ",", "Configuration", ".", "class", ",", "beanManager", ".", "createCreationalContext", "(", "configurationBean", ")", ")", ";", "return", "new", "DefaultCacheManager", "(", "globalConfiguration", ",", "defaultConfiguration", ")", ";", "}", "@", "Override", "public", "void", "destroy", "(", "Bean", "<", "EmbeddedCacheManager", ">", "bean", ",", "EmbeddedCacheManager", "instance", ",", "CreationalContext", "<", "EmbeddedCacheManager", ">", "creationalContext", ")", "{", "instance", ".", "stop", "(", ")", ";", "}", "}", ")", ".", "create", "(", ")", ";", "}" ]
The default cache manager is an instance of {@link DefaultCacheManager} initialized with the default configuration (either produced by {@link #createDefaultEmbeddedConfigurationBean(BeanManager)} or provided by user). The default cache manager can be overridden by creating a producer which produces the new default cache manager. The cache manager produced must have the scope {@link ApplicationScoped} and the {@linkplain javax.enterprise.inject.Default Default} qualifier. @param beanManager @return a custom bean
[ "The", "default", "cache", "manager", "is", "an", "instance", "of", "{", "@link", "DefaultCacheManager", "}", "initialized", "with", "the", "default", "configuration", "(", "either", "produced", "by", "{", "@link", "#createDefaultEmbeddedConfigurationBean", "(", "BeanManager", ")", "}", "or", "provided", "by", "user", ")", ".", "The", "default", "cache", "manager", "can", "be", "overridden", "by", "creating", "a", "producer", "which", "produces", "the", "new", "default", "cache", "manager", ".", "The", "cache", "manager", "produced", "must", "have", "the", "scope", "{", "@link", "ApplicationScoped", "}", "and", "the", "{", "@linkplain", "javax", ".", "enterprise", ".", "inject", ".", "Default", "Default", "}", "qualifier", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/cdi/embedded/src/main/java/org/infinispan/cdi/embedded/InfinispanExtensionEmbedded.java#L205-L233
google/closure-compiler
src/com/google/javascript/jscomp/PerformanceTracker.java
PerformanceTracker.recordPassStop
void recordPassStop(String passName, long runtime) { """ Collects information about a pass P after P finishes running, eg, how much time P took and what was its impact on code size. @param passName short name of the pass @param runtime execution time in milliseconds """ int allocMem = getAllocatedMegabytes(); Stats logStats = this.currentPass.pop(); checkState(passName.equals(logStats.pass)); this.log.add(logStats); // Update fields that aren't related to code size logStats.runtime = runtime; logStats.allocMem = allocMem; logStats.runs = 1; if (this.codeChange.hasCodeChanged()) { logStats.changes = 1; } if (passName.equals(PassNames.PARSE_INPUTS)) { recordParsingStop(logStats); } else if (this.codeChange.hasCodeChanged() && tracksAstSize()) { recordOtherPassStop(logStats); } }
java
void recordPassStop(String passName, long runtime) { int allocMem = getAllocatedMegabytes(); Stats logStats = this.currentPass.pop(); checkState(passName.equals(logStats.pass)); this.log.add(logStats); // Update fields that aren't related to code size logStats.runtime = runtime; logStats.allocMem = allocMem; logStats.runs = 1; if (this.codeChange.hasCodeChanged()) { logStats.changes = 1; } if (passName.equals(PassNames.PARSE_INPUTS)) { recordParsingStop(logStats); } else if (this.codeChange.hasCodeChanged() && tracksAstSize()) { recordOtherPassStop(logStats); } }
[ "void", "recordPassStop", "(", "String", "passName", ",", "long", "runtime", ")", "{", "int", "allocMem", "=", "getAllocatedMegabytes", "(", ")", ";", "Stats", "logStats", "=", "this", ".", "currentPass", ".", "pop", "(", ")", ";", "checkState", "(", "passName", ".", "equals", "(", "logStats", ".", "pass", ")", ")", ";", "this", ".", "log", ".", "add", "(", "logStats", ")", ";", "// Update fields that aren't related to code size", "logStats", ".", "runtime", "=", "runtime", ";", "logStats", ".", "allocMem", "=", "allocMem", ";", "logStats", ".", "runs", "=", "1", ";", "if", "(", "this", ".", "codeChange", ".", "hasCodeChanged", "(", ")", ")", "{", "logStats", ".", "changes", "=", "1", ";", "}", "if", "(", "passName", ".", "equals", "(", "PassNames", ".", "PARSE_INPUTS", ")", ")", "{", "recordParsingStop", "(", "logStats", ")", ";", "}", "else", "if", "(", "this", ".", "codeChange", ".", "hasCodeChanged", "(", ")", "&&", "tracksAstSize", "(", ")", ")", "{", "recordOtherPassStop", "(", "logStats", ")", ";", "}", "}" ]
Collects information about a pass P after P finishes running, eg, how much time P took and what was its impact on code size. @param passName short name of the pass @param runtime execution time in milliseconds
[ "Collects", "information", "about", "a", "pass", "P", "after", "P", "finishes", "running", "eg", "how", "much", "time", "P", "took", "and", "what", "was", "its", "impact", "on", "code", "size", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PerformanceTracker.java#L150-L168
StanKocken/EfficientAdapter
efficientadapter/src/main/java/com/skocken/efficientadapter/lib/util/ViewHelper.java
ViewHelper.setText
public static void setText(EfficientCacheView cacheView, int viewId, CharSequence text) { """ Equivalent to calling TextView.setText @param cacheView The cache of views to get the view from @param viewId The id of the view whose text should change @param text The new text for the view """ View view = cacheView.findViewByIdEfficient(viewId); if (view instanceof TextView) { ((TextView) view).setText(text); } }
java
public static void setText(EfficientCacheView cacheView, int viewId, CharSequence text) { View view = cacheView.findViewByIdEfficient(viewId); if (view instanceof TextView) { ((TextView) view).setText(text); } }
[ "public", "static", "void", "setText", "(", "EfficientCacheView", "cacheView", ",", "int", "viewId", ",", "CharSequence", "text", ")", "{", "View", "view", "=", "cacheView", ".", "findViewByIdEfficient", "(", "viewId", ")", ";", "if", "(", "view", "instanceof", "TextView", ")", "{", "(", "(", "TextView", ")", "view", ")", ".", "setText", "(", "text", ")", ";", "}", "}" ]
Equivalent to calling TextView.setText @param cacheView The cache of views to get the view from @param viewId The id of the view whose text should change @param text The new text for the view
[ "Equivalent", "to", "calling", "TextView", ".", "setText" ]
train
https://github.com/StanKocken/EfficientAdapter/blob/0bcc3a20182cbce9d7901e1e2a9104251637167d/efficientadapter/src/main/java/com/skocken/efficientadapter/lib/util/ViewHelper.java#L115-L120
twotoasters/RecyclerViewLib
library/src/main/java/com/twotoasters/anim/PendingItemAnimator.java
PendingItemAnimator.animateMoveImpl
protected ViewPropertyAnimatorCompat animateMoveImpl(final ViewHolder holder, int fromX, int fromY, int toX, int toY) { """ Preform your animation. You do not need to override this in most cases cause the default is pretty good. Listeners will be overridden * """ final View view = holder.itemView; final int deltaX = toX - fromX; final int deltaY = toY - fromY; ViewCompat.animate(view).cancel(); if (deltaX != 0) { ViewCompat.animate(view).translationX(0); } if (deltaY != 0) { ViewCompat.animate(view).translationY(0); } // TODO: make EndActions end listeners instead, since end actions aren't called when // vpas are canceled (and can't end them. why?) // need listener functionality in VPACompat for this. Ick. return ViewCompat.animate(view).setInterpolator(null).setDuration(getMoveDuration()); }
java
protected ViewPropertyAnimatorCompat animateMoveImpl(final ViewHolder holder, int fromX, int fromY, int toX, int toY) { final View view = holder.itemView; final int deltaX = toX - fromX; final int deltaY = toY - fromY; ViewCompat.animate(view).cancel(); if (deltaX != 0) { ViewCompat.animate(view).translationX(0); } if (deltaY != 0) { ViewCompat.animate(view).translationY(0); } // TODO: make EndActions end listeners instead, since end actions aren't called when // vpas are canceled (and can't end them. why?) // need listener functionality in VPACompat for this. Ick. return ViewCompat.animate(view).setInterpolator(null).setDuration(getMoveDuration()); }
[ "protected", "ViewPropertyAnimatorCompat", "animateMoveImpl", "(", "final", "ViewHolder", "holder", ",", "int", "fromX", ",", "int", "fromY", ",", "int", "toX", ",", "int", "toY", ")", "{", "final", "View", "view", "=", "holder", ".", "itemView", ";", "final", "int", "deltaX", "=", "toX", "-", "fromX", ";", "final", "int", "deltaY", "=", "toY", "-", "fromY", ";", "ViewCompat", ".", "animate", "(", "view", ")", ".", "cancel", "(", ")", ";", "if", "(", "deltaX", "!=", "0", ")", "{", "ViewCompat", ".", "animate", "(", "view", ")", ".", "translationX", "(", "0", ")", ";", "}", "if", "(", "deltaY", "!=", "0", ")", "{", "ViewCompat", ".", "animate", "(", "view", ")", ".", "translationY", "(", "0", ")", ";", "}", "// TODO: make EndActions end listeners instead, since end actions aren't called when", "// vpas are canceled (and can't end them. why?)", "// need listener functionality in VPACompat for this. Ick.", "return", "ViewCompat", ".", "animate", "(", "view", ")", ".", "setInterpolator", "(", "null", ")", ".", "setDuration", "(", "getMoveDuration", "(", ")", ")", ";", "}" ]
Preform your animation. You do not need to override this in most cases cause the default is pretty good. Listeners will be overridden *
[ "Preform", "your", "animation", ".", "You", "do", "not", "need", "to", "override", "this", "in", "most", "cases", "cause", "the", "default", "is", "pretty", "good", ".", "Listeners", "will", "be", "overridden", "*" ]
train
https://github.com/twotoasters/RecyclerViewLib/blob/2379fd5bbf57d4dfc8b28046b7ace950905c75f0/library/src/main/java/com/twotoasters/anim/PendingItemAnimator.java#L276-L291
baratine/baratine
kraken/src/main/java/com/caucho/v5/kraken/table/WatchServiceImpl.java
WatchServiceImpl.notifyWatch
@Override public void notifyWatch(TableKraken table, byte []key) { """ Notify local and remote watches for the given table and key @param table the table with the updated row @param key the key for the updated row """ WatchTable watchTable = _tableMap.get(table); if (watchTable != null) { watchTable.onPut(key, TableListener.TypePut.REMOTE); } }
java
@Override public void notifyWatch(TableKraken table, byte []key) { WatchTable watchTable = _tableMap.get(table); if (watchTable != null) { watchTable.onPut(key, TableListener.TypePut.REMOTE); } }
[ "@", "Override", "public", "void", "notifyWatch", "(", "TableKraken", "table", ",", "byte", "[", "]", "key", ")", "{", "WatchTable", "watchTable", "=", "_tableMap", ".", "get", "(", "table", ")", ";", "if", "(", "watchTable", "!=", "null", ")", "{", "watchTable", ".", "onPut", "(", "key", ",", "TableListener", ".", "TypePut", ".", "REMOTE", ")", ";", "}", "}" ]
Notify local and remote watches for the given table and key @param table the table with the updated row @param key the key for the updated row
[ "Notify", "local", "and", "remote", "watches", "for", "the", "given", "table", "and", "key" ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kraken/table/WatchServiceImpl.java#L212-L220
raydac/java-comment-preprocessor
jcp/src/main/java/com/igormaznitsa/jcp/context/PreprocessorContext.java
PreprocessorContext.setGlobalVariable
@Nonnull public PreprocessorContext setGlobalVariable(@Nonnull final String name, @Nonnull final Value value) { """ Set a global variable value @param name the variable name, it must not be null and will be normalized to the supported format @param value the variable value, it must not be null @return this preprocessor context """ assertNotNull("Variable name is null", name); final String normalizedName = assertNotNull(PreprocessorUtils.normalizeVariableName(name)); if (normalizedName.isEmpty()) { throw makeException("Name is empty", null); } assertNotNull("Value is null", value); if (mapVariableNameToSpecialVarProcessor.containsKey(normalizedName)) { mapVariableNameToSpecialVarProcessor.get(normalizedName).setVariable(normalizedName, value, this); } else { if (isVerbose()) { final String valueAsStr = value.toString(); if (globalVarTable.containsKey(normalizedName)) { logForVerbose("Replacing global variable [" + normalizedName + '=' + valueAsStr + ']'); } else { logForVerbose("Defining new global variable [" + normalizedName + '=' + valueAsStr + ']'); } } globalVarTable.put(normalizedName, value); } return this; }
java
@Nonnull public PreprocessorContext setGlobalVariable(@Nonnull final String name, @Nonnull final Value value) { assertNotNull("Variable name is null", name); final String normalizedName = assertNotNull(PreprocessorUtils.normalizeVariableName(name)); if (normalizedName.isEmpty()) { throw makeException("Name is empty", null); } assertNotNull("Value is null", value); if (mapVariableNameToSpecialVarProcessor.containsKey(normalizedName)) { mapVariableNameToSpecialVarProcessor.get(normalizedName).setVariable(normalizedName, value, this); } else { if (isVerbose()) { final String valueAsStr = value.toString(); if (globalVarTable.containsKey(normalizedName)) { logForVerbose("Replacing global variable [" + normalizedName + '=' + valueAsStr + ']'); } else { logForVerbose("Defining new global variable [" + normalizedName + '=' + valueAsStr + ']'); } } globalVarTable.put(normalizedName, value); } return this; }
[ "@", "Nonnull", "public", "PreprocessorContext", "setGlobalVariable", "(", "@", "Nonnull", "final", "String", "name", ",", "@", "Nonnull", "final", "Value", "value", ")", "{", "assertNotNull", "(", "\"Variable name is null\"", ",", "name", ")", ";", "final", "String", "normalizedName", "=", "assertNotNull", "(", "PreprocessorUtils", ".", "normalizeVariableName", "(", "name", ")", ")", ";", "if", "(", "normalizedName", ".", "isEmpty", "(", ")", ")", "{", "throw", "makeException", "(", "\"Name is empty\"", ",", "null", ")", ";", "}", "assertNotNull", "(", "\"Value is null\"", ",", "value", ")", ";", "if", "(", "mapVariableNameToSpecialVarProcessor", ".", "containsKey", "(", "normalizedName", ")", ")", "{", "mapVariableNameToSpecialVarProcessor", ".", "get", "(", "normalizedName", ")", ".", "setVariable", "(", "normalizedName", ",", "value", ",", "this", ")", ";", "}", "else", "{", "if", "(", "isVerbose", "(", ")", ")", "{", "final", "String", "valueAsStr", "=", "value", ".", "toString", "(", ")", ";", "if", "(", "globalVarTable", ".", "containsKey", "(", "normalizedName", ")", ")", "{", "logForVerbose", "(", "\"Replacing global variable [\"", "+", "normalizedName", "+", "'", "'", "+", "valueAsStr", "+", "'", "'", ")", ";", "}", "else", "{", "logForVerbose", "(", "\"Defining new global variable [\"", "+", "normalizedName", "+", "'", "'", "+", "valueAsStr", "+", "'", "'", ")", ";", "}", "}", "globalVarTable", ".", "put", "(", "normalizedName", ",", "value", ")", ";", "}", "return", "this", ";", "}" ]
Set a global variable value @param name the variable name, it must not be null and will be normalized to the supported format @param value the variable value, it must not be null @return this preprocessor context
[ "Set", "a", "global", "variable", "value" ]
train
https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/jcp/context/PreprocessorContext.java#L587-L613
davetcc/tcMenu
tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java
MenuTree.removeMenuItem
public void removeMenuItem(SubMenuItem parent, MenuItem item) { """ Remove the menu item for the provided menu item in the provided sub menu. @param parent the submenu to search @param item the item to remove (Search By ID) """ SubMenuItem subMenu = (parent != null) ? parent : ROOT; synchronized (subMenuItems) { ArrayList<MenuItem> subMenuChildren = subMenuItems.get(subMenu); if (subMenuChildren == null) { throw new UnsupportedOperationException("Menu element not found"); } subMenuChildren.remove(item); if (item.hasChildren()) { subMenuItems.remove(item); } } menuStates.remove(item.getId()); }
java
public void removeMenuItem(SubMenuItem parent, MenuItem item) { SubMenuItem subMenu = (parent != null) ? parent : ROOT; synchronized (subMenuItems) { ArrayList<MenuItem> subMenuChildren = subMenuItems.get(subMenu); if (subMenuChildren == null) { throw new UnsupportedOperationException("Menu element not found"); } subMenuChildren.remove(item); if (item.hasChildren()) { subMenuItems.remove(item); } } menuStates.remove(item.getId()); }
[ "public", "void", "removeMenuItem", "(", "SubMenuItem", "parent", ",", "MenuItem", "item", ")", "{", "SubMenuItem", "subMenu", "=", "(", "parent", "!=", "null", ")", "?", "parent", ":", "ROOT", ";", "synchronized", "(", "subMenuItems", ")", "{", "ArrayList", "<", "MenuItem", ">", "subMenuChildren", "=", "subMenuItems", ".", "get", "(", "subMenu", ")", ";", "if", "(", "subMenuChildren", "==", "null", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Menu element not found\"", ")", ";", "}", "subMenuChildren", ".", "remove", "(", "item", ")", ";", "if", "(", "item", ".", "hasChildren", "(", ")", ")", "{", "subMenuItems", ".", "remove", "(", "item", ")", ";", "}", "}", "menuStates", ".", "remove", "(", "item", ".", "getId", "(", ")", ")", ";", "}" ]
Remove the menu item for the provided menu item in the provided sub menu. @param parent the submenu to search @param item the item to remove (Search By ID)
[ "Remove", "the", "menu", "item", "for", "the", "provided", "menu", "item", "in", "the", "provided", "sub", "menu", "." ]
train
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java#L210-L225
undertow-io/undertow
core/src/main/java/io/undertow/websockets/core/WebSockets.java
WebSockets.sendBinary
public static <T> void sendBinary(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel, final WebSocketCallback<T> callback, T context) { """ Sends a complete binary message, invoking the callback when complete Automatically frees the pooled byte buffer when done. @param pooledData The data to send, it will be freed when done @param wsChannel The web socket channel @param callback The callback to invoke on completion @param context The context object that will be passed to the callback on completion """ sendInternal(pooledData, WebSocketFrameType.BINARY, wsChannel, callback, context, -1); }
java
public static <T> void sendBinary(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel, final WebSocketCallback<T> callback, T context) { sendInternal(pooledData, WebSocketFrameType.BINARY, wsChannel, callback, context, -1); }
[ "public", "static", "<", "T", ">", "void", "sendBinary", "(", "final", "PooledByteBuffer", "pooledData", ",", "final", "WebSocketChannel", "wsChannel", ",", "final", "WebSocketCallback", "<", "T", ">", "callback", ",", "T", "context", ")", "{", "sendInternal", "(", "pooledData", ",", "WebSocketFrameType", ".", "BINARY", ",", "wsChannel", ",", "callback", ",", "context", ",", "-", "1", ")", ";", "}" ]
Sends a complete binary message, invoking the callback when complete Automatically frees the pooled byte buffer when done. @param pooledData The data to send, it will be freed when done @param wsChannel The web socket channel @param callback The callback to invoke on completion @param context The context object that will be passed to the callback on completion
[ "Sends", "a", "complete", "binary", "message", "invoking", "the", "callback", "when", "complete", "Automatically", "frees", "the", "pooled", "byte", "buffer", "when", "done", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L699-L701
fabric8io/kubernetes-client
openshift-client/src/main/java/io/fabric8/openshift/client/dsl/internal/BuildConfigOperationsImpl.java
BuildConfigOperationsImpl.deleteBuilds
private void deleteBuilds() { """ /* Labels are limited to 63 chars so need to first truncate the build config name (if required), retrieve builds with matching label, then check the build config name against the builds' build config annotation which have no such length restriction (but aren't usable for searching). Would be better if referenced build config was available via fields but it currently isn't... """ if (getName() == null) { return; } String buildConfigLabelValue = getName().substring(0, Math.min(getName().length(), 63)); BuildList matchingBuilds = new BuildOperationsImpl(client, (OpenShiftConfig) config).inNamespace(namespace).withLabel(BUILD_CONFIG_LABEL, buildConfigLabelValue).list(); if (matchingBuilds.getItems() != null) { for (Build matchingBuild : matchingBuilds.getItems()) { if (matchingBuild.getMetadata() != null && matchingBuild.getMetadata().getAnnotations() != null && getName().equals(matchingBuild.getMetadata().getAnnotations().get(BUILD_CONFIG_ANNOTATION))) { new BuildOperationsImpl(client, (OpenShiftConfig) config).inNamespace(matchingBuild.getMetadata().getNamespace()).withName(matchingBuild.getMetadata().getName()).delete(); } } } }
java
private void deleteBuilds() { if (getName() == null) { return; } String buildConfigLabelValue = getName().substring(0, Math.min(getName().length(), 63)); BuildList matchingBuilds = new BuildOperationsImpl(client, (OpenShiftConfig) config).inNamespace(namespace).withLabel(BUILD_CONFIG_LABEL, buildConfigLabelValue).list(); if (matchingBuilds.getItems() != null) { for (Build matchingBuild : matchingBuilds.getItems()) { if (matchingBuild.getMetadata() != null && matchingBuild.getMetadata().getAnnotations() != null && getName().equals(matchingBuild.getMetadata().getAnnotations().get(BUILD_CONFIG_ANNOTATION))) { new BuildOperationsImpl(client, (OpenShiftConfig) config).inNamespace(matchingBuild.getMetadata().getNamespace()).withName(matchingBuild.getMetadata().getName()).delete(); } } } }
[ "private", "void", "deleteBuilds", "(", ")", "{", "if", "(", "getName", "(", ")", "==", "null", ")", "{", "return", ";", "}", "String", "buildConfigLabelValue", "=", "getName", "(", ")", ".", "substring", "(", "0", ",", "Math", ".", "min", "(", "getName", "(", ")", ".", "length", "(", ")", ",", "63", ")", ")", ";", "BuildList", "matchingBuilds", "=", "new", "BuildOperationsImpl", "(", "client", ",", "(", "OpenShiftConfig", ")", "config", ")", ".", "inNamespace", "(", "namespace", ")", ".", "withLabel", "(", "BUILD_CONFIG_LABEL", ",", "buildConfigLabelValue", ")", ".", "list", "(", ")", ";", "if", "(", "matchingBuilds", ".", "getItems", "(", ")", "!=", "null", ")", "{", "for", "(", "Build", "matchingBuild", ":", "matchingBuilds", ".", "getItems", "(", ")", ")", "{", "if", "(", "matchingBuild", ".", "getMetadata", "(", ")", "!=", "null", "&&", "matchingBuild", ".", "getMetadata", "(", ")", ".", "getAnnotations", "(", ")", "!=", "null", "&&", "getName", "(", ")", ".", "equals", "(", "matchingBuild", ".", "getMetadata", "(", ")", ".", "getAnnotations", "(", ")", ".", "get", "(", "BUILD_CONFIG_ANNOTATION", ")", ")", ")", "{", "new", "BuildOperationsImpl", "(", "client", ",", "(", "OpenShiftConfig", ")", "config", ")", ".", "inNamespace", "(", "matchingBuild", ".", "getMetadata", "(", ")", ".", "getNamespace", "(", ")", ")", ".", "withName", "(", "matchingBuild", ".", "getMetadata", "(", ")", ".", "getName", "(", ")", ")", ".", "delete", "(", ")", ";", "}", "}", "}", "}" ]
/* Labels are limited to 63 chars so need to first truncate the build config name (if required), retrieve builds with matching label, then check the build config name against the builds' build config annotation which have no such length restriction (but aren't usable for searching). Would be better if referenced build config was available via fields but it currently isn't...
[ "/", "*", "Labels", "are", "limited", "to", "63", "chars", "so", "need", "to", "first", "truncate", "the", "build", "config", "name", "(", "if", "required", ")", "retrieve", "builds", "with", "matching", "label", "then", "check", "the", "build", "config", "name", "against", "the", "builds", "build", "config", "annotation", "which", "have", "no", "such", "length", "restriction", "(", "but", "aren", "t", "usable", "for", "searching", ")", ".", "Would", "be", "better", "if", "referenced", "build", "config", "was", "available", "via", "fields", "but", "it", "currently", "isn", "t", "..." ]
train
https://github.com/fabric8io/kubernetes-client/blob/141668a882ed8e902c045a5cd0a80f14bd17d132/openshift-client/src/main/java/io/fabric8/openshift/client/dsl/internal/BuildConfigOperationsImpl.java#L178-L200
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java
VirtualNetworkGatewayConnectionsInner.getByResourceGroupAsync
public Observable<VirtualNetworkGatewayConnectionInner> getByResourceGroupAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName) { """ Gets the specified virtual network gateway connection by resource group. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualNetworkGatewayConnectionInner object """ return getByResourceGroupWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName).map(new Func1<ServiceResponse<VirtualNetworkGatewayConnectionInner>, VirtualNetworkGatewayConnectionInner>() { @Override public VirtualNetworkGatewayConnectionInner call(ServiceResponse<VirtualNetworkGatewayConnectionInner> response) { return response.body(); } }); }
java
public Observable<VirtualNetworkGatewayConnectionInner> getByResourceGroupAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName).map(new Func1<ServiceResponse<VirtualNetworkGatewayConnectionInner>, VirtualNetworkGatewayConnectionInner>() { @Override public VirtualNetworkGatewayConnectionInner call(ServiceResponse<VirtualNetworkGatewayConnectionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualNetworkGatewayConnectionInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayConnectionName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkGatewayConnectionName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VirtualNetworkGatewayConnectionInner", ">", ",", "VirtualNetworkGatewayConnectionInner", ">", "(", ")", "{", "@", "Override", "public", "VirtualNetworkGatewayConnectionInner", "call", "(", "ServiceResponse", "<", "VirtualNetworkGatewayConnectionInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets the specified virtual network gateway connection by resource group. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualNetworkGatewayConnectionInner object
[ "Gets", "the", "specified", "virtual", "network", "gateway", "connection", "by", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java#L331-L338
Microsoft/malmo
Minecraft/src/main/java/com/microsoft/Malmo/Utils/MapFileHelper.java
MapFileHelper.getNewSaveFileLocation
public static String getNewSaveFileLocation(boolean isTemporary) { """ Get a filename to use for creating a new Minecraft save map.<br> Ensure no duplicates. @param isTemporary mark the filename such that the file management code knows to delete this later @return a unique filename (relative to the saves folder) """ File dst; File savesDir = FMLClientHandler.instance().getSavesDir(); do { // We used to create filenames based on the current date/time, but this can cause problems when // multiple clients might be writing to the same save location. Instead, use a GUID: String s = UUID.randomUUID().toString(); // Add our port number, to help with file management: s = AddressHelper.getMissionControlPort() + "_" + s; // If this is a temp file, mark it as such: if (isTemporary) { s = tempMark + s; } dst = new File(savesDir, s); } while (dst.exists()); return dst.getName(); }
java
public static String getNewSaveFileLocation(boolean isTemporary) { File dst; File savesDir = FMLClientHandler.instance().getSavesDir(); do { // We used to create filenames based on the current date/time, but this can cause problems when // multiple clients might be writing to the same save location. Instead, use a GUID: String s = UUID.randomUUID().toString(); // Add our port number, to help with file management: s = AddressHelper.getMissionControlPort() + "_" + s; // If this is a temp file, mark it as such: if (isTemporary) { s = tempMark + s; } dst = new File(savesDir, s); } while (dst.exists()); return dst.getName(); }
[ "public", "static", "String", "getNewSaveFileLocation", "(", "boolean", "isTemporary", ")", "{", "File", "dst", ";", "File", "savesDir", "=", "FMLClientHandler", ".", "instance", "(", ")", ".", "getSavesDir", "(", ")", ";", "do", "{", "// We used to create filenames based on the current date/time, but this can cause problems when", "// multiple clients might be writing to the same save location. Instead, use a GUID:", "String", "s", "=", "UUID", ".", "randomUUID", "(", ")", ".", "toString", "(", ")", ";", "// Add our port number, to help with file management:", "s", "=", "AddressHelper", ".", "getMissionControlPort", "(", ")", "+", "\"_\"", "+", "s", ";", "// If this is a temp file, mark it as such:", "if", "(", "isTemporary", ")", "{", "s", "=", "tempMark", "+", "s", ";", "}", "dst", "=", "new", "File", "(", "savesDir", ",", "s", ")", ";", "}", "while", "(", "dst", ".", "exists", "(", ")", ")", ";", "return", "dst", ".", "getName", "(", ")", ";", "}" ]
Get a filename to use for creating a new Minecraft save map.<br> Ensure no duplicates. @param isTemporary mark the filename such that the file management code knows to delete this later @return a unique filename (relative to the saves folder)
[ "Get", "a", "filename", "to", "use", "for", "creating", "a", "new", "Minecraft", "save", "map", ".", "<br", ">", "Ensure", "no", "duplicates", "." ]
train
https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/MapFileHelper.java#L79-L99
jenkinsci/jenkins
core/src/main/java/jenkins/util/xml/XMLUtils.java
XMLUtils._transform
private static void _transform(Source source, Result out) throws TransformerException { """ potentially unsafe XML transformation. @param source The XML input to transform. @param out The Result of transforming the <code>source</code>. """ TransformerFactory factory = TransformerFactory.newInstance(); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); // this allows us to use UTF-8 for storing data, // plus it checks any well-formedness issue in the submitted data. Transformer t = factory.newTransformer(); t.transform(source, out); }
java
private static void _transform(Source source, Result out) throws TransformerException { TransformerFactory factory = TransformerFactory.newInstance(); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); // this allows us to use UTF-8 for storing data, // plus it checks any well-formedness issue in the submitted data. Transformer t = factory.newTransformer(); t.transform(source, out); }
[ "private", "static", "void", "_transform", "(", "Source", "source", ",", "Result", "out", ")", "throws", "TransformerException", "{", "TransformerFactory", "factory", "=", "TransformerFactory", ".", "newInstance", "(", ")", ";", "factory", ".", "setFeature", "(", "XMLConstants", ".", "FEATURE_SECURE_PROCESSING", ",", "true", ")", ";", "// this allows us to use UTF-8 for storing data,", "// plus it checks any well-formedness issue in the submitted data.", "Transformer", "t", "=", "factory", ".", "newTransformer", "(", ")", ";", "t", ".", "transform", "(", "source", ",", "out", ")", ";", "}" ]
potentially unsafe XML transformation. @param source The XML input to transform. @param out The Result of transforming the <code>source</code>.
[ "potentially", "unsafe", "XML", "transformation", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/util/xml/XMLUtils.java#L203-L211
mozilla/rhino
src/org/mozilla/javascript/NativeSet.java
NativeSet.loadFromIterable
static void loadFromIterable(Context cx, Scriptable scope, ScriptableObject set, Object arg1) { """ If an "iterable" object was passed to the constructor, there are many many things to do. This is common code with NativeWeakSet. """ if ((arg1 == null) || Undefined.instance.equals(arg1)) { return; } // Call the "[Symbol.iterator]" property as a function. Object ito = ScriptRuntime.callIterator(arg1, cx, scope); if (Undefined.instance.equals(ito)) { // Per spec, ignore if the iterator returns undefined return; } // Find the "add" function of our own prototype, since it might have // been replaced. Since we're not fully constructed yet, create a dummy instance // so that we can get our own prototype. ScriptableObject dummy = ensureScriptableObject(cx.newObject(scope, set.getClassName())); final Callable add = ScriptRuntime.getPropFunctionAndThis(dummy.getPrototype(), "add", cx, scope); // Clean up the value left around by the previous function ScriptRuntime.lastStoredScriptable(cx); // Finally, run through all the iterated values and add them! try (IteratorLikeIterable it = new IteratorLikeIterable(cx, scope, ito)) { for (Object val : it) { final Object finalVal = val == Scriptable.NOT_FOUND ? Undefined.instance : val; add.call(cx, scope, set, new Object[]{finalVal}); } } }
java
static void loadFromIterable(Context cx, Scriptable scope, ScriptableObject set, Object arg1) { if ((arg1 == null) || Undefined.instance.equals(arg1)) { return; } // Call the "[Symbol.iterator]" property as a function. Object ito = ScriptRuntime.callIterator(arg1, cx, scope); if (Undefined.instance.equals(ito)) { // Per spec, ignore if the iterator returns undefined return; } // Find the "add" function of our own prototype, since it might have // been replaced. Since we're not fully constructed yet, create a dummy instance // so that we can get our own prototype. ScriptableObject dummy = ensureScriptableObject(cx.newObject(scope, set.getClassName())); final Callable add = ScriptRuntime.getPropFunctionAndThis(dummy.getPrototype(), "add", cx, scope); // Clean up the value left around by the previous function ScriptRuntime.lastStoredScriptable(cx); // Finally, run through all the iterated values and add them! try (IteratorLikeIterable it = new IteratorLikeIterable(cx, scope, ito)) { for (Object val : it) { final Object finalVal = val == Scriptable.NOT_FOUND ? Undefined.instance : val; add.call(cx, scope, set, new Object[]{finalVal}); } } }
[ "static", "void", "loadFromIterable", "(", "Context", "cx", ",", "Scriptable", "scope", ",", "ScriptableObject", "set", ",", "Object", "arg1", ")", "{", "if", "(", "(", "arg1", "==", "null", ")", "||", "Undefined", ".", "instance", ".", "equals", "(", "arg1", ")", ")", "{", "return", ";", "}", "// Call the \"[Symbol.iterator]\" property as a function.", "Object", "ito", "=", "ScriptRuntime", ".", "callIterator", "(", "arg1", ",", "cx", ",", "scope", ")", ";", "if", "(", "Undefined", ".", "instance", ".", "equals", "(", "ito", ")", ")", "{", "// Per spec, ignore if the iterator returns undefined", "return", ";", "}", "// Find the \"add\" function of our own prototype, since it might have", "// been replaced. Since we're not fully constructed yet, create a dummy instance", "// so that we can get our own prototype.", "ScriptableObject", "dummy", "=", "ensureScriptableObject", "(", "cx", ".", "newObject", "(", "scope", ",", "set", ".", "getClassName", "(", ")", ")", ")", ";", "final", "Callable", "add", "=", "ScriptRuntime", ".", "getPropFunctionAndThis", "(", "dummy", ".", "getPrototype", "(", ")", ",", "\"add\"", ",", "cx", ",", "scope", ")", ";", "// Clean up the value left around by the previous function", "ScriptRuntime", ".", "lastStoredScriptable", "(", "cx", ")", ";", "// Finally, run through all the iterated values and add them!", "try", "(", "IteratorLikeIterable", "it", "=", "new", "IteratorLikeIterable", "(", "cx", ",", "scope", ",", "ito", ")", ")", "{", "for", "(", "Object", "val", ":", "it", ")", "{", "final", "Object", "finalVal", "=", "val", "==", "Scriptable", ".", "NOT_FOUND", "?", "Undefined", ".", "instance", ":", "val", ";", "add", ".", "call", "(", "cx", ",", "scope", ",", "set", ",", "new", "Object", "[", "]", "{", "finalVal", "}", ")", ";", "}", "}", "}" ]
If an "iterable" object was passed to the constructor, there are many many things to do. This is common code with NativeWeakSet.
[ "If", "an", "iterable", "object", "was", "passed", "to", "the", "constructor", "there", "are", "many", "many", "things", "to", "do", ".", "This", "is", "common", "code", "with", "NativeWeakSet", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/NativeSet.java#L155-L184
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/SimpleFormatterImpl.java
SimpleFormatterImpl.formatRawPattern
public static String formatRawPattern(String pattern, int min, int max, CharSequence... values) { """ Formats the not-compiled pattern with the given values. Equivalent to compileToStringMinMaxArguments() followed by formatCompiledPattern(). The number of arguments checked against the given limits is the highest argument number plus one, not the number of occurrences of arguments. @param pattern Not-compiled form of a pattern string. @param min The pattern must have at least this many arguments. @param max The pattern must have at most this many arguments. @return The compiled-pattern string. @throws IllegalArgumentException for bad argument syntax and too few or too many arguments. """ StringBuilder sb = new StringBuilder(); String compiledPattern = compileToStringMinMaxArguments(pattern, sb, min, max); sb.setLength(0); return formatAndAppend(compiledPattern, sb, null, values).toString(); }
java
public static String formatRawPattern(String pattern, int min, int max, CharSequence... values) { StringBuilder sb = new StringBuilder(); String compiledPattern = compileToStringMinMaxArguments(pattern, sb, min, max); sb.setLength(0); return formatAndAppend(compiledPattern, sb, null, values).toString(); }
[ "public", "static", "String", "formatRawPattern", "(", "String", "pattern", ",", "int", "min", ",", "int", "max", ",", "CharSequence", "...", "values", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "String", "compiledPattern", "=", "compileToStringMinMaxArguments", "(", "pattern", ",", "sb", ",", "min", ",", "max", ")", ";", "sb", ".", "setLength", "(", "0", ")", ";", "return", "formatAndAppend", "(", "compiledPattern", ",", "sb", ",", "null", ",", "values", ")", ".", "toString", "(", ")", ";", "}" ]
Formats the not-compiled pattern with the given values. Equivalent to compileToStringMinMaxArguments() followed by formatCompiledPattern(). The number of arguments checked against the given limits is the highest argument number plus one, not the number of occurrences of arguments. @param pattern Not-compiled form of a pattern string. @param min The pattern must have at least this many arguments. @param max The pattern must have at most this many arguments. @return The compiled-pattern string. @throws IllegalArgumentException for bad argument syntax and too few or too many arguments.
[ "Formats", "the", "not", "-", "compiled", "pattern", "with", "the", "given", "values", ".", "Equivalent", "to", "compileToStringMinMaxArguments", "()", "followed", "by", "formatCompiledPattern", "()", ".", "The", "number", "of", "arguments", "checked", "against", "the", "given", "limits", "is", "the", "highest", "argument", "number", "plus", "one", "not", "the", "number", "of", "occurrences", "of", "arguments", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/SimpleFormatterImpl.java#L205-L210
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.hosting_web_serviceName_cdn_duration_POST
public OvhOrder hosting_web_serviceName_cdn_duration_POST(String serviceName, String duration, OvhCdnOfferEnum offer) throws IOException { """ Create order REST: POST /order/hosting/web/{serviceName}/cdn/{duration} @param offer [required] Cdn offers you can add to your hosting @param serviceName [required] The internal name of your hosting @param duration [required] Duration """ String qPath = "/order/hosting/web/{serviceName}/cdn/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "offer", offer); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder hosting_web_serviceName_cdn_duration_POST(String serviceName, String duration, OvhCdnOfferEnum offer) throws IOException { String qPath = "/order/hosting/web/{serviceName}/cdn/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "offer", offer); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "hosting_web_serviceName_cdn_duration_POST", "(", "String", "serviceName", ",", "String", "duration", ",", "OvhCdnOfferEnum", "offer", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/hosting/web/{serviceName}/cdn/{duration}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "duration", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"offer\"", ",", "offer", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOrder", ".", "class", ")", ";", "}" ]
Create order REST: POST /order/hosting/web/{serviceName}/cdn/{duration} @param offer [required] Cdn offers you can add to your hosting @param serviceName [required] The internal name of your hosting @param duration [required] Duration
[ "Create", "order" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5013-L5020
duracloud/duracloud
durastore/src/main/java/org/duracloud/durastore/rest/SpaceResource.java
SpaceResource.updateSpaceACLs
public void updateSpaceACLs(String spaceID, Map<String, AclType> spaceACLs, String storeID) throws ResourceException { """ Updates the ACLs of a space. @param spaceID @param spaceACLs @param storeID """ try { StorageProvider storage = storageProviderFactory.getStorageProvider( storeID); if (null != spaceACLs) { storage.setSpaceACLs(spaceID, spaceACLs); } } catch (NotFoundException e) { throw new ResourceNotFoundException("update space ACLs for", spaceID, e); } catch (Exception e) { storageProviderFactory.expireStorageProvider(storeID); throw new ResourceException("update space ACLs for", spaceID, e); } }
java
public void updateSpaceACLs(String spaceID, Map<String, AclType> spaceACLs, String storeID) throws ResourceException { try { StorageProvider storage = storageProviderFactory.getStorageProvider( storeID); if (null != spaceACLs) { storage.setSpaceACLs(spaceID, spaceACLs); } } catch (NotFoundException e) { throw new ResourceNotFoundException("update space ACLs for", spaceID, e); } catch (Exception e) { storageProviderFactory.expireStorageProvider(storeID); throw new ResourceException("update space ACLs for", spaceID, e); } }
[ "public", "void", "updateSpaceACLs", "(", "String", "spaceID", ",", "Map", "<", "String", ",", "AclType", ">", "spaceACLs", ",", "String", "storeID", ")", "throws", "ResourceException", "{", "try", "{", "StorageProvider", "storage", "=", "storageProviderFactory", ".", "getStorageProvider", "(", "storeID", ")", ";", "if", "(", "null", "!=", "spaceACLs", ")", "{", "storage", ".", "setSpaceACLs", "(", "spaceID", ",", "spaceACLs", ")", ";", "}", "}", "catch", "(", "NotFoundException", "e", ")", "{", "throw", "new", "ResourceNotFoundException", "(", "\"update space ACLs for\"", ",", "spaceID", ",", "e", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "storageProviderFactory", ".", "expireStorageProvider", "(", "storeID", ")", ";", "throw", "new", "ResourceException", "(", "\"update space ACLs for\"", ",", "spaceID", ",", "e", ")", ";", "}", "}" ]
Updates the ACLs of a space. @param spaceID @param spaceACLs @param storeID
[ "Updates", "the", "ACLs", "of", "a", "space", "." ]
train
https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/durastore/src/main/java/org/duracloud/durastore/rest/SpaceResource.java#L221-L237
sdl/odata
odata_renderer/src/main/java/com/sdl/odata/unmarshaller/json/core/JsonNullableValidator.java
JsonNullableValidator.ensureCollection
public void ensureCollection(StructuredType entityType) throws ODataException { """ Ensure that non nullable collection are present. @param entityType entityType @throws ODataException If unable to ensure collection is present """ List<String> missingCollectionPropertyName = new ArrayList<>(); entityType.getStructuralProperties().stream() .filter(property -> (property.isCollection()) && !(property instanceof NavigationProperty) && !property.isNullable()).forEach(property -> { LOG.debug("Validating non-nullable collection property : {}", property.getName()); if (!fields.containsKey(property.getName())) { missingCollectionPropertyName.add(property.getName()); } }); if (missingCollectionPropertyName.size() != 0) { StringJoiner joiner = new StringJoiner(","); missingCollectionPropertyName.forEach(joiner::add); throw new ODataUnmarshallingException("The request does not specify the non-nullable collections: '" + joiner.toString() + "."); } }
java
public void ensureCollection(StructuredType entityType) throws ODataException { List<String> missingCollectionPropertyName = new ArrayList<>(); entityType.getStructuralProperties().stream() .filter(property -> (property.isCollection()) && !(property instanceof NavigationProperty) && !property.isNullable()).forEach(property -> { LOG.debug("Validating non-nullable collection property : {}", property.getName()); if (!fields.containsKey(property.getName())) { missingCollectionPropertyName.add(property.getName()); } }); if (missingCollectionPropertyName.size() != 0) { StringJoiner joiner = new StringJoiner(","); missingCollectionPropertyName.forEach(joiner::add); throw new ODataUnmarshallingException("The request does not specify the non-nullable collections: '" + joiner.toString() + "."); } }
[ "public", "void", "ensureCollection", "(", "StructuredType", "entityType", ")", "throws", "ODataException", "{", "List", "<", "String", ">", "missingCollectionPropertyName", "=", "new", "ArrayList", "<>", "(", ")", ";", "entityType", ".", "getStructuralProperties", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "property", "->", "(", "property", ".", "isCollection", "(", ")", ")", "&&", "!", "(", "property", "instanceof", "NavigationProperty", ")", "&&", "!", "property", ".", "isNullable", "(", ")", ")", ".", "forEach", "(", "property", "->", "{", "LOG", ".", "debug", "(", "\"Validating non-nullable collection property : {}\"", ",", "property", ".", "getName", "(", ")", ")", ";", "if", "(", "!", "fields", ".", "containsKey", "(", "property", ".", "getName", "(", ")", ")", ")", "{", "missingCollectionPropertyName", ".", "add", "(", "property", ".", "getName", "(", ")", ")", ";", "}", "}", ")", ";", "if", "(", "missingCollectionPropertyName", ".", "size", "(", ")", "!=", "0", ")", "{", "StringJoiner", "joiner", "=", "new", "StringJoiner", "(", "\",\"", ")", ";", "missingCollectionPropertyName", ".", "forEach", "(", "joiner", "::", "add", ")", ";", "throw", "new", "ODataUnmarshallingException", "(", "\"The request does not specify the non-nullable collections: '\"", "+", "joiner", ".", "toString", "(", ")", "+", "\".\"", ")", ";", "}", "}" ]
Ensure that non nullable collection are present. @param entityType entityType @throws ODataException If unable to ensure collection is present
[ "Ensure", "that", "non", "nullable", "collection", "are", "present", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/unmarshaller/json/core/JsonNullableValidator.java#L52-L70
hawkular/hawkular-apm
client/collector/src/main/java/org/hawkular/apm/client/collector/internal/DefaultTraceCollector.java
DefaultTraceCollector.processInContent
protected void processInContent(String location, FragmentBuilder builder, int hashCode) { """ This method processes the in content if available. @param location The instrumentation location @param builder The builder @param hashCode The hash code, or -1 to ignore the hash code """ if (builder.isInBufferActive(hashCode)) { processIn(location, null, builder.getInData(hashCode)); } else if (log.isLoggable(Level.FINEST)) { log.finest("processInContent: location=[" + location + "] hashCode=" + hashCode + " in buffer is not active"); } }
java
protected void processInContent(String location, FragmentBuilder builder, int hashCode) { if (builder.isInBufferActive(hashCode)) { processIn(location, null, builder.getInData(hashCode)); } else if (log.isLoggable(Level.FINEST)) { log.finest("processInContent: location=[" + location + "] hashCode=" + hashCode + " in buffer is not active"); } }
[ "protected", "void", "processInContent", "(", "String", "location", ",", "FragmentBuilder", "builder", ",", "int", "hashCode", ")", "{", "if", "(", "builder", ".", "isInBufferActive", "(", "hashCode", ")", ")", "{", "processIn", "(", "location", ",", "null", ",", "builder", ".", "getInData", "(", "hashCode", ")", ")", ";", "}", "else", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINEST", ")", ")", "{", "log", ".", "finest", "(", "\"processInContent: location=[\"", "+", "location", "+", "\"] hashCode=\"", "+", "hashCode", "+", "\" in buffer is not active\"", ")", ";", "}", "}" ]
This method processes the in content if available. @param location The instrumentation location @param builder The builder @param hashCode The hash code, or -1 to ignore the hash code
[ "This", "method", "processes", "the", "in", "content", "if", "available", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/collector/src/main/java/org/hawkular/apm/client/collector/internal/DefaultTraceCollector.java#L894-L901
twilio/twilio-java
src/main/java/com/twilio/rest/api/v2010/account/AvailablePhoneNumberCountryReader.java
AvailablePhoneNumberCountryReader.getPage
@Override @SuppressWarnings("checkstyle:linelength") public Page<AvailablePhoneNumberCountry> getPage(final String targetUrl, final TwilioRestClient client) { """ Retrieve the target page from the Twilio API. @param targetUrl API-generated URL for the requested results page @param client TwilioRestClient with which to make the request @return AvailablePhoneNumberCountry ResourceSet """ this.pathAccountSid = this.pathAccountSid == null ? client.getAccountSid() : this.pathAccountSid; Request request = new Request( HttpMethod.GET, targetUrl ); return pageForRequest(client, request); }
java
@Override @SuppressWarnings("checkstyle:linelength") public Page<AvailablePhoneNumberCountry> getPage(final String targetUrl, final TwilioRestClient client) { this.pathAccountSid = this.pathAccountSid == null ? client.getAccountSid() : this.pathAccountSid; Request request = new Request( HttpMethod.GET, targetUrl ); return pageForRequest(client, request); }
[ "@", "Override", "@", "SuppressWarnings", "(", "\"checkstyle:linelength\"", ")", "public", "Page", "<", "AvailablePhoneNumberCountry", ">", "getPage", "(", "final", "String", "targetUrl", ",", "final", "TwilioRestClient", "client", ")", "{", "this", ".", "pathAccountSid", "=", "this", ".", "pathAccountSid", "==", "null", "?", "client", ".", "getAccountSid", "(", ")", ":", "this", ".", "pathAccountSid", ";", "Request", "request", "=", "new", "Request", "(", "HttpMethod", ".", "GET", ",", "targetUrl", ")", ";", "return", "pageForRequest", "(", "client", ",", "request", ")", ";", "}" ]
Retrieve the target page from the Twilio API. @param targetUrl API-generated URL for the requested results page @param client TwilioRestClient with which to make the request @return AvailablePhoneNumberCountry ResourceSet
[ "Retrieve", "the", "target", "page", "from", "the", "Twilio", "API", "." ]
train
https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/api/v2010/account/AvailablePhoneNumberCountryReader.java#L80-L90
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritQueryHandler.java
GerritQueryHandler.queryJson
public List<String> queryJson(String queryString, boolean getPatchSets, boolean getCurrentPatchSet, boolean getFiles) throws SshException, IOException { """ Runs the query and returns the result as a list of JSON formatted strings. @param queryString the query. @param getPatchSets if all patch-sets of the projects found should be included in the result. Meaning if --patch-sets should be appended to the command call. @param getCurrentPatchSet if the current patch-set for the projects found should be included in the result. Meaning if --current-patch-set should be appended to the command call. @param getFiles if the files of the patch sets should be included in the result. Meaning if --files should be appended to the command call. @return a List of JSON formatted strings. @throws SshException if there is an error in the SSH Connection. @throws IOException for some other IO problem. """ return queryJson(queryString, getPatchSets, getCurrentPatchSet, getFiles, false); }
java
public List<String> queryJson(String queryString, boolean getPatchSets, boolean getCurrentPatchSet, boolean getFiles) throws SshException, IOException { return queryJson(queryString, getPatchSets, getCurrentPatchSet, getFiles, false); }
[ "public", "List", "<", "String", ">", "queryJson", "(", "String", "queryString", ",", "boolean", "getPatchSets", ",", "boolean", "getCurrentPatchSet", ",", "boolean", "getFiles", ")", "throws", "SshException", ",", "IOException", "{", "return", "queryJson", "(", "queryString", ",", "getPatchSets", ",", "getCurrentPatchSet", ",", "getFiles", ",", "false", ")", ";", "}" ]
Runs the query and returns the result as a list of JSON formatted strings. @param queryString the query. @param getPatchSets if all patch-sets of the projects found should be included in the result. Meaning if --patch-sets should be appended to the command call. @param getCurrentPatchSet if the current patch-set for the projects found should be included in the result. Meaning if --current-patch-set should be appended to the command call. @param getFiles if the files of the patch sets should be included in the result. Meaning if --files should be appended to the command call. @return a List of JSON formatted strings. @throws SshException if there is an error in the SSH Connection. @throws IOException for some other IO problem.
[ "Runs", "the", "query", "and", "returns", "the", "result", "as", "a", "list", "of", "JSON", "formatted", "strings", "." ]
train
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritQueryHandler.java#L290-L293
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/value/binary/TransientBinaryStore.java
TransientBinaryStore.newTempDirectory
private static File newTempDirectory() { """ Obtain a new temporary directory that can be used by a transient binary store. Note that none of the directories are actually created at this time, but are instead created (if needed) during {@link #initializeStorage(File)}. @return the new directory; never null """ String tempDirName = System.getProperty(JBOSS_SERVER_TMPDIR); if (tempDirName == null) { tempDirName = System.getProperty(JAVA_IO_TMPDIR); } if (tempDirName == null) { throw new SystemFailureException(JcrI18n.tempDirectorySystemPropertyMustBeSet.text(JAVA_IO_TMPDIR)); } File tempDir = new File(tempDirName); // Create a temporary directory in the "java.io.tmpdir" directory ... return new File(tempDir, "modeshape-binary-store"); }
java
private static File newTempDirectory() { String tempDirName = System.getProperty(JBOSS_SERVER_TMPDIR); if (tempDirName == null) { tempDirName = System.getProperty(JAVA_IO_TMPDIR); } if (tempDirName == null) { throw new SystemFailureException(JcrI18n.tempDirectorySystemPropertyMustBeSet.text(JAVA_IO_TMPDIR)); } File tempDir = new File(tempDirName); // Create a temporary directory in the "java.io.tmpdir" directory ... return new File(tempDir, "modeshape-binary-store"); }
[ "private", "static", "File", "newTempDirectory", "(", ")", "{", "String", "tempDirName", "=", "System", ".", "getProperty", "(", "JBOSS_SERVER_TMPDIR", ")", ";", "if", "(", "tempDirName", "==", "null", ")", "{", "tempDirName", "=", "System", ".", "getProperty", "(", "JAVA_IO_TMPDIR", ")", ";", "}", "if", "(", "tempDirName", "==", "null", ")", "{", "throw", "new", "SystemFailureException", "(", "JcrI18n", ".", "tempDirectorySystemPropertyMustBeSet", ".", "text", "(", "JAVA_IO_TMPDIR", ")", ")", ";", "}", "File", "tempDir", "=", "new", "File", "(", "tempDirName", ")", ";", "// Create a temporary directory in the \"java.io.tmpdir\" directory ...", "return", "new", "File", "(", "tempDir", ",", "\"modeshape-binary-store\"", ")", ";", "}" ]
Obtain a new temporary directory that can be used by a transient binary store. Note that none of the directories are actually created at this time, but are instead created (if needed) during {@link #initializeStorage(File)}. @return the new directory; never null
[ "Obtain", "a", "new", "temporary", "directory", "that", "can", "be", "used", "by", "a", "transient", "binary", "store", ".", "Note", "that", "none", "of", "the", "directories", "are", "actually", "created", "at", "this", "time", "but", "are", "instead", "created", "(", "if", "needed", ")", "during", "{", "@link", "#initializeStorage", "(", "File", ")", "}", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/value/binary/TransientBinaryStore.java#L54-L66
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/topography/ST_Drape.java
ST_Drape.processPolygon
private static Polygon processPolygon(Polygon p, Geometry triangleLines, GeometryFactory factory) { """ Cut the lines of the polygon with the triangles @param p @param triangleLines @param factory @return """ Geometry diffExt = p.getExteriorRing().difference(triangleLines); final int nbOfHoles = p.getNumInteriorRing(); final LinearRing[] holes = new LinearRing[nbOfHoles]; for (int i = 0; i < nbOfHoles; i++) { holes[i] = factory.createLinearRing(lineMerge(p.getInteriorRingN(i).difference(triangleLines), factory).getCoordinates()); } return factory.createPolygon(factory.createLinearRing(lineMerge(diffExt, factory).getCoordinates()), holes); }
java
private static Polygon processPolygon(Polygon p, Geometry triangleLines, GeometryFactory factory) { Geometry diffExt = p.getExteriorRing().difference(triangleLines); final int nbOfHoles = p.getNumInteriorRing(); final LinearRing[] holes = new LinearRing[nbOfHoles]; for (int i = 0; i < nbOfHoles; i++) { holes[i] = factory.createLinearRing(lineMerge(p.getInteriorRingN(i).difference(triangleLines), factory).getCoordinates()); } return factory.createPolygon(factory.createLinearRing(lineMerge(diffExt, factory).getCoordinates()), holes); }
[ "private", "static", "Polygon", "processPolygon", "(", "Polygon", "p", ",", "Geometry", "triangleLines", ",", "GeometryFactory", "factory", ")", "{", "Geometry", "diffExt", "=", "p", ".", "getExteriorRing", "(", ")", ".", "difference", "(", "triangleLines", ")", ";", "final", "int", "nbOfHoles", "=", "p", ".", "getNumInteriorRing", "(", ")", ";", "final", "LinearRing", "[", "]", "holes", "=", "new", "LinearRing", "[", "nbOfHoles", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nbOfHoles", ";", "i", "++", ")", "{", "holes", "[", "i", "]", "=", "factory", ".", "createLinearRing", "(", "lineMerge", "(", "p", ".", "getInteriorRingN", "(", "i", ")", ".", "difference", "(", "triangleLines", ")", ",", "factory", ")", ".", "getCoordinates", "(", ")", ")", ";", "}", "return", "factory", ".", "createPolygon", "(", "factory", ".", "createLinearRing", "(", "lineMerge", "(", "diffExt", ",", "factory", ")", ".", "getCoordinates", "(", ")", ")", ",", "holes", ")", ";", "}" ]
Cut the lines of the polygon with the triangles @param p @param triangleLines @param factory @return
[ "Cut", "the", "lines", "of", "the", "polygon", "with", "the", "triangles" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/topography/ST_Drape.java#L184-L193
JodaOrg/joda-time
src/main/java/org/joda/time/format/PeriodFormatterBuilder.java
PeriodFormatterBuilder.appendSuffix
public PeriodFormatterBuilder appendSuffix(String[] regularExpressions, String[] suffixes) { """ Append a field suffix which applies only to the last appended field. If the field is not printed, neither is the suffix. <p> The value is converted to String. During parsing, the suffix is selected based on the match with the regular expression. The index of the first regular expression that matches value converted to String nominates the suffix. If none of the regular expressions match the value converted to String then the last suffix is selected. <p> An example usage for English might look like this: <pre> appendSuffix(new String[] { &quot;&circ;1$&quot;, &quot;.*&quot; }, new String[] { &quot; year&quot;, &quot; years&quot; }) </pre> <p> Please note that for languages with simple mapping (singular and plural suffix only - like the one above) the {@link #appendSuffix(String, String)} method will result in a slightly faster formatter and that {@link #appendSuffix(String[], String[])} method should be only used when the mapping between values and prefixes is more complicated than the difference between singular and plural. @param regularExpressions an array of regular expressions, at least one element, length has to match the length of suffixes parameter @param suffixes an array of suffixes, at least one element, length has to match the length of regularExpressions parameter @return this PeriodFormatterBuilder @throws IllegalStateException if no field exists to append to @see #appendPrefix @since 2.5 """ if (regularExpressions == null || suffixes == null || regularExpressions.length < 1 || regularExpressions.length != suffixes.length) { throw new IllegalArgumentException(); } return appendSuffix(new RegExAffix(regularExpressions, suffixes)); }
java
public PeriodFormatterBuilder appendSuffix(String[] regularExpressions, String[] suffixes) { if (regularExpressions == null || suffixes == null || regularExpressions.length < 1 || regularExpressions.length != suffixes.length) { throw new IllegalArgumentException(); } return appendSuffix(new RegExAffix(regularExpressions, suffixes)); }
[ "public", "PeriodFormatterBuilder", "appendSuffix", "(", "String", "[", "]", "regularExpressions", ",", "String", "[", "]", "suffixes", ")", "{", "if", "(", "regularExpressions", "==", "null", "||", "suffixes", "==", "null", "||", "regularExpressions", ".", "length", "<", "1", "||", "regularExpressions", ".", "length", "!=", "suffixes", ".", "length", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "return", "appendSuffix", "(", "new", "RegExAffix", "(", "regularExpressions", ",", "suffixes", ")", ")", ";", "}" ]
Append a field suffix which applies only to the last appended field. If the field is not printed, neither is the suffix. <p> The value is converted to String. During parsing, the suffix is selected based on the match with the regular expression. The index of the first regular expression that matches value converted to String nominates the suffix. If none of the regular expressions match the value converted to String then the last suffix is selected. <p> An example usage for English might look like this: <pre> appendSuffix(new String[] { &quot;&circ;1$&quot;, &quot;.*&quot; }, new String[] { &quot; year&quot;, &quot; years&quot; }) </pre> <p> Please note that for languages with simple mapping (singular and plural suffix only - like the one above) the {@link #appendSuffix(String, String)} method will result in a slightly faster formatter and that {@link #appendSuffix(String[], String[])} method should be only used when the mapping between values and prefixes is more complicated than the difference between singular and plural. @param regularExpressions an array of regular expressions, at least one element, length has to match the length of suffixes parameter @param suffixes an array of suffixes, at least one element, length has to match the length of regularExpressions parameter @return this PeriodFormatterBuilder @throws IllegalStateException if no field exists to append to @see #appendPrefix @since 2.5
[ "Append", "a", "field", "suffix", "which", "applies", "only", "to", "the", "last", "appended", "field", ".", "If", "the", "field", "is", "not", "printed", "neither", "is", "the", "suffix", ".", "<p", ">", "The", "value", "is", "converted", "to", "String", ".", "During", "parsing", "the", "suffix", "is", "selected", "based", "on", "the", "match", "with", "the", "regular", "expression", ".", "The", "index", "of", "the", "first", "regular", "expression", "that", "matches", "value", "converted", "to", "String", "nominates", "the", "suffix", ".", "If", "none", "of", "the", "regular", "expressions", "match", "the", "value", "converted", "to", "String", "then", "the", "last", "suffix", "is", "selected", ".", "<p", ">", "An", "example", "usage", "for", "English", "might", "look", "like", "this", ":" ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/PeriodFormatterBuilder.java#L667-L673
actorapp/actor-platform
actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java
Messenger.registerApplePush
@ObjectiveCName("registerApplePushWithApnsId:withToken:") public void registerApplePush(int apnsId, String token) { """ Register apple push @param apnsId internal APNS cert key @param token APNS token """ modules.getPushesModule().registerApplePush(apnsId, token); }
java
@ObjectiveCName("registerApplePushWithApnsId:withToken:") public void registerApplePush(int apnsId, String token) { modules.getPushesModule().registerApplePush(apnsId, token); }
[ "@", "ObjectiveCName", "(", "\"registerApplePushWithApnsId:withToken:\"", ")", "public", "void", "registerApplePush", "(", "int", "apnsId", ",", "String", "token", ")", "{", "modules", ".", "getPushesModule", "(", ")", ".", "registerApplePush", "(", "apnsId", ",", "token", ")", ";", "}" ]
Register apple push @param apnsId internal APNS cert key @param token APNS token
[ "Register", "apple", "push" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java#L2688-L2691
googleapis/google-cloud-java
google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/KnowledgeBasesClient.java
KnowledgeBasesClient.createKnowledgeBase
public final KnowledgeBase createKnowledgeBase(ProjectName parent, KnowledgeBase knowledgeBase) { """ Creates a knowledge base. <p>Sample code: <pre><code> try (KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.create()) { ProjectName parent = ProjectName.of("[PROJECT]"); KnowledgeBase knowledgeBase = KnowledgeBase.newBuilder().build(); KnowledgeBase response = knowledgeBasesClient.createKnowledgeBase(parent, knowledgeBase); } </code></pre> @param parent Required. The project to create a knowledge base for. Format: `projects/&lt;Project ID&gt;`. @param knowledgeBase Required. The knowledge base to create. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ CreateKnowledgeBaseRequest request = CreateKnowledgeBaseRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setKnowledgeBase(knowledgeBase) .build(); return createKnowledgeBase(request); }
java
public final KnowledgeBase createKnowledgeBase(ProjectName parent, KnowledgeBase knowledgeBase) { CreateKnowledgeBaseRequest request = CreateKnowledgeBaseRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setKnowledgeBase(knowledgeBase) .build(); return createKnowledgeBase(request); }
[ "public", "final", "KnowledgeBase", "createKnowledgeBase", "(", "ProjectName", "parent", ",", "KnowledgeBase", "knowledgeBase", ")", "{", "CreateKnowledgeBaseRequest", "request", "=", "CreateKnowledgeBaseRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", "==", "null", "?", "null", ":", "parent", ".", "toString", "(", ")", ")", ".", "setKnowledgeBase", "(", "knowledgeBase", ")", ".", "build", "(", ")", ";", "return", "createKnowledgeBase", "(", "request", ")", ";", "}" ]
Creates a knowledge base. <p>Sample code: <pre><code> try (KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.create()) { ProjectName parent = ProjectName.of("[PROJECT]"); KnowledgeBase knowledgeBase = KnowledgeBase.newBuilder().build(); KnowledgeBase response = knowledgeBasesClient.createKnowledgeBase(parent, knowledgeBase); } </code></pre> @param parent Required. The project to create a knowledge base for. Format: `projects/&lt;Project ID&gt;`. @param knowledgeBase Required. The knowledge base to create. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "knowledge", "base", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/KnowledgeBasesClient.java#L405-L413
OpenTSDB/opentsdb
src/tools/CliUtils.java
CliUtils.toBytes
static byte[] toBytes(final String s) { """ Invokes the reflected {@code UniqueId.toBytes()} method with the given string using the UniqueId character set. @param s The string to convert to a byte array @return The byte array @throws RuntimeException if reflection failed """ try { return (byte[]) toBytes.invoke(null, s); } catch (Exception e) { throw new RuntimeException("toBytes=" + toBytes, e); } }
java
static byte[] toBytes(final String s) { try { return (byte[]) toBytes.invoke(null, s); } catch (Exception e) { throw new RuntimeException("toBytes=" + toBytes, e); } }
[ "static", "byte", "[", "]", "toBytes", "(", "final", "String", "s", ")", "{", "try", "{", "return", "(", "byte", "[", "]", ")", "toBytes", ".", "invoke", "(", "null", ",", "s", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"toBytes=\"", "+", "toBytes", ",", "e", ")", ";", "}", "}" ]
Invokes the reflected {@code UniqueId.toBytes()} method with the given string using the UniqueId character set. @param s The string to convert to a byte array @return The byte array @throws RuntimeException if reflection failed
[ "Invokes", "the", "reflected", "{" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/CliUtils.java#L245-L251
deeplearning4j/deeplearning4j
datavec/datavec-api/src/main/java/org/datavec/api/timeseries/util/TimeSeriesWritableUtils.java
TimeSeriesWritableUtils.convertWritablesSequence
public static Pair<INDArray, INDArray> convertWritablesSequence(List<List<List<Writable>>> timeSeriesRecord) { """ Convert the writables to a sequence (3d) data set, and also return the mask array (if necessary) @param timeSeriesRecord the input time series """ return convertWritablesSequence(timeSeriesRecord,getDetails(timeSeriesRecord)); }
java
public static Pair<INDArray, INDArray> convertWritablesSequence(List<List<List<Writable>>> timeSeriesRecord) { return convertWritablesSequence(timeSeriesRecord,getDetails(timeSeriesRecord)); }
[ "public", "static", "Pair", "<", "INDArray", ",", "INDArray", ">", "convertWritablesSequence", "(", "List", "<", "List", "<", "List", "<", "Writable", ">", ">", ">", "timeSeriesRecord", ")", "{", "return", "convertWritablesSequence", "(", "timeSeriesRecord", ",", "getDetails", "(", "timeSeriesRecord", ")", ")", ";", "}" ]
Convert the writables to a sequence (3d) data set, and also return the mask array (if necessary) @param timeSeriesRecord the input time series
[ "Convert", "the", "writables", "to", "a", "sequence", "(", "3d", ")", "data", "set", "and", "also", "return", "the", "mask", "array", "(", "if", "necessary", ")", "@param", "timeSeriesRecord", "the", "input", "time", "series" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/timeseries/util/TimeSeriesWritableUtils.java#L92-L94
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/gauges/AbstractRadial.java
AbstractRadial.createSection3DEffectGradient
protected RadialGradientPaint createSection3DEffectGradient(final int WIDTH, final float RADIUS_FACTOR) { """ Returns a radial gradient paint that will be used as overlay for the track or section image to achieve some kind of a 3d effect. @param WIDTH @param RADIUS_FACTOR : 0.38f for the standard radial gauge @return a radial gradient paint that will be used as overlay for the track or section image """ final float[] FRACTIONS; final Color[] COLORS; if (isExpandedSectionsEnabled()) { FRACTIONS = new float[]{ 0.0f, 0.7f, 0.75f, 0.96f, 1.0f }; COLORS = new Color[]{ new Color(0.0f, 0.0f, 0.0f, 1.0f), new Color(0.9f, 0.9f, 0.9f, 0.2f), new Color(1.0f, 1.0f, 1.0f, 0.5f), new Color(0.1843137255f, 0.1843137255f, 0.1843137255f, 0.3f), new Color(0.0f, 0.0f, 0.0f, 0.2f) }; } else { FRACTIONS = new float[]{ 0.0f, 0.89f, 0.955f, 1.0f }; COLORS = new Color[]{ new Color(0.0f, 0.0f, 0.0f, 0.0f), new Color(0.0f, 0.0f, 0.0f, 0.3f), new Color(1.0f, 1.0f, 1.0f, 0.6f), new Color(0.0f, 0.0f, 0.0f, 0.4f) }; } final Point2D GRADIENT_CENTER = new Point2D.Double(WIDTH / 2.0, WIDTH / 2.0); return new RadialGradientPaint(GRADIENT_CENTER, WIDTH * RADIUS_FACTOR, FRACTIONS, COLORS); }
java
protected RadialGradientPaint createSection3DEffectGradient(final int WIDTH, final float RADIUS_FACTOR) { final float[] FRACTIONS; final Color[] COLORS; if (isExpandedSectionsEnabled()) { FRACTIONS = new float[]{ 0.0f, 0.7f, 0.75f, 0.96f, 1.0f }; COLORS = new Color[]{ new Color(0.0f, 0.0f, 0.0f, 1.0f), new Color(0.9f, 0.9f, 0.9f, 0.2f), new Color(1.0f, 1.0f, 1.0f, 0.5f), new Color(0.1843137255f, 0.1843137255f, 0.1843137255f, 0.3f), new Color(0.0f, 0.0f, 0.0f, 0.2f) }; } else { FRACTIONS = new float[]{ 0.0f, 0.89f, 0.955f, 1.0f }; COLORS = new Color[]{ new Color(0.0f, 0.0f, 0.0f, 0.0f), new Color(0.0f, 0.0f, 0.0f, 0.3f), new Color(1.0f, 1.0f, 1.0f, 0.6f), new Color(0.0f, 0.0f, 0.0f, 0.4f) }; } final Point2D GRADIENT_CENTER = new Point2D.Double(WIDTH / 2.0, WIDTH / 2.0); return new RadialGradientPaint(GRADIENT_CENTER, WIDTH * RADIUS_FACTOR, FRACTIONS, COLORS); }
[ "protected", "RadialGradientPaint", "createSection3DEffectGradient", "(", "final", "int", "WIDTH", ",", "final", "float", "RADIUS_FACTOR", ")", "{", "final", "float", "[", "]", "FRACTIONS", ";", "final", "Color", "[", "]", "COLORS", ";", "if", "(", "isExpandedSectionsEnabled", "(", ")", ")", "{", "FRACTIONS", "=", "new", "float", "[", "]", "{", "0.0f", ",", "0.7f", ",", "0.75f", ",", "0.96f", ",", "1.0f", "}", ";", "COLORS", "=", "new", "Color", "[", "]", "{", "new", "Color", "(", "0.0f", ",", "0.0f", ",", "0.0f", ",", "1.0f", ")", ",", "new", "Color", "(", "0.9f", ",", "0.9f", ",", "0.9f", ",", "0.2f", ")", ",", "new", "Color", "(", "1.0f", ",", "1.0f", ",", "1.0f", ",", "0.5f", ")", ",", "new", "Color", "(", "0.1843137255f", ",", "0.1843137255f", ",", "0.1843137255f", ",", "0.3f", ")", ",", "new", "Color", "(", "0.0f", ",", "0.0f", ",", "0.0f", ",", "0.2f", ")", "}", ";", "}", "else", "{", "FRACTIONS", "=", "new", "float", "[", "]", "{", "0.0f", ",", "0.89f", ",", "0.955f", ",", "1.0f", "}", ";", "COLORS", "=", "new", "Color", "[", "]", "{", "new", "Color", "(", "0.0f", ",", "0.0f", ",", "0.0f", ",", "0.0f", ")", ",", "new", "Color", "(", "0.0f", ",", "0.0f", ",", "0.0f", ",", "0.3f", ")", ",", "new", "Color", "(", "1.0f", ",", "1.0f", ",", "1.0f", ",", "0.6f", ")", ",", "new", "Color", "(", "0.0f", ",", "0.0f", ",", "0.0f", ",", "0.4f", ")", "}", ";", "}", "final", "Point2D", "GRADIENT_CENTER", "=", "new", "Point2D", ".", "Double", "(", "WIDTH", "/", "2.0", ",", "WIDTH", "/", "2.0", ")", ";", "return", "new", "RadialGradientPaint", "(", "GRADIENT_CENTER", ",", "WIDTH", "*", "RADIUS_FACTOR", ",", "FRACTIONS", ",", "COLORS", ")", ";", "}" ]
Returns a radial gradient paint that will be used as overlay for the track or section image to achieve some kind of a 3d effect. @param WIDTH @param RADIUS_FACTOR : 0.38f for the standard radial gauge @return a radial gradient paint that will be used as overlay for the track or section image
[ "Returns", "a", "radial", "gradient", "paint", "that", "will", "be", "used", "as", "overlay", "for", "the", "track", "or", "section", "image", "to", "achieve", "some", "kind", "of", "a", "3d", "effect", "." ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/AbstractRadial.java#L1189-L1229
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.exportThrottledRequestsAsync
public Observable<LogAnalyticsOperationResultInner> exportThrottledRequestsAsync(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 for the request """ return exportThrottledRequestsWithServiceResponseAsync(location, parameters).map(new Func1<ServiceResponse<LogAnalyticsOperationResultInner>, LogAnalyticsOperationResultInner>() { @Override public LogAnalyticsOperationResultInner call(ServiceResponse<LogAnalyticsOperationResultInner> response) { return response.body(); } }); }
java
public Observable<LogAnalyticsOperationResultInner> exportThrottledRequestsAsync(String location, ThrottledRequestsInput parameters) { return exportThrottledRequestsWithServiceResponseAsync(location, parameters).map(new Func1<ServiceResponse<LogAnalyticsOperationResultInner>, LogAnalyticsOperationResultInner>() { @Override public LogAnalyticsOperationResultInner call(ServiceResponse<LogAnalyticsOperationResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "LogAnalyticsOperationResultInner", ">", "exportThrottledRequestsAsync", "(", "String", "location", ",", "ThrottledRequestsInput", "parameters", ")", "{", "return", "exportThrottledRequestsWithServiceResponseAsync", "(", "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 for the request
[ "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#L269-L276
rythmengine/spring-rythm
src/main/java/org/rythmengine/spring/web/util/ControllerUtil.java
ControllerUtil.renderBinary
protected static void renderBinary(InputStream is, String name, boolean inline) { """ Return a 200 OK application/binary response with content-disposition attachment. @param is The stream to copy @param name Name of file user is downloading. @param inline true to set the response Content-Disposition to inline """ throw new BinaryResult(is, name, inline); }
java
protected static void renderBinary(InputStream is, String name, boolean inline) { throw new BinaryResult(is, name, inline); }
[ "protected", "static", "void", "renderBinary", "(", "InputStream", "is", ",", "String", "name", ",", "boolean", "inline", ")", "{", "throw", "new", "BinaryResult", "(", "is", ",", "name", ",", "inline", ")", ";", "}" ]
Return a 200 OK application/binary response with content-disposition attachment. @param is The stream to copy @param name Name of file user is downloading. @param inline true to set the response Content-Disposition to inline
[ "Return", "a", "200", "OK", "application", "/", "binary", "response", "with", "content", "-", "disposition", "attachment", "." ]
train
https://github.com/rythmengine/spring-rythm/blob/a654016371c72dabaea50ac9a57626da7614d236/src/main/java/org/rythmengine/spring/web/util/ControllerUtil.java#L137-L139
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedDelayQueue.java
DistributedDelayQueue.putMulti
public boolean putMulti(MultiItem<T> items, long delayUntilEpoch, int maxWait, TimeUnit unit) throws Exception { """ Same as {@link #putMulti(MultiItem, long)} but allows a maximum wait time if an upper bound was set via {@link QueueBuilder#maxItems}. @param items items to add @param delayUntilEpoch future epoch (milliseconds) when this item will be available to consumers @param maxWait maximum wait @param unit wait unit @return true if items was added, false if timed out @throws Exception """ Preconditions.checkArgument(delayUntilEpoch > 0, "delayUntilEpoch cannot be negative"); queue.checkState(); return queue.internalPut(null, items, queue.makeItemPath() + epochToString(delayUntilEpoch), maxWait, unit); }
java
public boolean putMulti(MultiItem<T> items, long delayUntilEpoch, int maxWait, TimeUnit unit) throws Exception { Preconditions.checkArgument(delayUntilEpoch > 0, "delayUntilEpoch cannot be negative"); queue.checkState(); return queue.internalPut(null, items, queue.makeItemPath() + epochToString(delayUntilEpoch), maxWait, unit); }
[ "public", "boolean", "putMulti", "(", "MultiItem", "<", "T", ">", "items", ",", "long", "delayUntilEpoch", ",", "int", "maxWait", ",", "TimeUnit", "unit", ")", "throws", "Exception", "{", "Preconditions", ".", "checkArgument", "(", "delayUntilEpoch", ">", "0", ",", "\"delayUntilEpoch cannot be negative\"", ")", ";", "queue", ".", "checkState", "(", ")", ";", "return", "queue", ".", "internalPut", "(", "null", ",", "items", ",", "queue", ".", "makeItemPath", "(", ")", "+", "epochToString", "(", "delayUntilEpoch", ")", ",", "maxWait", ",", "unit", ")", ";", "}" ]
Same as {@link #putMulti(MultiItem, long)} but allows a maximum wait time if an upper bound was set via {@link QueueBuilder#maxItems}. @param items items to add @param delayUntilEpoch future epoch (milliseconds) when this item will be available to consumers @param maxWait maximum wait @param unit wait unit @return true if items was added, false if timed out @throws Exception
[ "Same", "as", "{", "@link", "#putMulti", "(", "MultiItem", "long", ")", "}", "but", "allows", "a", "maximum", "wait", "time", "if", "an", "upper", "bound", "was", "set", "via", "{", "@link", "QueueBuilder#maxItems", "}", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedDelayQueue.java#L191-L198
gosu-lang/gosu-lang
gosu-lab/src/main/java/editor/util/TextComponentUtil.java
TextComponentUtil.getWhiteSpaceLineStartBefore
public static int getWhiteSpaceLineStartBefore( String script, int start ) { """ Returns the start of the previous line if that line is only whitespace. Returns -1 otherwise. """ int startLine = getLineStart( script, start ); if( startLine > 0 ) { int nextLineEnd = startLine - 1; int previousLineStart = getLineStart( script, nextLineEnd ); boolean whitespace = GosuStringUtil.isWhitespace( script.substring( previousLineStart, nextLineEnd ) ); if( whitespace ) { return previousLineStart; } } return -1; }
java
public static int getWhiteSpaceLineStartBefore( String script, int start ) { int startLine = getLineStart( script, start ); if( startLine > 0 ) { int nextLineEnd = startLine - 1; int previousLineStart = getLineStart( script, nextLineEnd ); boolean whitespace = GosuStringUtil.isWhitespace( script.substring( previousLineStart, nextLineEnd ) ); if( whitespace ) { return previousLineStart; } } return -1; }
[ "public", "static", "int", "getWhiteSpaceLineStartBefore", "(", "String", "script", ",", "int", "start", ")", "{", "int", "startLine", "=", "getLineStart", "(", "script", ",", "start", ")", ";", "if", "(", "startLine", ">", "0", ")", "{", "int", "nextLineEnd", "=", "startLine", "-", "1", ";", "int", "previousLineStart", "=", "getLineStart", "(", "script", ",", "nextLineEnd", ")", ";", "boolean", "whitespace", "=", "GosuStringUtil", ".", "isWhitespace", "(", "script", ".", "substring", "(", "previousLineStart", ",", "nextLineEnd", ")", ")", ";", "if", "(", "whitespace", ")", "{", "return", "previousLineStart", ";", "}", "}", "return", "-", "1", ";", "}" ]
Returns the start of the previous line if that line is only whitespace. Returns -1 otherwise.
[ "Returns", "the", "start", "of", "the", "previous", "line", "if", "that", "line", "is", "only", "whitespace", ".", "Returns", "-", "1", "otherwise", "." ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/util/TextComponentUtil.java#L779-L793
jenkinsci/jenkins
core/src/main/java/hudson/util/ArgumentListBuilder.java
ArgumentListBuilder.addKeyValuePairsFromPropertyString
public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver<String> vr, Set<String> propsToMask) throws IOException { """ Adds key value pairs as "-Dkey=value -Dkey=value ..." by parsing a given string using {@link Properties} with masking. @param prefix The '-D' portion of the example. Defaults to -D if null. @param properties The persisted form of {@link Properties}. For example, "abc=def\nghi=jkl". Can be null, in which case this method becomes no-op. @param vr {@link VariableResolver} to resolve variables in properties string. @param propsToMask Set containing key names to mark as masked in the argument list. Key names that do not exist in the set will be added unmasked. @since 1.378 """ if(properties==null) return this; properties = Util.replaceMacro(properties, propertiesGeneratingResolver(vr)); for (Entry<Object,Object> entry : Util.loadProperties(properties).entrySet()) { addKeyValuePair(prefix, (String)entry.getKey(), entry.getValue().toString(), (propsToMask != null) && propsToMask.contains(entry.getKey())); } return this; }
java
public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver<String> vr, Set<String> propsToMask) throws IOException { if(properties==null) return this; properties = Util.replaceMacro(properties, propertiesGeneratingResolver(vr)); for (Entry<Object,Object> entry : Util.loadProperties(properties).entrySet()) { addKeyValuePair(prefix, (String)entry.getKey(), entry.getValue().toString(), (propsToMask != null) && propsToMask.contains(entry.getKey())); } return this; }
[ "public", "ArgumentListBuilder", "addKeyValuePairsFromPropertyString", "(", "String", "prefix", ",", "String", "properties", ",", "VariableResolver", "<", "String", ">", "vr", ",", "Set", "<", "String", ">", "propsToMask", ")", "throws", "IOException", "{", "if", "(", "properties", "==", "null", ")", "return", "this", ";", "properties", "=", "Util", ".", "replaceMacro", "(", "properties", ",", "propertiesGeneratingResolver", "(", "vr", ")", ")", ";", "for", "(", "Entry", "<", "Object", ",", "Object", ">", "entry", ":", "Util", ".", "loadProperties", "(", "properties", ")", ".", "entrySet", "(", ")", ")", "{", "addKeyValuePair", "(", "prefix", ",", "(", "String", ")", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ".", "toString", "(", ")", ",", "(", "propsToMask", "!=", "null", ")", "&&", "propsToMask", ".", "contains", "(", "entry", ".", "getKey", "(", ")", ")", ")", ";", "}", "return", "this", ";", "}" ]
Adds key value pairs as "-Dkey=value -Dkey=value ..." by parsing a given string using {@link Properties} with masking. @param prefix The '-D' portion of the example. Defaults to -D if null. @param properties The persisted form of {@link Properties}. For example, "abc=def\nghi=jkl". Can be null, in which case this method becomes no-op. @param vr {@link VariableResolver} to resolve variables in properties string. @param propsToMask Set containing key names to mark as masked in the argument list. Key names that do not exist in the set will be added unmasked. @since 1.378
[ "Adds", "key", "value", "pairs", "as", "-", "Dkey", "=", "value", "-", "Dkey", "=", "value", "...", "by", "parsing", "a", "given", "string", "using", "{", "@link", "Properties", "}", "with", "masking", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/ArgumentListBuilder.java#L227-L236
UrielCh/ovh-java-sdk
ovh-java-sdk-router/src/main/java/net/minidev/ovh/api/ApiOvhRouter.java
ApiOvhRouter.serviceName_network_POST
public OvhTask serviceName_network_POST(String serviceName, String description, String ipNet, Long vlanTag) throws IOException { """ Add a network to your router REST: POST /router/{serviceName}/network @param ipNet [required] Gateway IP / CIDR Netmask, (e.g. 192.168.1.254/24) @param description [required] @param vlanTag [required] Vlan tag from range 1 to 4094 or NULL for untagged traffic @param serviceName [required] The internal name of your Router offer """ String qPath = "/router/{serviceName}/network"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); addBody(o, "ipNet", ipNet); addBody(o, "vlanTag", vlanTag); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_network_POST(String serviceName, String description, String ipNet, Long vlanTag) throws IOException { String qPath = "/router/{serviceName}/network"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); addBody(o, "ipNet", ipNet); addBody(o, "vlanTag", vlanTag); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_network_POST", "(", "String", "serviceName", ",", "String", "description", ",", "String", "ipNet", ",", "Long", "vlanTag", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/router/{serviceName}/network\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"description\"", ",", "description", ")", ";", "addBody", "(", "o", ",", "\"ipNet\"", ",", "ipNet", ")", ";", "addBody", "(", "o", ",", "\"vlanTag\"", ",", "vlanTag", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhTask", ".", "class", ")", ";", "}" ]
Add a network to your router REST: POST /router/{serviceName}/network @param ipNet [required] Gateway IP / CIDR Netmask, (e.g. 192.168.1.254/24) @param description [required] @param vlanTag [required] Vlan tag from range 1 to 4094 or NULL for untagged traffic @param serviceName [required] The internal name of your Router offer
[ "Add", "a", "network", "to", "your", "router" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-router/src/main/java/net/minidev/ovh/api/ApiOvhRouter.java#L256-L265
jparsec/jparsec
jparsec/src/main/java/org/jparsec/Parser.java
Parser.ifelse
public final <R> Parser<R> ifelse(Parser<? extends R> consequence, Parser<? extends R> alternative) { """ A {@link Parser} that runs {@code consequence} if {@code this} succeeds, or {@code alternative} otherwise. """ return ifelse(__ -> consequence, alternative); }
java
public final <R> Parser<R> ifelse(Parser<? extends R> consequence, Parser<? extends R> alternative) { return ifelse(__ -> consequence, alternative); }
[ "public", "final", "<", "R", ">", "Parser", "<", "R", ">", "ifelse", "(", "Parser", "<", "?", "extends", "R", ">", "consequence", ",", "Parser", "<", "?", "extends", "R", ">", "alternative", ")", "{", "return", "ifelse", "(", "__", "->", "consequence", ",", "alternative", ")", ";", "}" ]
A {@link Parser} that runs {@code consequence} if {@code this} succeeds, or {@code alternative} otherwise.
[ "A", "{" ]
train
https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/Parser.java#L447-L449
EdwardRaff/JSAT
JSAT/src/jsat/linear/EigenValueDecomposition.java
EigenValueDecomposition.columnOpTransform
private static void columnOpTransform(Matrix M, int low, int high, int n, double q, double p, int shift) { """ Updates the columns of the matrix M such that <br><br> <code><br> for (int i = low; i <= high; i++)<br> {<br> &nbsp;&nbsp; z = M[i][n+shift];<br> &nbsp;&nbsp; M[i][n+shift] = q * z + p * M[i][n];<br> &nbsp;&nbsp; M[i][n] = q * M[i][n] - p * z;<br> }<br> </code> @param M the matrix to alter @param low the starting column (inclusive) @param high the ending column (inclusive) @param n the column to alter, and the preceding column will be altered as well @param q first constant @param p second constant @param shift the direction to perform the computation. Either 1 for after the current column, or -1 for before the current column. """ double z; for (int i = low; i <= high; i++) { z = M.get(i, n+shift); M.set(i, n+shift, q * z + p * M.get(i, n)); M.set(i, n, q * M.get(i, n) - p * z); } }
java
private static void columnOpTransform(Matrix M, int low, int high, int n, double q, double p, int shift) { double z; for (int i = low; i <= high; i++) { z = M.get(i, n+shift); M.set(i, n+shift, q * z + p * M.get(i, n)); M.set(i, n, q * M.get(i, n) - p * z); } }
[ "private", "static", "void", "columnOpTransform", "(", "Matrix", "M", ",", "int", "low", ",", "int", "high", ",", "int", "n", ",", "double", "q", ",", "double", "p", ",", "int", "shift", ")", "{", "double", "z", ";", "for", "(", "int", "i", "=", "low", ";", "i", "<=", "high", ";", "i", "++", ")", "{", "z", "=", "M", ".", "get", "(", "i", ",", "n", "+", "shift", ")", ";", "M", ".", "set", "(", "i", ",", "n", "+", "shift", ",", "q", "*", "z", "+", "p", "*", "M", ".", "get", "(", "i", ",", "n", ")", ")", ";", "M", ".", "set", "(", "i", ",", "n", ",", "q", "*", "M", ".", "get", "(", "i", ",", "n", ")", "-", "p", "*", "z", ")", ";", "}", "}" ]
Updates the columns of the matrix M such that <br><br> <code><br> for (int i = low; i <= high; i++)<br> {<br> &nbsp;&nbsp; z = M[i][n+shift];<br> &nbsp;&nbsp; M[i][n+shift] = q * z + p * M[i][n];<br> &nbsp;&nbsp; M[i][n] = q * M[i][n] - p * z;<br> }<br> </code> @param M the matrix to alter @param low the starting column (inclusive) @param high the ending column (inclusive) @param n the column to alter, and the preceding column will be altered as well @param q first constant @param p second constant @param shift the direction to perform the computation. Either 1 for after the current column, or -1 for before the current column.
[ "Updates", "the", "columns", "of", "the", "matrix", "M", "such", "that", "<br", ">", "<br", ">", "<code", ">", "<br", ">", "for", "(", "int", "i", "=", "low", ";", "i", "<", "=", "high", ";", "i", "++", ")", "<br", ">", "{", "<br", ">", "&nbsp", ";", "&nbsp", ";", "z", "=", "M", "[", "i", "]", "[", "n", "+", "shift", "]", ";", "<br", ">", "&nbsp", ";", "&nbsp", ";", "M", "[", "i", "]", "[", "n", "+", "shift", "]", "=", "q", "*", "z", "+", "p", "*", "M", "[", "i", "]", "[", "n", "]", ";", "<br", ">", "&nbsp", ";", "&nbsp", ";", "M", "[", "i", "]", "[", "n", "]", "=", "q", "*", "M", "[", "i", "]", "[", "n", "]", "-", "p", "*", "z", ";", "<br", ">", "}", "<br", ">", "<", "/", "code", ">" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/EigenValueDecomposition.java#L780-L789
aws/aws-sdk-java
aws-java-sdk-backup/src/main/java/com/amazonaws/services/backup/model/CreateBackupPlanRequest.java
CreateBackupPlanRequest.withBackupPlanTags
public CreateBackupPlanRequest withBackupPlanTags(java.util.Map<String, String> backupPlanTags) { """ <p> To help organize your resources, you can assign your own metadata to the resources that you create. Each tag is a key-value pair. The specified tags are assigned to all backups created with this plan. </p> @param backupPlanTags To help organize your resources, you can assign your own metadata to the resources that you create. Each tag is a key-value pair. The specified tags are assigned to all backups created with this plan. @return Returns a reference to this object so that method calls can be chained together. """ setBackupPlanTags(backupPlanTags); return this; }
java
public CreateBackupPlanRequest withBackupPlanTags(java.util.Map<String, String> backupPlanTags) { setBackupPlanTags(backupPlanTags); return this; }
[ "public", "CreateBackupPlanRequest", "withBackupPlanTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "backupPlanTags", ")", "{", "setBackupPlanTags", "(", "backupPlanTags", ")", ";", "return", "this", ";", "}" ]
<p> To help organize your resources, you can assign your own metadata to the resources that you create. Each tag is a key-value pair. The specified tags are assigned to all backups created with this plan. </p> @param backupPlanTags To help organize your resources, you can assign your own metadata to the resources that you create. Each tag is a key-value pair. The specified tags are assigned to all backups created with this plan. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "To", "help", "organize", "your", "resources", "you", "can", "assign", "your", "own", "metadata", "to", "the", "resources", "that", "you", "create", ".", "Each", "tag", "is", "a", "key", "-", "value", "pair", ".", "The", "specified", "tags", "are", "assigned", "to", "all", "backups", "created", "with", "this", "plan", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-backup/src/main/java/com/amazonaws/services/backup/model/CreateBackupPlanRequest.java#L138-L141
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkPeeringsInner.java
VirtualNetworkPeeringsInner.createOrUpdateAsync
public Observable<VirtualNetworkPeeringInner> createOrUpdateAsync(String resourceGroupName, String virtualNetworkName, String virtualNetworkPeeringName, VirtualNetworkPeeringInner virtualNetworkPeeringParameters) { """ Creates or updates a peering in the specified virtual network. @param resourceGroupName The name of the resource group. @param virtualNetworkName The name of the virtual network. @param virtualNetworkPeeringName The name of the peering. @param virtualNetworkPeeringParameters Parameters supplied to the create or update virtual network peering operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters).map(new Func1<ServiceResponse<VirtualNetworkPeeringInner>, VirtualNetworkPeeringInner>() { @Override public VirtualNetworkPeeringInner call(ServiceResponse<VirtualNetworkPeeringInner> response) { return response.body(); } }); }
java
public Observable<VirtualNetworkPeeringInner> createOrUpdateAsync(String resourceGroupName, String virtualNetworkName, String virtualNetworkPeeringName, VirtualNetworkPeeringInner virtualNetworkPeeringParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters).map(new Func1<ServiceResponse<VirtualNetworkPeeringInner>, VirtualNetworkPeeringInner>() { @Override public VirtualNetworkPeeringInner call(ServiceResponse<VirtualNetworkPeeringInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualNetworkPeeringInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkName", ",", "String", "virtualNetworkPeeringName", ",", "VirtualNetworkPeeringInner", "virtualNetworkPeeringParameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkName", ",", "virtualNetworkPeeringName", ",", "virtualNetworkPeeringParameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VirtualNetworkPeeringInner", ">", ",", "VirtualNetworkPeeringInner", ">", "(", ")", "{", "@", "Override", "public", "VirtualNetworkPeeringInner", "call", "(", "ServiceResponse", "<", "VirtualNetworkPeeringInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates or updates a peering in the specified virtual network. @param resourceGroupName The name of the resource group. @param virtualNetworkName The name of the virtual network. @param virtualNetworkPeeringName The name of the peering. @param virtualNetworkPeeringParameters Parameters supplied to the create or update virtual network peering operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "or", "updates", "a", "peering", "in", "the", "specified", "virtual", "network", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkPeeringsInner.java#L391-L398
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/StorageUtil.java
StorageUtil.toBoolean
public boolean toBoolean(Element el, String attributeName) { """ reads a XML Element Attribute ans cast it to a boolean value @param el XML Element to read Attribute from it @param attributeName Name of the Attribute to read @return Attribute Value """ return Caster.toBooleanValue(el.getAttribute(attributeName), false); }
java
public boolean toBoolean(Element el, String attributeName) { return Caster.toBooleanValue(el.getAttribute(attributeName), false); }
[ "public", "boolean", "toBoolean", "(", "Element", "el", ",", "String", "attributeName", ")", "{", "return", "Caster", ".", "toBooleanValue", "(", "el", ".", "getAttribute", "(", "attributeName", ")", ",", "false", ")", ";", "}" ]
reads a XML Element Attribute ans cast it to a boolean value @param el XML Element to read Attribute from it @param attributeName Name of the Attribute to read @return Attribute Value
[ "reads", "a", "XML", "Element", "Attribute", "ans", "cast", "it", "to", "a", "boolean", "value" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L186-L188
michel-kraemer/bson4jackson
src/main/java/de/undercouch/bson4jackson/BsonFactory.java
BsonFactory.configure
public final BsonFactory configure(BsonGenerator.Feature f, boolean state) { """ Method for enabling/disabling specified generator features (check {@link BsonGenerator.Feature} for list of features) @param f the feature to enable or disable @param state true if the feature should be enabled, false otherwise @return this BsonFactory """ if (state) { return enable(f); } return disable(f); }
java
public final BsonFactory configure(BsonGenerator.Feature f, boolean state) { if (state) { return enable(f); } return disable(f); }
[ "public", "final", "BsonFactory", "configure", "(", "BsonGenerator", ".", "Feature", "f", ",", "boolean", "state", ")", "{", "if", "(", "state", ")", "{", "return", "enable", "(", "f", ")", ";", "}", "return", "disable", "(", "f", ")", ";", "}" ]
Method for enabling/disabling specified generator features (check {@link BsonGenerator.Feature} for list of features) @param f the feature to enable or disable @param state true if the feature should be enabled, false otherwise @return this BsonFactory
[ "Method", "for", "enabling", "/", "disabling", "specified", "generator", "features", "(", "check", "{" ]
train
https://github.com/michel-kraemer/bson4jackson/blob/32d2ab3c516b3c07490fdfcf0c5e4ed0a2ee3979/src/main/java/de/undercouch/bson4jackson/BsonFactory.java#L116-L121
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java
CodeBuilderUtil.initialVersion
public static void initialVersion(CodeBuilder b, TypeDesc type, int value) throws SupportException { """ Generates code to push an initial version property value on the stack. @throws SupportException if version type is not supported """ adjustVersion(b, type, value, false); }
java
public static void initialVersion(CodeBuilder b, TypeDesc type, int value) throws SupportException { adjustVersion(b, type, value, false); }
[ "public", "static", "void", "initialVersion", "(", "CodeBuilder", "b", ",", "TypeDesc", "type", ",", "int", "value", ")", "throws", "SupportException", "{", "adjustVersion", "(", "b", ",", "type", ",", "value", ",", "false", ")", ";", "}" ]
Generates code to push an initial version property value on the stack. @throws SupportException if version type is not supported
[ "Generates", "code", "to", "push", "an", "initial", "version", "property", "value", "on", "the", "stack", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java#L685-L689
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/gauges/SparkLine.java
SparkLine.create_START_STOP_INDICATOR_Image
private BufferedImage create_START_STOP_INDICATOR_Image(final int WIDTH) { """ Returns a buffered image that contains the start/stop indicator @param WIDTH @return a buffered image that contains the start/stop indicator """ if (WIDTH <= 0) { return null; } // Define the size of the indicator int indicatorSize = (int) (0.015 * WIDTH); if (indicatorSize < 4) { indicatorSize = 4; } if (indicatorSize > 8) { indicatorSize = 8; } final BufferedImage IMAGE = UTIL.createImage(indicatorSize, indicatorSize, Transparency.TRANSLUCENT); final Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); G2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); G2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); final int IMAGE_WIDTH = IMAGE.getWidth(); final int IMAGE_HEIGHT = IMAGE.getHeight(); final Ellipse2D ELLIPSE = new Ellipse2D.Double(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT); final Point2D ELLIPSE_CENTER = new Point2D.Double((0.42857142857142855 * IMAGE_WIDTH), (0.2857142857142857 * IMAGE_HEIGHT)); final float[] ELLIPSE_FRACTIONS = { 0.0f, 0.01f, 0.99f, 1.0f }; final Color[] ELLIPSE_COLORS = { new Color(204, 204, 204, 255), new Color(204, 204, 204, 255), new Color(51, 51, 51, 255), new Color(51, 51, 51, 255) }; final RadialGradientPaint ELLIPSE_GRADIENT = new RadialGradientPaint(ELLIPSE_CENTER, (float) (0.5 * IMAGE_WIDTH), ELLIPSE_FRACTIONS, ELLIPSE_COLORS); G2.setPaint(ELLIPSE_GRADIENT); G2.fill(ELLIPSE); G2.dispose(); return IMAGE; }
java
private BufferedImage create_START_STOP_INDICATOR_Image(final int WIDTH) { if (WIDTH <= 0) { return null; } // Define the size of the indicator int indicatorSize = (int) (0.015 * WIDTH); if (indicatorSize < 4) { indicatorSize = 4; } if (indicatorSize > 8) { indicatorSize = 8; } final BufferedImage IMAGE = UTIL.createImage(indicatorSize, indicatorSize, Transparency.TRANSLUCENT); final Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); G2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); G2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); final int IMAGE_WIDTH = IMAGE.getWidth(); final int IMAGE_HEIGHT = IMAGE.getHeight(); final Ellipse2D ELLIPSE = new Ellipse2D.Double(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT); final Point2D ELLIPSE_CENTER = new Point2D.Double((0.42857142857142855 * IMAGE_WIDTH), (0.2857142857142857 * IMAGE_HEIGHT)); final float[] ELLIPSE_FRACTIONS = { 0.0f, 0.01f, 0.99f, 1.0f }; final Color[] ELLIPSE_COLORS = { new Color(204, 204, 204, 255), new Color(204, 204, 204, 255), new Color(51, 51, 51, 255), new Color(51, 51, 51, 255) }; final RadialGradientPaint ELLIPSE_GRADIENT = new RadialGradientPaint(ELLIPSE_CENTER, (float) (0.5 * IMAGE_WIDTH), ELLIPSE_FRACTIONS, ELLIPSE_COLORS); G2.setPaint(ELLIPSE_GRADIENT); G2.fill(ELLIPSE); G2.dispose(); return IMAGE; }
[ "private", "BufferedImage", "create_START_STOP_INDICATOR_Image", "(", "final", "int", "WIDTH", ")", "{", "if", "(", "WIDTH", "<=", "0", ")", "{", "return", "null", ";", "}", "// Define the size of the indicator", "int", "indicatorSize", "=", "(", "int", ")", "(", "0.015", "*", "WIDTH", ")", ";", "if", "(", "indicatorSize", "<", "4", ")", "{", "indicatorSize", "=", "4", ";", "}", "if", "(", "indicatorSize", ">", "8", ")", "{", "indicatorSize", "=", "8", ";", "}", "final", "BufferedImage", "IMAGE", "=", "UTIL", ".", "createImage", "(", "indicatorSize", ",", "indicatorSize", ",", "Transparency", ".", "TRANSLUCENT", ")", ";", "final", "Graphics2D", "G2", "=", "IMAGE", ".", "createGraphics", "(", ")", ";", "G2", ".", "setRenderingHint", "(", "RenderingHints", ".", "KEY_ANTIALIASING", ",", "RenderingHints", ".", "VALUE_ANTIALIAS_ON", ")", ";", "G2", ".", "setRenderingHint", "(", "RenderingHints", ".", "KEY_RENDERING", ",", "RenderingHints", ".", "VALUE_RENDER_QUALITY", ")", ";", "G2", ".", "setRenderingHint", "(", "RenderingHints", ".", "KEY_DITHERING", ",", "RenderingHints", ".", "VALUE_DITHER_ENABLE", ")", ";", "G2", ".", "setRenderingHint", "(", "RenderingHints", ".", "KEY_ALPHA_INTERPOLATION", ",", "RenderingHints", ".", "VALUE_ALPHA_INTERPOLATION_QUALITY", ")", ";", "G2", ".", "setRenderingHint", "(", "RenderingHints", ".", "KEY_COLOR_RENDERING", ",", "RenderingHints", ".", "VALUE_COLOR_RENDER_QUALITY", ")", ";", "G2", ".", "setRenderingHint", "(", "RenderingHints", ".", "KEY_STROKE_CONTROL", ",", "RenderingHints", ".", "VALUE_STROKE_NORMALIZE", ")", ";", "G2", ".", "setRenderingHint", "(", "RenderingHints", ".", "KEY_TEXT_ANTIALIASING", ",", "RenderingHints", ".", "VALUE_TEXT_ANTIALIAS_ON", ")", ";", "final", "int", "IMAGE_WIDTH", "=", "IMAGE", ".", "getWidth", "(", ")", ";", "final", "int", "IMAGE_HEIGHT", "=", "IMAGE", ".", "getHeight", "(", ")", ";", "final", "Ellipse2D", "ELLIPSE", "=", "new", "Ellipse2D", ".", "Double", "(", "0", ",", "0", ",", "IMAGE_WIDTH", ",", "IMAGE_HEIGHT", ")", ";", "final", "Point2D", "ELLIPSE_CENTER", "=", "new", "Point2D", ".", "Double", "(", "(", "0.42857142857142855", "*", "IMAGE_WIDTH", ")", ",", "(", "0.2857142857142857", "*", "IMAGE_HEIGHT", ")", ")", ";", "final", "float", "[", "]", "ELLIPSE_FRACTIONS", "=", "{", "0.0f", ",", "0.01f", ",", "0.99f", ",", "1.0f", "}", ";", "final", "Color", "[", "]", "ELLIPSE_COLORS", "=", "{", "new", "Color", "(", "204", ",", "204", ",", "204", ",", "255", ")", ",", "new", "Color", "(", "204", ",", "204", ",", "204", ",", "255", ")", ",", "new", "Color", "(", "51", ",", "51", ",", "51", ",", "255", ")", ",", "new", "Color", "(", "51", ",", "51", ",", "51", ",", "255", ")", "}", ";", "final", "RadialGradientPaint", "ELLIPSE_GRADIENT", "=", "new", "RadialGradientPaint", "(", "ELLIPSE_CENTER", ",", "(", "float", ")", "(", "0.5", "*", "IMAGE_WIDTH", ")", ",", "ELLIPSE_FRACTIONS", ",", "ELLIPSE_COLORS", ")", ";", "G2", ".", "setPaint", "(", "ELLIPSE_GRADIENT", ")", ";", "G2", ".", "fill", "(", "ELLIPSE", ")", ";", "G2", ".", "dispose", "(", ")", ";", "return", "IMAGE", ";", "}" ]
Returns a buffered image that contains the start/stop indicator @param WIDTH @return a buffered image that contains the start/stop indicator
[ "Returns", "a", "buffered", "image", "that", "contains", "the", "start", "/", "stop", "indicator" ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/SparkLine.java#L1577-L1625
xmlet/XsdAsmFaster
src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java
XsdAsmInterfaces.generateSequenceMethod
private void generateSequenceMethod(ClassWriter classWriter, String className, String javaType, String addingChildName, String typeName, String nextTypeName, String apiName) { """ <xs:element name="personInfo"> <xs:complexType> <xs:sequence> <xs:element name="firstName" type="xs:string"/> (...) Generates the method present in the sequence interface for a sequence element. Example: PersonInfoFirstName firstName(String firstName); @param classWriter The {@link ClassWriter} of the sequence interface. @param className The name of the class which contains the sequence. @param javaType The java type of the current sequence value. @param addingChildName The name of the child to be added. Based in the example above, it would be firstName. @param typeName The name of the current type, which would be PersonInfo based on the above example. @param nextTypeName The name of the next type, which would be PersonInfoFirstName based on the above example. @param apiName The name of the generated fluent interface. """ String type = getFullClassTypeName(typeName, apiName); String nextType = getFullClassTypeName(nextTypeName, apiName); String nextTypeDesc = getFullClassTypeNameDesc(nextTypeName, apiName); String addingType = getFullClassTypeName(addingChildName, apiName); javaType = javaType == null ? JAVA_STRING_DESC : javaType; MethodVisitor mVisitor = classWriter.visitMethod(ACC_PUBLIC, firstToLower(addingChildName), "(" + javaType + ")" + nextTypeDesc, "(" + javaType + ")L" + nextType + "<TZ;>;", null); mVisitor.visitLocalVariable(firstToLower(addingChildName), JAVA_STRING_DESC, null, new Label(), new Label(),1); mVisitor.visitCode(); mVisitor.visitTypeInsn(NEW, addingType); mVisitor.visitInsn(DUP); mVisitor.visitVarInsn(ALOAD, 0); mVisitor.visitVarInsn(ALOAD, 0); mVisitor.visitFieldInsn(GETFIELD, type, "visitor", elementVisitorTypeDesc); mVisitor.visitInsn(ICONST_1); mVisitor.visitMethodInsn(INVOKESPECIAL, addingType, CONSTRUCTOR, "(" + elementTypeDesc + elementVisitorTypeDesc + "Z)V", false); mVisitor.visitVarInsn(ALOAD, 1); mVisitor.visitMethodInsn(INVOKEVIRTUAL, addingType, "text", "(" + JAVA_OBJECT_DESC + ")" + elementTypeDesc, false); mVisitor.visitTypeInsn(CHECKCAST, addingType); mVisitor.visitMethodInsn(INVOKEVIRTUAL, addingType, "__", "()" + elementTypeDesc, false); mVisitor.visitInsn(POP); mVisitor.visitTypeInsn(NEW, nextType); mVisitor.visitInsn(DUP); mVisitor.visitVarInsn(ALOAD, 0); mVisitor.visitFieldInsn(GETFIELD, type, "parent", elementTypeDesc); mVisitor.visitVarInsn(ALOAD, 0); mVisitor.visitFieldInsn(GETFIELD, type, "visitor", elementVisitorTypeDesc); if (className.equals(nextTypeName)){ mVisitor.visitInsn(ICONST_0); } else { mVisitor.visitInsn(ICONST_1); } mVisitor.visitMethodInsn(INVOKESPECIAL, nextType, CONSTRUCTOR, "(" + elementTypeDesc + elementVisitorTypeDesc + "Z)V", false); mVisitor.visitInsn(ARETURN); mVisitor.visitMaxs(5, 2); mVisitor.visitEnd(); }
java
private void generateSequenceMethod(ClassWriter classWriter, String className, String javaType, String addingChildName, String typeName, String nextTypeName, String apiName) { String type = getFullClassTypeName(typeName, apiName); String nextType = getFullClassTypeName(nextTypeName, apiName); String nextTypeDesc = getFullClassTypeNameDesc(nextTypeName, apiName); String addingType = getFullClassTypeName(addingChildName, apiName); javaType = javaType == null ? JAVA_STRING_DESC : javaType; MethodVisitor mVisitor = classWriter.visitMethod(ACC_PUBLIC, firstToLower(addingChildName), "(" + javaType + ")" + nextTypeDesc, "(" + javaType + ")L" + nextType + "<TZ;>;", null); mVisitor.visitLocalVariable(firstToLower(addingChildName), JAVA_STRING_DESC, null, new Label(), new Label(),1); mVisitor.visitCode(); mVisitor.visitTypeInsn(NEW, addingType); mVisitor.visitInsn(DUP); mVisitor.visitVarInsn(ALOAD, 0); mVisitor.visitVarInsn(ALOAD, 0); mVisitor.visitFieldInsn(GETFIELD, type, "visitor", elementVisitorTypeDesc); mVisitor.visitInsn(ICONST_1); mVisitor.visitMethodInsn(INVOKESPECIAL, addingType, CONSTRUCTOR, "(" + elementTypeDesc + elementVisitorTypeDesc + "Z)V", false); mVisitor.visitVarInsn(ALOAD, 1); mVisitor.visitMethodInsn(INVOKEVIRTUAL, addingType, "text", "(" + JAVA_OBJECT_DESC + ")" + elementTypeDesc, false); mVisitor.visitTypeInsn(CHECKCAST, addingType); mVisitor.visitMethodInsn(INVOKEVIRTUAL, addingType, "__", "()" + elementTypeDesc, false); mVisitor.visitInsn(POP); mVisitor.visitTypeInsn(NEW, nextType); mVisitor.visitInsn(DUP); mVisitor.visitVarInsn(ALOAD, 0); mVisitor.visitFieldInsn(GETFIELD, type, "parent", elementTypeDesc); mVisitor.visitVarInsn(ALOAD, 0); mVisitor.visitFieldInsn(GETFIELD, type, "visitor", elementVisitorTypeDesc); if (className.equals(nextTypeName)){ mVisitor.visitInsn(ICONST_0); } else { mVisitor.visitInsn(ICONST_1); } mVisitor.visitMethodInsn(INVOKESPECIAL, nextType, CONSTRUCTOR, "(" + elementTypeDesc + elementVisitorTypeDesc + "Z)V", false); mVisitor.visitInsn(ARETURN); mVisitor.visitMaxs(5, 2); mVisitor.visitEnd(); }
[ "private", "void", "generateSequenceMethod", "(", "ClassWriter", "classWriter", ",", "String", "className", ",", "String", "javaType", ",", "String", "addingChildName", ",", "String", "typeName", ",", "String", "nextTypeName", ",", "String", "apiName", ")", "{", "String", "type", "=", "getFullClassTypeName", "(", "typeName", ",", "apiName", ")", ";", "String", "nextType", "=", "getFullClassTypeName", "(", "nextTypeName", ",", "apiName", ")", ";", "String", "nextTypeDesc", "=", "getFullClassTypeNameDesc", "(", "nextTypeName", ",", "apiName", ")", ";", "String", "addingType", "=", "getFullClassTypeName", "(", "addingChildName", ",", "apiName", ")", ";", "javaType", "=", "javaType", "==", "null", "?", "JAVA_STRING_DESC", ":", "javaType", ";", "MethodVisitor", "mVisitor", "=", "classWriter", ".", "visitMethod", "(", "ACC_PUBLIC", ",", "firstToLower", "(", "addingChildName", ")", ",", "\"(\"", "+", "javaType", "+", "\")\"", "+", "nextTypeDesc", ",", "\"(\"", "+", "javaType", "+", "\")L\"", "+", "nextType", "+", "\"<TZ;>;\"", ",", "null", ")", ";", "mVisitor", ".", "visitLocalVariable", "(", "firstToLower", "(", "addingChildName", ")", ",", "JAVA_STRING_DESC", ",", "null", ",", "new", "Label", "(", ")", ",", "new", "Label", "(", ")", ",", "1", ")", ";", "mVisitor", ".", "visitCode", "(", ")", ";", "mVisitor", ".", "visitTypeInsn", "(", "NEW", ",", "addingType", ")", ";", "mVisitor", ".", "visitInsn", "(", "DUP", ")", ";", "mVisitor", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mVisitor", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mVisitor", ".", "visitFieldInsn", "(", "GETFIELD", ",", "type", ",", "\"visitor\"", ",", "elementVisitorTypeDesc", ")", ";", "mVisitor", ".", "visitInsn", "(", "ICONST_1", ")", ";", "mVisitor", ".", "visitMethodInsn", "(", "INVOKESPECIAL", ",", "addingType", ",", "CONSTRUCTOR", ",", "\"(\"", "+", "elementTypeDesc", "+", "elementVisitorTypeDesc", "+", "\"Z)V\"", ",", "false", ")", ";", "mVisitor", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "mVisitor", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "addingType", ",", "\"text\"", ",", "\"(\"", "+", "JAVA_OBJECT_DESC", "+", "\")\"", "+", "elementTypeDesc", ",", "false", ")", ";", "mVisitor", ".", "visitTypeInsn", "(", "CHECKCAST", ",", "addingType", ")", ";", "mVisitor", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "addingType", ",", "\"__\"", ",", "\"()\"", "+", "elementTypeDesc", ",", "false", ")", ";", "mVisitor", ".", "visitInsn", "(", "POP", ")", ";", "mVisitor", ".", "visitTypeInsn", "(", "NEW", ",", "nextType", ")", ";", "mVisitor", ".", "visitInsn", "(", "DUP", ")", ";", "mVisitor", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mVisitor", ".", "visitFieldInsn", "(", "GETFIELD", ",", "type", ",", "\"parent\"", ",", "elementTypeDesc", ")", ";", "mVisitor", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mVisitor", ".", "visitFieldInsn", "(", "GETFIELD", ",", "type", ",", "\"visitor\"", ",", "elementVisitorTypeDesc", ")", ";", "if", "(", "className", ".", "equals", "(", "nextTypeName", ")", ")", "{", "mVisitor", ".", "visitInsn", "(", "ICONST_0", ")", ";", "}", "else", "{", "mVisitor", ".", "visitInsn", "(", "ICONST_1", ")", ";", "}", "mVisitor", ".", "visitMethodInsn", "(", "INVOKESPECIAL", ",", "nextType", ",", "CONSTRUCTOR", ",", "\"(\"", "+", "elementTypeDesc", "+", "elementVisitorTypeDesc", "+", "\"Z)V\"", ",", "false", ")", ";", "mVisitor", ".", "visitInsn", "(", "ARETURN", ")", ";", "mVisitor", ".", "visitMaxs", "(", "5", ",", "2", ")", ";", "mVisitor", ".", "visitEnd", "(", ")", ";", "}" ]
<xs:element name="personInfo"> <xs:complexType> <xs:sequence> <xs:element name="firstName" type="xs:string"/> (...) Generates the method present in the sequence interface for a sequence element. Example: PersonInfoFirstName firstName(String firstName); @param classWriter The {@link ClassWriter} of the sequence interface. @param className The name of the class which contains the sequence. @param javaType The java type of the current sequence value. @param addingChildName The name of the child to be added. Based in the example above, it would be firstName. @param typeName The name of the current type, which would be PersonInfo based on the above example. @param nextTypeName The name of the next type, which would be PersonInfoFirstName based on the above example. @param apiName The name of the generated fluent interface.
[ "<xs", ":", "element", "name", "=", "personInfo", ">", "<xs", ":", "complexType", ">", "<xs", ":", "sequence", ">", "<xs", ":", "element", "name", "=", "firstName", "type", "=", "xs", ":", "string", "/", ">", "(", "...", ")", "Generates", "the", "method", "present", "in", "the", "sequence", "interface", "for", "a", "sequence", "element", ".", "Example", ":", "PersonInfoFirstName", "firstName", "(", "String", "firstName", ")", ";" ]
train
https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java#L526-L566
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/NodeReportsInner.java
NodeReportsInner.listByNodeAsync
public Observable<Page<DscNodeReportInner>> listByNodeAsync(final String resourceGroupName, final String automationAccountName, final String nodeId) { """ Retrieve the Dsc node report list by node id. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param nodeId The parameters supplied to the list operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DscNodeReportInner&gt; object """ return listByNodeWithServiceResponseAsync(resourceGroupName, automationAccountName, nodeId) .map(new Func1<ServiceResponse<Page<DscNodeReportInner>>, Page<DscNodeReportInner>>() { @Override public Page<DscNodeReportInner> call(ServiceResponse<Page<DscNodeReportInner>> response) { return response.body(); } }); }
java
public Observable<Page<DscNodeReportInner>> listByNodeAsync(final String resourceGroupName, final String automationAccountName, final String nodeId) { return listByNodeWithServiceResponseAsync(resourceGroupName, automationAccountName, nodeId) .map(new Func1<ServiceResponse<Page<DscNodeReportInner>>, Page<DscNodeReportInner>>() { @Override public Page<DscNodeReportInner> call(ServiceResponse<Page<DscNodeReportInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "DscNodeReportInner", ">", ">", "listByNodeAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "automationAccountName", ",", "final", "String", "nodeId", ")", "{", "return", "listByNodeWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName", ",", "nodeId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "DscNodeReportInner", ">", ">", ",", "Page", "<", "DscNodeReportInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "DscNodeReportInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "DscNodeReportInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Retrieve the Dsc node report list by node id. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param nodeId The parameters supplied to the list operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DscNodeReportInner&gt; object
[ "Retrieve", "the", "Dsc", "node", "report", "list", "by", "node", "id", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/NodeReportsInner.java#L130-L138
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationsInner.java
DisasterRecoveryConfigurationsInner.beginFailoverAllowDataLoss
public void beginFailoverAllowDataLoss(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { """ Fails over from the current primary server to this server. This operation might result in data loss. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param disasterRecoveryConfigurationName The name of the disaster recovery configuration to failover forcefully. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ beginFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).toBlocking().single().body(); }
java
public void beginFailoverAllowDataLoss(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { beginFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).toBlocking().single().body(); }
[ "public", "void", "beginFailoverAllowDataLoss", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "disasterRecoveryConfigurationName", ")", "{", "beginFailoverAllowDataLossWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "disasterRecoveryConfigurationName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Fails over from the current primary server to this server. This operation might result in data loss. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param disasterRecoveryConfigurationName The name of the disaster recovery configuration to failover forcefully. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Fails", "over", "from", "the", "current", "primary", "server", "to", "this", "server", ".", "This", "operation", "might", "result", "in", "data", "loss", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationsInner.java#L877-L879
patka/cassandra-migration
cassandra-migration/src/main/java/org/cognitor/cassandra/migration/Database.java
Database.logMigration
private void logMigration(DbMigration migration, boolean wasSuccessful) { """ Inserts the result of the migration into the migration table @param migration the migration that was executed @param wasSuccessful indicates if the migration was successful or not """ BoundStatement boundStatement = logMigrationStatement.bind(wasSuccessful, migration.getVersion(), migration.getScriptName(), migration.getMigrationScript(), new Date()); session.execute(boundStatement); }
java
private void logMigration(DbMigration migration, boolean wasSuccessful) { BoundStatement boundStatement = logMigrationStatement.bind(wasSuccessful, migration.getVersion(), migration.getScriptName(), migration.getMigrationScript(), new Date()); session.execute(boundStatement); }
[ "private", "void", "logMigration", "(", "DbMigration", "migration", ",", "boolean", "wasSuccessful", ")", "{", "BoundStatement", "boundStatement", "=", "logMigrationStatement", ".", "bind", "(", "wasSuccessful", ",", "migration", ".", "getVersion", "(", ")", ",", "migration", ".", "getScriptName", "(", ")", ",", "migration", ".", "getMigrationScript", "(", ")", ",", "new", "Date", "(", ")", ")", ";", "session", ".", "execute", "(", "boundStatement", ")", ";", "}" ]
Inserts the result of the migration into the migration table @param migration the migration that was executed @param wasSuccessful indicates if the migration was successful or not
[ "Inserts", "the", "result", "of", "the", "migration", "into", "the", "migration", "table" ]
train
https://github.com/patka/cassandra-migration/blob/c61840c23b17a18df704d136909c26ff46bd5c77/cassandra-migration/src/main/java/org/cognitor/cassandra/migration/Database.java#L219-L223
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/RoaringBitmap.java
RoaringBitmap.andNot
@Deprecated public static RoaringBitmap andNot(final RoaringBitmap x1, final RoaringBitmap x2, final int rangeStart, final int rangeEnd) { """ Bitwise ANDNOT (difference) operation for the given range, rangeStart (inclusive) and rangeEnd (exclusive). The provided bitmaps are *not* modified. This operation is thread-safe as long as the provided bitmaps remain unchanged. @param x1 first bitmap @param x2 other bitmap @param rangeStart starting point of the range (inclusive) @param rangeEnd end point of the range (exclusive) @return result of the operation @deprecated use the version where longs specify the range. Negative values for range endpoints are not allowed. """ return andNot(x1, x2, (long) rangeStart, (long) rangeEnd); }
java
@Deprecated public static RoaringBitmap andNot(final RoaringBitmap x1, final RoaringBitmap x2, final int rangeStart, final int rangeEnd) { return andNot(x1, x2, (long) rangeStart, (long) rangeEnd); }
[ "@", "Deprecated", "public", "static", "RoaringBitmap", "andNot", "(", "final", "RoaringBitmap", "x1", ",", "final", "RoaringBitmap", "x2", ",", "final", "int", "rangeStart", ",", "final", "int", "rangeEnd", ")", "{", "return", "andNot", "(", "x1", ",", "x2", ",", "(", "long", ")", "rangeStart", ",", "(", "long", ")", "rangeEnd", ")", ";", "}" ]
Bitwise ANDNOT (difference) operation for the given range, rangeStart (inclusive) and rangeEnd (exclusive). The provided bitmaps are *not* modified. This operation is thread-safe as long as the provided bitmaps remain unchanged. @param x1 first bitmap @param x2 other bitmap @param rangeStart starting point of the range (inclusive) @param rangeEnd end point of the range (exclusive) @return result of the operation @deprecated use the version where longs specify the range. Negative values for range endpoints are not allowed.
[ "Bitwise", "ANDNOT", "(", "difference", ")", "operation", "for", "the", "given", "range", "rangeStart", "(", "inclusive", ")", "and", "rangeEnd", "(", "exclusive", ")", ".", "The", "provided", "bitmaps", "are", "*", "not", "*", "modified", ".", "This", "operation", "is", "thread", "-", "safe", "as", "long", "as", "the", "provided", "bitmaps", "remain", "unchanged", "." ]
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/RoaringBitmap.java#L1294-L1298
grails/grails-core
grails-spring/src/main/groovy/grails/spring/BeanBuilder.java
BeanBuilder.xmlns
public void xmlns(Map<String, String> definition) { """ Defines a Spring namespace definition to use. @param definition The definition """ Assert.notNull(namespaceHandlerResolver, "You cannot define a Spring namespace without a [namespaceHandlerResolver] set"); if (definition.isEmpty()) { return; } for (Map.Entry<String, String> entry : definition.entrySet()) { String namespace = entry.getKey(); String uri = entry.getValue() == null ? null : entry.getValue(); Assert.notNull(uri, "Namespace definition cannot supply a null URI"); final NamespaceHandler namespaceHandler = namespaceHandlerResolver.resolve(uri); if (namespaceHandler == null) { throw new BeanDefinitionParsingException( new Problem("No namespace handler found for URI: " + uri, new Location(readerContext.getResource()))); } namespaceHandlers.put(namespace, namespaceHandler); namespaces.put(namespace, uri); } }
java
public void xmlns(Map<String, String> definition) { Assert.notNull(namespaceHandlerResolver, "You cannot define a Spring namespace without a [namespaceHandlerResolver] set"); if (definition.isEmpty()) { return; } for (Map.Entry<String, String> entry : definition.entrySet()) { String namespace = entry.getKey(); String uri = entry.getValue() == null ? null : entry.getValue(); Assert.notNull(uri, "Namespace definition cannot supply a null URI"); final NamespaceHandler namespaceHandler = namespaceHandlerResolver.resolve(uri); if (namespaceHandler == null) { throw new BeanDefinitionParsingException( new Problem("No namespace handler found for URI: " + uri, new Location(readerContext.getResource()))); } namespaceHandlers.put(namespace, namespaceHandler); namespaces.put(namespace, uri); } }
[ "public", "void", "xmlns", "(", "Map", "<", "String", ",", "String", ">", "definition", ")", "{", "Assert", ".", "notNull", "(", "namespaceHandlerResolver", ",", "\"You cannot define a Spring namespace without a [namespaceHandlerResolver] set\"", ")", ";", "if", "(", "definition", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "definition", ".", "entrySet", "(", ")", ")", "{", "String", "namespace", "=", "entry", ".", "getKey", "(", ")", ";", "String", "uri", "=", "entry", ".", "getValue", "(", ")", "==", "null", "?", "null", ":", "entry", ".", "getValue", "(", ")", ";", "Assert", ".", "notNull", "(", "uri", ",", "\"Namespace definition cannot supply a null URI\"", ")", ";", "final", "NamespaceHandler", "namespaceHandler", "=", "namespaceHandlerResolver", ".", "resolve", "(", "uri", ")", ";", "if", "(", "namespaceHandler", "==", "null", ")", "{", "throw", "new", "BeanDefinitionParsingException", "(", "new", "Problem", "(", "\"No namespace handler found for URI: \"", "+", "uri", ",", "new", "Location", "(", "readerContext", ".", "getResource", "(", ")", ")", ")", ")", ";", "}", "namespaceHandlers", ".", "put", "(", "namespace", ",", "namespaceHandler", ")", ";", "namespaces", ".", "put", "(", "namespace", ",", "uri", ")", ";", "}", "}" ]
Defines a Spring namespace definition to use. @param definition The definition
[ "Defines", "a", "Spring", "namespace", "definition", "to", "use", "." ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-spring/src/main/groovy/grails/spring/BeanBuilder.java#L220-L241
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/cluster/RedisClusterClient.java
RedisClusterClient.forEachCloseable
@SuppressWarnings("unchecked") protected <T extends Closeable> void forEachCloseable(Predicate<? super Closeable> selector, Consumer<T> function) { """ Apply a {@link Consumer} of {@link Closeable} to all active connections. @param <T> @param function the {@link Consumer}. """ for (Closeable c : closeableResources) { if (selector.test(c)) { function.accept((T) c); } } }
java
@SuppressWarnings("unchecked") protected <T extends Closeable> void forEachCloseable(Predicate<? super Closeable> selector, Consumer<T> function) { for (Closeable c : closeableResources) { if (selector.test(c)) { function.accept((T) c); } } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "<", "T", "extends", "Closeable", ">", "void", "forEachCloseable", "(", "Predicate", "<", "?", "super", "Closeable", ">", "selector", ",", "Consumer", "<", "T", ">", "function", ")", "{", "for", "(", "Closeable", "c", ":", "closeableResources", ")", "{", "if", "(", "selector", ".", "test", "(", "c", ")", ")", "{", "function", ".", "accept", "(", "(", "T", ")", "c", ")", ";", "}", "}", "}" ]
Apply a {@link Consumer} of {@link Closeable} to all active connections. @param <T> @param function the {@link Consumer}.
[ "Apply", "a", "{", "@link", "Consumer", "}", "of", "{", "@link", "Closeable", "}", "to", "all", "active", "connections", "." ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/cluster/RedisClusterClient.java#L1061-L1068
nostra13/Android-Universal-Image-Loader
library/src/main/java/com/nostra13/universalimageloader/core/ImageLoader.java
ImageLoader.loadImageSync
public Bitmap loadImageSync(String uri, ImageSize targetImageSize, DisplayImageOptions options) { """ Loads and decodes image synchronously.<br /> <b>NOTE:</b> {@link #init(ImageLoaderConfiguration)} method must be called before this method call @param uri Image URI (i.e. "http://site.com/image.png", "file:///mnt/sdcard/image.png") @param targetImageSize Minimal size for {@link Bitmap} which will be returned. Downloaded image will be decoded and scaled to {@link Bitmap} of the size which is <b>equal or larger</b> (usually a bit larger) than incoming targetImageSize. @param options {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions Options} for image decoding and scaling. If <b>null</b> - default display image options {@linkplain ImageLoaderConfiguration.Builder#defaultDisplayImageOptions(DisplayImageOptions) from configuration} will be used. @return Result image Bitmap. Can be <b>null</b> if image loading/decoding was failed or cancelled. @throws IllegalStateException if {@link #init(ImageLoaderConfiguration)} method wasn't called before """ if (options == null) { options = configuration.defaultDisplayImageOptions; } options = new DisplayImageOptions.Builder().cloneFrom(options).syncLoading(true).build(); SyncImageLoadingListener listener = new SyncImageLoadingListener(); loadImage(uri, targetImageSize, options, listener); return listener.getLoadedBitmap(); }
java
public Bitmap loadImageSync(String uri, ImageSize targetImageSize, DisplayImageOptions options) { if (options == null) { options = configuration.defaultDisplayImageOptions; } options = new DisplayImageOptions.Builder().cloneFrom(options).syncLoading(true).build(); SyncImageLoadingListener listener = new SyncImageLoadingListener(); loadImage(uri, targetImageSize, options, listener); return listener.getLoadedBitmap(); }
[ "public", "Bitmap", "loadImageSync", "(", "String", "uri", ",", "ImageSize", "targetImageSize", ",", "DisplayImageOptions", "options", ")", "{", "if", "(", "options", "==", "null", ")", "{", "options", "=", "configuration", ".", "defaultDisplayImageOptions", ";", "}", "options", "=", "new", "DisplayImageOptions", ".", "Builder", "(", ")", ".", "cloneFrom", "(", "options", ")", ".", "syncLoading", "(", "true", ")", ".", "build", "(", ")", ";", "SyncImageLoadingListener", "listener", "=", "new", "SyncImageLoadingListener", "(", ")", ";", "loadImage", "(", "uri", ",", "targetImageSize", ",", "options", ",", "listener", ")", ";", "return", "listener", ".", "getLoadedBitmap", "(", ")", ";", "}" ]
Loads and decodes image synchronously.<br /> <b>NOTE:</b> {@link #init(ImageLoaderConfiguration)} method must be called before this method call @param uri Image URI (i.e. "http://site.com/image.png", "file:///mnt/sdcard/image.png") @param targetImageSize Minimal size for {@link Bitmap} which will be returned. Downloaded image will be decoded and scaled to {@link Bitmap} of the size which is <b>equal or larger</b> (usually a bit larger) than incoming targetImageSize. @param options {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions Options} for image decoding and scaling. If <b>null</b> - default display image options {@linkplain ImageLoaderConfiguration.Builder#defaultDisplayImageOptions(DisplayImageOptions) from configuration} will be used. @return Result image Bitmap. Can be <b>null</b> if image loading/decoding was failed or cancelled. @throws IllegalStateException if {@link #init(ImageLoaderConfiguration)} method wasn't called before
[ "Loads", "and", "decodes", "image", "synchronously", ".", "<br", "/", ">", "<b", ">", "NOTE", ":", "<", "/", "b", ">", "{", "@link", "#init", "(", "ImageLoaderConfiguration", ")", "}", "method", "must", "be", "called", "before", "this", "method", "call" ]
train
https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/core/ImageLoader.java#L595-L604
README.md exists but content is empty.
Downloads last month
33