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
xerial/snappy-java
src/main/java/org/xerial/snappy/Snappy.java
Snappy.uncompressedLength
public static int uncompressedLength(byte[] input, int offset, int length) throws IOException { """ Get the uncompressed byte size of the given compressed input. This operation takes O(1) time. @param input @param offset @param length @return uncompressed byte size of the the given input data @throws IOException when failed to uncompress the given input. The error code is {@link SnappyErrorCode#PARSING_ERROR} """ if (input == null) { throw new NullPointerException("input is null"); } return impl.uncompressedLength(input, offset, length); }
java
public static int uncompressedLength(byte[] input, int offset, int length) throws IOException { if (input == null) { throw new NullPointerException("input is null"); } return impl.uncompressedLength(input, offset, length); }
[ "public", "static", "int", "uncompressedLength", "(", "byte", "[", "]", "input", ",", "int", "offset", ",", "int", "length", ")", "throws", "IOException", "{", "if", "(", "input", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"input is null\"", ")", ";", "}", "return", "impl", ".", "uncompressedLength", "(", "input", ",", "offset", ",", "length", ")", ";", "}" ]
Get the uncompressed byte size of the given compressed input. This operation takes O(1) time. @param input @param offset @param length @return uncompressed byte size of the the given input data @throws IOException when failed to uncompress the given input. The error code is {@link SnappyErrorCode#PARSING_ERROR}
[ "Get", "the", "uncompressed", "byte", "size", "of", "the", "given", "compressed", "input", ".", "This", "operation", "takes", "O", "(", "1", ")", "time", "." ]
train
https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/Snappy.java#L627-L635
pmlopes/yoke
framework/src/main/java/com/jetdrone/vertx/yoke/middleware/BasicAuth.java
BasicAuth.handle401
private void handle401(final YokeRequest request, final Handler<Object> next) { """ Handle all forbidden errors, in this case we need to add a special header to the response @param request yoke request @param next middleware to be called next """ YokeResponse response = request.response(); response.putHeader("WWW-Authenticate", "Basic realm=\"" + getRealm(request) + "\""); response.setStatusCode(401); next.handle("No authorization token"); }
java
private void handle401(final YokeRequest request, final Handler<Object> next) { YokeResponse response = request.response(); response.putHeader("WWW-Authenticate", "Basic realm=\"" + getRealm(request) + "\""); response.setStatusCode(401); next.handle("No authorization token"); }
[ "private", "void", "handle401", "(", "final", "YokeRequest", "request", ",", "final", "Handler", "<", "Object", ">", "next", ")", "{", "YokeResponse", "response", "=", "request", ".", "response", "(", ")", ";", "response", ".", "putHeader", "(", "\"WWW-Authenticate\"", ",", "\"Basic realm=\\\"\"", "+", "getRealm", "(", "request", ")", "+", "\"\\\"\"", ")", ";", "response", ".", "setStatusCode", "(", "401", ")", ";", "next", ".", "handle", "(", "\"No authorization token\"", ")", ";", "}" ]
Handle all forbidden errors, in this case we need to add a special header to the response @param request yoke request @param next middleware to be called next
[ "Handle", "all", "forbidden", "errors", "in", "this", "case", "we", "need", "to", "add", "a", "special", "header", "to", "the", "response" ]
train
https://github.com/pmlopes/yoke/blob/fe8a64036f09fb745f0644faddd46162d64faf3c/framework/src/main/java/com/jetdrone/vertx/yoke/middleware/BasicAuth.java#L128-L133
joelittlejohn/jsonschema2pojo
jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/TypeRule.java
TypeRule.getIntegerType
private JType getIntegerType(JCodeModel owner, JsonNode node, GenerationConfig config) { """ Returns the JType for an integer field. Handles type lookup and unboxing. """ if (config.isUseBigIntegers()) { return unboxIfNecessary(owner.ref(BigInteger.class), config); } else if (config.isUseLongIntegers() || node.has("minimum") && node.get("minimum").isLong() || node.has("maximum") && node.get("maximum") .isLong()) { return unboxIfNecessary(owner.ref(Long.class), config); } else { return unboxIfNecessary(owner.ref(Integer.class), config); } }
java
private JType getIntegerType(JCodeModel owner, JsonNode node, GenerationConfig config) { if (config.isUseBigIntegers()) { return unboxIfNecessary(owner.ref(BigInteger.class), config); } else if (config.isUseLongIntegers() || node.has("minimum") && node.get("minimum").isLong() || node.has("maximum") && node.get("maximum") .isLong()) { return unboxIfNecessary(owner.ref(Long.class), config); } else { return unboxIfNecessary(owner.ref(Integer.class), config); } }
[ "private", "JType", "getIntegerType", "(", "JCodeModel", "owner", ",", "JsonNode", "node", ",", "GenerationConfig", "config", ")", "{", "if", "(", "config", ".", "isUseBigIntegers", "(", ")", ")", "{", "return", "unboxIfNecessary", "(", "owner", ".", "ref", "(", "BigInteger", ".", "class", ")", ",", "config", ")", ";", "}", "else", "if", "(", "config", ".", "isUseLongIntegers", "(", ")", "||", "node", ".", "has", "(", "\"minimum\"", ")", "&&", "node", ".", "get", "(", "\"minimum\"", ")", ".", "isLong", "(", ")", "||", "node", ".", "has", "(", "\"maximum\"", ")", "&&", "node", ".", "get", "(", "\"maximum\"", ")", ".", "isLong", "(", ")", ")", "{", "return", "unboxIfNecessary", "(", "owner", ".", "ref", "(", "Long", ".", "class", ")", ",", "config", ")", ";", "}", "else", "{", "return", "unboxIfNecessary", "(", "owner", ".", "ref", "(", "Integer", ".", "class", ")", ",", "config", ")", ";", "}", "}" ]
Returns the JType for an integer field. Handles type lookup and unboxing.
[ "Returns", "the", "JType", "for", "an", "integer", "field", ".", "Handles", "type", "lookup", "and", "unboxing", "." ]
train
https://github.com/joelittlejohn/jsonschema2pojo/blob/0552b80db93214eb186e4ae45b40866cc1e7eb84/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/TypeRule.java#L146-L157
landawn/AbacusUtil
src/com/landawn/abacus/util/Matth.java
Matth.subtractExact
public static long subtractExact(long a, long b) { """ Returns the difference of {@code a} and {@code b}, provided it does not overflow. @throws ArithmeticException if {@code a - b} overflows in signed {@code long} arithmetic """ long result = a - b; checkNoOverflow((a ^ b) >= 0 | (a ^ result) >= 0); return result; }
java
public static long subtractExact(long a, long b) { long result = a - b; checkNoOverflow((a ^ b) >= 0 | (a ^ result) >= 0); return result; }
[ "public", "static", "long", "subtractExact", "(", "long", "a", ",", "long", "b", ")", "{", "long", "result", "=", "a", "-", "b", ";", "checkNoOverflow", "(", "(", "a", "^", "b", ")", ">=", "0", "|", "(", "a", "^", "result", ")", ">=", "0", ")", ";", "return", "result", ";", "}" ]
Returns the difference of {@code a} and {@code b}, provided it does not overflow. @throws ArithmeticException if {@code a - b} overflows in signed {@code long} arithmetic
[ "Returns", "the", "difference", "of", "{", "@code", "a", "}", "and", "{", "@code", "b", "}", "provided", "it", "does", "not", "overflow", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Matth.java#L1404-L1408
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/util/POIUtils.java
POIUtils.buildNameArea
public static AreaReference buildNameArea(final String sheetName, final Point startPosition, final Point endPosition, SpreadsheetVersion sheetVersion) { """ 名前の範囲の形式を組み立てる。 <code>シート名!$A$1:$A:$5</code> @param sheetName シート名 @param startPosition 設定するセルの開始位置 @param endPosition 設定するセルの終了位置 @param sheetVersion シートの形式 @return """ ArgUtils.notEmpty(sheetName, "sheetName"); ArgUtils.notNull(startPosition, "startPosition"); ArgUtils.notNull(endPosition, "endPosition"); final CellReference firstRefs = new CellReference(sheetName, startPosition.y, startPosition.x, true, true); final CellReference lastRefs = new CellReference(sheetName, endPosition.y, endPosition.x, true, true); return new AreaReference(firstRefs, lastRefs, sheetVersion); }
java
public static AreaReference buildNameArea(final String sheetName, final Point startPosition, final Point endPosition, SpreadsheetVersion sheetVersion) { ArgUtils.notEmpty(sheetName, "sheetName"); ArgUtils.notNull(startPosition, "startPosition"); ArgUtils.notNull(endPosition, "endPosition"); final CellReference firstRefs = new CellReference(sheetName, startPosition.y, startPosition.x, true, true); final CellReference lastRefs = new CellReference(sheetName, endPosition.y, endPosition.x, true, true); return new AreaReference(firstRefs, lastRefs, sheetVersion); }
[ "public", "static", "AreaReference", "buildNameArea", "(", "final", "String", "sheetName", ",", "final", "Point", "startPosition", ",", "final", "Point", "endPosition", ",", "SpreadsheetVersion", "sheetVersion", ")", "{", "ArgUtils", ".", "notEmpty", "(", "sheetName", ",", "\"sheetName\"", ")", ";", "ArgUtils", ".", "notNull", "(", "startPosition", ",", "\"startPosition\"", ")", ";", "ArgUtils", ".", "notNull", "(", "endPosition", ",", "\"endPosition\"", ")", ";", "final", "CellReference", "firstRefs", "=", "new", "CellReference", "(", "sheetName", ",", "startPosition", ".", "y", ",", "startPosition", ".", "x", ",", "true", ",", "true", ")", ";", "final", "CellReference", "lastRefs", "=", "new", "CellReference", "(", "sheetName", ",", "endPosition", ".", "y", ",", "endPosition", ".", "x", ",", "true", ",", "true", ")", ";", "return", "new", "AreaReference", "(", "firstRefs", ",", "lastRefs", ",", "sheetVersion", ")", ";", "}" ]
名前の範囲の形式を組み立てる。 <code>シート名!$A$1:$A:$5</code> @param sheetName シート名 @param startPosition 設定するセルの開始位置 @param endPosition 設定するセルの終了位置 @param sheetVersion シートの形式 @return
[ "名前の範囲の形式を組み立てる。", "<code", ">", "シート名!$A$1", ":", "$A", ":", "$5<", "/", "code", ">" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/util/POIUtils.java#L847-L858
stagemonitor/stagemonitor
stagemonitor-core/src/main/java/org/stagemonitor/core/metrics/prometheus/StagemonitorPrometheusCollector.java
StagemonitorPrometheusCollector.fromTimer
private MetricFamilySamples fromTimer(List<Map.Entry<MetricName, Timer>> histogramsWithSameName) { """ Export dropwizard Timer as a histogram. Use TIME_UNIT as time unit. """ final SummaryMetricFamily summaryMetricFamily = getSummaryMetricFamily(histogramsWithSameName, "_seconds"); for (Map.Entry<MetricName, Timer> entry : histogramsWithSameName) { addSummaryMetric(summaryMetricFamily, entry.getKey(), entry.getValue().getSnapshot(), SECONDS_IN_NANOS, entry.getValue().getCount()); } return summaryMetricFamily; }
java
private MetricFamilySamples fromTimer(List<Map.Entry<MetricName, Timer>> histogramsWithSameName) { final SummaryMetricFamily summaryMetricFamily = getSummaryMetricFamily(histogramsWithSameName, "_seconds"); for (Map.Entry<MetricName, Timer> entry : histogramsWithSameName) { addSummaryMetric(summaryMetricFamily, entry.getKey(), entry.getValue().getSnapshot(), SECONDS_IN_NANOS, entry.getValue().getCount()); } return summaryMetricFamily; }
[ "private", "MetricFamilySamples", "fromTimer", "(", "List", "<", "Map", ".", "Entry", "<", "MetricName", ",", "Timer", ">", ">", "histogramsWithSameName", ")", "{", "final", "SummaryMetricFamily", "summaryMetricFamily", "=", "getSummaryMetricFamily", "(", "histogramsWithSameName", ",", "\"_seconds\"", ")", ";", "for", "(", "Map", ".", "Entry", "<", "MetricName", ",", "Timer", ">", "entry", ":", "histogramsWithSameName", ")", "{", "addSummaryMetric", "(", "summaryMetricFamily", ",", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ".", "getSnapshot", "(", ")", ",", "SECONDS_IN_NANOS", ",", "entry", ".", "getValue", "(", ")", ".", "getCount", "(", ")", ")", ";", "}", "return", "summaryMetricFamily", ";", "}" ]
Export dropwizard Timer as a histogram. Use TIME_UNIT as time unit.
[ "Export", "dropwizard", "Timer", "as", "a", "histogram", ".", "Use", "TIME_UNIT", "as", "time", "unit", "." ]
train
https://github.com/stagemonitor/stagemonitor/blob/7a1bf6848906f816aa465983f602ea1f1e8f2b7b/stagemonitor-core/src/main/java/org/stagemonitor/core/metrics/prometheus/StagemonitorPrometheusCollector.java#L127-L133
eurekaclinical/aiw-i2b2-etl
src/main/java/edu/emory/cci/aiw/i2b2etl/dest/I2b2QueryResultsHandler.java
I2b2QueryResultsHandler.start
@Override public void start(PropositionDefinitionCache propDefs) throws QueryResultsHandlerProcessingException { """ Builds most of the concept tree, truncates the data tables, opens a connection to the i2b2 project database, and does some other prep. This method is called before the first call to {@link #handleQueryResult(String, java.util.List, java.util.Map, java.util.Map, java.util.Map)}. @throws QueryResultsHandlerProcessingException """ Logger logger = I2b2ETLUtil.logger(); try { this.conceptDimensionHandler = new ConceptDimensionHandler(dataConnectionSpec); this.modifierDimensionHandler = new ModifierDimensionHandler(dataConnectionSpec); this.cache = new KnowledgeSourceCacheFactory().getInstance(this.knowledgeSource, propDefs, true); this.metadata = new MetadataFactory().getInstance(propDefs, this.qrhId, this.cache, collectUserPropositionDefinitions(), this.conceptsSection.getFolderSpecs(), settings, this.data, this.metadataConnectionSpec); this.providerDimensionFactory = new ProviderDimensionFactory(this.metadata, this.settings, this.dataConnectionSpec); this.patientDimensionFactory = new PatientDimensionFactory(this.metadata, this.settings, this.data, this.dataConnectionSpec); this.visitDimensionFactory = new VisitDimensionFactory(this.metadata, this.settings, this.data, this.dataConnectionSpec); DataRemoverFactory f = new DataRemoverFactory(); if (this.query.getQueryMode() == QueryMode.REPLACE) { f.getInstance(this.dataRemoveMethod).doRemoveData(); } f.getInstance(this.metaRemoveMethod).doRemoveMetadata(); this.factHandlers = new ArrayList<>(); addPropositionFactHandlers(); executePreHook(); // disable indexes on observation_fact to speed up inserts disableObservationFactIndexes(); // create i2b2 temporary tables using stored procedures truncateTempTables(); this.dataSchemaConnection = openDataDatabaseConnection(); this.dataSchemaName = this.dataSchemaConnection.getSchema(); if (this.settings.getManageCTotalNum()) { try (Connection conn = openMetadataDatabaseConnection()) { conn.setAutoCommit(true); try (CallableStatement mappingCall = conn.prepareCall("{ call ECMETA.EC_CLEAR_C_TOTALNUM() }")) { logger.log(Level.INFO, "Clearing C_TOTALNUM for query {0}", this.query.getName()); mappingCall.execute(); } } } logger.log(Level.INFO, "Populating observation facts table for query {0}", this.query.getName()); } catch (KnowledgeSourceReadException | SQLException | OntologyBuildException ex) { throw new QueryResultsHandlerProcessingException("Error during i2b2 load", ex); } }
java
@Override public void start(PropositionDefinitionCache propDefs) throws QueryResultsHandlerProcessingException { Logger logger = I2b2ETLUtil.logger(); try { this.conceptDimensionHandler = new ConceptDimensionHandler(dataConnectionSpec); this.modifierDimensionHandler = new ModifierDimensionHandler(dataConnectionSpec); this.cache = new KnowledgeSourceCacheFactory().getInstance(this.knowledgeSource, propDefs, true); this.metadata = new MetadataFactory().getInstance(propDefs, this.qrhId, this.cache, collectUserPropositionDefinitions(), this.conceptsSection.getFolderSpecs(), settings, this.data, this.metadataConnectionSpec); this.providerDimensionFactory = new ProviderDimensionFactory(this.metadata, this.settings, this.dataConnectionSpec); this.patientDimensionFactory = new PatientDimensionFactory(this.metadata, this.settings, this.data, this.dataConnectionSpec); this.visitDimensionFactory = new VisitDimensionFactory(this.metadata, this.settings, this.data, this.dataConnectionSpec); DataRemoverFactory f = new DataRemoverFactory(); if (this.query.getQueryMode() == QueryMode.REPLACE) { f.getInstance(this.dataRemoveMethod).doRemoveData(); } f.getInstance(this.metaRemoveMethod).doRemoveMetadata(); this.factHandlers = new ArrayList<>(); addPropositionFactHandlers(); executePreHook(); // disable indexes on observation_fact to speed up inserts disableObservationFactIndexes(); // create i2b2 temporary tables using stored procedures truncateTempTables(); this.dataSchemaConnection = openDataDatabaseConnection(); this.dataSchemaName = this.dataSchemaConnection.getSchema(); if (this.settings.getManageCTotalNum()) { try (Connection conn = openMetadataDatabaseConnection()) { conn.setAutoCommit(true); try (CallableStatement mappingCall = conn.prepareCall("{ call ECMETA.EC_CLEAR_C_TOTALNUM() }")) { logger.log(Level.INFO, "Clearing C_TOTALNUM for query {0}", this.query.getName()); mappingCall.execute(); } } } logger.log(Level.INFO, "Populating observation facts table for query {0}", this.query.getName()); } catch (KnowledgeSourceReadException | SQLException | OntologyBuildException ex) { throw new QueryResultsHandlerProcessingException("Error during i2b2 load", ex); } }
[ "@", "Override", "public", "void", "start", "(", "PropositionDefinitionCache", "propDefs", ")", "throws", "QueryResultsHandlerProcessingException", "{", "Logger", "logger", "=", "I2b2ETLUtil", ".", "logger", "(", ")", ";", "try", "{", "this", ".", "conceptDimensionHandler", "=", "new", "ConceptDimensionHandler", "(", "dataConnectionSpec", ")", ";", "this", ".", "modifierDimensionHandler", "=", "new", "ModifierDimensionHandler", "(", "dataConnectionSpec", ")", ";", "this", ".", "cache", "=", "new", "KnowledgeSourceCacheFactory", "(", ")", ".", "getInstance", "(", "this", ".", "knowledgeSource", ",", "propDefs", ",", "true", ")", ";", "this", ".", "metadata", "=", "new", "MetadataFactory", "(", ")", ".", "getInstance", "(", "propDefs", ",", "this", ".", "qrhId", ",", "this", ".", "cache", ",", "collectUserPropositionDefinitions", "(", ")", ",", "this", ".", "conceptsSection", ".", "getFolderSpecs", "(", ")", ",", "settings", ",", "this", ".", "data", ",", "this", ".", "metadataConnectionSpec", ")", ";", "this", ".", "providerDimensionFactory", "=", "new", "ProviderDimensionFactory", "(", "this", ".", "metadata", ",", "this", ".", "settings", ",", "this", ".", "dataConnectionSpec", ")", ";", "this", ".", "patientDimensionFactory", "=", "new", "PatientDimensionFactory", "(", "this", ".", "metadata", ",", "this", ".", "settings", ",", "this", ".", "data", ",", "this", ".", "dataConnectionSpec", ")", ";", "this", ".", "visitDimensionFactory", "=", "new", "VisitDimensionFactory", "(", "this", ".", "metadata", ",", "this", ".", "settings", ",", "this", ".", "data", ",", "this", ".", "dataConnectionSpec", ")", ";", "DataRemoverFactory", "f", "=", "new", "DataRemoverFactory", "(", ")", ";", "if", "(", "this", ".", "query", ".", "getQueryMode", "(", ")", "==", "QueryMode", ".", "REPLACE", ")", "{", "f", ".", "getInstance", "(", "this", ".", "dataRemoveMethod", ")", ".", "doRemoveData", "(", ")", ";", "}", "f", ".", "getInstance", "(", "this", ".", "metaRemoveMethod", ")", ".", "doRemoveMetadata", "(", ")", ";", "this", ".", "factHandlers", "=", "new", "ArrayList", "<>", "(", ")", ";", "addPropositionFactHandlers", "(", ")", ";", "executePreHook", "(", ")", ";", "// disable indexes on observation_fact to speed up inserts", "disableObservationFactIndexes", "(", ")", ";", "// create i2b2 temporary tables using stored procedures", "truncateTempTables", "(", ")", ";", "this", ".", "dataSchemaConnection", "=", "openDataDatabaseConnection", "(", ")", ";", "this", ".", "dataSchemaName", "=", "this", ".", "dataSchemaConnection", ".", "getSchema", "(", ")", ";", "if", "(", "this", ".", "settings", ".", "getManageCTotalNum", "(", ")", ")", "{", "try", "(", "Connection", "conn", "=", "openMetadataDatabaseConnection", "(", ")", ")", "{", "conn", ".", "setAutoCommit", "(", "true", ")", ";", "try", "(", "CallableStatement", "mappingCall", "=", "conn", ".", "prepareCall", "(", "\"{ call ECMETA.EC_CLEAR_C_TOTALNUM() }\"", ")", ")", "{", "logger", ".", "log", "(", "Level", ".", "INFO", ",", "\"Clearing C_TOTALNUM for query {0}\"", ",", "this", ".", "query", ".", "getName", "(", ")", ")", ";", "mappingCall", ".", "execute", "(", ")", ";", "}", "}", "}", "logger", ".", "log", "(", "Level", ".", "INFO", ",", "\"Populating observation facts table for query {0}\"", ",", "this", ".", "query", ".", "getName", "(", ")", ")", ";", "}", "catch", "(", "KnowledgeSourceReadException", "|", "SQLException", "|", "OntologyBuildException", "ex", ")", "{", "throw", "new", "QueryResultsHandlerProcessingException", "(", "\"Error during i2b2 load\"", ",", "ex", ")", ";", "}", "}" ]
Builds most of the concept tree, truncates the data tables, opens a connection to the i2b2 project database, and does some other prep. This method is called before the first call to {@link #handleQueryResult(String, java.util.List, java.util.Map, java.util.Map, java.util.Map)}. @throws QueryResultsHandlerProcessingException
[ "Builds", "most", "of", "the", "concept", "tree", "truncates", "the", "data", "tables", "opens", "a", "connection", "to", "the", "i2b2", "project", "database", "and", "does", "some", "other", "prep", ".", "This", "method", "is", "called", "before", "the", "first", "call", "to", "{", "@link", "#handleQueryResult", "(", "String", "java", ".", "util", ".", "List", "java", ".", "util", ".", "Map", "java", ".", "util", ".", "Map", "java", ".", "util", ".", "Map", ")", "}", "." ]
train
https://github.com/eurekaclinical/aiw-i2b2-etl/blob/3eed6bda7755919cb9466d2930723a0f4748341a/src/main/java/edu/emory/cci/aiw/i2b2etl/dest/I2b2QueryResultsHandler.java#L314-L354
facebook/fresco
drawee/src/main/java/com/facebook/drawee/drawable/RoundedDrawable.java
RoundedDrawable.setBorder
@Override public void setBorder(int color, float width) { """ Sets the border @param color of the border @param width of the border """ if (mBorderColor != color || mBorderWidth != width) { mBorderColor = color; mBorderWidth = width; mIsPathDirty = true; invalidateSelf(); } }
java
@Override public void setBorder(int color, float width) { if (mBorderColor != color || mBorderWidth != width) { mBorderColor = color; mBorderWidth = width; mIsPathDirty = true; invalidateSelf(); } }
[ "@", "Override", "public", "void", "setBorder", "(", "int", "color", ",", "float", "width", ")", "{", "if", "(", "mBorderColor", "!=", "color", "||", "mBorderWidth", "!=", "width", ")", "{", "mBorderColor", "=", "color", ";", "mBorderWidth", "=", "width", ";", "mIsPathDirty", "=", "true", ";", "invalidateSelf", "(", ")", ";", "}", "}" ]
Sets the border @param color of the border @param width of the border
[ "Sets", "the", "border" ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/drawable/RoundedDrawable.java#L144-L152
legsem/legstar.avro
legstar.avro.cob2avro/src/main/java/com/legstar/avro/cob2avro/io/ZosVarRdwDatumReader.java
ZosVarRdwDatumReader.getRecordLen
private static int getRecordLen(byte[] hostData, int start, int length) { """ RDW is a 4 bytes numeric stored in Big Endian as a binary 2's complement. @param hostData the mainframe data @param start where the RDW starts @param length the total size of the mainframe data @return the size of the record (actual data without the rdw itself) """ int len = getRawRdw(hostData, start, length); if (len < RDW_LEN || len > hostData.length) { throw new IllegalArgumentException( "Record does not start with a Record Descriptor Word"); } /* Beware that raw rdw accounts for the rdw length (4 bytes) */ return len - RDW_LEN; }
java
private static int getRecordLen(byte[] hostData, int start, int length) { int len = getRawRdw(hostData, start, length); if (len < RDW_LEN || len > hostData.length) { throw new IllegalArgumentException( "Record does not start with a Record Descriptor Word"); } /* Beware that raw rdw accounts for the rdw length (4 bytes) */ return len - RDW_LEN; }
[ "private", "static", "int", "getRecordLen", "(", "byte", "[", "]", "hostData", ",", "int", "start", ",", "int", "length", ")", "{", "int", "len", "=", "getRawRdw", "(", "hostData", ",", "start", ",", "length", ")", ";", "if", "(", "len", "<", "RDW_LEN", "||", "len", ">", "hostData", ".", "length", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Record does not start with a Record Descriptor Word\"", ")", ";", "}", "/* Beware that raw rdw accounts for the rdw length (4 bytes) */", "return", "len", "-", "RDW_LEN", ";", "}" ]
RDW is a 4 bytes numeric stored in Big Endian as a binary 2's complement. @param hostData the mainframe data @param start where the RDW starts @param length the total size of the mainframe data @return the size of the record (actual data without the rdw itself)
[ "RDW", "is", "a", "4", "bytes", "numeric", "stored", "in", "Big", "Endian", "as", "a", "binary", "2", "s", "complement", "." ]
train
https://github.com/legsem/legstar.avro/blob/bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b/legstar.avro.cob2avro/src/main/java/com/legstar/avro/cob2avro/io/ZosVarRdwDatumReader.java#L96-L105
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
LambdaToMethod.makeNewClass
JCNewClass makeNewClass(Type ctype, List<JCExpression> args, Symbol cons) { """ Make an attributed class instance creation expression. @param ctype The class type. @param args The constructor arguments. @param cons The constructor symbol """ JCNewClass tree = make.NewClass(null, null, make.QualIdent(ctype.tsym), args, null); tree.constructor = cons; tree.type = ctype; return tree; }
java
JCNewClass makeNewClass(Type ctype, List<JCExpression> args, Symbol cons) { JCNewClass tree = make.NewClass(null, null, make.QualIdent(ctype.tsym), args, null); tree.constructor = cons; tree.type = ctype; return tree; }
[ "JCNewClass", "makeNewClass", "(", "Type", "ctype", ",", "List", "<", "JCExpression", ">", "args", ",", "Symbol", "cons", ")", "{", "JCNewClass", "tree", "=", "make", ".", "NewClass", "(", "null", ",", "null", ",", "make", ".", "QualIdent", "(", "ctype", ".", "tsym", ")", ",", "args", ",", "null", ")", ";", "tree", ".", "constructor", "=", "cons", ";", "tree", ".", "type", "=", "ctype", ";", "return", "tree", ";", "}" ]
Make an attributed class instance creation expression. @param ctype The class type. @param args The constructor arguments. @param cons The constructor symbol
[ "Make", "an", "attributed", "class", "instance", "creation", "expression", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java#L664-L670
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/filter/filterpolicy_binding.java
filterpolicy_binding.get
public static filterpolicy_binding get(nitro_service service, String name) throws Exception { """ Use this API to fetch filterpolicy_binding resource of given name . """ filterpolicy_binding obj = new filterpolicy_binding(); obj.set_name(name); filterpolicy_binding response = (filterpolicy_binding) obj.get_resource(service); return response; }
java
public static filterpolicy_binding get(nitro_service service, String name) throws Exception{ filterpolicy_binding obj = new filterpolicy_binding(); obj.set_name(name); filterpolicy_binding response = (filterpolicy_binding) obj.get_resource(service); return response; }
[ "public", "static", "filterpolicy_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "filterpolicy_binding", "obj", "=", "new", "filterpolicy_binding", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "filterpolicy_binding", "response", "=", "(", "filterpolicy_binding", ")", "obj", ".", "get_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch filterpolicy_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "filterpolicy_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/filter/filterpolicy_binding.java#L136-L141
cqframework/clinical_quality_language
Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java
ElmBaseVisitor.visitParameterDef
public T visitParameterDef(ParameterDef elm, C context) { """ Visit a ParameterDef. This method will be called for every node in the tree that is a ParameterDef. @param elm the ELM tree @param context the context passed to the visitor @return the visitor result """ if (elm.getParameterTypeSpecifier() != null) { visitElement(elm.getParameterTypeSpecifier(), context); } if (elm.getDefault() != null) { visitElement(elm.getDefault(), context); } return null; }
java
public T visitParameterDef(ParameterDef elm, C context) { if (elm.getParameterTypeSpecifier() != null) { visitElement(elm.getParameterTypeSpecifier(), context); } if (elm.getDefault() != null) { visitElement(elm.getDefault(), context); } return null; }
[ "public", "T", "visitParameterDef", "(", "ParameterDef", "elm", ",", "C", "context", ")", "{", "if", "(", "elm", ".", "getParameterTypeSpecifier", "(", ")", "!=", "null", ")", "{", "visitElement", "(", "elm", ".", "getParameterTypeSpecifier", "(", ")", ",", "context", ")", ";", "}", "if", "(", "elm", ".", "getDefault", "(", ")", "!=", "null", ")", "{", "visitElement", "(", "elm", ".", "getDefault", "(", ")", ",", "context", ")", ";", "}", "return", "null", ";", "}" ]
Visit a ParameterDef. This method will be called for every node in the tree that is a ParameterDef. @param elm the ELM tree @param context the context passed to the visitor @return the visitor result
[ "Visit", "a", "ParameterDef", ".", "This", "method", "will", "be", "called", "for", "every", "node", "in", "the", "tree", "that", "is", "a", "ParameterDef", "." ]
train
https://github.com/cqframework/clinical_quality_language/blob/67459d1ef453e49db8d7c5c86e87278377ed0a0b/Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java#L372-L382
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbEpisodes.java
TmdbEpisodes.getEpisodeInfo
public TVEpisodeInfo getEpisodeInfo(int tvID, int seasonNumber, int episodeNumber, String language, String... appendToResponse) throws MovieDbException { """ Get the primary information about a TV episode by combination of a season and episode number. @param tvID @param seasonNumber @param episodeNumber @param language @param appendToResponse @return @throws MovieDbException """ TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, tvID); parameters.add(Param.SEASON_NUMBER, seasonNumber); parameters.add(Param.EPISODE_NUMBER, episodeNumber); parameters.add(Param.LANGUAGE, language); parameters.add(Param.APPEND, appendToResponse); URL url = new ApiUrl(apiKey, MethodBase.EPISODE).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, TVEpisodeInfo.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get TV Episode Info", url, ex); } }
java
public TVEpisodeInfo getEpisodeInfo(int tvID, int seasonNumber, int episodeNumber, String language, String... appendToResponse) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, tvID); parameters.add(Param.SEASON_NUMBER, seasonNumber); parameters.add(Param.EPISODE_NUMBER, episodeNumber); parameters.add(Param.LANGUAGE, language); parameters.add(Param.APPEND, appendToResponse); URL url = new ApiUrl(apiKey, MethodBase.EPISODE).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, TVEpisodeInfo.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get TV Episode Info", url, ex); } }
[ "public", "TVEpisodeInfo", "getEpisodeInfo", "(", "int", "tvID", ",", "int", "seasonNumber", ",", "int", "episodeNumber", ",", "String", "language", ",", "String", "...", "appendToResponse", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(", "Param", ".", "ID", ",", "tvID", ")", ";", "parameters", ".", "add", "(", "Param", ".", "SEASON_NUMBER", ",", "seasonNumber", ")", ";", "parameters", ".", "add", "(", "Param", ".", "EPISODE_NUMBER", ",", "episodeNumber", ")", ";", "parameters", ".", "add", "(", "Param", ".", "LANGUAGE", ",", "language", ")", ";", "parameters", ".", "add", "(", "Param", ".", "APPEND", ",", "appendToResponse", ")", ";", "URL", "url", "=", "new", "ApiUrl", "(", "apiKey", ",", "MethodBase", ".", "EPISODE", ")", ".", "buildUrl", "(", "parameters", ")", ";", "String", "webpage", "=", "httpTools", ".", "getRequest", "(", "url", ")", ";", "try", "{", "return", "MAPPER", ".", "readValue", "(", "webpage", ",", "TVEpisodeInfo", ".", "class", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "MovieDbException", "(", "ApiExceptionType", ".", "MAPPING_FAILED", ",", "\"Failed to get TV Episode Info\"", ",", "url", ",", "ex", ")", ";", "}", "}" ]
Get the primary information about a TV episode by combination of a season and episode number. @param tvID @param seasonNumber @param episodeNumber @param language @param appendToResponse @return @throws MovieDbException
[ "Get", "the", "primary", "information", "about", "a", "TV", "episode", "by", "combination", "of", "a", "season", "and", "episode", "number", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbEpisodes.java#L78-L94
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.cdn_dedicated_serviceName_backend_duration_GET
public OvhOrder cdn_dedicated_serviceName_backend_duration_GET(String serviceName, String duration, Long backend) throws IOException { """ Get prices and contracts information REST: GET /order/cdn/dedicated/{serviceName}/backend/{duration} @param backend [required] Backend number that will be ordered @param serviceName [required] The internal name of your CDN offer @param duration [required] Duration """ String qPath = "/order/cdn/dedicated/{serviceName}/backend/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "backend", backend); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder cdn_dedicated_serviceName_backend_duration_GET(String serviceName, String duration, Long backend) throws IOException { String qPath = "/order/cdn/dedicated/{serviceName}/backend/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "backend", backend); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "cdn_dedicated_serviceName_backend_duration_GET", "(", "String", "serviceName", ",", "String", "duration", ",", "Long", "backend", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/cdn/dedicated/{serviceName}/backend/{duration}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "duration", ")", ";", "query", "(", "sb", ",", "\"backend\"", ",", "backend", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOrder", ".", "class", ")", ";", "}" ]
Get prices and contracts information REST: GET /order/cdn/dedicated/{serviceName}/backend/{duration} @param backend [required] Backend number that will be ordered @param serviceName [required] The internal name of your CDN offer @param duration [required] Duration
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5229-L5235
phoenixnap/springmvc-raml-plugin
src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/SchemaHelper.java
SchemaHelper.extractTopItem
private static String extractTopItem(String searchString, String schema, int startIdx) { """ Extracts the value of a specified parameter in a schema @param searchString element to search for @param schema Schema as a string @return the value or null if not found """ String extracted = null; int propIdx = schema.indexOf("\"properties\"", startIdx); if (propIdx == -1) { propIdx = Integer.MAX_VALUE; } // check for second int idIdx = schema.indexOf("\"" + searchString + "\"", startIdx); int secondIdIdx = schema.indexOf("\"" + searchString + "\"", idIdx + 1); if (secondIdIdx != -1 && propIdx > secondIdIdx) { idIdx = secondIdIdx; } if (idIdx != -1 && propIdx > idIdx) { // make sure we're not in a nested // id // find the 1st and second " after the idx int valueStartIdx = schema.indexOf("\"", idIdx + (searchString.length() + 2)); int valueEndIdx = schema.indexOf("\"", valueStartIdx + 1); extracted = schema.substring(valueStartIdx + 1, valueEndIdx); } return extracted; }
java
private static String extractTopItem(String searchString, String schema, int startIdx) { String extracted = null; int propIdx = schema.indexOf("\"properties\"", startIdx); if (propIdx == -1) { propIdx = Integer.MAX_VALUE; } // check for second int idIdx = schema.indexOf("\"" + searchString + "\"", startIdx); int secondIdIdx = schema.indexOf("\"" + searchString + "\"", idIdx + 1); if (secondIdIdx != -1 && propIdx > secondIdIdx) { idIdx = secondIdIdx; } if (idIdx != -1 && propIdx > idIdx) { // make sure we're not in a nested // id // find the 1st and second " after the idx int valueStartIdx = schema.indexOf("\"", idIdx + (searchString.length() + 2)); int valueEndIdx = schema.indexOf("\"", valueStartIdx + 1); extracted = schema.substring(valueStartIdx + 1, valueEndIdx); } return extracted; }
[ "private", "static", "String", "extractTopItem", "(", "String", "searchString", ",", "String", "schema", ",", "int", "startIdx", ")", "{", "String", "extracted", "=", "null", ";", "int", "propIdx", "=", "schema", ".", "indexOf", "(", "\"\\\"properties\\\"\"", ",", "startIdx", ")", ";", "if", "(", "propIdx", "==", "-", "1", ")", "{", "propIdx", "=", "Integer", ".", "MAX_VALUE", ";", "}", "// check for second", "int", "idIdx", "=", "schema", ".", "indexOf", "(", "\"\\\"\"", "+", "searchString", "+", "\"\\\"\"", ",", "startIdx", ")", ";", "int", "secondIdIdx", "=", "schema", ".", "indexOf", "(", "\"\\\"\"", "+", "searchString", "+", "\"\\\"\"", ",", "idIdx", "+", "1", ")", ";", "if", "(", "secondIdIdx", "!=", "-", "1", "&&", "propIdx", ">", "secondIdIdx", ")", "{", "idIdx", "=", "secondIdIdx", ";", "}", "if", "(", "idIdx", "!=", "-", "1", "&&", "propIdx", ">", "idIdx", ")", "{", "// make sure we're not in a nested", "// id", "// find the 1st and second \" after the idx", "int", "valueStartIdx", "=", "schema", ".", "indexOf", "(", "\"\\\"\"", ",", "idIdx", "+", "(", "searchString", ".", "length", "(", ")", "+", "2", ")", ")", ";", "int", "valueEndIdx", "=", "schema", ".", "indexOf", "(", "\"\\\"\"", ",", "valueStartIdx", "+", "1", ")", ";", "extracted", "=", "schema", ".", "substring", "(", "valueStartIdx", "+", "1", ",", "valueEndIdx", ")", ";", "}", "return", "extracted", ";", "}" ]
Extracts the value of a specified parameter in a schema @param searchString element to search for @param schema Schema as a string @return the value or null if not found
[ "Extracts", "the", "value", "of", "a", "specified", "parameter", "in", "a", "schema" ]
train
https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/SchemaHelper.java#L261-L281
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/print/OneSelect.java
OneSelect.addLinkFromSelectPart
public void addLinkFromSelectPart(final String _linkFrom) throws CacheReloadException { """ Add the name of the type and attribute the link comes from, evaluated from an <code>linkTo[TYPENAME#ATTRIBUTENAME]</code> part of an select statement. @param _linkFrom name of the attribute the link comes from @throws CacheReloadException on erro """ this.fromSelect = new LinkFromSelect(_linkFrom, getQuery().isCacheEnabled() ? getQuery().getKey() : null); }
java
public void addLinkFromSelectPart(final String _linkFrom) throws CacheReloadException { this.fromSelect = new LinkFromSelect(_linkFrom, getQuery().isCacheEnabled() ? getQuery().getKey() : null); }
[ "public", "void", "addLinkFromSelectPart", "(", "final", "String", "_linkFrom", ")", "throws", "CacheReloadException", "{", "this", ".", "fromSelect", "=", "new", "LinkFromSelect", "(", "_linkFrom", ",", "getQuery", "(", ")", ".", "isCacheEnabled", "(", ")", "?", "getQuery", "(", ")", ".", "getKey", "(", ")", ":", "null", ")", ";", "}" ]
Add the name of the type and attribute the link comes from, evaluated from an <code>linkTo[TYPENAME#ATTRIBUTENAME]</code> part of an select statement. @param _linkFrom name of the attribute the link comes from @throws CacheReloadException on erro
[ "Add", "the", "name", "of", "the", "type", "and", "attribute", "the", "link", "comes", "from", "evaluated", "from", "an", "<code", ">", "linkTo", "[", "TYPENAME#ATTRIBUTENAME", "]", "<", "/", "code", ">", "part", "of", "an", "select", "statement", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/print/OneSelect.java#L390-L394
facebookarchive/hadoop-20
src/contrib/corona/src/java/org/apache/hadoop/mapred/RemoteJTProxy.java
RemoteJTProxy.initializeClientUnprotected
void initializeClientUnprotected(String host, int port, String sessionId) throws IOException { """ Create the RPC client to the remote corona job tracker. @param host The host running the remote corona job tracker. @param port The port of the remote corona job tracker. @param sessionId The session for the remote corona job tracker. @throws IOException """ if (client != null) { return; } LOG.info("Creating JT client to " + host + ":" + port); long connectTimeout = RemoteJTProxy.getRemotJTTimeout(conf); int rpcTimeout = RemoteJTProxy.getRemoteJTRPCTimeout(conf); remoteJTAddr = new InetSocketAddress(host, port); client = RPC.waitForProtocolProxy( JobSubmissionProtocol.class, JobSubmissionProtocol.versionID, remoteJTAddr, conf, connectTimeout, rpcTimeout ).getProxy(); remoteJTStatus = RemoteJTStatus.SUCCESS; remoteJTHost = host; remoteJTPort = port; remoteSessionId = sessionId; if (remoteJTState != null) { remoteJTState.setSessionId(sessionId); } }
java
void initializeClientUnprotected(String host, int port, String sessionId) throws IOException { if (client != null) { return; } LOG.info("Creating JT client to " + host + ":" + port); long connectTimeout = RemoteJTProxy.getRemotJTTimeout(conf); int rpcTimeout = RemoteJTProxy.getRemoteJTRPCTimeout(conf); remoteJTAddr = new InetSocketAddress(host, port); client = RPC.waitForProtocolProxy( JobSubmissionProtocol.class, JobSubmissionProtocol.versionID, remoteJTAddr, conf, connectTimeout, rpcTimeout ).getProxy(); remoteJTStatus = RemoteJTStatus.SUCCESS; remoteJTHost = host; remoteJTPort = port; remoteSessionId = sessionId; if (remoteJTState != null) { remoteJTState.setSessionId(sessionId); } }
[ "void", "initializeClientUnprotected", "(", "String", "host", ",", "int", "port", ",", "String", "sessionId", ")", "throws", "IOException", "{", "if", "(", "client", "!=", "null", ")", "{", "return", ";", "}", "LOG", ".", "info", "(", "\"Creating JT client to \"", "+", "host", "+", "\":\"", "+", "port", ")", ";", "long", "connectTimeout", "=", "RemoteJTProxy", ".", "getRemotJTTimeout", "(", "conf", ")", ";", "int", "rpcTimeout", "=", "RemoteJTProxy", ".", "getRemoteJTRPCTimeout", "(", "conf", ")", ";", "remoteJTAddr", "=", "new", "InetSocketAddress", "(", "host", ",", "port", ")", ";", "client", "=", "RPC", ".", "waitForProtocolProxy", "(", "JobSubmissionProtocol", ".", "class", ",", "JobSubmissionProtocol", ".", "versionID", ",", "remoteJTAddr", ",", "conf", ",", "connectTimeout", ",", "rpcTimeout", ")", ".", "getProxy", "(", ")", ";", "remoteJTStatus", "=", "RemoteJTStatus", ".", "SUCCESS", ";", "remoteJTHost", "=", "host", ";", "remoteJTPort", "=", "port", ";", "remoteSessionId", "=", "sessionId", ";", "if", "(", "remoteJTState", "!=", "null", ")", "{", "remoteJTState", ".", "setSessionId", "(", "sessionId", ")", ";", "}", "}" ]
Create the RPC client to the remote corona job tracker. @param host The host running the remote corona job tracker. @param port The port of the remote corona job tracker. @param sessionId The session for the remote corona job tracker. @throws IOException
[ "Create", "the", "RPC", "client", "to", "the", "remote", "corona", "job", "tracker", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/RemoteJTProxy.java#L297-L322
dbracewell/hermes
hermes-core/src/main/java/com/davidbracewell/hermes/extraction/AbstractExtractor.java
AbstractExtractor.toStringFunction
public T toStringFunction(@NonNull SerializableFunction<HString, String> toStringFunction) { """ To string function t. @param toStringFunction the to string function @return the t """ this.toStringFunction = toStringFunction; return Cast.as(this); }
java
public T toStringFunction(@NonNull SerializableFunction<HString, String> toStringFunction) { this.toStringFunction = toStringFunction; return Cast.as(this); }
[ "public", "T", "toStringFunction", "(", "@", "NonNull", "SerializableFunction", "<", "HString", ",", "String", ">", "toStringFunction", ")", "{", "this", ".", "toStringFunction", "=", "toStringFunction", ";", "return", "Cast", ".", "as", "(", "this", ")", ";", "}" ]
To string function t. @param toStringFunction the to string function @return the t
[ "To", "string", "function", "t", "." ]
train
https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-core/src/main/java/com/davidbracewell/hermes/extraction/AbstractExtractor.java#L202-L205
crowmagnumb/s6-util
src/main/java/net/crowmagnumb/util/reflect/SimpleMethodInvoker.java
SimpleMethodInvoker.invokeMethod
private static Object invokeMethod( final Object obj, final String methodName, final Object[] args, final Class<?>[] parameterTypes ) throws UtilException { """ We have an object and a method name, but in order to invoke a method on an object, we need the object's Class (type). Given this Class we can then check that such a method exists and throw an exception if it doesn't. @param obj to invoke method on @param methodName to invoke @param args to use @param parameterTypes types of arguments @return method result @throws net.crowmagnumb.util.UtilException if problem """ return invokeMethod( obj, obj.getClass(), methodName, args, parameterTypes ); }
java
private static Object invokeMethod( final Object obj, final String methodName, final Object[] args, final Class<?>[] parameterTypes ) throws UtilException { return invokeMethod( obj, obj.getClass(), methodName, args, parameterTypes ); }
[ "private", "static", "Object", "invokeMethod", "(", "final", "Object", "obj", ",", "final", "String", "methodName", ",", "final", "Object", "[", "]", "args", ",", "final", "Class", "<", "?", ">", "[", "]", "parameterTypes", ")", "throws", "UtilException", "{", "return", "invokeMethod", "(", "obj", ",", "obj", ".", "getClass", "(", ")", ",", "methodName", ",", "args", ",", "parameterTypes", ")", ";", "}" ]
We have an object and a method name, but in order to invoke a method on an object, we need the object's Class (type). Given this Class we can then check that such a method exists and throw an exception if it doesn't. @param obj to invoke method on @param methodName to invoke @param args to use @param parameterTypes types of arguments @return method result @throws net.crowmagnumb.util.UtilException if problem
[ "We", "have", "an", "object", "and", "a", "method", "name", "but", "in", "order", "to", "invoke", "a", "method", "on", "an", "object", "we", "need", "the", "object", "s", "Class", "(", "type", ")", "." ]
train
https://github.com/crowmagnumb/s6-util/blob/0f9969bc0809e8a617501fa57c135e9b3984fae0/src/main/java/net/crowmagnumb/util/reflect/SimpleMethodInvoker.java#L301-L309
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java
JsiiClient.getPropertyValue
public JsonNode getPropertyValue(final JsiiObjectRef objRef, final String property) { """ Gets a value for a property from a remote object. @param objRef The remote object reference. @param property The property name. @return The value of the property. """ ObjectNode req = makeRequest("get", objRef); req.put("property", property); return this.runtime.requestResponse(req).get("value"); }
java
public JsonNode getPropertyValue(final JsiiObjectRef objRef, final String property) { ObjectNode req = makeRequest("get", objRef); req.put("property", property); return this.runtime.requestResponse(req).get("value"); }
[ "public", "JsonNode", "getPropertyValue", "(", "final", "JsiiObjectRef", "objRef", ",", "final", "String", "property", ")", "{", "ObjectNode", "req", "=", "makeRequest", "(", "\"get\"", ",", "objRef", ")", ";", "req", ".", "put", "(", "\"property\"", ",", "property", ")", ";", "return", "this", ".", "runtime", ".", "requestResponse", "(", "req", ")", ".", "get", "(", "\"value\"", ")", ";", "}" ]
Gets a value for a property from a remote object. @param objRef The remote object reference. @param property The property name. @return The value of the property.
[ "Gets", "a", "value", "for", "a", "property", "from", "a", "remote", "object", "." ]
train
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java#L109-L114
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/CollectionValuedMap.java
CollectionValuedMap.addAll
public void addAll(Map<K, V> m) { """ Adds all of the mappings in m to this CollectionValuedMap. If m is a CollectionValuedMap, it will behave strangely. Use the constructor instead. """ if (m instanceof CollectionValuedMap<?, ?>) { throw new UnsupportedOperationException(); } for (Map.Entry<K, V> e : m.entrySet()) { add(e.getKey(), e.getValue()); } }
java
public void addAll(Map<K, V> m) { if (m instanceof CollectionValuedMap<?, ?>) { throw new UnsupportedOperationException(); } for (Map.Entry<K, V> e : m.entrySet()) { add(e.getKey(), e.getValue()); } }
[ "public", "void", "addAll", "(", "Map", "<", "K", ",", "V", ">", "m", ")", "{", "if", "(", "m", "instanceof", "CollectionValuedMap", "<", "?", ",", "?", ">", ")", "{", "throw", "new", "UnsupportedOperationException", "(", ")", ";", "}", "for", "(", "Map", ".", "Entry", "<", "K", ",", "V", ">", "e", ":", "m", ".", "entrySet", "(", ")", ")", "{", "add", "(", "e", ".", "getKey", "(", ")", ",", "e", ".", "getValue", "(", ")", ")", ";", "}", "}" ]
Adds all of the mappings in m to this CollectionValuedMap. If m is a CollectionValuedMap, it will behave strangely. Use the constructor instead.
[ "Adds", "all", "of", "the", "mappings", "in", "m", "to", "this", "CollectionValuedMap", ".", "If", "m", "is", "a", "CollectionValuedMap", "it", "will", "behave", "strangely", ".", "Use", "the", "constructor", "instead", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/CollectionValuedMap.java#L100-L107
VoltDB/voltdb
third_party/java/src/org/apache/jute_voltpatches/Utils.java
Utils.bufEquals
public static boolean bufEquals(byte onearray[], byte twoarray[]) { """ equals function that actually compares two buffers. @param onearray First buffer @param twoarray Second buffer @return true if one and two contain exactly the same content, else false. """ if (onearray == twoarray) return true; boolean ret = (onearray.length == twoarray.length); if (!ret) { return ret; } for (int idx = 0; idx < onearray.length; idx++) { if (onearray[idx] != twoarray[idx]) { return false; } } return true; }
java
public static boolean bufEquals(byte onearray[], byte twoarray[]) { if (onearray == twoarray) return true; boolean ret = (onearray.length == twoarray.length); if (!ret) { return ret; } for (int idx = 0; idx < onearray.length; idx++) { if (onearray[idx] != twoarray[idx]) { return false; } } return true; }
[ "public", "static", "boolean", "bufEquals", "(", "byte", "onearray", "[", "]", ",", "byte", "twoarray", "[", "]", ")", "{", "if", "(", "onearray", "==", "twoarray", ")", "return", "true", ";", "boolean", "ret", "=", "(", "onearray", ".", "length", "==", "twoarray", ".", "length", ")", ";", "if", "(", "!", "ret", ")", "{", "return", "ret", ";", "}", "for", "(", "int", "idx", "=", "0", ";", "idx", "<", "onearray", ".", "length", ";", "idx", "++", ")", "{", "if", "(", "onearray", "[", "idx", "]", "!=", "twoarray", "[", "idx", "]", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
equals function that actually compares two buffers. @param onearray First buffer @param twoarray Second buffer @return true if one and two contain exactly the same content, else false.
[ "equals", "function", "that", "actually", "compares", "two", "buffers", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/jute_voltpatches/Utils.java#L43-L56
Netflix/conductor
client/src/main/java/com/netflix/conductor/client/http/TaskClient.java
TaskClient.logMessageForTask
public void logMessageForTask(String taskId, String logMessage) { """ Log execution messages for a task. @param taskId id of the task @param logMessage the message to be logged """ Preconditions.checkArgument(StringUtils.isNotBlank(taskId), "Task id cannot be blank"); postForEntityWithRequestOnly("tasks/" + taskId + "/log", logMessage); }
java
public void logMessageForTask(String taskId, String logMessage) { Preconditions.checkArgument(StringUtils.isNotBlank(taskId), "Task id cannot be blank"); postForEntityWithRequestOnly("tasks/" + taskId + "/log", logMessage); }
[ "public", "void", "logMessageForTask", "(", "String", "taskId", ",", "String", "logMessage", ")", "{", "Preconditions", ".", "checkArgument", "(", "StringUtils", ".", "isNotBlank", "(", "taskId", ")", ",", "\"Task id cannot be blank\"", ")", ";", "postForEntityWithRequestOnly", "(", "\"tasks/\"", "+", "taskId", "+", "\"/log\"", ",", "logMessage", ")", ";", "}" ]
Log execution messages for a task. @param taskId id of the task @param logMessage the message to be logged
[ "Log", "execution", "messages", "for", "a", "task", "." ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/client/src/main/java/com/netflix/conductor/client/http/TaskClient.java#L288-L291
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Convert.java
Convert.toLong
public static Long toLong(Object value) { """ Converts value to <code>Long</code> if it can. If value is a <code>Long</code>, it is returned, if it is a <code>Number</code>, it is promoted to <code>Long</code> and then returned, if it is a <code>Date</code>, returns its getTime() value, in all other cases, it converts the value to String, then tries to parse Long from it. @param value value to be converted to Long. @return value converted to Long. """ if (value == null) { return null; } else if (value instanceof Long) { return (Long) value; } else if (value instanceof Number) { return ((Number) value).longValue(); } else if (value instanceof java.util.Date) { return ((java.util.Date) value).getTime(); } else { try { return Long.valueOf(value.toString().trim()); } catch (NumberFormatException e) { throw new ConversionException("failed to convert: '" + value + "' to Long", e); } } }
java
public static Long toLong(Object value) { if (value == null) { return null; } else if (value instanceof Long) { return (Long) value; } else if (value instanceof Number) { return ((Number) value).longValue(); } else if (value instanceof java.util.Date) { return ((java.util.Date) value).getTime(); } else { try { return Long.valueOf(value.toString().trim()); } catch (NumberFormatException e) { throw new ConversionException("failed to convert: '" + value + "' to Long", e); } } }
[ "public", "static", "Long", "toLong", "(", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "else", "if", "(", "value", "instanceof", "Long", ")", "{", "return", "(", "Long", ")", "value", ";", "}", "else", "if", "(", "value", "instanceof", "Number", ")", "{", "return", "(", "(", "Number", ")", "value", ")", ".", "longValue", "(", ")", ";", "}", "else", "if", "(", "value", "instanceof", "java", ".", "util", ".", "Date", ")", "{", "return", "(", "(", "java", ".", "util", ".", "Date", ")", "value", ")", ".", "getTime", "(", ")", ";", "}", "else", "{", "try", "{", "return", "Long", ".", "valueOf", "(", "value", ".", "toString", "(", ")", ".", "trim", "(", ")", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "throw", "new", "ConversionException", "(", "\"failed to convert: '\"", "+", "value", "+", "\"' to Long\"", ",", "e", ")", ";", "}", "}", "}" ]
Converts value to <code>Long</code> if it can. If value is a <code>Long</code>, it is returned, if it is a <code>Number</code>, it is promoted to <code>Long</code> and then returned, if it is a <code>Date</code>, returns its getTime() value, in all other cases, it converts the value to String, then tries to parse Long from it. @param value value to be converted to Long. @return value converted to Long.
[ "Converts", "value", "to", "<code", ">", "Long<", "/", "code", ">", "if", "it", "can", ".", "If", "value", "is", "a", "<code", ">", "Long<", "/", "code", ">", "it", "is", "returned", "if", "it", "is", "a", "<code", ">", "Number<", "/", "code", ">", "it", "is", "promoted", "to", "<code", ">", "Long<", "/", "code", ">", "and", "then", "returned", "if", "it", "is", "a", "<code", ">", "Date<", "/", "code", ">", "returns", "its", "getTime", "()", "value", "in", "all", "other", "cases", "it", "converts", "the", "value", "to", "String", "then", "tries", "to", "parse", "Long", "from", "it", "." ]
train
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Convert.java#L347-L363
cdk/cdk
tool/builder3d/src/main/java/org/openscience/cdk/modeling/builder3d/AtomTetrahedralLigandPlacer3D.java
AtomTetrahedralLigandPlacer3D.getPlacedAtomsInAtomContainer
public IAtomContainer getPlacedAtomsInAtomContainer(IAtom atom, IAtomContainer ac) { """ Gets all placed neighbouring atoms of a atom. @param atom central atom (Atom) @param ac the molecule @return all connected and placed atoms to the central atom ((AtomContainer) """ List bonds = ac.getConnectedBondsList(atom); IAtomContainer connectedAtoms = atom.getBuilder().newInstance(IAtomContainer.class); IAtom connectedAtom = null; for (int i = 0; i < bonds.size(); i++) { connectedAtom = ((IBond) bonds.get(i)).getOther(atom); if (connectedAtom.getFlag(CDKConstants.ISPLACED)) { connectedAtoms.addAtom(connectedAtom); } } return connectedAtoms; }
java
public IAtomContainer getPlacedAtomsInAtomContainer(IAtom atom, IAtomContainer ac) { List bonds = ac.getConnectedBondsList(atom); IAtomContainer connectedAtoms = atom.getBuilder().newInstance(IAtomContainer.class); IAtom connectedAtom = null; for (int i = 0; i < bonds.size(); i++) { connectedAtom = ((IBond) bonds.get(i)).getOther(atom); if (connectedAtom.getFlag(CDKConstants.ISPLACED)) { connectedAtoms.addAtom(connectedAtom); } } return connectedAtoms; }
[ "public", "IAtomContainer", "getPlacedAtomsInAtomContainer", "(", "IAtom", "atom", ",", "IAtomContainer", "ac", ")", "{", "List", "bonds", "=", "ac", ".", "getConnectedBondsList", "(", "atom", ")", ";", "IAtomContainer", "connectedAtoms", "=", "atom", ".", "getBuilder", "(", ")", ".", "newInstance", "(", "IAtomContainer", ".", "class", ")", ";", "IAtom", "connectedAtom", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "bonds", ".", "size", "(", ")", ";", "i", "++", ")", "{", "connectedAtom", "=", "(", "(", "IBond", ")", "bonds", ".", "get", "(", "i", ")", ")", ".", "getOther", "(", "atom", ")", ";", "if", "(", "connectedAtom", ".", "getFlag", "(", "CDKConstants", ".", "ISPLACED", ")", ")", "{", "connectedAtoms", ".", "addAtom", "(", "connectedAtom", ")", ";", "}", "}", "return", "connectedAtoms", ";", "}" ]
Gets all placed neighbouring atoms of a atom. @param atom central atom (Atom) @param ac the molecule @return all connected and placed atoms to the central atom ((AtomContainer)
[ "Gets", "all", "placed", "neighbouring", "atoms", "of", "a", "atom", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/builder3d/src/main/java/org/openscience/cdk/modeling/builder3d/AtomTetrahedralLigandPlacer3D.java#L816-L828
elki-project/elki
elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/datastore/DataStoreUtil.java
DataStoreUtil.makeDBIDStorage
public static WritableDBIDDataStore makeDBIDStorage(DBIDs ids, int hints) { """ Make a new storage, to associate the given ids with an object of class dataclass. @param ids DBIDs to store data for @param hints Hints for the storage manager @return new data store """ return DataStoreFactory.FACTORY.makeDBIDStorage(ids, hints); }
java
public static WritableDBIDDataStore makeDBIDStorage(DBIDs ids, int hints) { return DataStoreFactory.FACTORY.makeDBIDStorage(ids, hints); }
[ "public", "static", "WritableDBIDDataStore", "makeDBIDStorage", "(", "DBIDs", "ids", ",", "int", "hints", ")", "{", "return", "DataStoreFactory", ".", "FACTORY", ".", "makeDBIDStorage", "(", "ids", ",", "hints", ")", ";", "}" ]
Make a new storage, to associate the given ids with an object of class dataclass. @param ids DBIDs to store data for @param hints Hints for the storage manager @return new data store
[ "Make", "a", "new", "storage", "to", "associate", "the", "given", "ids", "with", "an", "object", "of", "class", "dataclass", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/datastore/DataStoreUtil.java#L75-L77
fabric8io/kubernetes-client
kubernetes-client/src/main/java/io/fabric8/kubernetes/client/Config.java
Config.autoConfigure
public static Config autoConfigure(String context) { """ Does auto detection with some opinionated defaults. @param context if null will use current-context @return Config object """ Config config = new Config(); return autoConfigure(config, context); }
java
public static Config autoConfigure(String context) { Config config = new Config(); return autoConfigure(config, context); }
[ "public", "static", "Config", "autoConfigure", "(", "String", "context", ")", "{", "Config", "config", "=", "new", "Config", "(", ")", ";", "return", "autoConfigure", "(", "config", ",", "context", ")", ";", "}" ]
Does auto detection with some opinionated defaults. @param context if null will use current-context @return Config object
[ "Does", "auto", "detection", "with", "some", "opinionated", "defaults", "." ]
train
https://github.com/fabric8io/kubernetes-client/blob/141668a882ed8e902c045a5cd0a80f14bd17d132/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/Config.java#L209-L212
republicofgavin/PauseResumeAudioRecorder
library/src/main/java/com/github/republicofgavin/pauseresumeaudiorecorder/PauseResumeAudioRecorder.java
PauseResumeAudioRecorder.setAudioFile
public void setAudioFile(final String audioFilePath) { """ Setter for the audioFile. If the file does not contain a .wav suffix, it will be added. If the file has a suffix other than .wav, it will be removed. This API puts it in the prepared state. NOTE: The .wav file does not exist until the stop recording (and subsequent conversion) is completed. Where the data is stored temporarily is the same path and name just with .temp instead of .wav. @param audioFilePath A fully qualified file path for the audio file to be stored. The file path should exist and the file should not, errors can occur during writing. @throws IllegalArgumentException if the parameter is null, empty, blank. @throws IllegalStateException If the API is called while the recorder is not initialized or prepared. """ if (audioFilePath==null || audioFilePath.trim().isEmpty()){ throw new IllegalArgumentException("audioFile cannot be null, empty, blank, or directory"); } else if (currentAudioState.get()!=PREPARED_STATE && currentAudioState.get()!=INITIALIZED_STATE ){ throw new IllegalStateException("Recorder cannot have its file changed when it is not in an initialized or prepared state"); } String modifiedAudioFilePath=audioFilePath; if (modifiedAudioFilePath.toLowerCase(Locale.getDefault()).contains(".")){ final String subString=modifiedAudioFilePath.substring(modifiedAudioFilePath.lastIndexOf(".")); modifiedAudioFilePath=modifiedAudioFilePath.replace(subString,".temp"); } else { modifiedAudioFilePath=modifiedAudioFilePath+".temp"; } this.audioFile=modifiedAudioFilePath; currentAudioState.getAndSet(PREPARED_STATE); }
java
public void setAudioFile(final String audioFilePath){ if (audioFilePath==null || audioFilePath.trim().isEmpty()){ throw new IllegalArgumentException("audioFile cannot be null, empty, blank, or directory"); } else if (currentAudioState.get()!=PREPARED_STATE && currentAudioState.get()!=INITIALIZED_STATE ){ throw new IllegalStateException("Recorder cannot have its file changed when it is not in an initialized or prepared state"); } String modifiedAudioFilePath=audioFilePath; if (modifiedAudioFilePath.toLowerCase(Locale.getDefault()).contains(".")){ final String subString=modifiedAudioFilePath.substring(modifiedAudioFilePath.lastIndexOf(".")); modifiedAudioFilePath=modifiedAudioFilePath.replace(subString,".temp"); } else { modifiedAudioFilePath=modifiedAudioFilePath+".temp"; } this.audioFile=modifiedAudioFilePath; currentAudioState.getAndSet(PREPARED_STATE); }
[ "public", "void", "setAudioFile", "(", "final", "String", "audioFilePath", ")", "{", "if", "(", "audioFilePath", "==", "null", "||", "audioFilePath", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"audioFile cannot be null, empty, blank, or directory\"", ")", ";", "}", "else", "if", "(", "currentAudioState", ".", "get", "(", ")", "!=", "PREPARED_STATE", "&&", "currentAudioState", ".", "get", "(", ")", "!=", "INITIALIZED_STATE", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Recorder cannot have its file changed when it is not in an initialized or prepared state\"", ")", ";", "}", "String", "modifiedAudioFilePath", "=", "audioFilePath", ";", "if", "(", "modifiedAudioFilePath", ".", "toLowerCase", "(", "Locale", ".", "getDefault", "(", ")", ")", ".", "contains", "(", "\".\"", ")", ")", "{", "final", "String", "subString", "=", "modifiedAudioFilePath", ".", "substring", "(", "modifiedAudioFilePath", ".", "lastIndexOf", "(", "\".\"", ")", ")", ";", "modifiedAudioFilePath", "=", "modifiedAudioFilePath", ".", "replace", "(", "subString", ",", "\".temp\"", ")", ";", "}", "else", "{", "modifiedAudioFilePath", "=", "modifiedAudioFilePath", "+", "\".temp\"", ";", "}", "this", ".", "audioFile", "=", "modifiedAudioFilePath", ";", "currentAudioState", ".", "getAndSet", "(", "PREPARED_STATE", ")", ";", "}" ]
Setter for the audioFile. If the file does not contain a .wav suffix, it will be added. If the file has a suffix other than .wav, it will be removed. This API puts it in the prepared state. NOTE: The .wav file does not exist until the stop recording (and subsequent conversion) is completed. Where the data is stored temporarily is the same path and name just with .temp instead of .wav. @param audioFilePath A fully qualified file path for the audio file to be stored. The file path should exist and the file should not, errors can occur during writing. @throws IllegalArgumentException if the parameter is null, empty, blank. @throws IllegalStateException If the API is called while the recorder is not initialized or prepared.
[ "Setter", "for", "the", "audioFile", ".", "If", "the", "file", "does", "not", "contain", "a", ".", "wav", "suffix", "it", "will", "be", "added", ".", "If", "the", "file", "has", "a", "suffix", "other", "than", ".", "wav", "it", "will", "be", "removed", ".", "This", "API", "puts", "it", "in", "the", "prepared", "state", ".", "NOTE", ":", "The", ".", "wav", "file", "does", "not", "exist", "until", "the", "stop", "recording", "(", "and", "subsequent", "conversion", ")", "is", "completed", ".", "Where", "the", "data", "is", "stored", "temporarily", "is", "the", "same", "path", "and", "name", "just", "with", ".", "temp", "instead", "of", ".", "wav", "." ]
train
https://github.com/republicofgavin/PauseResumeAudioRecorder/blob/938128a6266fb5bd7b60f844b5d7e56e1899d4e2/library/src/main/java/com/github/republicofgavin/pauseresumeaudiorecorder/PauseResumeAudioRecorder.java#L159-L176
drinkjava2/jBeanBox
jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java
CheckClassAdapter.checkTypeRefAndPath
static void checkTypeRefAndPath(int typeRef, TypePath typePath) { """ Checks the reference to a type in a type annotation. @param typeRef a reference to an annotated type. @param typePath the path to the annotated type argument, wildcard bound, array element type, or static inner type within 'typeRef'. May be <tt>null</tt> if the annotation targets 'typeRef' as a whole. """ int mask = 0; switch (typeRef >>> 24) { case TypeReference.CLASS_TYPE_PARAMETER: case TypeReference.METHOD_TYPE_PARAMETER: case TypeReference.METHOD_FORMAL_PARAMETER: mask = 0xFFFF0000; break; case TypeReference.FIELD: case TypeReference.METHOD_RETURN: case TypeReference.METHOD_RECEIVER: case TypeReference.LOCAL_VARIABLE: case TypeReference.RESOURCE_VARIABLE: case TypeReference.INSTANCEOF: case TypeReference.NEW: case TypeReference.CONSTRUCTOR_REFERENCE: case TypeReference.METHOD_REFERENCE: mask = 0xFF000000; break; case TypeReference.CLASS_EXTENDS: case TypeReference.CLASS_TYPE_PARAMETER_BOUND: case TypeReference.METHOD_TYPE_PARAMETER_BOUND: case TypeReference.THROWS: case TypeReference.EXCEPTION_PARAMETER: mask = 0xFFFFFF00; break; case TypeReference.CAST: case TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT: case TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT: case TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT: case TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT: mask = 0xFF0000FF; break; default: throw new IllegalArgumentException("Invalid type reference sort 0x" + Integer.toHexString(typeRef >>> 24)); } if ((typeRef & ~mask) != 0) { throw new IllegalArgumentException("Invalid type reference 0x" + Integer.toHexString(typeRef)); } if (typePath != null) { for (int i = 0; i < typePath.getLength(); ++i) { int step = typePath.getStep(i); if (step != TypePath.ARRAY_ELEMENT && step != TypePath.INNER_TYPE && step != TypePath.TYPE_ARGUMENT && step != TypePath.WILDCARD_BOUND) { throw new IllegalArgumentException( "Invalid type path step " + i + " in " + typePath); } if (step != TypePath.TYPE_ARGUMENT && typePath.getStepArgument(i) != 0) { throw new IllegalArgumentException( "Invalid type path step argument for step " + i + " in " + typePath); } } } }
java
static void checkTypeRefAndPath(int typeRef, TypePath typePath) { int mask = 0; switch (typeRef >>> 24) { case TypeReference.CLASS_TYPE_PARAMETER: case TypeReference.METHOD_TYPE_PARAMETER: case TypeReference.METHOD_FORMAL_PARAMETER: mask = 0xFFFF0000; break; case TypeReference.FIELD: case TypeReference.METHOD_RETURN: case TypeReference.METHOD_RECEIVER: case TypeReference.LOCAL_VARIABLE: case TypeReference.RESOURCE_VARIABLE: case TypeReference.INSTANCEOF: case TypeReference.NEW: case TypeReference.CONSTRUCTOR_REFERENCE: case TypeReference.METHOD_REFERENCE: mask = 0xFF000000; break; case TypeReference.CLASS_EXTENDS: case TypeReference.CLASS_TYPE_PARAMETER_BOUND: case TypeReference.METHOD_TYPE_PARAMETER_BOUND: case TypeReference.THROWS: case TypeReference.EXCEPTION_PARAMETER: mask = 0xFFFFFF00; break; case TypeReference.CAST: case TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT: case TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT: case TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT: case TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT: mask = 0xFF0000FF; break; default: throw new IllegalArgumentException("Invalid type reference sort 0x" + Integer.toHexString(typeRef >>> 24)); } if ((typeRef & ~mask) != 0) { throw new IllegalArgumentException("Invalid type reference 0x" + Integer.toHexString(typeRef)); } if (typePath != null) { for (int i = 0; i < typePath.getLength(); ++i) { int step = typePath.getStep(i); if (step != TypePath.ARRAY_ELEMENT && step != TypePath.INNER_TYPE && step != TypePath.TYPE_ARGUMENT && step != TypePath.WILDCARD_BOUND) { throw new IllegalArgumentException( "Invalid type path step " + i + " in " + typePath); } if (step != TypePath.TYPE_ARGUMENT && typePath.getStepArgument(i) != 0) { throw new IllegalArgumentException( "Invalid type path step argument for step " + i + " in " + typePath); } } } }
[ "static", "void", "checkTypeRefAndPath", "(", "int", "typeRef", ",", "TypePath", "typePath", ")", "{", "int", "mask", "=", "0", ";", "switch", "(", "typeRef", ">>>", "24", ")", "{", "case", "TypeReference", ".", "CLASS_TYPE_PARAMETER", ":", "case", "TypeReference", ".", "METHOD_TYPE_PARAMETER", ":", "case", "TypeReference", ".", "METHOD_FORMAL_PARAMETER", ":", "mask", "=", "0xFFFF0000", ";", "break", ";", "case", "TypeReference", ".", "FIELD", ":", "case", "TypeReference", ".", "METHOD_RETURN", ":", "case", "TypeReference", ".", "METHOD_RECEIVER", ":", "case", "TypeReference", ".", "LOCAL_VARIABLE", ":", "case", "TypeReference", ".", "RESOURCE_VARIABLE", ":", "case", "TypeReference", ".", "INSTANCEOF", ":", "case", "TypeReference", ".", "NEW", ":", "case", "TypeReference", ".", "CONSTRUCTOR_REFERENCE", ":", "case", "TypeReference", ".", "METHOD_REFERENCE", ":", "mask", "=", "0xFF000000", ";", "break", ";", "case", "TypeReference", ".", "CLASS_EXTENDS", ":", "case", "TypeReference", ".", "CLASS_TYPE_PARAMETER_BOUND", ":", "case", "TypeReference", ".", "METHOD_TYPE_PARAMETER_BOUND", ":", "case", "TypeReference", ".", "THROWS", ":", "case", "TypeReference", ".", "EXCEPTION_PARAMETER", ":", "mask", "=", "0xFFFFFF00", ";", "break", ";", "case", "TypeReference", ".", "CAST", ":", "case", "TypeReference", ".", "CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT", ":", "case", "TypeReference", ".", "METHOD_INVOCATION_TYPE_ARGUMENT", ":", "case", "TypeReference", ".", "CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT", ":", "case", "TypeReference", ".", "METHOD_REFERENCE_TYPE_ARGUMENT", ":", "mask", "=", "0xFF0000FF", ";", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"Invalid type reference sort 0x\"", "+", "Integer", ".", "toHexString", "(", "typeRef", ">>>", "24", ")", ")", ";", "}", "if", "(", "(", "typeRef", "&", "~", "mask", ")", "!=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid type reference 0x\"", "+", "Integer", ".", "toHexString", "(", "typeRef", ")", ")", ";", "}", "if", "(", "typePath", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "typePath", ".", "getLength", "(", ")", ";", "++", "i", ")", "{", "int", "step", "=", "typePath", ".", "getStep", "(", "i", ")", ";", "if", "(", "step", "!=", "TypePath", ".", "ARRAY_ELEMENT", "&&", "step", "!=", "TypePath", ".", "INNER_TYPE", "&&", "step", "!=", "TypePath", ".", "TYPE_ARGUMENT", "&&", "step", "!=", "TypePath", ".", "WILDCARD_BOUND", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid type path step \"", "+", "i", "+", "\" in \"", "+", "typePath", ")", ";", "}", "if", "(", "step", "!=", "TypePath", ".", "TYPE_ARGUMENT", "&&", "typePath", ".", "getStepArgument", "(", "i", ")", "!=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid type path step argument for step \"", "+", "i", "+", "\" in \"", "+", "typePath", ")", ";", "}", "}", "}", "}" ]
Checks the reference to a type in a type annotation. @param typeRef a reference to an annotated type. @param typePath the path to the annotated type argument, wildcard bound, array element type, or static inner type within 'typeRef'. May be <tt>null</tt> if the annotation targets 'typeRef' as a whole.
[ "Checks", "the", "reference", "to", "a", "type", "in", "a", "type", "annotation", "." ]
train
https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java#L705-L764
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/interest/FactoryDetectPoint.java
FactoryDetectPoint.createHarris
public static <T extends ImageGray<T>, D extends ImageGray<D>> GeneralFeatureDetector<T, D> createHarris( @Nullable ConfigGeneralDetector configDetector, @Nullable ConfigHarrisCorner configCorner, Class<D> derivType) { """ Detects Harris corners. @param configDetector Configuration for feature detector. @param configCorner Configuration for corner intensity computation. If null radius will match detector radius @param derivType Type of derivative image. @see boofcv.alg.feature.detect.intensity.HarrisCornerIntensity """ if( configDetector == null) configDetector = new ConfigGeneralDetector(); if( configCorner == null) { configCorner = new ConfigHarrisCorner(); configCorner.radius = configDetector.radius; } GradientCornerIntensity<D> cornerIntensity = FactoryIntensityPointAlg.harris( configCorner.radius,(float)configCorner.kappa,configCorner.weighted, derivType); return createGeneral(cornerIntensity, configDetector); }
java
public static <T extends ImageGray<T>, D extends ImageGray<D>> GeneralFeatureDetector<T, D> createHarris( @Nullable ConfigGeneralDetector configDetector, @Nullable ConfigHarrisCorner configCorner, Class<D> derivType) { if( configDetector == null) configDetector = new ConfigGeneralDetector(); if( configCorner == null) { configCorner = new ConfigHarrisCorner(); configCorner.radius = configDetector.radius; } GradientCornerIntensity<D> cornerIntensity = FactoryIntensityPointAlg.harris( configCorner.radius,(float)configCorner.kappa,configCorner.weighted, derivType); return createGeneral(cornerIntensity, configDetector); }
[ "public", "static", "<", "T", "extends", "ImageGray", "<", "T", ">", ",", "D", "extends", "ImageGray", "<", "D", ">", ">", "GeneralFeatureDetector", "<", "T", ",", "D", ">", "createHarris", "(", "@", "Nullable", "ConfigGeneralDetector", "configDetector", ",", "@", "Nullable", "ConfigHarrisCorner", "configCorner", ",", "Class", "<", "D", ">", "derivType", ")", "{", "if", "(", "configDetector", "==", "null", ")", "configDetector", "=", "new", "ConfigGeneralDetector", "(", ")", ";", "if", "(", "configCorner", "==", "null", ")", "{", "configCorner", "=", "new", "ConfigHarrisCorner", "(", ")", ";", "configCorner", ".", "radius", "=", "configDetector", ".", "radius", ";", "}", "GradientCornerIntensity", "<", "D", ">", "cornerIntensity", "=", "FactoryIntensityPointAlg", ".", "harris", "(", "configCorner", ".", "radius", ",", "(", "float", ")", "configCorner", ".", "kappa", ",", "configCorner", ".", "weighted", ",", "derivType", ")", ";", "return", "createGeneral", "(", "cornerIntensity", ",", "configDetector", ")", ";", "}" ]
Detects Harris corners. @param configDetector Configuration for feature detector. @param configCorner Configuration for corner intensity computation. If null radius will match detector radius @param derivType Type of derivative image. @see boofcv.alg.feature.detect.intensity.HarrisCornerIntensity
[ "Detects", "Harris", "corners", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/interest/FactoryDetectPoint.java#L62-L76
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/matrix/DiagonalMatrix.java
DiagonalMatrix.setColumn
public void setColumn(int column, DoubleVector vector) { """ {@inheritDoc} Note that any values are not on the diagonal are ignored. """ checkIndices(vector.length() - 1, column); values[column] = vector.get(column); }
java
public void setColumn(int column, DoubleVector vector) { checkIndices(vector.length() - 1, column); values[column] = vector.get(column); }
[ "public", "void", "setColumn", "(", "int", "column", ",", "DoubleVector", "vector", ")", "{", "checkIndices", "(", "vector", ".", "length", "(", ")", "-", "1", ",", "column", ")", ";", "values", "[", "column", "]", "=", "vector", ".", "get", "(", "column", ")", ";", "}" ]
{@inheritDoc} Note that any values are not on the diagonal are ignored.
[ "{", "@inheritDoc", "}" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/matrix/DiagonalMatrix.java#L176-L180
inferred/FreeBuilder
src/main/java/org/inferred/freebuilder/processor/model/ModelUtils.java
ModelUtils.findAnnotationMirror
public static Optional<AnnotationMirror> findAnnotationMirror( Element element, QualifiedName annotationClass) { """ Returns an {@link AnnotationMirror} for the annotation of type {@code annotationClass} on {@code element}, or {@link Optional#empty()} if no such annotation exists. """ return findAnnotationMirror(element, Shading.unshadedName(annotationClass.toString())); }
java
public static Optional<AnnotationMirror> findAnnotationMirror( Element element, QualifiedName annotationClass) { return findAnnotationMirror(element, Shading.unshadedName(annotationClass.toString())); }
[ "public", "static", "Optional", "<", "AnnotationMirror", ">", "findAnnotationMirror", "(", "Element", "element", ",", "QualifiedName", "annotationClass", ")", "{", "return", "findAnnotationMirror", "(", "element", ",", "Shading", ".", "unshadedName", "(", "annotationClass", ".", "toString", "(", ")", ")", ")", ";", "}" ]
Returns an {@link AnnotationMirror} for the annotation of type {@code annotationClass} on {@code element}, or {@link Optional#empty()} if no such annotation exists.
[ "Returns", "an", "{" ]
train
https://github.com/inferred/FreeBuilder/blob/d5a222f90648aece135da4b971c55a60afe8649c/src/main/java/org/inferred/freebuilder/processor/model/ModelUtils.java#L67-L70
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslocspresponder.java
sslocspresponder.get
public static sslocspresponder get(nitro_service service, String name) throws Exception { """ Use this API to fetch sslocspresponder resource of given name . """ sslocspresponder obj = new sslocspresponder(); obj.set_name(name); sslocspresponder response = (sslocspresponder) obj.get_resource(service); return response; }
java
public static sslocspresponder get(nitro_service service, String name) throws Exception{ sslocspresponder obj = new sslocspresponder(); obj.set_name(name); sslocspresponder response = (sslocspresponder) obj.get_resource(service); return response; }
[ "public", "static", "sslocspresponder", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "sslocspresponder", "obj", "=", "new", "sslocspresponder", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "sslocspresponder", "response", "=", "(", "sslocspresponder", ")", "obj", ".", "get_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch sslocspresponder resource of given name .
[ "Use", "this", "API", "to", "fetch", "sslocspresponder", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslocspresponder.java#L634-L639
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/handler/impl/CudaZeroHandler.java
CudaZeroHandler.copyforward
@Override @Deprecated public void copyforward(AllocationPoint point, AllocationShape shape) { """ Copies memory from host buffer to device. Host copy is preserved as is. @param point """ /* Technically that's just a case for relocate, with source as HOST and target point.getAllocationStatus() */ log.info("copyforward() called on tp[" + point.getObjectId() + "], shape: " + point.getShape()); //relocate(AllocationStatus.HOST, point.getAllocationStatus(), point, shape); throw new UnsupportedOperationException("Deprecated call"); }
java
@Override @Deprecated public void copyforward(AllocationPoint point, AllocationShape shape) { /* Technically that's just a case for relocate, with source as HOST and target point.getAllocationStatus() */ log.info("copyforward() called on tp[" + point.getObjectId() + "], shape: " + point.getShape()); //relocate(AllocationStatus.HOST, point.getAllocationStatus(), point, shape); throw new UnsupportedOperationException("Deprecated call"); }
[ "@", "Override", "@", "Deprecated", "public", "void", "copyforward", "(", "AllocationPoint", "point", ",", "AllocationShape", "shape", ")", "{", "/*\n Technically that's just a case for relocate, with source as HOST and target point.getAllocationStatus()\n */", "log", ".", "info", "(", "\"copyforward() called on tp[\"", "+", "point", ".", "getObjectId", "(", ")", "+", "\"], shape: \"", "+", "point", ".", "getShape", "(", ")", ")", ";", "//relocate(AllocationStatus.HOST, point.getAllocationStatus(), point, shape);", "throw", "new", "UnsupportedOperationException", "(", "\"Deprecated call\"", ")", ";", "}" ]
Copies memory from host buffer to device. Host copy is preserved as is. @param point
[ "Copies", "memory", "from", "host", "buffer", "to", "device", ".", "Host", "copy", "is", "preserved", "as", "is", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/handler/impl/CudaZeroHandler.java#L470-L479
kcthota/emoji4j
src/main/java/emoji4j/AbstractEmoji.java
AbstractEmoji.htmlifyHelper
protected static String htmlifyHelper(String text, boolean isHex, boolean isSurrogate) { """ Helper to convert emoji characters to html entities in a string @param text String to htmlify @param isHex isHex @return htmlified string """ StringBuffer sb = new StringBuffer(); for (int i = 0; i < text.length(); i++) { int ch = text.codePointAt(i); if (ch <= 128) { sb.appendCodePoint(ch); } else if (ch > 128 && (ch < 159 || (ch >= 55296 && ch <= 57343))) { // don't write illegal html characters // refer // http://en.wikipedia.org/wiki/Character_encodings_in_HTML // Illegal characters section continue; } else { if (isHex) { sb.append("&#x" + Integer.toHexString(ch) + ";"); } else { if(isSurrogate) { double H = Math.floor((ch - 0x10000) / 0x400) + 0xD800; double L = ((ch - 0x10000) % 0x400) + 0xDC00; sb.append("&#"+String.format("%.0f", H)+";&#"+String.format("%.0f", L)+";"); } else { sb.append("&#" + ch + ";"); } } } } return sb.toString(); }
java
protected static String htmlifyHelper(String text, boolean isHex, boolean isSurrogate) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < text.length(); i++) { int ch = text.codePointAt(i); if (ch <= 128) { sb.appendCodePoint(ch); } else if (ch > 128 && (ch < 159 || (ch >= 55296 && ch <= 57343))) { // don't write illegal html characters // refer // http://en.wikipedia.org/wiki/Character_encodings_in_HTML // Illegal characters section continue; } else { if (isHex) { sb.append("&#x" + Integer.toHexString(ch) + ";"); } else { if(isSurrogate) { double H = Math.floor((ch - 0x10000) / 0x400) + 0xD800; double L = ((ch - 0x10000) % 0x400) + 0xDC00; sb.append("&#"+String.format("%.0f", H)+";&#"+String.format("%.0f", L)+";"); } else { sb.append("&#" + ch + ";"); } } } } return sb.toString(); }
[ "protected", "static", "String", "htmlifyHelper", "(", "String", "text", ",", "boolean", "isHex", ",", "boolean", "isSurrogate", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "text", ".", "length", "(", ")", ";", "i", "++", ")", "{", "int", "ch", "=", "text", ".", "codePointAt", "(", "i", ")", ";", "if", "(", "ch", "<=", "128", ")", "{", "sb", ".", "appendCodePoint", "(", "ch", ")", ";", "}", "else", "if", "(", "ch", ">", "128", "&&", "(", "ch", "<", "159", "||", "(", "ch", ">=", "55296", "&&", "ch", "<=", "57343", ")", ")", ")", "{", "// don't write illegal html characters", "// refer", "// http://en.wikipedia.org/wiki/Character_encodings_in_HTML", "// Illegal characters section", "continue", ";", "}", "else", "{", "if", "(", "isHex", ")", "{", "sb", ".", "append", "(", "\"&#x\"", "+", "Integer", ".", "toHexString", "(", "ch", ")", "+", "\";\"", ")", ";", "}", "else", "{", "if", "(", "isSurrogate", ")", "{", "double", "H", "=", "Math", ".", "floor", "(", "(", "ch", "-", "0x10000", ")", "/", "0x400", ")", "+", "0xD800", ";", "double", "L", "=", "(", "(", "ch", "-", "0x10000", ")", "%", "0x400", ")", "+", "0xDC00", ";", "sb", ".", "append", "(", "\"&#\"", "+", "String", ".", "format", "(", "\"%.0f\"", ",", "H", ")", "+", "\";&#\"", "+", "String", ".", "format", "(", "\"%.0f\"", ",", "L", ")", "+", "\";\"", ")", ";", "}", "else", "{", "sb", ".", "append", "(", "\"&#\"", "+", "ch", "+", "\";\"", ")", ";", "}", "}", "}", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Helper to convert emoji characters to html entities in a string @param text String to htmlify @param isHex isHex @return htmlified string
[ "Helper", "to", "convert", "emoji", "characters", "to", "html", "entities", "in", "a", "string" ]
train
https://github.com/kcthota/emoji4j/blob/b8cc0c60b8d804cfd7f3369689576b9a93ea1e6f/src/main/java/emoji4j/AbstractEmoji.java#L29-L61
ksclarke/vertx-pairtree
src/main/java/info/freelibrary/pairtree/fs/FsPairtree.java
FsPairtree.checkPrefix
private void checkPrefix(final Future<Boolean> aFuture) { """ Checks whether a Pairtree prefix file exists. @param aFuture The result of an action that may, or may not, have occurred yet. """ final String prefixFilePath = getPrefixFilePath(); myFileSystem.exists(prefixFilePath, result -> { if (result.succeeded()) { if (hasPrefix()) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(MessageCodes.PT_DEBUG_035, prefixFilePath); } if (result.result()) { aFuture.complete(result.result()); } else { aFuture.fail(new PairtreeException(MessageCodes.PT_013, prefixFilePath)); } } else { LOGGER.debug(MessageCodes.PT_DEBUG_009, prefixFilePath); if (result.result()) { aFuture.fail(new PairtreeException(MessageCodes.PT_014, prefixFilePath)); } else { aFuture.complete(!result.result()); } } } else { aFuture.fail(result.cause()); } }); }
java
private void checkPrefix(final Future<Boolean> aFuture) { final String prefixFilePath = getPrefixFilePath(); myFileSystem.exists(prefixFilePath, result -> { if (result.succeeded()) { if (hasPrefix()) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(MessageCodes.PT_DEBUG_035, prefixFilePath); } if (result.result()) { aFuture.complete(result.result()); } else { aFuture.fail(new PairtreeException(MessageCodes.PT_013, prefixFilePath)); } } else { LOGGER.debug(MessageCodes.PT_DEBUG_009, prefixFilePath); if (result.result()) { aFuture.fail(new PairtreeException(MessageCodes.PT_014, prefixFilePath)); } else { aFuture.complete(!result.result()); } } } else { aFuture.fail(result.cause()); } }); }
[ "private", "void", "checkPrefix", "(", "final", "Future", "<", "Boolean", ">", "aFuture", ")", "{", "final", "String", "prefixFilePath", "=", "getPrefixFilePath", "(", ")", ";", "myFileSystem", ".", "exists", "(", "prefixFilePath", ",", "result", "->", "{", "if", "(", "result", ".", "succeeded", "(", ")", ")", "{", "if", "(", "hasPrefix", "(", ")", ")", "{", "if", "(", "LOGGER", ".", "isDebugEnabled", "(", ")", ")", "{", "LOGGER", ".", "debug", "(", "MessageCodes", ".", "PT_DEBUG_035", ",", "prefixFilePath", ")", ";", "}", "if", "(", "result", ".", "result", "(", ")", ")", "{", "aFuture", ".", "complete", "(", "result", ".", "result", "(", ")", ")", ";", "}", "else", "{", "aFuture", ".", "fail", "(", "new", "PairtreeException", "(", "MessageCodes", ".", "PT_013", ",", "prefixFilePath", ")", ")", ";", "}", "}", "else", "{", "LOGGER", ".", "debug", "(", "MessageCodes", ".", "PT_DEBUG_009", ",", "prefixFilePath", ")", ";", "if", "(", "result", ".", "result", "(", ")", ")", "{", "aFuture", ".", "fail", "(", "new", "PairtreeException", "(", "MessageCodes", ".", "PT_014", ",", "prefixFilePath", ")", ")", ";", "}", "else", "{", "aFuture", ".", "complete", "(", "!", "result", ".", "result", "(", ")", ")", ";", "}", "}", "}", "else", "{", "aFuture", ".", "fail", "(", "result", ".", "cause", "(", ")", ")", ";", "}", "}", ")", ";", "}" ]
Checks whether a Pairtree prefix file exists. @param aFuture The result of an action that may, or may not, have occurred yet.
[ "Checks", "whether", "a", "Pairtree", "prefix", "file", "exists", "." ]
train
https://github.com/ksclarke/vertx-pairtree/blob/b2ea1e32057e5df262e9265540d346a732b718df/src/main/java/info/freelibrary/pairtree/fs/FsPairtree.java#L204-L232
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.checkRole
public void checkRole(CmsDbContext dbc, CmsRole role) throws CmsRoleViolationException { """ Checks if the user of the current database context has permissions to impersonate the given role in the given organizational unit.<p> If the organizational unit is <code>null</code>, this method will check if the given user has the given role for at least one organizational unit.<p> @param dbc the current OpenCms users database context @param role the role to check @throws CmsRoleViolationException if the user does not have the required role permissions @see org.opencms.security.CmsRoleManager#checkRole(CmsObject, CmsRole) """ if (!hasRole(dbc, dbc.currentUser(), role)) { if (role.getOuFqn() != null) { throw role.createRoleViolationExceptionForOrgUnit(dbc.getRequestContext(), role.getOuFqn()); } else { throw role.createRoleViolationException(dbc.getRequestContext()); } } }
java
public void checkRole(CmsDbContext dbc, CmsRole role) throws CmsRoleViolationException { if (!hasRole(dbc, dbc.currentUser(), role)) { if (role.getOuFqn() != null) { throw role.createRoleViolationExceptionForOrgUnit(dbc.getRequestContext(), role.getOuFqn()); } else { throw role.createRoleViolationException(dbc.getRequestContext()); } } }
[ "public", "void", "checkRole", "(", "CmsDbContext", "dbc", ",", "CmsRole", "role", ")", "throws", "CmsRoleViolationException", "{", "if", "(", "!", "hasRole", "(", "dbc", ",", "dbc", ".", "currentUser", "(", ")", ",", "role", ")", ")", "{", "if", "(", "role", ".", "getOuFqn", "(", ")", "!=", "null", ")", "{", "throw", "role", ".", "createRoleViolationExceptionForOrgUnit", "(", "dbc", ".", "getRequestContext", "(", ")", ",", "role", ".", "getOuFqn", "(", ")", ")", ";", "}", "else", "{", "throw", "role", ".", "createRoleViolationException", "(", "dbc", ".", "getRequestContext", "(", ")", ")", ";", "}", "}", "}" ]
Checks if the user of the current database context has permissions to impersonate the given role in the given organizational unit.<p> If the organizational unit is <code>null</code>, this method will check if the given user has the given role for at least one organizational unit.<p> @param dbc the current OpenCms users database context @param role the role to check @throws CmsRoleViolationException if the user does not have the required role permissions @see org.opencms.security.CmsRoleManager#checkRole(CmsObject, CmsRole)
[ "Checks", "if", "the", "user", "of", "the", "current", "database", "context", "has", "permissions", "to", "impersonate", "the", "given", "role", "in", "the", "given", "organizational", "unit", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L562-L571
jbundle/jbundle
base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XScreenField.java
XScreenField.printInputControl
public void printInputControl(PrintWriter out, String strFieldDesc, String strFieldName, String strSize, String strMaxSize, String strValue, String strControlType, String strFieldType) { """ Display this field in XML input format. @param strFieldType The field type """ out.println(" <xfm:" + strControlType + " xform=\"form1\" ref=\"" + strFieldName + "\" cols=\"" + strSize + "\" type=\"" + strFieldType + "\">"); out.println(" <xfm:caption>" + strFieldDesc + "</xfm:caption>"); out.println(" </xfm:" + strControlType + ">"); }
java
public void printInputControl(PrintWriter out, String strFieldDesc, String strFieldName, String strSize, String strMaxSize, String strValue, String strControlType, String strFieldType) { out.println(" <xfm:" + strControlType + " xform=\"form1\" ref=\"" + strFieldName + "\" cols=\"" + strSize + "\" type=\"" + strFieldType + "\">"); out.println(" <xfm:caption>" + strFieldDesc + "</xfm:caption>"); out.println(" </xfm:" + strControlType + ">"); }
[ "public", "void", "printInputControl", "(", "PrintWriter", "out", ",", "String", "strFieldDesc", ",", "String", "strFieldName", ",", "String", "strSize", ",", "String", "strMaxSize", ",", "String", "strValue", ",", "String", "strControlType", ",", "String", "strFieldType", ")", "{", "out", ".", "println", "(", "\" <xfm:\"", "+", "strControlType", "+", "\" xform=\\\"form1\\\" ref=\\\"\"", "+", "strFieldName", "+", "\"\\\" cols=\\\"\"", "+", "strSize", "+", "\"\\\" type=\\\"\"", "+", "strFieldType", "+", "\"\\\">\"", ")", ";", "out", ".", "println", "(", "\" <xfm:caption>\"", "+", "strFieldDesc", "+", "\"</xfm:caption>\"", ")", ";", "out", ".", "println", "(", "\" </xfm:\"", "+", "strControlType", "+", "\">\"", ")", ";", "}" ]
Display this field in XML input format. @param strFieldType The field type
[ "Display", "this", "field", "in", "XML", "input", "format", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XScreenField.java#L147-L152
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/client/injection/WebServiceRefBinding.java
WebServiceRefBinding.processExistingWSDL
private void processExistingWSDL(String wsdlLocation, Member newMember) throws InjectionException { """ This will compare the wsdlLocation attribute of the various annotations that have refer to the same service reference. If they differ we will throw an exception as the runtime will not be able to determine which WSDL to use. We will only do this checking if there was not a WSDL location specified in the deployment descriptor. If the DD specifies a deployment descriptor that value will be used, and other values will be ignored. """ // if the wsdlLocation for this service reference is specified in the DD, log a debug statement and continue if (wsrInfo.getWsdlLocation() != null && !"".equals(wsrInfo.getWsdlLocation())) { if (tc.isDebugEnabled()) { Tr.debug(tc, "For the " + wsrInfo.getJndiName() + " service reference, " + "the " + wsrInfo.getWsdlLocation() + " WSDL file is specified in the " + "deployment descriptor. Annotation metadata referencing a WSDL file for " + "this service reference will be ignored."); } } else { // else we want to set the value to whatever is in the annotation if (tc.isDebugEnabled()) { Tr.debug(tc, "For the " + wsrInfo.getJndiName() + " service reference, " + "setting the wsdlLocation: " + wsdlLocation); } wsrInfo.setWsdlLocation(wsdlLocation); } }
java
private void processExistingWSDL(String wsdlLocation, Member newMember) throws InjectionException { // if the wsdlLocation for this service reference is specified in the DD, log a debug statement and continue if (wsrInfo.getWsdlLocation() != null && !"".equals(wsrInfo.getWsdlLocation())) { if (tc.isDebugEnabled()) { Tr.debug(tc, "For the " + wsrInfo.getJndiName() + " service reference, " + "the " + wsrInfo.getWsdlLocation() + " WSDL file is specified in the " + "deployment descriptor. Annotation metadata referencing a WSDL file for " + "this service reference will be ignored."); } } else { // else we want to set the value to whatever is in the annotation if (tc.isDebugEnabled()) { Tr.debug(tc, "For the " + wsrInfo.getJndiName() + " service reference, " + "setting the wsdlLocation: " + wsdlLocation); } wsrInfo.setWsdlLocation(wsdlLocation); } }
[ "private", "void", "processExistingWSDL", "(", "String", "wsdlLocation", ",", "Member", "newMember", ")", "throws", "InjectionException", "{", "// if the wsdlLocation for this service reference is specified in the DD, log a debug statement and continue", "if", "(", "wsrInfo", ".", "getWsdlLocation", "(", ")", "!=", "null", "&&", "!", "\"\"", ".", "equals", "(", "wsrInfo", ".", "getWsdlLocation", "(", ")", ")", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"For the \"", "+", "wsrInfo", ".", "getJndiName", "(", ")", "+", "\" service reference, \"", "+", "\"the \"", "+", "wsrInfo", ".", "getWsdlLocation", "(", ")", "+", "\" WSDL file is specified in the \"", "+", "\"deployment descriptor. Annotation metadata referencing a WSDL file for \"", "+", "\"this service reference will be ignored.\"", ")", ";", "}", "}", "else", "{", "// else we want to set the value to whatever is in the annotation", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"For the \"", "+", "wsrInfo", ".", "getJndiName", "(", ")", "+", "\" service reference, \"", "+", "\"setting the wsdlLocation: \"", "+", "wsdlLocation", ")", ";", "}", "wsrInfo", ".", "setWsdlLocation", "(", "wsdlLocation", ")", ";", "}", "}" ]
This will compare the wsdlLocation attribute of the various annotations that have refer to the same service reference. If they differ we will throw an exception as the runtime will not be able to determine which WSDL to use. We will only do this checking if there was not a WSDL location specified in the deployment descriptor. If the DD specifies a deployment descriptor that value will be used, and other values will be ignored.
[ "This", "will", "compare", "the", "wsdlLocation", "attribute", "of", "the", "various", "annotations", "that", "have", "refer", "to", "the", "same", "service", "reference", ".", "If", "they", "differ", "we", "will", "throw", "an", "exception", "as", "the", "runtime", "will", "not", "be", "able", "to", "determine", "which", "WSDL", "to", "use", ".", "We", "will", "only", "do", "this", "checking", "if", "there", "was", "not", "a", "WSDL", "location", "specified", "in", "the", "deployment", "descriptor", ".", "If", "the", "DD", "specifies", "a", "deployment", "descriptor", "that", "value", "will", "be", "used", "and", "other", "values", "will", "be", "ignored", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/client/injection/WebServiceRefBinding.java#L343-L357
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/SpringServlet.java
SpringServlet.getFedoraHomeDir
private File getFedoraHomeDir() throws ServletException { """ Validates and returns the value of FEDORA_HOME. @return the FEDORA_HOME directory. @throws ServletException if FEDORA_HOME (or fedora.home) was not set, does not denote an existing directory, or is not writable by the current user. """ String fedoraHome = Constants.FEDORA_HOME; if (fedoraHome == null) { failStartup("FEDORA_HOME was not configured properly. It must be " + "set via the fedora.home servlet init-param (preferred), " + "the fedora.home system property, or the FEDORA_HOME " + "environment variable.", null); } File fedoraHomeDir = new File(fedoraHome); if (!fedoraHomeDir.isDirectory()) { failStartup("The FEDORA_HOME directory, " + fedoraHomeDir.getPath() + " does not exist", null); } File writeTest = new File(fedoraHomeDir, "writeTest.tmp"); String writeErrorMessage = "The FEDORA_HOME directory, " + fedoraHomeDir.getPath() + " is not writable by " + "the current user, " + System.getProperty("user.name"); try { writeTest.createNewFile(); if (!writeTest.exists()) { throw new IOException(""); } writeTest.delete(); } catch (IOException e) { failStartup(writeErrorMessage, null); } return fedoraHomeDir; }
java
private File getFedoraHomeDir() throws ServletException { String fedoraHome = Constants.FEDORA_HOME; if (fedoraHome == null) { failStartup("FEDORA_HOME was not configured properly. It must be " + "set via the fedora.home servlet init-param (preferred), " + "the fedora.home system property, or the FEDORA_HOME " + "environment variable.", null); } File fedoraHomeDir = new File(fedoraHome); if (!fedoraHomeDir.isDirectory()) { failStartup("The FEDORA_HOME directory, " + fedoraHomeDir.getPath() + " does not exist", null); } File writeTest = new File(fedoraHomeDir, "writeTest.tmp"); String writeErrorMessage = "The FEDORA_HOME directory, " + fedoraHomeDir.getPath() + " is not writable by " + "the current user, " + System.getProperty("user.name"); try { writeTest.createNewFile(); if (!writeTest.exists()) { throw new IOException(""); } writeTest.delete(); } catch (IOException e) { failStartup(writeErrorMessage, null); } return fedoraHomeDir; }
[ "private", "File", "getFedoraHomeDir", "(", ")", "throws", "ServletException", "{", "String", "fedoraHome", "=", "Constants", ".", "FEDORA_HOME", ";", "if", "(", "fedoraHome", "==", "null", ")", "{", "failStartup", "(", "\"FEDORA_HOME was not configured properly. It must be \"", "+", "\"set via the fedora.home servlet init-param (preferred), \"", "+", "\"the fedora.home system property, or the FEDORA_HOME \"", "+", "\"environment variable.\"", ",", "null", ")", ";", "}", "File", "fedoraHomeDir", "=", "new", "File", "(", "fedoraHome", ")", ";", "if", "(", "!", "fedoraHomeDir", ".", "isDirectory", "(", ")", ")", "{", "failStartup", "(", "\"The FEDORA_HOME directory, \"", "+", "fedoraHomeDir", ".", "getPath", "(", ")", "+", "\" does not exist\"", ",", "null", ")", ";", "}", "File", "writeTest", "=", "new", "File", "(", "fedoraHomeDir", ",", "\"writeTest.tmp\"", ")", ";", "String", "writeErrorMessage", "=", "\"The FEDORA_HOME directory, \"", "+", "fedoraHomeDir", ".", "getPath", "(", ")", "+", "\" is not writable by \"", "+", "\"the current user, \"", "+", "System", ".", "getProperty", "(", "\"user.name\"", ")", ";", "try", "{", "writeTest", ".", "createNewFile", "(", ")", ";", "if", "(", "!", "writeTest", ".", "exists", "(", ")", ")", "{", "throw", "new", "IOException", "(", "\"\"", ")", ";", "}", "writeTest", ".", "delete", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "failStartup", "(", "writeErrorMessage", ",", "null", ")", ";", "}", "return", "fedoraHomeDir", ";", "}" ]
Validates and returns the value of FEDORA_HOME. @return the FEDORA_HOME directory. @throws ServletException if FEDORA_HOME (or fedora.home) was not set, does not denote an existing directory, or is not writable by the current user.
[ "Validates", "and", "returns", "the", "value", "of", "FEDORA_HOME", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/SpringServlet.java#L85-L115
labai/ted
ted-driver/src/main/java/ted/driver/TedDriver.java
TedDriver.createAndExecuteTask
public Long createAndExecuteTask(String taskName, String data, String key1, String key2) { """ create task and immediately execute it (will wait until execution finish) """ return tedDriverImpl.createAndExecuteTask(taskName, data, key1, key2, false); }
java
public Long createAndExecuteTask(String taskName, String data, String key1, String key2) { return tedDriverImpl.createAndExecuteTask(taskName, data, key1, key2, false); }
[ "public", "Long", "createAndExecuteTask", "(", "String", "taskName", ",", "String", "data", ",", "String", "key1", ",", "String", "key2", ")", "{", "return", "tedDriverImpl", ".", "createAndExecuteTask", "(", "taskName", ",", "data", ",", "key1", ",", "key2", ",", "false", ")", ";", "}" ]
create task and immediately execute it (will wait until execution finish)
[ "create", "task", "and", "immediately", "execute", "it", "(", "will", "wait", "until", "execution", "finish", ")" ]
train
https://github.com/labai/ted/blob/2ee197246a78d842c18d6780c48fd903b00608a6/ted-driver/src/main/java/ted/driver/TedDriver.java#L87-L89
BlueBrain/bluima
modules/bluima_pdf/src/main/java/edu/psu/seersuite/extractors/tableextractor/Debug.java
Debug.printStatInfo
public static void printStatInfo(String outputDirPath, File pdfFile, int pageNum, int tableNum) { """ After processing all the PDF documents, this method helps us to get the statistic information of all the PDF documents such as the total number of pages, tables, etc. @param outputDirPath the directory path where the middle-stage results will go to @param pdfFile the PDF file being processed @param pageNum the total number of pages in the PDF directory @param tableNum the total number of detected tables in the PDF directory @throws IOException """ try { File classificationData = new File(outputDirPath, "statInfo"); if (!classificationData.exists()) { classificationData.mkdirs(); } File fileName = new File(classificationData, "tableNumStatInfo.txt"); BufferedWriter bw0 = new BufferedWriter(new FileWriter(fileName, true)); bw0.append(outputDirPath+pdfFile.getName() + "\t\t" + pageNum + " PAGES\t\t" + tableNum + " TABLES\n"); bw0.close(); } catch (IOException e){ System.out.printf("[Debug Error] IOException\n"); } }
java
public static void printStatInfo(String outputDirPath, File pdfFile, int pageNum, int tableNum) { try { File classificationData = new File(outputDirPath, "statInfo"); if (!classificationData.exists()) { classificationData.mkdirs(); } File fileName = new File(classificationData, "tableNumStatInfo.txt"); BufferedWriter bw0 = new BufferedWriter(new FileWriter(fileName, true)); bw0.append(outputDirPath+pdfFile.getName() + "\t\t" + pageNum + " PAGES\t\t" + tableNum + " TABLES\n"); bw0.close(); } catch (IOException e){ System.out.printf("[Debug Error] IOException\n"); } }
[ "public", "static", "void", "printStatInfo", "(", "String", "outputDirPath", ",", "File", "pdfFile", ",", "int", "pageNum", ",", "int", "tableNum", ")", "{", "try", "{", "File", "classificationData", "=", "new", "File", "(", "outputDirPath", ",", "\"statInfo\"", ")", ";", "if", "(", "!", "classificationData", ".", "exists", "(", ")", ")", "{", "classificationData", ".", "mkdirs", "(", ")", ";", "}", "File", "fileName", "=", "new", "File", "(", "classificationData", ",", "\"tableNumStatInfo.txt\"", ")", ";", "BufferedWriter", "bw0", "=", "new", "BufferedWriter", "(", "new", "FileWriter", "(", "fileName", ",", "true", ")", ")", ";", "bw0", ".", "append", "(", "outputDirPath", "+", "pdfFile", ".", "getName", "(", ")", "+", "\"\\t\\t\"", "+", "pageNum", "+", "\" PAGES\\t\\t\"", "+", "tableNum", "+", "\" TABLES\\n\"", ")", ";", "bw0", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "System", ".", "out", ".", "printf", "(", "\"[Debug Error] IOException\\n\"", ")", ";", "}", "}" ]
After processing all the PDF documents, this method helps us to get the statistic information of all the PDF documents such as the total number of pages, tables, etc. @param outputDirPath the directory path where the middle-stage results will go to @param pdfFile the PDF file being processed @param pageNum the total number of pages in the PDF directory @param tableNum the total number of detected tables in the PDF directory @throws IOException
[ "After", "processing", "all", "the", "PDF", "documents", "this", "method", "helps", "us", "to", "get", "the", "statistic", "information", "of", "all", "the", "PDF", "documents", "such", "as", "the", "total", "number", "of", "pages", "tables", "etc", "." ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_pdf/src/main/java/edu/psu/seersuite/extractors/tableextractor/Debug.java#L148-L162