repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
DDTH/ddth-kafka
src/main/java/com/github/ddth/kafka/KafkaClient.java
KafkaClient.sendMessageRaw
public Future<RecordMetadata> sendMessageRaw(KafkaMessage message, Callback callback) { return sendMessageRaw(DEFAULT_PRODUCER_TYPE, message, callback); }
java
public Future<RecordMetadata> sendMessageRaw(KafkaMessage message, Callback callback) { return sendMessageRaw(DEFAULT_PRODUCER_TYPE, message, callback); }
[ "public", "Future", "<", "RecordMetadata", ">", "sendMessageRaw", "(", "KafkaMessage", "message", ",", "Callback", "callback", ")", "{", "return", "sendMessageRaw", "(", "DEFAULT_PRODUCER_TYPE", ",", "message", ",", "callback", ")", ";", "}" ]
Sends a message asynchronously, with default {@link ProducerType}. <p> This methods returns the underlying Kafka producer's output directly to caller, not converting {@link RecordMetadata} to {@link KafkaMessage}. </p> @param message @param callback @return @since 1.3.1
[ "Sends", "a", "message", "asynchronously", "with", "default", "{", "@link", "ProducerType", "}", "." ]
train
https://github.com/DDTH/ddth-kafka/blob/aaeb8536e28a109ac0b69022f0ea4bbf5696b76f/src/main/java/com/github/ddth/kafka/KafkaClient.java#L779-L781
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ClassUtils.java
ClassUtils.resolveMethod
public static Method resolveMethod(Class<?> type, String methodName, Class<?>[] parameterTypes, Object[] arguments, Class<?> returnType) { try { return getMethod(type, methodName, parameterTypes); } catch (MethodNotFoundException cause) { Method method = findMethod(type, methodName, arguments); Assert.notNull(method, new MethodNotFoundException(String.format( "Failed to resolve method with signature [%1$s] on class type [%2$s]", getMethodSignature(methodName, parameterTypes, returnType), getName(type)), cause.getCause())); return method; } }
java
public static Method resolveMethod(Class<?> type, String methodName, Class<?>[] parameterTypes, Object[] arguments, Class<?> returnType) { try { return getMethod(type, methodName, parameterTypes); } catch (MethodNotFoundException cause) { Method method = findMethod(type, methodName, arguments); Assert.notNull(method, new MethodNotFoundException(String.format( "Failed to resolve method with signature [%1$s] on class type [%2$s]", getMethodSignature(methodName, parameterTypes, returnType), getName(type)), cause.getCause())); return method; } }
[ "public", "static", "Method", "resolveMethod", "(", "Class", "<", "?", ">", "type", ",", "String", "methodName", ",", "Class", "<", "?", ">", "[", "]", "parameterTypes", ",", "Object", "[", "]", "arguments", ",", "Class", "<", "?", ">", "returnType", "...
Attempts to resolve the method with the specified name and signature on the given class type. The named method's resolution is first attempted by using the specified method's name along with the array of parameter types. If unsuccessful, the method proceeds to lookup the named method by searching all "declared" methods of the class type having a signature compatible with the given argument types. This method operates recursively until the method is resolved or the class type hierarchy is exhausted, in which case, a MethodNotFoundException is thrown. @param type the Class type on which to resolve the method. @param methodName a String indicating the name of the method to resolve. @param parameterTypes an array of Class objects used to resolve the exact signature of the method. @param arguments an array of Objects used in a method invocation serving as a fallback search/lookup strategy if the method cannot be resolved using it's parameter types. Maybe null. @param returnType the declared class type of the method's return value (used only for Exception message purposes). @return the resolved method from the given class type given the name, parameter types (signature) and calling arguments, if any. @throws MethodNotFoundException if the specified method cannot be resolved on the given class type. @throws NullPointerException if the class type is null. @see #getMethod(Class, String, Class[]) @see #findMethod(Class, String, Object...) @see java.lang.Class @see java.lang.reflect.Method
[ "Attempts", "to", "resolve", "the", "method", "with", "the", "specified", "name", "and", "signature", "on", "the", "given", "class", "type", ".", "The", "named", "method", "s", "resolution", "is", "first", "attempted", "by", "using", "the", "specified", "met...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L411-L427
MenoData/Time4J
base/src/main/java/net/time4j/history/EraPreference.java
EraPreference.abUrbeConditaBetween
public static EraPreference abUrbeConditaBetween( PlainDate start, PlainDate end ) { return new EraPreference(HistoricEra.AB_URBE_CONDITA, start, end); }
java
public static EraPreference abUrbeConditaBetween( PlainDate start, PlainDate end ) { return new EraPreference(HistoricEra.AB_URBE_CONDITA, start, end); }
[ "public", "static", "EraPreference", "abUrbeConditaBetween", "(", "PlainDate", "start", ",", "PlainDate", "end", ")", "{", "return", "new", "EraPreference", "(", "HistoricEra", ".", "AB_URBE_CONDITA", ",", "start", ",", "end", ")", ";", "}" ]
/*[deutsch] <p>Legt fest, da&szlig; die &Auml;ra Ab Urbe Condita innerhalb der angegebenen Datumsspanne bevorzugt wird. </p> @param start first date when the era A.U.C. shall be used (inclusive) @param end last date when the era A.U.C. shall be used (inclusive) @return EraPreference @see HistoricEra#AB_URBE_CONDITA @since 3.14/4.11
[ "/", "*", "[", "deutsch", "]", "<p", ">", "Legt", "fest", "da&szlig", ";", "die", "&Auml", ";", "ra", "Ab", "Urbe", "Condita", "innerhalb", "der", "angegebenen", "Datumsspanne", "bevorzugt", "wird", ".", "<", "/", "p", ">" ]
train
https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/history/EraPreference.java#L255-L262
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java
SerializedFormBuilder.buildSerializableMethods
public void buildSerializableMethods(XMLNode node, Content classContentTree) { Content serializableMethodTree = methodWriter.getSerializableMethodsHeader(); MemberDoc[] members = currentClass.serializationMethods(); int membersLength = members.length; if (membersLength > 0) { for (int i = 0; i < membersLength; i++) { currentMember = members[i]; Content methodsContentTree = methodWriter.getMethodsContentHeader( (i == membersLength - 1)); buildChildren(node, methodsContentTree); serializableMethodTree.addContent(methodsContentTree); } } if (currentClass.serializationMethods().length > 0) { classContentTree.addContent(methodWriter.getSerializableMethods( configuration.getText("doclet.Serialized_Form_methods"), serializableMethodTree)); if (currentClass.isSerializable() && !currentClass.isExternalizable()) { if (currentClass.serializationMethods().length == 0) { Content noCustomizationMsg = methodWriter.getNoCustomizationMsg( configuration.getText( "doclet.Serializable_no_customization")); classContentTree.addContent(methodWriter.getSerializableMethods( configuration.getText("doclet.Serialized_Form_methods"), noCustomizationMsg)); } } } }
java
public void buildSerializableMethods(XMLNode node, Content classContentTree) { Content serializableMethodTree = methodWriter.getSerializableMethodsHeader(); MemberDoc[] members = currentClass.serializationMethods(); int membersLength = members.length; if (membersLength > 0) { for (int i = 0; i < membersLength; i++) { currentMember = members[i]; Content methodsContentTree = methodWriter.getMethodsContentHeader( (i == membersLength - 1)); buildChildren(node, methodsContentTree); serializableMethodTree.addContent(methodsContentTree); } } if (currentClass.serializationMethods().length > 0) { classContentTree.addContent(methodWriter.getSerializableMethods( configuration.getText("doclet.Serialized_Form_methods"), serializableMethodTree)); if (currentClass.isSerializable() && !currentClass.isExternalizable()) { if (currentClass.serializationMethods().length == 0) { Content noCustomizationMsg = methodWriter.getNoCustomizationMsg( configuration.getText( "doclet.Serializable_no_customization")); classContentTree.addContent(methodWriter.getSerializableMethods( configuration.getText("doclet.Serialized_Form_methods"), noCustomizationMsg)); } } } }
[ "public", "void", "buildSerializableMethods", "(", "XMLNode", "node", ",", "Content", "classContentTree", ")", "{", "Content", "serializableMethodTree", "=", "methodWriter", ".", "getSerializableMethodsHeader", "(", ")", ";", "MemberDoc", "[", "]", "members", "=", "...
Build the summaries for the methods that belong to the given class. @param node the XML element that specifies which components to document @param classContentTree content tree to which the documentation will be added
[ "Build", "the", "summaries", "for", "the", "methods", "that", "belong", "to", "the", "given", "class", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java#L272-L300
gotev/android-upload-service
uploadservice/src/main/java/net/gotev/uploadservice/HttpUploadRequest.java
HttpUploadRequest.addParameter
public B addParameter(final String paramName, final String paramValue) { httpParams.addParameter(paramName, paramValue); return self(); }
java
public B addParameter(final String paramName, final String paramValue) { httpParams.addParameter(paramName, paramValue); return self(); }
[ "public", "B", "addParameter", "(", "final", "String", "paramName", ",", "final", "String", "paramValue", ")", "{", "httpParams", ".", "addParameter", "(", "paramName", ",", "paramValue", ")", ";", "return", "self", "(", ")", ";", "}" ]
Adds a parameter to this upload request. @param paramName parameter name @param paramValue parameter value @return self instance
[ "Adds", "a", "parameter", "to", "this", "upload", "request", "." ]
train
https://github.com/gotev/android-upload-service/blob/0952fcbe4b32c100150ffd0a237de3be4942e0a8/uploadservice/src/main/java/net/gotev/uploadservice/HttpUploadRequest.java#L85-L88
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/io/IOUtils.java
IOUtils.slurpFile
public static String slurpFile(String filename, String encoding) throws IOException { Reader r = new InputStreamReader(new FileInputStream(filename), encoding); return IOUtils.slurpReader(r); }
java
public static String slurpFile(String filename, String encoding) throws IOException { Reader r = new InputStreamReader(new FileInputStream(filename), encoding); return IOUtils.slurpReader(r); }
[ "public", "static", "String", "slurpFile", "(", "String", "filename", ",", "String", "encoding", ")", "throws", "IOException", "{", "Reader", "r", "=", "new", "InputStreamReader", "(", "new", "FileInputStream", "(", "filename", ")", ",", "encoding", ")", ";", ...
Returns all the text in the given file with the given encoding.
[ "Returns", "all", "the", "text", "in", "the", "given", "file", "with", "the", "given", "encoding", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/io/IOUtils.java#L726-L730
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/json/JsonObject.java
JsonObject.getDouble
public double getDouble(String name, double defaultValue) { JsonValue value = get(name); return value != null ? value.asDouble() : defaultValue; }
java
public double getDouble(String name, double defaultValue) { JsonValue value = get(name); return value != null ? value.asDouble() : defaultValue; }
[ "public", "double", "getDouble", "(", "String", "name", ",", "double", "defaultValue", ")", "{", "JsonValue", "value", "=", "get", "(", "name", ")", ";", "return", "value", "!=", "null", "?", "value", ".", "asDouble", "(", ")", ":", "defaultValue", ";", ...
Returns the <code>double</code> value of the member with the specified name in this object. If this object does not contain a member with this name, the given default value is returned. If this object contains multiple members with the given name, the last one will be picked. If this member's value does not represent a JSON number or if it cannot be interpreted as Java <code>double</code>, an exception is thrown. @param name the name of the member whose value is to be returned @param defaultValue the value to be returned if the requested member is missing @return the value of the last member with the specified name, or the given default value if this object does not contain a member with that name
[ "Returns", "the", "<code", ">", "double<", "/", "code", ">", "value", "of", "the", "member", "with", "the", "specified", "name", "in", "this", "object", ".", "If", "this", "object", "does", "not", "contain", "a", "member", "with", "this", "name", "the", ...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/json/JsonObject.java#L638-L641
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java
HttpChannelConfig.parseDoNotAllowDuplicateSetCookies
private void parseDoNotAllowDuplicateSetCookies(Map<?, ?> props) { //PI31734 - prevent multiple Set-Cookies with the same name String value = (String) props.get(HttpConfigConstants.PROPNAME_DO_NOT_ALLOW_DUPLICATE_SET_COOKIES); if (null != value) { this.doNotAllowDuplicateSetCookies = convertBoolean(value); if ((TraceComponent.isAnyTracingEnabled()) && (tc.isEventEnabled())) { Tr.event(tc, "Config: DoNotAllowDuplicateSetCookies is " + doNotAllowDuplicateSetCookies()); } } }
java
private void parseDoNotAllowDuplicateSetCookies(Map<?, ?> props) { //PI31734 - prevent multiple Set-Cookies with the same name String value = (String) props.get(HttpConfigConstants.PROPNAME_DO_NOT_ALLOW_DUPLICATE_SET_COOKIES); if (null != value) { this.doNotAllowDuplicateSetCookies = convertBoolean(value); if ((TraceComponent.isAnyTracingEnabled()) && (tc.isEventEnabled())) { Tr.event(tc, "Config: DoNotAllowDuplicateSetCookies is " + doNotAllowDuplicateSetCookies()); } } }
[ "private", "void", "parseDoNotAllowDuplicateSetCookies", "(", "Map", "<", "?", ",", "?", ">", "props", ")", "{", "//PI31734 - prevent multiple Set-Cookies with the same name", "String", "value", "=", "(", "String", ")", "props", ".", "get", "(", "HttpConfigConstants",...
Check the configuration map for the property to tell us if we should prevent multiple set-cookies with the same name @ param props
[ "Check", "the", "configuration", "map", "for", "the", "property", "to", "tell", "us", "if", "we", "should", "prevent", "multiple", "set", "-", "cookies", "with", "the", "same", "name" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L1245-L1254
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java
OdsElements.flushRows
public void flushRows(final XMLUtil util, final ZipUTF8Writer writer) throws IOException { this.contentElement.flushRows(util, writer, this.settingsElement); }
java
public void flushRows(final XMLUtil util, final ZipUTF8Writer writer) throws IOException { this.contentElement.flushRows(util, writer, this.settingsElement); }
[ "public", "void", "flushRows", "(", "final", "XMLUtil", "util", ",", "final", "ZipUTF8Writer", "writer", ")", "throws", "IOException", "{", "this", ".", "contentElement", ".", "flushRows", "(", "util", ",", "writer", ",", "this", ".", "settingsElement", ")", ...
Flush the rows @param util the util @param writer the stream to write @throws IOException when write fails
[ "Flush", "the", "rows" ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java#L269-L271
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/Configurer.java
Configurer.getBooleanDefault
public final boolean getBooleanDefault(boolean defaultValue, String attribute, String... path) { return Boolean.parseBoolean(getNodeStringDefault(String.valueOf(defaultValue), attribute, path)); }
java
public final boolean getBooleanDefault(boolean defaultValue, String attribute, String... path) { return Boolean.parseBoolean(getNodeStringDefault(String.valueOf(defaultValue), attribute, path)); }
[ "public", "final", "boolean", "getBooleanDefault", "(", "boolean", "defaultValue", ",", "String", "attribute", ",", "String", "...", "path", ")", "{", "return", "Boolean", ".", "parseBoolean", "(", "getNodeStringDefault", "(", "String", ".", "valueOf", "(", "def...
Get a boolean in the xml tree. @param defaultValue Value used if node does not exist. @param attribute The attribute to get as boolean. @param path The node path (child list) @return The boolean value. @throws LionEngineException If unable to read node.
[ "Get", "a", "boolean", "in", "the", "xml", "tree", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/Configurer.java#L199-L202
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/util/FutureUtil.java
FutureUtil.logAllExceptions
@PrivateApi public static ExceptionHandler logAllExceptions(final ILogger logger, final Level level) { if (logger.isLoggable(level)) { return new ExceptionHandler() { @Override public void handleException(Throwable throwable) { logger.log(level, "Exception occurred", throwable); } }; } return IGNORE_ALL_EXCEPTIONS; }
java
@PrivateApi public static ExceptionHandler logAllExceptions(final ILogger logger, final Level level) { if (logger.isLoggable(level)) { return new ExceptionHandler() { @Override public void handleException(Throwable throwable) { logger.log(level, "Exception occurred", throwable); } }; } return IGNORE_ALL_EXCEPTIONS; }
[ "@", "PrivateApi", "public", "static", "ExceptionHandler", "logAllExceptions", "(", "final", "ILogger", "logger", ",", "final", "Level", "level", ")", "{", "if", "(", "logger", ".", "isLoggable", "(", "level", ")", ")", "{", "return", "new", "ExceptionHandler"...
This ExceptionHandler rethrows {@link java.util.concurrent.ExecutionException}s and logs {@link com.hazelcast.core.MemberLeftException}s to the log. @param logger the ILogger instance to be used for logging @param level the log level to be used for logging
[ "This", "ExceptionHandler", "rethrows", "{", "@link", "java", ".", "util", ".", "concurrent", ".", "ExecutionException", "}", "s", "and", "logs", "{", "@link", "com", ".", "hazelcast", ".", "core", ".", "MemberLeftException", "}", "s", "to", "the", "log", ...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/FutureUtil.java#L198-L209
relayrides/pushy
pushy/src/main/java/com/turo/pushy/apns/util/ApnsPayloadBuilder.java
ApnsPayloadBuilder.setLocalizedAlertMessage
public ApnsPayloadBuilder setLocalizedAlertMessage(final String localizedAlertKey, final String... alertArguments) { this.localizedAlertKey = localizedAlertKey; this.localizedAlertArguments = (alertArguments != null && alertArguments.length > 0) ? alertArguments : null; this.alertBody = null; return this; }
java
public ApnsPayloadBuilder setLocalizedAlertMessage(final String localizedAlertKey, final String... alertArguments) { this.localizedAlertKey = localizedAlertKey; this.localizedAlertArguments = (alertArguments != null && alertArguments.length > 0) ? alertArguments : null; this.alertBody = null; return this; }
[ "public", "ApnsPayloadBuilder", "setLocalizedAlertMessage", "(", "final", "String", "localizedAlertKey", ",", "final", "String", "...", "alertArguments", ")", "{", "this", ".", "localizedAlertKey", "=", "localizedAlertKey", ";", "this", ".", "localizedAlertArguments", "...
<p>Sets the key of a message in the receiving app's localized string list to be shown for the push notification. The message in the app's string list may optionally have placeholders, which will be populated by values from the given {@code alertArguments}. Clears any previously-set literal alert body.</p> <p>By default, no message is shown.</p> @param localizedAlertKey a key to a string in the receiving app's localized string list @param alertArguments arguments to populate placeholders in the localized alert string; may be {@code null} @return a reference to this payload builder @see ApnsPayloadBuilder#setAlertBody(String)
[ "<p", ">", "Sets", "the", "key", "of", "a", "message", "in", "the", "receiving", "app", "s", "localized", "string", "list", "to", "be", "shown", "for", "the", "push", "notification", ".", "The", "message", "in", "the", "app", "s", "string", "list", "ma...
train
https://github.com/relayrides/pushy/blob/1f6f9a0e07d785c815d74c2320a8d87c80231d36/pushy/src/main/java/com/turo/pushy/apns/util/ApnsPayloadBuilder.java#L192-L199
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java
XML.checksAttributesExistence
private XML checksAttributesExistence(Class<?> aClass,Attribute[] attributes){ String[] attributesNames = new String[attributes.length]; for (int i = attributes.length; i --> 0;) attributesNames[i] = attributes[i].getName(); checksAttributesExistence(aClass,attributesNames); return this; }
java
private XML checksAttributesExistence(Class<?> aClass,Attribute[] attributes){ String[] attributesNames = new String[attributes.length]; for (int i = attributes.length; i --> 0;) attributesNames[i] = attributes[i].getName(); checksAttributesExistence(aClass,attributesNames); return this; }
[ "private", "XML", "checksAttributesExistence", "(", "Class", "<", "?", ">", "aClass", ",", "Attribute", "[", "]", "attributes", ")", "{", "String", "[", "]", "attributesNames", "=", "new", "String", "[", "attributes", ".", "length", "]", ";", "for", "(", ...
Verifies that the attributes exist in aClass. @param aClass Class to check @param attributes attributes to check @return this instance of XML
[ "Verifies", "that", "the", "attributes", "exist", "in", "aClass", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java#L407-L414
drinkjava2/jBeanBox
jbeanbox/src/main/java/com/github/drinkjava2/jbeanbox/BeanBoxUtils.java
BeanBoxUtils.getUniqueBeanBox
public static BeanBox getUniqueBeanBox(BeanBoxContext ctx, Class<?> clazz) { BeanBoxException.assureNotNull(clazz, "Target class can not be null"); BeanBox box = ctx.beanBoxMetaCache.get(clazz); if (box != null) return box; if (BeanBox.class.isAssignableFrom(clazz)) try { box = (BeanBox) clazz.newInstance(); if (box.singleton == null) box.singleton = true; } catch (Exception e) { BeanBoxException.throwEX(e); } else box = doCreateBeanBox(ctx, clazz); ctx.beanBoxMetaCache.put(clazz, box); return box; }
java
public static BeanBox getUniqueBeanBox(BeanBoxContext ctx, Class<?> clazz) { BeanBoxException.assureNotNull(clazz, "Target class can not be null"); BeanBox box = ctx.beanBoxMetaCache.get(clazz); if (box != null) return box; if (BeanBox.class.isAssignableFrom(clazz)) try { box = (BeanBox) clazz.newInstance(); if (box.singleton == null) box.singleton = true; } catch (Exception e) { BeanBoxException.throwEX(e); } else box = doCreateBeanBox(ctx, clazz); ctx.beanBoxMetaCache.put(clazz, box); return box; }
[ "public", "static", "BeanBox", "getUniqueBeanBox", "(", "BeanBoxContext", "ctx", ",", "Class", "<", "?", ">", "clazz", ")", "{", "BeanBoxException", ".", "assureNotNull", "(", "clazz", ",", "\"Target class can not be null\"", ")", ";", "BeanBox", "box", "=", "ct...
Translate a BeanBox class or normal class to a readOnly BeanBox instance
[ "Translate", "a", "BeanBox", "class", "or", "normal", "class", "to", "a", "readOnly", "BeanBox", "instance" ]
train
https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/jbeanbox/BeanBoxUtils.java#L45-L62
jpush/jmessage-api-java-client
src/main/java/cn/jmessage/api/JMessageClient.java
JMessageClient.addChatRoomMember
public ResponseWrapper addChatRoomMember(long roomId, Members members) throws APIConnectionException, APIRequestException { return _chatRoomClient.addChatRoomMember(roomId, members); }
java
public ResponseWrapper addChatRoomMember(long roomId, Members members) throws APIConnectionException, APIRequestException { return _chatRoomClient.addChatRoomMember(roomId, members); }
[ "public", "ResponseWrapper", "addChatRoomMember", "(", "long", "roomId", ",", "Members", "members", ")", "throws", "APIConnectionException", ",", "APIRequestException", "{", "return", "_chatRoomClient", ".", "addChatRoomMember", "(", "roomId", ",", "members", ")", ";"...
Add members to chat room @param roomId chat room id @param members {@link Members} @return No content @throws APIConnectionException connect exception @throws APIRequestException request exception
[ "Add", "members", "to", "chat", "room" ]
train
https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L904-L907
landawn/AbacusUtil
src/com/landawn/abacus/util/Array.java
Array.bucketSort
static <T extends Comparable<T>> void bucketSort(final List<T> c, final int fromIndex, final int toIndex) { bucketSort(c, fromIndex, toIndex, null); }
java
static <T extends Comparable<T>> void bucketSort(final List<T> c, final int fromIndex, final int toIndex) { bucketSort(c, fromIndex, toIndex, null); }
[ "static", "<", "T", "extends", "Comparable", "<", "T", ">", ">", "void", "bucketSort", "(", "final", "List", "<", "T", ">", "c", ",", "final", "int", "fromIndex", ",", "final", "int", "toIndex", ")", "{", "bucketSort", "(", "c", ",", "fromIndex", ","...
Note: All the objects with same value will be replaced with first element with the same value. @param c @param fromIndex @param toIndex
[ "Note", ":", "All", "the", "objects", "with", "same", "value", "will", "be", "replaced", "with", "first", "element", "with", "the", "same", "value", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Array.java#L3161-L3163
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java
DynamoDBMapper.batchLoad
public Map<String, List<Object>> batchLoad(Map<Class<?>, List<KeyPair>> itemsToGet) { return batchLoad(itemsToGet, this.config); }
java
public Map<String, List<Object>> batchLoad(Map<Class<?>, List<KeyPair>> itemsToGet) { return batchLoad(itemsToGet, this.config); }
[ "public", "Map", "<", "String", ",", "List", "<", "Object", ">", ">", "batchLoad", "(", "Map", "<", "Class", "<", "?", ">", ",", "List", "<", "KeyPair", ">", ">", "itemsToGet", ")", "{", "return", "batchLoad", "(", "itemsToGet", ",", "this", ".", "...
Retrieves the attributes for multiple items from multiple tables using their primary keys. {@link AmazonDynamoDB#batchGetItem(BatchGetItemRequest)} API. @see #batchLoad(Map, DynamoDBMapperConfig)
[ "Retrieves", "the", "attributes", "for", "multiple", "items", "from", "multiple", "tables", "using", "their", "primary", "keys", ".", "{", "@link", "AmazonDynamoDB#batchGetItem", "(", "BatchGetItemRequest", ")", "}", "API", "." ]
train
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java#L827-L829
opendatatrentino/s-match
src/main/java/it/unitn/disi/common/utils/ClassFactory.java
ClassFactory.stringToClasses
public static List<Object> stringToClasses(String str, String separator) { ArrayList<Object> tmp = new ArrayList<Object>(); StringTokenizer stringTokenizer = new StringTokenizer(str, separator); while (stringTokenizer.hasMoreTokens()) { Object obj = getClassForName(stringTokenizer.nextToken()); if (obj != null) { tmp.add(obj); } } return tmp; }
java
public static List<Object> stringToClasses(String str, String separator) { ArrayList<Object> tmp = new ArrayList<Object>(); StringTokenizer stringTokenizer = new StringTokenizer(str, separator); while (stringTokenizer.hasMoreTokens()) { Object obj = getClassForName(stringTokenizer.nextToken()); if (obj != null) { tmp.add(obj); } } return tmp; }
[ "public", "static", "List", "<", "Object", ">", "stringToClasses", "(", "String", "str", ",", "String", "separator", ")", "{", "ArrayList", "<", "Object", ">", "tmp", "=", "new", "ArrayList", "<", "Object", ">", "(", ")", ";", "StringTokenizer", "stringTok...
Parses a string of class names separated by separator into a list of objects. @param str names of classes @param separator separator characters @return ArrayList of class instances
[ "Parses", "a", "string", "of", "class", "names", "separated", "by", "separator", "into", "a", "list", "of", "objects", "." ]
train
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/common/utils/ClassFactory.java#L107-L117
phax/ph-xmldsig
src/main/java/com/helger/xmldsig/keyselect/AbstractKeySelector.java
AbstractKeySelector.algorithmEquals
public static boolean algorithmEquals (@Nonnull final String sAlgURI, @Nonnull final String sAlgName) { if (sAlgName.equalsIgnoreCase ("DSA")) { return sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_DSA) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_DSA_SHA256); } if (sAlgName.equalsIgnoreCase ("RSA")) { return sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1_MGF1) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA224) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA224_MGF1) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA256) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA256_MGF1) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA384) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA384_MGF1) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA512) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA512_MGF1) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA3_224_MGF1) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA3_256_MGF1) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA3_384_MGF1) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA3_512_MGF1); } if (sAlgName.equalsIgnoreCase ("EC")) { return sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_ECDSA_RIPEMD160) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA1) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA224) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA256) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA384) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA512); } LOGGER.warn ("Algorithm mismatch between JCA/JCE public key algorithm name ('" + sAlgName + "') and signature algorithm URI ('" + sAlgURI + "')"); return false; }
java
public static boolean algorithmEquals (@Nonnull final String sAlgURI, @Nonnull final String sAlgName) { if (sAlgName.equalsIgnoreCase ("DSA")) { return sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_DSA) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_DSA_SHA256); } if (sAlgName.equalsIgnoreCase ("RSA")) { return sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1_MGF1) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA224) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA224_MGF1) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA256) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA256_MGF1) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA384) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA384_MGF1) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA512) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA512_MGF1) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA3_224_MGF1) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA3_256_MGF1) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA3_384_MGF1) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA3_512_MGF1); } if (sAlgName.equalsIgnoreCase ("EC")) { return sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_ECDSA_RIPEMD160) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA1) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA224) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA256) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA384) || sAlgURI.equalsIgnoreCase (XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA512); } LOGGER.warn ("Algorithm mismatch between JCA/JCE public key algorithm name ('" + sAlgName + "') and signature algorithm URI ('" + sAlgURI + "')"); return false; }
[ "public", "static", "boolean", "algorithmEquals", "(", "@", "Nonnull", "final", "String", "sAlgURI", ",", "@", "Nonnull", "final", "String", "sAlgName", ")", "{", "if", "(", "sAlgName", ".", "equalsIgnoreCase", "(", "\"DSA\"", ")", ")", "{", "return", "sAlgU...
Checks if a JCA/JCE public key algorithm name is compatible with the specified signature algorithm URI. @param sAlgURI The requested algorithm URI. @param sAlgName The provided algorithm name from a public key. @return <code>true</code> if the name matches the URI.
[ "Checks", "if", "a", "JCA", "/", "JCE", "public", "key", "algorithm", "name", "is", "compatible", "with", "the", "specified", "signature", "algorithm", "URI", "." ]
train
https://github.com/phax/ph-xmldsig/blob/c00677fe3dac5aef0f3039b08a03e90052473952/src/main/java/com/helger/xmldsig/keyselect/AbstractKeySelector.java#L47-L87
landawn/AbacusUtil
src/com/landawn/abacus/util/N.java
N.copyOfRange
public static float[] copyOfRange(final float[] original, int from, final int to, final int step) { N.checkFromToIndex(from < to ? from : (to == -1 ? 0 : to), from < to ? to : from, original.length); if (step == 0) { throw new IllegalArgumentException("The input parameter 'by' can not be zero"); } if (from == to || from < to != step > 0) { return N.EMPTY_FLOAT_ARRAY; } if (step == 1) { return copyOfRange(original, from, to); } from = from > to ? N.min(original.length - 1, from) : from; final int len = (to - from) / step + ((to - from) % step == 0 ? 0 : 1); final float[] copy = new float[len]; for (int i = 0, j = from; i < len; i++, j += step) { copy[i] = original[j]; } return copy; }
java
public static float[] copyOfRange(final float[] original, int from, final int to, final int step) { N.checkFromToIndex(from < to ? from : (to == -1 ? 0 : to), from < to ? to : from, original.length); if (step == 0) { throw new IllegalArgumentException("The input parameter 'by' can not be zero"); } if (from == to || from < to != step > 0) { return N.EMPTY_FLOAT_ARRAY; } if (step == 1) { return copyOfRange(original, from, to); } from = from > to ? N.min(original.length - 1, from) : from; final int len = (to - from) / step + ((to - from) % step == 0 ? 0 : 1); final float[] copy = new float[len]; for (int i = 0, j = from; i < len; i++, j += step) { copy[i] = original[j]; } return copy; }
[ "public", "static", "float", "[", "]", "copyOfRange", "(", "final", "float", "[", "]", "original", ",", "int", "from", ",", "final", "int", "to", ",", "final", "int", "step", ")", "{", "N", ".", "checkFromToIndex", "(", "from", "<", "to", "?", "from"...
Copy all the elements in <code>original</code>, through <code>to</code>-<code>from</code>, by <code>step</code>. @param original @param from @param to @param step @return @see N#copyOfRange(int[], int, int, int)
[ "Copy", "all", "the", "elements", "in", "<code", ">", "original<", "/", "code", ">", "through", "<code", ">", "to<", "/", "code", ">", "-", "<code", ">", "from<", "/", "code", ">", "by", "<code", ">", "step<", "/", "code", ">", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L10836-L10860
cybazeitalia/emaze-dysfunctional
src/main/java/net/emaze/dysfunctional/Spies.java
Spies.spyRes
public static <T1, T2> BiPredicate<T1, T2> spyRes(BiPredicate<T1, T2> predicate, Box<Boolean> result) { return spy(predicate, result, Box.<T1>empty(), Box.<T2>empty()); }
java
public static <T1, T2> BiPredicate<T1, T2> spyRes(BiPredicate<T1, T2> predicate, Box<Boolean> result) { return spy(predicate, result, Box.<T1>empty(), Box.<T2>empty()); }
[ "public", "static", "<", "T1", ",", "T2", ">", "BiPredicate", "<", "T1", ",", "T2", ">", "spyRes", "(", "BiPredicate", "<", "T1", ",", "T2", ">", "predicate", ",", "Box", "<", "Boolean", ">", "result", ")", "{", "return", "spy", "(", "predicate", "...
Proxies a binary predicate spying for result. @param <T1> the predicate first parameter type @param <T2> the predicate second parameter type @param predicate the predicate that will be spied @param result a box that will be containing spied result @return the proxied predicate
[ "Proxies", "a", "binary", "predicate", "spying", "for", "result", "." ]
train
https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Spies.java#L456-L458
Azure/azure-sdk-for-java
containerservice/resource-manager/v2017_08_31/src/main/java/com/microsoft/azure/management/containerservice/v2017_08_31/implementation/ManagedClustersInner.java
ManagedClustersInner.getUpgradeProfile
public ManagedClusterUpgradeProfileInner getUpgradeProfile(String resourceGroupName, String resourceName) { return getUpgradeProfileWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); }
java
public ManagedClusterUpgradeProfileInner getUpgradeProfile(String resourceGroupName, String resourceName) { return getUpgradeProfileWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); }
[ "public", "ManagedClusterUpgradeProfileInner", "getUpgradeProfile", "(", "String", "resourceGroupName", ",", "String", "resourceName", ")", "{", "return", "getUpgradeProfileWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ")", ".", "toBlocking", "(", ...
Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. @param resourceGroupName The name of the resource group. @param resourceName The name of the managed cluster resource. @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 ManagedClusterUpgradeProfileInner object if successful.
[ "Gets", "upgrade", "profile", "for", "a", "managed", "cluster", ".", "Gets", "the", "details", "of", "the", "upgrade", "profile", "for", "a", "managed", "cluster", "with", "a", "specified", "resource", "group", "and", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2017_08_31/src/main/java/com/microsoft/azure/management/containerservice/v2017_08_31/implementation/ManagedClustersInner.java#L356-L358
marklogic/java-client-api
marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java
StructuredQueryBuilder.geospatialRegionConstraint
public StructuredQueryDefinition geospatialRegionConstraint(String constraintName, GeospatialOperator operator, Region... regions) { checkRegions(regions); return new GeospatialRegionConstraintQuery(constraintName, operator, regions); }
java
public StructuredQueryDefinition geospatialRegionConstraint(String constraintName, GeospatialOperator operator, Region... regions) { checkRegions(regions); return new GeospatialRegionConstraintQuery(constraintName, operator, regions); }
[ "public", "StructuredQueryDefinition", "geospatialRegionConstraint", "(", "String", "constraintName", ",", "GeospatialOperator", "operator", ",", "Region", "...", "regions", ")", "{", "checkRegions", "(", "regions", ")", ";", "return", "new", "GeospatialRegionConstraintQu...
Matches the container specified by the constraint whose geospatial region appears within one of the criteria regions. @param constraintName the constraint definition @param operator the geospatial operator to be applied with the regions in the index and the criteria regions @param regions the possible regions containing the point @return the StructuredQueryDefinition for the geospatial constraint query
[ "Matches", "the", "container", "specified", "by", "the", "constraint", "whose", "geospatial", "region", "appears", "within", "one", "of", "the", "criteria", "regions", "." ]
train
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java#L1105-L1108
elki-project/elki
elki-logging/src/main/java/de/lmu/ifi/dbs/elki/logging/OutputStreamLogger.java
OutputStreamLogger.countNonNewline
private int countNonNewline(String str, int off, int len) { for(int cnt = 0; cnt < len; cnt++) { final int pos = off + cnt; if(str.charAt(pos) == UNIX_NEWLINE) { return cnt; } if(str.charAt(pos) == CARRIAGE_RETURN) { return cnt; } } return len; }
java
private int countNonNewline(String str, int off, int len) { for(int cnt = 0; cnt < len; cnt++) { final int pos = off + cnt; if(str.charAt(pos) == UNIX_NEWLINE) { return cnt; } if(str.charAt(pos) == CARRIAGE_RETURN) { return cnt; } } return len; }
[ "private", "int", "countNonNewline", "(", "String", "str", ",", "int", "off", ",", "int", "len", ")", "{", "for", "(", "int", "cnt", "=", "0", ";", "cnt", "<", "len", ";", "cnt", "++", ")", "{", "final", "int", "pos", "=", "off", "+", "cnt", ";...
Count the number of non-newline characters before first newline in the string. @param str String @param off offset @param len length @return number of non-newline characters
[ "Count", "the", "number", "of", "non", "-", "newline", "characters", "before", "first", "newline", "in", "the", "string", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-logging/src/main/java/de/lmu/ifi/dbs/elki/logging/OutputStreamLogger.java#L191-L202
kite-sdk/kite
kite-data/kite-data-hive/src/main/java/org/kitesdk/data/spi/hive/HiveAbstractMetadataProvider.java
HiveAbstractMetadataProvider.isReadable
private boolean isReadable(String namespace, String name) { Table table = getMetaStoreUtil().getTable(namespace, name); if (isManaged(table) || isExternal(table)) { // readable table types try { // get a descriptor for the table. if this succeeds, it is readable HiveUtils.descriptorForTable(conf, table); return true; } catch (DatasetException e) { // not a readable table } catch (IllegalStateException e) { // not a readable table } catch (IllegalArgumentException e) { // not a readable table } catch (UnsupportedOperationException e) { // not a readable table } } return false; }
java
private boolean isReadable(String namespace, String name) { Table table = getMetaStoreUtil().getTable(namespace, name); if (isManaged(table) || isExternal(table)) { // readable table types try { // get a descriptor for the table. if this succeeds, it is readable HiveUtils.descriptorForTable(conf, table); return true; } catch (DatasetException e) { // not a readable table } catch (IllegalStateException e) { // not a readable table } catch (IllegalArgumentException e) { // not a readable table } catch (UnsupportedOperationException e) { // not a readable table } } return false; }
[ "private", "boolean", "isReadable", "(", "String", "namespace", ",", "String", "name", ")", "{", "Table", "table", "=", "getMetaStoreUtil", "(", ")", ".", "getTable", "(", "namespace", ",", "name", ")", ";", "if", "(", "isManaged", "(", "table", ")", "||...
Returns true if the given table exists and can be read by this library. @param namespace a Hive database name @param name a table name @return {@code true} if the table exists and is supported
[ "Returns", "true", "if", "the", "given", "table", "exists", "and", "can", "be", "read", "by", "this", "library", "." ]
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-hive/src/main/java/org/kitesdk/data/spi/hive/HiveAbstractMetadataProvider.java#L216-L234
larsga/Duke
duke-core/src/main/java/no/priv/garshol/duke/datasources/SparqlDataSource.java
SparqlDataSource.runQuery
public SparqlResult runQuery(String endpoint, String query) { return SparqlClient.execute(endpoint, query, username, password); }
java
public SparqlResult runQuery(String endpoint, String query) { return SparqlClient.execute(endpoint, query, username, password); }
[ "public", "SparqlResult", "runQuery", "(", "String", "endpoint", ",", "String", "query", ")", "{", "return", "SparqlClient", ".", "execute", "(", "endpoint", ",", "query", ",", "username", ",", "password", ")", ";", "}" ]
An extension point so we can control how the query gets executed. This exists for testing purposes, not because we believe it will actually be used for real.
[ "An", "extension", "point", "so", "we", "can", "control", "how", "the", "query", "gets", "executed", ".", "This", "exists", "for", "testing", "purposes", "not", "because", "we", "believe", "it", "will", "actually", "be", "used", "for", "real", "." ]
train
https://github.com/larsga/Duke/blob/6263f9c6e984c26362a76241c7c7ea3bb4469bac/duke-core/src/main/java/no/priv/garshol/duke/datasources/SparqlDataSource.java#L123-L125
domaframework/doma-gen
src/main/java/org/seasar/doma/extension/gen/GlobalFactory.java
GlobalFactory.createDaoDescFactory
public DaoDescFactory createDaoDescFactory( String packageName, String suffix, String configClassName) { return new DaoDescFactory(packageName, suffix, configClassName); }
java
public DaoDescFactory createDaoDescFactory( String packageName, String suffix, String configClassName) { return new DaoDescFactory(packageName, suffix, configClassName); }
[ "public", "DaoDescFactory", "createDaoDescFactory", "(", "String", "packageName", ",", "String", "suffix", ",", "String", "configClassName", ")", "{", "return", "new", "DaoDescFactory", "(", "packageName", ",", "suffix", ",", "configClassName", ")", ";", "}" ]
Dao記述のファクトリを作成します。 @param packageName パッケージ名 @param suffix サフィックス @param configClassName 設定クラス名 @return Dao記述のファクトリ @since 1.7.0
[ "Dao記述のファクトリを作成します。" ]
train
https://github.com/domaframework/doma-gen/blob/8046e0b28d2167d444125f206ce36e554b3ee616/src/main/java/org/seasar/doma/extension/gen/GlobalFactory.java#L153-L156
triceo/splitlog
splitlog-core/src/main/java/com/github/triceo/splitlog/expectations/AbstractExpectationManager.java
AbstractExpectationManager.unsetExpectation
protected synchronized boolean unsetExpectation(final AbstractExpectation<C, P> expectation) { if (this.expectations.containsKey(expectation)) { this.expectations.remove(expectation); AbstractExpectationManager.LOGGER.info("Unregistered expectation {}.", expectation); return true; } return false; }
java
protected synchronized boolean unsetExpectation(final AbstractExpectation<C, P> expectation) { if (this.expectations.containsKey(expectation)) { this.expectations.remove(expectation); AbstractExpectationManager.LOGGER.info("Unregistered expectation {}.", expectation); return true; } return false; }
[ "protected", "synchronized", "boolean", "unsetExpectation", "(", "final", "AbstractExpectation", "<", "C", ",", "P", ">", "expectation", ")", "{", "if", "(", "this", ".", "expectations", ".", "containsKey", "(", "expectation", ")", ")", "{", "this", ".", "ex...
Stop tracking this expectation. Calls from the internal code only. @param expectation The expectation to stop. @return If stopped, false if stopped already.
[ "Stop", "tracking", "this", "expectation", ".", "Calls", "from", "the", "internal", "code", "only", "." ]
train
https://github.com/triceo/splitlog/blob/4e1b188e8c814119f5cf7343bbc53917843d68a2/splitlog-core/src/main/java/com/github/triceo/splitlog/expectations/AbstractExpectationManager.java#L109-L116
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java
PathChildrenCache.clearDataBytes
public boolean clearDataBytes(String fullPath, int ifVersion) { ChildData data = currentData.get(fullPath); if ( data != null ) { if ( (ifVersion < 0) || (ifVersion == data.getStat().getVersion()) ) { if ( data.getData() != null ) { currentData.replace(fullPath, data, new ChildData(data.getPath(), data.getStat(), null)); } return true; } } return false; }
java
public boolean clearDataBytes(String fullPath, int ifVersion) { ChildData data = currentData.get(fullPath); if ( data != null ) { if ( (ifVersion < 0) || (ifVersion == data.getStat().getVersion()) ) { if ( data.getData() != null ) { currentData.replace(fullPath, data, new ChildData(data.getPath(), data.getStat(), null)); } return true; } } return false; }
[ "public", "boolean", "clearDataBytes", "(", "String", "fullPath", ",", "int", "ifVersion", ")", "{", "ChildData", "data", "=", "currentData", ".", "get", "(", "fullPath", ")", ";", "if", "(", "data", "!=", "null", ")", "{", "if", "(", "(", "ifVersion", ...
As a memory optimization, you can clear the cached data bytes for a node. Subsequent calls to {@link ChildData#getData()} for this node will return <code>null</code>. @param fullPath the path of the node to clear @param ifVersion if non-negative, only clear the data if the data's version matches this version @return true if the data was cleared
[ "As", "a", "memory", "optimization", "you", "can", "clear", "the", "cached", "data", "bytes", "for", "a", "node", ".", "Subsequent", "calls", "to", "{", "@link", "ChildData#getData", "()", "}", "for", "this", "node", "will", "return", "<code", ">", "null<"...
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java#L444-L459
undertow-io/undertow
core/src/main/java/io/undertow/util/FlexBase64.java
FlexBase64.decodeURL
public static ByteBuffer decodeURL(byte[] source, int off, int limit) throws IOException { return Decoder.decode(source, off, limit, true); }
java
public static ByteBuffer decodeURL(byte[] source, int off, int limit) throws IOException { return Decoder.decode(source, off, limit, true); }
[ "public", "static", "ByteBuffer", "decodeURL", "(", "byte", "[", "]", "source", ",", "int", "off", ",", "int", "limit", ")", "throws", "IOException", "{", "return", "Decoder", ".", "decode", "(", "source", ",", "off", ",", "limit", ",", "true", ")", ";...
Decodes a Base64url encoded byte array into a new byte buffer. The returned byte buffer is a heap buffer, and it is therefor possible to retrieve the backing array using {@link java.nio.ByteBuffer#array()}, {@link java.nio.ByteBuffer#arrayOffset()} and {@link java.nio.ByteBuffer#limit()}. The latter is very important since the decoded array may be larger than the decoded data. This is due to length estimation which avoids an unnecessary array copy. @param source the Base64url content to decode @param off position to start decoding from in source @param limit position to stop decoding in source (exclusive) @return a byte buffer containing the decoded output @throws IOException if the encoding is invalid or corrupted
[ "Decodes", "a", "Base64url", "encoded", "byte", "array", "into", "a", "new", "byte", "buffer", ".", "The", "returned", "byte", "buffer", "is", "a", "heap", "buffer", "and", "it", "is", "therefor", "possible", "to", "retrieve", "the", "backing", "array", "u...
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/FlexBase64.java#L385-L387
rundeck/rundeck
rundeck-storage/rundeck-storage-filesys/src/main/java/org/rundeck/storage/data/file/DirectFilepathMapper.java
DirectFilepathMapper.withPath
private File withPath(Path path, File dir) { return new File(dir, path.getPath()); }
java
private File withPath(Path path, File dir) { return new File(dir, path.getPath()); }
[ "private", "File", "withPath", "(", "Path", "path", ",", "File", "dir", ")", "{", "return", "new", "File", "(", "dir", ",", "path", ".", "getPath", "(", ")", ")", ";", "}" ]
file for a given path in the specified subdir @param path path @param dir dir @return file
[ "file", "for", "a", "given", "path", "in", "the", "specified", "subdir" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/rundeck-storage/rundeck-storage-filesys/src/main/java/org/rundeck/storage/data/file/DirectFilepathMapper.java#L48-L50
osmdroid/osmdroid
osmdroid-geopackage/src/main/java/org/osmdroid/gpkg/overlay/features/SphericalUtil.java
SphericalUtil.polarTriangleArea
private static double polarTriangleArea(double tan1, double lng1, double tan2, double lng2) { double deltaLng = lng1 - lng2; double t = tan1 * tan2; return 2 * atan2(t * sin(deltaLng), 1 + t * cos(deltaLng)); }
java
private static double polarTriangleArea(double tan1, double lng1, double tan2, double lng2) { double deltaLng = lng1 - lng2; double t = tan1 * tan2; return 2 * atan2(t * sin(deltaLng), 1 + t * cos(deltaLng)); }
[ "private", "static", "double", "polarTriangleArea", "(", "double", "tan1", ",", "double", "lng1", ",", "double", "tan2", ",", "double", "lng2", ")", "{", "double", "deltaLng", "=", "lng1", "-", "lng2", ";", "double", "t", "=", "tan1", "*", "tan2", ";", ...
Returns the signed area of a triangle which has North Pole as a vertex. Formula derived from "Area of a spherical triangle given two edges and the included angle" as per "Spherical Trigonometry" by Todhunter, page 71, section 103, point 2. See http://books.google.com/books?id=3uBHAAAAIAAJ&pg=PA71 The arguments named "tan" are tan((pi/2 - latitude)/2).
[ "Returns", "the", "signed", "area", "of", "a", "triangle", "which", "has", "North", "Pole", "as", "a", "vertex", ".", "Formula", "derived", "from", "Area", "of", "a", "spherical", "triangle", "given", "two", "edges", "and", "the", "included", "angle", "as"...
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-geopackage/src/main/java/org/osmdroid/gpkg/overlay/features/SphericalUtil.java#L349-L353
unbescape/unbescape
src/main/java/org/unbescape/java/JavaEscape.java
JavaEscape.escapeJavaMinimal
public static void escapeJavaMinimal(final char[] text, final int offset, final int len, final Writer writer) throws IOException { escapeJava(text, offset, len, writer, JavaEscapeLevel.LEVEL_1_BASIC_ESCAPE_SET); }
java
public static void escapeJavaMinimal(final char[] text, final int offset, final int len, final Writer writer) throws IOException { escapeJava(text, offset, len, writer, JavaEscapeLevel.LEVEL_1_BASIC_ESCAPE_SET); }
[ "public", "static", "void", "escapeJavaMinimal", "(", "final", "char", "[", "]", "text", ",", "final", "int", "offset", ",", "final", "int", "len", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeJava", "(", "text", ",", "offset...
<p> Perform a Java level 1 (only basic set) <strong>escape</strong> operation on a <tt>char[]</tt> input. </p> <p> <em>Level 1</em> means this method will only escape the Java basic escape set: </p> <ul> <li>The <em>Single Escape Characters</em>: <tt>&#92;b</tt> (<tt>U+0008</tt>), <tt>&#92;t</tt> (<tt>U+0009</tt>), <tt>&#92;n</tt> (<tt>U+000A</tt>), <tt>&#92;f</tt> (<tt>U+000C</tt>), <tt>&#92;r</tt> (<tt>U+000D</tt>), <tt>&#92;&quot;</tt> (<tt>U+0022</tt>), <tt>&#92;&#39;</tt> (<tt>U+0027</tt>) and <tt>&#92;&#92;</tt> (<tt>U+005C</tt>). Note <tt>&#92;&#39;</tt> is not really needed in String literals (only in Character literals), so it won't be used until escape level 3. </li> <li> Two ranges of non-displayable, control characters (some of which are already part of the <em>single escape characters</em> list): <tt>U+0000</tt> to <tt>U+001F</tt> and <tt>U+007F</tt> to <tt>U+009F</tt>. </li> </ul> <p> This method calls {@link #escapeJava(char[], int, int, java.io.Writer, JavaEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>level</tt>: {@link JavaEscapeLevel#LEVEL_1_BASIC_ESCAPE_SET}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>char[]</tt> to be escaped. @param offset the position in <tt>text</tt> at which the escape operation should start. @param len the number of characters in <tt>text</tt> that should be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs
[ "<p", ">", "Perform", "a", "Java", "level", "1", "(", "only", "basic", "set", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "char", "[]", "<", "/", "tt", ">", "input", ".", "<", "/", "p", ">", "<p", ">"...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/java/JavaEscape.java#L702-L705
awslabs/amazon-sqs-java-messaging-lib
src/main/java/com/amazon/sqs/javamessaging/AmazonSQSMessagingClientWrapper.java
AmazonSQSMessagingClientWrapper.sendMessage
public SendMessageResult sendMessage(SendMessageRequest sendMessageRequest) throws JMSException { try { prepareRequest(sendMessageRequest); return amazonSQSClient.sendMessage(sendMessageRequest); } catch (AmazonClientException e) { throw handleException(e, "sendMessage"); } }
java
public SendMessageResult sendMessage(SendMessageRequest sendMessageRequest) throws JMSException { try { prepareRequest(sendMessageRequest); return amazonSQSClient.sendMessage(sendMessageRequest); } catch (AmazonClientException e) { throw handleException(e, "sendMessage"); } }
[ "public", "SendMessageResult", "sendMessage", "(", "SendMessageRequest", "sendMessageRequest", ")", "throws", "JMSException", "{", "try", "{", "prepareRequest", "(", "sendMessageRequest", ")", ";", "return", "amazonSQSClient", ".", "sendMessage", "(", "sendMessageRequest"...
Calls <code>sendMessage</code> and wraps <code>AmazonClientException</code>. @param sendMessageRequest Container for the necessary parameters to execute the sendMessage service method on AmazonSQS. @return The response from the sendMessage service method, as returned by AmazonSQS @throws JMSException
[ "Calls", "<code", ">", "sendMessage<", "/", "code", ">", "and", "wraps", "<code", ">", "AmazonClientException<", "/", "code", ">", "." ]
train
https://github.com/awslabs/amazon-sqs-java-messaging-lib/blob/efa716d34d51ef1c5572790626cdb795419cb342/src/main/java/com/amazon/sqs/javamessaging/AmazonSQSMessagingClientWrapper.java#L199-L206
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java
ProfilePackageFrameWriter.addClassListing
protected void addClassListing(Content contentTree, int profileValue) { if (packageDoc.isIncluded()) { addClassKindListing(packageDoc.interfaces(), getResource("doclet.Interfaces"), contentTree, profileValue); addClassKindListing(packageDoc.ordinaryClasses(), getResource("doclet.Classes"), contentTree, profileValue); addClassKindListing(packageDoc.enums(), getResource("doclet.Enums"), contentTree, profileValue); addClassKindListing(packageDoc.exceptions(), getResource("doclet.Exceptions"), contentTree, profileValue); addClassKindListing(packageDoc.errors(), getResource("doclet.Errors"), contentTree, profileValue); addClassKindListing(packageDoc.annotationTypes(), getResource("doclet.AnnotationTypes"), contentTree, profileValue); } }
java
protected void addClassListing(Content contentTree, int profileValue) { if (packageDoc.isIncluded()) { addClassKindListing(packageDoc.interfaces(), getResource("doclet.Interfaces"), contentTree, profileValue); addClassKindListing(packageDoc.ordinaryClasses(), getResource("doclet.Classes"), contentTree, profileValue); addClassKindListing(packageDoc.enums(), getResource("doclet.Enums"), contentTree, profileValue); addClassKindListing(packageDoc.exceptions(), getResource("doclet.Exceptions"), contentTree, profileValue); addClassKindListing(packageDoc.errors(), getResource("doclet.Errors"), contentTree, profileValue); addClassKindListing(packageDoc.annotationTypes(), getResource("doclet.AnnotationTypes"), contentTree, profileValue); } }
[ "protected", "void", "addClassListing", "(", "Content", "contentTree", ",", "int", "profileValue", ")", "{", "if", "(", "packageDoc", ".", "isIncluded", "(", ")", ")", "{", "addClassKindListing", "(", "packageDoc", ".", "interfaces", "(", ")", ",", "getResourc...
Add class listing for all the classes in this package. Divide class listing as per the class kind and generate separate listing for Classes, Interfaces, Exceptions and Errors. @param contentTree the content tree to which the listing will be added @param profileValue the value of the profile being documented
[ "Add", "class", "listing", "for", "all", "the", "classes", "in", "this", "package", ".", "Divide", "class", "listing", "as", "per", "the", "class", "kind", "and", "generate", "separate", "listing", "for", "Classes", "Interfaces", "Exceptions", "and", "Errors",...
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java#L130-L145
ops4j/org.ops4j.pax.logging
pax-logging-log4j2/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java
ThrowableProxy.getExtendedStackTraceAsString
public String getExtendedStackTraceAsString(final List<String> ignorePackages, final String suffix) { return getExtendedStackTraceAsString(ignorePackages, PlainTextRenderer.getInstance(), suffix); }
java
public String getExtendedStackTraceAsString(final List<String> ignorePackages, final String suffix) { return getExtendedStackTraceAsString(ignorePackages, PlainTextRenderer.getInstance(), suffix); }
[ "public", "String", "getExtendedStackTraceAsString", "(", "final", "List", "<", "String", ">", "ignorePackages", ",", "final", "String", "suffix", ")", "{", "return", "getExtendedStackTraceAsString", "(", "ignorePackages", ",", "PlainTextRenderer", ".", "getInstance", ...
Format the stack trace including packaging information. @param ignorePackages List of packages to be ignored in the trace. @param suffix @return The formatted stack trace including packaging information.
[ "Format", "the", "stack", "trace", "including", "packaging", "information", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-log4j2/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java#L473-L475
kiegroup/drools
drools-model/drools-constraint-parser/src/main/java/org/drools/constraint/parser/DrlConstraintParser.java
DrlConstraintParser.parseResource
public static Expression parseResource(final String path, Charset encoding) throws IOException { return simplifiedParse(EXPRESSION, resourceProvider(path, encoding)); }
java
public static Expression parseResource(final String path, Charset encoding) throws IOException { return simplifiedParse(EXPRESSION, resourceProvider(path, encoding)); }
[ "public", "static", "Expression", "parseResource", "(", "final", "String", "path", ",", "Charset", "encoding", ")", "throws", "IOException", "{", "return", "simplifiedParse", "(", "EXPRESSION", ",", "resourceProvider", "(", "path", ",", "encoding", ")", ")", ";"...
Parses the Java code contained in a resource and returns a {@link Expression} that represents it.<br> @param path path to a resource containing Java source code. As resource is accessed through a class loader, a leading "/" is not allowed in pathToResource @param encoding encoding of the source code @return Expression representing the Java source code @throws ParseProblemException if the source code has parser errors @throws IOException the path could not be accessed
[ "Parses", "the", "Java", "code", "contained", "in", "a", "resource", "and", "returns", "a", "{", "@link", "Expression", "}", "that", "represents", "it", ".", "<br", ">" ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-model/drools-constraint-parser/src/main/java/org/drools/constraint/parser/DrlConstraintParser.java#L212-L214
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java
HtmlTree.TH
public static HtmlTree TH(HtmlStyle styleClass, String scope, Content body) { HtmlTree htmltree = new HtmlTree(HtmlTag.TH, nullCheck(body)); if (styleClass != null) htmltree.addStyle(styleClass); htmltree.addAttr(HtmlAttr.SCOPE, nullCheck(scope)); return htmltree; }
java
public static HtmlTree TH(HtmlStyle styleClass, String scope, Content body) { HtmlTree htmltree = new HtmlTree(HtmlTag.TH, nullCheck(body)); if (styleClass != null) htmltree.addStyle(styleClass); htmltree.addAttr(HtmlAttr.SCOPE, nullCheck(scope)); return htmltree; }
[ "public", "static", "HtmlTree", "TH", "(", "HtmlStyle", "styleClass", ",", "String", "scope", ",", "Content", "body", ")", "{", "HtmlTree", "htmltree", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "TH", ",", "nullCheck", "(", "body", ")", ")", ";", "if",...
Generates a TH tag with style class and scope attributes and some content. @param styleClass style for the tag @param scope scope of the tag @param body content for the tag @return an HtmlTree object for the TH tag
[ "Generates", "a", "TH", "tag", "with", "style", "class", "and", "scope", "attributes", "and", "some", "content", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L806-L812
code4everything/util
src/main/java/com/zhazhapan/util/DateUtils.java
DateUtils.addDay
public static Date addDay(String date, int amount) throws ParseException { return add(date, Calendar.DATE, amount); }
java
public static Date addDay(String date, int amount) throws ParseException { return add(date, Calendar.DATE, amount); }
[ "public", "static", "Date", "addDay", "(", "String", "date", ",", "int", "amount", ")", "throws", "ParseException", "{", "return", "add", "(", "date", ",", "Calendar", ".", "DATE", ",", "amount", ")", ";", "}" ]
添加日期 @param date 日期 @param amount 数量 @return 添加后的日期 @throws ParseException 异常
[ "添加日期" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/DateUtils.java#L425-L427
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/config/internal/MultivalueProperty.java
MultivalueProperty.processRecords
private static void processRecords(List<String> result, List<CSVRecord> records, Function<String, String> valueProcessor) { for (CSVRecord csvRecord : records) { Iterator<String> it = csvRecord.iterator(); if (!result.isEmpty()) { String next = it.next(); if (!next.isEmpty()) { int lastItemIdx = result.size() - 1; String previous = result.get(lastItemIdx); if (previous.isEmpty()) { result.set(lastItemIdx, valueProcessor.apply(next)); } else { result.set(lastItemIdx, valueProcessor.apply(previous + "\n" + next)); } } } it.forEachRemaining(s -> { String apply = valueProcessor.apply(s); result.add(apply); }); } }
java
private static void processRecords(List<String> result, List<CSVRecord> records, Function<String, String> valueProcessor) { for (CSVRecord csvRecord : records) { Iterator<String> it = csvRecord.iterator(); if (!result.isEmpty()) { String next = it.next(); if (!next.isEmpty()) { int lastItemIdx = result.size() - 1; String previous = result.get(lastItemIdx); if (previous.isEmpty()) { result.set(lastItemIdx, valueProcessor.apply(next)); } else { result.set(lastItemIdx, valueProcessor.apply(previous + "\n" + next)); } } } it.forEachRemaining(s -> { String apply = valueProcessor.apply(s); result.add(apply); }); } }
[ "private", "static", "void", "processRecords", "(", "List", "<", "String", ">", "result", ",", "List", "<", "CSVRecord", ">", "records", ",", "Function", "<", "String", ",", "String", ">", "valueProcessor", ")", "{", "for", "(", "CSVRecord", "csvRecord", "...
In most cases we expect a single record. <br>Having multiple records means the input value was splitted over multiple lines (this is common in Maven). For example: <pre> &lt;sonar.exclusions&gt; src/foo, src/bar, src/biz &lt;sonar.exclusions&gt; </pre> In this case records will be merged to form a single list of items. Last item of a record is appended to first item of next record. <p> This is a very curious case, but we try to preserve line break in the middle of an item: <pre> &lt;sonar.exclusions&gt; a b, c &lt;sonar.exclusions&gt; </pre> will produce ['a\nb', 'c']
[ "In", "most", "cases", "we", "expect", "a", "single", "record", ".", "<br", ">", "Having", "multiple", "records", "means", "the", "input", "value", "was", "splitted", "over", "multiple", "lines", "(", "this", "is", "common", "in", "Maven", ")", ".", "For...
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/config/internal/MultivalueProperty.java#L84-L104
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/model/ClassNameRewriterUtil.java
ClassNameRewriterUtil.rewriteMethodSignature
public static String rewriteMethodSignature(ClassNameRewriter classNameRewriter, String methodSignature) { if (classNameRewriter != IdentityClassNameRewriter.instance()) { SignatureParser parser = new SignatureParser(methodSignature); StringBuilder buf = new StringBuilder(); buf.append('('); for (Iterator<String> i = parser.parameterSignatureIterator(); i.hasNext();) { buf.append(rewriteSignature(classNameRewriter, i.next())); } buf.append(')'); buf.append(rewriteSignature(classNameRewriter, parser.getReturnTypeSignature())); methodSignature = buf.toString(); } return methodSignature; }
java
public static String rewriteMethodSignature(ClassNameRewriter classNameRewriter, String methodSignature) { if (classNameRewriter != IdentityClassNameRewriter.instance()) { SignatureParser parser = new SignatureParser(methodSignature); StringBuilder buf = new StringBuilder(); buf.append('('); for (Iterator<String> i = parser.parameterSignatureIterator(); i.hasNext();) { buf.append(rewriteSignature(classNameRewriter, i.next())); } buf.append(')'); buf.append(rewriteSignature(classNameRewriter, parser.getReturnTypeSignature())); methodSignature = buf.toString(); } return methodSignature; }
[ "public", "static", "String", "rewriteMethodSignature", "(", "ClassNameRewriter", "classNameRewriter", ",", "String", "methodSignature", ")", "{", "if", "(", "classNameRewriter", "!=", "IdentityClassNameRewriter", ".", "instance", "(", ")", ")", "{", "SignatureParser", ...
Rewrite a method signature. @param classNameRewriter a ClassNameRewriter @param methodSignature a method signature @return the rewritten method signature
[ "Rewrite", "a", "method", "signature", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/model/ClassNameRewriterUtil.java#L44-L62
apache/flink
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/operations/SortOperationFactory.java
SortOperationFactory.createSort
public TableOperation createSort(List<Expression> orders, TableOperation child) { failIfStreaming(); List<Expression> convertedOrders = orders.stream() .map(f -> f.accept(orderWrapper)) .collect(Collectors.toList()); return new SortTableOperation(convertedOrders, child); }
java
public TableOperation createSort(List<Expression> orders, TableOperation child) { failIfStreaming(); List<Expression> convertedOrders = orders.stream() .map(f -> f.accept(orderWrapper)) .collect(Collectors.toList()); return new SortTableOperation(convertedOrders, child); }
[ "public", "TableOperation", "createSort", "(", "List", "<", "Expression", ">", "orders", ",", "TableOperation", "child", ")", "{", "failIfStreaming", "(", ")", ";", "List", "<", "Expression", ">", "convertedOrders", "=", "orders", ".", "stream", "(", ")", "....
Creates a valid {@link SortTableOperation} operation. <p><b>NOTE:</b> if the collation is not explicitly specified for any expression, it is wrapped in a default ascending order @param orders expressions describing order, @param child relational expression on top of which to apply the sort operation @return valid sort operation
[ "Creates", "a", "valid", "{", "@link", "SortTableOperation", "}", "operation", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/operations/SortOperationFactory.java#L57-L64
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.memberType
public Type memberType(Type t, Symbol sym) { return (sym.flags() & STATIC) != 0 ? sym.type : memberType.visit(t, sym); }
java
public Type memberType(Type t, Symbol sym) { return (sym.flags() & STATIC) != 0 ? sym.type : memberType.visit(t, sym); }
[ "public", "Type", "memberType", "(", "Type", "t", ",", "Symbol", "sym", ")", "{", "return", "(", "sym", ".", "flags", "(", ")", "&", "STATIC", ")", "!=", "0", "?", "sym", ".", "type", ":", "memberType", ".", "visit", "(", "t", ",", "sym", ")", ...
The type of given symbol, seen as a member of t. @param t a type @param sym a symbol
[ "The", "type", "of", "given", "symbol", "seen", "as", "a", "member", "of", "t", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L1981-L1985
alexvasilkov/Events
library/src/main/java/com/alexvasilkov/events/internal/Dispatcher.java
Dispatcher.scheduleStatusUpdates
@MainThread private void scheduleStatusUpdates(Event event, EventStatus status) { for (EventTarget target : targets) { for (EventMethod method : target.methods) { if (event.getKey().equals(method.eventKey) && method.type == EventMethod.Type.STATUS) { Utils.log(event.getKey(), method, "Scheduling status update"); executionQueue.add(Task.create(this, target, method, event, status)); } } } }
java
@MainThread private void scheduleStatusUpdates(Event event, EventStatus status) { for (EventTarget target : targets) { for (EventMethod method : target.methods) { if (event.getKey().equals(method.eventKey) && method.type == EventMethod.Type.STATUS) { Utils.log(event.getKey(), method, "Scheduling status update"); executionQueue.add(Task.create(this, target, method, event, status)); } } } }
[ "@", "MainThread", "private", "void", "scheduleStatusUpdates", "(", "Event", "event", ",", "EventStatus", "status", ")", "{", "for", "(", "EventTarget", "target", ":", "targets", ")", "{", "for", "(", "EventMethod", "method", ":", "target", ".", "methods", "...
Schedules status update of given event for all registered targets.
[ "Schedules", "status", "update", "of", "given", "event", "for", "all", "registered", "targets", "." ]
train
https://github.com/alexvasilkov/Events/blob/4208e11fab35d99229fe6c3b3d434ca1948f3fc5/library/src/main/java/com/alexvasilkov/events/internal/Dispatcher.java#L94-L105
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/file/meta/InodeTree.java
InodeTree.initializeRoot
public void initializeRoot(String owner, String group, Mode mode, JournalContext context) throws UnavailableException { if (mState.getRoot() == null) { MutableInodeDirectory root = MutableInodeDirectory.create( mDirectoryIdGenerator.getNewDirectoryId(context), NO_PARENT, ROOT_INODE_NAME, CreateDirectoryContext .mergeFrom(CreateDirectoryPOptions.newBuilder().setMode(mode.toProto())) .setOwner(owner).setGroup(group)); root.setPersistenceState(PersistenceState.PERSISTED); mState.applyAndJournal(context, root); } }
java
public void initializeRoot(String owner, String group, Mode mode, JournalContext context) throws UnavailableException { if (mState.getRoot() == null) { MutableInodeDirectory root = MutableInodeDirectory.create( mDirectoryIdGenerator.getNewDirectoryId(context), NO_PARENT, ROOT_INODE_NAME, CreateDirectoryContext .mergeFrom(CreateDirectoryPOptions.newBuilder().setMode(mode.toProto())) .setOwner(owner).setGroup(group)); root.setPersistenceState(PersistenceState.PERSISTED); mState.applyAndJournal(context, root); } }
[ "public", "void", "initializeRoot", "(", "String", "owner", ",", "String", "group", ",", "Mode", "mode", ",", "JournalContext", "context", ")", "throws", "UnavailableException", "{", "if", "(", "mState", ".", "getRoot", "(", ")", "==", "null", ")", "{", "M...
Initializes the root of the inode tree. @param owner the root owner @param group the root group @param mode the root mode @param context the journal context to journal the initialization to
[ "Initializes", "the", "root", "of", "the", "inode", "tree", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/InodeTree.java#L224-L235
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/net/IpHelper.java
IpHelper.stoa
public static InetAddress stoa(final String ip) { if (ip == null || ip.isEmpty()) throw new IllegalArgumentException("must pass a valid ip: null or empty strings are not valid IPs!"); try { return InetAddress.getByName(ip); } catch (UnknownHostException e) { throw new IllegalArgumentException("must pass a valid ip. Illegal input was: " + ip, e); } }
java
public static InetAddress stoa(final String ip) { if (ip == null || ip.isEmpty()) throw new IllegalArgumentException("must pass a valid ip: null or empty strings are not valid IPs!"); try { return InetAddress.getByName(ip); } catch (UnknownHostException e) { throw new IllegalArgumentException("must pass a valid ip. Illegal input was: " + ip, e); } }
[ "public", "static", "InetAddress", "stoa", "(", "final", "String", "ip", ")", "{", "if", "(", "ip", "==", "null", "||", "ip", ".", "isEmpty", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"must pass a valid ip: null or empty strings are not val...
Parses an IP address, returning it as an InetAddress<br /> This method exists to prevent code which is handling valid IP addresses from having to catch UnknownHostException excessively (when there is often no choice but to totally fail out anyway) @param ip a valid IP address (IPv4 or IPv6) @return the resulting InetAddress for that ip; this is equivalent to calling <code>InetAddress.getByName</code> on the IP (but without having to catch UnknownHostException) @throws IllegalArgumentException if the IP address is invalid (eg. null, an empty string or otherwise not in the valid IP address format)
[ "Parses", "an", "IP", "address", "returning", "it", "as", "an", "InetAddress<br", "/", ">", "This", "method", "exists", "to", "prevent", "code", "which", "is", "handling", "valid", "IP", "addresses", "from", "having", "to", "catch", "UnknownHostException", "ex...
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/net/IpHelper.java#L674-L687
aws/aws-sdk-java
aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/Partition.java
Partition.withParameters
public Partition withParameters(java.util.Map<String, String> parameters) { setParameters(parameters); return this; }
java
public Partition withParameters(java.util.Map<String, String> parameters) { setParameters(parameters); return this; }
[ "public", "Partition", "withParameters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "parameters", ")", "{", "setParameters", "(", "parameters", ")", ";", "return", "this", ";", "}" ]
<p> These key-value pairs define partition parameters. </p> @param parameters These key-value pairs define partition parameters. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "These", "key", "-", "value", "pairs", "define", "partition", "parameters", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/Partition.java#L385-L388
meertensinstituut/mtas
src/main/java/mtas/analysis/util/MtasFetchData.java
MtasFetchData.getString
private String getString() throws MtasParserException { String text = null; BufferedReader bufferedReader = new BufferedReader(reader, 2048); try { text = IOUtils.toString(bufferedReader); bufferedReader.close(); return text; } catch (IOException e) { log.debug(e); throw new MtasParserException("couldn't read text"); } }
java
private String getString() throws MtasParserException { String text = null; BufferedReader bufferedReader = new BufferedReader(reader, 2048); try { text = IOUtils.toString(bufferedReader); bufferedReader.close(); return text; } catch (IOException e) { log.debug(e); throw new MtasParserException("couldn't read text"); } }
[ "private", "String", "getString", "(", ")", "throws", "MtasParserException", "{", "String", "text", "=", "null", ";", "BufferedReader", "bufferedReader", "=", "new", "BufferedReader", "(", "reader", ",", "2048", ")", ";", "try", "{", "text", "=", "IOUtils", ...
Gets the string. @return the string @throws MtasParserException the mtas parser exception
[ "Gets", "the", "string", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/analysis/util/MtasFetchData.java#L47-L58
OpenLiberty/open-liberty
dev/com.ibm.ws.security/src/com/ibm/ws/security/krb5/Krb5Common.java
Krb5Common.restorePropertyAsNeeded
public static void restorePropertyAsNeeded(final String propName, final String oldPropValue, final String newPropValue) { java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<Object>() { @Override public Object run() { if (oldPropValue == null) { System.clearProperty(propName); } else if (!oldPropValue.equalsIgnoreCase(newPropValue)) { System.setProperty(propName, oldPropValue); } return null; } }); if (tc.isDebugEnabled()) Tr.debug(tc, "Restore property " + propName + " to previous value: " + oldPropValue); }
java
public static void restorePropertyAsNeeded(final String propName, final String oldPropValue, final String newPropValue) { java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<Object>() { @Override public Object run() { if (oldPropValue == null) { System.clearProperty(propName); } else if (!oldPropValue.equalsIgnoreCase(newPropValue)) { System.setProperty(propName, oldPropValue); } return null; } }); if (tc.isDebugEnabled()) Tr.debug(tc, "Restore property " + propName + " to previous value: " + oldPropValue); }
[ "public", "static", "void", "restorePropertyAsNeeded", "(", "final", "String", "propName", ",", "final", "String", "oldPropValue", ",", "final", "String", "newPropValue", ")", "{", "java", ".", "security", ".", "AccessController", ".", "doPrivileged", "(", "new", ...
This method restore the property value to the original value. @param propName @param oldPropValue @param newPropValue
[ "This", "method", "restore", "the", "property", "value", "to", "the", "original", "value", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/krb5/Krb5Common.java#L104-L118
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_miniPabx_serviceName_PUT
public void billingAccount_miniPabx_serviceName_PUT(String billingAccount, String serviceName, OvhMiniPabx body) throws IOException { String qPath = "/telephony/{billingAccount}/miniPabx/{serviceName}"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
java
public void billingAccount_miniPabx_serviceName_PUT(String billingAccount, String serviceName, OvhMiniPabx body) throws IOException { String qPath = "/telephony/{billingAccount}/miniPabx/{serviceName}"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "billingAccount_miniPabx_serviceName_PUT", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "OvhMiniPabx", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/miniPabx/{serviceName}\"", ";", ...
Alter this object properties REST: PUT /telephony/{billingAccount}/miniPabx/{serviceName} @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L5160-L5164
nmorel/gwt-jackson
extensions/guava/src/main/java/com/github/nmorel/gwtjackson/guava/client/deser/BaseImmutableMapJsonDeserializer.java
BaseImmutableMapJsonDeserializer.buildMap
protected void buildMap( JsonReader reader, JsonDeserializationContext ctx, JsonDeserializerParameters params, Builder<K, V> builder ) { reader.beginObject(); while ( JsonToken.END_OBJECT != reader.peek() ) { String name = reader.nextName(); K key = keyDeserializer.deserialize( name, ctx ); V value = valueDeserializer.deserialize( reader, ctx, params ); builder.put( key, value ); } reader.endObject(); }
java
protected void buildMap( JsonReader reader, JsonDeserializationContext ctx, JsonDeserializerParameters params, Builder<K, V> builder ) { reader.beginObject(); while ( JsonToken.END_OBJECT != reader.peek() ) { String name = reader.nextName(); K key = keyDeserializer.deserialize( name, ctx ); V value = valueDeserializer.deserialize( reader, ctx, params ); builder.put( key, value ); } reader.endObject(); }
[ "protected", "void", "buildMap", "(", "JsonReader", "reader", ",", "JsonDeserializationContext", "ctx", ",", "JsonDeserializerParameters", "params", ",", "Builder", "<", "K", ",", "V", ">", "builder", ")", "{", "reader", ".", "beginObject", "(", ")", ";", "whi...
Build the {@link ImmutableMap} using the given builder. @param reader {@link JsonReader} used to read the JSON input @param ctx Context for the full deserialization process @param params Parameters for this deserialization @param builder {@link ImmutableMap.Builder} used to collect the entries
[ "Build", "the", "{", "@link", "ImmutableMap", "}", "using", "the", "given", "builder", "." ]
train
https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/extensions/guava/src/main/java/com/github/nmorel/gwtjackson/guava/client/deser/BaseImmutableMapJsonDeserializer.java#L72-L81
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.updateRegexEntityModelAsync
public Observable<OperationStatus> updateRegexEntityModelAsync(UUID appId, String versionId, UUID regexEntityId, RegexModelUpdateObject regexEntityUpdateObject) { return updateRegexEntityModelWithServiceResponseAsync(appId, versionId, regexEntityId, regexEntityUpdateObject).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
java
public Observable<OperationStatus> updateRegexEntityModelAsync(UUID appId, String versionId, UUID regexEntityId, RegexModelUpdateObject regexEntityUpdateObject) { return updateRegexEntityModelWithServiceResponseAsync(appId, versionId, regexEntityId, regexEntityUpdateObject).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatus", ">", "updateRegexEntityModelAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "regexEntityId", ",", "RegexModelUpdateObject", "regexEntityUpdateObject", ")", "{", "return", "updateRegexEntityModelWithServi...
Updates the regex entity model . @param appId The application ID. @param versionId The version ID. @param regexEntityId The regex entity extractor ID. @param regexEntityUpdateObject An object containing the new entity name and regex pattern. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Updates", "the", "regex", "entity", "model", "." ]
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#L10300-L10307
m-m-m/util
text/src/main/java/net/sf/mmm/util/text/base/HyphenatorImpl.java
HyphenatorImpl.sortPatterns
private static HyphenationPattern[] sortPatterns(HyphenationPattern[] patternArray) { Comparator<HyphenationPattern> comparator = new Comparator<HyphenationPattern>() { @Override public int compare(HyphenationPattern p1, HyphenationPattern p2) { return (p2.getWordPart().length() - p1.getWordPart().length()); } }; Arrays.sort(patternArray, comparator); return patternArray; }
java
private static HyphenationPattern[] sortPatterns(HyphenationPattern[] patternArray) { Comparator<HyphenationPattern> comparator = new Comparator<HyphenationPattern>() { @Override public int compare(HyphenationPattern p1, HyphenationPattern p2) { return (p2.getWordPart().length() - p1.getWordPart().length()); } }; Arrays.sort(patternArray, comparator); return patternArray; }
[ "private", "static", "HyphenationPattern", "[", "]", "sortPatterns", "(", "HyphenationPattern", "[", "]", "patternArray", ")", "{", "Comparator", "<", "HyphenationPattern", ">", "comparator", "=", "new", "Comparator", "<", "HyphenationPattern", ">", "(", ")", "{",...
This method sorts the given {@link HyphenationPattern patterns} according to the {@link String#length() length} of their {@link HyphenationPattern#getWordPart() word-part}. @param patternArray are the unsorted {@link HyphenationPattern patterns}. @return the sorted {@link HyphenationPattern patterns}.
[ "This", "method", "sorts", "the", "given", "{", "@link", "HyphenationPattern", "patterns", "}", "according", "to", "the", "{", "@link", "String#length", "()", "length", "}", "of", "their", "{", "@link", "HyphenationPattern#getWordPart", "()", "word", "-", "part"...
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/text/src/main/java/net/sf/mmm/util/text/base/HyphenatorImpl.java#L80-L92
google/error-prone
check_api/src/main/java/com/google/errorprone/dataflow/nullnesspropagation/NullnessPropagationTransfer.java
NullnessPropagationTransfer.visitMethodInvocation
@Override Nullness visitMethodInvocation( MethodInvocationNode node, Updates thenUpdates, Updates elseUpdates, Updates bothUpdates) { ClassAndMethod callee = tryGetMethodSymbol(node.getTree(), Types.instance(context)); if (callee != null && !callee.isStatic) { setNonnullIfTrackable(bothUpdates, node.getTarget().getReceiver()); } setUnconditionalArgumentNullness(bothUpdates, node.getArguments(), callee); setConditionalArgumentNullness( thenUpdates, elseUpdates, node.getArguments(), callee, Types.instance(context), Symtab.instance(context)); return returnValueNullness(node, callee); }
java
@Override Nullness visitMethodInvocation( MethodInvocationNode node, Updates thenUpdates, Updates elseUpdates, Updates bothUpdates) { ClassAndMethod callee = tryGetMethodSymbol(node.getTree(), Types.instance(context)); if (callee != null && !callee.isStatic) { setNonnullIfTrackable(bothUpdates, node.getTarget().getReceiver()); } setUnconditionalArgumentNullness(bothUpdates, node.getArguments(), callee); setConditionalArgumentNullness( thenUpdates, elseUpdates, node.getArguments(), callee, Types.instance(context), Symtab.instance(context)); return returnValueNullness(node, callee); }
[ "@", "Override", "Nullness", "visitMethodInvocation", "(", "MethodInvocationNode", "node", ",", "Updates", "thenUpdates", ",", "Updates", "elseUpdates", ",", "Updates", "bothUpdates", ")", "{", "ClassAndMethod", "callee", "=", "tryGetMethodSymbol", "(", "node", ".", ...
Refines the receiver of a method invocation to type non-null after successful invocation, and refines the value of the expression as a whole to non-null if applicable (e.g., if the method returns a primitive type). <p>NOTE: This transfer makes the unsound assumption that fields reachable via the actual params of this method invocation are not mutated by the callee. To be sound with respect to escaping mutable references in general, we would have to set to top (i.e. NULLABLE) any tracked access path that could contain an alias of an actual parameter of this invocation.
[ "Refines", "the", "receiver", "of", "a", "method", "invocation", "to", "type", "non", "-", "null", "after", "successful", "invocation", "and", "refines", "the", "value", "of", "the", "expression", "as", "a", "whole", "to", "non", "-", "null", "if", "applic...
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/dataflow/nullnesspropagation/NullnessPropagationTransfer.java#L567-L583
drewnoakes/metadata-extractor
Source/com/drew/lang/GeoLocation.java
GeoLocation.degreesMinutesSecondsToDecimal
@Nullable public static Double degreesMinutesSecondsToDecimal(@NotNull final Rational degs, @NotNull final Rational mins, @NotNull final Rational secs, final boolean isNegative) { double decimal = Math.abs(degs.doubleValue()) + mins.doubleValue() / 60.0d + secs.doubleValue() / 3600.0d; if (Double.isNaN(decimal)) return null; if (isNegative) decimal *= -1; return decimal; }
java
@Nullable public static Double degreesMinutesSecondsToDecimal(@NotNull final Rational degs, @NotNull final Rational mins, @NotNull final Rational secs, final boolean isNegative) { double decimal = Math.abs(degs.doubleValue()) + mins.doubleValue() / 60.0d + secs.doubleValue() / 3600.0d; if (Double.isNaN(decimal)) return null; if (isNegative) decimal *= -1; return decimal; }
[ "@", "Nullable", "public", "static", "Double", "degreesMinutesSecondsToDecimal", "(", "@", "NotNull", "final", "Rational", "degs", ",", "@", "NotNull", "final", "Rational", "mins", ",", "@", "NotNull", "final", "Rational", "secs", ",", "final", "boolean", "isNeg...
Converts DMS (degrees-minutes-seconds) rational values, as given in {@link com.drew.metadata.exif.GpsDirectory}, into a single value in degrees, as a double.
[ "Converts", "DMS", "(", "degrees", "-", "minutes", "-", "seconds", ")", "rational", "values", "as", "given", "in", "{" ]
train
https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/lang/GeoLocation.java#L106-L120
akquinet/needle
src/main/java/de/akquinet/jbosscc/needle/db/transaction/TransactionHelper.java
TransactionHelper.loadObject
public final <T> T loadObject(final Class<T> clazz, final Object id) throws Exception { return executeInTransaction(new Runnable<T>() { @Override public T run(final EntityManager entityManager) { return loadObject(entityManager, clazz, id); } }); }
java
public final <T> T loadObject(final Class<T> clazz, final Object id) throws Exception { return executeInTransaction(new Runnable<T>() { @Override public T run(final EntityManager entityManager) { return loadObject(entityManager, clazz, id); } }); }
[ "public", "final", "<", "T", ">", "T", "loadObject", "(", "final", "Class", "<", "T", ">", "clazz", ",", "final", "Object", "id", ")", "throws", "Exception", "{", "return", "executeInTransaction", "(", "new", "Runnable", "<", "T", ">", "(", ")", "{", ...
Finds and returns the object of the given id in the persistence context. @param <T> type of searched object @param clazz type of searched object @param id technical id of searched object @return found object @throws Exception finding object failed
[ "Finds", "and", "returns", "the", "object", "of", "the", "given", "id", "in", "the", "persistence", "context", "." ]
train
https://github.com/akquinet/needle/blob/8b411c521246b8212882485edc01644f9aac7e24/src/main/java/de/akquinet/jbosscc/needle/db/transaction/TransactionHelper.java#L51-L58
fflewddur/hola
src/main/java/net/straylightlabs/hola/utils/Utils.java
Utils.dumpPacket
@SuppressWarnings("unused") public static void dumpPacket(DatagramPacket packet, String prefix) { byte[] buffer = new byte[packet.getLength()]; System.arraycopy(packet.getData(), packet.getOffset(), buffer, 0, packet.getLength()); printBuffer(buffer, "Buffer to save"); try { Path path = getNextPath(prefix); logger.info("Dumping buffer to {}", path); Files.write(path, buffer); } catch (IOException e) { logger.error("Error writing file: {}", e.getLocalizedMessage()); } }
java
@SuppressWarnings("unused") public static void dumpPacket(DatagramPacket packet, String prefix) { byte[] buffer = new byte[packet.getLength()]; System.arraycopy(packet.getData(), packet.getOffset(), buffer, 0, packet.getLength()); printBuffer(buffer, "Buffer to save"); try { Path path = getNextPath(prefix); logger.info("Dumping buffer to {}", path); Files.write(path, buffer); } catch (IOException e) { logger.error("Error writing file: {}", e.getLocalizedMessage()); } }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "public", "static", "void", "dumpPacket", "(", "DatagramPacket", "packet", ",", "String", "prefix", ")", "{", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "packet", ".", "getLength", "(", ")", "]", ...
Save @packet to a new file beginning with @prefix. Append a sequential suffix to ensure we don't overwrite existing files. @param packet The data packet to dump to disk @param prefix The start of the file name
[ "Save" ]
train
https://github.com/fflewddur/hola/blob/08d9b9f3b807fd447181a5c1122f117a950db848/src/main/java/net/straylightlabs/hola/utils/Utils.java#L52-L64
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
BpmnParse.parseMessages
public void parseMessages() { for (Element messageElement : rootElement.elements("message")) { String id = messageElement.attribute("id"); String messageName = messageElement.attribute("name"); Expression messageExpression = null; if (messageName != null) { messageExpression = expressionManager.createExpression(messageName); } MessageDefinition messageDefinition = new MessageDefinition(this.targetNamespace + ":" + id, messageExpression); this.messages.put(messageDefinition.getId(), messageDefinition); } }
java
public void parseMessages() { for (Element messageElement : rootElement.elements("message")) { String id = messageElement.attribute("id"); String messageName = messageElement.attribute("name"); Expression messageExpression = null; if (messageName != null) { messageExpression = expressionManager.createExpression(messageName); } MessageDefinition messageDefinition = new MessageDefinition(this.targetNamespace + ":" + id, messageExpression); this.messages.put(messageDefinition.getId(), messageDefinition); } }
[ "public", "void", "parseMessages", "(", ")", "{", "for", "(", "Element", "messageElement", ":", "rootElement", ".", "elements", "(", "\"message\"", ")", ")", "{", "String", "id", "=", "messageElement", ".", "attribute", "(", "\"id\"", ")", ";", "String", "...
Parses the messages of the given definitions file. Messages are not contained within a process element, but they can be referenced from inner process elements.
[ "Parses", "the", "messages", "of", "the", "given", "definitions", "file", ".", "Messages", "are", "not", "contained", "within", "a", "process", "element", "but", "they", "can", "be", "referenced", "from", "inner", "process", "elements", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java#L372-L385
bwkimmel/java-util
src/main/java/ca/eandb/util/io/FileUtil.java
FileUtil.postOrderTraversal
public static boolean postOrderTraversal(File root, FileVisitor visitor) throws Exception { if (root.isDirectory()) { for (File child : root.listFiles()) { if (!postOrderTraversal(child, visitor)) { return false; } } } return visitor.visit(root); }
java
public static boolean postOrderTraversal(File root, FileVisitor visitor) throws Exception { if (root.isDirectory()) { for (File child : root.listFiles()) { if (!postOrderTraversal(child, visitor)) { return false; } } } return visitor.visit(root); }
[ "public", "static", "boolean", "postOrderTraversal", "(", "File", "root", ",", "FileVisitor", "visitor", ")", "throws", "Exception", "{", "if", "(", "root", ".", "isDirectory", "(", ")", ")", "{", "for", "(", "File", "child", ":", "root", ".", "listFiles",...
Walks a directory tree using post-order traversal. The contents of a directory are visited before the directory itself is visited. @param root The <code>File</code> indicating the file or directory to walk. @param visitor The <code>FileVisitor</code> to use to visit files and directories while walking the tree. @return A value indicating whether the tree walk was completed without {@link FileVisitor#visit(File)} ever returning false. @throws Exception If {@link FileVisitor#visit(File)} threw an exception. @see FileVisitor#visit(File)
[ "Walks", "a", "directory", "tree", "using", "post", "-", "order", "traversal", ".", "The", "contents", "of", "a", "directory", "are", "visited", "before", "the", "directory", "itself", "is", "visited", "." ]
train
https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/io/FileUtil.java#L230-L239
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecSearchTree.java
CodecSearchTree.searchMtasTree
public static ArrayList<MtasTreeHit<?>> searchMtasTree(int position, IndexInput in, long ref, long objectRefApproxOffset) throws IOException { return searchMtasTree(position, position, in, ref, objectRefApproxOffset); }
java
public static ArrayList<MtasTreeHit<?>> searchMtasTree(int position, IndexInput in, long ref, long objectRefApproxOffset) throws IOException { return searchMtasTree(position, position, in, ref, objectRefApproxOffset); }
[ "public", "static", "ArrayList", "<", "MtasTreeHit", "<", "?", ">", ">", "searchMtasTree", "(", "int", "position", ",", "IndexInput", "in", ",", "long", "ref", ",", "long", "objectRefApproxOffset", ")", "throws", "IOException", "{", "return", "searchMtasTree", ...
Search mtas tree. @param position the position @param in the in @param ref the ref @param objectRefApproxOffset the object ref approx offset @return the array list @throws IOException Signals that an I/O exception has occurred.
[ "Search", "mtas", "tree", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecSearchTree.java#L121-L124
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/collection/PdfCollectionField.java
PdfCollectionField.getValue
public PdfObject getValue(String v) { switch(fieldType) { case TEXT: return new PdfString(v, PdfObject.TEXT_UNICODE); case DATE: return new PdfDate(PdfDate.decode(v)); case NUMBER: return new PdfNumber(v); } throw new IllegalArgumentException(v + " is not an acceptable value for the field " + get(PdfName.N).toString()); }
java
public PdfObject getValue(String v) { switch(fieldType) { case TEXT: return new PdfString(v, PdfObject.TEXT_UNICODE); case DATE: return new PdfDate(PdfDate.decode(v)); case NUMBER: return new PdfNumber(v); } throw new IllegalArgumentException(v + " is not an acceptable value for the field " + get(PdfName.N).toString()); }
[ "public", "PdfObject", "getValue", "(", "String", "v", ")", "{", "switch", "(", "fieldType", ")", "{", "case", "TEXT", ":", "return", "new", "PdfString", "(", "v", ",", "PdfObject", ".", "TEXT_UNICODE", ")", ";", "case", "DATE", ":", "return", "new", "...
Returns a PdfObject that can be used as the value of a Collection Item. @param v value the value that has to be changed into a PdfObject (PdfString, PdfDate or PdfNumber)
[ "Returns", "a", "PdfObject", "that", "can", "be", "used", "as", "the", "value", "of", "a", "Collection", "Item", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/collection/PdfCollectionField.java#L118-L128
threerings/narya
core/src/main/java/com/threerings/crowd/chat/client/ChatDirector.java
ChatDirector.translatedReplacements
protected StringBuffer translatedReplacements (String key, StringBuffer buf) { MessageBundle bundle = _ctx.getMessageManager().getBundle(_bundle); if (!bundle.exists(key)) { return buf; } StringTokenizer st = new StringTokenizer(bundle.get(key), "#"); // apply the replacements to each mogrification that matches while (st.hasMoreTokens()) { String pattern = st.nextToken(); String replace = st.nextToken(); Matcher m = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE).matcher(buf); if (m.find()) { buf = new StringBuffer(); m.appendReplacement(buf, replace); // they may match more than once while (m.find()) { m.appendReplacement(buf, replace); } m.appendTail(buf); } } return buf; }
java
protected StringBuffer translatedReplacements (String key, StringBuffer buf) { MessageBundle bundle = _ctx.getMessageManager().getBundle(_bundle); if (!bundle.exists(key)) { return buf; } StringTokenizer st = new StringTokenizer(bundle.get(key), "#"); // apply the replacements to each mogrification that matches while (st.hasMoreTokens()) { String pattern = st.nextToken(); String replace = st.nextToken(); Matcher m = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE).matcher(buf); if (m.find()) { buf = new StringBuffer(); m.appendReplacement(buf, replace); // they may match more than once while (m.find()) { m.appendReplacement(buf, replace); } m.appendTail(buf); } } return buf; }
[ "protected", "StringBuffer", "translatedReplacements", "(", "String", "key", ",", "StringBuffer", "buf", ")", "{", "MessageBundle", "bundle", "=", "_ctx", ".", "getMessageManager", "(", ")", ".", "getBundle", "(", "_bundle", ")", ";", "if", "(", "!", "bundle",...
Do all the replacements (mogrifications) specified in the translation string specified by the key.
[ "Do", "all", "the", "replacements", "(", "mogrifications", ")", "specified", "in", "the", "translation", "string", "specified", "by", "the", "key", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/chat/client/ChatDirector.java#L943-L966
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalTime.java
LocalTime.withNano
public LocalTime withNano(int nanoOfSecond) { if (this.nano == nanoOfSecond) { return this; } NANO_OF_SECOND.checkValidValue(nanoOfSecond); return create(hour, minute, second, nanoOfSecond); }
java
public LocalTime withNano(int nanoOfSecond) { if (this.nano == nanoOfSecond) { return this; } NANO_OF_SECOND.checkValidValue(nanoOfSecond); return create(hour, minute, second, nanoOfSecond); }
[ "public", "LocalTime", "withNano", "(", "int", "nanoOfSecond", ")", "{", "if", "(", "this", ".", "nano", "==", "nanoOfSecond", ")", "{", "return", "this", ";", "}", "NANO_OF_SECOND", ".", "checkValidValue", "(", "nanoOfSecond", ")", ";", "return", "create", ...
Returns a copy of this {@code LocalTime} with the nano-of-second altered. <p> This instance is immutable and unaffected by this method call. @param nanoOfSecond the nano-of-second to set in the result, from 0 to 999,999,999 @return a {@code LocalTime} based on this time with the requested nanosecond, not null @throws DateTimeException if the nanos value is invalid
[ "Returns", "a", "copy", "of", "this", "{", "@code", "LocalTime", "}", "with", "the", "nano", "-", "of", "-", "second", "altered", ".", "<p", ">", "This", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "call", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalTime.java#L914-L920
mcxiaoke/Android-Next
core/src/main/java/com/mcxiaoke/next/utils/IOUtils.java
IOUtils.readFully
public static void readFully(Reader input, char[] buffer, int offset, int length) throws IOException { int actual = read(input, buffer, offset, length); if (actual != length) { throw new EOFException("Length to read: " + length + " actual: " + actual); } }
java
public static void readFully(Reader input, char[] buffer, int offset, int length) throws IOException { int actual = read(input, buffer, offset, length); if (actual != length) { throw new EOFException("Length to read: " + length + " actual: " + actual); } }
[ "public", "static", "void", "readFully", "(", "Reader", "input", ",", "char", "[", "]", "buffer", ",", "int", "offset", ",", "int", "length", ")", "throws", "IOException", "{", "int", "actual", "=", "read", "(", "input", ",", "buffer", ",", "offset", "...
Read the requested number of characters or fail if there are not enough left. <p/> This allows for the possibility that {@link Reader#read(char[], int, int)} may not read as many characters as requested (most likely because of reaching EOF). @param input where to read input from @param buffer destination @param offset inital offset into buffer @param length length to read, must be >= 0 @throws IOException if there is a problem reading the file @throws IllegalArgumentException if length is negative @throws EOFException if the number of characters read was incorrect @since 2.2
[ "Read", "the", "requested", "number", "of", "characters", "or", "fail", "if", "there", "are", "not", "enough", "left", ".", "<p", "/", ">", "This", "allows", "for", "the", "possibility", "that", "{", "@link", "Reader#read", "(", "char", "[]", "int", "int...
train
https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/core/src/main/java/com/mcxiaoke/next/utils/IOUtils.java#L991-L996
kiswanij/jk-util
src/main/java/com/jk/util/model/table/JKDefaultTableModel.java
JKDefaultTableModel.getValueAt
@Override public Object getValueAt(final int row, final int column) { final Vector rowVector = (Vector) this.dataVector.elementAt(row); return rowVector.elementAt(column); }
java
@Override public Object getValueAt(final int row, final int column) { final Vector rowVector = (Vector) this.dataVector.elementAt(row); return rowVector.elementAt(column); }
[ "@", "Override", "public", "Object", "getValueAt", "(", "final", "int", "row", ",", "final", "int", "column", ")", "{", "final", "Vector", "rowVector", "=", "(", "Vector", ")", "this", ".", "dataVector", ".", "elementAt", "(", "row", ")", ";", "return", ...
Returns an attribute value for the cell at <code>row</code> and <code>column</code>. @param row the row whose value is to be queried @param column the column whose value is to be queried @return the value Object at the specified cell @exception ArrayIndexOutOfBoundsException if an invalid row or column was given
[ "Returns", "an", "attribute", "value", "for", "the", "cell", "at", "<code", ">", "row<", "/", "code", ">", "and", "<code", ">", "column<", "/", "code", ">", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/model/table/JKDefaultTableModel.java#L409-L413
aws/aws-sdk-java
src/samples/AmazonEC2SpotInstances-Advanced/Requests.java
Requests.tagResources
private void tagResources(List<String> resources, List<Tag> tags) { // Create a tag request. CreateTagsRequest createTagsRequest = new CreateTagsRequest(); createTagsRequest.setResources(resources); createTagsRequest.setTags(tags); // Try to tag the Spot request submitted. try { ec2.createTags(createTagsRequest); } catch (AmazonServiceException e) { // Write out any exceptions that may have occurred. System.out.println("Error terminating instances"); System.out.println("Caught Exception: " + e.getMessage()); System.out.println("Reponse Status Code: " + e.getStatusCode()); System.out.println("Error Code: " + e.getErrorCode()); System.out.println("Request ID: " + e.getRequestId()); } }
java
private void tagResources(List<String> resources, List<Tag> tags) { // Create a tag request. CreateTagsRequest createTagsRequest = new CreateTagsRequest(); createTagsRequest.setResources(resources); createTagsRequest.setTags(tags); // Try to tag the Spot request submitted. try { ec2.createTags(createTagsRequest); } catch (AmazonServiceException e) { // Write out any exceptions that may have occurred. System.out.println("Error terminating instances"); System.out.println("Caught Exception: " + e.getMessage()); System.out.println("Reponse Status Code: " + e.getStatusCode()); System.out.println("Error Code: " + e.getErrorCode()); System.out.println("Request ID: " + e.getRequestId()); } }
[ "private", "void", "tagResources", "(", "List", "<", "String", ">", "resources", ",", "List", "<", "Tag", ">", "tags", ")", "{", "// Create a tag request.\r", "CreateTagsRequest", "createTagsRequest", "=", "new", "CreateTagsRequest", "(", ")", ";", "createTagsRequ...
Tag any of the resources we specify. @param resources @param tags
[ "Tag", "any", "of", "the", "resources", "we", "specify", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/src/samples/AmazonEC2SpotInstances-Advanced/Requests.java#L320-L338
OpenLiberty/open-liberty
dev/com.ibm.ws.rest.handler.validator.jca/src/com/ibm/ws/rest/handler/validator/jca/ConnectionFactoryValidator.java
ConnectionFactoryValidator.createConnectionSpec
@FFDCIgnore(Throwable.class) private ConnectionSpec createConnectionSpec(ConnectionFactory cciConFactory, String conSpecClassName, String userName, @Sensitive String password) { try { @SuppressWarnings("unchecked") Class<ConnectionSpec> conSpecClass = (Class<ConnectionSpec>) cciConFactory.getClass().getClassLoader().loadClass(conSpecClassName); ConnectionSpec conSpec = conSpecClass.newInstance(); conSpecClass.getMethod("setPassword", String.class).invoke(conSpec, password); conSpecClass.getMethod("setUserName", String.class).invoke(conSpec, userName); return conSpec; } catch (Throwable x) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Unable to create or populate ConnectionSpec", x.getMessage()); return null; } }
java
@FFDCIgnore(Throwable.class) private ConnectionSpec createConnectionSpec(ConnectionFactory cciConFactory, String conSpecClassName, String userName, @Sensitive String password) { try { @SuppressWarnings("unchecked") Class<ConnectionSpec> conSpecClass = (Class<ConnectionSpec>) cciConFactory.getClass().getClassLoader().loadClass(conSpecClassName); ConnectionSpec conSpec = conSpecClass.newInstance(); conSpecClass.getMethod("setPassword", String.class).invoke(conSpec, password); conSpecClass.getMethod("setUserName", String.class).invoke(conSpec, userName); return conSpec; } catch (Throwable x) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Unable to create or populate ConnectionSpec", x.getMessage()); return null; } }
[ "@", "FFDCIgnore", "(", "Throwable", ".", "class", ")", "private", "ConnectionSpec", "createConnectionSpec", "(", "ConnectionFactory", "cciConFactory", ",", "String", "conSpecClassName", ",", "String", "userName", ",", "@", "Sensitive", "String", "password", ")", "{...
Utility method that attempts to construct a ConnectionSpec impl of the specified name, which might or might not exist in the resource adapter. @param cciConFactory the connection factory class @param conSpecClassName possible connection spec impl class name to try @param userName user name to set on the connection spec @param password password to set on the connection spec @return ConnectionSpec instance if successful. Otherwise null.
[ "Utility", "method", "that", "attempts", "to", "construct", "a", "ConnectionSpec", "impl", "of", "the", "specified", "name", "which", "might", "or", "might", "not", "exist", "in", "the", "resource", "adapter", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.rest.handler.validator.jca/src/com/ibm/ws/rest/handler/validator/jca/ConnectionFactoryValidator.java#L69-L83
avianey/facebook-api-android-maven
facebook/src/main/java/com/facebook/AccessToken.java
AccessToken.createFromExistingAccessToken
public static AccessToken createFromExistingAccessToken(String accessToken, Date expirationTime, Date lastRefreshTime, AccessTokenSource accessTokenSource, List<String> permissions) { if (expirationTime == null) { expirationTime = DEFAULT_EXPIRATION_TIME; } if (lastRefreshTime == null) { lastRefreshTime = DEFAULT_LAST_REFRESH_TIME; } if (accessTokenSource == null) { accessTokenSource = DEFAULT_ACCESS_TOKEN_SOURCE; } return new AccessToken(accessToken, expirationTime, permissions, null, accessTokenSource, lastRefreshTime); }
java
public static AccessToken createFromExistingAccessToken(String accessToken, Date expirationTime, Date lastRefreshTime, AccessTokenSource accessTokenSource, List<String> permissions) { if (expirationTime == null) { expirationTime = DEFAULT_EXPIRATION_TIME; } if (lastRefreshTime == null) { lastRefreshTime = DEFAULT_LAST_REFRESH_TIME; } if (accessTokenSource == null) { accessTokenSource = DEFAULT_ACCESS_TOKEN_SOURCE; } return new AccessToken(accessToken, expirationTime, permissions, null, accessTokenSource, lastRefreshTime); }
[ "public", "static", "AccessToken", "createFromExistingAccessToken", "(", "String", "accessToken", ",", "Date", "expirationTime", ",", "Date", "lastRefreshTime", ",", "AccessTokenSource", "accessTokenSource", ",", "List", "<", "String", ">", "permissions", ")", "{", "i...
Creates a new AccessToken using the supplied information from a previously-obtained access token (for instance, from an already-cached access token obtained prior to integration with the Facebook SDK). @param accessToken the access token string obtained from Facebook @param expirationTime the expiration date associated with the token; if null, an infinite expiration time is assumed (but will become correct when the token is refreshed) @param lastRefreshTime the last time the token was refreshed (or when it was first obtained); if null, the current time is used. @param accessTokenSource an enum indicating how the token was originally obtained (in most cases, this will be either AccessTokenSource.FACEBOOK_APPLICATION or AccessTokenSource.WEB_VIEW); if null, FACEBOOK_APPLICATION is assumed. @param permissions the permissions that were requested when the token was obtained (or when it was last reauthorized); may be null if permission set is unknown @return a new AccessToken
[ "Creates", "a", "new", "AccessToken", "using", "the", "supplied", "information", "from", "a", "previously", "-", "obtained", "access", "token", "(", "for", "instance", "from", "an", "already", "-", "cached", "access", "token", "obtained", "prior", "to", "integ...
train
https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/AccessToken.java#L154-L167
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java
WSJdbcResultSet.updateArray
public void updateArray(int i, java.sql.Array array) throws SQLException { try { rsetImpl.updateArray(i, array); } catch (SQLException ex) { FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateArray", "3993", this); throw WSJdbcUtil.mapException(this, ex); } catch (NullPointerException nullX) { // No FFDC code needed; we might be closed. throw runtimeXIfNotClosed(nullX); } }
java
public void updateArray(int i, java.sql.Array array) throws SQLException { try { rsetImpl.updateArray(i, array); } catch (SQLException ex) { FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateArray", "3993", this); throw WSJdbcUtil.mapException(this, ex); } catch (NullPointerException nullX) { // No FFDC code needed; we might be closed. throw runtimeXIfNotClosed(nullX); } }
[ "public", "void", "updateArray", "(", "int", "i", ",", "java", ".", "sql", ".", "Array", "array", ")", "throws", "SQLException", "{", "try", "{", "rsetImpl", ".", "updateArray", "(", "i", ",", "array", ")", ";", "}", "catch", "(", "SQLException", "ex",...
<p>Updates the designated column with a java.sql.Array value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database. </p> @param columnIndex the first column is 1, the second is 2, ... @param array the new column value @exception SQLException If a database access error occurs
[ "<p", ">", "Updates", "the", "designated", "column", "with", "a", "java", ".", "sql", ".", "Array", "value", ".", "The", "updater", "methods", "are", "used", "to", "update", "column", "values", "in", "the", "current", "row", "or", "the", "insert", "row",...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L4567-L4578
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java
InstructionView.updateDistanceWith
public void updateDistanceWith(RouteProgress routeProgress) { if (routeProgress != null && !isRerouting) { InstructionModel model = new InstructionModel(distanceFormatter, routeProgress); updateDataFromInstruction(model); } }
java
public void updateDistanceWith(RouteProgress routeProgress) { if (routeProgress != null && !isRerouting) { InstructionModel model = new InstructionModel(distanceFormatter, routeProgress); updateDataFromInstruction(model); } }
[ "public", "void", "updateDistanceWith", "(", "RouteProgress", "routeProgress", ")", "{", "if", "(", "routeProgress", "!=", "null", "&&", "!", "isRerouting", ")", "{", "InstructionModel", "model", "=", "new", "InstructionModel", "(", "distanceFormatter", ",", "rout...
Use this method inside a {@link ProgressChangeListener} to update this view with all other information that is not updated by the {@link InstructionView#updateBannerInstructionsWith(Milestone)}. <p> This includes the distance remaining, instruction list, turn lanes, and next step information. @param routeProgress for route data used to populate the views @since 0.20.0
[ "Use", "this", "method", "inside", "a", "{", "@link", "ProgressChangeListener", "}", "to", "update", "this", "view", "with", "all", "other", "information", "that", "is", "not", "updated", "by", "the", "{", "@link", "InstructionView#updateBannerInstructionsWith", "...
train
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java#L229-L234
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/sc/scpolicy_stats.java
scpolicy_stats.get
public static scpolicy_stats get(nitro_service service, String name) throws Exception{ scpolicy_stats obj = new scpolicy_stats(); obj.set_name(name); scpolicy_stats response = (scpolicy_stats) obj.stat_resource(service); return response; }
java
public static scpolicy_stats get(nitro_service service, String name) throws Exception{ scpolicy_stats obj = new scpolicy_stats(); obj.set_name(name); scpolicy_stats response = (scpolicy_stats) obj.stat_resource(service); return response; }
[ "public", "static", "scpolicy_stats", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "scpolicy_stats", "obj", "=", "new", "scpolicy_stats", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "scpoli...
Use this API to fetch statistics of scpolicy_stats resource of given name .
[ "Use", "this", "API", "to", "fetch", "statistics", "of", "scpolicy_stats", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/sc/scpolicy_stats.java#L429-L434
aws/aws-sdk-java
aws-java-sdk-fms/src/main/java/com/amazonaws/services/fms/model/Policy.java
Policy.withIncludeMap
public Policy withIncludeMap(java.util.Map<String, java.util.List<String>> includeMap) { setIncludeMap(includeMap); return this; }
java
public Policy withIncludeMap(java.util.Map<String, java.util.List<String>> includeMap) { setIncludeMap(includeMap); return this; }
[ "public", "Policy", "withIncludeMap", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "java", ".", "util", ".", "List", "<", "String", ">", ">", "includeMap", ")", "{", "setIncludeMap", "(", "includeMap", ")", ";", "return", "this", ";", "}" ...
<p> Specifies the AWS account IDs to include in the policy. If <code>IncludeMap</code> is null, all accounts in the organization in AWS Organizations are included in the policy. If <code>IncludeMap</code> is not null, only values listed in <code>IncludeMap</code> are included in the policy. </p> <p> The key to the map is <code>ACCOUNT</code>. For example, a valid <code>IncludeMap</code> would be <code>{“ACCOUNT” : [“accountID1”, “accountID2”]}</code>. </p> @param includeMap Specifies the AWS account IDs to include in the policy. If <code>IncludeMap</code> is null, all accounts in the organization in AWS Organizations are included in the policy. If <code>IncludeMap</code> is not null, only values listed in <code>IncludeMap</code> are included in the policy.</p> <p> The key to the map is <code>ACCOUNT</code>. For example, a valid <code>IncludeMap</code> would be <code>{“ACCOUNT” : [“accountID1”, “accountID2”]}</code>. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Specifies", "the", "AWS", "account", "IDs", "to", "include", "in", "the", "policy", ".", "If", "<code", ">", "IncludeMap<", "/", "code", ">", "is", "null", "all", "accounts", "in", "the", "organization", "in", "AWS", "Organizations", "are", "...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-fms/src/main/java/com/amazonaws/services/fms/model/Policy.java#L681-L684
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
SearchManager.createQuery
public Query createQuery(SessionImpl session, SessionDataManager sessionDataManager, Node node) throws InvalidQueryException, RepositoryException { AbstractQueryImpl query = createQueryInstance(); query.init(session, sessionDataManager, handler, node); return query; }
java
public Query createQuery(SessionImpl session, SessionDataManager sessionDataManager, Node node) throws InvalidQueryException, RepositoryException { AbstractQueryImpl query = createQueryInstance(); query.init(session, sessionDataManager, handler, node); return query; }
[ "public", "Query", "createQuery", "(", "SessionImpl", "session", ",", "SessionDataManager", "sessionDataManager", ",", "Node", "node", ")", "throws", "InvalidQueryException", ",", "RepositoryException", "{", "AbstractQueryImpl", "query", "=", "createQueryInstance", "(", ...
Creates a query object from a node that can be executed on the workspace. @param session the session of the user executing the query. @param sessionDataManager the item manager of the user executing the query. Needed to return <code>Node</code> instances in the result set. @param node a node of type nt:query. @return a <code>Query</code> instance to execute. @throws InvalidQueryException if <code>absPath</code> is not a valid persisted query (that is, a node of type nt:query) @throws RepositoryException if any other error occurs.
[ "Creates", "a", "query", "object", "from", "a", "node", "that", "can", "be", "executed", "on", "the", "workspace", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java#L366-L372
alkacon/opencms-core
src-modules/org/opencms/workplace/CmsWidgetDialog.java
CmsWidgetDialog.createDialogRowsHtml
protected String createDialogRowsHtml(int startIndex, int endIndex) { StringBuffer result = new StringBuffer((endIndex - startIndex) * 8); for (int i = startIndex; i <= endIndex; i++) { CmsWidgetDialogParameter base = getWidgets().get(i); result.append(createDialogRowHtml(base)); } return result.toString(); }
java
protected String createDialogRowsHtml(int startIndex, int endIndex) { StringBuffer result = new StringBuffer((endIndex - startIndex) * 8); for (int i = startIndex; i <= endIndex; i++) { CmsWidgetDialogParameter base = getWidgets().get(i); result.append(createDialogRowHtml(base)); } return result.toString(); }
[ "protected", "String", "createDialogRowsHtml", "(", "int", "startIndex", ",", "int", "endIndex", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", "(", "endIndex", "-", "startIndex", ")", "*", "8", ")", ";", "for", "(", "int", "i", "=", ...
Creates the dialog widget rows HTML for the specified widget indices.<p> @param startIndex the widget index to start with @param endIndex the widget index to stop at @return the dialog widget rows HTML for the specified widget indices
[ "Creates", "the", "dialog", "widget", "rows", "HTML", "for", "the", "specified", "widget", "indices", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/CmsWidgetDialog.java#L1042-L1050
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.listCustomPrebuiltEntitiesAsync
public Observable<List<EntityExtractor>> listCustomPrebuiltEntitiesAsync(UUID appId, String versionId) { return listCustomPrebuiltEntitiesWithServiceResponseAsync(appId, versionId).map(new Func1<ServiceResponse<List<EntityExtractor>>, List<EntityExtractor>>() { @Override public List<EntityExtractor> call(ServiceResponse<List<EntityExtractor>> response) { return response.body(); } }); }
java
public Observable<List<EntityExtractor>> listCustomPrebuiltEntitiesAsync(UUID appId, String versionId) { return listCustomPrebuiltEntitiesWithServiceResponseAsync(appId, versionId).map(new Func1<ServiceResponse<List<EntityExtractor>>, List<EntityExtractor>>() { @Override public List<EntityExtractor> call(ServiceResponse<List<EntityExtractor>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "EntityExtractor", ">", ">", "listCustomPrebuiltEntitiesAsync", "(", "UUID", "appId", ",", "String", "versionId", ")", "{", "return", "listCustomPrebuiltEntitiesWithServiceResponseAsync", "(", "appId", ",", "versionId", ")", "...
Gets all custom prebuilt entities information of this application. @param appId The application ID. @param versionId The version ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;EntityExtractor&gt; object
[ "Gets", "all", "custom", "prebuilt", "entities", "information", "of", "this", "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#L6005-L6012
gitblit/fathom
fathom-x509/src/main/java/fathom/x509/X509Utils.java
X509Utils.newCertificateRevocationList
public static void newCertificateRevocationList(File caRevocationList, File caKeystoreFile, String caKeystorePassword) { try { // read the Fathom CA key and certificate KeyStore store = openKeyStore(caKeystoreFile, caKeystorePassword); PrivateKey caPrivateKey = (PrivateKey) store.getKey(CA_ALIAS, caKeystorePassword.toCharArray()); X509Certificate caCert = (X509Certificate) store.getCertificate(CA_ALIAS); X500Name issuerDN = new X500Name(PrincipalUtil.getIssuerX509Principal(caCert).getName()); X509v2CRLBuilder crlBuilder = new X509v2CRLBuilder(issuerDN, new Date()); // build and sign CRL with CA private key ContentSigner signer = new JcaContentSignerBuilder(SIGNING_ALGORITHM).setProvider(BC).build(caPrivateKey); X509CRLHolder crl = crlBuilder.build(signer); File tmpFile = new File(caRevocationList.getParentFile(), Long.toHexString(System.currentTimeMillis()) + ".tmp"); FileOutputStream fos = null; try { fos = new FileOutputStream(tmpFile); fos.write(crl.getEncoded()); fos.flush(); fos.close(); if (caRevocationList.exists()) { caRevocationList.delete(); } tmpFile.renameTo(caRevocationList); } finally { if (fos != null) { fos.close(); } if (tmpFile.exists()) { tmpFile.delete(); } } } catch (Exception e) { throw new RuntimeException("Failed to create new certificate revocation list " + caRevocationList, e); } }
java
public static void newCertificateRevocationList(File caRevocationList, File caKeystoreFile, String caKeystorePassword) { try { // read the Fathom CA key and certificate KeyStore store = openKeyStore(caKeystoreFile, caKeystorePassword); PrivateKey caPrivateKey = (PrivateKey) store.getKey(CA_ALIAS, caKeystorePassword.toCharArray()); X509Certificate caCert = (X509Certificate) store.getCertificate(CA_ALIAS); X500Name issuerDN = new X500Name(PrincipalUtil.getIssuerX509Principal(caCert).getName()); X509v2CRLBuilder crlBuilder = new X509v2CRLBuilder(issuerDN, new Date()); // build and sign CRL with CA private key ContentSigner signer = new JcaContentSignerBuilder(SIGNING_ALGORITHM).setProvider(BC).build(caPrivateKey); X509CRLHolder crl = crlBuilder.build(signer); File tmpFile = new File(caRevocationList.getParentFile(), Long.toHexString(System.currentTimeMillis()) + ".tmp"); FileOutputStream fos = null; try { fos = new FileOutputStream(tmpFile); fos.write(crl.getEncoded()); fos.flush(); fos.close(); if (caRevocationList.exists()) { caRevocationList.delete(); } tmpFile.renameTo(caRevocationList); } finally { if (fos != null) { fos.close(); } if (tmpFile.exists()) { tmpFile.delete(); } } } catch (Exception e) { throw new RuntimeException("Failed to create new certificate revocation list " + caRevocationList, e); } }
[ "public", "static", "void", "newCertificateRevocationList", "(", "File", "caRevocationList", ",", "File", "caKeystoreFile", ",", "String", "caKeystorePassword", ")", "{", "try", "{", "// read the Fathom CA key and certificate", "KeyStore", "store", "=", "openKeyStore", "(...
Creates a new certificate revocation list (CRL). This function will destroy any existing CRL file. @param caRevocationList @param caKeystoreFile @param caKeystorePassword @return
[ "Creates", "a", "new", "certificate", "revocation", "list", "(", "CRL", ")", ".", "This", "function", "will", "destroy", "any", "existing", "CRL", "file", "." ]
train
https://github.com/gitblit/fathom/blob/f2f820eb16e9fea1e36ad4eda4ed51b35f056538/fathom-x509/src/main/java/fathom/x509/X509Utils.java#L669-L705
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java
ResourcesInner.deleteById
public void deleteById(String resourceId, String apiVersion) { deleteByIdWithServiceResponseAsync(resourceId, apiVersion).toBlocking().last().body(); }
java
public void deleteById(String resourceId, String apiVersion) { deleteByIdWithServiceResponseAsync(resourceId, apiVersion).toBlocking().last().body(); }
[ "public", "void", "deleteById", "(", "String", "resourceId", ",", "String", "apiVersion", ")", "{", "deleteByIdWithServiceResponseAsync", "(", "resourceId", ",", "apiVersion", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";...
Deletes a resource by ID. @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} @param apiVersion The API version to use for the operation. @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
[ "Deletes", "a", "resource", "by", "ID", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L1925-L1927
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/SerializeInterceptor.java
SerializeInterceptor.getImageContent
private byte[] getImageContent(InputStream in, String mime) throws FMSException { byte[] imageInByte = null; ByteArrayOutputStream baos = null; try { BufferedImage originalImage = ImageIO.read(in); baos = new ByteArrayOutputStream(); ImageIO.write(originalImage, mime, baos); baos.flush(); imageInByte = baos.toByteArray(); baos.close(); } catch (IOException e) { throw new FMSException("Error while reading the upload file.", e); } finally { close(baos); close(in); } return imageInByte; }
java
private byte[] getImageContent(InputStream in, String mime) throws FMSException { byte[] imageInByte = null; ByteArrayOutputStream baos = null; try { BufferedImage originalImage = ImageIO.read(in); baos = new ByteArrayOutputStream(); ImageIO.write(originalImage, mime, baos); baos.flush(); imageInByte = baos.toByteArray(); baos.close(); } catch (IOException e) { throw new FMSException("Error while reading the upload file.", e); } finally { close(baos); close(in); } return imageInByte; }
[ "private", "byte", "[", "]", "getImageContent", "(", "InputStream", "in", ",", "String", "mime", ")", "throws", "FMSException", "{", "byte", "[", "]", "imageInByte", "=", "null", ";", "ByteArrayOutputStream", "baos", "=", "null", ";", "try", "{", "BufferedIm...
Method to return the byte[] value of the given image input stream @param in the input stream @param mime the mime type of the file @return byte[] the file content @throws FMSException
[ "Method", "to", "return", "the", "byte", "[]", "value", "of", "the", "given", "image", "input", "stream" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/SerializeInterceptor.java#L161-L178
CloudSlang/cs-actions
cs-vmware/src/main/java/io/cloudslang/content/vmware/services/VmService.java
VmService.updateVM
public Map<String, String> updateVM(HttpInputs httpInputs, VmInputs vmInputs) throws Exception { ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs); try { ManagedObjectReference vmMor = new MorObjectHandler().getMor(connectionResources, ManagedObjectType.VIRTUAL_MACHINE.getValue(), vmInputs.getVirtualMachineName()); if (vmMor != null) { VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec(); String device = Device.getValue(vmInputs.getDevice()).toLowerCase(); if (Constants.CPU.equalsIgnoreCase(device) || Constants.MEMORY.equalsIgnoreCase(device)) { vmConfigSpec = new VmUtils().getUpdateConfigSpec(vmInputs, vmConfigSpec, device); } else { vmConfigSpec = new VmUtils().getAddOrRemoveSpecs(connectionResources, vmMor, vmInputs, vmConfigSpec, device); } ManagedObjectReference task = connectionResources.getVimPortType().reconfigVMTask(vmMor, vmConfigSpec); return new ResponseHelper(connectionResources, task).getResultsMap("Success: The [" + vmInputs.getVirtualMachineName() + "] VM was successfully reconfigured. The taskId is: " + task.getValue(), "Failure: The [" + vmInputs.getVirtualMachineName() + "] VM could not be reconfigured."); } else { return ResponseUtils.getVmNotFoundResultsMap(vmInputs); } } catch (Exception ex) { return ResponseUtils.getResultsMap(ex.toString(), Outputs.RETURN_CODE_FAILURE); } finally { if (httpInputs.isCloseSession()) { connectionResources.getConnection().disconnect(); clearConnectionFromContext(httpInputs.getGlobalSessionObject()); } } }
java
public Map<String, String> updateVM(HttpInputs httpInputs, VmInputs vmInputs) throws Exception { ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs); try { ManagedObjectReference vmMor = new MorObjectHandler().getMor(connectionResources, ManagedObjectType.VIRTUAL_MACHINE.getValue(), vmInputs.getVirtualMachineName()); if (vmMor != null) { VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec(); String device = Device.getValue(vmInputs.getDevice()).toLowerCase(); if (Constants.CPU.equalsIgnoreCase(device) || Constants.MEMORY.equalsIgnoreCase(device)) { vmConfigSpec = new VmUtils().getUpdateConfigSpec(vmInputs, vmConfigSpec, device); } else { vmConfigSpec = new VmUtils().getAddOrRemoveSpecs(connectionResources, vmMor, vmInputs, vmConfigSpec, device); } ManagedObjectReference task = connectionResources.getVimPortType().reconfigVMTask(vmMor, vmConfigSpec); return new ResponseHelper(connectionResources, task).getResultsMap("Success: The [" + vmInputs.getVirtualMachineName() + "] VM was successfully reconfigured. The taskId is: " + task.getValue(), "Failure: The [" + vmInputs.getVirtualMachineName() + "] VM could not be reconfigured."); } else { return ResponseUtils.getVmNotFoundResultsMap(vmInputs); } } catch (Exception ex) { return ResponseUtils.getResultsMap(ex.toString(), Outputs.RETURN_CODE_FAILURE); } finally { if (httpInputs.isCloseSession()) { connectionResources.getConnection().disconnect(); clearConnectionFromContext(httpInputs.getGlobalSessionObject()); } } }
[ "public", "Map", "<", "String", ",", "String", ">", "updateVM", "(", "HttpInputs", "httpInputs", ",", "VmInputs", "vmInputs", ")", "throws", "Exception", "{", "ConnectionResources", "connectionResources", "=", "new", "ConnectionResources", "(", "httpInputs", ",", ...
Method used to connect to data center to update existing devices of a virtual machine identified by the inputs provided. @param httpInputs Object that has all the inputs necessary to made a connection to data center @param vmInputs Object that has all the specific inputs necessary to identify the targeted device @return Map with String as key and value that contains returnCode of the operation, success message with task id of the execution or failure message and the exception if there is one @throws Exception
[ "Method", "used", "to", "connect", "to", "data", "center", "to", "update", "existing", "devices", "of", "a", "virtual", "machine", "identified", "by", "the", "inputs", "provided", "." ]
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-vmware/src/main/java/io/cloudslang/content/vmware/services/VmService.java#L295-L325
google/closure-templates
java/src/com/google/template/soy/jbcsrc/runtime/JbcSrcRuntime.java
JbcSrcRuntime.applyEscapers
public static CompiledTemplate applyEscapers( CompiledTemplate delegate, ImmutableList<SoyJavaPrintDirective> directives) { ContentKind kind = delegate.kind(); if (canSkipEscaping(directives, kind)) { return delegate; } return new EscapedCompiledTemplate(delegate, directives, kind); }
java
public static CompiledTemplate applyEscapers( CompiledTemplate delegate, ImmutableList<SoyJavaPrintDirective> directives) { ContentKind kind = delegate.kind(); if (canSkipEscaping(directives, kind)) { return delegate; } return new EscapedCompiledTemplate(delegate, directives, kind); }
[ "public", "static", "CompiledTemplate", "applyEscapers", "(", "CompiledTemplate", "delegate", ",", "ImmutableList", "<", "SoyJavaPrintDirective", ">", "directives", ")", "{", "ContentKind", "kind", "=", "delegate", ".", "kind", "(", ")", ";", "if", "(", "canSkipEs...
Wraps a given template with a collection of escapers to apply. @param delegate The delegate template to render @param directives The set of directives to apply
[ "Wraps", "a", "given", "template", "with", "a", "collection", "of", "escapers", "to", "apply", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/runtime/JbcSrcRuntime.java#L242-L249
iron-io/iron_mq_java
src/main/java/io/iron/ironmq/Queue.java
Queue.deleteMessage
public void deleteMessage(String id, String reservationId, String subscriberName) throws IOException { String payload = gson.toJson(new SubscribedMessageOptions(reservationId, subscriberName)); IronReader reader = client.delete("queues/" + name + "/messages/" + id, payload); reader.close(); }
java
public void deleteMessage(String id, String reservationId, String subscriberName) throws IOException { String payload = gson.toJson(new SubscribedMessageOptions(reservationId, subscriberName)); IronReader reader = client.delete("queues/" + name + "/messages/" + id, payload); reader.close(); }
[ "public", "void", "deleteMessage", "(", "String", "id", ",", "String", "reservationId", ",", "String", "subscriberName", ")", "throws", "IOException", "{", "String", "payload", "=", "gson", ".", "toJson", "(", "new", "SubscribedMessageOptions", "(", "reservationId...
Deletes a Message from the queue. @param id The ID of the message to delete. @param reservationId Reservation Id of the message. Reserved message could not be deleted without reservation Id. @throws io.iron.ironmq.HTTPException If the IronMQ service returns a status other than 200 OK. @throws java.io.IOException If there is an error accessing the IronMQ server.
[ "Deletes", "a", "Message", "from", "the", "queue", "." ]
train
https://github.com/iron-io/iron_mq_java/blob/62d6a86545ca7ef31b7b4797aae0c5b31394a507/src/main/java/io/iron/ironmq/Queue.java#L294-L298
Azure/azure-sdk-for-java
authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentsInner.java
RoleAssignmentsInner.listByResourceGroupAsync
public Observable<Page<RoleAssignmentInner>> listByResourceGroupAsync(final String resourceGroupName, final String filter) { return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter) .map(new Func1<ServiceResponse<Page<RoleAssignmentInner>>, Page<RoleAssignmentInner>>() { @Override public Page<RoleAssignmentInner> call(ServiceResponse<Page<RoleAssignmentInner>> response) { return response.body(); } }); }
java
public Observable<Page<RoleAssignmentInner>> listByResourceGroupAsync(final String resourceGroupName, final String filter) { return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter) .map(new Func1<ServiceResponse<Page<RoleAssignmentInner>>, Page<RoleAssignmentInner>>() { @Override public Page<RoleAssignmentInner> call(ServiceResponse<Page<RoleAssignmentInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "RoleAssignmentInner", ">", ">", "listByResourceGroupAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "filter", ")", "{", "return", "listByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName...
Gets role assignments for a resource group. @param resourceGroupName The name of the resource group. @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;RoleAssignmentInner&gt; object
[ "Gets", "role", "assignments", "for", "a", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentsInner.java#L577-L585
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/UIContextImpl.java
UIContextImpl.setFwkAttribute
@Override public void setFwkAttribute(final String name, final Object value) { if (attribMap == null) { attribMap = new HashMap<>(); } attribMap.put(name, value); }
java
@Override public void setFwkAttribute(final String name, final Object value) { if (attribMap == null) { attribMap = new HashMap<>(); } attribMap.put(name, value); }
[ "@", "Override", "public", "void", "setFwkAttribute", "(", "final", "String", "name", ",", "final", "Object", "value", ")", "{", "if", "(", "attribMap", "==", "null", ")", "{", "attribMap", "=", "new", "HashMap", "<>", "(", ")", ";", "}", "attribMap", ...
Reserved for internal framework use. Sets a framework attribute. @param name the attribute name. @param value the attribute value.
[ "Reserved", "for", "internal", "framework", "use", ".", "Sets", "a", "framework", "attribute", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/UIContextImpl.java#L360-L367
windup/windup
reporting/api/src/main/java/org/jboss/windup/reporting/service/ClassificationService.java
ClassificationService.attachLink
public ClassificationModel attachLink(ClassificationModel classificationModel, LinkModel linkModel) { for (LinkModel existing : classificationModel.getLinks()) { if (StringUtils.equals(existing.getLink(), linkModel.getLink())) { return classificationModel; } } classificationModel.addLink(linkModel); return classificationModel; }
java
public ClassificationModel attachLink(ClassificationModel classificationModel, LinkModel linkModel) { for (LinkModel existing : classificationModel.getLinks()) { if (StringUtils.equals(existing.getLink(), linkModel.getLink())) { return classificationModel; } } classificationModel.addLink(linkModel); return classificationModel; }
[ "public", "ClassificationModel", "attachLink", "(", "ClassificationModel", "classificationModel", ",", "LinkModel", "linkModel", ")", "{", "for", "(", "LinkModel", "existing", ":", "classificationModel", ".", "getLinks", "(", ")", ")", "{", "if", "(", "StringUtils",...
Attach the given link to the classification, while checking for duplicates.
[ "Attach", "the", "given", "link", "to", "the", "classification", "while", "checking", "for", "duplicates", "." ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/reporting/api/src/main/java/org/jboss/windup/reporting/service/ClassificationService.java#L317-L328
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/MachineTypeId.java
MachineTypeId.of
public static MachineTypeId of(String project, String zone, String type) { return new MachineTypeId(project, zone, type); }
java
public static MachineTypeId of(String project, String zone, String type) { return new MachineTypeId(project, zone, type); }
[ "public", "static", "MachineTypeId", "of", "(", "String", "project", ",", "String", "zone", ",", "String", "type", ")", "{", "return", "new", "MachineTypeId", "(", "project", ",", "zone", ",", "type", ")", ";", "}" ]
Returns a machine type identity given project, zone and type names.
[ "Returns", "a", "machine", "type", "identity", "given", "project", "zone", "and", "type", "names", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/MachineTypeId.java#L116-L118
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/authentication/authenticationldappolicy_binding.java
authenticationldappolicy_binding.get
public static authenticationldappolicy_binding get(nitro_service service, String name) throws Exception{ authenticationldappolicy_binding obj = new authenticationldappolicy_binding(); obj.set_name(name); authenticationldappolicy_binding response = (authenticationldappolicy_binding) obj.get_resource(service); return response; }
java
public static authenticationldappolicy_binding get(nitro_service service, String name) throws Exception{ authenticationldappolicy_binding obj = new authenticationldappolicy_binding(); obj.set_name(name); authenticationldappolicy_binding response = (authenticationldappolicy_binding) obj.get_resource(service); return response; }
[ "public", "static", "authenticationldappolicy_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "authenticationldappolicy_binding", "obj", "=", "new", "authenticationldappolicy_binding", "(", ")", ";", "obj", ".", ...
Use this API to fetch authenticationldappolicy_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "authenticationldappolicy_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/authentication/authenticationldappolicy_binding.java#L136-L141
linkedin/PalDB
paldb/src/main/java/com/linkedin/paldb/utils/TempUtils.java
TempUtils.createTempDir
public static File createTempDir(String prefix) { File baseDir = new File(System.getProperty("java.io.tmpdir")); String baseName = prefix + System.currentTimeMillis() + "-"; for (int counter = 0; counter < 10000; counter++) { File tempDir = new File(baseDir, baseName + counter); if (tempDir.mkdir()) { return tempDir; } } throw new IllegalStateException( "Failed to create directory within " + 10000 + " attempts (tried " + baseName + "0 to " + baseName + (10000 - 1) + ')'); }
java
public static File createTempDir(String prefix) { File baseDir = new File(System.getProperty("java.io.tmpdir")); String baseName = prefix + System.currentTimeMillis() + "-"; for (int counter = 0; counter < 10000; counter++) { File tempDir = new File(baseDir, baseName + counter); if (tempDir.mkdir()) { return tempDir; } } throw new IllegalStateException( "Failed to create directory within " + 10000 + " attempts (tried " + baseName + "0 to " + baseName + (10000 - 1) + ')'); }
[ "public", "static", "File", "createTempDir", "(", "String", "prefix", ")", "{", "File", "baseDir", "=", "new", "File", "(", "System", ".", "getProperty", "(", "\"java.io.tmpdir\"", ")", ")", ";", "String", "baseName", "=", "prefix", "+", "System", ".", "cu...
Creates a temporary directory prefixed with <code>prefix</code>. @param prefix folder prefix @return temporary folder
[ "Creates", "a", "temporary", "directory", "prefixed", "with", "<code", ">", "prefix<", "/", "code", ">", "." ]
train
https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/utils/TempUtils.java#L41-L54
roboconf/roboconf-platform
core/roboconf-plugin-script/src/main/java/net/roboconf/plugin/script/internal/templating/InstanceTemplateHelper.java
InstanceTemplateHelper.injectInstanceImports
public static void injectInstanceImports(Instance instance, String templateFilePath, Writer writer) throws IOException { injectInstanceImports(instance, new File( templateFilePath ), writer); }
java
public static void injectInstanceImports(Instance instance, String templateFilePath, Writer writer) throws IOException { injectInstanceImports(instance, new File( templateFilePath ), writer); }
[ "public", "static", "void", "injectInstanceImports", "(", "Instance", "instance", ",", "String", "templateFilePath", ",", "Writer", "writer", ")", "throws", "IOException", "{", "injectInstanceImports", "(", "instance", ",", "new", "File", "(", "templateFilePath", ")...
Reads the import values of the instances and injects them into the template file. <p> See test resources to see the associated way to write templates </p> @param instance the instance whose imports must be injected @param templateFilePath the path of the template file @param writer a writer @throws IOException if something went wrong
[ "Reads", "the", "import", "values", "of", "the", "instances", "and", "injects", "them", "into", "the", "template", "file", ".", "<p", ">", "See", "test", "resources", "to", "see", "the", "associated", "way", "to", "write", "templates", "<", "/", "p", ">"...
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-plugin-script/src/main/java/net/roboconf/plugin/script/internal/templating/InstanceTemplateHelper.java#L88-L91
Azure/azure-sdk-for-java
redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java
RedisInner.createAsync
public Observable<RedisResourceInner> createAsync(String resourceGroupName, String name, RedisCreateParameters parameters) { return createWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1<ServiceResponse<RedisResourceInner>, RedisResourceInner>() { @Override public RedisResourceInner call(ServiceResponse<RedisResourceInner> response) { return response.body(); } }); }
java
public Observable<RedisResourceInner> createAsync(String resourceGroupName, String name, RedisCreateParameters parameters) { return createWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1<ServiceResponse<RedisResourceInner>, RedisResourceInner>() { @Override public RedisResourceInner call(ServiceResponse<RedisResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RedisResourceInner", ">", "createAsync", "(", "String", "resourceGroupName", ",", "String", "name", ",", "RedisCreateParameters", "parameters", ")", "{", "return", "createWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ","...
Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. @param resourceGroupName The name of the resource group. @param name The name of the Redis cache. @param parameters Parameters supplied to the Create Redis operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Create", "or", "replace", "(", "overwrite", "/", "recreate", "with", "potential", "downtime", ")", "an", "existing", "Redis", "cache", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java#L362-L369
alkacon/opencms-core
src/org/opencms/search/documents/CmsDocumentXmlContent.java
CmsDocumentXmlContent.extractContent
public I_CmsExtractionResult extractContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index) throws CmsException { logContentExtraction(resource, index); try { CmsFile file = readFile(cms, resource); A_CmsXmlDocument xmlContent = CmsXmlContentFactory.unmarshal(cms, file); I_CmsXmlContentHandler handler = xmlContent.getHandler(); Locale locale = index.getLocaleForResource(cms, resource, xmlContent.getLocales()); List<String> elements = xmlContent.getNames(locale); StringBuffer content = new StringBuffer(); LinkedHashMap<String, String> items = new LinkedHashMap<String, String>(); for (Iterator<String> i = elements.iterator(); i.hasNext();) { String xpath = i.next(); // xpath will have the form "Text[1]" or "Nested[1]/Text[1]" I_CmsXmlContentValue value = xmlContent.getValue(xpath, locale); if (handler.isSearchable(value)) { // the content value is searchable String extracted = value.getPlainText(cms); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(extracted)) { items.put(xpath, extracted); content.append(extracted); content.append('\n'); } } } return new CmsExtractionResult(content.toString(), items); } catch (Exception e) { throw new CmsIndexException( Messages.get().container(Messages.ERR_TEXT_EXTRACTION_1, resource.getRootPath()), e); } }
java
public I_CmsExtractionResult extractContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index) throws CmsException { logContentExtraction(resource, index); try { CmsFile file = readFile(cms, resource); A_CmsXmlDocument xmlContent = CmsXmlContentFactory.unmarshal(cms, file); I_CmsXmlContentHandler handler = xmlContent.getHandler(); Locale locale = index.getLocaleForResource(cms, resource, xmlContent.getLocales()); List<String> elements = xmlContent.getNames(locale); StringBuffer content = new StringBuffer(); LinkedHashMap<String, String> items = new LinkedHashMap<String, String>(); for (Iterator<String> i = elements.iterator(); i.hasNext();) { String xpath = i.next(); // xpath will have the form "Text[1]" or "Nested[1]/Text[1]" I_CmsXmlContentValue value = xmlContent.getValue(xpath, locale); if (handler.isSearchable(value)) { // the content value is searchable String extracted = value.getPlainText(cms); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(extracted)) { items.put(xpath, extracted); content.append(extracted); content.append('\n'); } } } return new CmsExtractionResult(content.toString(), items); } catch (Exception e) { throw new CmsIndexException( Messages.get().container(Messages.ERR_TEXT_EXTRACTION_1, resource.getRootPath()), e); } }
[ "public", "I_CmsExtractionResult", "extractContent", "(", "CmsObject", "cms", ",", "CmsResource", "resource", ",", "I_CmsSearchIndex", "index", ")", "throws", "CmsException", "{", "logContentExtraction", "(", "resource", ",", "index", ")", ";", "try", "{", "CmsFile"...
Returns the raw text content of a given VFS resource of type <code>CmsResourceTypeXmlContent</code>.<p> All XML nodes from the content for all locales will be stored separately in the item map which you can access using {@link CmsExtractionResult#getContentItems()}. The XML elements will be accessible using their xpath. The xpath will have the form like for example <code>Text[1]</code> or <code>Nested[1]/Text[1]</code>.<p> @see org.opencms.search.documents.I_CmsSearchExtractor#extractContent(CmsObject, CmsResource, I_CmsSearchIndex)
[ "Returns", "the", "raw", "text", "content", "of", "a", "given", "VFS", "resource", "of", "type", "<code", ">", "CmsResourceTypeXmlContent<", "/", "code", ">", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/documents/CmsDocumentXmlContent.java#L103-L135
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/CmsEditorBase.java
CmsEditorBase.saveEntities
public void saveEntities(Set<String> entityIds, boolean clearOnSuccess, Command callback) { List<CmsEntity> entities = new ArrayList<CmsEntity>(); for (String entityId : entityIds) { CmsEntity entity = m_entityBackend.getEntity(entityId); if (entity != null) { entities.add(entity); } } saveEntities(entities, clearOnSuccess, callback); }
java
public void saveEntities(Set<String> entityIds, boolean clearOnSuccess, Command callback) { List<CmsEntity> entities = new ArrayList<CmsEntity>(); for (String entityId : entityIds) { CmsEntity entity = m_entityBackend.getEntity(entityId); if (entity != null) { entities.add(entity); } } saveEntities(entities, clearOnSuccess, callback); }
[ "public", "void", "saveEntities", "(", "Set", "<", "String", ">", "entityIds", ",", "boolean", "clearOnSuccess", ",", "Command", "callback", ")", "{", "List", "<", "CmsEntity", ">", "entities", "=", "new", "ArrayList", "<", "CmsEntity", ">", "(", ")", ";",...
Saves the given entity.<p> @param entityIds the entity ids @param clearOnSuccess <code>true</code> to clear all entities from entity back-end on success @param callback the callback executed on success
[ "Saves", "the", "given", "entity", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsEditorBase.java#L537-L547
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FileSystem.java
FileSystem.newInstance
public static FileSystem newInstance(URI uri, Configuration conf) throws IOException { String scheme = uri.getScheme(); String authority = uri.getAuthority(); if (scheme == null) { // no scheme: use default FS return newInstance(conf); } if (authority == null) { // no authority URI defaultUri = getDefaultUri(conf); if (scheme.equals(defaultUri.getScheme()) // if scheme matches default && defaultUri.getAuthority() != null) { // & default has authority return newInstance(defaultUri, conf); // return default } } return CACHE.getUnique(uri, conf); }
java
public static FileSystem newInstance(URI uri, Configuration conf) throws IOException { String scheme = uri.getScheme(); String authority = uri.getAuthority(); if (scheme == null) { // no scheme: use default FS return newInstance(conf); } if (authority == null) { // no authority URI defaultUri = getDefaultUri(conf); if (scheme.equals(defaultUri.getScheme()) // if scheme matches default && defaultUri.getAuthority() != null) { // & default has authority return newInstance(defaultUri, conf); // return default } } return CACHE.getUnique(uri, conf); }
[ "public", "static", "FileSystem", "newInstance", "(", "URI", "uri", ",", "Configuration", "conf", ")", "throws", "IOException", "{", "String", "scheme", "=", "uri", ".", "getScheme", "(", ")", ";", "String", "authority", "=", "uri", ".", "getAuthority", "(",...
Returns the FileSystem for this URI's scheme and authority. The scheme of the URI determines a configuration property name, <tt>fs.<i>scheme</i>.class</tt> whose value names the FileSystem class. The entire URI is passed to the FileSystem instance's initialize method. This always returns a new FileSystem object.
[ "Returns", "the", "FileSystem", "for", "this", "URI", "s", "scheme", "and", "authority", ".", "The", "scheme", "of", "the", "URI", "determines", "a", "configuration", "property", "name", "<tt", ">", "fs", ".", "<i", ">", "scheme<", "/", "i", ">", ".", ...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L219-L235
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java
FlashImpl._createFlashCookie
private Cookie _createFlashCookie(String name, String value, ExternalContext externalContext) { Cookie cookie = new Cookie(name, value); cookie.setMaxAge(-1); cookie.setPath(_getCookiePath(externalContext)); cookie.setSecure(externalContext.isSecure()); //cookie.setHttpOnly(true); if (ServletSpecifications.isServlet30Available()) { _Servlet30Utils.setCookieHttpOnly(cookie, true); } return cookie; }
java
private Cookie _createFlashCookie(String name, String value, ExternalContext externalContext) { Cookie cookie = new Cookie(name, value); cookie.setMaxAge(-1); cookie.setPath(_getCookiePath(externalContext)); cookie.setSecure(externalContext.isSecure()); //cookie.setHttpOnly(true); if (ServletSpecifications.isServlet30Available()) { _Servlet30Utils.setCookieHttpOnly(cookie, true); } return cookie; }
[ "private", "Cookie", "_createFlashCookie", "(", "String", "name", ",", "String", "value", ",", "ExternalContext", "externalContext", ")", "{", "Cookie", "cookie", "=", "new", "Cookie", "(", "name", ",", "value", ")", ";", "cookie", ".", "setMaxAge", "(", "-"...
Creates a Cookie with the given name and value. In addition, it will be configured with maxAge=-1, the current request path and secure value. @param name @param value @param externalContext @return
[ "Creates", "a", "Cookie", "with", "the", "given", "name", "and", "value", ".", "In", "addition", "it", "will", "be", "configured", "with", "maxAge", "=", "-", "1", "the", "current", "request", "path", "and", "secure", "value", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java#L1177-L1190
sagiegurari/fax4j
src/main/java/org/fax4j/spi/FaxClientSpiFactory.java
FaxClientSpiFactory.createFaxJobMonitor
private static FaxJobMonitor createFaxJobMonitor(Map<String,String> systemConfig) { //get class name String className=systemConfig.get(FaxClientSpiFactory.FAX_JOB_MONITOR_CLASS_NAME_PROPERTY_KEY); if((className==null)||(className.length()==0)) { className=FaxJobMonitorImpl.class.getName(); } //create new instance FaxJobMonitor faxJobMonitorInstance=(FaxJobMonitor)ReflectionHelper.createInstance(className); return faxJobMonitorInstance; }
java
private static FaxJobMonitor createFaxJobMonitor(Map<String,String> systemConfig) { //get class name String className=systemConfig.get(FaxClientSpiFactory.FAX_JOB_MONITOR_CLASS_NAME_PROPERTY_KEY); if((className==null)||(className.length()==0)) { className=FaxJobMonitorImpl.class.getName(); } //create new instance FaxJobMonitor faxJobMonitorInstance=(FaxJobMonitor)ReflectionHelper.createInstance(className); return faxJobMonitorInstance; }
[ "private", "static", "FaxJobMonitor", "createFaxJobMonitor", "(", "Map", "<", "String", ",", "String", ">", "systemConfig", ")", "{", "//get class name", "String", "className", "=", "systemConfig", ".", "get", "(", "FaxClientSpiFactory", ".", "FAX_JOB_MONITOR_CLASS_NA...
This function creates the fax job monitor used by the fax4j framework. @param systemConfig The system configuration @return The logger
[ "This", "function", "creates", "the", "fax", "job", "monitor", "used", "by", "the", "fax4j", "framework", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/FaxClientSpiFactory.java#L414-L427
apiman/apiman
gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/TimeRestrictedAccessPolicy.java
TimeRestrictedAccessPolicy.canProcessRequest
private boolean canProcessRequest(TimeRestrictedAccessConfig config, String destination) { if (destination == null || destination.trim().length() == 0) { destination = "/"; //$NON-NLS-1$ } List<TimeRestrictedAccess> rulesEnabledForPath = getRulesMatchingPath(config, destination); if(rulesEnabledForPath.size()!=0){ DateTime currentTime = new DateTime(DateTimeZone.UTC); for (TimeRestrictedAccess rule : rulesEnabledForPath) { boolean matchesDay = matchesDay(currentTime, rule); if (matchesDay) { boolean matchesTime = matchesTime(rule); if (matchesTime) { return true; } } } return false; } return true; }
java
private boolean canProcessRequest(TimeRestrictedAccessConfig config, String destination) { if (destination == null || destination.trim().length() == 0) { destination = "/"; //$NON-NLS-1$ } List<TimeRestrictedAccess> rulesEnabledForPath = getRulesMatchingPath(config, destination); if(rulesEnabledForPath.size()!=0){ DateTime currentTime = new DateTime(DateTimeZone.UTC); for (TimeRestrictedAccess rule : rulesEnabledForPath) { boolean matchesDay = matchesDay(currentTime, rule); if (matchesDay) { boolean matchesTime = matchesTime(rule); if (matchesTime) { return true; } } } return false; } return true; }
[ "private", "boolean", "canProcessRequest", "(", "TimeRestrictedAccessConfig", "config", ",", "String", "destination", ")", "{", "if", "(", "destination", "==", "null", "||", "destination", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", "{", ...
Evaluates whether the destination provided matches any of the configured pathsToIgnore and matches specified time range. @param config The {@link IgnoredResourcesConfig} containing the pathsToIgnore @param destination The destination to evaluate @return true if any path matches the destination. false otherwise
[ "Evaluates", "whether", "the", "destination", "provided", "matches", "any", "of", "the", "configured", "pathsToIgnore", "and", "matches", "specified", "time", "range", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/TimeRestrictedAccessPolicy.java#L90-L109
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/util/HashUtil.java
HashUtil.hashToIndex
public static int hashToIndex(int hash, int length) { checkPositive(length, "length must be larger than 0"); if (hash == Integer.MIN_VALUE) { return 0; } return abs(hash) % length; }
java
public static int hashToIndex(int hash, int length) { checkPositive(length, "length must be larger than 0"); if (hash == Integer.MIN_VALUE) { return 0; } return abs(hash) % length; }
[ "public", "static", "int", "hashToIndex", "(", "int", "hash", ",", "int", "length", ")", "{", "checkPositive", "(", "length", ",", "\"length must be larger than 0\"", ")", ";", "if", "(", "hash", "==", "Integer", ".", "MIN_VALUE", ")", "{", "return", "0", ...
A function that calculates the index (e.g. to be used in an array/list) for a given hash. The returned value will always be equal or larger than 0 and will always be smaller than 'length'. The reason this function exists is to deal correctly with negative and especially the Integer.MIN_VALUE; since that can't be used safely with a Math.abs function. @param length the length of the array/list @return the mod of the hash @throws IllegalArgumentException if mod smaller than 1.
[ "A", "function", "that", "calculates", "the", "index", "(", "e", ".", "g", ".", "to", "be", "used", "in", "an", "array", "/", "list", ")", "for", "a", "given", "hash", ".", "The", "returned", "value", "will", "always", "be", "equal", "or", "larger", ...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/HashUtil.java#L333-L341
sporniket/core
sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java
XmlStringTools.doAppendComment
private static StringBuffer doAppendComment(StringBuffer buffer, String comment) { buffer.append(SEQUENCE__COMMENT__OPEN).append(comment).append(SEQUENCE__COMMENT__CLOSE); return buffer; }
java
private static StringBuffer doAppendComment(StringBuffer buffer, String comment) { buffer.append(SEQUENCE__COMMENT__OPEN).append(comment).append(SEQUENCE__COMMENT__CLOSE); return buffer; }
[ "private", "static", "StringBuffer", "doAppendComment", "(", "StringBuffer", "buffer", ",", "String", "comment", ")", "{", "buffer", ".", "append", "(", "SEQUENCE__COMMENT__OPEN", ")", ".", "append", "(", "comment", ")", ".", "append", "(", "SEQUENCE__COMMENT__CLO...
Add a comment to a StringBuffer. If the buffer is null, a new one is created. @param buffer StringBuffer to fill @param comment the comment @return the buffer
[ "Add", "a", "comment", "to", "a", "StringBuffer", "." ]
train
https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java#L470-L474
aoindustries/ao-encoding
src/main/java/com/aoindustries/encoding/TextInShEncoder.java
TextInShEncoder.getEscapedCharacter
private static String getEscapedCharacter(char c) throws IOException { switch(c) { case '\\' : return "\\\\"; case '\'' : return "\\'"; case '"' : return "\\\""; case '?' : return "\\?"; } if( (c >= 0x20 && c <= 0x7E) // common case first || (c >= 0xA0 && c <= 0xFFFD) ) return null; // 01 to 1F - control characters if(c >= 0x01 && c <= 0x1F) return LOW_CONTROL[c - 0x01]; // 7F to 9F - control characters if(c >= 0x7F && c <= 0x9F) return HIGH_CONTROL[c - 0x7F]; if(c == 0xFFFE) return "\\uFFFE"; if(c == 0xFFFF) return "\\uFFFF"; assert c == 0 : "The only character not supported is NULL (\\x00), got " + Integer.toHexString(c); throw new IOException(ApplicationResources.accessor.getMessage("ShValidator.invalidCharacter", Integer.toHexString(c))); }
java
private static String getEscapedCharacter(char c) throws IOException { switch(c) { case '\\' : return "\\\\"; case '\'' : return "\\'"; case '"' : return "\\\""; case '?' : return "\\?"; } if( (c >= 0x20 && c <= 0x7E) // common case first || (c >= 0xA0 && c <= 0xFFFD) ) return null; // 01 to 1F - control characters if(c >= 0x01 && c <= 0x1F) return LOW_CONTROL[c - 0x01]; // 7F to 9F - control characters if(c >= 0x7F && c <= 0x9F) return HIGH_CONTROL[c - 0x7F]; if(c == 0xFFFE) return "\\uFFFE"; if(c == 0xFFFF) return "\\uFFFF"; assert c == 0 : "The only character not supported is NULL (\\x00), got " + Integer.toHexString(c); throw new IOException(ApplicationResources.accessor.getMessage("ShValidator.invalidCharacter", Integer.toHexString(c))); }
[ "private", "static", "String", "getEscapedCharacter", "(", "char", "c", ")", "throws", "IOException", "{", "switch", "(", "c", ")", "{", "case", "'", "'", ":", "return", "\"\\\\\\\\\"", ";", "case", "'", "'", ":", "return", "\"\\\\'\"", ";", "case", "'",...
Encodes a single character and returns its String representation or null if no modification is necessary. Implemented as <a href="https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html">ANSI-C quoting</a>. The only character not supported is NULL (\x00). @see ShValidator#checkCharacter(char) @throws IOException if any text character cannot be converted for use in a shell script
[ "Encodes", "a", "single", "character", "and", "returns", "its", "String", "representation", "or", "null", "if", "no", "modification", "is", "necessary", ".", "Implemented", "as", "<a", "href", "=", "https", ":", "//", "www", ".", "gnu", ".", "org", "/", ...
train
https://github.com/aoindustries/ao-encoding/blob/54eeb8ff58ab7b44bb02549bbe2572625b449e4e/src/main/java/com/aoindustries/encoding/TextInShEncoder.java#L132-L151
Azure/azure-sdk-for-java
sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansInner.java
ManagedDatabaseVulnerabilityAssessmentScansInner.initiateScan
public void initiateScan(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { initiateScanWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).toBlocking().last().body(); }
java
public void initiateScan(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { initiateScanWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).toBlocking().last().body(); }
[ "public", "void", "initiateScan", "(", "String", "resourceGroupName", ",", "String", "managedInstanceName", ",", "String", "databaseName", ",", "String", "scanId", ")", "{", "initiateScanWithServiceResponseAsync", "(", "resourceGroupName", ",", "managedInstanceName", ",",...
Executes a Vulnerability Assessment database scan. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param managedInstanceName The name of the managed instance. @param databaseName The name of the database. @param scanId The vulnerability assessment scan Id of the scan to retrieve. @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
[ "Executes", "a", "Vulnerability", "Assessment", "database", "scan", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansInner.java#L331-L333
apache/reef
lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/EvaluatorSetupHelper.java
EvaluatorSetupHelper.getResources
Map<String, LocalResource> getResources( final ResourceLaunchEvent resourceLaunchEvent) throws IOException { final Map<String, LocalResource> result = new HashMap<>(); result.putAll(getGlobalResources()); final File localStagingFolder = this.tempFileCreator.createTempDirectory(this.fileNames.getEvaluatorFolderPrefix()); // Write the configuration final File configurationFile = new File(localStagingFolder, this.fileNames.getEvaluatorConfigurationName()); this.configurationSerializer.toFile(makeEvaluatorConfiguration(resourceLaunchEvent), configurationFile); // Copy files to the staging folder JobJarMaker.copy(resourceLaunchEvent.getFileSet(), localStagingFolder); // Make a JAR file out of it final File localFile = tempFileCreator.createTempFile( this.fileNames.getEvaluatorFolderPrefix(), this.fileNames.getJarFileSuffix()); new JARFileMaker(localFile).addChildren(localStagingFolder).close(); // Upload the JAR to the job folder final Path pathToEvaluatorJar = this.uploader.uploadToJobFolder(localFile); result.put(this.fileNames.getLocalFolderPath(), this.uploader.makeLocalResourceForJarFile(pathToEvaluatorJar)); if (this.deleteTempFiles) { LOG.log(Level.FINE, "Marking [{0}] for deletion at the exit of this JVM and deleting [{1}]", new Object[]{localFile.getAbsolutePath(), localStagingFolder.getAbsolutePath()}); localFile.deleteOnExit(); if (!localStagingFolder.delete()) { LOG.log(Level.WARNING, "Failed to delete [{0}]", localStagingFolder.getAbsolutePath()); } } else { LOG.log(Level.FINE, "The evaluator staging folder will be kept at [{0}], the JAR at [{1}]", new Object[]{localFile.getAbsolutePath(), localStagingFolder.getAbsolutePath()}); } return result; }
java
Map<String, LocalResource> getResources( final ResourceLaunchEvent resourceLaunchEvent) throws IOException { final Map<String, LocalResource> result = new HashMap<>(); result.putAll(getGlobalResources()); final File localStagingFolder = this.tempFileCreator.createTempDirectory(this.fileNames.getEvaluatorFolderPrefix()); // Write the configuration final File configurationFile = new File(localStagingFolder, this.fileNames.getEvaluatorConfigurationName()); this.configurationSerializer.toFile(makeEvaluatorConfiguration(resourceLaunchEvent), configurationFile); // Copy files to the staging folder JobJarMaker.copy(resourceLaunchEvent.getFileSet(), localStagingFolder); // Make a JAR file out of it final File localFile = tempFileCreator.createTempFile( this.fileNames.getEvaluatorFolderPrefix(), this.fileNames.getJarFileSuffix()); new JARFileMaker(localFile).addChildren(localStagingFolder).close(); // Upload the JAR to the job folder final Path pathToEvaluatorJar = this.uploader.uploadToJobFolder(localFile); result.put(this.fileNames.getLocalFolderPath(), this.uploader.makeLocalResourceForJarFile(pathToEvaluatorJar)); if (this.deleteTempFiles) { LOG.log(Level.FINE, "Marking [{0}] for deletion at the exit of this JVM and deleting [{1}]", new Object[]{localFile.getAbsolutePath(), localStagingFolder.getAbsolutePath()}); localFile.deleteOnExit(); if (!localStagingFolder.delete()) { LOG.log(Level.WARNING, "Failed to delete [{0}]", localStagingFolder.getAbsolutePath()); } } else { LOG.log(Level.FINE, "The evaluator staging folder will be kept at [{0}], the JAR at [{1}]", new Object[]{localFile.getAbsolutePath(), localStagingFolder.getAbsolutePath()}); } return result; }
[ "Map", "<", "String", ",", "LocalResource", ">", "getResources", "(", "final", "ResourceLaunchEvent", "resourceLaunchEvent", ")", "throws", "IOException", "{", "final", "Map", "<", "String", ",", "LocalResource", ">", "result", "=", "new", "HashMap", "<>", "(", ...
Sets up the LocalResources for a new Evaluator. @param resourceLaunchEvent @return @throws IOException
[ "Sets", "up", "the", "LocalResources", "for", "a", "new", "Evaluator", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/EvaluatorSetupHelper.java#L94-L131