repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
gosu-lang/gosu-lang
gosu-core-api/src/main/java/gw/util/GosuStringUtil.java
GosuStringUtil.containsIgnoreCase
public static boolean containsIgnoreCase(String str, String searchStr) { if (str == null || searchStr == null) { return false; } return contains(str.toUpperCase(), searchStr.toUpperCase()); }
java
public static boolean containsIgnoreCase(String str, String searchStr) { if (str == null || searchStr == null) { return false; } return contains(str.toUpperCase(), searchStr.toUpperCase()); }
[ "public", "static", "boolean", "containsIgnoreCase", "(", "String", "str", ",", "String", "searchStr", ")", "{", "if", "(", "str", "==", "null", "||", "searchStr", "==", "null", ")", "{", "return", "false", ";", "}", "return", "contains", "(", "str", "."...
<p>Checks if String contains a search String irrespective of case, handling <code>null</code>. This method uses {@link #contains(String, String)}.</p> <p>A <code>null</code> String will return <code>false</code>.</p> <pre> GosuStringUtil.contains(null, *) = false GosuStringUtil.contains(*, null) = false GosuStringUtil.contains("", "") = true GosuStringUtil.contains("abc", "") = true GosuStringUtil.contains("abc", "a") = true GosuStringUtil.contains("abc", "z") = false GosuStringUtil.contains("abc", "A") = true GosuStringUtil.contains("abc", "Z") = false </pre> @param str the String to check, may be null @param searchStr the String to find, may be null @return true if the String contains the search String irrespective of case or false if not or <code>null</code> string input
[ "<p", ">", "Checks", "if", "String", "contains", "a", "search", "String", "irrespective", "of", "case", "handling", "<code", ">", "null<", "/", "code", ">", ".", "This", "method", "uses", "{", "@link", "#contains", "(", "String", "String", ")", "}", ".",...
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuStringUtil.java#L1036-L1041
Stratio/stratio-cassandra
src/java/org/apache/cassandra/tools/SSTableImport.java
SSTableImport.stringAsType
private static ByteBuffer stringAsType(String content, AbstractType<?> type) { try { return type.fromString(content); } catch (MarshalException e) { throw new RuntimeException(e.getMessage()); } }
java
private static ByteBuffer stringAsType(String content, AbstractType<?> type) { try { return type.fromString(content); } catch (MarshalException e) { throw new RuntimeException(e.getMessage()); } }
[ "private", "static", "ByteBuffer", "stringAsType", "(", "String", "content", ",", "AbstractType", "<", "?", ">", "type", ")", "{", "try", "{", "return", "type", ".", "fromString", "(", "content", ")", ";", "}", "catch", "(", "MarshalException", "e", ")", ...
Convert a string to bytes (ByteBuffer) according to type @param content string to convert @param type type to use for conversion @return byte buffer representation of the given string
[ "Convert", "a", "string", "to", "bytes", "(", "ByteBuffer", ")", "according", "to", "type" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/tools/SSTableImport.java#L546-L556
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java
CacheProviderWrapper.getDepIdsByRangeDisk
@Override public Set getDepIdsByRangeDisk(int index, int length) { final String methodName = "getDepIdsByRangeDisk()"; Set ids = new HashSet(); if (this.swapToDisk) { // TODO write code to support getDepIdsByRangeDisk function if (tc.isDebugEnabled()) { Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it is not implemented yet"); } } else { if (this.featureSupport.isDiskCacheSupported() == false) { Tr.error(tc, "DYNA1064E", new Object[] { methodName, cacheName, this.cacheProviderName }); } else { if (tc.isDebugEnabled()) { Tr.debug(tc, methodName + " cacheName=" + cacheName + " no operation is done because the disk cache offload is not enabled"); } } } return ids; }
java
@Override public Set getDepIdsByRangeDisk(int index, int length) { final String methodName = "getDepIdsByRangeDisk()"; Set ids = new HashSet(); if (this.swapToDisk) { // TODO write code to support getDepIdsByRangeDisk function if (tc.isDebugEnabled()) { Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it is not implemented yet"); } } else { if (this.featureSupport.isDiskCacheSupported() == false) { Tr.error(tc, "DYNA1064E", new Object[] { methodName, cacheName, this.cacheProviderName }); } else { if (tc.isDebugEnabled()) { Tr.debug(tc, methodName + " cacheName=" + cacheName + " no operation is done because the disk cache offload is not enabled"); } } } return ids; }
[ "@", "Override", "public", "Set", "getDepIdsByRangeDisk", "(", "int", "index", ",", "int", "length", ")", "{", "final", "String", "methodName", "=", "\"getDepIdsByRangeDisk()\"", ";", "Set", "ids", "=", "new", "HashSet", "(", ")", ";", "if", "(", "this", "...
Returns a set of dependency IDs based on the range and size. WARNING: If index = 1 or -1, the set might contain "DISKCACHE_MORE" to indicate there are more dep ids on the disk cache. The caller need to remove DISKCACHE_MORE" from the set before it is being used. The "DISKCACHE_MORE" key is defined as HTODDynacache.DISKCACHE_MORE. @param index If index = 0, it starts the beginning. If index = 1, it means "next". If Index = -1, it means "previous". @param length The max number of dependency ids to be read. If length = -1, it reads all dependency ids until the end. @return The Set of dependency ids.
[ "Returns", "a", "set", "of", "dependency", "IDs", "based", "on", "the", "range", "and", "size", ".", "WARNING", ":", "If", "index", "=", "1", "or", "-", "1", "the", "set", "might", "contain", "DISKCACHE_MORE", "to", "indicate", "there", "are", "more", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java#L1015-L1034
line/centraldogma
server/src/main/java/com/linecorp/centraldogma/server/internal/api/HttpApiUtil.java
HttpApiUtil.throwResponse
public static <T> T throwResponse(RequestContext ctx, HttpStatus status, String message) { throw HttpResponseException.of(newResponse(ctx, status, message)); }
java
public static <T> T throwResponse(RequestContext ctx, HttpStatus status, String message) { throw HttpResponseException.of(newResponse(ctx, status, message)); }
[ "public", "static", "<", "T", ">", "T", "throwResponse", "(", "RequestContext", "ctx", ",", "HttpStatus", "status", ",", "String", "message", ")", "{", "throw", "HttpResponseException", ".", "of", "(", "newResponse", "(", "ctx", ",", "status", ",", "message"...
Throws a newly created {@link HttpResponseException} with the specified {@link HttpStatus} and {@code message}.
[ "Throws", "a", "newly", "created", "{" ]
train
https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/api/HttpApiUtil.java#L70-L72
jbundle/jbundle
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java
FieldInfo.setData
public int setData(Object vpData, boolean bDisplayOption, int iMoveMode) { boolean bModified = true; if ((m_data == vpData) || ((m_data != null) && (m_data.equals(vpData)))) bModified = false; m_data = vpData; // Set the data if (bDisplayOption) this.displayField(); // Display the data if (iMoveMode == Constants.SCREEN_MOVE) { if (bModified) { m_bModified = true; // This field has been modified. if (m_record != null) // Never return m_record.doRecordChange(this, iMoveMode, bDisplayOption); // Tell the record that I changed } } else m_bModified = false; // Init or read clears this flag return Constants.NORMAL_RETURN; }
java
public int setData(Object vpData, boolean bDisplayOption, int iMoveMode) { boolean bModified = true; if ((m_data == vpData) || ((m_data != null) && (m_data.equals(vpData)))) bModified = false; m_data = vpData; // Set the data if (bDisplayOption) this.displayField(); // Display the data if (iMoveMode == Constants.SCREEN_MOVE) { if (bModified) { m_bModified = true; // This field has been modified. if (m_record != null) // Never return m_record.doRecordChange(this, iMoveMode, bDisplayOption); // Tell the record that I changed } } else m_bModified = false; // Init or read clears this flag return Constants.NORMAL_RETURN; }
[ "public", "int", "setData", "(", "Object", "vpData", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "boolean", "bModified", "=", "true", ";", "if", "(", "(", "m_data", "==", "vpData", ")", "||", "(", "(", "m_data", "!=", "null", "...
Move the physical binary data to this field. (Must be the same physical type... setText makes sure of that) After seting the data, I call the doRecordChange() method of the record if I changed. @param vpData The data to set the field to. @param bDisplayOption Display the data on the screen if true (call displayField()). @param iMoveMode INIT, SCREEN, or READ move mode. @return The error code.
[ "Move", "the", "physical", "binary", "data", "to", "this", "field", ".", "(", "Must", "be", "the", "same", "physical", "type", "...", "setText", "makes", "sure", "of", "that", ")", "After", "seting", "the", "data", "I", "call", "the", "doRecordChange", "...
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java#L244-L264
spring-projects/spring-boot
spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java
Launcher.createMainMethodRunner
protected MainMethodRunner createMainMethodRunner(String mainClass, String[] args, ClassLoader classLoader) { return new MainMethodRunner(mainClass, args); }
java
protected MainMethodRunner createMainMethodRunner(String mainClass, String[] args, ClassLoader classLoader) { return new MainMethodRunner(mainClass, args); }
[ "protected", "MainMethodRunner", "createMainMethodRunner", "(", "String", "mainClass", ",", "String", "[", "]", "args", ",", "ClassLoader", "classLoader", ")", "{", "return", "new", "MainMethodRunner", "(", "mainClass", ",", "args", ")", ";", "}" ]
Create the {@code MainMethodRunner} used to launch the application. @param mainClass the main class @param args the incoming arguments @param classLoader the classloader @return the main method runner
[ "Create", "the", "{" ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java#L97-L100
alibaba/Tangram-Android
tangram/src/main/java/com/tmall/wireless/tangram/eventbus/BusSupport.java
BusSupport.wrapEventHandler
public static EventHandlerWrapper wrapEventHandler(@NonNull String type, String producer, @NonNull Object subscriber, String action) { return new EventHandlerWrapper(type, producer, subscriber, action); }
java
public static EventHandlerWrapper wrapEventHandler(@NonNull String type, String producer, @NonNull Object subscriber, String action) { return new EventHandlerWrapper(type, producer, subscriber, action); }
[ "public", "static", "EventHandlerWrapper", "wrapEventHandler", "(", "@", "NonNull", "String", "type", ",", "String", "producer", ",", "@", "NonNull", "Object", "subscriber", ",", "String", "action", ")", "{", "return", "new", "EventHandlerWrapper", "(", "type", ...
See {@link EventHandlerWrapper} @param type The event type subcriber is interested. @param producer The event source id subscriber is interested. @param subscriber Original subscriber object. @param action The name of callback method with parameter 'TangramOp1'. If empty, the subscribe must provide a handler method named 'execute'. See {@link ReflectedActionFinder} @return An EventHandlerWrapper wrapping a subscriber and used to registered into event bus.
[ "See", "{" ]
train
https://github.com/alibaba/Tangram-Android/blob/caa57f54e009c8dacd34a2322d5761956ebed321/tangram/src/main/java/com/tmall/wireless/tangram/eventbus/BusSupport.java#L168-L171
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/openal/DeferredSound.java
DeferredSound.playAsSoundEffect
public int playAsSoundEffect(float pitch, float gain, boolean loop, float x, float y, float z) { checkTarget(); return target.playAsSoundEffect(pitch, gain, loop, x, y, z); }
java
public int playAsSoundEffect(float pitch, float gain, boolean loop, float x, float y, float z) { checkTarget(); return target.playAsSoundEffect(pitch, gain, loop, x, y, z); }
[ "public", "int", "playAsSoundEffect", "(", "float", "pitch", ",", "float", "gain", ",", "boolean", "loop", ",", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "checkTarget", "(", ")", ";", "return", "target", ".", "playAsSoundEffect", "(",...
Play this sound as a sound effect @param pitch The pitch of the play back @param gain The gain of the play back @param loop True if we should loop @param x The x position of the sound @param y The y position of the sound @param z The z position of the sound
[ "Play", "this", "sound", "as", "a", "sound", "effect" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/openal/DeferredSound.java#L144-L147
sdl/odata
odata_renderer/src/main/java/com/sdl/odata/renderer/AbstractRenderer.java
AbstractRenderer.scoreByMediaType
protected int scoreByMediaType(List<MediaType> mediaTypes, MediaType requiredMediaType) { int score = MAXIMUM_HEADER_SCORE; boolean match = false; boolean matchWildCard = false; for (MediaType mediaType : mediaTypes) { if (mediaType.matches(requiredMediaType)) { if (mediaType.isWildCardMediaType()) { matchWildCard = true; } match = true; break; } // Lower the score for each subsequent possible match score -= 2; } return match && !matchWildCard ? score : matchWildCard ? WILDCARD_MATCH_SCORE : DEFAULT_SCORE; }
java
protected int scoreByMediaType(List<MediaType> mediaTypes, MediaType requiredMediaType) { int score = MAXIMUM_HEADER_SCORE; boolean match = false; boolean matchWildCard = false; for (MediaType mediaType : mediaTypes) { if (mediaType.matches(requiredMediaType)) { if (mediaType.isWildCardMediaType()) { matchWildCard = true; } match = true; break; } // Lower the score for each subsequent possible match score -= 2; } return match && !matchWildCard ? score : matchWildCard ? WILDCARD_MATCH_SCORE : DEFAULT_SCORE; }
[ "protected", "int", "scoreByMediaType", "(", "List", "<", "MediaType", ">", "mediaTypes", ",", "MediaType", "requiredMediaType", ")", "{", "int", "score", "=", "MAXIMUM_HEADER_SCORE", ";", "boolean", "match", "=", "false", ";", "boolean", "matchWildCard", "=", "...
Computes a score by examining a list of media types (typically from the 'Accept' header) against a required media type. @param mediaTypes The list of media types to examine. @param requiredMediaType The required media type. @return A score that indicates if one of the media types in the list matches the required media type.
[ "Computes", "a", "score", "by", "examining", "a", "list", "of", "media", "types", "(", "typically", "from", "the", "Accept", "header", ")", "against", "a", "required", "media", "type", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/renderer/AbstractRenderer.java#L158-L175
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Registry.java
Registry.setType
public void setType(String type) throws ApplicationException { type = type.toLowerCase().trim(); if (type.equals("string")) this.type = RegistryEntry.TYPE_STRING; else if (type.equals("dword")) this.type = RegistryEntry.TYPE_DWORD; else if (type.equals("key")) this.type = RegistryEntry.TYPE_KEY; else if (type.equals("any")) this.type = RegistryEntry.TYPE_ANY; else throw new ApplicationException("attribute type of the tag registry has an invalid value [" + type + "], valid values are [string, dword]"); }
java
public void setType(String type) throws ApplicationException { type = type.toLowerCase().trim(); if (type.equals("string")) this.type = RegistryEntry.TYPE_STRING; else if (type.equals("dword")) this.type = RegistryEntry.TYPE_DWORD; else if (type.equals("key")) this.type = RegistryEntry.TYPE_KEY; else if (type.equals("any")) this.type = RegistryEntry.TYPE_ANY; else throw new ApplicationException("attribute type of the tag registry has an invalid value [" + type + "], valid values are [string, dword]"); }
[ "public", "void", "setType", "(", "String", "type", ")", "throws", "ApplicationException", "{", "type", "=", "type", ".", "toLowerCase", "(", ")", ".", "trim", "(", ")", ";", "if", "(", "type", ".", "equals", "(", "\"string\"", ")", ")", "this", ".", ...
set the value type string: return string values dWord: return DWord values key: return keys any: return keys and values @param type value to set @throws ApplicationException
[ "set", "the", "value", "type", "string", ":", "return", "string", "values", "dWord", ":", "return", "DWord", "values", "key", ":", "return", "keys", "any", ":", "return", "keys", "and", "values" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Registry.java#L144-L151
cloudant/java-cloudant
cloudant-client/src/main/java/com/cloudant/client/internal/views/PaginationToken.java
PaginationToken.tokenize
static String tokenize(PageMetadata<?, ?> pageMetadata) { try { Gson g = getGsonWithKeyAdapter(pageMetadata.pageRequestParameters); return new String(Base64.encodeBase64URLSafe(g.toJson(new PaginationToken (pageMetadata)).getBytes("UTF-8")), Charset.forName("UTF-8")); } catch (UnsupportedEncodingException e) { //all JVMs should support UTF-8 throw new RuntimeException(e); } }
java
static String tokenize(PageMetadata<?, ?> pageMetadata) { try { Gson g = getGsonWithKeyAdapter(pageMetadata.pageRequestParameters); return new String(Base64.encodeBase64URLSafe(g.toJson(new PaginationToken (pageMetadata)).getBytes("UTF-8")), Charset.forName("UTF-8")); } catch (UnsupportedEncodingException e) { //all JVMs should support UTF-8 throw new RuntimeException(e); } }
[ "static", "String", "tokenize", "(", "PageMetadata", "<", "?", ",", "?", ">", "pageMetadata", ")", "{", "try", "{", "Gson", "g", "=", "getGsonWithKeyAdapter", "(", "pageMetadata", ".", "pageRequestParameters", ")", ";", "return", "new", "String", "(", "Base6...
Generate an opaque pagination token from the supplied PageMetadata. @param pageMetadata page metadata of the page for which the token should be generated @return opaque pagination token
[ "Generate", "an", "opaque", "pagination", "token", "from", "the", "supplied", "PageMetadata", "." ]
train
https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/internal/views/PaginationToken.java#L110-L120
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_instance_instanceId_rescueMode_POST
public OvhRescueAdminPassword project_serviceName_instance_instanceId_rescueMode_POST(String serviceName, String instanceId, String imageId, Boolean rescue) throws IOException { String qPath = "/cloud/project/{serviceName}/instance/{instanceId}/rescueMode"; StringBuilder sb = path(qPath, serviceName, instanceId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "imageId", imageId); addBody(o, "rescue", rescue); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhRescueAdminPassword.class); }
java
public OvhRescueAdminPassword project_serviceName_instance_instanceId_rescueMode_POST(String serviceName, String instanceId, String imageId, Boolean rescue) throws IOException { String qPath = "/cloud/project/{serviceName}/instance/{instanceId}/rescueMode"; StringBuilder sb = path(qPath, serviceName, instanceId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "imageId", imageId); addBody(o, "rescue", rescue); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhRescueAdminPassword.class); }
[ "public", "OvhRescueAdminPassword", "project_serviceName_instance_instanceId_rescueMode_POST", "(", "String", "serviceName", ",", "String", "instanceId", ",", "String", "imageId", ",", "Boolean", "rescue", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/clo...
Enable or disable rescue mode REST: POST /cloud/project/{serviceName}/instance/{instanceId}/rescueMode @param imageId [required] Image to boot on @param instanceId [required] Instance id @param rescue [required] Enable rescue mode @param serviceName [required] Service name
[ "Enable", "or", "disable", "rescue", "mode" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1818-L1826
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/Command.java
Command.shortcutChanged
private void shortcutChanged(String shortcut, boolean unbind) { Set<String> bindings = new HashSet<>(); bindings.add(shortcut); for (BaseUIComponent component : componentBindings) { CommandUtil.updateShortcuts(component, bindings, unbind); } }
java
private void shortcutChanged(String shortcut, boolean unbind) { Set<String> bindings = new HashSet<>(); bindings.add(shortcut); for (BaseUIComponent component : componentBindings) { CommandUtil.updateShortcuts(component, bindings, unbind); } }
[ "private", "void", "shortcutChanged", "(", "String", "shortcut", ",", "boolean", "unbind", ")", "{", "Set", "<", "String", ">", "bindings", "=", "new", "HashSet", "<>", "(", ")", ";", "bindings", ".", "add", "(", "shortcut", ")", ";", "for", "(", "Base...
Called when a shortcut is bound or unbound. @param shortcut The shortcut that has been bound or unbound. @param unbind If true, the shortcut is being unbound.
[ "Called", "when", "a", "shortcut", "is", "bound", "or", "unbound", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/Command.java#L187-L194
eurekaclinical/protempa
protempa-ksb-protege/src/main/java/org/protempa/backend/ksb/protege/ConnectionManager.java
ConnectionManager.createInstance
Instance createInstance(String name, Cls cls) throws KnowledgeSourceReadException { return getFromProtege(new InstanceSpec(name, cls), INSTANCE_CREATOR); }
java
Instance createInstance(String name, Cls cls) throws KnowledgeSourceReadException { return getFromProtege(new InstanceSpec(name, cls), INSTANCE_CREATOR); }
[ "Instance", "createInstance", "(", "String", "name", ",", "Cls", "cls", ")", "throws", "KnowledgeSourceReadException", "{", "return", "getFromProtege", "(", "new", "InstanceSpec", "(", "name", ",", "cls", ")", ",", "INSTANCE_CREATOR", ")", ";", "}" ]
Creates a new instance in the knowledge base. @param name the name <code>String</code> of the instance. @param cls the <code>Cls</code> of the instance. @return a new <code>Instance</code>, or <code>null</code> if an invalid class specification was provided. @see ConnectionManager#INSTANCE_CREATOR
[ "Creates", "a", "new", "instance", "in", "the", "knowledge", "base", "." ]
train
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-ksb-protege/src/main/java/org/protempa/backend/ksb/protege/ConnectionManager.java#L475-L478
ehcache/ehcache3
impl/src/main/java/org/ehcache/impl/internal/resilience/AbstractResilienceStrategy.java
AbstractResilienceStrategy.pacedErrorLog
protected void pacedErrorLog(String message, Object arg1, Object arg2) { pacer.pacedCall(() -> LOGGER.error(message + " - Similar messages will be suppressed for 30 seconds", arg1, arg2), () -> LOGGER.debug(message, arg1, arg2)); }
java
protected void pacedErrorLog(String message, Object arg1, Object arg2) { pacer.pacedCall(() -> LOGGER.error(message + " - Similar messages will be suppressed for 30 seconds", arg1, arg2), () -> LOGGER.debug(message, arg1, arg2)); }
[ "protected", "void", "pacedErrorLog", "(", "String", "message", ",", "Object", "arg1", ",", "Object", "arg2", ")", "{", "pacer", ".", "pacedCall", "(", "(", ")", "->", "LOGGER", ".", "error", "(", "message", "+", "\" - Similar messages will be suppressed for 30 ...
Log messages in error at worst every 30 seconds. Log everything at debug level. @param message message to log @param arg1 first log param @param arg2 second log param
[ "Log", "messages", "in", "error", "at", "worst", "every", "30", "seconds", ".", "Log", "everything", "at", "debug", "level", "." ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/internal/resilience/AbstractResilienceStrategy.java#L189-L191
killbill/killbill
invoice/src/main/java/org/killbill/billing/invoice/tree/ItemsNodeInterval.java
ItemsNodeInterval.addProposedItem
public boolean addProposedItem(final ItemsNodeInterval newNode) { Preconditions.checkState(newNode.getItems().size() == 1, "Invalid node=%s", newNode); final Item item = newNode.getItems().get(0); return addNode(newNode, new AddNodeCallback() { @Override public boolean onExistingNode(final NodeInterval existingNode) { // If we receive a new proposed that is the same kind as the reversed existing (current node), // we match existing and proposed. If not, we keep the proposed item as-is outside of the tree. if (isSameKind((ItemsNodeInterval) existingNode)) { final ItemsInterval existingOrNewNodeItems = ((ItemsNodeInterval) existingNode).getItemsInterval(); existingOrNewNodeItems.cancelItems(item); return true; } else { return false; } } @Override public boolean shouldInsertNode(final NodeInterval insertionNode) { // At this stage, we're currently merging a proposed item that does not fit any of the existing intervals. // If this new node is about to be inserted at the root level, this means the proposed item overlaps any // existing item. We keep these as-is, outside of the tree: they will become part of the resulting list. if (insertionNode.isRoot()) { return false; } // If we receive a new proposed that is the same kind as the reversed existing (parent node), // we want to insert it to generate a piece of repair (see SubscriptionItemTree#buildForMerge). // If not, we keep the proposed item as-is outside of the tree. return isSameKind((ItemsNodeInterval) insertionNode); } private boolean isSameKind(final ItemsNodeInterval insertionNode) { final List<Item> insertionNodeItems = insertionNode.getItems(); Preconditions.checkState(insertionNodeItems.size() == 1, "Expected existing node to have only one item"); final Item insertionNodeItem = insertionNodeItems.get(0); return insertionNodeItem.isSameKind(item); } }); }
java
public boolean addProposedItem(final ItemsNodeInterval newNode) { Preconditions.checkState(newNode.getItems().size() == 1, "Invalid node=%s", newNode); final Item item = newNode.getItems().get(0); return addNode(newNode, new AddNodeCallback() { @Override public boolean onExistingNode(final NodeInterval existingNode) { // If we receive a new proposed that is the same kind as the reversed existing (current node), // we match existing and proposed. If not, we keep the proposed item as-is outside of the tree. if (isSameKind((ItemsNodeInterval) existingNode)) { final ItemsInterval existingOrNewNodeItems = ((ItemsNodeInterval) existingNode).getItemsInterval(); existingOrNewNodeItems.cancelItems(item); return true; } else { return false; } } @Override public boolean shouldInsertNode(final NodeInterval insertionNode) { // At this stage, we're currently merging a proposed item that does not fit any of the existing intervals. // If this new node is about to be inserted at the root level, this means the proposed item overlaps any // existing item. We keep these as-is, outside of the tree: they will become part of the resulting list. if (insertionNode.isRoot()) { return false; } // If we receive a new proposed that is the same kind as the reversed existing (parent node), // we want to insert it to generate a piece of repair (see SubscriptionItemTree#buildForMerge). // If not, we keep the proposed item as-is outside of the tree. return isSameKind((ItemsNodeInterval) insertionNode); } private boolean isSameKind(final ItemsNodeInterval insertionNode) { final List<Item> insertionNodeItems = insertionNode.getItems(); Preconditions.checkState(insertionNodeItems.size() == 1, "Expected existing node to have only one item"); final Item insertionNodeItem = insertionNodeItems.get(0); return insertionNodeItem.isSameKind(item); } }); }
[ "public", "boolean", "addProposedItem", "(", "final", "ItemsNodeInterval", "newNode", ")", "{", "Preconditions", ".", "checkState", "(", "newNode", ".", "getItems", "(", ")", ".", "size", "(", ")", "==", "1", ",", "\"Invalid node=%s\"", ",", "newNode", ")", ...
Add proposed item into the (flattened and reversed) tree @param newNode a new proposed item @return true if the item was merged and will trigger a repair or false if the proposed item should be kept as such and no repair generated
[ "Add", "proposed", "item", "into", "the", "(", "flattened", "and", "reversed", ")", "tree" ]
train
https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/invoice/src/main/java/org/killbill/billing/invoice/tree/ItemsNodeInterval.java#L130-L170
casmi/casmi
src/main/java/casmi/graphics/element/Curve.java
Curve.setNode
public void setNode(int number, Vector3D v) { if (number <= 0) { number = 0; } else if (3 <= number) { number = 3; } this.points[number * 3] = (float)v.getX(); this.points[number * 3 + 1] = (float)v.getY(); this.points[number * 3 + 2] = (float)v.getZ(); set(); }
java
public void setNode(int number, Vector3D v) { if (number <= 0) { number = 0; } else if (3 <= number) { number = 3; } this.points[number * 3] = (float)v.getX(); this.points[number * 3 + 1] = (float)v.getY(); this.points[number * 3 + 2] = (float)v.getZ(); set(); }
[ "public", "void", "setNode", "(", "int", "number", ",", "Vector3D", "v", ")", "{", "if", "(", "number", "<=", "0", ")", "{", "number", "=", "0", ";", "}", "else", "if", "(", "3", "<=", "number", ")", "{", "number", "=", "3", ";", "}", "this", ...
Sets coordinate of nodes of this Curve. @param number The number of a node. The node whose number is 0 or 3 is a anchor point, and the node whose number is 1 or 2 is a control point. @param v The coordinates of this node.
[ "Sets", "coordinate", "of", "nodes", "of", "this", "Curve", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Curve.java#L384-L394
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.deleteEntityAsync
public Observable<OperationStatus> deleteEntityAsync(UUID appId, String versionId, UUID entityId) { return deleteEntityWithServiceResponseAsync(appId, versionId, entityId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
java
public Observable<OperationStatus> deleteEntityAsync(UUID appId, String versionId, UUID entityId) { return deleteEntityWithServiceResponseAsync(appId, versionId, entityId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatus", ">", "deleteEntityAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ")", "{", "return", "deleteEntityWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "entityId", ")", "...
Deletes an entity extractor from the application. @param appId The application ID. @param versionId The version ID. @param entityId The entity extractor ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Deletes", "an", "entity", "extractor", "from", "the", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L3592-L3599
MenoData/Time4J
base/src/main/java/net/time4j/format/expert/Iso8601Format.java
Iso8601Format.parseDate
public static PlainDate parseDate(CharSequence iso) throws ParseException { ParseLog plog = new ParseLog(); PlainDate date = parseDate(iso, plog); if ((date == null) || plog.isError()) { throw new ParseException(plog.getErrorMessage(), plog.getErrorIndex()); } else if (plog.getPosition() < iso.length()) { throw new ParseException("Trailing characters found: " + iso, plog.getPosition()); } else { return date; } }
java
public static PlainDate parseDate(CharSequence iso) throws ParseException { ParseLog plog = new ParseLog(); PlainDate date = parseDate(iso, plog); if ((date == null) || plog.isError()) { throw new ParseException(plog.getErrorMessage(), plog.getErrorIndex()); } else if (plog.getPosition() < iso.length()) { throw new ParseException("Trailing characters found: " + iso, plog.getPosition()); } else { return date; } }
[ "public", "static", "PlainDate", "parseDate", "(", "CharSequence", "iso", ")", "throws", "ParseException", "{", "ParseLog", "plog", "=", "new", "ParseLog", "(", ")", ";", "PlainDate", "date", "=", "parseDate", "(", "iso", ",", "plog", ")", ";", "if", "(", ...
/*[deutsch] <p>Interpretiert den angegebenen ISO-8601-kompatiblen Datumstext im <i>basic</i>-Format oder im <i>extended</i>-Format. </p> @param iso text like &quot;20160101&quot;, &quot;2016001&quot;, &quot;2016W011&quot;, &quot;2016-01-01&quot;, &quot;2016-001&quot; or &quot;2016-W01-1&quot; @return PlainDate @throws ParseException if parsing fails for any reason @since 3.22/4.18
[ "/", "*", "[", "deutsch", "]", "<p", ">", "Interpretiert", "den", "angegebenen", "ISO", "-", "8601", "-", "kompatiblen", "Datumstext", "im", "<i", ">", "basic<", "/", "i", ">", "-", "Format", "oder", "im", "<i", ">", "extended<", "/", "i", ">", "-", ...
train
https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/format/expert/Iso8601Format.java#L572-L585
eurekaclinical/protempa
protempa-framework/src/main/java/org/protempa/proposition/CopyPropositionVisitor.java
CopyPropositionVisitor.setProperties
public void setProperties(Map<String, Value> properties) { if (properties != null) { this.properties = new HashMap<>(properties); } else { this.properties = null; } }
java
public void setProperties(Map<String, Value> properties) { if (properties != null) { this.properties = new HashMap<>(properties); } else { this.properties = null; } }
[ "public", "void", "setProperties", "(", "Map", "<", "String", ",", "Value", ">", "properties", ")", "{", "if", "(", "properties", "!=", "null", ")", "{", "this", ".", "properties", "=", "new", "HashMap", "<>", "(", "properties", ")", ";", "}", "else", ...
Overrides the properties for copies made with this visitor. @param properties a map of property name to value pairs, or <code>null</code> to use the original proposition's value for this field.
[ "Overrides", "the", "properties", "for", "copies", "made", "with", "this", "visitor", "." ]
train
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/proposition/CopyPropositionVisitor.java#L73-L79
korpling/ANNIS
annis-service/src/main/java/annis/GraphHelper.java
GraphHelper.createQueryData
public static QueryData createQueryData(MatchGroup matchGroup, QueryDao annisDao) { QueryData queryData = new QueryData(); Set<String> corpusNames = new TreeSet<>(); for(Match m : matchGroup.getMatches()) { // collect list of used corpora and created pseudo QueryNodes for each URI List<QueryNode> pseudoNodes = new ArrayList<>(m.getSaltIDs().size()); for (java.net.URI u : m.getSaltIDs()) { pseudoNodes.add(new QueryNode()); corpusNames.add(CommonHelper.getCorpusPath(u).get(0)); } queryData.addAlternative(pseudoNodes); } List<Long> corpusIDs = annisDao.mapCorpusNamesToIds(new LinkedList<>( corpusNames)); queryData.setCorpusList(corpusIDs); queryData.addExtension(matchGroup); return queryData; }
java
public static QueryData createQueryData(MatchGroup matchGroup, QueryDao annisDao) { QueryData queryData = new QueryData(); Set<String> corpusNames = new TreeSet<>(); for(Match m : matchGroup.getMatches()) { // collect list of used corpora and created pseudo QueryNodes for each URI List<QueryNode> pseudoNodes = new ArrayList<>(m.getSaltIDs().size()); for (java.net.URI u : m.getSaltIDs()) { pseudoNodes.add(new QueryNode()); corpusNames.add(CommonHelper.getCorpusPath(u).get(0)); } queryData.addAlternative(pseudoNodes); } List<Long> corpusIDs = annisDao.mapCorpusNamesToIds(new LinkedList<>( corpusNames)); queryData.setCorpusList(corpusIDs); queryData.addExtension(matchGroup); return queryData; }
[ "public", "static", "QueryData", "createQueryData", "(", "MatchGroup", "matchGroup", ",", "QueryDao", "annisDao", ")", "{", "QueryData", "queryData", "=", "new", "QueryData", "(", ")", ";", "Set", "<", "String", ">", "corpusNames", "=", "new", "TreeSet", "<>",...
This is a helper function to make it easier to create a correct query data object from a {@link MatchGroup} for a {@link AnnisDao#graph(annis.ql.parser.QueryData) } query. @param matchGroup @return
[ "This", "is", "a", "helper", "function", "to", "make", "it", "easier", "to", "create", "a", "correct", "query", "data", "object", "from", "a", "{", "@link", "MatchGroup", "}", "for", "a", "{", "@link", "AnnisDao#graph", "(", "annis", ".", "ql", ".", "p...
train
https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-service/src/main/java/annis/GraphHelper.java#L39-L63
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/checker/NodeRemover.java
NodeRemover.validateIfRequiredByParent
private void validateIfRequiredByParent(JDBCStorageConnection conn, ResultSet resultSet) throws RepositoryException, SQLException, IllegalNameException { String parentId = getIdentifier(resultSet, DBConstants.COLUMN_PARENTID); InternalQName nodeName = InternalQName.parse(resultSet.getString(DBConstants.COLUMN_NAME)); NodeData parent = null; try { parent = (NodeData)conn.getItemData(parentId); } catch (PrimaryTypeNotFoundException e) { // It is possible, parent also without primaryType property return; } // parent already removed in previous check if (parent == null) { return; } NodeDefinitionData def = nodeTypeManager.getChildNodeDefinition(nodeName, parent.getPrimaryTypeName(), parent.getMixinTypeNames()); if (!def.isResidualSet()) { throw new SQLException("Node is required by its parent."); } }
java
private void validateIfRequiredByParent(JDBCStorageConnection conn, ResultSet resultSet) throws RepositoryException, SQLException, IllegalNameException { String parentId = getIdentifier(resultSet, DBConstants.COLUMN_PARENTID); InternalQName nodeName = InternalQName.parse(resultSet.getString(DBConstants.COLUMN_NAME)); NodeData parent = null; try { parent = (NodeData)conn.getItemData(parentId); } catch (PrimaryTypeNotFoundException e) { // It is possible, parent also without primaryType property return; } // parent already removed in previous check if (parent == null) { return; } NodeDefinitionData def = nodeTypeManager.getChildNodeDefinition(nodeName, parent.getPrimaryTypeName(), parent.getMixinTypeNames()); if (!def.isResidualSet()) { throw new SQLException("Node is required by its parent."); } }
[ "private", "void", "validateIfRequiredByParent", "(", "JDBCStorageConnection", "conn", ",", "ResultSet", "resultSet", ")", "throws", "RepositoryException", ",", "SQLException", ",", "IllegalNameException", "{", "String", "parentId", "=", "getIdentifier", "(", "resultSet",...
Validates if node represented by instance of {@link ResultSet} is mandatory for parent node. It means should not be removed. Throws {@link SQLException} in this case with appropriate message.
[ "Validates", "if", "node", "represented", "by", "instance", "of", "{" ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/checker/NodeRemover.java#L117-L147
datasift/datasift-java
src/main/java/com/datasift/client/accounts/DataSiftAccount.java
DataSiftAccount.createLimit
public FutureData<Limit> createLimit(String identity, String service, Long allowance) { if (identity == null || identity.isEmpty()) { throw new IllegalArgumentException("An identity is required"); } if (service == null || service.isEmpty()) { throw new IllegalArgumentException("A service is required"); } if (allowance < 0) { throw new IllegalArgumentException("Allowance must be a positive integer"); } FutureData<Limit> future = new FutureData<>(); URI uri = newParams().forURL(config.newAPIEndpointURI(IDENTITY + "/" + identity + "/limit")); try { Request request = config.http() .postJSON(uri, new PageReader(newRequestCallback(future, new Limit(), config))) .setData(new NewLimit(service, allowance)); performRequest(future, request); } catch (JsonProcessingException e) { e.printStackTrace(); } return future; }
java
public FutureData<Limit> createLimit(String identity, String service, Long allowance) { if (identity == null || identity.isEmpty()) { throw new IllegalArgumentException("An identity is required"); } if (service == null || service.isEmpty()) { throw new IllegalArgumentException("A service is required"); } if (allowance < 0) { throw new IllegalArgumentException("Allowance must be a positive integer"); } FutureData<Limit> future = new FutureData<>(); URI uri = newParams().forURL(config.newAPIEndpointURI(IDENTITY + "/" + identity + "/limit")); try { Request request = config.http() .postJSON(uri, new PageReader(newRequestCallback(future, new Limit(), config))) .setData(new NewLimit(service, allowance)); performRequest(future, request); } catch (JsonProcessingException e) { e.printStackTrace(); } return future; }
[ "public", "FutureData", "<", "Limit", ">", "createLimit", "(", "String", "identity", ",", "String", "service", ",", "Long", "allowance", ")", "{", "if", "(", "identity", "==", "null", "||", "identity", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", ...
/* Create a Limit @param identity ID of the identity to store the limit in @param service service to set the limit for @param allowance allowance to store in the limit @return Created limit
[ "/", "*", "Create", "a", "Limit" ]
train
https://github.com/datasift/datasift-java/blob/09de124f2a1a507ff6181e59875c6f325290850e/src/main/java/com/datasift/client/accounts/DataSiftAccount.java#L325-L346
mfornos/humanize
humanize-icu/src/main/java/humanize/ICUHumanize.java
ICUHumanize.smartDateFormat
public static String smartDateFormat(final Date value, final String skeleton) { return formatDate(value, context.get().getBestPattern(skeleton)); }
java
public static String smartDateFormat(final Date value, final String skeleton) { return formatDate(value, context.get().getBestPattern(skeleton)); }
[ "public", "static", "String", "smartDateFormat", "(", "final", "Date", "value", ",", "final", "String", "skeleton", ")", "{", "return", "formatDate", "(", "value", ",", "context", ".", "get", "(", ")", ".", "getBestPattern", "(", "skeleton", ")", ")", ";",...
<p> Guesses the best locale-dependent pattern to format the date/time fields that the skeleton specifies. </p> @param value The date to be formatted @param skeleton A pattern containing only the variable fields. For example, "MMMdd" and "mmhh" are skeletons. @return A string with a text representation of the date
[ "<p", ">", "Guesses", "the", "best", "locale", "-", "dependent", "pattern", "to", "format", "the", "date", "/", "time", "fields", "that", "the", "skeleton", "specifies", ".", "<", "/", "p", ">" ]
train
https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-icu/src/main/java/humanize/ICUHumanize.java#L1584-L1587
weld/core
impl/src/main/java/org/jboss/weld/util/Proxies.java
Proxies.isTypesProxyable
public static boolean isTypesProxyable(Iterable<? extends Type> types, ServiceRegistry services) { return getUnproxyableTypesException(types, services) == null; }
java
public static boolean isTypesProxyable(Iterable<? extends Type> types, ServiceRegistry services) { return getUnproxyableTypesException(types, services) == null; }
[ "public", "static", "boolean", "isTypesProxyable", "(", "Iterable", "<", "?", "extends", "Type", ">", "types", ",", "ServiceRegistry", "services", ")", "{", "return", "getUnproxyableTypesException", "(", "types", ",", "services", ")", "==", "null", ";", "}" ]
Indicates if a set of types are all proxyable @param types The types to test @return True if proxyable, false otherwise
[ "Indicates", "if", "a", "set", "of", "types", "are", "all", "proxyable" ]
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Proxies.java#L160-L162
m-m-m/util
event/src/main/java/net/sf/mmm/util/event/base/AbstractEventBus.java
AbstractEventBus.getEventDispatcher
@SuppressWarnings({ "unchecked", "rawtypes" }) private EventDispatcher getEventDispatcher(Class<?> eventType, boolean createIfNotExists) { EventDispatcher<?> dispatcher = this.eventType2dispatcherMap.get(eventType); if (dispatcher == null) { Class<?> parentType = eventType.getSuperclass(); if (createIfNotExists) { EventDispatcher<?> parent; if (parentType == null) { assert (eventType == Object.class); parent = null; } else { parent = getEventDispatcher(parentType, true); } dispatcher = new EventDispatcher(parent, this.queueFactory); this.eventType2dispatcherMap.put(eventType, dispatcher); } else { return getEventDispatcher(parentType, false); } } return dispatcher; }
java
@SuppressWarnings({ "unchecked", "rawtypes" }) private EventDispatcher getEventDispatcher(Class<?> eventType, boolean createIfNotExists) { EventDispatcher<?> dispatcher = this.eventType2dispatcherMap.get(eventType); if (dispatcher == null) { Class<?> parentType = eventType.getSuperclass(); if (createIfNotExists) { EventDispatcher<?> parent; if (parentType == null) { assert (eventType == Object.class); parent = null; } else { parent = getEventDispatcher(parentType, true); } dispatcher = new EventDispatcher(parent, this.queueFactory); this.eventType2dispatcherMap.put(eventType, dispatcher); } else { return getEventDispatcher(parentType, false); } } return dispatcher; }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "private", "EventDispatcher", "getEventDispatcher", "(", "Class", "<", "?", ">", "eventType", ",", "boolean", "createIfNotExists", ")", "{", "EventDispatcher", "<", "?", ">", "dis...
Gets or creates the {@link EventDispatcher} for the given {@code eventType}. @param eventType is the {@link Class} reflecting the {@link net.sf.mmm.util.event.api.Event event}. @param createIfNotExists - if {@code true} the requested {@link EventDispatcher} will be created if it does not exists, if {@code false} this method will return {@code null} if it does not exist. @return the {@link EventDispatcher} responsible for the given {@code eventType}. May be {@code null} if {@code createIfNotExists} is {@code null} and not available.
[ "Gets", "or", "creates", "the", "{", "@link", "EventDispatcher", "}", "for", "the", "given", "{", "@code", "eventType", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/event/src/main/java/net/sf/mmm/util/event/base/AbstractEventBus.java#L209-L230
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/Resources.java
Resources.getResource
@Pure public static URL getResource(Class<?> classname, String path) { if (classname == null) { return null; } URL u = getResource(classname.getClassLoader(), classname.getPackage(), path); if (u == null) { u = getResource(classname.getClassLoader(), path); } return u; }
java
@Pure public static URL getResource(Class<?> classname, String path) { if (classname == null) { return null; } URL u = getResource(classname.getClassLoader(), classname.getPackage(), path); if (u == null) { u = getResource(classname.getClassLoader(), path); } return u; }
[ "@", "Pure", "public", "static", "URL", "getResource", "(", "Class", "<", "?", ">", "classname", ",", "String", "path", ")", "{", "if", "(", "classname", "==", "null", ")", "{", "return", "null", ";", "}", "URL", "u", "=", "getResource", "(", "classn...
Replies the URL of a resource. <p>You may use Unix-like syntax to write the resource path, ie. you may use slashes to separate filenames. <p>The name of {@code classname} is translated into a resource path (by remove the name of the class and replacing the dots by slashes) and the given path is append to. For example, the two following codes are equivalent:<pre><code> Resources.getResources(Resources.class, "/a/b/c/d.png"); Resources.getResources("org/arakhne/vmutil/a/b/c/d.png"); </code></pre> <p>The class loader of the given class is used. If it is <code>null</code>, the class loader replied by {@link ClassLoaderFinder} is used. If it is also <code>null</code>, the class loader of this Resources class is used. @param classname is located in the package in which the resource should be also located. @param path is the absolute path of the resource. @return the url of the resource or <code>null</code> if the resource was not found in class paths.
[ "Replies", "the", "URL", "of", "a", "resource", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/Resources.java#L164-L174
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/PageContentHelper.java
PageContentHelper.addJsHeadlines
public static void addJsHeadlines(final PrintWriter writer, final List jsHeadlines) { if (jsHeadlines == null || jsHeadlines.isEmpty()) { return; } writer.println(); writer.write("\n<!-- Start javascript headlines -->" + OPEN_JAVASCRIPT); for (Iterator iter = jsHeadlines.iterator(); iter.hasNext();) { String line = (String) iter.next(); writer.write("\n" + line); } writer.write(CLOSE_JAVASCRIPT + "\n<!-- End javascript headlines -->"); }
java
public static void addJsHeadlines(final PrintWriter writer, final List jsHeadlines) { if (jsHeadlines == null || jsHeadlines.isEmpty()) { return; } writer.println(); writer.write("\n<!-- Start javascript headlines -->" + OPEN_JAVASCRIPT); for (Iterator iter = jsHeadlines.iterator(); iter.hasNext();) { String line = (String) iter.next(); writer.write("\n" + line); } writer.write(CLOSE_JAVASCRIPT + "\n<!-- End javascript headlines -->"); }
[ "public", "static", "void", "addJsHeadlines", "(", "final", "PrintWriter", "writer", ",", "final", "List", "jsHeadlines", ")", "{", "if", "(", "jsHeadlines", "==", "null", "||", "jsHeadlines", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "writer...
Add a list of javascript headline entries intended to be added only once to the page. @param writer the writer to write to. @param jsHeadlines a list of javascript entries to be added to the page as a whole.
[ "Add", "a", "list", "of", "javascript", "headline", "entries", "intended", "to", "be", "added", "only", "once", "to", "the", "page", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/PageContentHelper.java#L67-L83
Red5/red5-server-common
src/main/java/org/red5/server/messaging/AbstractPipe.java
AbstractPipe.subscribe
public boolean subscribe(IConsumer consumer, Map<String, Object> paramMap) { // pipe is possibly used by dozens of threads at once (like many subscribers for one server stream) boolean success = consumers.addIfAbsent(consumer); // if consumer is listener object register it as listener and consumer has just been added if (success && consumer instanceof IPipeConnectionListener) { listeners.addIfAbsent((IPipeConnectionListener) consumer); } return success; }
java
public boolean subscribe(IConsumer consumer, Map<String, Object> paramMap) { // pipe is possibly used by dozens of threads at once (like many subscribers for one server stream) boolean success = consumers.addIfAbsent(consumer); // if consumer is listener object register it as listener and consumer has just been added if (success && consumer instanceof IPipeConnectionListener) { listeners.addIfAbsent((IPipeConnectionListener) consumer); } return success; }
[ "public", "boolean", "subscribe", "(", "IConsumer", "consumer", ",", "Map", "<", "String", ",", "Object", ">", "paramMap", ")", "{", "// pipe is possibly used by dozens of threads at once (like many subscribers for one server stream)", "boolean", "success", "=", "consumers", ...
Connect consumer to this pipe. Doesn't allow to connect one consumer twice. Does register event listeners if instance of IPipeConnectionListener is given. @param consumer Consumer @param paramMap Parameters passed with connection, used in concrete pipe implementations @return true if consumer was added, false otherwise
[ "Connect", "consumer", "to", "this", "pipe", ".", "Doesn", "t", "allow", "to", "connect", "one", "consumer", "twice", ".", "Does", "register", "event", "listeners", "if", "instance", "of", "IPipeConnectionListener", "is", "given", "." ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/messaging/AbstractPipe.java#L73-L81
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPRuleAssetCategoryRelPersistenceImpl.java
CPRuleAssetCategoryRelPersistenceImpl.findAll
@Override public List<CPRuleAssetCategoryRel> findAll(int start, int end) { return findAll(start, end, null); }
java
@Override public List<CPRuleAssetCategoryRel> findAll(int start, int end) { return findAll(start, end, null); }
[ "@", "Override", "public", "List", "<", "CPRuleAssetCategoryRel", ">", "findAll", "(", "int", "start", ",", "int", "end", ")", "{", "return", "findAll", "(", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the cp rule asset category rels. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPRuleAssetCategoryRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param start the lower bound of the range of cp rule asset category rels @param end the upper bound of the range of cp rule asset category rels (not inclusive) @return the range of cp rule asset category rels
[ "Returns", "a", "range", "of", "all", "the", "cp", "rule", "asset", "category", "rels", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPRuleAssetCategoryRelPersistenceImpl.java#L1682-L1685
nguillaumin/slick2d-maven
slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/WhiskasPanel.java
WhiskasPanel.linkToEmitter
private void linkToEmitter(String name, LinearInterpolator interpol) { // put to value map valueMap.put(name, interpol); // now update the checkbox to represent the state of the given // interpolator boolean checked = interpol.isActive(); JCheckBox enableControl = (JCheckBox) valueNameToControl.get(name); enableControl.setSelected(false); if (checked) enableControl.setSelected(checked); }
java
private void linkToEmitter(String name, LinearInterpolator interpol) { // put to value map valueMap.put(name, interpol); // now update the checkbox to represent the state of the given // interpolator boolean checked = interpol.isActive(); JCheckBox enableControl = (JCheckBox) valueNameToControl.get(name); enableControl.setSelected(false); if (checked) enableControl.setSelected(checked); }
[ "private", "void", "linkToEmitter", "(", "String", "name", ",", "LinearInterpolator", "interpol", ")", "{", "// put to value map\r", "valueMap", ".", "put", "(", "name", ",", "interpol", ")", ";", "// now update the checkbox to represent the state of the given\r", "// int...
Link this set of controls to a linear interpolater within the particle emitter @param name The name of the article emitter being linked @param interpol The interpolator being configured
[ "Link", "this", "set", "of", "controls", "to", "a", "linear", "interpolater", "within", "the", "particle", "emitter" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/WhiskasPanel.java#L141-L152
gallandarakhneorg/afc
advanced/attributes/src/main/java/org/arakhne/afc/attrs/collection/AbstractAttributeCollection.java
AbstractAttributeCollection.fireAttributeRenamedEvent
protected synchronized void fireAttributeRenamedEvent(String oldName, String newName, AttributeValue attr) { if (this.listenerList != null && isEventFirable()) { final AttributeChangeListener[] list = new AttributeChangeListener[this.listenerList.size()]; this.listenerList.toArray(list); final AttributeChangeEvent event = new AttributeChangeEvent( this, Type.RENAME, oldName, attr, newName, attr); for (final AttributeChangeListener listener : list) { listener.onAttributeChangeEvent(event); } } }
java
protected synchronized void fireAttributeRenamedEvent(String oldName, String newName, AttributeValue attr) { if (this.listenerList != null && isEventFirable()) { final AttributeChangeListener[] list = new AttributeChangeListener[this.listenerList.size()]; this.listenerList.toArray(list); final AttributeChangeEvent event = new AttributeChangeEvent( this, Type.RENAME, oldName, attr, newName, attr); for (final AttributeChangeListener listener : list) { listener.onAttributeChangeEvent(event); } } }
[ "protected", "synchronized", "void", "fireAttributeRenamedEvent", "(", "String", "oldName", ",", "String", "newName", ",", "AttributeValue", "attr", ")", "{", "if", "(", "this", ".", "listenerList", "!=", "null", "&&", "isEventFirable", "(", ")", ")", "{", "fi...
Fire the renaming event. @param oldName is the previous name of the attribute (before renaming) @param newName is the new name of the attribute (after renaming) @param attr is the value of the attribute.
[ "Fire", "the", "renaming", "event", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/attributes/src/main/java/org/arakhne/afc/attrs/collection/AbstractAttributeCollection.java#L162-L177
wildfly/wildfly-core
embedded/src/main/java/org/wildfly/core/embedded/SystemPropertyContext.java
SystemPropertyContext.resolvePath
static Path resolvePath(final Path base, final String... paths) { return Paths.get(base.toString(), paths); }
java
static Path resolvePath(final Path base, final String... paths) { return Paths.get(base.toString(), paths); }
[ "static", "Path", "resolvePath", "(", "final", "Path", "base", ",", "final", "String", "...", "paths", ")", "{", "return", "Paths", ".", "get", "(", "base", ".", "toString", "(", ")", ",", "paths", ")", ";", "}" ]
Resolves a path relative to the base path. @param base the base path @param paths paths relative to the base directory @return the resolved path
[ "Resolves", "a", "path", "relative", "to", "the", "base", "path", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/embedded/src/main/java/org/wildfly/core/embedded/SystemPropertyContext.java#L167-L169
lievendoclo/Valkyrie-RCP
valkyrie-rcp-integrations/valkyrie-rcp-vldocking/src/main/java/org/valkyriercp/application/docking/VLDockingBeanPostProcessor.java
VLDockingBeanPostProcessor.postProcessAfterInitialization
@Override public Object postProcessAfterInitialization(Object bean, String beanName) { // throws BeansException { if (bean instanceof VLDockingViewDescriptor) { return bean; } else if (bean instanceof ViewDescriptor) { final ViewDescriptor sourceViewDescriptor = (ViewDescriptor) bean; final ViewDescriptor targetViewDescriptor = this.getTemplate(sourceViewDescriptor); // Copy source state ObjectUtils.shallowCopy(sourceViewDescriptor, targetViewDescriptor); return targetViewDescriptor; } return bean; }
java
@Override public Object postProcessAfterInitialization(Object bean, String beanName) { // throws BeansException { if (bean instanceof VLDockingViewDescriptor) { return bean; } else if (bean instanceof ViewDescriptor) { final ViewDescriptor sourceViewDescriptor = (ViewDescriptor) bean; final ViewDescriptor targetViewDescriptor = this.getTemplate(sourceViewDescriptor); // Copy source state ObjectUtils.shallowCopy(sourceViewDescriptor, targetViewDescriptor); return targetViewDescriptor; } return bean; }
[ "@", "Override", "public", "Object", "postProcessAfterInitialization", "(", "Object", "bean", ",", "String", "beanName", ")", "{", "// throws BeansException {", "if", "(", "bean", "instanceof", "VLDockingViewDescriptor", ")", "{", "return", "bean", ";", "}", "else",...
{@inheritDoc} <p/> Replaces those view descriptors not implementing {@link VLDockingViewDescriptor}.
[ "{" ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-vldocking/src/main/java/org/valkyriercp/application/docking/VLDockingBeanPostProcessor.java#L58-L76
nmdp-bioinformatics/ngs
range/src/main/java/org/nmdp/ngs/range/Ranges.java
Ranges.orderingByUpperEndpoint
public static <C extends Comparable> Ordering<Range<C>> orderingByUpperEndpoint() { return new Ordering<Range<C>>() { @Override public int compare(final Range<C> left, final Range<C> right) { return ComparisonChain.start() .compare(left.hasUpperBound(), right.hasUpperBound()) .compare(left.upperEndpoint(), right.upperEndpoint()) .result(); } }; }
java
public static <C extends Comparable> Ordering<Range<C>> orderingByUpperEndpoint() { return new Ordering<Range<C>>() { @Override public int compare(final Range<C> left, final Range<C> right) { return ComparisonChain.start() .compare(left.hasUpperBound(), right.hasUpperBound()) .compare(left.upperEndpoint(), right.upperEndpoint()) .result(); } }; }
[ "public", "static", "<", "C", "extends", "Comparable", ">", "Ordering", "<", "Range", "<", "C", ">", ">", "orderingByUpperEndpoint", "(", ")", "{", "return", "new", "Ordering", "<", "Range", "<", "C", ">", ">", "(", ")", "{", "@", "Override", "public",...
Return an ordering by upper endpoint over ranges. @param <C> range endpoint type @return an ordering by upper endpoint over ranges
[ "Return", "an", "ordering", "by", "upper", "endpoint", "over", "ranges", "." ]
train
https://github.com/nmdp-bioinformatics/ngs/blob/277627e4311313a80f5dc110b3185b0d7af32bd0/range/src/main/java/org/nmdp/ngs/range/Ranges.java#L180-L190
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractPipeline.java
AbstractPipeline.evaluateToArrayNode
@SuppressWarnings("unchecked") public final Node<E_OUT> evaluateToArrayNode(IntFunction<E_OUT[]> generator) { if (linkedOrConsumed) throw new IllegalStateException(MSG_STREAM_LINKED); linkedOrConsumed = true; // If the last intermediate operation is stateful then // evaluate directly to avoid an extra collection step if (isParallel() && previousStage != null && opIsStateful()) { // Set the depth of this, last, pipeline stage to zero to slice the // pipeline such that this operation will not be included in the // upstream slice and upstream operations will not be included // in this slice depth = 0; return opEvaluateParallel(previousStage, previousStage.sourceSpliterator(0), generator); } else { return evaluate(sourceSpliterator(0), true, generator); } }
java
@SuppressWarnings("unchecked") public final Node<E_OUT> evaluateToArrayNode(IntFunction<E_OUT[]> generator) { if (linkedOrConsumed) throw new IllegalStateException(MSG_STREAM_LINKED); linkedOrConsumed = true; // If the last intermediate operation is stateful then // evaluate directly to avoid an extra collection step if (isParallel() && previousStage != null && opIsStateful()) { // Set the depth of this, last, pipeline stage to zero to slice the // pipeline such that this operation will not be included in the // upstream slice and upstream operations will not be included // in this slice depth = 0; return opEvaluateParallel(previousStage, previousStage.sourceSpliterator(0), generator); } else { return evaluate(sourceSpliterator(0), true, generator); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "final", "Node", "<", "E_OUT", ">", "evaluateToArrayNode", "(", "IntFunction", "<", "E_OUT", "[", "]", ">", "generator", ")", "{", "if", "(", "linkedOrConsumed", ")", "throw", "new", "IllegalStateEx...
Collect the elements output from the pipeline stage. @param generator the array generator to be used to create array instances @return a flat array-backed Node that holds the collected output elements
[ "Collect", "the", "elements", "output", "from", "the", "pipeline", "stage", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractPipeline.java#L247-L266
wildfly/wildfly-maven-plugin
plugin/src/main/java/org/wildfly/plugin/deployment/resource/AddResourceMojo.java
AddResourceMojo.parseAddress
private ModelNode parseAddress(final String profileName, final String inputAddress) { final ModelNode result = new ModelNode(); if (profileName != null) { result.add(ServerOperations.PROFILE, profileName); } String[] parts = inputAddress.split(","); for (String part : parts) { String[] address = part.split("="); if (address.length != 2) { throw new RuntimeException(part + " is not a valid address segment"); } result.add(address[0], address[1]); } return result; }
java
private ModelNode parseAddress(final String profileName, final String inputAddress) { final ModelNode result = new ModelNode(); if (profileName != null) { result.add(ServerOperations.PROFILE, profileName); } String[] parts = inputAddress.split(","); for (String part : parts) { String[] address = part.split("="); if (address.length != 2) { throw new RuntimeException(part + " is not a valid address segment"); } result.add(address[0], address[1]); } return result; }
[ "private", "ModelNode", "parseAddress", "(", "final", "String", "profileName", ",", "final", "String", "inputAddress", ")", "{", "final", "ModelNode", "result", "=", "new", "ModelNode", "(", ")", ";", "if", "(", "profileName", "!=", "null", ")", "{", "result...
Parses the comma delimited address into model nodes. @param profileName the profile name for the domain or {@code null} if not a domain @param inputAddress the address. @return a collection of the address nodes.
[ "Parses", "the", "comma", "delimited", "address", "into", "model", "nodes", "." ]
train
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/plugin/src/main/java/org/wildfly/plugin/deployment/resource/AddResourceMojo.java#L287-L301
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Getter.java
Getter.getView
public <T extends TextView> T getView(Class<T> classToFilterBy, String text, boolean onlyVisible) { T viewToReturn = (T) waiter.waitForText(classToFilterBy, text, 0, Timeout.getSmallTimeout(), false, onlyVisible, false); if(viewToReturn == null) Assert.fail(classToFilterBy.getSimpleName() + " with text: '" + text + "' is not found!"); return viewToReturn; }
java
public <T extends TextView> T getView(Class<T> classToFilterBy, String text, boolean onlyVisible) { T viewToReturn = (T) waiter.waitForText(classToFilterBy, text, 0, Timeout.getSmallTimeout(), false, onlyVisible, false); if(viewToReturn == null) Assert.fail(classToFilterBy.getSimpleName() + " with text: '" + text + "' is not found!"); return viewToReturn; }
[ "public", "<", "T", "extends", "TextView", ">", "T", "getView", "(", "Class", "<", "T", ">", "classToFilterBy", ",", "String", "text", ",", "boolean", "onlyVisible", ")", "{", "T", "viewToReturn", "=", "(", "T", ")", "waiter", ".", "waitForText", "(", ...
Returns a {@code View} that shows a given text, from the list of current {@code View}s of the specified type. @param classToFilterBy which {@code View}s to choose from @param text the text that the view shows @param onlyVisible {@code true} if only visible texts on the screen should be returned @return a {@code View} showing a given text, from the list of current {@code View}s of the specified type
[ "Returns", "a", "{", "@code", "View", "}", "that", "shows", "a", "given", "text", "from", "the", "list", "of", "current", "{", "@code", "View", "}", "s", "of", "the", "specified", "type", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Getter.java#L63-L71
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.vps_serviceName_additionalDisk_duration_POST
public OvhOrder vps_serviceName_additionalDisk_duration_POST(String serviceName, String duration, OvhAdditionalDiskSizeEnum additionalDiskSize) throws IOException { String qPath = "/order/vps/{serviceName}/additionalDisk/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "additionalDiskSize", additionalDiskSize); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder vps_serviceName_additionalDisk_duration_POST(String serviceName, String duration, OvhAdditionalDiskSizeEnum additionalDiskSize) throws IOException { String qPath = "/order/vps/{serviceName}/additionalDisk/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "additionalDiskSize", additionalDiskSize); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "vps_serviceName_additionalDisk_duration_POST", "(", "String", "serviceName", ",", "String", "duration", ",", "OvhAdditionalDiskSizeEnum", "additionalDiskSize", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/vps/{serviceName}/addition...
Create order REST: POST /order/vps/{serviceName}/additionalDisk/{duration} @param additionalDiskSize [required] Size of the additional disk @param serviceName [required] The internal name of your VPS offer @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#L3618-L3625
protostuff/protostuff
protostuff-api/src/main/java/io/protostuff/UnsignedNumberUtil.java
UnsignedNumberUtil.unsignedIntToString
private static String unsignedIntToString(int x, int radix) { long asLong = x & INT_MASK; return Long.toString(asLong, radix); }
java
private static String unsignedIntToString(int x, int radix) { long asLong = x & INT_MASK; return Long.toString(asLong, radix); }
[ "private", "static", "String", "unsignedIntToString", "(", "int", "x", ",", "int", "radix", ")", "{", "long", "asLong", "=", "x", "&", "INT_MASK", ";", "return", "Long", ".", "toString", "(", "asLong", ",", "radix", ")", ";", "}" ]
Returns a string representation of {@code x} for the given radix, where {@code x} is treated as unsigned. @param x the value to convert to a string. @param radix the radix to use while working with {@code x} @throws IllegalArgumentException if {@code radix} is not between {@link Character#MIN_RADIX} and {@link Character#MAX_RADIX}.
[ "Returns", "a", "string", "representation", "of", "{", "@code", "x", "}", "for", "the", "given", "radix", "where", "{", "@code", "x", "}", "is", "treated", "as", "unsigned", "." ]
train
https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-api/src/main/java/io/protostuff/UnsignedNumberUtil.java#L170-L174
aws/aws-sdk-java
aws-java-sdk-glacier/src/main/java/com/amazonaws/services/glacier/TreeHashGenerator.java
TreeHashGenerator.calculateTreeHash
public static String calculateTreeHash(List<byte[]> checksums) throws AmazonClientException { /* * The tree hash algorithm involves concatenating adjacent pairs of * individual checksums, then taking the checksum of the resulting bytes * and storing it, then recursing on this new list until there is only * one element. Any final odd-numbered parts at each step are carried * over to the next iteration as-is. */ List<byte[]> hashes = new ArrayList<byte[]>(); hashes.addAll(checksums); while ( hashes.size() > 1 ) { List<byte[]> treeHashes = new ArrayList<byte[]>(); for ( int i = 0; i < hashes.size() / 2; i++ ) { byte[] firstPart = hashes.get(2 * i); byte[] secondPart = hashes.get(2 * i + 1); byte[] concatenation = new byte[firstPart.length + secondPart.length]; System.arraycopy(firstPart, 0, concatenation, 0, firstPart.length); System.arraycopy(secondPart, 0, concatenation, firstPart.length, secondPart.length); try { treeHashes.add(computeSHA256Hash(concatenation)); } catch (Exception e) { throw new AmazonClientException("Unable to compute hash", e); } } if ( hashes.size() % 2 == 1 ) { treeHashes.add(hashes.get(hashes.size() - 1)); } hashes = treeHashes; } return BinaryUtils.toHex(hashes.get(0)); }
java
public static String calculateTreeHash(List<byte[]> checksums) throws AmazonClientException { /* * The tree hash algorithm involves concatenating adjacent pairs of * individual checksums, then taking the checksum of the resulting bytes * and storing it, then recursing on this new list until there is only * one element. Any final odd-numbered parts at each step are carried * over to the next iteration as-is. */ List<byte[]> hashes = new ArrayList<byte[]>(); hashes.addAll(checksums); while ( hashes.size() > 1 ) { List<byte[]> treeHashes = new ArrayList<byte[]>(); for ( int i = 0; i < hashes.size() / 2; i++ ) { byte[] firstPart = hashes.get(2 * i); byte[] secondPart = hashes.get(2 * i + 1); byte[] concatenation = new byte[firstPart.length + secondPart.length]; System.arraycopy(firstPart, 0, concatenation, 0, firstPart.length); System.arraycopy(secondPart, 0, concatenation, firstPart.length, secondPart.length); try { treeHashes.add(computeSHA256Hash(concatenation)); } catch (Exception e) { throw new AmazonClientException("Unable to compute hash", e); } } if ( hashes.size() % 2 == 1 ) { treeHashes.add(hashes.get(hashes.size() - 1)); } hashes = treeHashes; } return BinaryUtils.toHex(hashes.get(0)); }
[ "public", "static", "String", "calculateTreeHash", "(", "List", "<", "byte", "[", "]", ">", "checksums", ")", "throws", "AmazonClientException", "{", "/*\r\n * The tree hash algorithm involves concatenating adjacent pairs of\r\n * individual checksums, then taking the...
Returns the hex encoded binary tree hash for the individual checksums given. The sums are assumed to have been generated from sequential 1MB portions of a larger file, with the possible exception of the last part, which may be less than a full MB. @return The combined hex encoded binary tree hash for the individual checksums specified. @throws AmazonClientException If problems were encountered reading the data or calculating the hash.
[ "Returns", "the", "hex", "encoded", "binary", "tree", "hash", "for", "the", "individual", "checksums", "given", ".", "The", "sums", "are", "assumed", "to", "have", "been", "generated", "from", "sequential", "1MB", "portions", "of", "a", "larger", "file", "wi...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glacier/src/main/java/com/amazonaws/services/glacier/TreeHashGenerator.java#L112-L144
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.getDateFormat
public static String getDateFormat(final Date date, final String pattern) { SimpleDateFormat simpleDateFormat = buildDateFormat(pattern); return simpleDateFormat.format(date); }
java
public static String getDateFormat(final Date date, final String pattern) { SimpleDateFormat simpleDateFormat = buildDateFormat(pattern); return simpleDateFormat.format(date); }
[ "public", "static", "String", "getDateFormat", "(", "final", "Date", "date", ",", "final", "String", "pattern", ")", "{", "SimpleDateFormat", "simpleDateFormat", "=", "buildDateFormat", "(", "pattern", ")", ";", "return", "simpleDateFormat", ".", "format", "(", ...
Format date by given pattern. @param date date to be handled. @param pattern pattern use to handle given date. @return a string object of format date by given pattern.
[ "Format", "date", "by", "given", "pattern", "." ]
train
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L111-L115
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Solo.java
Solo.getView
public View getView(int id){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "getView("+id+")"); } return getView(id, 0); }
java
public View getView(int id){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "getView("+id+")"); } return getView(id, 0); }
[ "public", "View", "getView", "(", "int", "id", ")", "{", "if", "(", "config", ".", "commandLogging", ")", "{", "Log", ".", "d", "(", "config", ".", "commandLoggingTag", ",", "\"getView(\"", "+", "id", "+", "\")\"", ")", ";", "}", "return", "getView", ...
Returns a View matching the specified resource id. @param id the R.id of the {@link View} to return @return a {@link View} matching the specified id
[ "Returns", "a", "View", "matching", "the", "specified", "resource", "id", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L3025-L3031
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/recordcount/CompactionRecordCountProvider.java
CompactionRecordCountProvider.constructFileName
@Deprecated public static String constructFileName(String filenamePrefix, long recordCount) { return constructFileName(filenamePrefix, DEFAULT_SUFFIX, recordCount); }
java
@Deprecated public static String constructFileName(String filenamePrefix, long recordCount) { return constructFileName(filenamePrefix, DEFAULT_SUFFIX, recordCount); }
[ "@", "Deprecated", "public", "static", "String", "constructFileName", "(", "String", "filenamePrefix", ",", "long", "recordCount", ")", "{", "return", "constructFileName", "(", "filenamePrefix", ",", "DEFAULT_SUFFIX", ",", "recordCount", ")", ";", "}" ]
Construct the file name as {filenamePrefix}{recordCount}.{SystemCurrentTimeInMills}.{RandomInteger}{SUFFIX}. @deprecated discouraged since default behavior is not obvious from API itself.
[ "Construct", "the", "file", "name", "as", "{", "filenamePrefix", "}", "{", "recordCount", "}", ".", "{", "SystemCurrentTimeInMills", "}", ".", "{", "RandomInteger", "}", "{", "SUFFIX", "}", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/recordcount/CompactionRecordCountProvider.java#L48-L51
kite-sdk/kite
kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/Constraints.java
Constraints.toNormalizedQueryMap
public Map<String, String> toNormalizedQueryMap() { Map<String, String> query = Maps.newTreeMap(); return toQueryMap(query, true); }
java
public Map<String, String> toNormalizedQueryMap() { Map<String, String> query = Maps.newTreeMap(); return toQueryMap(query, true); }
[ "public", "Map", "<", "String", ",", "String", ">", "toNormalizedQueryMap", "(", ")", "{", "Map", "<", "String", ",", "String", ">", "query", "=", "Maps", ".", "newTreeMap", "(", ")", ";", "return", "toQueryMap", "(", "query", ",", "true", ")", ";", ...
Get a normalized query map for the constraints. A normalized query map will be equal in value and iteration order for any logically equivalent set of constraints.
[ "Get", "a", "normalized", "query", "map", "for", "the", "constraints", ".", "A", "normalized", "query", "map", "will", "be", "equal", "in", "value", "and", "iteration", "order", "for", "any", "logically", "equivalent", "set", "of", "constraints", "." ]
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/Constraints.java#L459-L462
perwendel/spark
src/main/java/spark/FilterImpl.java
FilterImpl.create
static FilterImpl create(final String path, String acceptType, final Filter filter) { if (acceptType == null) { acceptType = DEFAULT_ACCEPT_TYPE; } return new FilterImpl(path, acceptType, filter) { @Override public void handle(Request request, Response response) throws Exception { filter.handle(request, response); } }; }
java
static FilterImpl create(final String path, String acceptType, final Filter filter) { if (acceptType == null) { acceptType = DEFAULT_ACCEPT_TYPE; } return new FilterImpl(path, acceptType, filter) { @Override public void handle(Request request, Response response) throws Exception { filter.handle(request, response); } }; }
[ "static", "FilterImpl", "create", "(", "final", "String", "path", ",", "String", "acceptType", ",", "final", "Filter", "filter", ")", "{", "if", "(", "acceptType", "==", "null", ")", "{", "acceptType", "=", "DEFAULT_ACCEPT_TYPE", ";", "}", "return", "new", ...
Wraps the filter in FilterImpl @param path the path @param acceptType the accept type @param filter the filter @return the wrapped route
[ "Wraps", "the", "filter", "in", "FilterImpl" ]
train
https://github.com/perwendel/spark/blob/080fb1f9d6e580f6742e9589044c7420d3157b8b/src/main/java/spark/FilterImpl.java#L66-L76
alkacon/opencms-core
src/org/opencms/workplace/editors/CmsXmlContentEditor.java
CmsXmlContentEditor.actionPreview
public void actionPreview() throws IOException, JspException { try { // save content of the editor only to the temporary file setEditorValues(getElementLocale()); writeContent(); CmsObject cloneCms = getCloneCms(); CmsUUID tempProjectId = OpenCms.getWorkplaceManager().getTempFileProjectId(); cloneCms.getRequestContext().setCurrentProject(getCms().readProject(tempProjectId)); // remove eventual release & expiration date from temporary file to make preview work cloneCms.setDateReleased(getParamTempfile(), CmsResource.DATE_RELEASED_DEFAULT, false); cloneCms.setDateExpired(getParamTempfile(), CmsResource.DATE_EXPIRED_DEFAULT, false); } catch (CmsException e) { // show error page showErrorPage(this, e); } // get preview uri from content handler String previewUri = m_content.getHandler().getPreview(getCms(), m_content, getParamTempfile()); // create locale request parameter StringBuffer param = new StringBuffer(8); if (previewUri.indexOf('?') != -1) { param.append("&"); } else { param.append("?"); } param.append(CmsLocaleManager.PARAMETER_LOCALE); param.append("="); param.append(getParamElementlanguage()); // redirect to the temporary file with currently active element language or to the specified preview uri sendCmsRedirect(previewUri + param); }
java
public void actionPreview() throws IOException, JspException { try { // save content of the editor only to the temporary file setEditorValues(getElementLocale()); writeContent(); CmsObject cloneCms = getCloneCms(); CmsUUID tempProjectId = OpenCms.getWorkplaceManager().getTempFileProjectId(); cloneCms.getRequestContext().setCurrentProject(getCms().readProject(tempProjectId)); // remove eventual release & expiration date from temporary file to make preview work cloneCms.setDateReleased(getParamTempfile(), CmsResource.DATE_RELEASED_DEFAULT, false); cloneCms.setDateExpired(getParamTempfile(), CmsResource.DATE_EXPIRED_DEFAULT, false); } catch (CmsException e) { // show error page showErrorPage(this, e); } // get preview uri from content handler String previewUri = m_content.getHandler().getPreview(getCms(), m_content, getParamTempfile()); // create locale request parameter StringBuffer param = new StringBuffer(8); if (previewUri.indexOf('?') != -1) { param.append("&"); } else { param.append("?"); } param.append(CmsLocaleManager.PARAMETER_LOCALE); param.append("="); param.append(getParamElementlanguage()); // redirect to the temporary file with currently active element language or to the specified preview uri sendCmsRedirect(previewUri + param); }
[ "public", "void", "actionPreview", "(", ")", "throws", "IOException", ",", "JspException", "{", "try", "{", "// save content of the editor only to the temporary file", "setEditorValues", "(", "getElementLocale", "(", ")", ")", ";", "writeContent", "(", ")", ";", "CmsO...
Performs the preview XML content action in a new browser window.<p> @throws IOException if redirect fails @throws JspException if inclusion of error page fails
[ "Performs", "the", "preview", "XML", "content", "action", "in", "a", "new", "browser", "window", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/CmsXmlContentEditor.java#L534-L568
osiam/connector4java
src/main/java/org/osiam/resources/scim/Extension.java
Extension.getField
public <T> T getField(String field, ExtensionFieldType<T> extensionFieldType) { if (field == null || field.isEmpty()) { throw new IllegalArgumentException("Invalid field name"); } if (extensionFieldType == null) { throw new IllegalArgumentException("Invalid field type"); } if (!isFieldPresent(field)) { throw new NoSuchElementException("Field " + field + " not valid in this extension"); } return extensionFieldType.fromString(fields.get(field).value); }
java
public <T> T getField(String field, ExtensionFieldType<T> extensionFieldType) { if (field == null || field.isEmpty()) { throw new IllegalArgumentException("Invalid field name"); } if (extensionFieldType == null) { throw new IllegalArgumentException("Invalid field type"); } if (!isFieldPresent(field)) { throw new NoSuchElementException("Field " + field + " not valid in this extension"); } return extensionFieldType.fromString(fields.get(field).value); }
[ "public", "<", "T", ">", "T", "getField", "(", "String", "field", ",", "ExtensionFieldType", "<", "T", ">", "extensionFieldType", ")", "{", "if", "(", "field", "==", "null", "||", "field", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArg...
Return the value for the field with a given name and type. @param field The name of the field to retrieve the value of. @param extensionFieldType The type of the field. @return The value for the field with the given name. @throws NoSuchElementException if this schema does not contain a field of the given name. @throws IllegalArgumentException if the given field is null or an empty string or if the extensionFieldType is null.
[ "Return", "the", "value", "for", "the", "field", "with", "a", "given", "name", "and", "type", "." ]
train
https://github.com/osiam/connector4java/blob/a5e6ae1e706f4889d662a069fe2f3bf8e3848d12/src/main/java/org/osiam/resources/scim/Extension.java#L88-L101
IBM-Cloud/gp-java-client
src/main/java/com/ibm/g11n/pipeline/iam/TokenLifeCycleManager.java
TokenLifeCycleManager.getInstance
static TokenLifeCycleManager getInstance(final String iamEndpoint, final String apiKey) { if (iamEndpoint == null || iamEndpoint.isEmpty()) { throw new IllegalArgumentException( "Cannot initialize with null or empty IAM endpoint."); } if (apiKey == null || apiKey.isEmpty()) { throw new IllegalArgumentException( "Cannot initialize with null or empty IAM apiKey."); } return getInstanceUnchecked(iamEndpoint, apiKey); }
java
static TokenLifeCycleManager getInstance(final String iamEndpoint, final String apiKey) { if (iamEndpoint == null || iamEndpoint.isEmpty()) { throw new IllegalArgumentException( "Cannot initialize with null or empty IAM endpoint."); } if (apiKey == null || apiKey.isEmpty()) { throw new IllegalArgumentException( "Cannot initialize with null or empty IAM apiKey."); } return getInstanceUnchecked(iamEndpoint, apiKey); }
[ "static", "TokenLifeCycleManager", "getInstance", "(", "final", "String", "iamEndpoint", ",", "final", "String", "apiKey", ")", "{", "if", "(", "iamEndpoint", "==", "null", "||", "iamEndpoint", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgume...
Get an instance of TokenLifeCylceManager. Single instance is maintained for each unique pair of iamEndpoint and apiKey. The method is thread safe. @param iamEndpoint IAM endpoint. @param apiKey IAM API Key. @return Instance of TokenLifeCylceManager
[ "Get", "an", "instance", "of", "TokenLifeCylceManager", ".", "Single", "instance", "is", "maintained", "for", "each", "unique", "pair", "of", "iamEndpoint", "and", "apiKey", ".", "The", "method", "is", "thread", "safe", "." ]
train
https://github.com/IBM-Cloud/gp-java-client/blob/b015a081d7a7313bc48c448087fbc07bce860427/src/main/java/com/ibm/g11n/pipeline/iam/TokenLifeCycleManager.java#L184-L195
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java
IoUtil.readLines
public static <T extends Collection<String>> T readLines(InputStream in, String charsetName, T collection) throws IORuntimeException { return readLines(in, CharsetUtil.charset(charsetName), collection); }
java
public static <T extends Collection<String>> T readLines(InputStream in, String charsetName, T collection) throws IORuntimeException { return readLines(in, CharsetUtil.charset(charsetName), collection); }
[ "public", "static", "<", "T", "extends", "Collection", "<", "String", ">", ">", "T", "readLines", "(", "InputStream", "in", ",", "String", "charsetName", ",", "T", "collection", ")", "throws", "IORuntimeException", "{", "return", "readLines", "(", "in", ",",...
从流中读取内容 @param <T> 集合类型 @param in 输入流 @param charsetName 字符集 @param collection 返回集合 @return 内容 @throws IORuntimeException IO异常
[ "从流中读取内容" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L644-L646
solita/clamav-java
src/main/java/fi/solita/clamav/ClamAVClient.java
ClamAVClient.isCleanReply
public static boolean isCleanReply(byte[] reply) { String r = new String(reply, StandardCharsets.US_ASCII); return (r.contains("OK") && !r.contains("FOUND")); }
java
public static boolean isCleanReply(byte[] reply) { String r = new String(reply, StandardCharsets.US_ASCII); return (r.contains("OK") && !r.contains("FOUND")); }
[ "public", "static", "boolean", "isCleanReply", "(", "byte", "[", "]", "reply", ")", "{", "String", "r", "=", "new", "String", "(", "reply", ",", "StandardCharsets", ".", "US_ASCII", ")", ";", "return", "(", "r", ".", "contains", "(", "\"OK\"", ")", "&&...
Interpret the result from a ClamAV scan, and determine if the result means the data is clean @param reply The reply from the server after scanning @return true if no virus was found according to the clamd reply message
[ "Interpret", "the", "result", "from", "a", "ClamAV", "scan", "and", "determine", "if", "the", "result", "means", "the", "data", "is", "clean" ]
train
https://github.com/solita/clamav-java/blob/4ff23d37fb0763862db76f2f3389f3e45e80dd09/src/main/java/fi/solita/clamav/ClamAVClient.java#L133-L136
voldemort/voldemort
src/java/voldemort/utils/ByteUtils.java
ByteUtils.writeBytes
public static void writeBytes(byte[] bytes, long value, int offset, int numBytes) { int shift = 0; for(int i = offset + numBytes - 1; i >= offset; i--) { bytes[i] = (byte) (0xFF & (value >> shift)); shift += 8; } }
java
public static void writeBytes(byte[] bytes, long value, int offset, int numBytes) { int shift = 0; for(int i = offset + numBytes - 1; i >= offset; i--) { bytes[i] = (byte) (0xFF & (value >> shift)); shift += 8; } }
[ "public", "static", "void", "writeBytes", "(", "byte", "[", "]", "bytes", ",", "long", "value", ",", "int", "offset", ",", "int", "numBytes", ")", "{", "int", "shift", "=", "0", ";", "for", "(", "int", "i", "=", "offset", "+", "numBytes", "-", "1",...
Write the given number of bytes out to the array @param bytes The array to write to @param value The value to write from @param offset the offset into the array @param numBytes The number of bytes to write
[ "Write", "the", "given", "number", "of", "bytes", "out", "to", "the", "array" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/ByteUtils.java#L295-L301
basho/riak-java-client
src/main/java/com/basho/riak/client/api/convert/reflection/AnnotationUtil.java
AnnotationUtil.getLinks
public static <T> RiakLinks getLinks(RiakLinks container, T domainObject) { return AnnotationHelper.getInstance().getLinks(container, domainObject); }
java
public static <T> RiakLinks getLinks(RiakLinks container, T domainObject) { return AnnotationHelper.getInstance().getLinks(container, domainObject); }
[ "public", "static", "<", "T", ">", "RiakLinks", "getLinks", "(", "RiakLinks", "container", ",", "T", "domainObject", ")", "{", "return", "AnnotationHelper", ".", "getInstance", "(", ")", ".", "getLinks", "(", "container", ",", "domainObject", ")", ";", "}" ]
Attempts to get the the Riak links from a domain object by looking for a {@literal @RiakLinks} annotated member. @param <T> the domain object type @param container the RiakLinks container @param domainObject the domain object @return a Collection of RiakLink objects.
[ "Attempts", "to", "get", "the", "the", "Riak", "links", "from", "a", "domain", "object", "by", "looking", "for", "a", "{", "@literal", "@RiakLinks", "}", "annotated", "member", "." ]
train
https://github.com/basho/riak-java-client/blob/bed6cd60f360bacf1b873ab92dd74f2526651e71/src/main/java/com/basho/riak/client/api/convert/reflection/AnnotationUtil.java#L237-L240
yan74/afplib
org.afplib/src/main/java/org/afplib/base/util/BaseValidator.java
BaseValidator.validateModcaString8_MaxLength
public boolean validateModcaString8_MaxLength(String modcaString8, DiagnosticChain diagnostics, Map<Object, Object> context) { int length = modcaString8.length(); boolean result = length <= 8; if (!result && diagnostics != null) reportMaxLengthViolation(BasePackage.Literals.MODCA_STRING8, modcaString8, length, 8, diagnostics, context); return result; }
java
public boolean validateModcaString8_MaxLength(String modcaString8, DiagnosticChain diagnostics, Map<Object, Object> context) { int length = modcaString8.length(); boolean result = length <= 8; if (!result && diagnostics != null) reportMaxLengthViolation(BasePackage.Literals.MODCA_STRING8, modcaString8, length, 8, diagnostics, context); return result; }
[ "public", "boolean", "validateModcaString8_MaxLength", "(", "String", "modcaString8", ",", "DiagnosticChain", "diagnostics", ",", "Map", "<", "Object", ",", "Object", ">", "context", ")", "{", "int", "length", "=", "modcaString8", ".", "length", "(", ")", ";", ...
Validates the MaxLength constraint of '<em>Modca String8</em>'. <!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "Validates", "the", "MaxLength", "constraint", "of", "<em", ">", "Modca", "String8<", "/", "em", ">", ".", "<!", "--", "begin", "-", "user", "-", "doc", "--", ">", "<!", "--", "end", "-", "user", "-", "doc", "--", ">" ]
train
https://github.com/yan74/afplib/blob/9ff0513f9448bdf8c0b0e31dc4910c094c48fb2f/org.afplib/src/main/java/org/afplib/base/util/BaseValidator.java#L239-L245
BotMill/fb-botmill
src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ReplyFactory.java
ReplyFactory.getReusableImageAttachment
public static AttachmentMessageBuilder getReusableImageAttachment(String attachmentId) { AttachmentPayload payload = new AttachmentPayload(); payload.setAttachmentId(attachmentId); return new AttachmentMessageBuilder(AttachmentType.IMAGE, payload); }
java
public static AttachmentMessageBuilder getReusableImageAttachment(String attachmentId) { AttachmentPayload payload = new AttachmentPayload(); payload.setAttachmentId(attachmentId); return new AttachmentMessageBuilder(AttachmentType.IMAGE, payload); }
[ "public", "static", "AttachmentMessageBuilder", "getReusableImageAttachment", "(", "String", "attachmentId", ")", "{", "AttachmentPayload", "payload", "=", "new", "AttachmentPayload", "(", ")", ";", "payload", ".", "setAttachmentId", "(", "attachmentId", ")", ";", "re...
Get the reusable image attachment @param attachmentId the attachment id generated by the upload api @return a builder for the response. @see <a href= "https://developers.facebook.com/docs/messenger-platform/send-api-reference/image-attachment" > Facebook's Messenger Platform Image Attachment Documentation</a>
[ "Get", "the", "reusable", "image", "attachment" ]
train
https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ReplyFactory.java#L139-L143
jscep/jscep
src/main/java/org/jscep/client/Client.java
Client.getCertificate
public CertStore getCertificate(final X509Certificate identity, final PrivateKey key, final BigInteger serial, final String profile) throws OperationFailureException, ClientException { LOGGER.debug("Retriving certificate from CA"); // TRANSACTIONAL // Certificate query final CertStore store = getCaCertificate(profile); CertStoreInspector certs = inspectorFactory.getInstance(store); final X509Certificate ca = certs.getIssuer(); X500Name name = X500Utils.toX500Name(ca.getSubjectX500Principal()); IssuerAndSerialNumber iasn = new IssuerAndSerialNumber(name, serial); Transport transport = createTransport(profile); final Transaction t = new NonEnrollmentTransaction(transport, getEncoder(identity, key, profile), getDecoder(identity, key, profile), iasn, MessageType.GET_CERT); State state; try { state = t.send(); } catch (TransactionException e) { throw new ClientException(e); } if (state == State.CERT_ISSUED) { return t.getCertStore(); } else if (state == State.CERT_REQ_PENDING) { throw new IllegalStateException(); } else { throw new OperationFailureException(t.getFailInfo()); } }
java
public CertStore getCertificate(final X509Certificate identity, final PrivateKey key, final BigInteger serial, final String profile) throws OperationFailureException, ClientException { LOGGER.debug("Retriving certificate from CA"); // TRANSACTIONAL // Certificate query final CertStore store = getCaCertificate(profile); CertStoreInspector certs = inspectorFactory.getInstance(store); final X509Certificate ca = certs.getIssuer(); X500Name name = X500Utils.toX500Name(ca.getSubjectX500Principal()); IssuerAndSerialNumber iasn = new IssuerAndSerialNumber(name, serial); Transport transport = createTransport(profile); final Transaction t = new NonEnrollmentTransaction(transport, getEncoder(identity, key, profile), getDecoder(identity, key, profile), iasn, MessageType.GET_CERT); State state; try { state = t.send(); } catch (TransactionException e) { throw new ClientException(e); } if (state == State.CERT_ISSUED) { return t.getCertStore(); } else if (state == State.CERT_REQ_PENDING) { throw new IllegalStateException(); } else { throw new OperationFailureException(t.getFailInfo()); } }
[ "public", "CertStore", "getCertificate", "(", "final", "X509Certificate", "identity", ",", "final", "PrivateKey", "key", ",", "final", "BigInteger", "serial", ",", "final", "String", "profile", ")", "throws", "OperationFailureException", ",", "ClientException", "{", ...
Retrieves the certificate corresponding to the provided serial number. <p> This request relates only to the current CA certificate. If the CA certificate has changed since the requested certificate was issued, this operation will fail. <p> This method provides support for SCEP servers with multiple profiles. @param identity the identity of the client. @param key the private key to sign the SCEP request. @param serial the serial number of the requested certificate. @param profile the SCEP server profile. @return the certificate store containing the requested certificate. @throws ClientException if any client error occurs. @throws OperationFailureException if the SCEP server refuses to service the request.
[ "Retrieves", "the", "certificate", "corresponding", "to", "the", "provided", "serial", "number", ".", "<p", ">", "This", "request", "relates", "only", "to", "the", "current", "CA", "certificate", ".", "If", "the", "CA", "certificate", "has", "changed", "since"...
train
https://github.com/jscep/jscep/blob/d2c602f8b3adb774704c24eaf62f6b8654a40e35/src/main/java/org/jscep/client/Client.java#L524-L555
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.createOrUpdate
public DisasterRecoveryConfigurationInner createOrUpdate(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).toBlocking().last().body(); }
java
public DisasterRecoveryConfigurationInner createOrUpdate(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).toBlocking().last().body(); }
[ "public", "DisasterRecoveryConfigurationInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "disasterRecoveryConfigurationName", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "s...
Creates or updates a disaster recovery configuration. @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 be created/updated. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the DisasterRecoveryConfigurationInner object if successful.
[ "Creates", "or", "updates", "a", "disaster", "recovery", "configuration", "." ]
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#L371-L373
codelibs/jcifs
src/main/java/jcifs/smb1/smb1/SmbFile.java
SmbFile.listFiles
public SmbFile[] listFiles( String wildcard ) throws SmbException { return listFiles( wildcard, ATTR_DIRECTORY | ATTR_HIDDEN | ATTR_SYSTEM, null, null ); }
java
public SmbFile[] listFiles( String wildcard ) throws SmbException { return listFiles( wildcard, ATTR_DIRECTORY | ATTR_HIDDEN | ATTR_SYSTEM, null, null ); }
[ "public", "SmbFile", "[", "]", "listFiles", "(", "String", "wildcard", ")", "throws", "SmbException", "{", "return", "listFiles", "(", "wildcard", ",", "ATTR_DIRECTORY", "|", "ATTR_HIDDEN", "|", "ATTR_SYSTEM", ",", "null", ",", "null", ")", ";", "}" ]
The CIFS protocol provides for DOS "wildcards" to be used as a performance enhancement. The client does not have to filter the names and the server does not have to return all directory entries. <p> The wildcard expression may consist of two special meta characters in addition to the normal filename characters. The '*' character matches any number of characters in part of a name. If the expression begins with one or more '?'s then exactly that many characters will be matched whereas if it ends with '?'s it will match that many characters <i>or less</i>. <p> Wildcard expressions will not filter workgroup names or server names. <blockquote><pre> winnt> ls c?o* clock.avi -rw-- 82944 Mon Oct 14 1996 1:38 AM Cookies drw-- 0 Fri Nov 13 1998 9:42 PM 2 items in 5ms </pre></blockquote> @param wildcard a wildcard expression @throws SmbException @return An array of <code>SmbFile</code> objects representing file and directories, workgroups, servers, or shares depending on the context of the resource URL
[ "The", "CIFS", "protocol", "provides", "for", "DOS", "wildcards", "to", "be", "used", "as", "a", "performance", "enhancement", ".", "The", "client", "does", "not", "have", "to", "filter", "the", "names", "and", "the", "server", "does", "not", "have", "to",...
train
https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/smb1/SmbFile.java#L1684-L1686
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/route/Route.java
Route.HEAD
public static Route HEAD(String uriPattern, RouteHandler routeHandler) { return new Route(HttpConstants.Method.HEAD, uriPattern, routeHandler); }
java
public static Route HEAD(String uriPattern, RouteHandler routeHandler) { return new Route(HttpConstants.Method.HEAD, uriPattern, routeHandler); }
[ "public", "static", "Route", "HEAD", "(", "String", "uriPattern", ",", "RouteHandler", "routeHandler", ")", "{", "return", "new", "Route", "(", "HttpConstants", ".", "Method", ".", "HEAD", ",", "uriPattern", ",", "routeHandler", ")", ";", "}" ]
Create a {@code HEAD} route. @param uriPattern @param routeHandler @return
[ "Create", "a", "{", "@code", "HEAD", "}", "route", "." ]
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/route/Route.java#L103-L105
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/WebSiteManagementClientImpl.java
WebSiteManagementClientImpl.checkNameAvailabilityAsync
public Observable<ResourceNameAvailabilityInner> checkNameAvailabilityAsync(String name, CheckNameResourceTypes type, Boolean isFqdn) { return checkNameAvailabilityWithServiceResponseAsync(name, type, isFqdn).map(new Func1<ServiceResponse<ResourceNameAvailabilityInner>, ResourceNameAvailabilityInner>() { @Override public ResourceNameAvailabilityInner call(ServiceResponse<ResourceNameAvailabilityInner> response) { return response.body(); } }); }
java
public Observable<ResourceNameAvailabilityInner> checkNameAvailabilityAsync(String name, CheckNameResourceTypes type, Boolean isFqdn) { return checkNameAvailabilityWithServiceResponseAsync(name, type, isFqdn).map(new Func1<ServiceResponse<ResourceNameAvailabilityInner>, ResourceNameAvailabilityInner>() { @Override public ResourceNameAvailabilityInner call(ServiceResponse<ResourceNameAvailabilityInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ResourceNameAvailabilityInner", ">", "checkNameAvailabilityAsync", "(", "String", "name", ",", "CheckNameResourceTypes", "type", ",", "Boolean", "isFqdn", ")", "{", "return", "checkNameAvailabilityWithServiceResponseAsync", "(", "name", ",", ...
Check if a resource name is available. Check if a resource name is available. @param name Resource name to verify. @param type Resource type used for verification. Possible values include: 'Site', 'Slot', 'HostingEnvironment', 'PublishingUser', 'Microsoft.Web/sites', 'Microsoft.Web/sites/slots', 'Microsoft.Web/hostingEnvironments', 'Microsoft.Web/publishingUsers' @param isFqdn Is fully qualified domain name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ResourceNameAvailabilityInner object
[ "Check", "if", "a", "resource", "name", "is", "available", ".", "Check", "if", "a", "resource", "name", "is", "available", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/WebSiteManagementClientImpl.java#L1278-L1285
arquillian/arquillian-extension-warp
impl/src/main/java/org/jboss/arquillian/warp/impl/server/execution/WarpFilter.java
WarpFilter.doFilterHttp
private void doFilterHttp(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException, ServletException { request.setAttribute(ARQUILLIAN_MANAGER_ATTRIBUTE, manager); boolean isDelegated = delegator.tryDelegateRequest(request, response, filterChain); if (!isDelegated) { doFilterWarp(request, response, filterChain); } }
java
private void doFilterHttp(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException, ServletException { request.setAttribute(ARQUILLIAN_MANAGER_ATTRIBUTE, manager); boolean isDelegated = delegator.tryDelegateRequest(request, response, filterChain); if (!isDelegated) { doFilterWarp(request, response, filterChain); } }
[ "private", "void", "doFilterHttp", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "FilterChain", "filterChain", ")", "throws", "IOException", ",", "ServletException", "{", "request", ".", "setAttribute", "(", "ARQUILLIAN_MANAGER_ATTRIBU...
<p> Checks whether the request processing can be delegated to one of registered {@link RequestDelegationService}s. </p> <p> <p> If not, delegates processing to {@link #doFilterWarp(HttpServletRequest, HttpServletResponse, FilterChain)}. </p>
[ "<p", ">", "Checks", "whether", "the", "request", "processing", "can", "be", "delegated", "to", "one", "of", "registered", "{" ]
train
https://github.com/arquillian/arquillian-extension-warp/blob/e958f4d782851baf7f40e39835d3d1ad185b74dd/impl/src/main/java/org/jboss/arquillian/warp/impl/server/execution/WarpFilter.java#L113-L123
Alluxio/alluxio
core/common/src/main/java/alluxio/util/FormatUtils.java
FormatUtils.byteArrayToHexString
public static String byteArrayToHexString(byte[] bytes, String prefix, String separator) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { sb.append(String.format("%s%02x", prefix, bytes[i])); if (i != bytes.length - 1) { sb.append(separator); } } return sb.toString(); }
java
public static String byteArrayToHexString(byte[] bytes, String prefix, String separator) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { sb.append(String.format("%s%02x", prefix, bytes[i])); if (i != bytes.length - 1) { sb.append(separator); } } return sb.toString(); }
[ "public", "static", "String", "byteArrayToHexString", "(", "byte", "[", "]", "bytes", ",", "String", "prefix", ",", "String", "separator", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";",...
Parses a byte array into a hex string where each byte is represented in the format {@code %02x}. @param bytes the byte array to be transformed @param prefix the prefix to use @param separator the separator to use @return the string representation of the byte array
[ "Parses", "a", "byte", "array", "into", "a", "hex", "string", "where", "each", "byte", "is", "represented", "in", "the", "format", "{", "@code", "%02x", "}", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/FormatUtils.java#L96-L105
dita-ot/dita-ot
src/main/java/org/dita/dost/util/XMLUtils.java
XMLUtils.escapeXML
public static String escapeXML(final String s) { final char[] chars = s.toCharArray(); return escapeXML(chars, 0, chars.length); }
java
public static String escapeXML(final String s) { final char[] chars = s.toCharArray(); return escapeXML(chars, 0, chars.length); }
[ "public", "static", "String", "escapeXML", "(", "final", "String", "s", ")", "{", "final", "char", "[", "]", "chars", "=", "s", ".", "toCharArray", "(", ")", ";", "return", "escapeXML", "(", "chars", ",", "0", ",", "chars", ".", "length", ")", ";", ...
Escape XML characters. @param s value needed to be escaped @return escaped value
[ "Escape", "XML", "characters", "." ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/XMLUtils.java#L637-L640
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
NodeIndexer.addPropertyName
private void addPropertyName(Document doc, InternalQName name) throws RepositoryException { String fieldName = name.getName(); try { fieldName = resolver.createJCRName(name).getAsString(); } catch (NamespaceException e) { // will never happen if (LOG.isTraceEnabled()) { LOG.trace("An exception occurred: " + e.getMessage()); } } doc.add(new Field(FieldNames.PROPERTIES_SET, fieldName, Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS)); }
java
private void addPropertyName(Document doc, InternalQName name) throws RepositoryException { String fieldName = name.getName(); try { fieldName = resolver.createJCRName(name).getAsString(); } catch (NamespaceException e) { // will never happen if (LOG.isTraceEnabled()) { LOG.trace("An exception occurred: " + e.getMessage()); } } doc.add(new Field(FieldNames.PROPERTIES_SET, fieldName, Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS)); }
[ "private", "void", "addPropertyName", "(", "Document", "doc", ",", "InternalQName", "name", ")", "throws", "RepositoryException", "{", "String", "fieldName", "=", "name", ".", "getName", "(", ")", ";", "try", "{", "fieldName", "=", "resolver", ".", "createJCRN...
Adds the property name to the lucene _:PROPERTIES_SET field. @param doc the document. @param name the name of the property. @throws RepositoryException
[ "Adds", "the", "property", "name", "to", "the", "lucene", "_", ":", "PROPERTIES_SET", "field", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java#L669-L685
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/protocol/file/Handler.java
Handler.hostsEqual
protected boolean hostsEqual(URL u1, URL u2) { /* * Special case for file: URLs * per RFC 1738 no hostname is equivalent to 'localhost' * i.e. file:///path is equal to file://localhost/path */ String s1 = u1.getHost(); String s2 = u2.getHost(); if ("localhost".equalsIgnoreCase(s1) && ( s2 == null || "".equals(s2))) return true; if ("localhost".equalsIgnoreCase(s2) && ( s1 == null || "".equals(s1))) return true; return super.hostsEqual(u1, u2); }
java
protected boolean hostsEqual(URL u1, URL u2) { /* * Special case for file: URLs * per RFC 1738 no hostname is equivalent to 'localhost' * i.e. file:///path is equal to file://localhost/path */ String s1 = u1.getHost(); String s2 = u2.getHost(); if ("localhost".equalsIgnoreCase(s1) && ( s2 == null || "".equals(s2))) return true; if ("localhost".equalsIgnoreCase(s2) && ( s1 == null || "".equals(s1))) return true; return super.hostsEqual(u1, u2); }
[ "protected", "boolean", "hostsEqual", "(", "URL", "u1", ",", "URL", "u2", ")", "{", "/*\n * Special case for file: URLs\n * per RFC 1738 no hostname is equivalent to 'localhost'\n * i.e. file:///path is equal to file://localhost/path\n */", "String", "s1", ...
Compares the host components of two URLs. @param u1 the URL of the first host to compare @param u2 the URL of the second host to compare @return <tt>true</tt> if and only if they are equal, <tt>false</tt> otherwise.
[ "Compares", "the", "host", "components", "of", "two", "URLs", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/protocol/file/Handler.java#L122-L135
weld/core
impl/src/main/java/org/jboss/weld/util/Beans.java
Beans.isBeanProxyable
public static boolean isBeanProxyable(Bean<?> bean, BeanManagerImpl manager) { if (bean instanceof RIBean<?>) { return ((RIBean<?>) bean).isProxyable(); } else { return Proxies.isTypesProxyable(bean.getTypes(), manager.getServices()); } }
java
public static boolean isBeanProxyable(Bean<?> bean, BeanManagerImpl manager) { if (bean instanceof RIBean<?>) { return ((RIBean<?>) bean).isProxyable(); } else { return Proxies.isTypesProxyable(bean.getTypes(), manager.getServices()); } }
[ "public", "static", "boolean", "isBeanProxyable", "(", "Bean", "<", "?", ">", "bean", ",", "BeanManagerImpl", "manager", ")", "{", "if", "(", "bean", "instanceof", "RIBean", "<", "?", ">", ")", "{", "return", "(", "(", "RIBean", "<", "?", ">", ")", "...
Indicates if a bean is proxyable @param bean The bean to test @return True if proxyable, false otherwise
[ "Indicates", "if", "a", "bean", "is", "proxyable" ]
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Beans.java#L156-L162
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Instant.java
Instant.ofEpochMilli
public static Instant ofEpochMilli(long epochMilli) { long secs = Math.floorDiv(epochMilli, 1000); int mos = (int)Math.floorMod(epochMilli, 1000); return create(secs, mos * 1000_000); }
java
public static Instant ofEpochMilli(long epochMilli) { long secs = Math.floorDiv(epochMilli, 1000); int mos = (int)Math.floorMod(epochMilli, 1000); return create(secs, mos * 1000_000); }
[ "public", "static", "Instant", "ofEpochMilli", "(", "long", "epochMilli", ")", "{", "long", "secs", "=", "Math", ".", "floorDiv", "(", "epochMilli", ",", "1000", ")", ";", "int", "mos", "=", "(", "int", ")", "Math", ".", "floorMod", "(", "epochMilli", ...
Obtains an instance of {@code Instant} using milliseconds from the epoch of 1970-01-01T00:00:00Z. <p> The seconds and nanoseconds are extracted from the specified milliseconds. @param epochMilli the number of milliseconds from 1970-01-01T00:00:00Z @return an instant, not null @throws DateTimeException if the instant exceeds the maximum or minimum instant
[ "Obtains", "an", "instance", "of", "{", "@code", "Instant", "}", "using", "milliseconds", "from", "the", "epoch", "of", "1970", "-", "01", "-", "01T00", ":", "00", ":", "00Z", ".", "<p", ">", "The", "seconds", "and", "nanoseconds", "are", "extracted", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Instant.java#L337-L341
leancloud/java-sdk-all
realtime/src/main/java/cn/leancloud/im/v2/AVIMConversationEventHandler.java
AVIMConversationEventHandler.onMemberUnblocked
public void onMemberUnblocked(AVIMClient client, AVIMConversation conversation, List<String> members, String operator){ LOGGER.d("Notification --- " + operator + " unblocked members: " + StringUtil.join(", ", members)); }
java
public void onMemberUnblocked(AVIMClient client, AVIMConversation conversation, List<String> members, String operator){ LOGGER.d("Notification --- " + operator + " unblocked members: " + StringUtil.join(", ", members)); }
[ "public", "void", "onMemberUnblocked", "(", "AVIMClient", "client", ",", "AVIMConversation", "conversation", ",", "List", "<", "String", ">", "members", ",", "String", "operator", ")", "{", "LOGGER", ".", "d", "(", "\"Notification --- \"", "+", "operator", "+", ...
聊天室成员被移出黑名单通知处理函数 @param client 聊天客户端 @param conversation 对话 @param members 成员列表 @param operator 操作者 id
[ "聊天室成员被移出黑名单通知处理函数" ]
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/realtime/src/main/java/cn/leancloud/im/v2/AVIMConversationEventHandler.java#L146-L148
ahome-it/lienzo-core
src/main/java/com/ait/lienzo/client/core/image/ImageProxy.java
ImageProxy.getImageData
public ImageData getImageData() { if (false == isLoaded()) { return null; } if (m_fastout) { final ScratchPad temp = new ScratchPad(m_dest_wide, m_dest_high); temp.getContext().drawImage(m_jsimg, m_clip_xpos, m_clip_ypos, m_clip_wide, m_clip_high, 0, 0, m_dest_wide, m_dest_high); return temp.getContext().getImageData(0, 0, m_dest_wide, m_dest_high); } else { return m_filterImage.getContext().getImageData(0, 0, m_dest_wide, m_dest_high); } }
java
public ImageData getImageData() { if (false == isLoaded()) { return null; } if (m_fastout) { final ScratchPad temp = new ScratchPad(m_dest_wide, m_dest_high); temp.getContext().drawImage(m_jsimg, m_clip_xpos, m_clip_ypos, m_clip_wide, m_clip_high, 0, 0, m_dest_wide, m_dest_high); return temp.getContext().getImageData(0, 0, m_dest_wide, m_dest_high); } else { return m_filterImage.getContext().getImageData(0, 0, m_dest_wide, m_dest_high); } }
[ "public", "ImageData", "getImageData", "(", ")", "{", "if", "(", "false", "==", "isLoaded", "(", ")", ")", "{", "return", "null", ";", "}", "if", "(", "m_fastout", ")", "{", "final", "ScratchPad", "temp", "=", "new", "ScratchPad", "(", "m_dest_wide", "...
Returns an ImageData object that can be used for further image processing e.g. by image filters. @return ImageData
[ "Returns", "an", "ImageData", "object", "that", "can", "be", "used", "for", "further", "image", "processing", "e", ".", "g", ".", "by", "image", "filters", "." ]
train
https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/image/ImageProxy.java#L595-L613
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/CFG.java
CFG.getIncomingEdgeWithType
public Edge getIncomingEdgeWithType(BasicBlock basicBlock, @Type int edgeType) { return getEdgeWithType(incomingEdgeIterator(basicBlock), edgeType); }
java
public Edge getIncomingEdgeWithType(BasicBlock basicBlock, @Type int edgeType) { return getEdgeWithType(incomingEdgeIterator(basicBlock), edgeType); }
[ "public", "Edge", "getIncomingEdgeWithType", "(", "BasicBlock", "basicBlock", ",", "@", "Type", "int", "edgeType", ")", "{", "return", "getEdgeWithType", "(", "incomingEdgeIterator", "(", "basicBlock", ")", ",", "edgeType", ")", ";", "}" ]
Get the first incoming edge in basic block with given type. @param basicBlock the basic block @param edgeType the edge type @return the Edge, or null if there is no edge with that edge type
[ "Get", "the", "first", "incoming", "edge", "in", "basic", "block", "with", "given", "type", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/CFG.java#L491-L493
eclipse/hawkbit
hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaControllerManagement.java
JpaControllerManagement.setLastTargetQuery
private void setLastTargetQuery(final String tenant, final long currentTimeMillis, final List<String> chunk) { final Map<String, String> paramMapping = Maps.newHashMapWithExpectedSize(chunk.size()); for (int i = 0; i < chunk.size(); i++) { paramMapping.put("cid" + i, chunk.get(i)); } final Query updateQuery = entityManager.createNativeQuery( "UPDATE sp_target SET last_target_query = #last_target_query WHERE controller_id IN (" + formatQueryInStatementParams(paramMapping.keySet()) + ") AND tenant = #tenant"); paramMapping.forEach(updateQuery::setParameter); updateQuery.setParameter("last_target_query", currentTimeMillis); updateQuery.setParameter("tenant", tenant); final int updated = updateQuery.executeUpdate(); if (updated < chunk.size()) { LOG.error("Targets polls could not be applied completely ({} instead of {}).", updated, chunk.size()); } }
java
private void setLastTargetQuery(final String tenant, final long currentTimeMillis, final List<String> chunk) { final Map<String, String> paramMapping = Maps.newHashMapWithExpectedSize(chunk.size()); for (int i = 0; i < chunk.size(); i++) { paramMapping.put("cid" + i, chunk.get(i)); } final Query updateQuery = entityManager.createNativeQuery( "UPDATE sp_target SET last_target_query = #last_target_query WHERE controller_id IN (" + formatQueryInStatementParams(paramMapping.keySet()) + ") AND tenant = #tenant"); paramMapping.forEach(updateQuery::setParameter); updateQuery.setParameter("last_target_query", currentTimeMillis); updateQuery.setParameter("tenant", tenant); final int updated = updateQuery.executeUpdate(); if (updated < chunk.size()) { LOG.error("Targets polls could not be applied completely ({} instead of {}).", updated, chunk.size()); } }
[ "private", "void", "setLastTargetQuery", "(", "final", "String", "tenant", ",", "final", "long", "currentTimeMillis", ",", "final", "List", "<", "String", ">", "chunk", ")", "{", "final", "Map", "<", "String", ",", "String", ">", "paramMapping", "=", "Maps",...
Sets {@link Target#getLastTargetQuery()} by native SQL in order to avoid raising opt lock revision as this update is not mission critical and in fact only written by {@link ControllerManagement}, i.e. the target itself.
[ "Sets", "{" ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaControllerManagement.java#L453-L472
line/armeria
core/src/main/java/com/linecorp/armeria/server/file/AbstractHttpFileBuilder.java
AbstractHttpFileBuilder.cacheControl
public final B cacheControl(CharSequence cacheControl) { requireNonNull(cacheControl, "cacheControl"); return setHeader(HttpHeaderNames.CACHE_CONTROL, cacheControl); }
java
public final B cacheControl(CharSequence cacheControl) { requireNonNull(cacheControl, "cacheControl"); return setHeader(HttpHeaderNames.CACHE_CONTROL, cacheControl); }
[ "public", "final", "B", "cacheControl", "(", "CharSequence", "cacheControl", ")", "{", "requireNonNull", "(", "cacheControl", ",", "\"cacheControl\"", ")", ";", "return", "setHeader", "(", "HttpHeaderNames", ".", "CACHE_CONTROL", ",", "cacheControl", ")", ";", "}"...
Sets the {@code "cache-control"} header. This method is a shortcut of: <pre>{@code builder.setHeader(HttpHeaderNames.CACHE_CONTROL, cacheControl); }</pre>
[ "Sets", "the", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/file/AbstractHttpFileBuilder.java#L257-L260
sagiegurari/fax4j
src/main/java/org/fax4j/spi/hylafax/HylaFaxJob.java
HylaFaxJob.setPriority
public void setPriority(FaxJobPriority priority) { try { if(priority==FaxJobPriority.HIGH_PRIORITY) { this.JOB.setPriority(Job.PRIORITY_HIGH); } else { this.JOB.setPriority(Job.PRIORITY_NORMAL); } } catch(Exception exception) { throw new FaxException("Error while setting job priority.",exception); } }
java
public void setPriority(FaxJobPriority priority) { try { if(priority==FaxJobPriority.HIGH_PRIORITY) { this.JOB.setPriority(Job.PRIORITY_HIGH); } else { this.JOB.setPriority(Job.PRIORITY_NORMAL); } } catch(Exception exception) { throw new FaxException("Error while setting job priority.",exception); } }
[ "public", "void", "setPriority", "(", "FaxJobPriority", "priority", ")", "{", "try", "{", "if", "(", "priority", "==", "FaxJobPriority", ".", "HIGH_PRIORITY", ")", "{", "this", ".", "JOB", ".", "setPriority", "(", "Job", ".", "PRIORITY_HIGH", ")", ";", "}"...
This function sets the priority. @param priority The priority
[ "This", "function", "sets", "the", "priority", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/hylafax/HylaFaxJob.java#L142-L159
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParameters.java
QueryParameters.importValues
public void importValues(Map<String, Object> map) { for (String key : map.keySet()) { this.set(key, map.get(key)); } }
java
public void importValues(Map<String, Object> map) { for (String key : map.keySet()) { this.set(key, map.get(key)); } }
[ "public", "void", "importValues", "(", "Map", "<", "String", ",", "Object", ">", "map", ")", "{", "for", "(", "String", "key", ":", "map", ".", "keySet", "(", ")", ")", "{", "this", ".", "set", "(", "key", ",", "map", ".", "get", "(", "key", ")...
Imports values from Map. If such key already exists - value would be rewritten and Type/Position/Direction would be reset to default value. @param map Map which would be imported
[ "Imports", "values", "from", "Map", ".", "If", "such", "key", "already", "exists", "-", "value", "would", "be", "rewritten", "and", "Type", "/", "Position", "/", "Direction", "would", "be", "reset", "to", "default", "value", "." ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParameters.java#L196-L200
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/nio/IOUtil.java
IOUtil.copy
public static void copy(InputStream source, File target) { if (!target.exists()) { throw new HazelcastException("The target file doesn't exist " + target.getAbsolutePath()); } FileOutputStream out = null; try { out = new FileOutputStream(target); byte[] buff = new byte[8192]; int length; while ((length = source.read(buff)) > 0) { out.write(buff, 0, length); } } catch (Exception e) { throw new HazelcastException("Error occurred while copying InputStream", e); } finally { closeResource(out); } }
java
public static void copy(InputStream source, File target) { if (!target.exists()) { throw new HazelcastException("The target file doesn't exist " + target.getAbsolutePath()); } FileOutputStream out = null; try { out = new FileOutputStream(target); byte[] buff = new byte[8192]; int length; while ((length = source.read(buff)) > 0) { out.write(buff, 0, length); } } catch (Exception e) { throw new HazelcastException("Error occurred while copying InputStream", e); } finally { closeResource(out); } }
[ "public", "static", "void", "copy", "(", "InputStream", "source", ",", "File", "target", ")", "{", "if", "(", "!", "target", ".", "exists", "(", ")", ")", "{", "throw", "new", "HazelcastException", "(", "\"The target file doesn't exist \"", "+", "target", "....
Deep copies source to target. If target doesn't exist, this will fail with {@link HazelcastException}. <p> The source is only accessed here, but not managed. It's the responsibility of the caller to release any resources hold by the source. @param source the source @param target the destination @throws HazelcastException if the target doesn't exist
[ "Deep", "copies", "source", "to", "target", ".", "If", "target", "doesn", "t", "exist", "this", "will", "fail", "with", "{", "@link", "HazelcastException", "}", ".", "<p", ">", "The", "source", "is", "only", "accessed", "here", "but", "not", "managed", "...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/nio/IOUtil.java#L556-L575
enioka/jqm
jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/JobDef.java
JobDef.map
static JobDef map(ResultSet rs, int colShift) { JobDef tmp = new JobDef(); try { tmp.id = rs.getInt(1 + colShift); tmp.application = rs.getString(2 + colShift); tmp.applicationName = rs.getString(3 + colShift); tmp.canBeRestarted = true; tmp.classLoader = rs.getInt(4 + colShift) > 0 ? rs.getInt(4 + colShift) : null; tmp.description = rs.getString(5 + colShift); tmp.enabled = rs.getBoolean(6 + colShift); tmp.external = rs.getBoolean(7 + colShift); tmp.highlander = rs.getBoolean(8 + colShift); tmp.jarPath = rs.getString(9 + colShift); tmp.javaClassName = rs.getString(10 + colShift); tmp.javaOpts = rs.getString(11 + colShift); tmp.keyword1 = rs.getString(12 + colShift); tmp.keyword2 = rs.getString(13 + colShift); tmp.keyword3 = rs.getString(14 + colShift); tmp.maxTimeRunning = rs.getInt(15 + colShift); tmp.module = rs.getString(16 + colShift); tmp.pathType = PathType.valueOf(rs.getString(17 + colShift)); tmp.queue_id = rs.getInt(18 + colShift); tmp.priority = rs.getInt(19 + colShift) > 0 ? rs.getInt(19 + colShift) : null; } catch (SQLException e) { throw new DatabaseException(e); } return tmp; }
java
static JobDef map(ResultSet rs, int colShift) { JobDef tmp = new JobDef(); try { tmp.id = rs.getInt(1 + colShift); tmp.application = rs.getString(2 + colShift); tmp.applicationName = rs.getString(3 + colShift); tmp.canBeRestarted = true; tmp.classLoader = rs.getInt(4 + colShift) > 0 ? rs.getInt(4 + colShift) : null; tmp.description = rs.getString(5 + colShift); tmp.enabled = rs.getBoolean(6 + colShift); tmp.external = rs.getBoolean(7 + colShift); tmp.highlander = rs.getBoolean(8 + colShift); tmp.jarPath = rs.getString(9 + colShift); tmp.javaClassName = rs.getString(10 + colShift); tmp.javaOpts = rs.getString(11 + colShift); tmp.keyword1 = rs.getString(12 + colShift); tmp.keyword2 = rs.getString(13 + colShift); tmp.keyword3 = rs.getString(14 + colShift); tmp.maxTimeRunning = rs.getInt(15 + colShift); tmp.module = rs.getString(16 + colShift); tmp.pathType = PathType.valueOf(rs.getString(17 + colShift)); tmp.queue_id = rs.getInt(18 + colShift); tmp.priority = rs.getInt(19 + colShift) > 0 ? rs.getInt(19 + colShift) : null; } catch (SQLException e) { throw new DatabaseException(e); } return tmp; }
[ "static", "JobDef", "map", "(", "ResultSet", "rs", ",", "int", "colShift", ")", "{", "JobDef", "tmp", "=", "new", "JobDef", "(", ")", ";", "try", "{", "tmp", ".", "id", "=", "rs", ".", "getInt", "(", "1", "+", "colShift", ")", ";", "tmp", ".", ...
ResultSet is not modified (no rs.next called). @param rs @return
[ "ResultSet", "is", "not", "modified", "(", "no", "rs", ".", "next", "called", ")", "." ]
train
https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/JobDef.java#L462-L494
knowm/XChange
xchange-btcturk/src/main/java/org/knowm/xchange/btcturk/BTCTurkAdapters.java
BTCTurkAdapters.adaptTrade
public static Trade adaptTrade(BTCTurkTrades btcTurkTrade, CurrencyPair currencyPair) { return new Trade( null, btcTurkTrade.getAmount(), currencyPair, btcTurkTrade.getPrice(), btcTurkTrade.getDate(), btcTurkTrade.getTid().toString()); }
java
public static Trade adaptTrade(BTCTurkTrades btcTurkTrade, CurrencyPair currencyPair) { return new Trade( null, btcTurkTrade.getAmount(), currencyPair, btcTurkTrade.getPrice(), btcTurkTrade.getDate(), btcTurkTrade.getTid().toString()); }
[ "public", "static", "Trade", "adaptTrade", "(", "BTCTurkTrades", "btcTurkTrade", ",", "CurrencyPair", "currencyPair", ")", "{", "return", "new", "Trade", "(", "null", ",", "btcTurkTrade", ".", "getAmount", "(", ")", ",", "currencyPair", ",", "btcTurkTrade", ".",...
Adapts a BTCTurkTrade to a Trade Object @param btcTurkTrade The BTCTurkTrade trade @param currencyPair (e.g. BTC/TRY) @return The XChange Trade
[ "Adapts", "a", "BTCTurkTrade", "to", "a", "Trade", "Object" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-btcturk/src/main/java/org/knowm/xchange/btcturk/BTCTurkAdapters.java#L103-L112
nextreports/nextreports-engine
src/ro/nextreports/engine/querybuilder/sql/SelectQuery.java
SelectQuery.appendList
private void appendList(Output out, Collection collection, String separator, boolean areColumns) { Iterator it = collection.iterator(); boolean hasNext = it.hasNext(); //boolean areColumns = (columns == collection); while (hasNext) { Outputable sqlToken = (Outputable) it.next(); hasNext = it.hasNext(); sqlToken.write(out); if (areColumns) { Column column = (Column) sqlToken; String columnAlias = column.getAlias(); if (columnAlias != null) { out.print(" AS "); out.print("\""); out.print(columnAlias); out.print("\""); } } if (hasNext) { out.print(separator); out.println(); } } }
java
private void appendList(Output out, Collection collection, String separator, boolean areColumns) { Iterator it = collection.iterator(); boolean hasNext = it.hasNext(); //boolean areColumns = (columns == collection); while (hasNext) { Outputable sqlToken = (Outputable) it.next(); hasNext = it.hasNext(); sqlToken.write(out); if (areColumns) { Column column = (Column) sqlToken; String columnAlias = column.getAlias(); if (columnAlias != null) { out.print(" AS "); out.print("\""); out.print(columnAlias); out.print("\""); } } if (hasNext) { out.print(separator); out.println(); } } }
[ "private", "void", "appendList", "(", "Output", "out", ",", "Collection", "collection", ",", "String", "separator", ",", "boolean", "areColumns", ")", "{", "Iterator", "it", "=", "collection", ".", "iterator", "(", ")", ";", "boolean", "hasNext", "=", "it", ...
Iterate through a Collection and append all entries (using .toString()) to a StringBuffer.
[ "Iterate", "through", "a", "Collection", "and", "append", "all", "entries", "(", "using", ".", "toString", "()", ")", "to", "a", "StringBuffer", "." ]
train
https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/querybuilder/sql/SelectQuery.java#L671-L695
MTDdk/jawn
jawn-core/src/main/java/net/javapla/jawn/core/util/StringUtil.java
StringUtil.sanitizeForUri
public static String sanitizeForUri(String uri, String replace) { /* * Explanation: * [a-zA-Z0-9\\._-] matches a letter from a-z lower or uppercase, numbers, dots, underscores and hyphen * [^a-zA-Z0-9\\._-] is the inverse. i.e. all characters which do not match the first expression * [^a-zA-Z0-9\\._-]+ is a sequence of characters which do not match the first expression * So every sequence of characters which does not consist of characters from a-z, 0-9 or . _ - will be replaced. */ uri = uri.replaceAll("[^a-zA-Z0-9\\._-]+", replace); return uri; }
java
public static String sanitizeForUri(String uri, String replace) { /* * Explanation: * [a-zA-Z0-9\\._-] matches a letter from a-z lower or uppercase, numbers, dots, underscores and hyphen * [^a-zA-Z0-9\\._-] is the inverse. i.e. all characters which do not match the first expression * [^a-zA-Z0-9\\._-]+ is a sequence of characters which do not match the first expression * So every sequence of characters which does not consist of characters from a-z, 0-9 or . _ - will be replaced. */ uri = uri.replaceAll("[^a-zA-Z0-9\\._-]+", replace); return uri; }
[ "public", "static", "String", "sanitizeForUri", "(", "String", "uri", ",", "String", "replace", ")", "{", "/*\n * Explanation:\n * [a-zA-Z0-9\\\\._-] matches a letter from a-z lower or uppercase, numbers, dots, underscores and hyphen\n * [^a-zA-Z0-9\\\\._-] is the inv...
Sanitizes a URI to conform with the URI standards RFC3986 http://www.ietf.org/rfc/rfc3986.txt. <p> Replaces all the disallowed characters for a correctly formed URI. @param uri The un-sanitized URI @param replace The character to replace the disallowed characters with @return The sanitized input
[ "Sanitizes", "a", "URI", "to", "conform", "with", "the", "URI", "standards", "RFC3986", "http", ":", "//", "www", ".", "ietf", ".", "org", "/", "rfc", "/", "rfc3986", ".", "txt", ".", "<p", ">", "Replaces", "all", "the", "disallowed", "characters", "fo...
train
https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/util/StringUtil.java#L262-L272
classgraph/classgraph
src/main/java/nonapi/io/github/classgraph/fastzipfilereader/NestedJarHandler.java
NestedJarHandler.downloadTempFile
private File downloadTempFile(final String jarURL, final LogNode log) { final LogNode subLog = log == null ? null : log.log(jarURL, "Downloading URL " + jarURL); File tempFile; try { tempFile = makeTempFile(jarURL, /* onlyUseLeafname = */ true); final URL url = new URL(jarURL); try (InputStream inputStream = url.openStream()) { Files.copy(inputStream, tempFile.toPath(), StandardCopyOption.REPLACE_EXISTING); } if (subLog != null) { subLog.addElapsedTime(); } } catch (final IOException | SecurityException e) { if (subLog != null) { subLog.log("Could not download " + jarURL, e); } return null; } if (subLog != null) { subLog.log("Downloaded to temporary file " + tempFile); subLog.log("***** Note that it is time-consuming to scan jars at http(s) addresses, " + "they must be downloaded for every scan, and the same jars must also be " + "separately downloaded by the ClassLoader *****"); } return tempFile; }
java
private File downloadTempFile(final String jarURL, final LogNode log) { final LogNode subLog = log == null ? null : log.log(jarURL, "Downloading URL " + jarURL); File tempFile; try { tempFile = makeTempFile(jarURL, /* onlyUseLeafname = */ true); final URL url = new URL(jarURL); try (InputStream inputStream = url.openStream()) { Files.copy(inputStream, tempFile.toPath(), StandardCopyOption.REPLACE_EXISTING); } if (subLog != null) { subLog.addElapsedTime(); } } catch (final IOException | SecurityException e) { if (subLog != null) { subLog.log("Could not download " + jarURL, e); } return null; } if (subLog != null) { subLog.log("Downloaded to temporary file " + tempFile); subLog.log("***** Note that it is time-consuming to scan jars at http(s) addresses, " + "they must be downloaded for every scan, and the same jars must also be " + "separately downloaded by the ClassLoader *****"); } return tempFile; }
[ "private", "File", "downloadTempFile", "(", "final", "String", "jarURL", ",", "final", "LogNode", "log", ")", "{", "final", "LogNode", "subLog", "=", "log", "==", "null", "?", "null", ":", "log", ".", "log", "(", "jarURL", ",", "\"Downloading URL \"", "+",...
Download a jar from a URL to a temporary file. @param jarURL the jar URL @param log the log @return the temporary file the jar was downloaded to
[ "Download", "a", "jar", "from", "a", "URL", "to", "a", "temporary", "file", "." ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/fastzipfilereader/NestedJarHandler.java#L522-L547
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java
UnitResponse.createError
public static UnitResponse createError(String errCode, Object data, String errMsg) { if (Group.CODE_SUCCESS.equalsIgnoreCase(errCode)) { throw new IllegalArgumentException("Only non-success code is allowed here."); } return new UnitResponse().setCode(errCode).setData(data).setMessage(errMsg); }
java
public static UnitResponse createError(String errCode, Object data, String errMsg) { if (Group.CODE_SUCCESS.equalsIgnoreCase(errCode)) { throw new IllegalArgumentException("Only non-success code is allowed here."); } return new UnitResponse().setCode(errCode).setData(data).setMessage(errMsg); }
[ "public", "static", "UnitResponse", "createError", "(", "String", "errCode", ",", "Object", "data", ",", "String", "errMsg", ")", "{", "if", "(", "Group", ".", "CODE_SUCCESS", ".", "equalsIgnoreCase", "(", "errCode", ")", ")", "{", "throw", "new", "IllegalAr...
create a new error unit response instance. @param errCode the error code. @param data the data, anything you want, can be an exception object too @param errMsg the error message. @return the newly created unit response object.
[ "create", "a", "new", "error", "unit", "response", "instance", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java#L174-L179
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.setSecret
public SecretBundle setSecret(String vaultBaseUrl, String secretName, String value) { return setSecretWithServiceResponseAsync(vaultBaseUrl, secretName, value).toBlocking().single().body(); }
java
public SecretBundle setSecret(String vaultBaseUrl, String secretName, String value) { return setSecretWithServiceResponseAsync(vaultBaseUrl, secretName, value).toBlocking().single().body(); }
[ "public", "SecretBundle", "setSecret", "(", "String", "vaultBaseUrl", ",", "String", "secretName", ",", "String", "value", ")", "{", "return", "setSecretWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "secretName", ",", "value", ")", ".", "toBlocking", "(", "...
Sets a secret in a specified key vault. The SET operation adds a secret to the Azure Key Vault. If the named secret already exists, Azure Key Vault creates a new version of that secret. This operation requires the secrets/set permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param secretName The name of the secret. @param value The value of the secret. @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SecretBundle object if successful.
[ "Sets", "a", "secret", "in", "a", "specified", "key", "vault", ".", "The", "SET", "operation", "adds", "a", "secret", "to", "the", "Azure", "Key", "Vault", ".", "If", "the", "named", "secret", "already", "exists", "Azure", "Key", "Vault", "creates", "a",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L3322-L3324
glyptodon/guacamole-client
extensions/guacamole-auth-duo/src/main/java/org/apache/guacamole/auth/duo/api/DuoCookie.java
DuoCookie.parseDuoCookie
public static DuoCookie parseDuoCookie(String str) throws GuacamoleException { // Attempt to decode data as base64 String data; try { data = new String(BaseEncoding.base64().decode(str), "UTF-8"); } // Bail if invalid base64 is provided catch (IllegalArgumentException e) { throw new GuacamoleClientException("Username is not correctly " + "encoded as base64.", e); } // Throw hard errors if standard pieces of Java are missing catch (UnsupportedEncodingException e) { throw new UnsupportedOperationException("Unexpected lack of " + "UTF-8 support.", e); } // Verify format of provided data Matcher matcher = COOKIE_FORMAT.matcher(data); if (!matcher.matches()) throw new GuacamoleClientException("Format of base64-encoded " + "username is invalid."); // Get username and key (simple strings) String username = matcher.group(USERNAME_GROUP); String key = matcher.group(INTEGRATION_KEY_GROUP); // Parse expiration time long expires; try { expires = Long.parseLong(matcher.group(EXPIRATION_TIMESTAMP_GROUP)); } // Bail if expiration timestamp is not a valid long catch (NumberFormatException e) { throw new GuacamoleClientException("Expiration timestamp is " + "not valid.", e); } // Return parsed cookie return new DuoCookie(username, key, expires); }
java
public static DuoCookie parseDuoCookie(String str) throws GuacamoleException { // Attempt to decode data as base64 String data; try { data = new String(BaseEncoding.base64().decode(str), "UTF-8"); } // Bail if invalid base64 is provided catch (IllegalArgumentException e) { throw new GuacamoleClientException("Username is not correctly " + "encoded as base64.", e); } // Throw hard errors if standard pieces of Java are missing catch (UnsupportedEncodingException e) { throw new UnsupportedOperationException("Unexpected lack of " + "UTF-8 support.", e); } // Verify format of provided data Matcher matcher = COOKIE_FORMAT.matcher(data); if (!matcher.matches()) throw new GuacamoleClientException("Format of base64-encoded " + "username is invalid."); // Get username and key (simple strings) String username = matcher.group(USERNAME_GROUP); String key = matcher.group(INTEGRATION_KEY_GROUP); // Parse expiration time long expires; try { expires = Long.parseLong(matcher.group(EXPIRATION_TIMESTAMP_GROUP)); } // Bail if expiration timestamp is not a valid long catch (NumberFormatException e) { throw new GuacamoleClientException("Expiration timestamp is " + "not valid.", e); } // Return parsed cookie return new DuoCookie(username, key, expires); }
[ "public", "static", "DuoCookie", "parseDuoCookie", "(", "String", "str", ")", "throws", "GuacamoleException", "{", "// Attempt to decode data as base64", "String", "data", ";", "try", "{", "data", "=", "new", "String", "(", "BaseEncoding", ".", "base64", "(", ")",...
Parses a base64-encoded Duo cookie, producing a new DuoCookie object containing the data therein. If the given string is not a valid Duo cookie, an exception is thrown. Note that the cookie may be expired, and must be checked for expiration prior to actual use. @param str The base64-encoded Duo cookie to parse. @return A new DuoCookie object containing the same data as the given base64-encoded Duo cookie string. @throws GuacamoleException If the given string is not a valid base64-encoded Duo cookie.
[ "Parses", "a", "base64", "-", "encoded", "Duo", "cookie", "producing", "a", "new", "DuoCookie", "object", "containing", "the", "data", "therein", ".", "If", "the", "given", "string", "is", "not", "a", "valid", "Duo", "cookie", "an", "exception", "is", "thr...
train
https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/extensions/guacamole-auth-duo/src/main/java/org/apache/guacamole/auth/duo/api/DuoCookie.java#L169-L214
JOML-CI/JOML
src/org/joml/Vector4d.java
Vector4d.rotateAxis
public Vector4d rotateAxis(double angle, double x, double y, double z) { return rotateAxis(angle, x, y, z, thisOrNew()); }
java
public Vector4d rotateAxis(double angle, double x, double y, double z) { return rotateAxis(angle, x, y, z, thisOrNew()); }
[ "public", "Vector4d", "rotateAxis", "(", "double", "angle", ",", "double", "x", ",", "double", "y", ",", "double", "z", ")", "{", "return", "rotateAxis", "(", "angle", ",", "x", ",", "y", ",", "z", ",", "thisOrNew", "(", ")", ")", ";", "}" ]
Rotate this vector the specified radians around the given rotation axis. @param angle the angle in radians @param x the x component of the rotation axis @param y the y component of the rotation axis @param z the z component of the rotation axis @return a vector holding the result
[ "Rotate", "this", "vector", "the", "specified", "radians", "around", "the", "given", "rotation", "axis", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector4d.java#L1146-L1148
lessthanoptimal/BoofCV
integration/boofcv-swing/src/main/java/boofcv/gui/feature/CompareTwoImagePanel.java
CompareTwoImagePanel.setImages
public synchronized void setImages(BufferedImage leftImage , BufferedImage rightImage ) { this.leftImage = leftImage; this.rightImage = rightImage; setPreferredSize(leftImage.getWidth(),leftImage.getHeight(),rightImage.getWidth(),rightImage.getHeight()); }
java
public synchronized void setImages(BufferedImage leftImage , BufferedImage rightImage ) { this.leftImage = leftImage; this.rightImage = rightImage; setPreferredSize(leftImage.getWidth(),leftImage.getHeight(),rightImage.getWidth(),rightImage.getHeight()); }
[ "public", "synchronized", "void", "setImages", "(", "BufferedImage", "leftImage", ",", "BufferedImage", "rightImage", ")", "{", "this", ".", "leftImage", "=", "leftImage", ";", "this", ".", "rightImage", "=", "rightImage", ";", "setPreferredSize", "(", "leftImage"...
Sets the internal images. Not thread safe. @param leftImage @param rightImage
[ "Sets", "the", "internal", "images", ".", "Not", "thread", "safe", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/feature/CompareTwoImagePanel.java#L93-L98
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/util/IOUtils.java
IOUtils.processReader
public static void processReader(BufferedReader br, ReaderProcessor processor) throws ParserException { String line; try { while( (line = br.readLine()) != null ) { processor.process(line); } } catch(IOException e) { throw new ParserException("Could not read from the given BufferedReader"); } finally { close(br); } }
java
public static void processReader(BufferedReader br, ReaderProcessor processor) throws ParserException { String line; try { while( (line = br.readLine()) != null ) { processor.process(line); } } catch(IOException e) { throw new ParserException("Could not read from the given BufferedReader"); } finally { close(br); } }
[ "public", "static", "void", "processReader", "(", "BufferedReader", "br", ",", "ReaderProcessor", "processor", ")", "throws", "ParserException", "{", "String", "line", ";", "try", "{", "while", "(", "(", "line", "=", "br", ".", "readLine", "(", ")", ")", "...
Takes in a reader and a processor, reads every line from the given file and then invokes the processor. What you do with the lines is dependent on your processor. The code will automatically close the given BufferedReader. @param br The reader to process @param processor The processor to invoke on all lines @throws ParserException Can throw this if we cannot parse the given reader
[ "Takes", "in", "a", "reader", "and", "a", "processor", "reads", "every", "line", "from", "the", "given", "file", "and", "then", "invokes", "the", "processor", ".", "What", "you", "do", "with", "the", "lines", "is", "dependent", "on", "your", "processor", ...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/util/IOUtils.java#L90-L103
hawkular/hawkular-inventory
hawkular-inventory-impl-tinkerpop-parent/hawkular-inventory-impl-tinkerpop/src/main/java/org/hawkular/inventory/impl/tinkerpop/TinkerpopBackend.java
TinkerpopBackend.updateProperties
static void updateProperties(Element e, Map<String, Object> properties, String[] disallowedProperties) { if (properties == null) { return; } Set<String> disallowed = new HashSet<>(Arrays.asList(disallowedProperties)); //remove all non-mapped properties, that are not in the update Spliterator<Property<?>> sp = Spliterators.spliteratorUnknownSize(e.properties(), Spliterator.NONNULL & Spliterator.IMMUTABLE); Property<?>[] toRemove = StreamSupport.stream(sp, false) .filter((p) -> !disallowed.contains(p.key()) && !properties.containsKey(p.key())) .toArray(Property[]::new); for (Property<?> p : toRemove) { p.remove(); } //update and add new the properties properties.forEach((p, v) -> { if (!disallowed.contains(p)) { e.property(p, v); } }); }
java
static void updateProperties(Element e, Map<String, Object> properties, String[] disallowedProperties) { if (properties == null) { return; } Set<String> disallowed = new HashSet<>(Arrays.asList(disallowedProperties)); //remove all non-mapped properties, that are not in the update Spliterator<Property<?>> sp = Spliterators.spliteratorUnknownSize(e.properties(), Spliterator.NONNULL & Spliterator.IMMUTABLE); Property<?>[] toRemove = StreamSupport.stream(sp, false) .filter((p) -> !disallowed.contains(p.key()) && !properties.containsKey(p.key())) .toArray(Property[]::new); for (Property<?> p : toRemove) { p.remove(); } //update and add new the properties properties.forEach((p, v) -> { if (!disallowed.contains(p)) { e.property(p, v); } }); }
[ "static", "void", "updateProperties", "(", "Element", "e", ",", "Map", "<", "String", ",", "Object", ">", "properties", ",", "String", "[", "]", "disallowedProperties", ")", "{", "if", "(", "properties", "==", "null", ")", "{", "return", ";", "}", "Set",...
Updates the properties of the element, disregarding any changes of the disallowed properties <p> The list of the disallowed properties will usually come from {@link Constants.Type#getMappedProperties()}. @param e the element to update properties of @param properties the properties to update @param disallowedProperties the list of properties that are not allowed to change.
[ "Updates", "the", "properties", "of", "the", "element", "disregarding", "any", "changes", "of", "the", "disallowed", "properties" ]
train
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-impl-tinkerpop-parent/hawkular-inventory-impl-tinkerpop/src/main/java/org/hawkular/inventory/impl/tinkerpop/TinkerpopBackend.java#L1292-L1316
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java
AbstractMastersListener.throwFailoverMessage
@Override public void throwFailoverMessage(HostAddress failHostAddress, boolean wasMaster, SQLException queryException, boolean reconnected) throws SQLException { String firstPart = "Communications link failure with " + (wasMaster ? "primary" : "secondary") + ((failHostAddress != null) ? " host " + failHostAddress.host + ":" + failHostAddress.port : "") + ". "; String error = ""; if (reconnected) { error += " Driver has reconnect connection"; } else { if (currentConnectionAttempts.get() > urlParser.getOptions().retriesAllDown) { error += " Driver will not try to reconnect (too much failure > " + urlParser .getOptions().retriesAllDown + ")"; } } String message; String sqlState; int vendorCode = 0; Throwable cause = null; if (queryException == null) { message = firstPart + error; sqlState = CONNECTION_EXCEPTION.getSqlState(); } else { message = firstPart + queryException.getMessage() + ". " + error; sqlState = queryException.getSQLState(); vendorCode = queryException.getErrorCode(); cause = queryException.getCause(); } if (sqlState != null && sqlState.startsWith("08")) { if (reconnected) { //change sqlState to "Transaction has been rolled back", to transaction exception, since reconnection has succeed sqlState = "25S03"; } else { throw new SQLNonTransientConnectionException(message, sqlState, vendorCode, cause); } } throw new SQLException(message, sqlState, vendorCode, cause); }
java
@Override public void throwFailoverMessage(HostAddress failHostAddress, boolean wasMaster, SQLException queryException, boolean reconnected) throws SQLException { String firstPart = "Communications link failure with " + (wasMaster ? "primary" : "secondary") + ((failHostAddress != null) ? " host " + failHostAddress.host + ":" + failHostAddress.port : "") + ". "; String error = ""; if (reconnected) { error += " Driver has reconnect connection"; } else { if (currentConnectionAttempts.get() > urlParser.getOptions().retriesAllDown) { error += " Driver will not try to reconnect (too much failure > " + urlParser .getOptions().retriesAllDown + ")"; } } String message; String sqlState; int vendorCode = 0; Throwable cause = null; if (queryException == null) { message = firstPart + error; sqlState = CONNECTION_EXCEPTION.getSqlState(); } else { message = firstPart + queryException.getMessage() + ". " + error; sqlState = queryException.getSQLState(); vendorCode = queryException.getErrorCode(); cause = queryException.getCause(); } if (sqlState != null && sqlState.startsWith("08")) { if (reconnected) { //change sqlState to "Transaction has been rolled back", to transaction exception, since reconnection has succeed sqlState = "25S03"; } else { throw new SQLNonTransientConnectionException(message, sqlState, vendorCode, cause); } } throw new SQLException(message, sqlState, vendorCode, cause); }
[ "@", "Override", "public", "void", "throwFailoverMessage", "(", "HostAddress", "failHostAddress", ",", "boolean", "wasMaster", ",", "SQLException", "queryException", ",", "boolean", "reconnected", ")", "throws", "SQLException", "{", "String", "firstPart", "=", "\"Comm...
Throw a human readable message after a failoverException. @param failHostAddress failedHostAddress @param wasMaster was failed connection master @param queryException internal error @param reconnected connection status @throws SQLException error with failover information
[ "Throw", "a", "human", "readable", "message", "after", "a", "failoverException", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java#L496-L540
mangstadt/biweekly
src/main/java/biweekly/property/DateOrDateTimeProperty.java
DateOrDateTimeProperty.setValue
public void setValue(Date value, boolean hasTime) { setValue((value == null) ? null : new ICalDate(value, hasTime)); }
java
public void setValue(Date value, boolean hasTime) { setValue((value == null) ? null : new ICalDate(value, hasTime)); }
[ "public", "void", "setValue", "(", "Date", "value", ",", "boolean", "hasTime", ")", "{", "setValue", "(", "(", "value", "==", "null", ")", "?", "null", ":", "new", "ICalDate", "(", "value", ",", "hasTime", ")", ")", ";", "}" ]
Sets the date-time value. @param value the date-time value @param hasTime true if the value has a time component, false if it is strictly a date
[ "Sets", "the", "date", "-", "time", "value", "." ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/property/DateOrDateTimeProperty.java#L78-L80
Erudika/para
para-server/src/main/java/com/erudika/para/persistence/AWSDynamoUtils.java
AWSDynamoUtils.createTable
public static boolean createTable(String appid, long readCapacity, long writeCapacity) { if (StringUtils.isBlank(appid)) { return false; } else if (StringUtils.containsWhitespace(appid)) { logger.warn("DynamoDB table name contains whitespace. The name '{}' is invalid.", appid); return false; } else if (existsTable(appid)) { logger.warn("DynamoDB table '{}' already exists.", appid); return false; } try { String table = getTableNameForAppid(appid); getClient().createTable(new CreateTableRequest().withTableName(table). withKeySchema(new KeySchemaElement(Config._KEY, KeyType.HASH)). withSSESpecification(new SSESpecification().withEnabled(ENCRYPTION_AT_REST_ENABLED)). withAttributeDefinitions(new AttributeDefinition(Config._KEY, ScalarAttributeType.S)). withProvisionedThroughput(new ProvisionedThroughput(readCapacity, writeCapacity))); logger.info("Created DynamoDB table '{}'.", table); } catch (Exception e) { logger.error(null, e); return false; } return true; }
java
public static boolean createTable(String appid, long readCapacity, long writeCapacity) { if (StringUtils.isBlank(appid)) { return false; } else if (StringUtils.containsWhitespace(appid)) { logger.warn("DynamoDB table name contains whitespace. The name '{}' is invalid.", appid); return false; } else if (existsTable(appid)) { logger.warn("DynamoDB table '{}' already exists.", appid); return false; } try { String table = getTableNameForAppid(appid); getClient().createTable(new CreateTableRequest().withTableName(table). withKeySchema(new KeySchemaElement(Config._KEY, KeyType.HASH)). withSSESpecification(new SSESpecification().withEnabled(ENCRYPTION_AT_REST_ENABLED)). withAttributeDefinitions(new AttributeDefinition(Config._KEY, ScalarAttributeType.S)). withProvisionedThroughput(new ProvisionedThroughput(readCapacity, writeCapacity))); logger.info("Created DynamoDB table '{}'.", table); } catch (Exception e) { logger.error(null, e); return false; } return true; }
[ "public", "static", "boolean", "createTable", "(", "String", "appid", ",", "long", "readCapacity", ",", "long", "writeCapacity", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "appid", ")", ")", "{", "return", "false", ";", "}", "else", "if", "...
Creates a table in AWS DynamoDB. @param appid name of the {@link com.erudika.para.core.App} @param readCapacity read capacity @param writeCapacity write capacity @return true if created
[ "Creates", "a", "table", "in", "AWS", "DynamoDB", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/persistence/AWSDynamoUtils.java#L179-L202
JM-Lab/utils-java9
src/main/java/kr/jm/utils/HttpRequester.java
HttpRequester.getResponseAsString
public static String getResponseAsString(String uri, Header header) { HttpGet httpGet = new HttpGet(uri); httpGet.setHeader(header); request(httpGet); return request(httpGet); }
java
public static String getResponseAsString(String uri, Header header) { HttpGet httpGet = new HttpGet(uri); httpGet.setHeader(header); request(httpGet); return request(httpGet); }
[ "public", "static", "String", "getResponseAsString", "(", "String", "uri", ",", "Header", "header", ")", "{", "HttpGet", "httpGet", "=", "new", "HttpGet", "(", "uri", ")", ";", "httpGet", ".", "setHeader", "(", "header", ")", ";", "request", "(", "httpGet"...
Gets response as string. @param uri the uri @param header the header @return the response as string
[ "Gets", "response", "as", "string", "." ]
train
https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/HttpRequester.java#L99-L104
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/config/xml/PayloadElementParser.java
PayloadElementParser.parseMessagePayload
public static String parseMessagePayload(Element payloadElement) { if (payloadElement == null) { return ""; } try { Document payload = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); payload.appendChild(payload.importNode(payloadElement, true)); String payloadData = XMLUtils.serialize(payload); // temporary quickfix for unwanted testcase namespace in target payload payloadData = payloadData.replaceAll(" xmlns=\\\"http://www.citrusframework.org/schema/testcase\\\"", ""); return payloadData.trim(); } catch (DOMException e) { throw new CitrusRuntimeException("Error while constructing message payload", e); } catch (ParserConfigurationException e) { throw new CitrusRuntimeException("Error while constructing message payload", e); } }
java
public static String parseMessagePayload(Element payloadElement) { if (payloadElement == null) { return ""; } try { Document payload = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); payload.appendChild(payload.importNode(payloadElement, true)); String payloadData = XMLUtils.serialize(payload); // temporary quickfix for unwanted testcase namespace in target payload payloadData = payloadData.replaceAll(" xmlns=\\\"http://www.citrusframework.org/schema/testcase\\\"", ""); return payloadData.trim(); } catch (DOMException e) { throw new CitrusRuntimeException("Error while constructing message payload", e); } catch (ParserConfigurationException e) { throw new CitrusRuntimeException("Error while constructing message payload", e); } }
[ "public", "static", "String", "parseMessagePayload", "(", "Element", "payloadElement", ")", "{", "if", "(", "payloadElement", "==", "null", ")", "{", "return", "\"\"", ";", "}", "try", "{", "Document", "payload", "=", "DocumentBuilderFactory", ".", "newInstance"...
Static parse method taking care of payload element. @param payloadElement
[ "Static", "parse", "method", "taking", "care", "of", "payload", "element", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/PayloadElementParser.java#L44-L62
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/form/checkbox/CheckGroupSelectorPanel.java
CheckGroupSelectorPanel.newCheckGroupSelector
protected CheckGroupSelector newCheckGroupSelector(final String id, final CheckGroup<T> group) { return ComponentFactory.newCheckGroupSelector(id, group); }
java
protected CheckGroupSelector newCheckGroupSelector(final String id, final CheckGroup<T> group) { return ComponentFactory.newCheckGroupSelector(id, group); }
[ "protected", "CheckGroupSelector", "newCheckGroupSelector", "(", "final", "String", "id", ",", "final", "CheckGroup", "<", "T", ">", "group", ")", "{", "return", "ComponentFactory", ".", "newCheckGroupSelector", "(", "id", ",", "group", ")", ";", "}" ]
Factory method for create a new {@link CheckGroupSelector}. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a new {@link CheckGroupSelector}. @param id the id @param group the {@link CheckGroup} @return the new {@link CheckGroupSelector}
[ "Factory", "method", "for", "create", "a", "new", "{", "@link", "CheckGroupSelector", "}", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "the", "derived", "classes", "and", "can", "be", "overridden", "so", "users", "can", "provi...
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/form/checkbox/CheckGroupSelectorPanel.java#L151-L154
nmdp-bioinformatics/ngs
feature/src/main/java/org/nmdp/ngs/feature/Allele.java
Allele.doubleCrossover
public Allele doubleCrossover(final Allele right) throws IllegalSymbolException, IndexOutOfBoundsException, IllegalAlphabetException { if (this.overlaps(right)) { //System.out.println("this range" + this.toString() + " sequence = " + this.sequence.seqString() + "sequence length = " + sequence.length()); Locus homologue = intersection(right); //System.out.println("homologue = " + homologue); SymbolList copy = DNATools.createDNA(this.sequence.seqString()); int length = homologue.getEnd() - homologue.getStart(); int target = homologue.getStart() - right.getStart() + 1; int from = homologue.getStart() - this.getStart() + 1; //System.out.println("length = " + length); //System.out.println("target = " + target); //System.out.println("from = " + from); //System.out.println("copy = " + copy.seqString()); try { SymbolList replace = right.sequence.subList(target, target + length - 1); //System.out.println("replace = " + replace.seqString()); copy.edit(new Edit(from, length, replace)); } catch(ChangeVetoException e) { //System.out.println("CHANGE VETO EXCEPTON" + e.getMessage()); } //System.out.println("CROSSEDOVER SEQUENCE = " + copy.seqString()); //copy.edit(new Edit()); //Sequence left = this.sequence.subList(0, homologue.getStart()); //Sequence middle = right.sequence.subList(homologue.getStart() - right.getStart(), i1); return new Allele(this.name, this.contig, this.getStart(), this.getEnd(), copy, Lesion.UNKNOWN); } return new Allele(this.name, this.contig, this.getStart(), this.getEnd(), this.sequence, Lesion.UNKNOWN); }
java
public Allele doubleCrossover(final Allele right) throws IllegalSymbolException, IndexOutOfBoundsException, IllegalAlphabetException { if (this.overlaps(right)) { //System.out.println("this range" + this.toString() + " sequence = " + this.sequence.seqString() + "sequence length = " + sequence.length()); Locus homologue = intersection(right); //System.out.println("homologue = " + homologue); SymbolList copy = DNATools.createDNA(this.sequence.seqString()); int length = homologue.getEnd() - homologue.getStart(); int target = homologue.getStart() - right.getStart() + 1; int from = homologue.getStart() - this.getStart() + 1; //System.out.println("length = " + length); //System.out.println("target = " + target); //System.out.println("from = " + from); //System.out.println("copy = " + copy.seqString()); try { SymbolList replace = right.sequence.subList(target, target + length - 1); //System.out.println("replace = " + replace.seqString()); copy.edit(new Edit(from, length, replace)); } catch(ChangeVetoException e) { //System.out.println("CHANGE VETO EXCEPTON" + e.getMessage()); } //System.out.println("CROSSEDOVER SEQUENCE = " + copy.seqString()); //copy.edit(new Edit()); //Sequence left = this.sequence.subList(0, homologue.getStart()); //Sequence middle = right.sequence.subList(homologue.getStart() - right.getStart(), i1); return new Allele(this.name, this.contig, this.getStart(), this.getEnd(), copy, Lesion.UNKNOWN); } return new Allele(this.name, this.contig, this.getStart(), this.getEnd(), this.sequence, Lesion.UNKNOWN); }
[ "public", "Allele", "doubleCrossover", "(", "final", "Allele", "right", ")", "throws", "IllegalSymbolException", ",", "IndexOutOfBoundsException", ",", "IllegalAlphabetException", "{", "if", "(", "this", ".", "overlaps", "(", "right", ")", ")", "{", "//System.out.pr...
A method to simulate double crossover between Allele objects whereby the sequence from one allele is joined to the other within a specific region of overlap. @param right allele @return a new crossed-over allele. This implementation treats the original alleles as immutable thus favoring programmatic convenience over genetic reality. @throws IllegalSymbolException @throws IndexOutOfBoundsException @throws IllegalAlphabetException
[ "A", "method", "to", "simulate", "double", "crossover", "between", "Allele", "objects", "whereby", "the", "sequence", "from", "one", "allele", "is", "joined", "to", "the", "other", "within", "a", "specific", "region", "of", "overlap", "." ]
train
https://github.com/nmdp-bioinformatics/ngs/blob/277627e4311313a80f5dc110b3185b0d7af32bd0/feature/src/main/java/org/nmdp/ngs/feature/Allele.java#L274-L311
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java
VirtualMachinesInner.runCommandAsync
public Observable<RunCommandResultInner> runCommandAsync(String resourceGroupName, String vmName, RunCommandInput parameters) { return runCommandWithServiceResponseAsync(resourceGroupName, vmName, parameters).map(new Func1<ServiceResponse<RunCommandResultInner>, RunCommandResultInner>() { @Override public RunCommandResultInner call(ServiceResponse<RunCommandResultInner> response) { return response.body(); } }); }
java
public Observable<RunCommandResultInner> runCommandAsync(String resourceGroupName, String vmName, RunCommandInput parameters) { return runCommandWithServiceResponseAsync(resourceGroupName, vmName, parameters).map(new Func1<ServiceResponse<RunCommandResultInner>, RunCommandResultInner>() { @Override public RunCommandResultInner call(ServiceResponse<RunCommandResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RunCommandResultInner", ">", "runCommandAsync", "(", "String", "resourceGroupName", ",", "String", "vmName", ",", "RunCommandInput", "parameters", ")", "{", "return", "runCommandWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmNam...
Run command on the VM. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine. @param parameters Parameters supplied to the Run command operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Run", "command", "on", "the", "VM", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java#L2653-L2660
googleads/googleads-java-lib
modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/utils/v201902/DateTimes.java
DateTimes.toStringForTimeZone
public static String toStringForTimeZone(DateTime dateTime, String newZoneId) { return dateTimesHelper.toStringForTimeZone(dateTime, newZoneId); }
java
public static String toStringForTimeZone(DateTime dateTime, String newZoneId) { return dateTimesHelper.toStringForTimeZone(dateTime, newZoneId); }
[ "public", "static", "String", "toStringForTimeZone", "(", "DateTime", "dateTime", ",", "String", "newZoneId", ")", "{", "return", "dateTimesHelper", ".", "toStringForTimeZone", "(", "dateTime", ",", "newZoneId", ")", ";", "}" ]
Returns string representation of this date time with a different time zone, preserving the millisecond instant. <p>This method is useful for finding the local time in another time zone, especially for filtering. <p>For example, if this date time holds 12:30 in Europe/London, the result from this method with Europe/Paris would be 13:30. You may also want to use this with your network's time zone, i.e. <pre><code> String timeZoneId = networkService.getCurrentNetwork().getTimeZone(); String statementPart = "startDateTime > " + DateTimes.toString(apiDateTime, timeZoneId); //... statementBuilder.where(statementPart); </code></pre> This method is in the same style of {@link org.joda.time.DateTime#withZone(org.joda.time.DateTimeZone)}. @param dateTime the date time to stringify into a new time zone @param newZoneId the time zone ID of the new zone @return a string representation of the {@code DateTime} in {@code yyyy-MM-dd'T'HH:mm:ss}
[ "Returns", "string", "representation", "of", "this", "date", "time", "with", "a", "different", "time", "zone", "preserving", "the", "millisecond", "instant", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/utils/v201902/DateTimes.java#L141-L143
alkacon/opencms-core
src/org/opencms/util/CmsFileUtil.java
CmsFileUtil.getEncoding
public static String getEncoding(CmsObject cms, CmsResource file) { CmsProperty encodingProperty = CmsProperty.getNullProperty(); try { encodingProperty = cms.readPropertyObject(file, CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING, true); } catch (CmsException e) { LOG.debug(e.getLocalizedMessage(), e); } return CmsEncoder.lookupEncoding(encodingProperty.getValue(""), OpenCms.getSystemInfo().getDefaultEncoding()); }
java
public static String getEncoding(CmsObject cms, CmsResource file) { CmsProperty encodingProperty = CmsProperty.getNullProperty(); try { encodingProperty = cms.readPropertyObject(file, CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING, true); } catch (CmsException e) { LOG.debug(e.getLocalizedMessage(), e); } return CmsEncoder.lookupEncoding(encodingProperty.getValue(""), OpenCms.getSystemInfo().getDefaultEncoding()); }
[ "public", "static", "String", "getEncoding", "(", "CmsObject", "cms", ",", "CmsResource", "file", ")", "{", "CmsProperty", "encodingProperty", "=", "CmsProperty", ".", "getNullProperty", "(", ")", ";", "try", "{", "encodingProperty", "=", "cms", ".", "readProper...
Returns the encoding of the file. Encoding is read from the content-encoding property and defaults to the systems default encoding. Since properties can change without rewriting content, the actual encoding can differ. @param cms {@link CmsObject} used to read properties of the given file. @param file the file for which the encoding is requested @return the file's encoding according to the content-encoding property, or the system's default encoding as default.
[ "Returns", "the", "encoding", "of", "the", "file", ".", "Encoding", "is", "read", "from", "the", "content", "-", "encoding", "property", "and", "defaults", "to", "the", "systems", "default", "encoding", ".", "Since", "properties", "can", "change", "without", ...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsFileUtil.java#L293-L302
apache/incubator-druid
server/src/main/java/org/apache/druid/discovery/DruidLeaderClient.java
DruidLeaderClient.makeRequest
public Request makeRequest(HttpMethod httpMethod, String urlPath) throws IOException { return makeRequest(httpMethod, urlPath, true); }
java
public Request makeRequest(HttpMethod httpMethod, String urlPath) throws IOException { return makeRequest(httpMethod, urlPath, true); }
[ "public", "Request", "makeRequest", "(", "HttpMethod", "httpMethod", ",", "String", "urlPath", ")", "throws", "IOException", "{", "return", "makeRequest", "(", "httpMethod", ",", "urlPath", ",", "true", ")", ";", "}" ]
Make a Request object aimed at the leader. Throws IOException if the leader cannot be located.
[ "Make", "a", "Request", "object", "aimed", "at", "the", "leader", ".", "Throws", "IOException", "if", "the", "leader", "cannot", "be", "located", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/discovery/DruidLeaderClient.java#L137-L140
elki-project/elki
elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/intrinsic/ISOS.java
ISOS.estimateID
protected double estimateID(DBIDRef ignore, DoubleDBIDListIter it, double[] p) { int j = 0; for(it.seek(0); it.valid(); it.advance()) { if(it.doubleValue() == 0. || DBIDUtil.equal(ignore, it)) { continue; } p[j++] = it.doubleValue(); } if(j < 2) { throw new ArithmeticException("Too little data to estimate ID."); } return estimator.estimate(p, j); }
java
protected double estimateID(DBIDRef ignore, DoubleDBIDListIter it, double[] p) { int j = 0; for(it.seek(0); it.valid(); it.advance()) { if(it.doubleValue() == 0. || DBIDUtil.equal(ignore, it)) { continue; } p[j++] = it.doubleValue(); } if(j < 2) { throw new ArithmeticException("Too little data to estimate ID."); } return estimator.estimate(p, j); }
[ "protected", "double", "estimateID", "(", "DBIDRef", "ignore", ",", "DoubleDBIDListIter", "it", ",", "double", "[", "]", "p", ")", "{", "int", "j", "=", "0", ";", "for", "(", "it", ".", "seek", "(", "0", ")", ";", "it", ".", "valid", "(", ")", ";...
Estimate the local intrinsic dimensionality. @param ignore Object to ignore @param it Iterator @param p Scratch array @return ID estimate
[ "Estimate", "the", "local", "intrinsic", "dimensionality", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/intrinsic/ISOS.java#L194-L206
netceteragroup/trema-core
src/main/java/com/netcetera/trema/core/XMLDatabase.java
XMLDatabase.fireTextNodesRemoved
protected void fireTextNodesRemoved(ITextNode[] textNodes, int index) { for (IDatabaseListener iDatabaseListener : listeners) { iDatabaseListener.textNodesRemoved(this, textNodes, index); } }
java
protected void fireTextNodesRemoved(ITextNode[] textNodes, int index) { for (IDatabaseListener iDatabaseListener : listeners) { iDatabaseListener.textNodesRemoved(this, textNodes, index); } }
[ "protected", "void", "fireTextNodesRemoved", "(", "ITextNode", "[", "]", "textNodes", ",", "int", "index", ")", "{", "for", "(", "IDatabaseListener", "iDatabaseListener", ":", "listeners", ")", "{", "iDatabaseListener", ".", "textNodesRemoved", "(", "this", ",", ...
Notifies the registered listeners that some text nodes have been removed. @param textNodes the text nodes that have been removed @param index the position of the topmost text node that has been removed
[ "Notifies", "the", "registered", "listeners", "that", "some", "text", "nodes", "have", "been", "removed", "." ]
train
https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/core/XMLDatabase.java#L572-L576