repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java
AdHocCommandManager.respondError
private static IQ respondError(AdHocCommandData response, StanzaError.Condition condition, AdHocCommand.SpecificErrorCondition specificCondition) { """ Responds an error with an specific condition. @param response the response to send. @param condition the condition of the error. @param specificCondition the adhoc command error condition. @throws NotConnectedException """ StanzaError.Builder error = StanzaError.getBuilder(condition).addExtension(new AdHocCommandData.SpecificError(specificCondition)); return respondError(response, error); }
java
private static IQ respondError(AdHocCommandData response, StanzaError.Condition condition, AdHocCommand.SpecificErrorCondition specificCondition) { StanzaError.Builder error = StanzaError.getBuilder(condition).addExtension(new AdHocCommandData.SpecificError(specificCondition)); return respondError(response, error); }
[ "private", "static", "IQ", "respondError", "(", "AdHocCommandData", "response", ",", "StanzaError", ".", "Condition", "condition", ",", "AdHocCommand", ".", "SpecificErrorCondition", "specificCondition", ")", "{", "StanzaError", ".", "Builder", "error", "=", "StanzaError", ".", "getBuilder", "(", "condition", ")", ".", "addExtension", "(", "new", "AdHocCommandData", ".", "SpecificError", "(", "specificCondition", ")", ")", ";", "return", "respondError", "(", "response", ",", "error", ")", ";", "}" ]
Responds an error with an specific condition. @param response the response to send. @param condition the condition of the error. @param specificCondition the adhoc command error condition. @throws NotConnectedException
[ "Responds", "an", "error", "with", "an", "specific", "condition", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java#L581-L585
livetribe/livetribe-slp
osgi/bundle/src/main/java/org/livetribe/slp/osgi/UserAgentManagedServiceFactory.java
UserAgentManagedServiceFactory.updated
public void updated(String pid, Dictionary dictionary) throws ConfigurationException { """ Update the SLP user agent's configuration, unregistering from the OSGi service registry and stopping it if it had already started. The new SLP user agent will be started with the new configuration and registered in the OSGi service registry using the configuration parameters as service properties. @param pid The PID for this configuration. @param dictionary The dictionary used to configure the SLP user agent. @throws ConfigurationException Thrown if an error occurs during the SLP user agent's configuration. """ LOGGER.entering(CLASS_NAME, "updated", new Object[]{pid, dictionary}); deleted(pid); UserAgent userAgent = SLP.newUserAgent(dictionary == null ? null : DictionarySettings.from(dictionary)); if (LOGGER.isLoggable(Level.FINER)) LOGGER.finer("User Agent " + pid + " starting..."); userAgent.start(); if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine("User Agent " + pid + " started successfully"); ServiceRegistration serviceRegistration = bundleContext.registerService(IServiceAgent.class.getName(), userAgent, dictionary); userAgents.put(pid, serviceRegistration); LOGGER.exiting(CLASS_NAME, "updated"); }
java
public void updated(String pid, Dictionary dictionary) throws ConfigurationException { LOGGER.entering(CLASS_NAME, "updated", new Object[]{pid, dictionary}); deleted(pid); UserAgent userAgent = SLP.newUserAgent(dictionary == null ? null : DictionarySettings.from(dictionary)); if (LOGGER.isLoggable(Level.FINER)) LOGGER.finer("User Agent " + pid + " starting..."); userAgent.start(); if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine("User Agent " + pid + " started successfully"); ServiceRegistration serviceRegistration = bundleContext.registerService(IServiceAgent.class.getName(), userAgent, dictionary); userAgents.put(pid, serviceRegistration); LOGGER.exiting(CLASS_NAME, "updated"); }
[ "public", "void", "updated", "(", "String", "pid", ",", "Dictionary", "dictionary", ")", "throws", "ConfigurationException", "{", "LOGGER", ".", "entering", "(", "CLASS_NAME", ",", "\"updated\"", ",", "new", "Object", "[", "]", "{", "pid", ",", "dictionary", "}", ")", ";", "deleted", "(", "pid", ")", ";", "UserAgent", "userAgent", "=", "SLP", ".", "newUserAgent", "(", "dictionary", "==", "null", "?", "null", ":", "DictionarySettings", ".", "from", "(", "dictionary", ")", ")", ";", "if", "(", "LOGGER", ".", "isLoggable", "(", "Level", ".", "FINER", ")", ")", "LOGGER", ".", "finer", "(", "\"User Agent \"", "+", "pid", "+", "\" starting...\"", ")", ";", "userAgent", ".", "start", "(", ")", ";", "if", "(", "LOGGER", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "LOGGER", ".", "fine", "(", "\"User Agent \"", "+", "pid", "+", "\" started successfully\"", ")", ";", "ServiceRegistration", "serviceRegistration", "=", "bundleContext", ".", "registerService", "(", "IServiceAgent", ".", "class", ".", "getName", "(", ")", ",", "userAgent", ",", "dictionary", ")", ";", "userAgents", ".", "put", "(", "pid", ",", "serviceRegistration", ")", ";", "LOGGER", ".", "exiting", "(", "CLASS_NAME", ",", "\"updated\"", ")", ";", "}" ]
Update the SLP user agent's configuration, unregistering from the OSGi service registry and stopping it if it had already started. The new SLP user agent will be started with the new configuration and registered in the OSGi service registry using the configuration parameters as service properties. @param pid The PID for this configuration. @param dictionary The dictionary used to configure the SLP user agent. @throws ConfigurationException Thrown if an error occurs during the SLP user agent's configuration.
[ "Update", "the", "SLP", "user", "agent", "s", "configuration", "unregistering", "from", "the", "OSGi", "service", "registry", "and", "stopping", "it", "if", "it", "had", "already", "started", ".", "The", "new", "SLP", "user", "agent", "will", "be", "started", "with", "the", "new", "configuration", "and", "registered", "in", "the", "OSGi", "service", "registry", "using", "the", "configuration", "parameters", "as", "service", "properties", "." ]
train
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/osgi/bundle/src/main/java/org/livetribe/slp/osgi/UserAgentManagedServiceFactory.java#L95-L113
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsxmlnamespace.java
nsxmlnamespace.get
public static nsxmlnamespace get(nitro_service service, String prefix) throws Exception { """ Use this API to fetch nsxmlnamespace resource of given name . """ nsxmlnamespace obj = new nsxmlnamespace(); obj.set_prefix(prefix); nsxmlnamespace response = (nsxmlnamespace) obj.get_resource(service); return response; }
java
public static nsxmlnamespace get(nitro_service service, String prefix) throws Exception{ nsxmlnamespace obj = new nsxmlnamespace(); obj.set_prefix(prefix); nsxmlnamespace response = (nsxmlnamespace) obj.get_resource(service); return response; }
[ "public", "static", "nsxmlnamespace", "get", "(", "nitro_service", "service", ",", "String", "prefix", ")", "throws", "Exception", "{", "nsxmlnamespace", "obj", "=", "new", "nsxmlnamespace", "(", ")", ";", "obj", ".", "set_prefix", "(", "prefix", ")", ";", "nsxmlnamespace", "response", "=", "(", "nsxmlnamespace", ")", "obj", ".", "get_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch nsxmlnamespace resource of given name .
[ "Use", "this", "API", "to", "fetch", "nsxmlnamespace", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsxmlnamespace.java#L297-L302
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java
Math.multiplyExact
public static int multiplyExact(int x, int y) { """ Returns the product of the arguments, throwing an exception if the result overflows an {@code int}. @param x the first value @param y the second value @return the result @throws ArithmeticException if the result overflows an int @since 1.8 """ long r = (long)x * (long)y; if ((int)r != r) { throw new ArithmeticException("integer overflow"); } return (int)r; }
java
public static int multiplyExact(int x, int y) { long r = (long)x * (long)y; if ((int)r != r) { throw new ArithmeticException("integer overflow"); } return (int)r; }
[ "public", "static", "int", "multiplyExact", "(", "int", "x", ",", "int", "y", ")", "{", "long", "r", "=", "(", "long", ")", "x", "*", "(", "long", ")", "y", ";", "if", "(", "(", "int", ")", "r", "!=", "r", ")", "{", "throw", "new", "ArithmeticException", "(", "\"integer overflow\"", ")", ";", "}", "return", "(", "int", ")", "r", ";", "}" ]
Returns the product of the arguments, throwing an exception if the result overflows an {@code int}. @param x the first value @param y the second value @return the result @throws ArithmeticException if the result overflows an int @since 1.8
[ "Returns", "the", "product", "of", "the", "arguments", "throwing", "an", "exception", "if", "the", "result", "overflows", "an", "{", "@code", "int", "}", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java#L869-L875
OpenLiberty/open-liberty
dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/TypeConversion.java
TypeConversion.intToBytes
public static void intToBytes(int value, byte[] bytes, int offset) { """ A utility method to convert an int into bytes in an array. @param value An int. @param bytes The byte array to which the int should be copied. @param offset The index where the int should start. """ bytes[offset + 3] = (byte) (value >>> 0); bytes[offset + 2] = (byte) (value >>> 8); bytes[offset + 1] = (byte) (value >>> 16); bytes[offset + 0] = (byte) (value >>> 24); }
java
public static void intToBytes(int value, byte[] bytes, int offset) { bytes[offset + 3] = (byte) (value >>> 0); bytes[offset + 2] = (byte) (value >>> 8); bytes[offset + 1] = (byte) (value >>> 16); bytes[offset + 0] = (byte) (value >>> 24); }
[ "public", "static", "void", "intToBytes", "(", "int", "value", ",", "byte", "[", "]", "bytes", ",", "int", "offset", ")", "{", "bytes", "[", "offset", "+", "3", "]", "=", "(", "byte", ")", "(", "value", ">>>", "0", ")", ";", "bytes", "[", "offset", "+", "2", "]", "=", "(", "byte", ")", "(", "value", ">>>", "8", ")", ";", "bytes", "[", "offset", "+", "1", "]", "=", "(", "byte", ")", "(", "value", ">>>", "16", ")", ";", "bytes", "[", "offset", "+", "0", "]", "=", "(", "byte", ")", "(", "value", ">>>", "24", ")", ";", "}" ]
A utility method to convert an int into bytes in an array. @param value An int. @param bytes The byte array to which the int should be copied. @param offset The index where the int should start.
[ "A", "utility", "method", "to", "convert", "an", "int", "into", "bytes", "in", "an", "array", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/TypeConversion.java#L109-L114
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/BaseProfile.java
BaseProfile.generateGradle
void generateGradle(Definition def, String outputDir) { """ generate gradle build.gradle @param def Definition @param outputDir output directory """ try { FileWriter bgfw = Utils.createFile("build.gradle", outputDir); BuildGradleGen bgGen = new BuildGradleGen(); bgGen.generate(def, bgfw); bgfw.close(); } catch (IOException ioe) { ioe.printStackTrace(); } }
java
void generateGradle(Definition def, String outputDir) { try { FileWriter bgfw = Utils.createFile("build.gradle", outputDir); BuildGradleGen bgGen = new BuildGradleGen(); bgGen.generate(def, bgfw); bgfw.close(); } catch (IOException ioe) { ioe.printStackTrace(); } }
[ "void", "generateGradle", "(", "Definition", "def", ",", "String", "outputDir", ")", "{", "try", "{", "FileWriter", "bgfw", "=", "Utils", ".", "createFile", "(", "\"build.gradle\"", ",", "outputDir", ")", ";", "BuildGradleGen", "bgGen", "=", "new", "BuildGradleGen", "(", ")", ";", "bgGen", ".", "generate", "(", "def", ",", "bgfw", ")", ";", "bgfw", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "ioe", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
generate gradle build.gradle @param def Definition @param outputDir output directory
[ "generate", "gradle", "build", ".", "gradle" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/BaseProfile.java#L410-L423
gocd/gocd
base/src/main/java/com/thoughtworks/go/util/DirectoryScanner.java
DirectoryScanner.accountForIncludedFile
private void accountForIncludedFile(String name, File file) { """ Process included file. @param name path of the file relative to the directory of the FileSet. @param file included File. """ processIncluded(name, file, filesIncluded, filesExcluded, filesDeselected); }
java
private void accountForIncludedFile(String name, File file) { processIncluded(name, file, filesIncluded, filesExcluded, filesDeselected); }
[ "private", "void", "accountForIncludedFile", "(", "String", "name", ",", "File", "file", ")", "{", "processIncluded", "(", "name", ",", "file", ",", "filesIncluded", ",", "filesExcluded", ",", "filesDeselected", ")", ";", "}" ]
Process included file. @param name path of the file relative to the directory of the FileSet. @param file included File.
[ "Process", "included", "file", "." ]
train
https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/base/src/main/java/com/thoughtworks/go/util/DirectoryScanner.java#L1128-L1130
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.getAt
public static <T> T getAt(List<T> self, int idx) { """ Support the subscript operator for a List. <pre class="groovyTestCase">def list = [2, "a", 5.3] assert list[1] == "a"</pre> @param self a List @param idx an index @return the value at the given index @since 1.0 """ int size = self.size(); int i = normaliseIndex(idx, size); if (i < size) { return self.get(i); } else { return null; } }
java
public static <T> T getAt(List<T> self, int idx) { int size = self.size(); int i = normaliseIndex(idx, size); if (i < size) { return self.get(i); } else { return null; } }
[ "public", "static", "<", "T", ">", "T", "getAt", "(", "List", "<", "T", ">", "self", ",", "int", "idx", ")", "{", "int", "size", "=", "self", ".", "size", "(", ")", ";", "int", "i", "=", "normaliseIndex", "(", "idx", ",", "size", ")", ";", "if", "(", "i", "<", "size", ")", "{", "return", "self", ".", "get", "(", "i", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Support the subscript operator for a List. <pre class="groovyTestCase">def list = [2, "a", 5.3] assert list[1] == "a"</pre> @param self a List @param idx an index @return the value at the given index @since 1.0
[ "Support", "the", "subscript", "operator", "for", "a", "List", ".", "<pre", "class", "=", "groovyTestCase", ">", "def", "list", "=", "[", "2", "a", "5", ".", "3", "]", "assert", "list", "[", "1", "]", "==", "a", "<", "/", "pre", ">" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L7851-L7859
wcm-io-caravan/caravan-commons
performance/src/main/java/io/wcm/caravan/common/performance/PerformanceMetrics.java
PerformanceMetrics.createNew
public static PerformanceMetrics createNew(String action, String descriptor, String correlationId) { """ Creates new instance of performance metrics. Generates new metrics key and assigns zero level. @param action a short name of measured operation, typically a first prefix of descriptor @param descriptor a full description of measured operation @param correlationId a reference to the request, which caused the operation @return PerformanceMetrics a new instance of performance metrics """ return new PerformanceMetrics(KEY_GEN.getAndIncrement(), 0, action, null, descriptor, correlationId); }
java
public static PerformanceMetrics createNew(String action, String descriptor, String correlationId) { return new PerformanceMetrics(KEY_GEN.getAndIncrement(), 0, action, null, descriptor, correlationId); }
[ "public", "static", "PerformanceMetrics", "createNew", "(", "String", "action", ",", "String", "descriptor", ",", "String", "correlationId", ")", "{", "return", "new", "PerformanceMetrics", "(", "KEY_GEN", ".", "getAndIncrement", "(", ")", ",", "0", ",", "action", ",", "null", ",", "descriptor", ",", "correlationId", ")", ";", "}" ]
Creates new instance of performance metrics. Generates new metrics key and assigns zero level. @param action a short name of measured operation, typically a first prefix of descriptor @param descriptor a full description of measured operation @param correlationId a reference to the request, which caused the operation @return PerformanceMetrics a new instance of performance metrics
[ "Creates", "new", "instance", "of", "performance", "metrics", ".", "Generates", "new", "metrics", "key", "and", "assigns", "zero", "level", "." ]
train
https://github.com/wcm-io-caravan/caravan-commons/blob/12e605bdfeb5a1ce7404e30d9f32274552cb8ce8/performance/src/main/java/io/wcm/caravan/common/performance/PerformanceMetrics.java#L71-L73
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java
StreamPersistedValueData.setPersistedURL
public InputStream setPersistedURL(URL url, boolean spoolContent) throws IOException { """ Sets persistent URL. Will reset (null) the stream and will spool the content of the stream if <code>spoolContent</code> has been set to <code>true</code>. This method should be called only from persistent layer (Value storage). @param url the url to which the data has been persisted @param spoolContent Indicates whether or not the content should always be spooled """ InputStream result = null; this.url = url; this.spoolContent = spoolContent; // JCR-2326 Release the current ValueData from tempFile users before // setting its reference to null so it will be garbage collected. if (!spoolContent && this.tempFile != null) { this.tempFile.release(this); this.tempFile = null; } else if (spoolContent && tempFile == null && stream != null) { spoolContent(stream); result = new FileInputStream(tempFile); } this.stream = null; return result; }
java
public InputStream setPersistedURL(URL url, boolean spoolContent) throws IOException { InputStream result = null; this.url = url; this.spoolContent = spoolContent; // JCR-2326 Release the current ValueData from tempFile users before // setting its reference to null so it will be garbage collected. if (!spoolContent && this.tempFile != null) { this.tempFile.release(this); this.tempFile = null; } else if (spoolContent && tempFile == null && stream != null) { spoolContent(stream); result = new FileInputStream(tempFile); } this.stream = null; return result; }
[ "public", "InputStream", "setPersistedURL", "(", "URL", "url", ",", "boolean", "spoolContent", ")", "throws", "IOException", "{", "InputStream", "result", "=", "null", ";", "this", ".", "url", "=", "url", ";", "this", ".", "spoolContent", "=", "spoolContent", ";", "// JCR-2326 Release the current ValueData from tempFile users before", "// setting its reference to null so it will be garbage collected.", "if", "(", "!", "spoolContent", "&&", "this", ".", "tempFile", "!=", "null", ")", "{", "this", ".", "tempFile", ".", "release", "(", "this", ")", ";", "this", ".", "tempFile", "=", "null", ";", "}", "else", "if", "(", "spoolContent", "&&", "tempFile", "==", "null", "&&", "stream", "!=", "null", ")", "{", "spoolContent", "(", "stream", ")", ";", "result", "=", "new", "FileInputStream", "(", "tempFile", ")", ";", "}", "this", ".", "stream", "=", "null", ";", "return", "result", ";", "}" ]
Sets persistent URL. Will reset (null) the stream and will spool the content of the stream if <code>spoolContent</code> has been set to <code>true</code>. This method should be called only from persistent layer (Value storage). @param url the url to which the data has been persisted @param spoolContent Indicates whether or not the content should always be spooled
[ "Sets", "persistent", "URL", ".", "Will", "reset", "(", "null", ")", "the", "stream", "and", "will", "spool", "the", "content", "of", "the", "stream", "if", "<code", ">", "spoolContent<", "/", "code", ">", "has", "been", "set", "to", "<code", ">", "true<", "/", "code", ">", ".", "This", "method", "should", "be", "called", "only", "from", "persistent", "layer", "(", "Value", "storage", ")", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java#L199-L219
google/closure-compiler
src/com/google/javascript/jscomp/Es6RewriteBlockScopedDeclaration.java
Es6RewriteBlockScopedDeclaration.createCommaNode
private Node createCommaNode(Node expr1, Node expr2) { """ Creates a COMMA node with type information matching its second argument. """ Node commaNode = IR.comma(expr1, expr2); if (shouldAddTypesOnNewAstNodes) { commaNode.setJSType(expr2.getJSType()); } return commaNode; }
java
private Node createCommaNode(Node expr1, Node expr2) { Node commaNode = IR.comma(expr1, expr2); if (shouldAddTypesOnNewAstNodes) { commaNode.setJSType(expr2.getJSType()); } return commaNode; }
[ "private", "Node", "createCommaNode", "(", "Node", "expr1", ",", "Node", "expr2", ")", "{", "Node", "commaNode", "=", "IR", ".", "comma", "(", "expr1", ",", "expr2", ")", ";", "if", "(", "shouldAddTypesOnNewAstNodes", ")", "{", "commaNode", ".", "setJSType", "(", "expr2", ".", "getJSType", "(", ")", ")", ";", "}", "return", "commaNode", ";", "}" ]
Creates a COMMA node with type information matching its second argument.
[ "Creates", "a", "COMMA", "node", "with", "type", "information", "matching", "its", "second", "argument", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6RewriteBlockScopedDeclaration.java#L718-L724
mapcode-foundation/mapcode-java
src/main/java/com/mapcode/Point.java
Point.fromLatLonFractions
@SuppressWarnings("NumericCastThatLosesPrecision") @Nonnull static Point fromLatLonFractions(final double latFraction, final double lonFraction) { """ Package private construction, from integer fractions (no loss of precision). """ final Point p = new Point(); p.latMicroDeg = (int) Math.floor(latFraction / LAT_MICRODEG_TO_FRACTIONS_FACTOR); p.latFractionOnlyDeg = (int) (latFraction - (LAT_MICRODEG_TO_FRACTIONS_FACTOR * p.latMicroDeg)); p.lonMicroDeg = (int) Math.floor(lonFraction / LON_MICRODEG_TO_FRACTIONS_FACTOR); p.lonFractionOnlyDeg = (int) (lonFraction - (LON_MICRODEG_TO_FRACTIONS_FACTOR * p.lonMicroDeg)); p.defined = true; return p.wrap(); }
java
@SuppressWarnings("NumericCastThatLosesPrecision") @Nonnull static Point fromLatLonFractions(final double latFraction, final double lonFraction) { final Point p = new Point(); p.latMicroDeg = (int) Math.floor(latFraction / LAT_MICRODEG_TO_FRACTIONS_FACTOR); p.latFractionOnlyDeg = (int) (latFraction - (LAT_MICRODEG_TO_FRACTIONS_FACTOR * p.latMicroDeg)); p.lonMicroDeg = (int) Math.floor(lonFraction / LON_MICRODEG_TO_FRACTIONS_FACTOR); p.lonFractionOnlyDeg = (int) (lonFraction - (LON_MICRODEG_TO_FRACTIONS_FACTOR * p.lonMicroDeg)); p.defined = true; return p.wrap(); }
[ "@", "SuppressWarnings", "(", "\"NumericCastThatLosesPrecision\"", ")", "@", "Nonnull", "static", "Point", "fromLatLonFractions", "(", "final", "double", "latFraction", ",", "final", "double", "lonFraction", ")", "{", "final", "Point", "p", "=", "new", "Point", "(", ")", ";", "p", ".", "latMicroDeg", "=", "(", "int", ")", "Math", ".", "floor", "(", "latFraction", "/", "LAT_MICRODEG_TO_FRACTIONS_FACTOR", ")", ";", "p", ".", "latFractionOnlyDeg", "=", "(", "int", ")", "(", "latFraction", "-", "(", "LAT_MICRODEG_TO_FRACTIONS_FACTOR", "*", "p", ".", "latMicroDeg", ")", ")", ";", "p", ".", "lonMicroDeg", "=", "(", "int", ")", "Math", ".", "floor", "(", "lonFraction", "/", "LON_MICRODEG_TO_FRACTIONS_FACTOR", ")", ";", "p", ".", "lonFractionOnlyDeg", "=", "(", "int", ")", "(", "lonFraction", "-", "(", "LON_MICRODEG_TO_FRACTIONS_FACTOR", "*", "p", ".", "lonMicroDeg", ")", ")", ";", "p", ".", "defined", "=", "true", ";", "return", "p", ".", "wrap", "(", ")", ";", "}" ]
Package private construction, from integer fractions (no loss of precision).
[ "Package", "private", "construction", "from", "integer", "fractions", "(", "no", "loss", "of", "precision", ")", "." ]
train
https://github.com/mapcode-foundation/mapcode-java/blob/f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8/src/main/java/com/mapcode/Point.java#L341-L351
lagom/lagom
service/javadsl/server/src/main/java/com/lightbend/lagom/javadsl/server/status/Latency.java
Latency.withPercentile999th
public final Latency withPercentile999th(double value) { """ Copy the current immutable object by setting a value for the {@link AbstractLatency#getPercentile999th() percentile999th} attribute. @param value A new value for percentile999th @return A modified copy of the {@code this} object """ double newValue = value; return new Latency(this.median, this.percentile98th, this.percentile99th, newValue, this.mean, this.min, this.max); }
java
public final Latency withPercentile999th(double value) { double newValue = value; return new Latency(this.median, this.percentile98th, this.percentile99th, newValue, this.mean, this.min, this.max); }
[ "public", "final", "Latency", "withPercentile999th", "(", "double", "value", ")", "{", "double", "newValue", "=", "value", ";", "return", "new", "Latency", "(", "this", ".", "median", ",", "this", ".", "percentile98th", ",", "this", ".", "percentile99th", ",", "newValue", ",", "this", ".", "mean", ",", "this", ".", "min", ",", "this", ".", "max", ")", ";", "}" ]
Copy the current immutable object by setting a value for the {@link AbstractLatency#getPercentile999th() percentile999th} attribute. @param value A new value for percentile999th @return A modified copy of the {@code this} object
[ "Copy", "the", "current", "immutable", "object", "by", "setting", "a", "value", "for", "the", "{" ]
train
https://github.com/lagom/lagom/blob/3763055a9d1aace793a5d970f4e688aea61b1a5a/service/javadsl/server/src/main/java/com/lightbend/lagom/javadsl/server/status/Latency.java#L157-L160
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
StringGroovyMethods.dropWhile
public static String dropWhile(GString self, @ClosureParams(value=SimpleType.class, options="char") Closure condition) { """ A GString variant of the equivalent CharSequence method. @param self the original GString @param condition the closure that while continuously evaluating to true will cause us to drop elements from the front of the original GString @return the shortest suffix of the given GString such that the given closure condition evaluates to true for each element dropped from the front of the CharSequence @see #dropWhile(CharSequence, groovy.lang.Closure) @since 2.3.7 """ return dropWhile(self.toString(), condition).toString(); }
java
public static String dropWhile(GString self, @ClosureParams(value=SimpleType.class, options="char") Closure condition) { return dropWhile(self.toString(), condition).toString(); }
[ "public", "static", "String", "dropWhile", "(", "GString", "self", ",", "@", "ClosureParams", "(", "value", "=", "SimpleType", ".", "class", ",", "options", "=", "\"char\"", ")", "Closure", "condition", ")", "{", "return", "dropWhile", "(", "self", ".", "toString", "(", ")", ",", "condition", ")", ".", "toString", "(", ")", ";", "}" ]
A GString variant of the equivalent CharSequence method. @param self the original GString @param condition the closure that while continuously evaluating to true will cause us to drop elements from the front of the original GString @return the shortest suffix of the given GString such that the given closure condition evaluates to true for each element dropped from the front of the CharSequence @see #dropWhile(CharSequence, groovy.lang.Closure) @since 2.3.7
[ "A", "GString", "variant", "of", "the", "equivalent", "CharSequence", "method", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L578-L580
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/effect/Effect.java
Effect.fill
public void fill(Graphics2D g, Shape s) { """ Paint the effect based around a solid shape in the graphics supplied. @param g the graphics to paint into. @param s the shape to base the effect around. """ Rectangle bounds = s.getBounds(); int width = bounds.width; int height = bounds.height; BufferedImage bimage = Effect.createBufferedImage(width, height, true); Graphics2D gbi = bimage.createGraphics(); gbi.setColor(Color.BLACK); gbi.fill(s); g.drawImage(applyEffect(bimage, null, width, height), 0, 0, null); }
java
public void fill(Graphics2D g, Shape s) { Rectangle bounds = s.getBounds(); int width = bounds.width; int height = bounds.height; BufferedImage bimage = Effect.createBufferedImage(width, height, true); Graphics2D gbi = bimage.createGraphics(); gbi.setColor(Color.BLACK); gbi.fill(s); g.drawImage(applyEffect(bimage, null, width, height), 0, 0, null); }
[ "public", "void", "fill", "(", "Graphics2D", "g", ",", "Shape", "s", ")", "{", "Rectangle", "bounds", "=", "s", ".", "getBounds", "(", ")", ";", "int", "width", "=", "bounds", ".", "width", ";", "int", "height", "=", "bounds", ".", "height", ";", "BufferedImage", "bimage", "=", "Effect", ".", "createBufferedImage", "(", "width", ",", "height", ",", "true", ")", ";", "Graphics2D", "gbi", "=", "bimage", ".", "createGraphics", "(", ")", ";", "gbi", ".", "setColor", "(", "Color", ".", "BLACK", ")", ";", "gbi", ".", "fill", "(", "s", ")", ";", "g", ".", "drawImage", "(", "applyEffect", "(", "bimage", ",", "null", ",", "width", ",", "height", ")", ",", "0", ",", "0", ",", "null", ")", ";", "}" ]
Paint the effect based around a solid shape in the graphics supplied. @param g the graphics to paint into. @param s the shape to base the effect around.
[ "Paint", "the", "effect", "based", "around", "a", "solid", "shape", "in", "the", "graphics", "supplied", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/effect/Effect.java#L104-L116
lecho/hellocharts-android
hellocharts-library/src/lecho/lib/hellocharts/model/Viewport.java
Viewport.offsetTo
public void offsetTo(float newLeft, float newTop) { """ Offset the viewport to a specific (left, top) position, keeping its width and height the same. @param newLeft The new "left" coordinate for the viewport @param newTop The new "top" coordinate for the viewport """ right += newLeft - left; bottom += newTop - top; left = newLeft; top = newTop; }
java
public void offsetTo(float newLeft, float newTop) { right += newLeft - left; bottom += newTop - top; left = newLeft; top = newTop; }
[ "public", "void", "offsetTo", "(", "float", "newLeft", ",", "float", "newTop", ")", "{", "right", "+=", "newLeft", "-", "left", ";", "bottom", "+=", "newTop", "-", "top", ";", "left", "=", "newLeft", ";", "top", "=", "newTop", ";", "}" ]
Offset the viewport to a specific (left, top) position, keeping its width and height the same. @param newLeft The new "left" coordinate for the viewport @param newTop The new "top" coordinate for the viewport
[ "Offset", "the", "viewport", "to", "a", "specific", "(", "left", "top", ")", "position", "keeping", "its", "width", "and", "height", "the", "same", "." ]
train
https://github.com/lecho/hellocharts-android/blob/c41419c9afa097452dee823c7eba0e5136aa96bd/hellocharts-library/src/lecho/lib/hellocharts/model/Viewport.java#L189-L194
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java
ApplicationGatewaysInner.beginUpdateTagsAsync
public Observable<ApplicationGatewayInner> beginUpdateTagsAsync(String resourceGroupName, String applicationGatewayName, Map<String, String> tags) { """ Updates the specified application gateway tags. @param resourceGroupName The name of the resource group. @param applicationGatewayName The name of the application gateway. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ApplicationGatewayInner object """ return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, applicationGatewayName, tags).map(new Func1<ServiceResponse<ApplicationGatewayInner>, ApplicationGatewayInner>() { @Override public ApplicationGatewayInner call(ServiceResponse<ApplicationGatewayInner> response) { return response.body(); } }); }
java
public Observable<ApplicationGatewayInner> beginUpdateTagsAsync(String resourceGroupName, String applicationGatewayName, Map<String, String> tags) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, applicationGatewayName, tags).map(new Func1<ServiceResponse<ApplicationGatewayInner>, ApplicationGatewayInner>() { @Override public ApplicationGatewayInner call(ServiceResponse<ApplicationGatewayInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ApplicationGatewayInner", ">", "beginUpdateTagsAsync", "(", "String", "resourceGroupName", ",", "String", "applicationGatewayName", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "beginUpdateTagsWithServiceResponseAsync", "(", "resourceGroupName", ",", "applicationGatewayName", ",", "tags", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ApplicationGatewayInner", ">", ",", "ApplicationGatewayInner", ">", "(", ")", "{", "@", "Override", "public", "ApplicationGatewayInner", "call", "(", "ServiceResponse", "<", "ApplicationGatewayInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Updates the specified application gateway tags. @param resourceGroupName The name of the resource group. @param applicationGatewayName The name of the application gateway. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ApplicationGatewayInner object
[ "Updates", "the", "specified", "application", "gateway", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java#L824-L831
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java
Graph.mapVertices
@SuppressWarnings( { """ Apply a function to the attribute of each vertex in the graph. @param mapper the map function to apply. @return a new graph """ "unchecked", "rawtypes" }) public <NV> Graph<K, NV, EV> mapVertices(final MapFunction<Vertex<K, VV>, NV> mapper) { TypeInformation<K> keyType = ((TupleTypeInfo<?>) vertices.getType()).getTypeAt(0); TypeInformation<NV> valueType; if (mapper instanceof ResultTypeQueryable) { valueType = ((ResultTypeQueryable) mapper).getProducedType(); } else { valueType = TypeExtractor.createTypeInfo(MapFunction.class, mapper.getClass(), 1, vertices.getType(), null); } TypeInformation<Vertex<K, NV>> returnType = (TypeInformation<Vertex<K, NV>>) new TupleTypeInfo( Vertex.class, keyType, valueType); return mapVertices(mapper, returnType); }
java
@SuppressWarnings({ "unchecked", "rawtypes" }) public <NV> Graph<K, NV, EV> mapVertices(final MapFunction<Vertex<K, VV>, NV> mapper) { TypeInformation<K> keyType = ((TupleTypeInfo<?>) vertices.getType()).getTypeAt(0); TypeInformation<NV> valueType; if (mapper instanceof ResultTypeQueryable) { valueType = ((ResultTypeQueryable) mapper).getProducedType(); } else { valueType = TypeExtractor.createTypeInfo(MapFunction.class, mapper.getClass(), 1, vertices.getType(), null); } TypeInformation<Vertex<K, NV>> returnType = (TypeInformation<Vertex<K, NV>>) new TupleTypeInfo( Vertex.class, keyType, valueType); return mapVertices(mapper, returnType); }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "public", "<", "NV", ">", "Graph", "<", "K", ",", "NV", ",", "EV", ">", "mapVertices", "(", "final", "MapFunction", "<", "Vertex", "<", "K", ",", "VV", ">", ",", "NV", ">", "mapper", ")", "{", "TypeInformation", "<", "K", ">", "keyType", "=", "(", "(", "TupleTypeInfo", "<", "?", ">", ")", "vertices", ".", "getType", "(", ")", ")", ".", "getTypeAt", "(", "0", ")", ";", "TypeInformation", "<", "NV", ">", "valueType", ";", "if", "(", "mapper", "instanceof", "ResultTypeQueryable", ")", "{", "valueType", "=", "(", "(", "ResultTypeQueryable", ")", "mapper", ")", ".", "getProducedType", "(", ")", ";", "}", "else", "{", "valueType", "=", "TypeExtractor", ".", "createTypeInfo", "(", "MapFunction", ".", "class", ",", "mapper", ".", "getClass", "(", ")", ",", "1", ",", "vertices", ".", "getType", "(", ")", ",", "null", ")", ";", "}", "TypeInformation", "<", "Vertex", "<", "K", ",", "NV", ">", ">", "returnType", "=", "(", "TypeInformation", "<", "Vertex", "<", "K", ",", "NV", ">", ">", ")", "new", "TupleTypeInfo", "(", "Vertex", ".", "class", ",", "keyType", ",", "valueType", ")", ";", "return", "mapVertices", "(", "mapper", ",", "returnType", ")", ";", "}" ]
Apply a function to the attribute of each vertex in the graph. @param mapper the map function to apply. @return a new graph
[ "Apply", "a", "function", "to", "the", "attribute", "of", "each", "vertex", "in", "the", "graph", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L527-L544
kiegroup/jbpm
jbpm-bpmn2-emfextmodel/src/main/java/org/jboss/drools/util/DroolsValidator.java
DroolsValidator.validatePriorityType_Min
public boolean validatePriorityType_Min(BigInteger priorityType, DiagnosticChain diagnostics, Map<Object, Object> context) { """ Validates the Min constraint of '<em>Priority Type</em>'. <!-- begin-user-doc --> <!-- end-user-doc --> @generated """ boolean result = priorityType.compareTo(PRIORITY_TYPE__MIN__VALUE) >= 0; if (!result && diagnostics != null) reportMinViolation(DroolsPackage.Literals.PRIORITY_TYPE, priorityType, PRIORITY_TYPE__MIN__VALUE, true, diagnostics, context); return result; }
java
public boolean validatePriorityType_Min(BigInteger priorityType, DiagnosticChain diagnostics, Map<Object, Object> context) { boolean result = priorityType.compareTo(PRIORITY_TYPE__MIN__VALUE) >= 0; if (!result && diagnostics != null) reportMinViolation(DroolsPackage.Literals.PRIORITY_TYPE, priorityType, PRIORITY_TYPE__MIN__VALUE, true, diagnostics, context); return result; }
[ "public", "boolean", "validatePriorityType_Min", "(", "BigInteger", "priorityType", ",", "DiagnosticChain", "diagnostics", ",", "Map", "<", "Object", ",", "Object", ">", "context", ")", "{", "boolean", "result", "=", "priorityType", ".", "compareTo", "(", "PRIORITY_TYPE__MIN__VALUE", ")", ">=", "0", ";", "if", "(", "!", "result", "&&", "diagnostics", "!=", "null", ")", "reportMinViolation", "(", "DroolsPackage", ".", "Literals", ".", "PRIORITY_TYPE", ",", "priorityType", ",", "PRIORITY_TYPE__MIN__VALUE", ",", "true", ",", "diagnostics", ",", "context", ")", ";", "return", "result", ";", "}" ]
Validates the Min constraint of '<em>Priority Type</em>'. <!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "Validates", "the", "Min", "constraint", "of", "<em", ">", "Priority", "Type<", "/", "em", ">", ".", "<!", "--", "begin", "-", "user", "-", "doc", "--", ">", "<!", "--", "end", "-", "user", "-", "doc", "--", ">" ]
train
https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-bpmn2-emfextmodel/src/main/java/org/jboss/drools/util/DroolsValidator.java#L230-L235
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java
JBBPTextWriter.Short
public JBBPTextWriter Short(final short[] values, int off, int len) throws IOException { """ Print values from short array @param values short value array, must not be null @param off offset to the first element @param len number of elements to print @return the context @throws IOException it will be thrown for transport error """ while (len-- > 0) { this.Short(values[off++]); } return this; }
java
public JBBPTextWriter Short(final short[] values, int off, int len) throws IOException { while (len-- > 0) { this.Short(values[off++]); } return this; }
[ "public", "JBBPTextWriter", "Short", "(", "final", "short", "[", "]", "values", ",", "int", "off", ",", "int", "len", ")", "throws", "IOException", "{", "while", "(", "len", "--", ">", "0", ")", "{", "this", ".", "Short", "(", "values", "[", "off", "++", "]", ")", ";", "}", "return", "this", ";", "}" ]
Print values from short array @param values short value array, must not be null @param off offset to the first element @param len number of elements to print @return the context @throws IOException it will be thrown for transport error
[ "Print", "values", "from", "short", "array" ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L957-L962
spring-projects/spring-hateoas
src/main/java/org/springframework/hateoas/client/Rels.java
Rels.getRelFor
public static Rel getRelFor(String rel, LinkDiscoverers discoverers) { """ Creates a new {@link Rel} for the given relation name and {@link LinkDiscoverers}. @param rel must not be {@literal null} or empty. @param discoverers must not be {@literal null}. @return """ Assert.hasText(rel, "Relation name must not be null!"); Assert.notNull(discoverers, "LinkDiscoverers must not be null!"); if (rel.startsWith("$")) { return new JsonPathRel(rel); } return new LinkDiscovererRel(rel, discoverers); }
java
public static Rel getRelFor(String rel, LinkDiscoverers discoverers) { Assert.hasText(rel, "Relation name must not be null!"); Assert.notNull(discoverers, "LinkDiscoverers must not be null!"); if (rel.startsWith("$")) { return new JsonPathRel(rel); } return new LinkDiscovererRel(rel, discoverers); }
[ "public", "static", "Rel", "getRelFor", "(", "String", "rel", ",", "LinkDiscoverers", "discoverers", ")", "{", "Assert", ".", "hasText", "(", "rel", ",", "\"Relation name must not be null!\"", ")", ";", "Assert", ".", "notNull", "(", "discoverers", ",", "\"LinkDiscoverers must not be null!\"", ")", ";", "if", "(", "rel", ".", "startsWith", "(", "\"$\"", ")", ")", "{", "return", "new", "JsonPathRel", "(", "rel", ")", ";", "}", "return", "new", "LinkDiscovererRel", "(", "rel", ",", "discoverers", ")", ";", "}" ]
Creates a new {@link Rel} for the given relation name and {@link LinkDiscoverers}. @param rel must not be {@literal null} or empty. @param discoverers must not be {@literal null}. @return
[ "Creates", "a", "new", "{", "@link", "Rel", "}", "for", "the", "given", "relation", "name", "and", "{", "@link", "LinkDiscoverers", "}", "." ]
train
https://github.com/spring-projects/spring-hateoas/blob/70ebff9309f086cd8d6a97daf67e0dc215c87d9c/src/main/java/org/springframework/hateoas/client/Rels.java#L43-L53
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/CallableUtils.java
CallableUtils.getStoredProcedureShortNameFromSql
public static String getStoredProcedureShortNameFromSql(String decodedSql) { """ Returns short function name. Example: schema.package.name - "name" would be returned @param decodedSql SQL String which would be processed @return procedure name """ String spName = null; Pattern regexPattern = null; Matcher regexMatcher = null; String procedureFullName = getStoredProcedureFullName(decodedSql); String[] procedurePath = procedureFullName.split("[.]"); if (procedurePath.length > 0) { spName = procedurePath[procedurePath.length - 1]; } else { throw new IllegalArgumentException(String.format(ERROR_SHORT_PROCEDURE_NAME_NOT_FOUND, procedureFullName)); } return spName; }
java
public static String getStoredProcedureShortNameFromSql(String decodedSql) { String spName = null; Pattern regexPattern = null; Matcher regexMatcher = null; String procedureFullName = getStoredProcedureFullName(decodedSql); String[] procedurePath = procedureFullName.split("[.]"); if (procedurePath.length > 0) { spName = procedurePath[procedurePath.length - 1]; } else { throw new IllegalArgumentException(String.format(ERROR_SHORT_PROCEDURE_NAME_NOT_FOUND, procedureFullName)); } return spName; }
[ "public", "static", "String", "getStoredProcedureShortNameFromSql", "(", "String", "decodedSql", ")", "{", "String", "spName", "=", "null", ";", "Pattern", "regexPattern", "=", "null", ";", "Matcher", "regexMatcher", "=", "null", ";", "String", "procedureFullName", "=", "getStoredProcedureFullName", "(", "decodedSql", ")", ";", "String", "[", "]", "procedurePath", "=", "procedureFullName", ".", "split", "(", "\"[.]\"", ")", ";", "if", "(", "procedurePath", ".", "length", ">", "0", ")", "{", "spName", "=", "procedurePath", "[", "procedurePath", ".", "length", "-", "1", "]", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "ERROR_SHORT_PROCEDURE_NAME_NOT_FOUND", ",", "procedureFullName", ")", ")", ";", "}", "return", "spName", ";", "}" ]
Returns short function name. Example: schema.package.name - "name" would be returned @param decodedSql SQL String which would be processed @return procedure name
[ "Returns", "short", "function", "name", ".", "Example", ":", "schema", ".", "package", ".", "name", "-", "name", "would", "be", "returned" ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/CallableUtils.java#L59-L76
epam/parso
src/main/java/com/epam/parso/DataWriterUtil.java
DataWriterUtil.getRowValues
public static List<String> getRowValues(List<Column> columns, Object[] row, Map<Integer, Format> columnFormatters) throws IOException { """ The method to convert the Objects array that stores data from the sas7bdat file to list of string. @param columns the {@link Column} class variables list that stores columns description from the sas7bdat file. @param row the Objects arrays that stores data from the sas7bdat file. @param columnFormatters the map that stores (@link Column#id) column identifier and the formatter for converting locale-sensitive values stored in this column into string. @return list of String objects that represent data from sas7bdat file. @throws java.io.IOException appears if the output into writer is impossible. """ return getRowValues(columns, row, DEFAULT_LOCALE, columnFormatters); }
java
public static List<String> getRowValues(List<Column> columns, Object[] row, Map<Integer, Format> columnFormatters) throws IOException { return getRowValues(columns, row, DEFAULT_LOCALE, columnFormatters); }
[ "public", "static", "List", "<", "String", ">", "getRowValues", "(", "List", "<", "Column", ">", "columns", ",", "Object", "[", "]", "row", ",", "Map", "<", "Integer", ",", "Format", ">", "columnFormatters", ")", "throws", "IOException", "{", "return", "getRowValues", "(", "columns", ",", "row", ",", "DEFAULT_LOCALE", ",", "columnFormatters", ")", ";", "}" ]
The method to convert the Objects array that stores data from the sas7bdat file to list of string. @param columns the {@link Column} class variables list that stores columns description from the sas7bdat file. @param row the Objects arrays that stores data from the sas7bdat file. @param columnFormatters the map that stores (@link Column#id) column identifier and the formatter for converting locale-sensitive values stored in this column into string. @return list of String objects that represent data from sas7bdat file. @throws java.io.IOException appears if the output into writer is impossible.
[ "The", "method", "to", "convert", "the", "Objects", "array", "that", "stores", "data", "from", "the", "sas7bdat", "file", "to", "list", "of", "string", "." ]
train
https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/DataWriterUtil.java#L356-L359
Stratio/stratio-cassandra
src/java/org/apache/cassandra/io/sstable/ColumnNameHelper.java
ColumnNameHelper.minComponents
public static List<ByteBuffer> minComponents(List<ByteBuffer> minSeen, Composite candidate, CellNameType comparator) { """ finds the min cell name component(s) Note that this method *can modify maxSeen*. @param minSeen the max columns seen so far @param candidate the candidate column(s) @param comparator the comparator to use @return a list with the min column(s) """ // For a cell name, no reason to look more than the clustering prefix // (and comparing the collection element would actually crash) int size = Math.min(candidate.size(), comparator.clusteringPrefixSize()); if (minSeen.isEmpty()) return getComponents(candidate, size); // In most case maxSeen is big enough to hold the result so update it in place in those cases minSeen = maybeGrow(minSeen, size); for (int i = 0; i < size; i++) minSeen.set(i, min(minSeen.get(i), candidate.get(i), comparator.subtype(i))); return minSeen; }
java
public static List<ByteBuffer> minComponents(List<ByteBuffer> minSeen, Composite candidate, CellNameType comparator) { // For a cell name, no reason to look more than the clustering prefix // (and comparing the collection element would actually crash) int size = Math.min(candidate.size(), comparator.clusteringPrefixSize()); if (minSeen.isEmpty()) return getComponents(candidate, size); // In most case maxSeen is big enough to hold the result so update it in place in those cases minSeen = maybeGrow(minSeen, size); for (int i = 0; i < size; i++) minSeen.set(i, min(minSeen.get(i), candidate.get(i), comparator.subtype(i))); return minSeen; }
[ "public", "static", "List", "<", "ByteBuffer", ">", "minComponents", "(", "List", "<", "ByteBuffer", ">", "minSeen", ",", "Composite", "candidate", ",", "CellNameType", "comparator", ")", "{", "// For a cell name, no reason to look more than the clustering prefix", "// (and comparing the collection element would actually crash)", "int", "size", "=", "Math", ".", "min", "(", "candidate", ".", "size", "(", ")", ",", "comparator", ".", "clusteringPrefixSize", "(", ")", ")", ";", "if", "(", "minSeen", ".", "isEmpty", "(", ")", ")", "return", "getComponents", "(", "candidate", ",", "size", ")", ";", "// In most case maxSeen is big enough to hold the result so update it in place in those cases", "minSeen", "=", "maybeGrow", "(", "minSeen", ",", "size", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "minSeen", ".", "set", "(", "i", ",", "min", "(", "minSeen", ".", "get", "(", "i", ")", ",", "candidate", ".", "get", "(", "i", ")", ",", "comparator", ".", "subtype", "(", "i", ")", ")", ")", ";", "return", "minSeen", ";", "}" ]
finds the min cell name component(s) Note that this method *can modify maxSeen*. @param minSeen the max columns seen so far @param candidate the candidate column(s) @param comparator the comparator to use @return a list with the min column(s)
[ "finds", "the", "min", "cell", "name", "component", "(", "s", ")" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/io/sstable/ColumnNameHelper.java#L91-L107
noties/Scrollable
library/src/main/java/ru/noties/scrollable/ScrollableLayout.java
ScrollableLayout.initScroller
protected ScrollableScroller initScroller(Context context, Interpolator interpolator, boolean flywheel) { """ Override this method if you wish to create own {@link android.widget.Scroller} @param context {@link android.content.Context} @param interpolator {@link android.view.animation.Interpolator}, the default implementation passes <code>null</code> @param flywheel {@link android.widget.Scroller#Scroller(android.content.Context, android.view.animation.Interpolator, boolean)} @return new instance of {@link android.widget.Scroller} must not bu null """ return new ScrollableScroller(context, interpolator, flywheel); }
java
protected ScrollableScroller initScroller(Context context, Interpolator interpolator, boolean flywheel) { return new ScrollableScroller(context, interpolator, flywheel); }
[ "protected", "ScrollableScroller", "initScroller", "(", "Context", "context", ",", "Interpolator", "interpolator", ",", "boolean", "flywheel", ")", "{", "return", "new", "ScrollableScroller", "(", "context", ",", "interpolator", ",", "flywheel", ")", ";", "}" ]
Override this method if you wish to create own {@link android.widget.Scroller} @param context {@link android.content.Context} @param interpolator {@link android.view.animation.Interpolator}, the default implementation passes <code>null</code> @param flywheel {@link android.widget.Scroller#Scroller(android.content.Context, android.view.animation.Interpolator, boolean)} @return new instance of {@link android.widget.Scroller} must not bu null
[ "Override", "this", "method", "if", "you", "wish", "to", "create", "own", "{" ]
train
https://github.com/noties/Scrollable/blob/e93213f04b41870b282dc810db70e29f7d225d5d/library/src/main/java/ru/noties/scrollable/ScrollableLayout.java#L289-L291
liferay/com-liferay-commerce
commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceEntryPersistenceImpl.java
CommercePriceEntryPersistenceImpl.findByCompanyId
@Override public List<CommercePriceEntry> findByCompanyId(long companyId, int start, int end) { """ Returns a range of all the commerce price entries where companyId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommercePriceEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param companyId the company ID @param start the lower bound of the range of commerce price entries @param end the upper bound of the range of commerce price entries (not inclusive) @return the range of matching commerce price entries """ return findByCompanyId(companyId, start, end, null); }
java
@Override public List<CommercePriceEntry> findByCompanyId(long companyId, int start, int end) { return findByCompanyId(companyId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommercePriceEntry", ">", "findByCompanyId", "(", "long", "companyId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByCompanyId", "(", "companyId", ",", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the commerce price entries where companyId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommercePriceEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param companyId the company ID @param start the lower bound of the range of commerce price entries @param end the upper bound of the range of commerce price entries (not inclusive) @return the range of matching commerce price entries
[ "Returns", "a", "range", "of", "all", "the", "commerce", "price", "entries", "where", "companyId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceEntryPersistenceImpl.java#L2046-L2050
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/AssetsInner.java
AssetsInner.getAsync
public Observable<AssetInner> getAsync(String resourceGroupName, String accountName, String assetName) { """ Get an Asset. Get the details of an Asset in the Media Services account. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param assetName The Asset name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AssetInner object """ return getWithServiceResponseAsync(resourceGroupName, accountName, assetName).map(new Func1<ServiceResponse<AssetInner>, AssetInner>() { @Override public AssetInner call(ServiceResponse<AssetInner> response) { return response.body(); } }); }
java
public Observable<AssetInner> getAsync(String resourceGroupName, String accountName, String assetName) { return getWithServiceResponseAsync(resourceGroupName, accountName, assetName).map(new Func1<ServiceResponse<AssetInner>, AssetInner>() { @Override public AssetInner call(ServiceResponse<AssetInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AssetInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "assetName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "assetName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "AssetInner", ">", ",", "AssetInner", ">", "(", ")", "{", "@", "Override", "public", "AssetInner", "call", "(", "ServiceResponse", "<", "AssetInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Get an Asset. Get the details of an Asset in the Media Services account. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param assetName The Asset name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AssetInner object
[ "Get", "an", "Asset", ".", "Get", "the", "details", "of", "an", "Asset", "in", "the", "Media", "Services", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/AssetsInner.java#L409-L416
infinispan/infinispan
core/src/main/java/org/infinispan/remoting/transport/jgroups/JGroupsTransport.java
JGroupsTransport.sendCommandToAll
private void sendCommandToAll(ReplicableCommand command, long requestId, DeliverOrder deliverOrder, boolean rsvp) { """ Send a command to the entire cluster. Doesn't send the command to itself unless {@code deliverOrder == TOTAL}. """ Message message = new Message(); marshallRequest(message, command, requestId); setMessageFlags(message, deliverOrder, rsvp, true); if (deliverOrder == DeliverOrder.TOTAL) { message.dest(new AnycastAddress()); } send(message); }
java
private void sendCommandToAll(ReplicableCommand command, long requestId, DeliverOrder deliverOrder, boolean rsvp) { Message message = new Message(); marshallRequest(message, command, requestId); setMessageFlags(message, deliverOrder, rsvp, true); if (deliverOrder == DeliverOrder.TOTAL) { message.dest(new AnycastAddress()); } send(message); }
[ "private", "void", "sendCommandToAll", "(", "ReplicableCommand", "command", ",", "long", "requestId", ",", "DeliverOrder", "deliverOrder", ",", "boolean", "rsvp", ")", "{", "Message", "message", "=", "new", "Message", "(", ")", ";", "marshallRequest", "(", "message", ",", "command", ",", "requestId", ")", ";", "setMessageFlags", "(", "message", ",", "deliverOrder", ",", "rsvp", ",", "true", ")", ";", "if", "(", "deliverOrder", "==", "DeliverOrder", ".", "TOTAL", ")", "{", "message", ".", "dest", "(", "new", "AnycastAddress", "(", ")", ")", ";", "}", "send", "(", "message", ")", ";", "}" ]
Send a command to the entire cluster. Doesn't send the command to itself unless {@code deliverOrder == TOTAL}.
[ "Send", "a", "command", "to", "the", "entire", "cluster", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/remoting/transport/jgroups/JGroupsTransport.java#L1163-L1173
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/Parameters.java
Parameters.setNumber
@NonNull public Parameters setNumber(@NonNull String name, Number value) { """ Set an Number value to the query parameter referenced by the given name. A query parameter is defined by using the Expression's parameter(String name) function. @param name The parameter name. @param value The Number value. @return The self object. """ return setValue(name, value); }
java
@NonNull public Parameters setNumber(@NonNull String name, Number value) { return setValue(name, value); }
[ "@", "NonNull", "public", "Parameters", "setNumber", "(", "@", "NonNull", "String", "name", ",", "Number", "value", ")", "{", "return", "setValue", "(", "name", ",", "value", ")", ";", "}" ]
Set an Number value to the query parameter referenced by the given name. A query parameter is defined by using the Expression's parameter(String name) function. @param name The parameter name. @param value The Number value. @return The self object.
[ "Set", "an", "Number", "value", "to", "the", "query", "parameter", "referenced", "by", "the", "given", "name", ".", "A", "query", "parameter", "is", "defined", "by", "using", "the", "Expression", "s", "parameter", "(", "String", "name", ")", "function", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Parameters.java#L92-L95
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/br/br_configurebandwidth5x.java
br_configurebandwidth5x.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { """ <pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre> """ br_configurebandwidth5x_responses result = (br_configurebandwidth5x_responses) service.get_payload_formatter().string_to_resource(br_configurebandwidth5x_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_configurebandwidth5x_response_array); } br_configurebandwidth5x[] result_br_configurebandwidth5x = new br_configurebandwidth5x[result.br_configurebandwidth5x_response_array.length]; for(int i = 0; i < result.br_configurebandwidth5x_response_array.length; i++) { result_br_configurebandwidth5x[i] = result.br_configurebandwidth5x_response_array[i].br_configurebandwidth5x[0]; } return result_br_configurebandwidth5x; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { br_configurebandwidth5x_responses result = (br_configurebandwidth5x_responses) service.get_payload_formatter().string_to_resource(br_configurebandwidth5x_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_configurebandwidth5x_response_array); } br_configurebandwidth5x[] result_br_configurebandwidth5x = new br_configurebandwidth5x[result.br_configurebandwidth5x_response_array.length]; for(int i = 0; i < result.br_configurebandwidth5x_response_array.length; i++) { result_br_configurebandwidth5x[i] = result.br_configurebandwidth5x_response_array[i].br_configurebandwidth5x[0]; } return result_br_configurebandwidth5x; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "br_configurebandwidth5x_responses", "result", "=", "(", "br_configurebandwidth5x_responses", ")", "service", ".", "get_payload_formatter", "(", ")", ".", "string_to_resource", "(", "br_configurebandwidth5x_responses", ".", "class", ",", "response", ")", ";", "if", "(", "result", ".", "errorcode", "!=", "0", ")", "{", "if", "(", "result", ".", "errorcode", "==", "SESSION_NOT_EXISTS", ")", "service", ".", "clear_session", "(", ")", ";", "throw", "new", "nitro_exception", "(", "result", ".", "message", ",", "result", ".", "errorcode", ",", "(", "base_response", "[", "]", ")", "result", ".", "br_configurebandwidth5x_response_array", ")", ";", "}", "br_configurebandwidth5x", "[", "]", "result_br_configurebandwidth5x", "=", "new", "br_configurebandwidth5x", "[", "result", ".", "br_configurebandwidth5x_response_array", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "result", ".", "br_configurebandwidth5x_response_array", ".", "length", ";", "i", "++", ")", "{", "result_br_configurebandwidth5x", "[", "i", "]", "=", "result", ".", "br_configurebandwidth5x_response_array", "[", "i", "]", ".", "br_configurebandwidth5x", "[", "0", "]", ";", "}", "return", "result_br_configurebandwidth5x", ";", "}" ]
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br/br_configurebandwidth5x.java#L241-L258
icon-Systemhaus-GmbH/javassist-maven-plugin
src/main/java/de/icongmbh/oss/maven/plugin/javassist/ClassnameExtractor.java
ClassnameExtractor.extractClassNameFromFile
public static String extractClassNameFromFile(final File parentDirectory, final File classFile) throws IOException { """ Remove parent directory from file name and replace directory separator with dots. <ul> <li>parentDirectory: {@code /tmp/my/parent/src/}</li> <li>classFile: {@code /tmp/my/parent/src/foo/bar/MyApp.class}</li> </ul> returns: {@code foo.bar.MyApp} @param parentDirectory to remove from {@code classFile} and maybe {@code null}. @param classFile to extract the name from. Maybe {@code null} @return class name extracted from file name or {@code null} @throws IOException by file operations """ if (null == classFile) { return null; } final String qualifiedFileName = parentDirectory != null ? classFile.getCanonicalPath() .substring(parentDirectory.getCanonicalPath().length() + 1) : classFile.getCanonicalPath(); return removeExtension(qualifiedFileName.replace(File.separator, ".")); }
java
public static String extractClassNameFromFile(final File parentDirectory, final File classFile) throws IOException { if (null == classFile) { return null; } final String qualifiedFileName = parentDirectory != null ? classFile.getCanonicalPath() .substring(parentDirectory.getCanonicalPath().length() + 1) : classFile.getCanonicalPath(); return removeExtension(qualifiedFileName.replace(File.separator, ".")); }
[ "public", "static", "String", "extractClassNameFromFile", "(", "final", "File", "parentDirectory", ",", "final", "File", "classFile", ")", "throws", "IOException", "{", "if", "(", "null", "==", "classFile", ")", "{", "return", "null", ";", "}", "final", "String", "qualifiedFileName", "=", "parentDirectory", "!=", "null", "?", "classFile", ".", "getCanonicalPath", "(", ")", ".", "substring", "(", "parentDirectory", ".", "getCanonicalPath", "(", ")", ".", "length", "(", ")", "+", "1", ")", ":", "classFile", ".", "getCanonicalPath", "(", ")", ";", "return", "removeExtension", "(", "qualifiedFileName", ".", "replace", "(", "File", ".", "separator", ",", "\".\"", ")", ")", ";", "}" ]
Remove parent directory from file name and replace directory separator with dots. <ul> <li>parentDirectory: {@code /tmp/my/parent/src/}</li> <li>classFile: {@code /tmp/my/parent/src/foo/bar/MyApp.class}</li> </ul> returns: {@code foo.bar.MyApp} @param parentDirectory to remove from {@code classFile} and maybe {@code null}. @param classFile to extract the name from. Maybe {@code null} @return class name extracted from file name or {@code null} @throws IOException by file operations
[ "Remove", "parent", "directory", "from", "file", "name", "and", "replace", "directory", "separator", "with", "dots", "." ]
train
https://github.com/icon-Systemhaus-GmbH/javassist-maven-plugin/blob/798368f79a0bd641648bebd8546388daf013a50e/src/main/java/de/icongmbh/oss/maven/plugin/javassist/ClassnameExtractor.java#L54-L64
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java
AsyncMutateInBuilder.arrayPrepend
public <T> AsyncMutateInBuilder arrayPrepend(String path, T value) { """ Prepend to an existing array, pushing the value to the front/first position in the array. @param path the path of the array. @param value the value to insert at the front of the array. """ this.mutationSpecs.add(new MutationSpec(Mutation.ARRAY_PUSH_FIRST, path, value)); return this; }
java
public <T> AsyncMutateInBuilder arrayPrepend(String path, T value) { this.mutationSpecs.add(new MutationSpec(Mutation.ARRAY_PUSH_FIRST, path, value)); return this; }
[ "public", "<", "T", ">", "AsyncMutateInBuilder", "arrayPrepend", "(", "String", "path", ",", "T", "value", ")", "{", "this", ".", "mutationSpecs", ".", "add", "(", "new", "MutationSpec", "(", "Mutation", ".", "ARRAY_PUSH_FIRST", ",", "path", ",", "value", ")", ")", ";", "return", "this", ";", "}" ]
Prepend to an existing array, pushing the value to the front/first position in the array. @param path the path of the array. @param value the value to insert at the front of the array.
[ "Prepend", "to", "an", "existing", "array", "pushing", "the", "value", "to", "the", "front", "/", "first", "position", "in", "the", "array", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java#L871-L874
apache/incubator-gobblin
gobblin-service/src/main/java/org/apache/gobblin/service/modules/restli/GobblinServiceFlowConfigResourceHandler.java
GobblinServiceFlowConfigResourceHandler.updateFlowConfig
@Override public UpdateResponse updateFlowConfig(FlowId flowId, FlowConfig flowConfig) throws FlowConfigLoggedException { """ Updating {@link FlowConfig} should check if current node is active (master). If current node is active, call {@link FlowConfigResourceLocalHandler#updateFlowConfig(FlowId, FlowConfig)} directly. If current node is standby, forward {@link ServiceConfigKeys#HELIX_FLOWSPEC_UPDATE} to active. The remote active will then call {@link FlowConfigResourceLocalHandler#updateFlowConfig(FlowId, FlowConfig)}. Please refer to {@link org.apache.gobblin.service.modules.core.ControllerUserDefinedMessageHandlerFactory} for remote handling. For better I/O load balance, user can enable {@link GobblinServiceFlowConfigResourceHandler#flowCatalogLocalCommit}. The {@link FlowConfig} will be then persisted to {@link org.apache.gobblin.runtime.spec_catalog.FlowCatalog} first before it is forwarded to active node (if current node is standby) for execution. """ String flowName = flowId.getFlowName(); String flowGroup = flowId.getFlowGroup(); if (!flowGroup.equals(flowConfig.getId().getFlowGroup()) || !flowName.equals(flowConfig.getId().getFlowName())) { throw new FlowConfigLoggedException(HttpStatus.S_400_BAD_REQUEST, "flowName and flowGroup cannot be changed in update", null); } checkHelixConnection(ServiceConfigKeys.HELIX_FLOWSPEC_UPDATE, flowName, flowGroup); try { if (!jobScheduler.isActive() && helixManager.isPresent()) { if (this.flowCatalogLocalCommit) { // We will handle FS I/O locally for load balance before forwarding to remote node. this.localHandler.updateFlowConfig(flowId, flowConfig, false); } forwardMessage(ServiceConfigKeys.HELIX_FLOWSPEC_UPDATE, FlowConfigUtils.serializeFlowConfig(flowConfig), flowName, flowGroup); // Do actual work on remote node, directly return success log.info("Forwarding update flowConfig [flowName=" + flowName + " flowGroup=" + flowGroup + "]"); return new UpdateResponse(HttpStatus.S_200_OK); } else { return this.localHandler.updateFlowConfig(flowId, flowConfig); } } catch (IOException e) { throw new FlowConfigLoggedException(HttpStatus.S_500_INTERNAL_SERVER_ERROR, "Cannot update flowConfig [flowName=" + flowName + " flowGroup=" + flowGroup + "]", e); } }
java
@Override public UpdateResponse updateFlowConfig(FlowId flowId, FlowConfig flowConfig) throws FlowConfigLoggedException { String flowName = flowId.getFlowName(); String flowGroup = flowId.getFlowGroup(); if (!flowGroup.equals(flowConfig.getId().getFlowGroup()) || !flowName.equals(flowConfig.getId().getFlowName())) { throw new FlowConfigLoggedException(HttpStatus.S_400_BAD_REQUEST, "flowName and flowGroup cannot be changed in update", null); } checkHelixConnection(ServiceConfigKeys.HELIX_FLOWSPEC_UPDATE, flowName, flowGroup); try { if (!jobScheduler.isActive() && helixManager.isPresent()) { if (this.flowCatalogLocalCommit) { // We will handle FS I/O locally for load balance before forwarding to remote node. this.localHandler.updateFlowConfig(flowId, flowConfig, false); } forwardMessage(ServiceConfigKeys.HELIX_FLOWSPEC_UPDATE, FlowConfigUtils.serializeFlowConfig(flowConfig), flowName, flowGroup); // Do actual work on remote node, directly return success log.info("Forwarding update flowConfig [flowName=" + flowName + " flowGroup=" + flowGroup + "]"); return new UpdateResponse(HttpStatus.S_200_OK); } else { return this.localHandler.updateFlowConfig(flowId, flowConfig); } } catch (IOException e) { throw new FlowConfigLoggedException(HttpStatus.S_500_INTERNAL_SERVER_ERROR, "Cannot update flowConfig [flowName=" + flowName + " flowGroup=" + flowGroup + "]", e); } }
[ "@", "Override", "public", "UpdateResponse", "updateFlowConfig", "(", "FlowId", "flowId", ",", "FlowConfig", "flowConfig", ")", "throws", "FlowConfigLoggedException", "{", "String", "flowName", "=", "flowId", ".", "getFlowName", "(", ")", ";", "String", "flowGroup", "=", "flowId", ".", "getFlowGroup", "(", ")", ";", "if", "(", "!", "flowGroup", ".", "equals", "(", "flowConfig", ".", "getId", "(", ")", ".", "getFlowGroup", "(", ")", ")", "||", "!", "flowName", ".", "equals", "(", "flowConfig", ".", "getId", "(", ")", ".", "getFlowName", "(", ")", ")", ")", "{", "throw", "new", "FlowConfigLoggedException", "(", "HttpStatus", ".", "S_400_BAD_REQUEST", ",", "\"flowName and flowGroup cannot be changed in update\"", ",", "null", ")", ";", "}", "checkHelixConnection", "(", "ServiceConfigKeys", ".", "HELIX_FLOWSPEC_UPDATE", ",", "flowName", ",", "flowGroup", ")", ";", "try", "{", "if", "(", "!", "jobScheduler", ".", "isActive", "(", ")", "&&", "helixManager", ".", "isPresent", "(", ")", ")", "{", "if", "(", "this", ".", "flowCatalogLocalCommit", ")", "{", "// We will handle FS I/O locally for load balance before forwarding to remote node.", "this", ".", "localHandler", ".", "updateFlowConfig", "(", "flowId", ",", "flowConfig", ",", "false", ")", ";", "}", "forwardMessage", "(", "ServiceConfigKeys", ".", "HELIX_FLOWSPEC_UPDATE", ",", "FlowConfigUtils", ".", "serializeFlowConfig", "(", "flowConfig", ")", ",", "flowName", ",", "flowGroup", ")", ";", "// Do actual work on remote node, directly return success", "log", ".", "info", "(", "\"Forwarding update flowConfig [flowName=\"", "+", "flowName", "+", "\" flowGroup=\"", "+", "flowGroup", "+", "\"]\"", ")", ";", "return", "new", "UpdateResponse", "(", "HttpStatus", ".", "S_200_OK", ")", ";", "}", "else", "{", "return", "this", ".", "localHandler", ".", "updateFlowConfig", "(", "flowId", ",", "flowConfig", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "FlowConfigLoggedException", "(", "HttpStatus", ".", "S_500_INTERNAL_SERVER_ERROR", ",", "\"Cannot update flowConfig [flowName=\"", "+", "flowName", "+", "\" flowGroup=\"", "+", "flowGroup", "+", "\"]\"", ",", "e", ")", ";", "}", "}" ]
Updating {@link FlowConfig} should check if current node is active (master). If current node is active, call {@link FlowConfigResourceLocalHandler#updateFlowConfig(FlowId, FlowConfig)} directly. If current node is standby, forward {@link ServiceConfigKeys#HELIX_FLOWSPEC_UPDATE} to active. The remote active will then call {@link FlowConfigResourceLocalHandler#updateFlowConfig(FlowId, FlowConfig)}. Please refer to {@link org.apache.gobblin.service.modules.core.ControllerUserDefinedMessageHandlerFactory} for remote handling. For better I/O load balance, user can enable {@link GobblinServiceFlowConfigResourceHandler#flowCatalogLocalCommit}. The {@link FlowConfig} will be then persisted to {@link org.apache.gobblin.runtime.spec_catalog.FlowCatalog} first before it is forwarded to active node (if current node is standby) for execution.
[ "Updating", "{", "@link", "FlowConfig", "}", "should", "check", "if", "current", "node", "is", "active", "(", "master", ")", ".", "If", "current", "node", "is", "active", "call", "{", "@link", "FlowConfigResourceLocalHandler#updateFlowConfig", "(", "FlowId", "FlowConfig", ")", "}", "directly", ".", "If", "current", "node", "is", "standby", "forward", "{", "@link", "ServiceConfigKeys#HELIX_FLOWSPEC_UPDATE", "}", "to", "active", ".", "The", "remote", "active", "will", "then", "call", "{", "@link", "FlowConfigResourceLocalHandler#updateFlowConfig", "(", "FlowId", "FlowConfig", ")", "}", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/modules/restli/GobblinServiceFlowConfigResourceHandler.java#L135-L169
arquillian/arquillian-extension-warp
impl/src/main/java/org/jboss/arquillian/warp/impl/server/execution/WarpFilter.java
WarpFilter.doFilter
@Override public void doFilter(ServletRequest req, ServletResponse resp, final FilterChain chain) throws IOException, ServletException { """ Detects whenever the request is HTTP request and if yes, delegates to {@link #doFilterHttp(HttpServletRequest, HttpServletResponse, FilterChain)}. """ if (manager == null || isHttpRequest(req, resp)) { doFilterHttp((HttpServletRequest) req, (HttpServletResponse) resp, chain); } else { chain.doFilter(req, resp); } }
java
@Override public void doFilter(ServletRequest req, ServletResponse resp, final FilterChain chain) throws IOException, ServletException { if (manager == null || isHttpRequest(req, resp)) { doFilterHttp((HttpServletRequest) req, (HttpServletResponse) resp, chain); } else { chain.doFilter(req, resp); } }
[ "@", "Override", "public", "void", "doFilter", "(", "ServletRequest", "req", ",", "ServletResponse", "resp", ",", "final", "FilterChain", "chain", ")", "throws", "IOException", ",", "ServletException", "{", "if", "(", "manager", "==", "null", "||", "isHttpRequest", "(", "req", ",", "resp", ")", ")", "{", "doFilterHttp", "(", "(", "HttpServletRequest", ")", "req", ",", "(", "HttpServletResponse", ")", "resp", ",", "chain", ")", ";", "}", "else", "{", "chain", ".", "doFilter", "(", "req", ",", "resp", ")", ";", "}", "}" ]
Detects whenever the request is HTTP request and if yes, delegates to {@link #doFilterHttp(HttpServletRequest, HttpServletResponse, FilterChain)}.
[ "Detects", "whenever", "the", "request", "is", "HTTP", "request", "and", "if", "yes", "delegates", "to", "{" ]
train
https://github.com/arquillian/arquillian-extension-warp/blob/e958f4d782851baf7f40e39835d3d1ad185b74dd/impl/src/main/java/org/jboss/arquillian/warp/impl/server/execution/WarpFilter.java#L89-L98
intellimate/Izou
src/main/java/org/intellimate/izou/security/SecurityFunctions.java
SecurityFunctions.decryptAES
public String decryptAES(byte[] cipherBytes, SecretKey key) { """ Applies an AES decryption on the byte array {@code cipherBytes} with they given key. The key has to be the same key used during encryption, else null is returned @param cipherBytes the byte array to decrypt @param key the key to use during the decryption @return the decrypted string if everything was successful, else null """ String plainText = null; Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); try { Cipher cipher = Cipher.getInstance("AES", "BC"); cipher.init(Cipher.DECRYPT_MODE, key); byte[] bytePlainText = cipher.doFinal(cipherBytes); plainText = new String(bytePlainText, "UTF-8"); } catch (IllegalBlockSizeException | InvalidKeyException | NoSuchAlgorithmException | BadPaddingException | NoSuchPaddingException | UnsupportedEncodingException | NoSuchProviderException e) { logger.error("Unable to apply AES decryption", e); } return plainText; }
java
public String decryptAES(byte[] cipherBytes, SecretKey key) { String plainText = null; Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); try { Cipher cipher = Cipher.getInstance("AES", "BC"); cipher.init(Cipher.DECRYPT_MODE, key); byte[] bytePlainText = cipher.doFinal(cipherBytes); plainText = new String(bytePlainText, "UTF-8"); } catch (IllegalBlockSizeException | InvalidKeyException | NoSuchAlgorithmException | BadPaddingException | NoSuchPaddingException | UnsupportedEncodingException | NoSuchProviderException e) { logger.error("Unable to apply AES decryption", e); } return plainText; }
[ "public", "String", "decryptAES", "(", "byte", "[", "]", "cipherBytes", ",", "SecretKey", "key", ")", "{", "String", "plainText", "=", "null", ";", "Security", ".", "addProvider", "(", "new", "org", ".", "bouncycastle", ".", "jce", ".", "provider", ".", "BouncyCastleProvider", "(", ")", ")", ";", "try", "{", "Cipher", "cipher", "=", "Cipher", ".", "getInstance", "(", "\"AES\"", ",", "\"BC\"", ")", ";", "cipher", ".", "init", "(", "Cipher", ".", "DECRYPT_MODE", ",", "key", ")", ";", "byte", "[", "]", "bytePlainText", "=", "cipher", ".", "doFinal", "(", "cipherBytes", ")", ";", "plainText", "=", "new", "String", "(", "bytePlainText", ",", "\"UTF-8\"", ")", ";", "}", "catch", "(", "IllegalBlockSizeException", "|", "InvalidKeyException", "|", "NoSuchAlgorithmException", "|", "BadPaddingException", "|", "NoSuchPaddingException", "|", "UnsupportedEncodingException", "|", "NoSuchProviderException", "e", ")", "{", "logger", ".", "error", "(", "\"Unable to apply AES decryption\"", ",", "e", ")", ";", "}", "return", "plainText", ";", "}" ]
Applies an AES decryption on the byte array {@code cipherBytes} with they given key. The key has to be the same key used during encryption, else null is returned @param cipherBytes the byte array to decrypt @param key the key to use during the decryption @return the decrypted string if everything was successful, else null
[ "Applies", "an", "AES", "decryption", "on", "the", "byte", "array", "{", "@code", "cipherBytes", "}", "with", "they", "given", "key", ".", "The", "key", "has", "to", "be", "the", "same", "key", "used", "during", "encryption", "else", "null", "is", "returned" ]
train
https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/security/SecurityFunctions.java#L73-L87
apache/groovy
subprojects/groovy-templates/src/main/groovy/groovy/text/markup/BaseTemplate.java
BaseTemplate.methodMissing
public Object methodMissing(String tagName, Object args) throws IOException { """ This is the main method responsible for writing a tag and its attributes. The arguments may be: <ul> <li>a closure</li> in which case the closure is rendered inside the tag body <li>a string</li>, in which case the string is rendered as the tag body <li>a map of attributes</li> in which case the attributes are rendered inside the opening tag </ul> <p>or a combination of (attributes,string), (attributes,closure)</p> @param tagName the name of the tag @param args tag generation arguments @return this template instance @throws IOException """ Object o = model.get(tagName); if (o instanceof Closure) { if (args instanceof Object[]) { yieldUnescaped(((Closure) o).call((Object[])args)); return this; } yieldUnescaped(((Closure) o).call(args)); return this; } else if (args instanceof Object[]) { final Writer wrt = out; TagData tagData = new TagData(args).invoke(); Object body = tagData.getBody(); writeIndent(); wrt.write('<'); wrt.write(tagName); writeAttributes(tagData.getAttributes()); if (body != null) { wrt.write('>'); writeBody(body); writeIndent(); wrt.write("</"); wrt.write(tagName); wrt.write('>'); } else { if (configuration.isExpandEmptyElements()) { wrt.write("></"); wrt.write(tagName); wrt.write('>'); } else { wrt.write("/>"); } } } return this; }
java
public Object methodMissing(String tagName, Object args) throws IOException { Object o = model.get(tagName); if (o instanceof Closure) { if (args instanceof Object[]) { yieldUnescaped(((Closure) o).call((Object[])args)); return this; } yieldUnescaped(((Closure) o).call(args)); return this; } else if (args instanceof Object[]) { final Writer wrt = out; TagData tagData = new TagData(args).invoke(); Object body = tagData.getBody(); writeIndent(); wrt.write('<'); wrt.write(tagName); writeAttributes(tagData.getAttributes()); if (body != null) { wrt.write('>'); writeBody(body); writeIndent(); wrt.write("</"); wrt.write(tagName); wrt.write('>'); } else { if (configuration.isExpandEmptyElements()) { wrt.write("></"); wrt.write(tagName); wrt.write('>'); } else { wrt.write("/>"); } } } return this; }
[ "public", "Object", "methodMissing", "(", "String", "tagName", ",", "Object", "args", ")", "throws", "IOException", "{", "Object", "o", "=", "model", ".", "get", "(", "tagName", ")", ";", "if", "(", "o", "instanceof", "Closure", ")", "{", "if", "(", "args", "instanceof", "Object", "[", "]", ")", "{", "yieldUnescaped", "(", "(", "(", "Closure", ")", "o", ")", ".", "call", "(", "(", "Object", "[", "]", ")", "args", ")", ")", ";", "return", "this", ";", "}", "yieldUnescaped", "(", "(", "(", "Closure", ")", "o", ")", ".", "call", "(", "args", ")", ")", ";", "return", "this", ";", "}", "else", "if", "(", "args", "instanceof", "Object", "[", "]", ")", "{", "final", "Writer", "wrt", "=", "out", ";", "TagData", "tagData", "=", "new", "TagData", "(", "args", ")", ".", "invoke", "(", ")", ";", "Object", "body", "=", "tagData", ".", "getBody", "(", ")", ";", "writeIndent", "(", ")", ";", "wrt", ".", "write", "(", "'", "'", ")", ";", "wrt", ".", "write", "(", "tagName", ")", ";", "writeAttributes", "(", "tagData", ".", "getAttributes", "(", ")", ")", ";", "if", "(", "body", "!=", "null", ")", "{", "wrt", ".", "write", "(", "'", "'", ")", ";", "writeBody", "(", "body", ")", ";", "writeIndent", "(", ")", ";", "wrt", ".", "write", "(", "\"</\"", ")", ";", "wrt", ".", "write", "(", "tagName", ")", ";", "wrt", ".", "write", "(", "'", "'", ")", ";", "}", "else", "{", "if", "(", "configuration", ".", "isExpandEmptyElements", "(", ")", ")", "{", "wrt", ".", "write", "(", "\"></\"", ")", ";", "wrt", ".", "write", "(", "tagName", ")", ";", "wrt", ".", "write", "(", "'", "'", ")", ";", "}", "else", "{", "wrt", ".", "write", "(", "\"/>\"", ")", ";", "}", "}", "}", "return", "this", ";", "}" ]
This is the main method responsible for writing a tag and its attributes. The arguments may be: <ul> <li>a closure</li> in which case the closure is rendered inside the tag body <li>a string</li>, in which case the string is rendered as the tag body <li>a map of attributes</li> in which case the attributes are rendered inside the opening tag </ul> <p>or a combination of (attributes,string), (attributes,closure)</p> @param tagName the name of the tag @param args tag generation arguments @return this template instance @throws IOException
[ "This", "is", "the", "main", "method", "responsible", "for", "writing", "a", "tag", "and", "its", "attributes", ".", "The", "arguments", "may", "be", ":", "<ul", ">", "<li", ">", "a", "closure<", "/", "li", ">", "in", "which", "case", "the", "closure", "is", "rendered", "inside", "the", "tag", "body", "<li", ">", "a", "string<", "/", "li", ">", "in", "which", "case", "the", "string", "is", "rendered", "as", "the", "tag", "body", "<li", ">", "a", "map", "of", "attributes<", "/", "li", ">", "in", "which", "case", "the", "attributes", "are", "rendered", "inside", "the", "opening", "tag", "<", "/", "ul", ">", "<p", ">", "or", "a", "combination", "of", "(", "attributes", "string", ")", "(", "attributes", "closure", ")", "<", "/", "p", ">" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-templates/src/main/groovy/groovy/text/markup/BaseTemplate.java#L232-L267
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/CmsScrollBar.java
CmsScrollBar.adjustKnobHeight
private void adjustKnobHeight(int outerHeight, int innerHeight) { """ Calculates the scroll knob height.<p> @param outerHeight the height of the scrollable element @param innerHeight the height of the scroll content """ int result = (int)((1.0 * outerHeight * outerHeight) / innerHeight); result = result > (outerHeight - 5) ? 5 : (result < 8 ? 8 : result); m_positionValueRatio = (1.0 * (outerHeight - result)) / (innerHeight - outerHeight); m_knobHeight = result - (2 * SCROLL_KNOB_OFFSET); m_knobHeight = m_knobHeight < SCROLL_KNOB_MIN_HEIGHT ? SCROLL_KNOB_MIN_HEIGHT : m_knobHeight; m_knob.getStyle().setHeight(m_knobHeight, Unit.PX); }
java
private void adjustKnobHeight(int outerHeight, int innerHeight) { int result = (int)((1.0 * outerHeight * outerHeight) / innerHeight); result = result > (outerHeight - 5) ? 5 : (result < 8 ? 8 : result); m_positionValueRatio = (1.0 * (outerHeight - result)) / (innerHeight - outerHeight); m_knobHeight = result - (2 * SCROLL_KNOB_OFFSET); m_knobHeight = m_knobHeight < SCROLL_KNOB_MIN_HEIGHT ? SCROLL_KNOB_MIN_HEIGHT : m_knobHeight; m_knob.getStyle().setHeight(m_knobHeight, Unit.PX); }
[ "private", "void", "adjustKnobHeight", "(", "int", "outerHeight", ",", "int", "innerHeight", ")", "{", "int", "result", "=", "(", "int", ")", "(", "(", "1.0", "*", "outerHeight", "*", "outerHeight", ")", "/", "innerHeight", ")", ";", "result", "=", "result", ">", "(", "outerHeight", "-", "5", ")", "?", "5", ":", "(", "result", "<", "8", "?", "8", ":", "result", ")", ";", "m_positionValueRatio", "=", "(", "1.0", "*", "(", "outerHeight", "-", "result", ")", ")", "/", "(", "innerHeight", "-", "outerHeight", ")", ";", "m_knobHeight", "=", "result", "-", "(", "2", "*", "SCROLL_KNOB_OFFSET", ")", ";", "m_knobHeight", "=", "m_knobHeight", "<", "SCROLL_KNOB_MIN_HEIGHT", "?", "SCROLL_KNOB_MIN_HEIGHT", ":", "m_knobHeight", ";", "m_knob", ".", "getStyle", "(", ")", ".", "setHeight", "(", "m_knobHeight", ",", "Unit", ".", "PX", ")", ";", "}" ]
Calculates the scroll knob height.<p> @param outerHeight the height of the scrollable element @param innerHeight the height of the scroll content
[ "Calculates", "the", "scroll", "knob", "height", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsScrollBar.java#L549-L557
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java
ReplicationLinksInner.failoverAsync
public Observable<Void> failoverAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { """ Sets which replica database is primary by failing over from the current primary replica database. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database that has the replication link to be failed over. @param linkId The ID of the replication link to be failed over. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return failoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> failoverAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { return failoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "failoverAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "String", "linkId", ")", "{", "return", "failoverWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "databaseName", ",", "linkId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Void", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponse", "<", "Void", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Sets which replica database is primary by failing over from the current primary replica database. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database that has the replication link to be failed over. @param linkId The ID of the replication link to be failed over. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Sets", "which", "replica", "database", "is", "primary", "by", "failing", "over", "from", "the", "current", "primary", "replica", "database", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java#L327-L334
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/JcrLockManager.java
JcrLockManager.cleanLocks
final void cleanLocks() throws RepositoryException { """ Unlocks all locks corresponding to the tokens held by the supplied session. @throws RepositoryException if the session is not live """ // clean the session-scoped locks: unlock all the nodes and remove the lock tokens from the system area Set<String> cleanedTokens = lockManager.cleanLocks(session); if (lockTokens.isEmpty()) { return; } // clean all open-scoped locks created via this session for (String lockToken : lockTokens) { if (!cleanedTokens.contains(lockToken)) { ModeShapeLock lock = lockManager.findLockByToken(lockToken); if (lock == null) { // there is no existing lock for this token (it must've been removed from somewhere else) continue; } // this is an open-scoped lock created via this session for which we'll have to update the 'held' flag if (!lockManager.setHeldBySession(session, lockToken, false)) { // Generally not expected, because if the lock exists we can always change the lock-held value to false // even when it is already false ... throw new LockException(JcrI18n.invalidLockToken.text(lockToken)); } } } // always clean our internal map of tokens lockTokens.clear(); }
java
final void cleanLocks() throws RepositoryException { // clean the session-scoped locks: unlock all the nodes and remove the lock tokens from the system area Set<String> cleanedTokens = lockManager.cleanLocks(session); if (lockTokens.isEmpty()) { return; } // clean all open-scoped locks created via this session for (String lockToken : lockTokens) { if (!cleanedTokens.contains(lockToken)) { ModeShapeLock lock = lockManager.findLockByToken(lockToken); if (lock == null) { // there is no existing lock for this token (it must've been removed from somewhere else) continue; } // this is an open-scoped lock created via this session for which we'll have to update the 'held' flag if (!lockManager.setHeldBySession(session, lockToken, false)) { // Generally not expected, because if the lock exists we can always change the lock-held value to false // even when it is already false ... throw new LockException(JcrI18n.invalidLockToken.text(lockToken)); } } } // always clean our internal map of tokens lockTokens.clear(); }
[ "final", "void", "cleanLocks", "(", ")", "throws", "RepositoryException", "{", "// clean the session-scoped locks: unlock all the nodes and remove the lock tokens from the system area", "Set", "<", "String", ">", "cleanedTokens", "=", "lockManager", ".", "cleanLocks", "(", "session", ")", ";", "if", "(", "lockTokens", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "// clean all open-scoped locks created via this session", "for", "(", "String", "lockToken", ":", "lockTokens", ")", "{", "if", "(", "!", "cleanedTokens", ".", "contains", "(", "lockToken", ")", ")", "{", "ModeShapeLock", "lock", "=", "lockManager", ".", "findLockByToken", "(", "lockToken", ")", ";", "if", "(", "lock", "==", "null", ")", "{", "// there is no existing lock for this token (it must've been removed from somewhere else)", "continue", ";", "}", "// this is an open-scoped lock created via this session for which we'll have to update the 'held' flag", "if", "(", "!", "lockManager", ".", "setHeldBySession", "(", "session", ",", "lockToken", ",", "false", ")", ")", "{", "// Generally not expected, because if the lock exists we can always change the lock-held value to false", "// even when it is already false ...", "throw", "new", "LockException", "(", "JcrI18n", ".", "invalidLockToken", ".", "text", "(", "lockToken", ")", ")", ";", "}", "}", "}", "// always clean our internal map of tokens", "lockTokens", ".", "clear", "(", ")", ";", "}" ]
Unlocks all locks corresponding to the tokens held by the supplied session. @throws RepositoryException if the session is not live
[ "Unlocks", "all", "locks", "corresponding", "to", "the", "tokens", "held", "by", "the", "supplied", "session", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/JcrLockManager.java#L65-L89
the-fascinator/plugin-indexer-solr
src/main/java/com/googlecode/fascinator/indexer/SolrIndexer.java
SolrIndexer.evalScript
private PyObject evalScript(InputStream inStream, String scriptName) { """ Evaluate and return a Python script. @param inStream : InputStream containing the script to evaluate @param scriptName : filename of the script (mainly for debugging) @return PyObject : Compiled result """ // Execute the script PythonInterpreter python = new PythonInterpreter(); python.execfile(inStream, scriptName); // Get the result and cleanup PyObject scriptClass = python.get(SCRIPT_CLASS_NAME); python.cleanup(); // Instantiate and return the result return scriptClass.__call__(); }
java
private PyObject evalScript(InputStream inStream, String scriptName) { // Execute the script PythonInterpreter python = new PythonInterpreter(); python.execfile(inStream, scriptName); // Get the result and cleanup PyObject scriptClass = python.get(SCRIPT_CLASS_NAME); python.cleanup(); // Instantiate and return the result return scriptClass.__call__(); }
[ "private", "PyObject", "evalScript", "(", "InputStream", "inStream", ",", "String", "scriptName", ")", "{", "// Execute the script", "PythonInterpreter", "python", "=", "new", "PythonInterpreter", "(", ")", ";", "python", ".", "execfile", "(", "inStream", ",", "scriptName", ")", ";", "// Get the result and cleanup", "PyObject", "scriptClass", "=", "python", ".", "get", "(", "SCRIPT_CLASS_NAME", ")", ";", "python", ".", "cleanup", "(", ")", ";", "// Instantiate and return the result", "return", "scriptClass", ".", "__call__", "(", ")", ";", "}" ]
Evaluate and return a Python script. @param inStream : InputStream containing the script to evaluate @param scriptName : filename of the script (mainly for debugging) @return PyObject : Compiled result
[ "Evaluate", "and", "return", "a", "Python", "script", "." ]
train
https://github.com/the-fascinator/plugin-indexer-solr/blob/001159b18b78a87daa5d8b2a17ced28694bae156/src/main/java/com/googlecode/fascinator/indexer/SolrIndexer.java#L1116-L1125
gildur/jshint4j
src/main/java/pl/gildur/jshint4j/JsHint.java
JsHint.lint
public List<Error> lint(String source, String options) { """ Runs JSHint on given JavaScript source code. @param source JavaScript source code @param options JSHint options @return JSHint errors """ if (source == null) { throw new NullPointerException("Source must not be null."); } Context cx = Context.enter(); try { Scriptable scope = cx.initStandardObjects(); evaluateJSHint(cx, scope); return lint(cx, scope, source, options); } finally { Context.exit(); } }
java
public List<Error> lint(String source, String options) { if (source == null) { throw new NullPointerException("Source must not be null."); } Context cx = Context.enter(); try { Scriptable scope = cx.initStandardObjects(); evaluateJSHint(cx, scope); return lint(cx, scope, source, options); } finally { Context.exit(); } }
[ "public", "List", "<", "Error", ">", "lint", "(", "String", "source", ",", "String", "options", ")", "{", "if", "(", "source", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Source must not be null.\"", ")", ";", "}", "Context", "cx", "=", "Context", ".", "enter", "(", ")", ";", "try", "{", "Scriptable", "scope", "=", "cx", ".", "initStandardObjects", "(", ")", ";", "evaluateJSHint", "(", "cx", ",", "scope", ")", ";", "return", "lint", "(", "cx", ",", "scope", ",", "source", ",", "options", ")", ";", "}", "finally", "{", "Context", ".", "exit", "(", ")", ";", "}", "}" ]
Runs JSHint on given JavaScript source code. @param source JavaScript source code @param options JSHint options @return JSHint errors
[ "Runs", "JSHint", "on", "given", "JavaScript", "source", "code", "." ]
train
https://github.com/gildur/jshint4j/blob/b6f9e2fb00e248a4194f38a2df07eb34d55177f7/src/main/java/pl/gildur/jshint4j/JsHint.java#L26-L39
citrusframework/citrus
modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/client/FtpClient.java
FtpClient.listFiles
protected FtpMessage listFiles(ListCommand list, TestContext context) { """ Perform list files operation and provide file information as response. @param list @param context @return """ String remoteFilePath = Optional.ofNullable(list.getTarget()) .map(ListCommand.Target::getPath) .map(context::replaceDynamicContentInString) .orElse(""); try { List<String> fileNames = new ArrayList<>(); FTPFile[] ftpFiles; if (StringUtils.hasText(remoteFilePath)) { ftpFiles = ftpClient.listFiles(remoteFilePath); } else { ftpFiles = ftpClient.listFiles(remoteFilePath); } for (FTPFile ftpFile : ftpFiles) { fileNames.add(ftpFile.getName()); } return FtpMessage.result(ftpClient.getReplyCode(), ftpClient.getReplyString(), fileNames); } catch (IOException e) { throw new CitrusRuntimeException(String.format("Failed to list files in path '%s'", remoteFilePath), e); } }
java
protected FtpMessage listFiles(ListCommand list, TestContext context) { String remoteFilePath = Optional.ofNullable(list.getTarget()) .map(ListCommand.Target::getPath) .map(context::replaceDynamicContentInString) .orElse(""); try { List<String> fileNames = new ArrayList<>(); FTPFile[] ftpFiles; if (StringUtils.hasText(remoteFilePath)) { ftpFiles = ftpClient.listFiles(remoteFilePath); } else { ftpFiles = ftpClient.listFiles(remoteFilePath); } for (FTPFile ftpFile : ftpFiles) { fileNames.add(ftpFile.getName()); } return FtpMessage.result(ftpClient.getReplyCode(), ftpClient.getReplyString(), fileNames); } catch (IOException e) { throw new CitrusRuntimeException(String.format("Failed to list files in path '%s'", remoteFilePath), e); } }
[ "protected", "FtpMessage", "listFiles", "(", "ListCommand", "list", ",", "TestContext", "context", ")", "{", "String", "remoteFilePath", "=", "Optional", ".", "ofNullable", "(", "list", ".", "getTarget", "(", ")", ")", ".", "map", "(", "ListCommand", ".", "Target", "::", "getPath", ")", ".", "map", "(", "context", "::", "replaceDynamicContentInString", ")", ".", "orElse", "(", "\"\"", ")", ";", "try", "{", "List", "<", "String", ">", "fileNames", "=", "new", "ArrayList", "<>", "(", ")", ";", "FTPFile", "[", "]", "ftpFiles", ";", "if", "(", "StringUtils", ".", "hasText", "(", "remoteFilePath", ")", ")", "{", "ftpFiles", "=", "ftpClient", ".", "listFiles", "(", "remoteFilePath", ")", ";", "}", "else", "{", "ftpFiles", "=", "ftpClient", ".", "listFiles", "(", "remoteFilePath", ")", ";", "}", "for", "(", "FTPFile", "ftpFile", ":", "ftpFiles", ")", "{", "fileNames", ".", "add", "(", "ftpFile", ".", "getName", "(", ")", ")", ";", "}", "return", "FtpMessage", ".", "result", "(", "ftpClient", ".", "getReplyCode", "(", ")", ",", "ftpClient", ".", "getReplyString", "(", ")", ",", "fileNames", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "CitrusRuntimeException", "(", "String", ".", "format", "(", "\"Failed to list files in path '%s'\"", ",", "remoteFilePath", ")", ",", "e", ")", ";", "}", "}" ]
Perform list files operation and provide file information as response. @param list @param context @return
[ "Perform", "list", "files", "operation", "and", "provide", "file", "information", "as", "response", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/client/FtpClient.java#L156-L179
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/BaseOutputLayer.java
BaseOutputLayer.computeScoreForExamples
@Override public INDArray computeScoreForExamples(double fullNetRegTerm, LayerWorkspaceMgr workspaceMgr) { """ Compute the score for each example individually, after labels and input have been set. @param fullNetRegTerm Regularization score term for the entire network (or, 0.0 to not include regularization) @return A column INDArray of shape [numExamples,1], where entry i is the score of the ith example """ if (input == null || labels == null) throw new IllegalStateException("Cannot calculate score without input and labels " + layerId()); INDArray preOut = preOutput2d(false, workspaceMgr); ILossFunction lossFunction = layerConf().getLossFn(); INDArray scoreArray = lossFunction.computeScoreArray(getLabels2d(workspaceMgr, ArrayType.FF_WORKING_MEM), preOut, layerConf().getActivationFn(), maskArray); if (fullNetRegTerm != 0.0) { scoreArray.addi(fullNetRegTerm); } return workspaceMgr.leverageTo(ArrayType.ACTIVATIONS, scoreArray); }
java
@Override public INDArray computeScoreForExamples(double fullNetRegTerm, LayerWorkspaceMgr workspaceMgr) { if (input == null || labels == null) throw new IllegalStateException("Cannot calculate score without input and labels " + layerId()); INDArray preOut = preOutput2d(false, workspaceMgr); ILossFunction lossFunction = layerConf().getLossFn(); INDArray scoreArray = lossFunction.computeScoreArray(getLabels2d(workspaceMgr, ArrayType.FF_WORKING_MEM), preOut, layerConf().getActivationFn(), maskArray); if (fullNetRegTerm != 0.0) { scoreArray.addi(fullNetRegTerm); } return workspaceMgr.leverageTo(ArrayType.ACTIVATIONS, scoreArray); }
[ "@", "Override", "public", "INDArray", "computeScoreForExamples", "(", "double", "fullNetRegTerm", ",", "LayerWorkspaceMgr", "workspaceMgr", ")", "{", "if", "(", "input", "==", "null", "||", "labels", "==", "null", ")", "throw", "new", "IllegalStateException", "(", "\"Cannot calculate score without input and labels \"", "+", "layerId", "(", ")", ")", ";", "INDArray", "preOut", "=", "preOutput2d", "(", "false", ",", "workspaceMgr", ")", ";", "ILossFunction", "lossFunction", "=", "layerConf", "(", ")", ".", "getLossFn", "(", ")", ";", "INDArray", "scoreArray", "=", "lossFunction", ".", "computeScoreArray", "(", "getLabels2d", "(", "workspaceMgr", ",", "ArrayType", ".", "FF_WORKING_MEM", ")", ",", "preOut", ",", "layerConf", "(", ")", ".", "getActivationFn", "(", ")", ",", "maskArray", ")", ";", "if", "(", "fullNetRegTerm", "!=", "0.0", ")", "{", "scoreArray", ".", "addi", "(", "fullNetRegTerm", ")", ";", "}", "return", "workspaceMgr", ".", "leverageTo", "(", "ArrayType", ".", "ACTIVATIONS", ",", "scoreArray", ")", ";", "}" ]
Compute the score for each example individually, after labels and input have been set. @param fullNetRegTerm Regularization score term for the entire network (or, 0.0 to not include regularization) @return A column INDArray of shape [numExamples,1], where entry i is the score of the ith example
[ "Compute", "the", "score", "for", "each", "example", "individually", "after", "labels", "and", "input", "have", "been", "set", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/BaseOutputLayer.java#L104-L118
tanhaichao/leopard-lang
leopard-util/src/main/java/io/leopard/util/EncryptUtil.java
EncryptUtil.encode
private static String encode(String str, String type) { """ 按类型对字符串进行加密并转换成16进制输出</br> @param str 字符串 @param type 可加密类型md5, des , sha1 @return 加密后的字符串 """ try { MessageDigest alga = MessageDigest.getInstance(type); alga.update(str.getBytes()); byte digesta[] = alga.digest(); String hex = byte2hex(digesta); // String hex2 = byte2hex2(digesta); // if (!hex.equals(hex2)) { // System.out.println("str:" + str); // } return hex; } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } }
java
private static String encode(String str, String type) { try { MessageDigest alga = MessageDigest.getInstance(type); alga.update(str.getBytes()); byte digesta[] = alga.digest(); String hex = byte2hex(digesta); // String hex2 = byte2hex2(digesta); // if (!hex.equals(hex2)) { // System.out.println("str:" + str); // } return hex; } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } }
[ "private", "static", "String", "encode", "(", "String", "str", ",", "String", "type", ")", "{", "try", "{", "MessageDigest", "alga", "=", "MessageDigest", ".", "getInstance", "(", "type", ")", ";", "alga", ".", "update", "(", "str", ".", "getBytes", "(", ")", ")", ";", "byte", "digesta", "[", "]", "=", "alga", ".", "digest", "(", ")", ";", "String", "hex", "=", "byte2hex", "(", "digesta", ")", ";", "// String hex2 = byte2hex2(digesta);\r", "// if (!hex.equals(hex2)) {\r", "// System.out.println(\"str:\" + str);\r", "// }\r", "return", "hex", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "}" ]
按类型对字符串进行加密并转换成16进制输出</br> @param str 字符串 @param type 可加密类型md5, des , sha1 @return 加密后的字符串
[ "按类型对字符串进行加密并转换成16进制输出<", "/", "br", ">" ]
train
https://github.com/tanhaichao/leopard-lang/blob/8ab110f6ca4ea84484817a3d752253ac69ea268b/leopard-util/src/main/java/io/leopard/util/EncryptUtil.java#L41-L56
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/map/impl/mapstore/MapDataStores.java
MapDataStores.createWriteBehindStore
public static <K, V> MapDataStore<K, V> createWriteBehindStore(MapStoreContext mapStoreContext, int partitionId, WriteBehindProcessor writeBehindProcessor) { """ Creates a write behind data store. @param mapStoreContext context for map store operations @param partitionId partition ID of partition @param writeBehindProcessor the {@link WriteBehindProcessor} @param <K> type of key to store @param <V> type of value to store @return new write behind store manager """ MapServiceContext mapServiceContext = mapStoreContext.getMapServiceContext(); NodeEngine nodeEngine = mapServiceContext.getNodeEngine(); MapStoreConfig mapStoreConfig = mapStoreContext.getMapStoreConfig(); InternalSerializationService serializationService = ((InternalSerializationService) nodeEngine.getSerializationService()); WriteBehindStore mapDataStore = new WriteBehindStore(mapStoreContext, partitionId, serializationService); mapDataStore.setWriteBehindQueue(newWriteBehindQueue(mapServiceContext, mapStoreConfig.isWriteCoalescing())); mapDataStore.setWriteBehindProcessor(writeBehindProcessor); return (MapDataStore<K, V>) mapDataStore; }
java
public static <K, V> MapDataStore<K, V> createWriteBehindStore(MapStoreContext mapStoreContext, int partitionId, WriteBehindProcessor writeBehindProcessor) { MapServiceContext mapServiceContext = mapStoreContext.getMapServiceContext(); NodeEngine nodeEngine = mapServiceContext.getNodeEngine(); MapStoreConfig mapStoreConfig = mapStoreContext.getMapStoreConfig(); InternalSerializationService serializationService = ((InternalSerializationService) nodeEngine.getSerializationService()); WriteBehindStore mapDataStore = new WriteBehindStore(mapStoreContext, partitionId, serializationService); mapDataStore.setWriteBehindQueue(newWriteBehindQueue(mapServiceContext, mapStoreConfig.isWriteCoalescing())); mapDataStore.setWriteBehindProcessor(writeBehindProcessor); return (MapDataStore<K, V>) mapDataStore; }
[ "public", "static", "<", "K", ",", "V", ">", "MapDataStore", "<", "K", ",", "V", ">", "createWriteBehindStore", "(", "MapStoreContext", "mapStoreContext", ",", "int", "partitionId", ",", "WriteBehindProcessor", "writeBehindProcessor", ")", "{", "MapServiceContext", "mapServiceContext", "=", "mapStoreContext", ".", "getMapServiceContext", "(", ")", ";", "NodeEngine", "nodeEngine", "=", "mapServiceContext", ".", "getNodeEngine", "(", ")", ";", "MapStoreConfig", "mapStoreConfig", "=", "mapStoreContext", ".", "getMapStoreConfig", "(", ")", ";", "InternalSerializationService", "serializationService", "=", "(", "(", "InternalSerializationService", ")", "nodeEngine", ".", "getSerializationService", "(", ")", ")", ";", "WriteBehindStore", "mapDataStore", "=", "new", "WriteBehindStore", "(", "mapStoreContext", ",", "partitionId", ",", "serializationService", ")", ";", "mapDataStore", ".", "setWriteBehindQueue", "(", "newWriteBehindQueue", "(", "mapServiceContext", ",", "mapStoreConfig", ".", "isWriteCoalescing", "(", ")", ")", ")", ";", "mapDataStore", ".", "setWriteBehindProcessor", "(", "writeBehindProcessor", ")", ";", "return", "(", "MapDataStore", "<", "K", ",", "V", ">", ")", "mapDataStore", ";", "}" ]
Creates a write behind data store. @param mapStoreContext context for map store operations @param partitionId partition ID of partition @param writeBehindProcessor the {@link WriteBehindProcessor} @param <K> type of key to store @param <V> type of value to store @return new write behind store manager
[ "Creates", "a", "write", "behind", "data", "store", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/mapstore/MapDataStores.java#L58-L69
RestComm/sipunit
src/main/java/org/cafesip/sipunit/SipSession.java
SipSession.sendReply
public SipTransaction sendReply(RequestEvent request, int statusCode, String reasonPhrase, String toTag, Address contact, int expires) { """ This method sends a basic, stateful response to a previously received request. Call this method after calling waitRequest(). The response is constructed based on the parameters passed in. The returned SipTransaction object must be used in any subsequent calls to sendReply() for the same received request, if there are any. @param request The RequestEvent object that was returned by a previous call to waitRequest(). @param statusCode The status code of the response to send (may use SipResponse constants). @param reasonPhrase If not null, the reason phrase to send. @param toTag If not null, it will be put into the 'To' header of the response. Required by final responses such as OK. @param contact If not null, it will be used to create a 'Contact' header to be added to the response. @param expires If not -1, an 'Expires' header is added to the response containing this value, which is the time the message is valid, in seconds. @return A SipTransaction object that must be passed in to any subsequent call to sendReply() for the same received request, or null if an error was encountered while sending the response. The calling program doesn't need to do anything with the returned SipTransaction other than pass it in to a subsequent call to sendReply() for the same received request. """ return sendReply(request, statusCode, reasonPhrase, toTag, contact, expires, null, null, null); }
java
public SipTransaction sendReply(RequestEvent request, int statusCode, String reasonPhrase, String toTag, Address contact, int expires) { return sendReply(request, statusCode, reasonPhrase, toTag, contact, expires, null, null, null); }
[ "public", "SipTransaction", "sendReply", "(", "RequestEvent", "request", ",", "int", "statusCode", ",", "String", "reasonPhrase", ",", "String", "toTag", ",", "Address", "contact", ",", "int", "expires", ")", "{", "return", "sendReply", "(", "request", ",", "statusCode", ",", "reasonPhrase", ",", "toTag", ",", "contact", ",", "expires", ",", "null", ",", "null", ",", "null", ")", ";", "}" ]
This method sends a basic, stateful response to a previously received request. Call this method after calling waitRequest(). The response is constructed based on the parameters passed in. The returned SipTransaction object must be used in any subsequent calls to sendReply() for the same received request, if there are any. @param request The RequestEvent object that was returned by a previous call to waitRequest(). @param statusCode The status code of the response to send (may use SipResponse constants). @param reasonPhrase If not null, the reason phrase to send. @param toTag If not null, it will be put into the 'To' header of the response. Required by final responses such as OK. @param contact If not null, it will be used to create a 'Contact' header to be added to the response. @param expires If not -1, an 'Expires' header is added to the response containing this value, which is the time the message is valid, in seconds. @return A SipTransaction object that must be passed in to any subsequent call to sendReply() for the same received request, or null if an error was encountered while sending the response. The calling program doesn't need to do anything with the returned SipTransaction other than pass it in to a subsequent call to sendReply() for the same received request.
[ "This", "method", "sends", "a", "basic", "stateful", "response", "to", "a", "previously", "received", "request", ".", "Call", "this", "method", "after", "calling", "waitRequest", "()", ".", "The", "response", "is", "constructed", "based", "on", "the", "parameters", "passed", "in", ".", "The", "returned", "SipTransaction", "object", "must", "be", "used", "in", "any", "subsequent", "calls", "to", "sendReply", "()", "for", "the", "same", "received", "request", "if", "there", "are", "any", "." ]
train
https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipSession.java#L1250-L1253
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java
ServletUtil.write
public static void write(HttpServletResponse response, InputStream in, String contentType, String fileName) { """ 返回数据给客户端 @param response 响应对象{@link HttpServletResponse} @param in 需要返回客户端的内容 @param contentType 返回的类型 @param fileName 文件名 @since 4.1.15 """ final String charset = ObjectUtil.defaultIfNull(response.getCharacterEncoding(), CharsetUtil.UTF_8); response.setHeader("Content-Disposition", StrUtil.format("attachment;filename={}", URLUtil.encode(fileName, charset))); response.setContentType(contentType); write(response, in); }
java
public static void write(HttpServletResponse response, InputStream in, String contentType, String fileName) { final String charset = ObjectUtil.defaultIfNull(response.getCharacterEncoding(), CharsetUtil.UTF_8); response.setHeader("Content-Disposition", StrUtil.format("attachment;filename={}", URLUtil.encode(fileName, charset))); response.setContentType(contentType); write(response, in); }
[ "public", "static", "void", "write", "(", "HttpServletResponse", "response", ",", "InputStream", "in", ",", "String", "contentType", ",", "String", "fileName", ")", "{", "final", "String", "charset", "=", "ObjectUtil", ".", "defaultIfNull", "(", "response", ".", "getCharacterEncoding", "(", ")", ",", "CharsetUtil", ".", "UTF_8", ")", ";", "response", ".", "setHeader", "(", "\"Content-Disposition\"", ",", "StrUtil", ".", "format", "(", "\"attachment;filename={}\"", ",", "URLUtil", ".", "encode", "(", "fileName", ",", "charset", ")", ")", ")", ";", "response", ".", "setContentType", "(", "contentType", ")", ";", "write", "(", "response", ",", "in", ")", ";", "}" ]
返回数据给客户端 @param response 响应对象{@link HttpServletResponse} @param in 需要返回客户端的内容 @param contentType 返回的类型 @param fileName 文件名 @since 4.1.15
[ "返回数据给客户端" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L522-L527
liferay/com-liferay-commerce
commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListItemPersistenceImpl.java
CommerceWishListItemPersistenceImpl.findByCW_CP
@Override public List<CommerceWishListItem> findByCW_CP(long commerceWishListId, long CProductId, int start, int end) { """ Returns a range of all the commerce wish list items where commerceWishListId = &#63; and CProductId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceWishListItemModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param commerceWishListId the commerce wish list ID @param CProductId the c product ID @param start the lower bound of the range of commerce wish list items @param end the upper bound of the range of commerce wish list items (not inclusive) @return the range of matching commerce wish list items """ return findByCW_CP(commerceWishListId, CProductId, start, end, null); }
java
@Override public List<CommerceWishListItem> findByCW_CP(long commerceWishListId, long CProductId, int start, int end) { return findByCW_CP(commerceWishListId, CProductId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceWishListItem", ">", "findByCW_CP", "(", "long", "commerceWishListId", ",", "long", "CProductId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByCW_CP", "(", "commerceWishListId", ",", "CProductId", ",", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the commerce wish list items where commerceWishListId = &#63; and CProductId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceWishListItemModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param commerceWishListId the commerce wish list ID @param CProductId the c product ID @param start the lower bound of the range of commerce wish list items @param end the upper bound of the range of commerce wish list items (not inclusive) @return the range of matching commerce wish list items
[ "Returns", "a", "range", "of", "all", "the", "commerce", "wish", "list", "items", "where", "commerceWishListId", "=", "&#63", ";", "and", "CProductId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListItemPersistenceImpl.java#L2359-L2363
jayantk/jklol
src/com/jayantkrish/jklol/models/FactorGraph.java
FactorGraph.outcomeToAssignment
public Assignment outcomeToAssignment(String[] factorVariables, Object[] outcome) { """ Identical to {@link #outcomeToAssignment(List, List)}, but with arrays. @param factorVariables @param outcome @return """ return outcomeToAssignment(Arrays.asList(factorVariables), Arrays.asList(outcome)); }
java
public Assignment outcomeToAssignment(String[] factorVariables, Object[] outcome) { return outcomeToAssignment(Arrays.asList(factorVariables), Arrays.asList(outcome)); }
[ "public", "Assignment", "outcomeToAssignment", "(", "String", "[", "]", "factorVariables", ",", "Object", "[", "]", "outcome", ")", "{", "return", "outcomeToAssignment", "(", "Arrays", ".", "asList", "(", "factorVariables", ")", ",", "Arrays", ".", "asList", "(", "outcome", ")", ")", ";", "}" ]
Identical to {@link #outcomeToAssignment(List, List)}, but with arrays. @param factorVariables @param outcome @return
[ "Identical", "to", "{", "@link", "#outcomeToAssignment", "(", "List", "List", ")", "}", "but", "with", "arrays", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/FactorGraph.java#L352-L354
google/gwtmockito
gwtmockito/src/main/java/com/google/gwtmockito/fakes/FakeClientBundleProvider.java
FakeClientBundleProvider.getFake
@Override public ClientBundle getFake(Class<?> type) { """ Returns a new instance of the given type that implements methods as described in the class description. @param type interface to be implemented by the returned type. """ return (ClientBundle) Proxy.newProxyInstance( FakeClientBundleProvider.class.getClassLoader(), new Class<?>[] {type}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Exception { Class<?> returnType = method.getReturnType(); if (CssResource.class.isAssignableFrom(returnType)) { return GWT.create(returnType); } else { return createFakeResource(returnType, method.getName()); } } }); }
java
@Override public ClientBundle getFake(Class<?> type) { return (ClientBundle) Proxy.newProxyInstance( FakeClientBundleProvider.class.getClassLoader(), new Class<?>[] {type}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Exception { Class<?> returnType = method.getReturnType(); if (CssResource.class.isAssignableFrom(returnType)) { return GWT.create(returnType); } else { return createFakeResource(returnType, method.getName()); } } }); }
[ "@", "Override", "public", "ClientBundle", "getFake", "(", "Class", "<", "?", ">", "type", ")", "{", "return", "(", "ClientBundle", ")", "Proxy", ".", "newProxyInstance", "(", "FakeClientBundleProvider", ".", "class", ".", "getClassLoader", "(", ")", ",", "new", "Class", "<", "?", ">", "[", "]", "{", "type", "}", ",", "new", "InvocationHandler", "(", ")", "{", "@", "Override", "public", "Object", "invoke", "(", "Object", "proxy", ",", "Method", "method", ",", "Object", "[", "]", "args", ")", "throws", "Exception", "{", "Class", "<", "?", ">", "returnType", "=", "method", ".", "getReturnType", "(", ")", ";", "if", "(", "CssResource", ".", "class", ".", "isAssignableFrom", "(", "returnType", ")", ")", "{", "return", "GWT", ".", "create", "(", "returnType", ")", ";", "}", "else", "{", "return", "createFakeResource", "(", "returnType", ",", "method", ".", "getName", "(", ")", ")", ";", "}", "}", "}", ")", ";", "}" ]
Returns a new instance of the given type that implements methods as described in the class description. @param type interface to be implemented by the returned type.
[ "Returns", "a", "new", "instance", "of", "the", "given", "type", "that", "implements", "methods", "as", "described", "in", "the", "class", "description", "." ]
train
https://github.com/google/gwtmockito/blob/e886a9b9d290169b5f83582dd89b7545c5f198a2/gwtmockito/src/main/java/com/google/gwtmockito/fakes/FakeClientBundleProvider.java#L50-L66
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/referral/Branch.java
Branch.initSession
public boolean initSession(boolean isReferrable, @NonNull Activity activity) { """ <p>Initialises a session with the Branch API, specifying whether the initialisation can count as a referrable action, and supplying the calling {@link Activity} for context.</p> @param isReferrable A {@link Boolean} value indicating whether this initialisation session should be considered as potentially referrable or not. By default, a user is only referrable if initSession results in a fresh install. Overriding this gives you control of who is referrable. @param activity The calling {@link Activity} for context. @return A {@link Boolean} value that returns <i>false</i> if unsuccessful. """ return initSession((BranchReferralInitListener) null, isReferrable, activity); }
java
public boolean initSession(boolean isReferrable, @NonNull Activity activity) { return initSession((BranchReferralInitListener) null, isReferrable, activity); }
[ "public", "boolean", "initSession", "(", "boolean", "isReferrable", ",", "@", "NonNull", "Activity", "activity", ")", "{", "return", "initSession", "(", "(", "BranchReferralInitListener", ")", "null", ",", "isReferrable", ",", "activity", ")", ";", "}" ]
<p>Initialises a session with the Branch API, specifying whether the initialisation can count as a referrable action, and supplying the calling {@link Activity} for context.</p> @param isReferrable A {@link Boolean} value indicating whether this initialisation session should be considered as potentially referrable or not. By default, a user is only referrable if initSession results in a fresh install. Overriding this gives you control of who is referrable. @param activity The calling {@link Activity} for context. @return A {@link Boolean} value that returns <i>false</i> if unsuccessful.
[ "<p", ">", "Initialises", "a", "session", "with", "the", "Branch", "API", "specifying", "whether", "the", "initialisation", "can", "count", "as", "a", "referrable", "action", "and", "supplying", "the", "calling", "{", "@link", "Activity", "}", "for", "context", ".", "<", "/", "p", ">" ]
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/Branch.java#L1186-L1188
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/ProjectableSQLQuery.java
ProjectableSQLQuery.addFlag
@Override public Q addFlag(Position position, String flag) { """ Add the given String literal as query flag @param position position @param flag query flag @return the current object """ return queryMixin.addFlag(new QueryFlag(position, flag)); }
java
@Override public Q addFlag(Position position, String flag) { return queryMixin.addFlag(new QueryFlag(position, flag)); }
[ "@", "Override", "public", "Q", "addFlag", "(", "Position", "position", ",", "String", "flag", ")", "{", "return", "queryMixin", ".", "addFlag", "(", "new", "QueryFlag", "(", "position", ",", "flag", ")", ")", ";", "}" ]
Add the given String literal as query flag @param position position @param flag query flag @return the current object
[ "Add", "the", "given", "String", "literal", "as", "query", "flag" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/ProjectableSQLQuery.java#L133-L136
bazaarvoice/emodb
common/astyanax/src/main/java/com/bazaarvoice/emodb/common/cassandra/nio/BufferUtils.java
BufferUtils.getString
public static String getString(ByteBuffer buf, int offset, int length, Charset encoding) { """ Converts the specified number of bytes in the buffer and converts them to a String using the specified encoding. Does not move the buffer position. """ buf = buf.duplicate(); buf.position(buf.position() + offset); if (buf.hasArray()) { return new String(buf.array(), buf.arrayOffset() + buf.position(), length, encoding); } else { byte[] bytes = new byte[length]; buf.get(bytes); return new String(bytes, encoding); } }
java
public static String getString(ByteBuffer buf, int offset, int length, Charset encoding) { buf = buf.duplicate(); buf.position(buf.position() + offset); if (buf.hasArray()) { return new String(buf.array(), buf.arrayOffset() + buf.position(), length, encoding); } else { byte[] bytes = new byte[length]; buf.get(bytes); return new String(bytes, encoding); } }
[ "public", "static", "String", "getString", "(", "ByteBuffer", "buf", ",", "int", "offset", ",", "int", "length", ",", "Charset", "encoding", ")", "{", "buf", "=", "buf", ".", "duplicate", "(", ")", ";", "buf", ".", "position", "(", "buf", ".", "position", "(", ")", "+", "offset", ")", ";", "if", "(", "buf", ".", "hasArray", "(", ")", ")", "{", "return", "new", "String", "(", "buf", ".", "array", "(", ")", ",", "buf", ".", "arrayOffset", "(", ")", "+", "buf", ".", "position", "(", ")", ",", "length", ",", "encoding", ")", ";", "}", "else", "{", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "length", "]", ";", "buf", ".", "get", "(", "bytes", ")", ";", "return", "new", "String", "(", "bytes", ",", "encoding", ")", ";", "}", "}" ]
Converts the specified number of bytes in the buffer and converts them to a String using the specified encoding. Does not move the buffer position.
[ "Converts", "the", "specified", "number", "of", "bytes", "in", "the", "buffer", "and", "converts", "them", "to", "a", "String", "using", "the", "specified", "encoding", ".", "Does", "not", "move", "the", "buffer", "position", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/astyanax/src/main/java/com/bazaarvoice/emodb/common/cassandra/nio/BufferUtils.java#L22-L32
bbottema/simple-java-mail
modules/cli-module/src/main/java/org/simplejavamail/internal/clisupport/CliCommandLineConsumer.java
CliCommandLineConsumer.consumeCommandLineInput
static CliReceivedCommand consumeCommandLineInput(ParseResult providedCommand, @SuppressWarnings("SameParameterValue") Iterable<CliDeclaredOptionSpec> declaredOptions) { """ we reach here when terminal input was value and no help was requested """ assumeTrue(providedCommand.hasSubcommand(), "Command was empty, expected one of: " + Arrays.toString(CliCommandType.values())); final ParseResult mailCommand = providedCommand.subcommand(); final CliCommandType matchedCommand = CliCommandType.valueOf(mailCommand.commandSpec().name()); final Map<CliDeclaredOptionSpec, OptionSpec> matchedOptionsInOrderProvision = matchProvidedOptions(declaredOptions, mailCommand.matchedOptions()); logParsedInput(matchedCommand, matchedOptionsInOrderProvision); List<CliReceivedOptionData> receivedOptions = new ArrayList<>(); for (Entry<CliDeclaredOptionSpec, OptionSpec> cliOption : matchedOptionsInOrderProvision.entrySet()) { final Method sourceMethod = cliOption.getKey().getSourceMethod(); final int mandatoryParameters = MiscUtil.countMandatoryParameters(sourceMethod); final List<String> providedStringValues = cliOption.getValue().getValue(); assumeTrue(providedStringValues.size() >= mandatoryParameters, format("provided %s arguments, but need at least %s", providedStringValues.size(), mandatoryParameters)); assumeTrue(providedStringValues.size() <= sourceMethod.getParameterTypes().length, format("provided %s arguments, but need at most %s", providedStringValues.size(), sourceMethod.getParameterTypes().length)); receivedOptions.add(new CliReceivedOptionData(cliOption.getKey(), convertProvidedOptionValues(providedStringValues, sourceMethod))); LOGGER.debug("\tconverted option values: {}", getLast(receivedOptions).getProvidedOptionValues()); } return new CliReceivedCommand(matchedCommand, receivedOptions); }
java
static CliReceivedCommand consumeCommandLineInput(ParseResult providedCommand, @SuppressWarnings("SameParameterValue") Iterable<CliDeclaredOptionSpec> declaredOptions) { assumeTrue(providedCommand.hasSubcommand(), "Command was empty, expected one of: " + Arrays.toString(CliCommandType.values())); final ParseResult mailCommand = providedCommand.subcommand(); final CliCommandType matchedCommand = CliCommandType.valueOf(mailCommand.commandSpec().name()); final Map<CliDeclaredOptionSpec, OptionSpec> matchedOptionsInOrderProvision = matchProvidedOptions(declaredOptions, mailCommand.matchedOptions()); logParsedInput(matchedCommand, matchedOptionsInOrderProvision); List<CliReceivedOptionData> receivedOptions = new ArrayList<>(); for (Entry<CliDeclaredOptionSpec, OptionSpec> cliOption : matchedOptionsInOrderProvision.entrySet()) { final Method sourceMethod = cliOption.getKey().getSourceMethod(); final int mandatoryParameters = MiscUtil.countMandatoryParameters(sourceMethod); final List<String> providedStringValues = cliOption.getValue().getValue(); assumeTrue(providedStringValues.size() >= mandatoryParameters, format("provided %s arguments, but need at least %s", providedStringValues.size(), mandatoryParameters)); assumeTrue(providedStringValues.size() <= sourceMethod.getParameterTypes().length, format("provided %s arguments, but need at most %s", providedStringValues.size(), sourceMethod.getParameterTypes().length)); receivedOptions.add(new CliReceivedOptionData(cliOption.getKey(), convertProvidedOptionValues(providedStringValues, sourceMethod))); LOGGER.debug("\tconverted option values: {}", getLast(receivedOptions).getProvidedOptionValues()); } return new CliReceivedCommand(matchedCommand, receivedOptions); }
[ "static", "CliReceivedCommand", "consumeCommandLineInput", "(", "ParseResult", "providedCommand", ",", "@", "SuppressWarnings", "(", "\"SameParameterValue\"", ")", "Iterable", "<", "CliDeclaredOptionSpec", ">", "declaredOptions", ")", "{", "assumeTrue", "(", "providedCommand", ".", "hasSubcommand", "(", ")", ",", "\"Command was empty, expected one of: \"", "+", "Arrays", ".", "toString", "(", "CliCommandType", ".", "values", "(", ")", ")", ")", ";", "final", "ParseResult", "mailCommand", "=", "providedCommand", ".", "subcommand", "(", ")", ";", "final", "CliCommandType", "matchedCommand", "=", "CliCommandType", ".", "valueOf", "(", "mailCommand", ".", "commandSpec", "(", ")", ".", "name", "(", ")", ")", ";", "final", "Map", "<", "CliDeclaredOptionSpec", ",", "OptionSpec", ">", "matchedOptionsInOrderProvision", "=", "matchProvidedOptions", "(", "declaredOptions", ",", "mailCommand", ".", "matchedOptions", "(", ")", ")", ";", "logParsedInput", "(", "matchedCommand", ",", "matchedOptionsInOrderProvision", ")", ";", "List", "<", "CliReceivedOptionData", ">", "receivedOptions", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Entry", "<", "CliDeclaredOptionSpec", ",", "OptionSpec", ">", "cliOption", ":", "matchedOptionsInOrderProvision", ".", "entrySet", "(", ")", ")", "{", "final", "Method", "sourceMethod", "=", "cliOption", ".", "getKey", "(", ")", ".", "getSourceMethod", "(", ")", ";", "final", "int", "mandatoryParameters", "=", "MiscUtil", ".", "countMandatoryParameters", "(", "sourceMethod", ")", ";", "final", "List", "<", "String", ">", "providedStringValues", "=", "cliOption", ".", "getValue", "(", ")", ".", "getValue", "(", ")", ";", "assumeTrue", "(", "providedStringValues", ".", "size", "(", ")", ">=", "mandatoryParameters", ",", "format", "(", "\"provided %s arguments, but need at least %s\"", ",", "providedStringValues", ".", "size", "(", ")", ",", "mandatoryParameters", ")", ")", ";", "assumeTrue", "(", "providedStringValues", ".", "size", "(", ")", "<=", "sourceMethod", ".", "getParameterTypes", "(", ")", ".", "length", ",", "format", "(", "\"provided %s arguments, but need at most %s\"", ",", "providedStringValues", ".", "size", "(", ")", ",", "sourceMethod", ".", "getParameterTypes", "(", ")", ".", "length", ")", ")", ";", "receivedOptions", ".", "add", "(", "new", "CliReceivedOptionData", "(", "cliOption", ".", "getKey", "(", ")", ",", "convertProvidedOptionValues", "(", "providedStringValues", ",", "sourceMethod", ")", ")", ")", ";", "LOGGER", ".", "debug", "(", "\"\\tconverted option values: {}\"", ",", "getLast", "(", "receivedOptions", ")", ".", "getProvidedOptionValues", "(", ")", ")", ";", "}", "return", "new", "CliReceivedCommand", "(", "matchedCommand", ",", "receivedOptions", ")", ";", "}" ]
we reach here when terminal input was value and no help was requested
[ "we", "reach", "here", "when", "terminal", "input", "was", "value", "and", "no", "help", "was", "requested" ]
train
https://github.com/bbottema/simple-java-mail/blob/b03635328aeecd525e35eddfef8f5b9a184559d8/modules/cli-module/src/main/java/org/simplejavamail/internal/clisupport/CliCommandLineConsumer.java#L38-L61
yavijava/yavijava
src/main/java/com/vmware/vim25/mo/VRPResourceManager.java
VRPResourceManager.setManagedByVDC
public void setManagedByVDC(ClusterComputeResource cluster, boolean status) throws InvalidState, NotFound, RuntimeFault, RemoteException { """ Sets whether a cluster is managed by a Virtual Datacenter. Setting this to true will prevent users from disabling DRS for the cluster. @param cluster Cluster object @param status True if the cluster is managed by a Virtual Datacenter @throws InvalidState @throws NotFound @throws RuntimeFault @throws RemoteException """ getVimService().setManagedByVDC(getMOR(), cluster.getMOR(), status); }
java
public void setManagedByVDC(ClusterComputeResource cluster, boolean status) throws InvalidState, NotFound, RuntimeFault, RemoteException { getVimService().setManagedByVDC(getMOR(), cluster.getMOR(), status); }
[ "public", "void", "setManagedByVDC", "(", "ClusterComputeResource", "cluster", ",", "boolean", "status", ")", "throws", "InvalidState", ",", "NotFound", ",", "RuntimeFault", ",", "RemoteException", "{", "getVimService", "(", ")", ".", "setManagedByVDC", "(", "getMOR", "(", ")", ",", "cluster", ".", "getMOR", "(", ")", ",", "status", ")", ";", "}" ]
Sets whether a cluster is managed by a Virtual Datacenter. Setting this to true will prevent users from disabling DRS for the cluster. @param cluster Cluster object @param status True if the cluster is managed by a Virtual Datacenter @throws InvalidState @throws NotFound @throws RuntimeFault @throws RemoteException
[ "Sets", "whether", "a", "cluster", "is", "managed", "by", "a", "Virtual", "Datacenter", ".", "Setting", "this", "to", "true", "will", "prevent", "users", "from", "disabling", "DRS", "for", "the", "cluster", "." ]
train
https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/VRPResourceManager.java#L180-L182
jbundle/jbundle
thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/memory/MemoryRemoteTable.java
MemoryRemoteTable.get
public Object get(int iRowIndex, int iRowCount) throws DBException, RemoteException { """ Receive this relative record in the table. <p>Note: This is usually used only by thin clients, as thick clients have the code to fake absolute access. @param iRowIndex The row to retrieve. @param iRowCount The number of rows to retrieve (Used only by EjbCachedTable). @return The record(s) or an error code as an Integer. @exception Exception File exception. """ if ((m_iterator == null) || (m_iCurrentRecord == -1) || (iRowIndex <= m_iCurrentRecord)) { m_iterator = m_mDataMap.keySet().iterator(); m_iCurrentRecord = -1; } while (m_iterator.hasNext()) { m_iCurrentRecord++; m_objCurrentKey = m_iterator.next(); if (m_iCurrentRecord == iRowIndex) return m_mDataMap.get(m_objCurrentKey); } m_iterator = null; m_iCurrentRecord = -1; m_objCurrentKey = null; return m_objCurrentKey; }
java
public Object get(int iRowIndex, int iRowCount) throws DBException, RemoteException { if ((m_iterator == null) || (m_iCurrentRecord == -1) || (iRowIndex <= m_iCurrentRecord)) { m_iterator = m_mDataMap.keySet().iterator(); m_iCurrentRecord = -1; } while (m_iterator.hasNext()) { m_iCurrentRecord++; m_objCurrentKey = m_iterator.next(); if (m_iCurrentRecord == iRowIndex) return m_mDataMap.get(m_objCurrentKey); } m_iterator = null; m_iCurrentRecord = -1; m_objCurrentKey = null; return m_objCurrentKey; }
[ "public", "Object", "get", "(", "int", "iRowIndex", ",", "int", "iRowCount", ")", "throws", "DBException", ",", "RemoteException", "{", "if", "(", "(", "m_iterator", "==", "null", ")", "||", "(", "m_iCurrentRecord", "==", "-", "1", ")", "||", "(", "iRowIndex", "<=", "m_iCurrentRecord", ")", ")", "{", "m_iterator", "=", "m_mDataMap", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "m_iCurrentRecord", "=", "-", "1", ";", "}", "while", "(", "m_iterator", ".", "hasNext", "(", ")", ")", "{", "m_iCurrentRecord", "++", ";", "m_objCurrentKey", "=", "m_iterator", ".", "next", "(", ")", ";", "if", "(", "m_iCurrentRecord", "==", "iRowIndex", ")", "return", "m_mDataMap", ".", "get", "(", "m_objCurrentKey", ")", ";", "}", "m_iterator", "=", "null", ";", "m_iCurrentRecord", "=", "-", "1", ";", "m_objCurrentKey", "=", "null", ";", "return", "m_objCurrentKey", ";", "}" ]
Receive this relative record in the table. <p>Note: This is usually used only by thin clients, as thick clients have the code to fake absolute access. @param iRowIndex The row to retrieve. @param iRowCount The number of rows to retrieve (Used only by EjbCachedTable). @return The record(s) or an error code as an Integer. @exception Exception File exception.
[ "Receive", "this", "relative", "record", "in", "the", "table", ".", "<p", ">", "Note", ":", "This", "is", "usually", "used", "only", "by", "thin", "clients", "as", "thick", "clients", "have", "the", "code", "to", "fake", "absolute", "access", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/memory/MemoryRemoteTable.java#L253-L273
cycorp/api-suite
core-api/src/main/java/com/cyc/session/exception/SessionRuntimeException.java
SessionRuntimeException.fromThrowable
public static SessionRuntimeException fromThrowable(String message, Throwable cause) { """ Converts a Throwable to a SessionRuntimeException with the specified detail message. If the Throwable is a SessionRuntimeException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new SessionRuntimeException with the detail message. @param cause the Throwable to convert @param message the specified detail message @return a SessionRuntimeException """ return (cause instanceof SessionRuntimeException && Objects.equals(message, cause.getMessage())) ? (SessionRuntimeException) cause : new SessionRuntimeException(message, cause); }
java
public static SessionRuntimeException fromThrowable(String message, Throwable cause) { return (cause instanceof SessionRuntimeException && Objects.equals(message, cause.getMessage())) ? (SessionRuntimeException) cause : new SessionRuntimeException(message, cause); }
[ "public", "static", "SessionRuntimeException", "fromThrowable", "(", "String", "message", ",", "Throwable", "cause", ")", "{", "return", "(", "cause", "instanceof", "SessionRuntimeException", "&&", "Objects", ".", "equals", "(", "message", ",", "cause", ".", "getMessage", "(", ")", ")", ")", "?", "(", "SessionRuntimeException", ")", "cause", ":", "new", "SessionRuntimeException", "(", "message", ",", "cause", ")", ";", "}" ]
Converts a Throwable to a SessionRuntimeException with the specified detail message. If the Throwable is a SessionRuntimeException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new SessionRuntimeException with the detail message. @param cause the Throwable to convert @param message the specified detail message @return a SessionRuntimeException
[ "Converts", "a", "Throwable", "to", "a", "SessionRuntimeException", "with", "the", "specified", "detail", "message", ".", "If", "the", "Throwable", "is", "a", "SessionRuntimeException", "and", "if", "the", "Throwable", "s", "message", "is", "identical", "to", "the", "one", "supplied", "the", "Throwable", "will", "be", "passed", "through", "unmodified", ";", "otherwise", "it", "will", "be", "wrapped", "in", "a", "new", "SessionRuntimeException", "with", "the", "detail", "message", "." ]
train
https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionRuntimeException.java#L66-L70
soi-toolkit/soi-toolkit-mule
commons/components/module-logger/src/main/java/org/soitoolkit/commons/module/logger/SoitoolkitLoggerModule.java
SoitoolkitLoggerModule.logWarning
@Processor public Object logWarning( String message, @Optional String integrationScenario, @Optional String contractId, @Optional String correlationId, @Optional Map<String, String> extra) { """ Log processor for level WARNING {@sample.xml ../../../doc/SoitoolkitLogger-connector.xml.sample soitoolkitlogger:log} @param message Log-message to be processed @param integrationScenario Optional name of the integration scenario or business process @param contractId Optional name of the contract in use @param correlationId Optional correlation identity of the message @param extra Optional extra info @return The incoming payload """ return doLog(LogLevelType.WARNING, message, integrationScenario, contractId, correlationId, extra); }
java
@Processor public Object logWarning( String message, @Optional String integrationScenario, @Optional String contractId, @Optional String correlationId, @Optional Map<String, String> extra) { return doLog(LogLevelType.WARNING, message, integrationScenario, contractId, correlationId, extra); }
[ "@", "Processor", "public", "Object", "logWarning", "(", "String", "message", ",", "@", "Optional", "String", "integrationScenario", ",", "@", "Optional", "String", "contractId", ",", "@", "Optional", "String", "correlationId", ",", "@", "Optional", "Map", "<", "String", ",", "String", ">", "extra", ")", "{", "return", "doLog", "(", "LogLevelType", ".", "WARNING", ",", "message", ",", "integrationScenario", ",", "contractId", ",", "correlationId", ",", "extra", ")", ";", "}" ]
Log processor for level WARNING {@sample.xml ../../../doc/SoitoolkitLogger-connector.xml.sample soitoolkitlogger:log} @param message Log-message to be processed @param integrationScenario Optional name of the integration scenario or business process @param contractId Optional name of the contract in use @param correlationId Optional correlation identity of the message @param extra Optional extra info @return The incoming payload
[ "Log", "processor", "for", "level", "WARNING" ]
train
https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/module-logger/src/main/java/org/soitoolkit/commons/module/logger/SoitoolkitLoggerModule.java#L167-L176
lessthanoptimal/BoofCV
main/boofcv-types/src/main/java/boofcv/struct/PackedSetsPoint2D_I32.java
PackedSetsPoint2D_I32.addPointToTail
public void addPointToTail( int x , int y ) { """ Adds a point to the tail point set @param x coordinate @param y coordinate """ int index = tail.start + tail.length*2; int block[]; int blockIndex = tail.block + index/blockLength; if( blockIndex == blocks.size ) { tailBlockSize = 0; block = blocks.grow(); } else { block = blocks.get( blockIndex ); } tailBlockSize += 2; index %= blockLength; block[index ] = x; block[index+1 ] = y; tail.length += 1; }
java
public void addPointToTail( int x , int y ) { int index = tail.start + tail.length*2; int block[]; int blockIndex = tail.block + index/blockLength; if( blockIndex == blocks.size ) { tailBlockSize = 0; block = blocks.grow(); } else { block = blocks.get( blockIndex ); } tailBlockSize += 2; index %= blockLength; block[index ] = x; block[index+1 ] = y; tail.length += 1; }
[ "public", "void", "addPointToTail", "(", "int", "x", ",", "int", "y", ")", "{", "int", "index", "=", "tail", ".", "start", "+", "tail", ".", "length", "*", "2", ";", "int", "block", "[", "]", ";", "int", "blockIndex", "=", "tail", ".", "block", "+", "index", "/", "blockLength", ";", "if", "(", "blockIndex", "==", "blocks", ".", "size", ")", "{", "tailBlockSize", "=", "0", ";", "block", "=", "blocks", ".", "grow", "(", ")", ";", "}", "else", "{", "block", "=", "blocks", ".", "get", "(", "blockIndex", ")", ";", "}", "tailBlockSize", "+=", "2", ";", "index", "%=", "blockLength", ";", "block", "[", "index", "]", "=", "x", ";", "block", "[", "index", "+", "1", "]", "=", "y", ";", "tail", ".", "length", "+=", "1", ";", "}" ]
Adds a point to the tail point set @param x coordinate @param y coordinate
[ "Adds", "a", "point", "to", "the", "tail", "point", "set" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/struct/PackedSetsPoint2D_I32.java#L111-L128
redkale/redkale
src/org/redkale/net/http/HttpRequest.java
HttpRequest.getIntParameter
public int getIntParameter(int radix, String name, int defaultValue) { """ 获取指定的参数int值, 没有返回默认int值 @param radix 进制数 @param name 参数名 @param defaultValue 默认int值 @return 参数值 """ parseBody(); return params.getIntValue(radix, name, defaultValue); }
java
public int getIntParameter(int radix, String name, int defaultValue) { parseBody(); return params.getIntValue(radix, name, defaultValue); }
[ "public", "int", "getIntParameter", "(", "int", "radix", ",", "String", "name", ",", "int", "defaultValue", ")", "{", "parseBody", "(", ")", ";", "return", "params", ".", "getIntValue", "(", "radix", ",", "name", ",", "defaultValue", ")", ";", "}" ]
获取指定的参数int值, 没有返回默认int值 @param radix 进制数 @param name 参数名 @param defaultValue 默认int值 @return 参数值
[ "获取指定的参数int值", "没有返回默认int值" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/net/http/HttpRequest.java#L1381-L1384
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/Zips.java
Zips.iterate
public void iterate(ZipEntryCallback zipEntryCallback) { """ Reads the source ZIP file and executes the given callback for each entry. <p> For each entry the corresponding input stream is also passed to the callback. If you want to stop the loop then throw a ZipBreakException. This method is charset aware and uses Zips.charset. @param zipEntryCallback callback to be called for each entry. @see ZipEntryCallback """ ZipEntryOrInfoAdapter zipEntryAdapter = new ZipEntryOrInfoAdapter(zipEntryCallback, null); processAllEntries(zipEntryAdapter); }
java
public void iterate(ZipEntryCallback zipEntryCallback) { ZipEntryOrInfoAdapter zipEntryAdapter = new ZipEntryOrInfoAdapter(zipEntryCallback, null); processAllEntries(zipEntryAdapter); }
[ "public", "void", "iterate", "(", "ZipEntryCallback", "zipEntryCallback", ")", "{", "ZipEntryOrInfoAdapter", "zipEntryAdapter", "=", "new", "ZipEntryOrInfoAdapter", "(", "zipEntryCallback", ",", "null", ")", ";", "processAllEntries", "(", "zipEntryAdapter", ")", ";", "}" ]
Reads the source ZIP file and executes the given callback for each entry. <p> For each entry the corresponding input stream is also passed to the callback. If you want to stop the loop then throw a ZipBreakException. This method is charset aware and uses Zips.charset. @param zipEntryCallback callback to be called for each entry. @see ZipEntryCallback
[ "Reads", "the", "source", "ZIP", "file", "and", "executes", "the", "given", "callback", "for", "each", "entry", ".", "<p", ">", "For", "each", "entry", "the", "corresponding", "input", "stream", "is", "also", "passed", "to", "the", "callback", ".", "If", "you", "want", "to", "stop", "the", "loop", "then", "throw", "a", "ZipBreakException", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/Zips.java#L435-L438
actframework/actframework
src/main/java/act/ws/WebSocketContext.java
WebSocketContext.sendJsonToTagged
public WebSocketContext sendJsonToTagged(Object data, String tag) { """ Send JSON representation of a data object to all connections connected to the same URL of this context with the connection of this context excluded @param data the data to be sent @param tag the tag label @return this context """ return sendToTagged(JSON.toJSONString(data), tag); }
java
public WebSocketContext sendJsonToTagged(Object data, String tag) { return sendToTagged(JSON.toJSONString(data), tag); }
[ "public", "WebSocketContext", "sendJsonToTagged", "(", "Object", "data", ",", "String", "tag", ")", "{", "return", "sendToTagged", "(", "JSON", ".", "toJSONString", "(", "data", ")", ",", "tag", ")", ";", "}" ]
Send JSON representation of a data object to all connections connected to the same URL of this context with the connection of this context excluded @param data the data to be sent @param tag the tag label @return this context
[ "Send", "JSON", "representation", "of", "a", "data", "object", "to", "all", "connections", "connected", "to", "the", "same", "URL", "of", "this", "context", "with", "the", "connection", "of", "this", "context", "excluded" ]
train
https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/ws/WebSocketContext.java#L244-L246
jenkinsci/jenkins
core/src/main/java/hudson/model/queue/WorkUnitContext.java
WorkUnitContext.synchronizeEnd
public void synchronizeEnd(Executor e, Queue.Executable executable, Throwable problems, long duration) throws InterruptedException { """ All the {@link Executor}s that jointly execute a {@link Task} call this method to synchronize on the end of the task. @throws InterruptedException If any of the member thread is interrupted while waiting for other threads to join, all the member threads will report {@link InterruptedException}. """ endLatch.synchronize(); // the main thread will send a notification WorkUnit wu = e.getCurrentWorkUnit(); if (wu.isMainWork()) { if (problems == null) { future.set(executable); e.getOwner().taskCompleted(e, task, duration); } else { future.set(problems); e.getOwner().taskCompletedWithProblems(e, task, duration, problems); } } }
java
public void synchronizeEnd(Executor e, Queue.Executable executable, Throwable problems, long duration) throws InterruptedException { endLatch.synchronize(); // the main thread will send a notification WorkUnit wu = e.getCurrentWorkUnit(); if (wu.isMainWork()) { if (problems == null) { future.set(executable); e.getOwner().taskCompleted(e, task, duration); } else { future.set(problems); e.getOwner().taskCompletedWithProblems(e, task, duration, problems); } } }
[ "public", "void", "synchronizeEnd", "(", "Executor", "e", ",", "Queue", ".", "Executable", "executable", ",", "Throwable", "problems", ",", "long", "duration", ")", "throws", "InterruptedException", "{", "endLatch", ".", "synchronize", "(", ")", ";", "// the main thread will send a notification", "WorkUnit", "wu", "=", "e", ".", "getCurrentWorkUnit", "(", ")", ";", "if", "(", "wu", ".", "isMainWork", "(", ")", ")", "{", "if", "(", "problems", "==", "null", ")", "{", "future", ".", "set", "(", "executable", ")", ";", "e", ".", "getOwner", "(", ")", ".", "taskCompleted", "(", "e", ",", "task", ",", "duration", ")", ";", "}", "else", "{", "future", ".", "set", "(", "problems", ")", ";", "e", ".", "getOwner", "(", ")", ".", "taskCompletedWithProblems", "(", "e", ",", "task", ",", "duration", ",", "problems", ")", ";", "}", "}", "}" ]
All the {@link Executor}s that jointly execute a {@link Task} call this method to synchronize on the end of the task. @throws InterruptedException If any of the member thread is interrupted while waiting for other threads to join, all the member threads will report {@link InterruptedException}.
[ "All", "the", "{", "@link", "Executor", "}", "s", "that", "jointly", "execute", "a", "{", "@link", "Task", "}", "call", "this", "method", "to", "synchronize", "on", "the", "end", "of", "the", "task", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/queue/WorkUnitContext.java#L132-L146
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/evaluation/clustering/EvaluateClustering.java
EvaluateClustering.evaluateRanking
public static double evaluateRanking(ScoreEvaluation eval, Cluster<?> clus, DoubleDBIDList ranking) { """ Evaluate given a cluster (of positive elements) and a scoring list. @param eval Evaluation method @param clus Cluster object @param ranking Object ranking @return Score """ return eval.evaluate(new DBIDsTest(DBIDUtil.ensureSet(clus.getIDs())), new DistanceResultAdapter(ranking.iter())); }
java
public static double evaluateRanking(ScoreEvaluation eval, Cluster<?> clus, DoubleDBIDList ranking) { return eval.evaluate(new DBIDsTest(DBIDUtil.ensureSet(clus.getIDs())), new DistanceResultAdapter(ranking.iter())); }
[ "public", "static", "double", "evaluateRanking", "(", "ScoreEvaluation", "eval", ",", "Cluster", "<", "?", ">", "clus", ",", "DoubleDBIDList", "ranking", ")", "{", "return", "eval", ".", "evaluate", "(", "new", "DBIDsTest", "(", "DBIDUtil", ".", "ensureSet", "(", "clus", ".", "getIDs", "(", ")", ")", ")", ",", "new", "DistanceResultAdapter", "(", "ranking", ".", "iter", "(", ")", ")", ")", ";", "}" ]
Evaluate given a cluster (of positive elements) and a scoring list. @param eval Evaluation method @param clus Cluster object @param ranking Object ranking @return Score
[ "Evaluate", "given", "a", "cluster", "(", "of", "positive", "elements", ")", "and", "a", "scoring", "list", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/evaluation/clustering/EvaluateClustering.java#L106-L108
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.perspectiveRect
public Matrix4d perspectiveRect(double width, double height, double zNear, double zFar, Matrix4d dest) { """ Apply a symmetric perspective projection frustum transformation for a right-handed coordinate system using OpenGL's NDC z range of <code>[-1..+1]</code> to this matrix and store the result in <code>dest</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>P</code> the perspective projection matrix, then the new matrix will be <code>M * P</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * P * v</code>, the perspective projection will be applied first! <p> In order to set the matrix to a perspective frustum transformation without post-multiplying, use {@link #setPerspectiveRect(double, double, double, double) setPerspectiveRect}. @see #setPerspectiveRect(double, double, double, double) @param width the width of the near frustum plane @param height the height of the near frustum plane @param zNear near clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity. In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zFar far clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity. In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}. @param dest will hold the result @return dest """ return perspectiveRect(width, height, zNear, zFar, false, dest); }
java
public Matrix4d perspectiveRect(double width, double height, double zNear, double zFar, Matrix4d dest) { return perspectiveRect(width, height, zNear, zFar, false, dest); }
[ "public", "Matrix4d", "perspectiveRect", "(", "double", "width", ",", "double", "height", ",", "double", "zNear", ",", "double", "zFar", ",", "Matrix4d", "dest", ")", "{", "return", "perspectiveRect", "(", "width", ",", "height", ",", "zNear", ",", "zFar", ",", "false", ",", "dest", ")", ";", "}" ]
Apply a symmetric perspective projection frustum transformation for a right-handed coordinate system using OpenGL's NDC z range of <code>[-1..+1]</code> to this matrix and store the result in <code>dest</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>P</code> the perspective projection matrix, then the new matrix will be <code>M * P</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * P * v</code>, the perspective projection will be applied first! <p> In order to set the matrix to a perspective frustum transformation without post-multiplying, use {@link #setPerspectiveRect(double, double, double, double) setPerspectiveRect}. @see #setPerspectiveRect(double, double, double, double) @param width the width of the near frustum plane @param height the height of the near frustum plane @param zNear near clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity. In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zFar far clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity. In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}. @param dest will hold the result @return dest
[ "Apply", "a", "symmetric", "perspective", "projection", "frustum", "transformation", "for", "a", "right", "-", "handed", "coordinate", "system", "using", "OpenGL", "s", "NDC", "z", "range", "of", "<code", ">", "[", "-", "1", "..", "+", "1", "]", "<", "/", "code", ">", "to", "this", "matrix", "and", "store", "the", "result", "in", "<code", ">", "dest<", "/", "code", ">", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is", "<code", ">", "this<", "/", "code", ">", "matrix", "and", "<code", ">", "P<", "/", "code", ">", "the", "perspective", "projection", "matrix", "then", "the", "new", "matrix", "will", "be", "<code", ">", "M", "*", "P<", "/", "code", ">", ".", "So", "when", "transforming", "a", "vector", "<code", ">", "v<", "/", "code", ">", "with", "the", "new", "matrix", "by", "using", "<code", ">", "M", "*", "P", "*", "v<", "/", "code", ">", "the", "perspective", "projection", "will", "be", "applied", "first!", "<p", ">", "In", "order", "to", "set", "the", "matrix", "to", "a", "perspective", "frustum", "transformation", "without", "post", "-", "multiplying", "use", "{", "@link", "#setPerspectiveRect", "(", "double", "double", "double", "double", ")", "setPerspectiveRect", "}", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L12261-L12263
dlemmermann/CalendarFX
CalendarFXView/src/main/java/com/calendarfx/model/Calendar.java
Calendar.stopBatchUpdates
public final void stopBatchUpdates() { """ Tells the calendar that the application is done making big changes. Invoking this method will trigger a calendar event of type {@link CalendarEvent#CALENDAR_CHANGED} which will then force an update of the views. """ batchUpdates = false; if (dirty) { dirty = false; fireEvent(new CalendarEvent(CalendarEvent.CALENDAR_CHANGED, this)); } }
java
public final void stopBatchUpdates() { batchUpdates = false; if (dirty) { dirty = false; fireEvent(new CalendarEvent(CalendarEvent.CALENDAR_CHANGED, this)); } }
[ "public", "final", "void", "stopBatchUpdates", "(", ")", "{", "batchUpdates", "=", "false", ";", "if", "(", "dirty", ")", "{", "dirty", "=", "false", ";", "fireEvent", "(", "new", "CalendarEvent", "(", "CalendarEvent", ".", "CALENDAR_CHANGED", ",", "this", ")", ")", ";", "}", "}" ]
Tells the calendar that the application is done making big changes. Invoking this method will trigger a calendar event of type {@link CalendarEvent#CALENDAR_CHANGED} which will then force an update of the views.
[ "Tells", "the", "calendar", "that", "the", "application", "is", "done", "making", "big", "changes", ".", "Invoking", "this", "method", "will", "trigger", "a", "calendar", "event", "of", "type", "{" ]
train
https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/model/Calendar.java#L252-L259
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/util/Scheduler.java
Scheduler.durationHours
public static long durationHours(LocalDateTime start,LocalDateTime end) { """ 1 Hours = 60 minutes @param start between time @param end finish time @return duration in hours """ if(start == null || end == null) return ZERO; return Duration.between(start, end).toHours(); }
java
public static long durationHours(LocalDateTime start,LocalDateTime end) { if(start == null || end == null) return ZERO; return Duration.between(start, end).toHours(); }
[ "public", "static", "long", "durationHours", "(", "LocalDateTime", "start", ",", "LocalDateTime", "end", ")", "{", "if", "(", "start", "==", "null", "||", "end", "==", "null", ")", "return", "ZERO", ";", "return", "Duration", ".", "between", "(", "start", ",", "end", ")", ".", "toHours", "(", ")", ";", "}" ]
1 Hours = 60 minutes @param start between time @param end finish time @return duration in hours
[ "1", "Hours", "=", "60", "minutes" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Scheduler.java#L121-L127
UrielCh/ovh-java-sdk
ovh-java-sdk-newAccount/src/main/java/net/minidev/ovh/api/ApiOvhNewAccount.java
ApiOvhNewAccount.rules_POST
public ArrayList<OvhCreationRule> rules_POST(OvhCreationRulesActionEnum action, String address, String area, String birthCity, String birthDay, String city, String companyNationalIdentificationNumber, String corporationType, OvhCountryEnum country, String email, String fax, String firstname, OvhLanguageEnum language, OvhLegalFormEnum legalform, String name, String nationalIdentificationNumber, String organisation, OvhOvhCompanyEnum ovhCompany, OvhOvhSubsidiaryEnum ovhSubsidiary, String phone, OvhCountryEnum phoneCountry, OvhGenderEnum sex, String spareEmail, String vat, String zip) throws IOException { """ Give all the rules to follow in order to create and update an OVH identifier REST: POST /newAccount/rules @param ovhSubsidiary [required] @param phone [required] @param phoneCountry [required] @param country [required] @param fax [required] @param organisation [required] @param nationalIdentificationNumber [required] @param vat [required] @param spareEmail [required] @param action [required] @param area [required] @param zip [required] @param address [required] @param legalform [required] @param sex [required] @param name [required] @param corporationType [required] @param birthCity [required] @param email [required] @param city [required] @param birthDay [required] @param companyNationalIdentificationNumber [required] @param firstname [required] @param language [required] @param ovhCompany [required] """ String qPath = "/newAccount/rules"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "action", action); addBody(o, "address", address); addBody(o, "area", area); addBody(o, "birthCity", birthCity); addBody(o, "birthDay", birthDay); addBody(o, "city", city); addBody(o, "companyNationalIdentificationNumber", companyNationalIdentificationNumber); addBody(o, "corporationType", corporationType); addBody(o, "country", country); addBody(o, "email", email); addBody(o, "fax", fax); addBody(o, "firstname", firstname); addBody(o, "language", language); addBody(o, "legalform", legalform); addBody(o, "name", name); addBody(o, "nationalIdentificationNumber", nationalIdentificationNumber); addBody(o, "organisation", organisation); addBody(o, "ovhCompany", ovhCompany); addBody(o, "ovhSubsidiary", ovhSubsidiary); addBody(o, "phone", phone); addBody(o, "phoneCountry", phoneCountry); addBody(o, "sex", sex); addBody(o, "spareEmail", spareEmail); addBody(o, "vat", vat); addBody(o, "zip", zip); String resp = execN(qPath, "POST", sb.toString(), o); return convertTo(resp, t4); }
java
public ArrayList<OvhCreationRule> rules_POST(OvhCreationRulesActionEnum action, String address, String area, String birthCity, String birthDay, String city, String companyNationalIdentificationNumber, String corporationType, OvhCountryEnum country, String email, String fax, String firstname, OvhLanguageEnum language, OvhLegalFormEnum legalform, String name, String nationalIdentificationNumber, String organisation, OvhOvhCompanyEnum ovhCompany, OvhOvhSubsidiaryEnum ovhSubsidiary, String phone, OvhCountryEnum phoneCountry, OvhGenderEnum sex, String spareEmail, String vat, String zip) throws IOException { String qPath = "/newAccount/rules"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "action", action); addBody(o, "address", address); addBody(o, "area", area); addBody(o, "birthCity", birthCity); addBody(o, "birthDay", birthDay); addBody(o, "city", city); addBody(o, "companyNationalIdentificationNumber", companyNationalIdentificationNumber); addBody(o, "corporationType", corporationType); addBody(o, "country", country); addBody(o, "email", email); addBody(o, "fax", fax); addBody(o, "firstname", firstname); addBody(o, "language", language); addBody(o, "legalform", legalform); addBody(o, "name", name); addBody(o, "nationalIdentificationNumber", nationalIdentificationNumber); addBody(o, "organisation", organisation); addBody(o, "ovhCompany", ovhCompany); addBody(o, "ovhSubsidiary", ovhSubsidiary); addBody(o, "phone", phone); addBody(o, "phoneCountry", phoneCountry); addBody(o, "sex", sex); addBody(o, "spareEmail", spareEmail); addBody(o, "vat", vat); addBody(o, "zip", zip); String resp = execN(qPath, "POST", sb.toString(), o); return convertTo(resp, t4); }
[ "public", "ArrayList", "<", "OvhCreationRule", ">", "rules_POST", "(", "OvhCreationRulesActionEnum", "action", ",", "String", "address", ",", "String", "area", ",", "String", "birthCity", ",", "String", "birthDay", ",", "String", "city", ",", "String", "companyNationalIdentificationNumber", ",", "String", "corporationType", ",", "OvhCountryEnum", "country", ",", "String", "email", ",", "String", "fax", ",", "String", "firstname", ",", "OvhLanguageEnum", "language", ",", "OvhLegalFormEnum", "legalform", ",", "String", "name", ",", "String", "nationalIdentificationNumber", ",", "String", "organisation", ",", "OvhOvhCompanyEnum", "ovhCompany", ",", "OvhOvhSubsidiaryEnum", "ovhSubsidiary", ",", "String", "phone", ",", "OvhCountryEnum", "phoneCountry", ",", "OvhGenderEnum", "sex", ",", "String", "spareEmail", ",", "String", "vat", ",", "String", "zip", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/newAccount/rules\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"action\"", ",", "action", ")", ";", "addBody", "(", "o", ",", "\"address\"", ",", "address", ")", ";", "addBody", "(", "o", ",", "\"area\"", ",", "area", ")", ";", "addBody", "(", "o", ",", "\"birthCity\"", ",", "birthCity", ")", ";", "addBody", "(", "o", ",", "\"birthDay\"", ",", "birthDay", ")", ";", "addBody", "(", "o", ",", "\"city\"", ",", "city", ")", ";", "addBody", "(", "o", ",", "\"companyNationalIdentificationNumber\"", ",", "companyNationalIdentificationNumber", ")", ";", "addBody", "(", "o", ",", "\"corporationType\"", ",", "corporationType", ")", ";", "addBody", "(", "o", ",", "\"country\"", ",", "country", ")", ";", "addBody", "(", "o", ",", "\"email\"", ",", "email", ")", ";", "addBody", "(", "o", ",", "\"fax\"", ",", "fax", ")", ";", "addBody", "(", "o", ",", "\"firstname\"", ",", "firstname", ")", ";", "addBody", "(", "o", ",", "\"language\"", ",", "language", ")", ";", "addBody", "(", "o", ",", "\"legalform\"", ",", "legalform", ")", ";", "addBody", "(", "o", ",", "\"name\"", ",", "name", ")", ";", "addBody", "(", "o", ",", "\"nationalIdentificationNumber\"", ",", "nationalIdentificationNumber", ")", ";", "addBody", "(", "o", ",", "\"organisation\"", ",", "organisation", ")", ";", "addBody", "(", "o", ",", "\"ovhCompany\"", ",", "ovhCompany", ")", ";", "addBody", "(", "o", ",", "\"ovhSubsidiary\"", ",", "ovhSubsidiary", ")", ";", "addBody", "(", "o", ",", "\"phone\"", ",", "phone", ")", ";", "addBody", "(", "o", ",", "\"phoneCountry\"", ",", "phoneCountry", ")", ";", "addBody", "(", "o", ",", "\"sex\"", ",", "sex", ")", ";", "addBody", "(", "o", ",", "\"spareEmail\"", ",", "spareEmail", ")", ";", "addBody", "(", "o", ",", "\"vat\"", ",", "vat", ")", ";", "addBody", "(", "o", ",", "\"zip\"", ",", "zip", ")", ";", "String", "resp", "=", "execN", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "t4", ")", ";", "}" ]
Give all the rules to follow in order to create and update an OVH identifier REST: POST /newAccount/rules @param ovhSubsidiary [required] @param phone [required] @param phoneCountry [required] @param country [required] @param fax [required] @param organisation [required] @param nationalIdentificationNumber [required] @param vat [required] @param spareEmail [required] @param action [required] @param area [required] @param zip [required] @param address [required] @param legalform [required] @param sex [required] @param name [required] @param corporationType [required] @param birthCity [required] @param email [required] @param city [required] @param birthDay [required] @param companyNationalIdentificationNumber [required] @param firstname [required] @param language [required] @param ovhCompany [required]
[ "Give", "all", "the", "rules", "to", "follow", "in", "order", "to", "create", "and", "update", "an", "OVH", "identifier" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-newAccount/src/main/java/net/minidev/ovh/api/ApiOvhNewAccount.java#L110-L141
bazaarvoice/emodb
table/src/main/java/com/bazaarvoice/emodb/table/db/astyanax/AstyanaxTableDAO.java
AstyanaxTableDAO.checkFacadeAllowed
@Override public boolean checkFacadeAllowed(String table, FacadeOptions options) throws FacadeExistsException { """ Returns true if facade may be created for the specified table and placement. Throws an exception if a facade is not allowed because of a conflict with the master or another facade. Returns false if there is already a facade at the specified placement, so facade creation would be idempotent. """ return checkFacadeAllowed(readTableJson(table, true), options.getPlacement(), null); }
java
@Override public boolean checkFacadeAllowed(String table, FacadeOptions options) throws FacadeExistsException { return checkFacadeAllowed(readTableJson(table, true), options.getPlacement(), null); }
[ "@", "Override", "public", "boolean", "checkFacadeAllowed", "(", "String", "table", ",", "FacadeOptions", "options", ")", "throws", "FacadeExistsException", "{", "return", "checkFacadeAllowed", "(", "readTableJson", "(", "table", ",", "true", ")", ",", "options", ".", "getPlacement", "(", ")", ",", "null", ")", ";", "}" ]
Returns true if facade may be created for the specified table and placement. Throws an exception if a facade is not allowed because of a conflict with the master or another facade. Returns false if there is already a facade at the specified placement, so facade creation would be idempotent.
[ "Returns", "true", "if", "facade", "may", "be", "created", "for", "the", "specified", "table", "and", "placement", ".", "Throws", "an", "exception", "if", "a", "facade", "is", "not", "allowed", "because", "of", "a", "conflict", "with", "the", "master", "or", "another", "facade", ".", "Returns", "false", "if", "there", "is", "already", "a", "facade", "at", "the", "specified", "placement", "so", "facade", "creation", "would", "be", "idempotent", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/table/src/main/java/com/bazaarvoice/emodb/table/db/astyanax/AstyanaxTableDAO.java#L644-L648
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java
KeyVaultClientCustomImpl.listKeyVersions
public PagedList<KeyItem> listKeyVersions(final String vaultBaseUrl, final String keyName, final Integer maxresults) { """ Retrieves a list of individual key versions with the same key name. The full key identifier, attributes, and tags are provided in the response. Authorization: Requires the keys/list permission. @param vaultBaseUrl The vault name, e.g. https://myvault.vault.azure.net @param keyName The name of the key @param maxresults Maximum number of results to return in a page. If not specified the service will return up to 25 results. @return the PagedList&lt;KeyItem&gt; if successful. """ return getKeyVersions(vaultBaseUrl, keyName, maxresults); }
java
public PagedList<KeyItem> listKeyVersions(final String vaultBaseUrl, final String keyName, final Integer maxresults) { return getKeyVersions(vaultBaseUrl, keyName, maxresults); }
[ "public", "PagedList", "<", "KeyItem", ">", "listKeyVersions", "(", "final", "String", "vaultBaseUrl", ",", "final", "String", "keyName", ",", "final", "Integer", "maxresults", ")", "{", "return", "getKeyVersions", "(", "vaultBaseUrl", ",", "keyName", ",", "maxresults", ")", ";", "}" ]
Retrieves a list of individual key versions with the same key name. The full key identifier, attributes, and tags are provided in the response. Authorization: Requires the keys/list permission. @param vaultBaseUrl The vault name, e.g. https://myvault.vault.azure.net @param keyName The name of the key @param maxresults Maximum number of results to return in a page. If not specified the service will return up to 25 results. @return the PagedList&lt;KeyItem&gt; if successful.
[ "Retrieves", "a", "list", "of", "individual", "key", "versions", "with", "the", "same", "key", "name", ".", "The", "full", "key", "identifier", "attributes", "and", "tags", "are", "provided", "in", "the", "response", ".", "Authorization", ":", "Requires", "the", "keys", "/", "list", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java#L823-L826
dbracewell/mango
src/main/java/com/davidbracewell/json/JsonReader.java
JsonReader.nextCollection
public <T extends Collection<Val>> T nextCollection(@NonNull Supplier<T> supplier) throws IOException { """ Reads the next array as a collection. @param <T> the collection type @param supplier the supplier to create a new collection @return the collection containing the items in the next array @throws IOException Something went wrong reading """ return nextCollection(supplier, StringUtils.EMPTY); }
java
public <T extends Collection<Val>> T nextCollection(@NonNull Supplier<T> supplier) throws IOException { return nextCollection(supplier, StringUtils.EMPTY); }
[ "public", "<", "T", "extends", "Collection", "<", "Val", ">", ">", "T", "nextCollection", "(", "@", "NonNull", "Supplier", "<", "T", ">", "supplier", ")", "throws", "IOException", "{", "return", "nextCollection", "(", "supplier", ",", "StringUtils", ".", "EMPTY", ")", ";", "}" ]
Reads the next array as a collection. @param <T> the collection type @param supplier the supplier to create a new collection @return the collection containing the items in the next array @throws IOException Something went wrong reading
[ "Reads", "the", "next", "array", "as", "a", "collection", "." ]
train
https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/json/JsonReader.java#L394-L396
IBM/ibm-cos-sdk-java
ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/aspera/transfer/AsperaLibraryLoader.java
AsperaLibraryLoader.extractFile
public static void extractFile(JarFile jar, JarEntry entry, File destPath) throws IOException { """ Extracts a jar entry from a jar file to a target location on the local file system @param jar The jar in which the desired file resides @param entry The desired entry (file) to extract from the jar @param destPath The target location to extract the jar entry to @throws IOException if any IO failure occurs during file extraction """ InputStream in = null; OutputStream out = null; try { in = jar.getInputStream(entry); out = new FileOutputStream(destPath); byte[] buf = new byte[1024]; for (int i = in.read(buf); i != -1; i = in.read(buf)) { out.write(buf, 0, i); } } finally { if(in != null) { in.close(); } if(out != null) { out.close(); } } //Ensure persmissions are set correct on ascp, has to be done after the File has been created if (entry.getName().equals("ascp")) { destPath.setExecutable(true); destPath.setWritable(true); } }
java
public static void extractFile(JarFile jar, JarEntry entry, File destPath) throws IOException { InputStream in = null; OutputStream out = null; try { in = jar.getInputStream(entry); out = new FileOutputStream(destPath); byte[] buf = new byte[1024]; for (int i = in.read(buf); i != -1; i = in.read(buf)) { out.write(buf, 0, i); } } finally { if(in != null) { in.close(); } if(out != null) { out.close(); } } //Ensure persmissions are set correct on ascp, has to be done after the File has been created if (entry.getName().equals("ascp")) { destPath.setExecutable(true); destPath.setWritable(true); } }
[ "public", "static", "void", "extractFile", "(", "JarFile", "jar", ",", "JarEntry", "entry", ",", "File", "destPath", ")", "throws", "IOException", "{", "InputStream", "in", "=", "null", ";", "OutputStream", "out", "=", "null", ";", "try", "{", "in", "=", "jar", ".", "getInputStream", "(", "entry", ")", ";", "out", "=", "new", "FileOutputStream", "(", "destPath", ")", ";", "byte", "[", "]", "buf", "=", "new", "byte", "[", "1024", "]", ";", "for", "(", "int", "i", "=", "in", ".", "read", "(", "buf", ")", ";", "i", "!=", "-", "1", ";", "i", "=", "in", ".", "read", "(", "buf", ")", ")", "{", "out", ".", "write", "(", "buf", ",", "0", ",", "i", ")", ";", "}", "}", "finally", "{", "if", "(", "in", "!=", "null", ")", "{", "in", ".", "close", "(", ")", ";", "}", "if", "(", "out", "!=", "null", ")", "{", "out", ".", "close", "(", ")", ";", "}", "}", "//Ensure persmissions are set correct on ascp, has to be done after the File has been created", "if", "(", "entry", ".", "getName", "(", ")", ".", "equals", "(", "\"ascp\"", ")", ")", "{", "destPath", ".", "setExecutable", "(", "true", ")", ";", "destPath", ".", "setWritable", "(", "true", ")", ";", "}", "}" ]
Extracts a jar entry from a jar file to a target location on the local file system @param jar The jar in which the desired file resides @param entry The desired entry (file) to extract from the jar @param destPath The target location to extract the jar entry to @throws IOException if any IO failure occurs during file extraction
[ "Extracts", "a", "jar", "entry", "from", "a", "jar", "file", "to", "a", "target", "location", "on", "the", "local", "file", "system" ]
train
https://github.com/IBM/ibm-cos-sdk-java/blob/d0bb2dd754c328a05e7dba8dc42e28b271b6daf2/ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/aspera/transfer/AsperaLibraryLoader.java#L149-L175
jeremylong/DependencyCheck
cli/src/main/java/org/owasp/dependencycheck/App.java
App.determineReturnCode
private int determineReturnCode(Engine engine, int cvssFailScore) { """ Determines the return code based on if one of the dependencies scanned has a vulnerability with a CVSS score above the cvssFailScore. @param engine the engine used during analysis @param cvssFailScore the max allowed CVSS score @return returns <code>1</code> if a severe enough vulnerability is identified; otherwise <code>0</code> """ int retCode = 0; //Set the exit code based on whether we found a high enough vulnerability for (Dependency dep : engine.getDependencies()) { if (!dep.getVulnerabilities().isEmpty()) { for (Vulnerability vuln : dep.getVulnerabilities()) { LOGGER.debug("VULNERABILITY FOUND {}", dep.getDisplayFileName()); if ((vuln.getCvssV2() != null && vuln.getCvssV2().getScore() > cvssFailScore) || (vuln.getCvssV3() != null && vuln.getCvssV3().getBaseScore() > cvssFailScore)) { retCode = 1; } } } } return retCode; }
java
private int determineReturnCode(Engine engine, int cvssFailScore) { int retCode = 0; //Set the exit code based on whether we found a high enough vulnerability for (Dependency dep : engine.getDependencies()) { if (!dep.getVulnerabilities().isEmpty()) { for (Vulnerability vuln : dep.getVulnerabilities()) { LOGGER.debug("VULNERABILITY FOUND {}", dep.getDisplayFileName()); if ((vuln.getCvssV2() != null && vuln.getCvssV2().getScore() > cvssFailScore) || (vuln.getCvssV3() != null && vuln.getCvssV3().getBaseScore() > cvssFailScore)) { retCode = 1; } } } } return retCode; }
[ "private", "int", "determineReturnCode", "(", "Engine", "engine", ",", "int", "cvssFailScore", ")", "{", "int", "retCode", "=", "0", ";", "//Set the exit code based on whether we found a high enough vulnerability", "for", "(", "Dependency", "dep", ":", "engine", ".", "getDependencies", "(", ")", ")", "{", "if", "(", "!", "dep", ".", "getVulnerabilities", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "for", "(", "Vulnerability", "vuln", ":", "dep", ".", "getVulnerabilities", "(", ")", ")", "{", "LOGGER", ".", "debug", "(", "\"VULNERABILITY FOUND {}\"", ",", "dep", ".", "getDisplayFileName", "(", ")", ")", ";", "if", "(", "(", "vuln", ".", "getCvssV2", "(", ")", "!=", "null", "&&", "vuln", ".", "getCvssV2", "(", ")", ".", "getScore", "(", ")", ">", "cvssFailScore", ")", "||", "(", "vuln", ".", "getCvssV3", "(", ")", "!=", "null", "&&", "vuln", ".", "getCvssV3", "(", ")", ".", "getBaseScore", "(", ")", ">", "cvssFailScore", ")", ")", "{", "retCode", "=", "1", ";", "}", "}", "}", "}", "return", "retCode", ";", "}" ]
Determines the return code based on if one of the dependencies scanned has a vulnerability with a CVSS score above the cvssFailScore. @param engine the engine used during analysis @param cvssFailScore the max allowed CVSS score @return returns <code>1</code> if a severe enough vulnerability is identified; otherwise <code>0</code>
[ "Determines", "the", "return", "code", "based", "on", "if", "one", "of", "the", "dependencies", "scanned", "has", "a", "vulnerability", "with", "a", "CVSS", "score", "above", "the", "cvssFailScore", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/cli/src/main/java/org/owasp/dependencycheck/App.java#L292-L307
recruit-mp/android-RMP-Appirater
library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java
RmpAppirater.tryToShowPrompt
public static void tryToShowPrompt(Context context, OnCompleteListener onCompleteListener) { """ Show rating dialog. The dialog will be showed if the user hasn't declined to rate or hasn't rated current version. @param context Context @param onCompleteListener Listener which be called after process of review dialog finished. """ tryToShowPrompt(context, null, null, onCompleteListener); }
java
public static void tryToShowPrompt(Context context, OnCompleteListener onCompleteListener) { tryToShowPrompt(context, null, null, onCompleteListener); }
[ "public", "static", "void", "tryToShowPrompt", "(", "Context", "context", ",", "OnCompleteListener", "onCompleteListener", ")", "{", "tryToShowPrompt", "(", "context", ",", "null", ",", "null", ",", "onCompleteListener", ")", ";", "}" ]
Show rating dialog. The dialog will be showed if the user hasn't declined to rate or hasn't rated current version. @param context Context @param onCompleteListener Listener which be called after process of review dialog finished.
[ "Show", "rating", "dialog", ".", "The", "dialog", "will", "be", "showed", "if", "the", "user", "hasn", "t", "declined", "to", "rate", "or", "hasn", "t", "rated", "current", "version", "." ]
train
https://github.com/recruit-mp/android-RMP-Appirater/blob/14fcdf110dfb97120303f39aab1de9393e84b90a/library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java#L192-L194
googleapis/google-cloud-java
google-cloud-clients/google-cloud-talent/src/main/java/com/google/cloud/talent/v4beta1/EventServiceClient.java
EventServiceClient.createClientEvent
public final ClientEvent createClientEvent(String parent, ClientEvent clientEvent) { """ Report events issued when end user interacts with customer's application that uses Cloud Talent Solution. You may inspect the created events in [self service tools](https://console.cloud.google.com/talent-solution/overview). [Learn more](https://cloud.google.com/talent-solution/docs/management-tools) about self service tools. <p>Sample code: <pre><code> try (EventServiceClient eventServiceClient = EventServiceClient.create()) { TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]"); ClientEvent clientEvent = ClientEvent.newBuilder().build(); ClientEvent response = eventServiceClient.createClientEvent(parent.toString(), clientEvent); } </code></pre> @param parent Required. <p>Resource name of the tenant under which the event is created. <p>The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenant/foo". <p>Tenant id is optional and a default tenant is created if unspecified, for example, "projects/api-test-project". @param clientEvent Required. <p>Events issued when end user interacts with customer's application that uses Cloud Talent Solution. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ CreateClientEventRequest request = CreateClientEventRequest.newBuilder().setParent(parent).setClientEvent(clientEvent).build(); return createClientEvent(request); }
java
public final ClientEvent createClientEvent(String parent, ClientEvent clientEvent) { CreateClientEventRequest request = CreateClientEventRequest.newBuilder().setParent(parent).setClientEvent(clientEvent).build(); return createClientEvent(request); }
[ "public", "final", "ClientEvent", "createClientEvent", "(", "String", "parent", ",", "ClientEvent", "clientEvent", ")", "{", "CreateClientEventRequest", "request", "=", "CreateClientEventRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", ")", ".", "setClientEvent", "(", "clientEvent", ")", ".", "build", "(", ")", ";", "return", "createClientEvent", "(", "request", ")", ";", "}" ]
Report events issued when end user interacts with customer's application that uses Cloud Talent Solution. You may inspect the created events in [self service tools](https://console.cloud.google.com/talent-solution/overview). [Learn more](https://cloud.google.com/talent-solution/docs/management-tools) about self service tools. <p>Sample code: <pre><code> try (EventServiceClient eventServiceClient = EventServiceClient.create()) { TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]"); ClientEvent clientEvent = ClientEvent.newBuilder().build(); ClientEvent response = eventServiceClient.createClientEvent(parent.toString(), clientEvent); } </code></pre> @param parent Required. <p>Resource name of the tenant under which the event is created. <p>The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenant/foo". <p>Tenant id is optional and a default tenant is created if unspecified, for example, "projects/api-test-project". @param clientEvent Required. <p>Events issued when end user interacts with customer's application that uses Cloud Talent Solution. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Report", "events", "issued", "when", "end", "user", "interacts", "with", "customer", "s", "application", "that", "uses", "Cloud", "Talent", "Solution", ".", "You", "may", "inspect", "the", "created", "events", "in", "[", "self", "service", "tools", "]", "(", "https", ":", "//", "console", ".", "cloud", ".", "google", ".", "com", "/", "talent", "-", "solution", "/", "overview", ")", ".", "[", "Learn", "more", "]", "(", "https", ":", "//", "cloud", ".", "google", ".", "com", "/", "talent", "-", "solution", "/", "docs", "/", "management", "-", "tools", ")", "about", "self", "service", "tools", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-talent/src/main/java/com/google/cloud/talent/v4beta1/EventServiceClient.java#L213-L218
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/spi/properties/HazelcastProperties.java
HazelcastProperties.getPositiveMillisOrDefault
public long getPositiveMillisOrDefault(HazelcastProperty property, long defaultValue) { """ Returns the configured value of a {@link HazelcastProperty} converted to milliseconds if it is positive, otherwise returns the passed default value. @param property the {@link HazelcastProperty} to get the value from @param defaultValue the default value to return if property has non positive value. @return the value in milliseconds if it is positive, otherwise the passed default value. @throws IllegalArgumentException if the {@link HazelcastProperty} has no {@link TimeUnit} """ long millis = getMillis(property); return millis > 0 ? millis : defaultValue; }
java
public long getPositiveMillisOrDefault(HazelcastProperty property, long defaultValue) { long millis = getMillis(property); return millis > 0 ? millis : defaultValue; }
[ "public", "long", "getPositiveMillisOrDefault", "(", "HazelcastProperty", "property", ",", "long", "defaultValue", ")", "{", "long", "millis", "=", "getMillis", "(", "property", ")", ";", "return", "millis", ">", "0", "?", "millis", ":", "defaultValue", ";", "}" ]
Returns the configured value of a {@link HazelcastProperty} converted to milliseconds if it is positive, otherwise returns the passed default value. @param property the {@link HazelcastProperty} to get the value from @param defaultValue the default value to return if property has non positive value. @return the value in milliseconds if it is positive, otherwise the passed default value. @throws IllegalArgumentException if the {@link HazelcastProperty} has no {@link TimeUnit}
[ "Returns", "the", "configured", "value", "of", "a", "{", "@link", "HazelcastProperty", "}", "converted", "to", "milliseconds", "if", "it", "is", "positive", "otherwise", "returns", "the", "passed", "default", "value", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/properties/HazelcastProperties.java#L262-L265
apache/incubator-atlas
repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java
DefaultMetadataService.addTrait
@Override public void addTrait(String guid, String traitInstanceDefinition) throws AtlasException { """ Adds a new trait to an existing entity represented by a guid. @param guid globally unique identifier for the entity @param traitInstanceDefinition trait instance json that needs to be added to entity @throws AtlasException """ guid = ParamChecker.notEmpty(guid, "entity id"); traitInstanceDefinition = ParamChecker.notEmpty(traitInstanceDefinition, "trait instance definition"); ITypedStruct traitInstance = deserializeTraitInstance(traitInstanceDefinition); addTrait(guid, traitInstance); }
java
@Override public void addTrait(String guid, String traitInstanceDefinition) throws AtlasException { guid = ParamChecker.notEmpty(guid, "entity id"); traitInstanceDefinition = ParamChecker.notEmpty(traitInstanceDefinition, "trait instance definition"); ITypedStruct traitInstance = deserializeTraitInstance(traitInstanceDefinition); addTrait(guid, traitInstance); }
[ "@", "Override", "public", "void", "addTrait", "(", "String", "guid", ",", "String", "traitInstanceDefinition", ")", "throws", "AtlasException", "{", "guid", "=", "ParamChecker", ".", "notEmpty", "(", "guid", ",", "\"entity id\"", ")", ";", "traitInstanceDefinition", "=", "ParamChecker", ".", "notEmpty", "(", "traitInstanceDefinition", ",", "\"trait instance definition\"", ")", ";", "ITypedStruct", "traitInstance", "=", "deserializeTraitInstance", "(", "traitInstanceDefinition", ")", ";", "addTrait", "(", "guid", ",", "traitInstance", ")", ";", "}" ]
Adds a new trait to an existing entity represented by a guid. @param guid globally unique identifier for the entity @param traitInstanceDefinition trait instance json that needs to be added to entity @throws AtlasException
[ "Adds", "a", "new", "trait", "to", "an", "existing", "entity", "represented", "by", "a", "guid", "." ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java#L600-L607
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/xml/XMLAttributeList.java
XMLAttributeList.addAttribute
public XMLAttributeList addAttribute(@Nonnull String name, @Nonnull String value) { """ Add a single attribute name and value. @param name the attribute name @param value the attribute value @return this object (so calls to addAttribute() can be chained) """ if (name == null) { throw new NullPointerException("name must be nonnull"); } if (value == null) { throw new NullPointerException("value must be nonnull"); } nameValuePairList.add(new NameValuePair(name, value)); return this; }
java
public XMLAttributeList addAttribute(@Nonnull String name, @Nonnull String value) { if (name == null) { throw new NullPointerException("name must be nonnull"); } if (value == null) { throw new NullPointerException("value must be nonnull"); } nameValuePairList.add(new NameValuePair(name, value)); return this; }
[ "public", "XMLAttributeList", "addAttribute", "(", "@", "Nonnull", "String", "name", ",", "@", "Nonnull", "String", "value", ")", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"name must be nonnull\"", ")", ";", "}", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"value must be nonnull\"", ")", ";", "}", "nameValuePairList", ".", "add", "(", "new", "NameValuePair", "(", "name", ",", "value", ")", ")", ";", "return", "this", ";", "}" ]
Add a single attribute name and value. @param name the attribute name @param value the attribute value @return this object (so calls to addAttribute() can be chained)
[ "Add", "a", "single", "attribute", "name", "and", "value", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/xml/XMLAttributeList.java#L75-L84
ngageoint/geopackage-java
src/main/java/mil/nga/geopackage/tiles/features/DefaultFeatureTiles.java
DefaultFeatureTiles.drawLineString
private boolean drawLineString(double simplifyTolerance, BoundingBox boundingBox, ProjectionTransform transform, FeatureTileGraphics graphics, LineString lineString, FeatureStyle featureStyle) { """ Draw a LineString @param simplifyTolerance simplify tolerance in meters @param boundingBox bounding box @param transform projection transform @param graphics feature tile graphics @param lineString line string @param featureStyle feature style @return true if drawn """ Path2D path = getPath(simplifyTolerance, boundingBox, transform, lineString); return drawLine(graphics, path, featureStyle); }
java
private boolean drawLineString(double simplifyTolerance, BoundingBox boundingBox, ProjectionTransform transform, FeatureTileGraphics graphics, LineString lineString, FeatureStyle featureStyle) { Path2D path = getPath(simplifyTolerance, boundingBox, transform, lineString); return drawLine(graphics, path, featureStyle); }
[ "private", "boolean", "drawLineString", "(", "double", "simplifyTolerance", ",", "BoundingBox", "boundingBox", ",", "ProjectionTransform", "transform", ",", "FeatureTileGraphics", "graphics", ",", "LineString", "lineString", ",", "FeatureStyle", "featureStyle", ")", "{", "Path2D", "path", "=", "getPath", "(", "simplifyTolerance", ",", "boundingBox", ",", "transform", ",", "lineString", ")", ";", "return", "drawLine", "(", "graphics", ",", "path", ",", "featureStyle", ")", ";", "}" ]
Draw a LineString @param simplifyTolerance simplify tolerance in meters @param boundingBox bounding box @param transform projection transform @param graphics feature tile graphics @param lineString line string @param featureStyle feature style @return true if drawn
[ "Draw", "a", "LineString" ]
train
https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/tiles/features/DefaultFeatureTiles.java#L455-L462
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.orthoSymmetric
public Matrix4f orthoSymmetric(float width, float height, float zNear, float zFar, boolean zZeroToOne) { """ Apply a symmetric orthographic projection transformation for a right-handed coordinate system using the given NDC z range to this matrix. <p> This method is equivalent to calling {@link #ortho(float, float, float, float, float, float, boolean) ortho()} with <code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix, then the new matrix will be <code>M * O</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the orthographic projection transformation will be applied first! <p> In order to set the matrix to a symmetric orthographic projection without post-multiplying it, use {@link #setOrthoSymmetric(float, float, float, float, boolean) setOrthoSymmetric()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #setOrthoSymmetric(float, float, float, float, boolean) @param width the distance between the right and left frustum edges @param height the distance between the top and bottom frustum edges @param zNear near clipping plane distance @param zFar far clipping plane distance @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return a matrix holding the result """ return orthoSymmetric(width, height, zNear, zFar, zZeroToOne, thisOrNew()); }
java
public Matrix4f orthoSymmetric(float width, float height, float zNear, float zFar, boolean zZeroToOne) { return orthoSymmetric(width, height, zNear, zFar, zZeroToOne, thisOrNew()); }
[ "public", "Matrix4f", "orthoSymmetric", "(", "float", "width", ",", "float", "height", ",", "float", "zNear", ",", "float", "zFar", ",", "boolean", "zZeroToOne", ")", "{", "return", "orthoSymmetric", "(", "width", ",", "height", ",", "zNear", ",", "zFar", ",", "zZeroToOne", ",", "thisOrNew", "(", ")", ")", ";", "}" ]
Apply a symmetric orthographic projection transformation for a right-handed coordinate system using the given NDC z range to this matrix. <p> This method is equivalent to calling {@link #ortho(float, float, float, float, float, float, boolean) ortho()} with <code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix, then the new matrix will be <code>M * O</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the orthographic projection transformation will be applied first! <p> In order to set the matrix to a symmetric orthographic projection without post-multiplying it, use {@link #setOrthoSymmetric(float, float, float, float, boolean) setOrthoSymmetric()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #setOrthoSymmetric(float, float, float, float, boolean) @param width the distance between the right and left frustum edges @param height the distance between the top and bottom frustum edges @param zNear near clipping plane distance @param zFar far clipping plane distance @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return a matrix holding the result
[ "Apply", "a", "symmetric", "orthographic", "projection", "transformation", "for", "a", "right", "-", "handed", "coordinate", "system", "using", "the", "given", "NDC", "z", "range", "to", "this", "matrix", ".", "<p", ">", "This", "method", "is", "equivalent", "to", "calling", "{", "@link", "#ortho", "(", "float", "float", "float", "float", "float", "float", "boolean", ")", "ortho", "()", "}", "with", "<code", ">", "left", "=", "-", "width", "/", "2<", "/", "code", ">", "<code", ">", "right", "=", "+", "width", "/", "2<", "/", "code", ">", "<code", ">", "bottom", "=", "-", "height", "/", "2<", "/", "code", ">", "and", "<code", ">", "top", "=", "+", "height", "/", "2<", "/", "code", ">", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is", "<code", ">", "this<", "/", "code", ">", "matrix", "and", "<code", ">", "O<", "/", "code", ">", "the", "orthographic", "projection", "matrix", "then", "the", "new", "matrix", "will", "be", "<code", ">", "M", "*", "O<", "/", "code", ">", ".", "So", "when", "transforming", "a", "vector", "<code", ">", "v<", "/", "code", ">", "with", "the", "new", "matrix", "by", "using", "<code", ">", "M", "*", "O", "*", "v<", "/", "code", ">", "the", "orthographic", "projection", "transformation", "will", "be", "applied", "first!", "<p", ">", "In", "order", "to", "set", "the", "matrix", "to", "a", "symmetric", "orthographic", "projection", "without", "post", "-", "multiplying", "it", "use", "{", "@link", "#setOrthoSymmetric", "(", "float", "float", "float", "float", "boolean", ")", "setOrthoSymmetric", "()", "}", ".", "<p", ">", "Reference", ":", "<a", "href", "=", "http", ":", "//", "www", ".", "songho", ".", "ca", "/", "opengl", "/", "gl_projectionmatrix", ".", "html#ortho", ">", "http", ":", "//", "www", ".", "songho", ".", "ca<", "/", "a", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L7434-L7436
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/execution/workflow/BaseWorkflowExecutor.java
BaseWorkflowExecutor.createPrintableDataContext
protected Map<String, Map<String, String>> createPrintableDataContext(Map<String, Map<String, String>> dataContext) { """ Creates a copy of the given data context with the secure option values obfuscated. This does not modify the original data context. "secureOption" map values will always be obfuscated. "option" entries that are also in "secureOption" will have their values obfuscated. All other maps within the data context will be added directly to the copy. @param dataContext data @return printable data """ return createPrintableDataContext(OPTION_KEY, SECURE_OPTION_KEY, SECURE_OPTION_VALUE, dataContext); }
java
protected Map<String, Map<String, String>> createPrintableDataContext(Map<String, Map<String, String>> dataContext) { return createPrintableDataContext(OPTION_KEY, SECURE_OPTION_KEY, SECURE_OPTION_VALUE, dataContext); }
[ "protected", "Map", "<", "String", ",", "Map", "<", "String", ",", "String", ">", ">", "createPrintableDataContext", "(", "Map", "<", "String", ",", "Map", "<", "String", ",", "String", ">", ">", "dataContext", ")", "{", "return", "createPrintableDataContext", "(", "OPTION_KEY", ",", "SECURE_OPTION_KEY", ",", "SECURE_OPTION_VALUE", ",", "dataContext", ")", ";", "}" ]
Creates a copy of the given data context with the secure option values obfuscated. This does not modify the original data context. "secureOption" map values will always be obfuscated. "option" entries that are also in "secureOption" will have their values obfuscated. All other maps within the data context will be added directly to the copy. @param dataContext data @return printable data
[ "Creates", "a", "copy", "of", "the", "given", "data", "context", "with", "the", "secure", "option", "values", "obfuscated", ".", "This", "does", "not", "modify", "the", "original", "data", "context", "." ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/workflow/BaseWorkflowExecutor.java#L571-L574
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/GlUtil.java
GlUtil.createProgram
public static int createProgram(String vertexSource, String fragmentSource) { """ Creates a new program from the supplied vertex and fragment shaders. @return A handle to the program, or 0 on failure. """ int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource); if (vertexShader == 0) { return 0; } int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource); if (pixelShader == 0) { return 0; } int program = GLES20.glCreateProgram(); checkGlError("glCreateProgram"); if (program == 0) { Log.e(TAG, "Could not create program"); } GLES20.glAttachShader(program, vertexShader); checkGlError("glAttachShader"); GLES20.glAttachShader(program, pixelShader); checkGlError("glAttachShader"); GLES20.glLinkProgram(program); int[] linkStatus = new int[1]; GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0); if (linkStatus[0] != GLES20.GL_TRUE) { Log.e(TAG, "Could not link program: "); Log.e(TAG, GLES20.glGetProgramInfoLog(program)); GLES20.glDeleteProgram(program); program = 0; } return program; }
java
public static int createProgram(String vertexSource, String fragmentSource) { int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource); if (vertexShader == 0) { return 0; } int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource); if (pixelShader == 0) { return 0; } int program = GLES20.glCreateProgram(); checkGlError("glCreateProgram"); if (program == 0) { Log.e(TAG, "Could not create program"); } GLES20.glAttachShader(program, vertexShader); checkGlError("glAttachShader"); GLES20.glAttachShader(program, pixelShader); checkGlError("glAttachShader"); GLES20.glLinkProgram(program); int[] linkStatus = new int[1]; GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0); if (linkStatus[0] != GLES20.GL_TRUE) { Log.e(TAG, "Could not link program: "); Log.e(TAG, GLES20.glGetProgramInfoLog(program)); GLES20.glDeleteProgram(program); program = 0; } return program; }
[ "public", "static", "int", "createProgram", "(", "String", "vertexSource", ",", "String", "fragmentSource", ")", "{", "int", "vertexShader", "=", "loadShader", "(", "GLES20", ".", "GL_VERTEX_SHADER", ",", "vertexSource", ")", ";", "if", "(", "vertexShader", "==", "0", ")", "{", "return", "0", ";", "}", "int", "pixelShader", "=", "loadShader", "(", "GLES20", ".", "GL_FRAGMENT_SHADER", ",", "fragmentSource", ")", ";", "if", "(", "pixelShader", "==", "0", ")", "{", "return", "0", ";", "}", "int", "program", "=", "GLES20", ".", "glCreateProgram", "(", ")", ";", "checkGlError", "(", "\"glCreateProgram\"", ")", ";", "if", "(", "program", "==", "0", ")", "{", "Log", ".", "e", "(", "TAG", ",", "\"Could not create program\"", ")", ";", "}", "GLES20", ".", "glAttachShader", "(", "program", ",", "vertexShader", ")", ";", "checkGlError", "(", "\"glAttachShader\"", ")", ";", "GLES20", ".", "glAttachShader", "(", "program", ",", "pixelShader", ")", ";", "checkGlError", "(", "\"glAttachShader\"", ")", ";", "GLES20", ".", "glLinkProgram", "(", "program", ")", ";", "int", "[", "]", "linkStatus", "=", "new", "int", "[", "1", "]", ";", "GLES20", ".", "glGetProgramiv", "(", "program", ",", "GLES20", ".", "GL_LINK_STATUS", ",", "linkStatus", ",", "0", ")", ";", "if", "(", "linkStatus", "[", "0", "]", "!=", "GLES20", ".", "GL_TRUE", ")", "{", "Log", ".", "e", "(", "TAG", ",", "\"Could not link program: \"", ")", ";", "Log", ".", "e", "(", "TAG", ",", "GLES20", ".", "glGetProgramInfoLog", "(", "program", ")", ")", ";", "GLES20", ".", "glDeleteProgram", "(", "program", ")", ";", "program", "=", "0", ";", "}", "return", "program", ";", "}" ]
Creates a new program from the supplied vertex and fragment shaders. @return A handle to the program, or 0 on failure.
[ "Creates", "a", "new", "program", "from", "the", "supplied", "vertex", "and", "fragment", "shaders", "." ]
train
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/GlUtil.java#L50-L79
alkacon/opencms-core
src/org/opencms/workplace/CmsWorkplaceSettings.java
CmsWorkplaceSettings.setLastUsedGallery
public void setLastUsedGallery(String galleryKey, String gallerypath) { """ Saves the last gallery for a given key.<p> @param galleryKey the gallery key @param gallerypath the resourcepath of the gallery """ m_lastUsedGalleries.put(galleryKey, gallerypath); LOG.info("user=" + m_user.getName() + ": setLastUsedGallery " + galleryKey + " -> " + gallerypath); }
java
public void setLastUsedGallery(String galleryKey, String gallerypath) { m_lastUsedGalleries.put(galleryKey, gallerypath); LOG.info("user=" + m_user.getName() + ": setLastUsedGallery " + galleryKey + " -> " + gallerypath); }
[ "public", "void", "setLastUsedGallery", "(", "String", "galleryKey", ",", "String", "gallerypath", ")", "{", "m_lastUsedGalleries", ".", "put", "(", "galleryKey", ",", "gallerypath", ")", ";", "LOG", ".", "info", "(", "\"user=\"", "+", "m_user", ".", "getName", "(", ")", "+", "\": setLastUsedGallery \"", "+", "galleryKey", "+", "\" -> \"", "+", "gallerypath", ")", ";", "}" ]
Saves the last gallery for a given key.<p> @param galleryKey the gallery key @param gallerypath the resourcepath of the gallery
[ "Saves", "the", "last", "gallery", "for", "a", "given", "key", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplaceSettings.java#L669-L673
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/html/Page.java
Page.addTo
public void addTo(String section, Object element) { """ Add content to a named sections. If the named section cannot. be found, the content is added to the page. """ Composite s = (Composite)sections.get(section); if (s==null) add(element); else s.add(element); }
java
public void addTo(String section, Object element) { Composite s = (Composite)sections.get(section); if (s==null) add(element); else s.add(element); }
[ "public", "void", "addTo", "(", "String", "section", ",", "Object", "element", ")", "{", "Composite", "s", "=", "(", "Composite", ")", "sections", ".", "get", "(", "section", ")", ";", "if", "(", "s", "==", "null", ")", "add", "(", "element", ")", ";", "else", "s", ".", "add", "(", "element", ")", ";", "}" ]
Add content to a named sections. If the named section cannot. be found, the content is added to the page.
[ "Add", "content", "to", "a", "named", "sections", ".", "If", "the", "named", "section", "cannot", ".", "be", "found", "the", "content", "is", "added", "to", "the", "page", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/html/Page.java#L349-L356
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java
ListWidget.selectItem
public boolean selectItem(int dataIndex, boolean select) { """ Select or deselect an item at position {@code pos}. @param dataIndex item position in the adapter @param select operation to perform select or deselect. @return {@code true} if the requested operation is successful, {@code false} otherwise. """ Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "selectItem [%d] select [%b]", dataIndex, select); if (dataIndex < 0 || dataIndex >= mContent.size()) { throw new IndexOutOfBoundsException("Selection index [" + dataIndex + "] is out of bounds!"); } updateSelectedItemsList(dataIndex, select); ListItemHostWidget hostWidget = getHostView(dataIndex, false); if (hostWidget != null) { hostWidget.setSelected(select); hostWidget.requestLayout(); return true; } return false; }
java
public boolean selectItem(int dataIndex, boolean select) { Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "selectItem [%d] select [%b]", dataIndex, select); if (dataIndex < 0 || dataIndex >= mContent.size()) { throw new IndexOutOfBoundsException("Selection index [" + dataIndex + "] is out of bounds!"); } updateSelectedItemsList(dataIndex, select); ListItemHostWidget hostWidget = getHostView(dataIndex, false); if (hostWidget != null) { hostWidget.setSelected(select); hostWidget.requestLayout(); return true; } return false; }
[ "public", "boolean", "selectItem", "(", "int", "dataIndex", ",", "boolean", "select", ")", "{", "Log", ".", "d", "(", "Log", ".", "SUBSYSTEM", ".", "LAYOUT", ",", "TAG", ",", "\"selectItem [%d] select [%b]\"", ",", "dataIndex", ",", "select", ")", ";", "if", "(", "dataIndex", "<", "0", "||", "dataIndex", ">=", "mContent", ".", "size", "(", ")", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "\"Selection index [\"", "+", "dataIndex", "+", "\"] is out of bounds!\"", ")", ";", "}", "updateSelectedItemsList", "(", "dataIndex", ",", "select", ")", ";", "ListItemHostWidget", "hostWidget", "=", "getHostView", "(", "dataIndex", ",", "false", ")", ";", "if", "(", "hostWidget", "!=", "null", ")", "{", "hostWidget", ".", "setSelected", "(", "select", ")", ";", "hostWidget", ".", "requestLayout", "(", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
Select or deselect an item at position {@code pos}. @param dataIndex item position in the adapter @param select operation to perform select or deselect. @return {@code true} if the requested operation is successful, {@code false} otherwise.
[ "Select", "or", "deselect", "an", "item", "at", "position", "{", "@code", "pos", "}", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java#L497-L513
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/renderkit/html/HtmlMessageRenderer.java
HtmlMessageRenderer.encodeEnd
@Override public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException { """ private static final Log log = LogFactory.getLog(HtmlMessageRenderer.class); """ super.encodeEnd(facesContext, component); // check for NP Map<String, List<ClientBehavior>> behaviors = null; if (component instanceof ClientBehaviorHolder) { behaviors = ((ClientBehaviorHolder) component).getClientBehaviors(); if (!behaviors.isEmpty()) { ResourceUtils.renderDefaultJsfJsInlineIfNecessary(facesContext, facesContext.getResponseWriter()); } } renderMessage(facesContext, component, false, true); }
java
@Override public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException { super.encodeEnd(facesContext, component); // check for NP Map<String, List<ClientBehavior>> behaviors = null; if (component instanceof ClientBehaviorHolder) { behaviors = ((ClientBehaviorHolder) component).getClientBehaviors(); if (!behaviors.isEmpty()) { ResourceUtils.renderDefaultJsfJsInlineIfNecessary(facesContext, facesContext.getResponseWriter()); } } renderMessage(facesContext, component, false, true); }
[ "@", "Override", "public", "void", "encodeEnd", "(", "FacesContext", "facesContext", ",", "UIComponent", "component", ")", "throws", "IOException", "{", "super", ".", "encodeEnd", "(", "facesContext", ",", "component", ")", ";", "// check for NP", "Map", "<", "String", ",", "List", "<", "ClientBehavior", ">", ">", "behaviors", "=", "null", ";", "if", "(", "component", "instanceof", "ClientBehaviorHolder", ")", "{", "behaviors", "=", "(", "(", "ClientBehaviorHolder", ")", "component", ")", ".", "getClientBehaviors", "(", ")", ";", "if", "(", "!", "behaviors", ".", "isEmpty", "(", ")", ")", "{", "ResourceUtils", ".", "renderDefaultJsfJsInlineIfNecessary", "(", "facesContext", ",", "facesContext", ".", "getResponseWriter", "(", ")", ")", ";", "}", "}", "renderMessage", "(", "facesContext", ",", "component", ",", "false", ",", "true", ")", ";", "}" ]
private static final Log log = LogFactory.getLog(HtmlMessageRenderer.class);
[ "private", "static", "final", "Log", "log", "=", "LogFactory", ".", "getLog", "(", "HtmlMessageRenderer", ".", "class", ")", ";" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/renderkit/html/HtmlMessageRenderer.java#L46-L62
emfjson/emfjson-jackson
src/main/java/org/emfjson/jackson/module/EMFModule.java
EMFModule.setupDefaultMapper
public static ObjectMapper setupDefaultMapper(JsonFactory factory) { """ Returns a pre configured mapper using the EMF module and the specified jackson factory. This method can be used to work with formats others than JSON (such as YAML). @param factory @return mapper """ final ObjectMapper mapper = new ObjectMapper(factory); // same as emf final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH); dateFormat.setTimeZone(TimeZone.getDefault()); mapper.configure(SerializationFeature.INDENT_OUTPUT, true); mapper.setDateFormat(dateFormat); mapper.setTimeZone(TimeZone.getDefault()); mapper.registerModule(new EMFModule()); return mapper; }
java
public static ObjectMapper setupDefaultMapper(JsonFactory factory) { final ObjectMapper mapper = new ObjectMapper(factory); // same as emf final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH); dateFormat.setTimeZone(TimeZone.getDefault()); mapper.configure(SerializationFeature.INDENT_OUTPUT, true); mapper.setDateFormat(dateFormat); mapper.setTimeZone(TimeZone.getDefault()); mapper.registerModule(new EMFModule()); return mapper; }
[ "public", "static", "ObjectMapper", "setupDefaultMapper", "(", "JsonFactory", "factory", ")", "{", "final", "ObjectMapper", "mapper", "=", "new", "ObjectMapper", "(", "factory", ")", ";", "// same as emf", "final", "SimpleDateFormat", "dateFormat", "=", "new", "SimpleDateFormat", "(", "\"yyyy-MM-dd'T'HH:mm:ss\"", ",", "Locale", ".", "ENGLISH", ")", ";", "dateFormat", ".", "setTimeZone", "(", "TimeZone", ".", "getDefault", "(", ")", ")", ";", "mapper", ".", "configure", "(", "SerializationFeature", ".", "INDENT_OUTPUT", ",", "true", ")", ";", "mapper", ".", "setDateFormat", "(", "dateFormat", ")", ";", "mapper", ".", "setTimeZone", "(", "TimeZone", ".", "getDefault", "(", ")", ")", ";", "mapper", ".", "registerModule", "(", "new", "EMFModule", "(", ")", ")", ";", "return", "mapper", ";", "}" ]
Returns a pre configured mapper using the EMF module and the specified jackson factory. This method can be used to work with formats others than JSON (such as YAML). @param factory @return mapper
[ "Returns", "a", "pre", "configured", "mapper", "using", "the", "EMF", "module", "and", "the", "specified", "jackson", "factory", ".", "This", "method", "can", "be", "used", "to", "work", "with", "formats", "others", "than", "JSON", "(", "such", "as", "YAML", ")", "." ]
train
https://github.com/emfjson/emfjson-jackson/blob/5f4488d1b07d499003351606cf76ee0c4ac39964/src/main/java/org/emfjson/jackson/module/EMFModule.java#L158-L170
Javacord/Javacord
javacord-api/src/main/java/org/javacord/api/entity/server/ServerUpdater.java
ServerUpdater.setSplash
public ServerUpdater setSplash(InputStream splash, String fileType) { """ Queues the splash to be updated. @param splash The new splash of the server. @param fileType The type of the splash, e.g. "png" or "jpg". @return The current instance in order to chain call methods. """ delegate.setSplash(splash, fileType); return this; }
java
public ServerUpdater setSplash(InputStream splash, String fileType) { delegate.setSplash(splash, fileType); return this; }
[ "public", "ServerUpdater", "setSplash", "(", "InputStream", "splash", ",", "String", "fileType", ")", "{", "delegate", ".", "setSplash", "(", "splash", ",", "fileType", ")", ";", "return", "this", ";", "}" ]
Queues the splash to be updated. @param splash The new splash of the server. @param fileType The type of the splash, e.g. "png" or "jpg". @return The current instance in order to chain call methods.
[ "Queues", "the", "splash", "to", "be", "updated", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/server/ServerUpdater.java#L365-L368
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/SeqRes2AtomAligner.java
SeqRes2AtomAligner.storeUnAlignedSeqRes
public static void storeUnAlignedSeqRes(Structure structure, List<Chain> seqResChains, boolean headerOnly) { """ Storing unaligned SEQRES groups in a Structure. @param structure @param seqResChains """ if (headerOnly) { List<Chain> atomChains = new ArrayList<>(); for (Chain seqRes: seqResChains) { // In header-only mode skip ATOM records. // Here we store chains with SEQRES instead of AtomGroups. seqRes.setSeqResGroups(seqRes.getAtomGroups()); seqRes.setAtomGroups(new ArrayList<>()); // clear out the atom groups. atomChains.add(seqRes); } structure.setChains(0, atomChains); } else { for (int i = 0; i < structure.nrModels(); i++) { List<Chain> atomChains = structure.getModel(i); for (Chain seqRes: seqResChains){ Chain atomRes; // Otherwise, we find a chain with AtomGroups // and set this as SEQRES groups. // TODO no idea if new parameter useChainId should be false or true here, used true as a guess - JD 2016-05-09 atomRes = SeqRes2AtomAligner.getMatchingAtomRes(seqRes,atomChains,true); if ( atomRes != null) atomRes.setSeqResGroups(seqRes.getAtomGroups()); else logger.warn("Could not find atom records for chain " + seqRes.getId()); } } } }
java
public static void storeUnAlignedSeqRes(Structure structure, List<Chain> seqResChains, boolean headerOnly) { if (headerOnly) { List<Chain> atomChains = new ArrayList<>(); for (Chain seqRes: seqResChains) { // In header-only mode skip ATOM records. // Here we store chains with SEQRES instead of AtomGroups. seqRes.setSeqResGroups(seqRes.getAtomGroups()); seqRes.setAtomGroups(new ArrayList<>()); // clear out the atom groups. atomChains.add(seqRes); } structure.setChains(0, atomChains); } else { for (int i = 0; i < structure.nrModels(); i++) { List<Chain> atomChains = structure.getModel(i); for (Chain seqRes: seqResChains){ Chain atomRes; // Otherwise, we find a chain with AtomGroups // and set this as SEQRES groups. // TODO no idea if new parameter useChainId should be false or true here, used true as a guess - JD 2016-05-09 atomRes = SeqRes2AtomAligner.getMatchingAtomRes(seqRes,atomChains,true); if ( atomRes != null) atomRes.setSeqResGroups(seqRes.getAtomGroups()); else logger.warn("Could not find atom records for chain " + seqRes.getId()); } } } }
[ "public", "static", "void", "storeUnAlignedSeqRes", "(", "Structure", "structure", ",", "List", "<", "Chain", ">", "seqResChains", ",", "boolean", "headerOnly", ")", "{", "if", "(", "headerOnly", ")", "{", "List", "<", "Chain", ">", "atomChains", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Chain", "seqRes", ":", "seqResChains", ")", "{", "// In header-only mode skip ATOM records.", "// Here we store chains with SEQRES instead of AtomGroups.", "seqRes", ".", "setSeqResGroups", "(", "seqRes", ".", "getAtomGroups", "(", ")", ")", ";", "seqRes", ".", "setAtomGroups", "(", "new", "ArrayList", "<>", "(", ")", ")", ";", "// clear out the atom groups.", "atomChains", ".", "add", "(", "seqRes", ")", ";", "}", "structure", ".", "setChains", "(", "0", ",", "atomChains", ")", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "structure", ".", "nrModels", "(", ")", ";", "i", "++", ")", "{", "List", "<", "Chain", ">", "atomChains", "=", "structure", ".", "getModel", "(", "i", ")", ";", "for", "(", "Chain", "seqRes", ":", "seqResChains", ")", "{", "Chain", "atomRes", ";", "// Otherwise, we find a chain with AtomGroups", "// and set this as SEQRES groups.", "// TODO no idea if new parameter useChainId should be false or true here, used true as a guess - JD 2016-05-09", "atomRes", "=", "SeqRes2AtomAligner", ".", "getMatchingAtomRes", "(", "seqRes", ",", "atomChains", ",", "true", ")", ";", "if", "(", "atomRes", "!=", "null", ")", "atomRes", ".", "setSeqResGroups", "(", "seqRes", ".", "getAtomGroups", "(", ")", ")", ";", "else", "logger", ".", "warn", "(", "\"Could not find atom records for chain \"", "+", "seqRes", ".", "getId", "(", ")", ")", ";", "}", "}", "}", "}" ]
Storing unaligned SEQRES groups in a Structure. @param structure @param seqResChains
[ "Storing", "unaligned", "SEQRES", "groups", "in", "a", "Structure", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/SeqRes2AtomAligner.java#L820-L858
fozziethebeat/S-Space
opt/src/main/java/edu/ucla/sspace/lra/LatentRelationalAnalysis.java
LatentRelationalAnalysis.indexFile
private static void indexFile(IndexWriter writer, File f) throws IOException { """ method to actually index a file using Lucene, adds a document onto the index writer """ if (f.isHidden() || !f.exists() || !f.canRead()) { System.err.println("Could not write "+f.getName()); return; } System.err.println("Indexing " + f.getCanonicalPath()); Document doc = new Document(); doc.add(new Field("path", f.getCanonicalPath(), Field.Store.YES, Field.Index.NOT_ANALYZED)); doc.add(new Field("modified",DateTools.timeToString(f.lastModified(), DateTools.Resolution.MINUTE),Field.Store.YES, Field.Index.NOT_ANALYZED)); doc.add(new Field("contents", new FileReader(f))); writer.addDocument(doc); }
java
private static void indexFile(IndexWriter writer, File f) throws IOException { if (f.isHidden() || !f.exists() || !f.canRead()) { System.err.println("Could not write "+f.getName()); return; } System.err.println("Indexing " + f.getCanonicalPath()); Document doc = new Document(); doc.add(new Field("path", f.getCanonicalPath(), Field.Store.YES, Field.Index.NOT_ANALYZED)); doc.add(new Field("modified",DateTools.timeToString(f.lastModified(), DateTools.Resolution.MINUTE),Field.Store.YES, Field.Index.NOT_ANALYZED)); doc.add(new Field("contents", new FileReader(f))); writer.addDocument(doc); }
[ "private", "static", "void", "indexFile", "(", "IndexWriter", "writer", ",", "File", "f", ")", "throws", "IOException", "{", "if", "(", "f", ".", "isHidden", "(", ")", "||", "!", "f", ".", "exists", "(", ")", "||", "!", "f", ".", "canRead", "(", ")", ")", "{", "System", ".", "err", ".", "println", "(", "\"Could not write \"", "+", "f", ".", "getName", "(", ")", ")", ";", "return", ";", "}", "System", ".", "err", ".", "println", "(", "\"Indexing \"", "+", "f", ".", "getCanonicalPath", "(", ")", ")", ";", "Document", "doc", "=", "new", "Document", "(", ")", ";", "doc", ".", "add", "(", "new", "Field", "(", "\"path\"", ",", "f", ".", "getCanonicalPath", "(", ")", ",", "Field", ".", "Store", ".", "YES", ",", "Field", ".", "Index", ".", "NOT_ANALYZED", ")", ")", ";", "doc", ".", "add", "(", "new", "Field", "(", "\"modified\"", ",", "DateTools", ".", "timeToString", "(", "f", ".", "lastModified", "(", ")", ",", "DateTools", ".", "Resolution", ".", "MINUTE", ")", ",", "Field", ".", "Store", ".", "YES", ",", "Field", ".", "Index", ".", "NOT_ANALYZED", ")", ")", ";", "doc", ".", "add", "(", "new", "Field", "(", "\"contents\"", ",", "new", "FileReader", "(", "f", ")", ")", ")", ";", "writer", ".", "addDocument", "(", "doc", ")", ";", "}" ]
method to actually index a file using Lucene, adds a document onto the index writer
[ "method", "to", "actually", "index", "a", "file", "using", "Lucene", "adds", "a", "document", "onto", "the", "index", "writer" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/opt/src/main/java/edu/ucla/sspace/lra/LatentRelationalAnalysis.java#L396-L413
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java
DocEnv.printError
public void printError(SourcePosition pos, String msg) { """ Print error message, increment error count. @param msg message to print. """ if (silent) return; messager.printError(pos, msg); }
java
public void printError(SourcePosition pos, String msg) { if (silent) return; messager.printError(pos, msg); }
[ "public", "void", "printError", "(", "SourcePosition", "pos", ",", "String", "msg", ")", "{", "if", "(", "silent", ")", "return", ";", "messager", ".", "printError", "(", "pos", ",", "msg", ")", ";", "}" ]
Print error message, increment error count. @param msg message to print.
[ "Print", "error", "message", "increment", "error", "count", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java#L347-L351
xetorthio/jedis
src/main/java/redis/clients/jedis/BinaryJedis.java
BinaryJedis.getbit
@Override public Boolean getbit(final byte[] key, final long offset) { """ Returns the bit value at offset in the string value stored at key @param key @param offset @return """ checkIsInMultiOrPipeline(); client.getbit(key, offset); return client.getIntegerReply() == 1; }
java
@Override public Boolean getbit(final byte[] key, final long offset) { checkIsInMultiOrPipeline(); client.getbit(key, offset); return client.getIntegerReply() == 1; }
[ "@", "Override", "public", "Boolean", "getbit", "(", "final", "byte", "[", "]", "key", ",", "final", "long", "offset", ")", "{", "checkIsInMultiOrPipeline", "(", ")", ";", "client", ".", "getbit", "(", "key", ",", "offset", ")", ";", "return", "client", ".", "getIntegerReply", "(", ")", "==", "1", ";", "}" ]
Returns the bit value at offset in the string value stored at key @param key @param offset @return
[ "Returns", "the", "bit", "value", "at", "offset", "in", "the", "string", "value", "stored", "at", "key" ]
train
https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L3222-L3227
leancloud/java-sdk-all
android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/push/GetPushStateApi.java
GetPushStateApi.onConnect
@Override public void onConnect(final int rst, final HuaweiApiClient client) { """ HuaweiApiClient 连接结果回调 @param rst 结果码 @param client HuaweiApiClient 实例 """ //需要在子线程中执行获取push状态的操作 ThreadUtil.INST.excute(new Runnable() { @Override public void run() { if (client == null || !ApiClientMgr.INST.isConnect(client)) { HMSAgentLog.e("client not connted"); onGetPushStateResult(rst); } else { HuaweiPush.HuaweiPushApi.getPushState(client); onGetPushStateResult(HMSAgent.AgentResultCode.HMSAGENT_SUCCESS); } } }); }
java
@Override public void onConnect(final int rst, final HuaweiApiClient client) { //需要在子线程中执行获取push状态的操作 ThreadUtil.INST.excute(new Runnable() { @Override public void run() { if (client == null || !ApiClientMgr.INST.isConnect(client)) { HMSAgentLog.e("client not connted"); onGetPushStateResult(rst); } else { HuaweiPush.HuaweiPushApi.getPushState(client); onGetPushStateResult(HMSAgent.AgentResultCode.HMSAGENT_SUCCESS); } } }); }
[ "@", "Override", "public", "void", "onConnect", "(", "final", "int", "rst", ",", "final", "HuaweiApiClient", "client", ")", "{", "//需要在子线程中执行获取push状态的操作\r", "ThreadUtil", ".", "INST", ".", "excute", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "if", "(", "client", "==", "null", "||", "!", "ApiClientMgr", ".", "INST", ".", "isConnect", "(", "client", ")", ")", "{", "HMSAgentLog", ".", "e", "(", "\"client not connted\"", ")", ";", "onGetPushStateResult", "(", "rst", ")", ";", "}", "else", "{", "HuaweiPush", ".", "HuaweiPushApi", ".", "getPushState", "(", "client", ")", ";", "onGetPushStateResult", "(", "HMSAgent", ".", "AgentResultCode", ".", "HMSAGENT_SUCCESS", ")", ";", "}", "}", "}", ")", ";", "}" ]
HuaweiApiClient 连接结果回调 @param rst 结果码 @param client HuaweiApiClient 实例
[ "HuaweiApiClient", "连接结果回调" ]
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/push/GetPushStateApi.java#L33-L48
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/SwingBindingFactory.java
SwingBindingFactory.createBinding
public Binding createBinding(String propertyPath, String binderId, Map context) { """ Create a binding based on a specific binder id. @param propertyPath Path to property @param binderId Id of the binder @param context Context data (can be empty map) @return Specific binding """ Assert.notNull(context, "Context must not be null"); Binder binder = ((SwingBinderSelectionStrategy)getBinderSelectionStrategy()).getIdBoundBinder(binderId); Binding binding = binder.bind(getFormModel(), propertyPath, context); interceptBinding(binding); return binding; }
java
public Binding createBinding(String propertyPath, String binderId, Map context) { Assert.notNull(context, "Context must not be null"); Binder binder = ((SwingBinderSelectionStrategy)getBinderSelectionStrategy()).getIdBoundBinder(binderId); Binding binding = binder.bind(getFormModel(), propertyPath, context); interceptBinding(binding); return binding; }
[ "public", "Binding", "createBinding", "(", "String", "propertyPath", ",", "String", "binderId", ",", "Map", "context", ")", "{", "Assert", ".", "notNull", "(", "context", ",", "\"Context must not be null\"", ")", ";", "Binder", "binder", "=", "(", "(", "SwingBinderSelectionStrategy", ")", "getBinderSelectionStrategy", "(", ")", ")", ".", "getIdBoundBinder", "(", "binderId", ")", ";", "Binding", "binding", "=", "binder", ".", "bind", "(", "getFormModel", "(", ")", ",", "propertyPath", ",", "context", ")", ";", "interceptBinding", "(", "binding", ")", ";", "return", "binding", ";", "}" ]
Create a binding based on a specific binder id. @param propertyPath Path to property @param binderId Id of the binder @param context Context data (can be empty map) @return Specific binding
[ "Create", "a", "binding", "based", "on", "a", "specific", "binder", "id", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/SwingBindingFactory.java#L434-L441
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AbstractAuditEventMessageImpl.java
AbstractAuditEventMessageImpl.getTypeValuePair
protected TypeValuePairType getTypeValuePair(String type, byte[] value) { """ Create and set a Type Value Pair instance for a given type and value @param type The type to set @param value The value to set @return The Type Value Pair instance """ TypeValuePairType tvp = new TypeValuePairType(); tvp.setType(type); //tvp.setValue(Base64.encodeBase64Chunked(value)); // the TVP itself base64 encodes now, no need for this tvp.setValue(value); return tvp; }
java
protected TypeValuePairType getTypeValuePair(String type, byte[] value) { TypeValuePairType tvp = new TypeValuePairType(); tvp.setType(type); //tvp.setValue(Base64.encodeBase64Chunked(value)); // the TVP itself base64 encodes now, no need for this tvp.setValue(value); return tvp; }
[ "protected", "TypeValuePairType", "getTypeValuePair", "(", "String", "type", ",", "byte", "[", "]", "value", ")", "{", "TypeValuePairType", "tvp", "=", "new", "TypeValuePairType", "(", ")", ";", "tvp", ".", "setType", "(", "type", ")", ";", "//tvp.setValue(Base64.encodeBase64Chunked(value));", "// the TVP itself base64 encodes now, no need for this", "tvp", ".", "setValue", "(", "value", ")", ";", "return", "tvp", ";", "}" ]
Create and set a Type Value Pair instance for a given type and value @param type The type to set @param value The value to set @return The Type Value Pair instance
[ "Create", "and", "set", "a", "Type", "Value", "Pair", "instance", "for", "a", "given", "type", "and", "value" ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AbstractAuditEventMessageImpl.java#L423-L430
baasbox/Android-SDK
library/src/main/java/com/baasbox/android/BaasDocument.java
BaasDocument.getString
public String getString(String name, String otherwise) { """ Returns the value mapped to <code>name</code> as a {@link java.lang.String} or <code>otherwise</code> if the mapping is absent. @param name a non <code>null</code> key @param otherwise a default value @return the value mapped to <code>name</code> or <code>otherwise</code> """ return data.getString(name, otherwise); }
java
public String getString(String name, String otherwise) { return data.getString(name, otherwise); }
[ "public", "String", "getString", "(", "String", "name", ",", "String", "otherwise", ")", "{", "return", "data", ".", "getString", "(", "name", ",", "otherwise", ")", ";", "}" ]
Returns the value mapped to <code>name</code> as a {@link java.lang.String} or <code>otherwise</code> if the mapping is absent. @param name a non <code>null</code> key @param otherwise a default value @return the value mapped to <code>name</code> or <code>otherwise</code>
[ "Returns", "the", "value", "mapped", "to", "<code", ">", "name<", "/", "code", ">", "as", "a", "{", "@link", "java", ".", "lang", ".", "String", "}", "or", "<code", ">", "otherwise<", "/", "code", ">", "if", "the", "mapping", "is", "absent", "." ]
train
https://github.com/baasbox/Android-SDK/blob/6bb2203246b885b2ad63a7bfaf37c83caf15e0d8/library/src/main/java/com/baasbox/android/BaasDocument.java#L971-L973
finmath/finmath-lib
src/main/java6/net/finmath/functions/AnalyticFormulas.java
AnalyticFormulas.sabrNormalVolatilityCurvatureApproximation
public static double sabrNormalVolatilityCurvatureApproximation(double alpha, double beta, double rho, double nu, double displacement, double underlying, double maturity) { """ Return the curvature of the implied normal volatility (Bachelier volatility) under a SABR model using the approximation of Berestycki. The curvatures is the second derivative of the implied vol w.r.t. the strike, evaluated at the money. @param alpha initial value of the stochastic volatility process of the SABR model. @param beta CEV parameter of the SABR model. @param rho Correlation (leverages) of the stochastic volatility. @param nu Volatility of the stochastic volatility (vol-of-vol). @param displacement The displacement parameter d. @param underlying Underlying (spot) value. @param maturity Maturity. @return The curvature of the implied normal volatility (Bachelier volatility) """ double sigma = sabrBerestyckiNormalVolatilityApproximation(alpha, beta, rho, nu, displacement, underlying, underlying, maturity); // Apply displacement. Displaced model is just a shift on underlying and strike. underlying += displacement; /* double d1xdz1 = 1.0; double d2xdz2 = rho; double d3xdz3 = 3.0*rho*rho-1.0; double d1zdK1 = -nu/alpha * Math.pow(underlying, -beta); double d2zdK2 = + nu/alpha * beta * Math.pow(underlying, -beta-1.0); double d3zdK3 = - nu/alpha * beta * (1.0+beta) * Math.pow(underlying, -beta-2.0); double d1xdK1 = d1xdz1*d1zdK1; double d2xdK2 = d2xdz2*d1zdK1*d1zdK1 + d1xdz1*d2zdK2; double d3xdK3 = d3xdz3*d1zdK1*d1zdK1*d1zdK1 + 3.0*d2xdz2*d2zdK2*d1zdK1 + d1xdz1*d3zdK3; double term1 = alpha * Math.pow(underlying, beta) / nu; */ double d2Part1dK2 = nu * ((1.0/3.0 - 1.0/2.0 * rho * rho) * nu/alpha * Math.pow(underlying, -beta) + (1.0/6.0 * beta*beta - 2.0/6.0 * beta) * alpha/nu*Math.pow(underlying, beta-2)); double d0BdK0 = (-1.0/24.0 *beta*(2-beta)*alpha*alpha*Math.pow(underlying, 2*beta-2) + 1.0/4.0 * beta*alpha*rho*nu*Math.pow(underlying, beta-1.0) + (2.0 -3.0*rho*rho)*nu*nu/24); double d1BdK1 = (-1.0/48.0 *beta*(2-beta)*(2*beta-2)*alpha*alpha*Math.pow(underlying, 2*beta-3) + 1.0/8.0 * beta*(beta-1.0)*alpha*rho*nu*Math.pow(underlying, beta-2)); double d2BdK2 = (-1.0/96.0 *beta*(2-beta)*(2*beta-2)*(2*beta-3)*alpha*alpha*Math.pow(underlying, 2*beta-4) + 1.0/16.0 * beta*(beta-1)*(beta-2)*alpha*rho*nu*Math.pow(underlying, beta-3)); double curvatureApproximation = nu/alpha * ((1.0/3.0 - 1.0/2.0 * rho * rho) * sigma*nu/alpha * Math.pow(underlying, -2*beta)); double curvaturePart1 = nu/alpha * ((1.0/3.0 - 1.0/2.0 * rho * rho) * sigma*nu/alpha * Math.pow(underlying, -2*beta) + (1.0/6.0 * beta*beta - 2.0/6.0 * beta) * sigma*alpha/nu*Math.pow(underlying, -2)); double curvatureMaturityPart = (rho*nu + alpha*beta*Math.pow(underlying, beta-1))*d1BdK1 + alpha*Math.pow(underlying, beta)*d2BdK2; return (curvaturePart1 + maturity * curvatureMaturityPart); }
java
public static double sabrNormalVolatilityCurvatureApproximation(double alpha, double beta, double rho, double nu, double displacement, double underlying, double maturity) { double sigma = sabrBerestyckiNormalVolatilityApproximation(alpha, beta, rho, nu, displacement, underlying, underlying, maturity); // Apply displacement. Displaced model is just a shift on underlying and strike. underlying += displacement; /* double d1xdz1 = 1.0; double d2xdz2 = rho; double d3xdz3 = 3.0*rho*rho-1.0; double d1zdK1 = -nu/alpha * Math.pow(underlying, -beta); double d2zdK2 = + nu/alpha * beta * Math.pow(underlying, -beta-1.0); double d3zdK3 = - nu/alpha * beta * (1.0+beta) * Math.pow(underlying, -beta-2.0); double d1xdK1 = d1xdz1*d1zdK1; double d2xdK2 = d2xdz2*d1zdK1*d1zdK1 + d1xdz1*d2zdK2; double d3xdK3 = d3xdz3*d1zdK1*d1zdK1*d1zdK1 + 3.0*d2xdz2*d2zdK2*d1zdK1 + d1xdz1*d3zdK3; double term1 = alpha * Math.pow(underlying, beta) / nu; */ double d2Part1dK2 = nu * ((1.0/3.0 - 1.0/2.0 * rho * rho) * nu/alpha * Math.pow(underlying, -beta) + (1.0/6.0 * beta*beta - 2.0/6.0 * beta) * alpha/nu*Math.pow(underlying, beta-2)); double d0BdK0 = (-1.0/24.0 *beta*(2-beta)*alpha*alpha*Math.pow(underlying, 2*beta-2) + 1.0/4.0 * beta*alpha*rho*nu*Math.pow(underlying, beta-1.0) + (2.0 -3.0*rho*rho)*nu*nu/24); double d1BdK1 = (-1.0/48.0 *beta*(2-beta)*(2*beta-2)*alpha*alpha*Math.pow(underlying, 2*beta-3) + 1.0/8.0 * beta*(beta-1.0)*alpha*rho*nu*Math.pow(underlying, beta-2)); double d2BdK2 = (-1.0/96.0 *beta*(2-beta)*(2*beta-2)*(2*beta-3)*alpha*alpha*Math.pow(underlying, 2*beta-4) + 1.0/16.0 * beta*(beta-1)*(beta-2)*alpha*rho*nu*Math.pow(underlying, beta-3)); double curvatureApproximation = nu/alpha * ((1.0/3.0 - 1.0/2.0 * rho * rho) * sigma*nu/alpha * Math.pow(underlying, -2*beta)); double curvaturePart1 = nu/alpha * ((1.0/3.0 - 1.0/2.0 * rho * rho) * sigma*nu/alpha * Math.pow(underlying, -2*beta) + (1.0/6.0 * beta*beta - 2.0/6.0 * beta) * sigma*alpha/nu*Math.pow(underlying, -2)); double curvatureMaturityPart = (rho*nu + alpha*beta*Math.pow(underlying, beta-1))*d1BdK1 + alpha*Math.pow(underlying, beta)*d2BdK2; return (curvaturePart1 + maturity * curvatureMaturityPart); }
[ "public", "static", "double", "sabrNormalVolatilityCurvatureApproximation", "(", "double", "alpha", ",", "double", "beta", ",", "double", "rho", ",", "double", "nu", ",", "double", "displacement", ",", "double", "underlying", ",", "double", "maturity", ")", "{", "double", "sigma", "=", "sabrBerestyckiNormalVolatilityApproximation", "(", "alpha", ",", "beta", ",", "rho", ",", "nu", ",", "displacement", ",", "underlying", ",", "underlying", ",", "maturity", ")", ";", "// Apply displacement. Displaced model is just a shift on underlying and strike.", "underlying", "+=", "displacement", ";", "/*\n\t\tdouble d1xdz1 = 1.0;\n\t\tdouble d2xdz2 = rho;\n\t\tdouble d3xdz3 = 3.0*rho*rho-1.0;\n\n\t\tdouble d1zdK1 = -nu/alpha * Math.pow(underlying, -beta);\n\t\tdouble d2zdK2 = + nu/alpha * beta * Math.pow(underlying, -beta-1.0);\n\t\tdouble d3zdK3 = - nu/alpha * beta * (1.0+beta) * Math.pow(underlying, -beta-2.0);\n\n\t\tdouble d1xdK1 = d1xdz1*d1zdK1;\n\t\tdouble d2xdK2 = d2xdz2*d1zdK1*d1zdK1 + d1xdz1*d2zdK2;\n\t\tdouble d3xdK3 = d3xdz3*d1zdK1*d1zdK1*d1zdK1 + 3.0*d2xdz2*d2zdK2*d1zdK1 + d1xdz1*d3zdK3;\n\n\t\tdouble term1 = alpha * Math.pow(underlying, beta) / nu;\n\t\t */", "double", "d2Part1dK2", "=", "nu", "*", "(", "(", "1.0", "/", "3.0", "-", "1.0", "/", "2.0", "*", "rho", "*", "rho", ")", "*", "nu", "/", "alpha", "*", "Math", ".", "pow", "(", "underlying", ",", "-", "beta", ")", "+", "(", "1.0", "/", "6.0", "*", "beta", "*", "beta", "-", "2.0", "/", "6.0", "*", "beta", ")", "*", "alpha", "/", "nu", "*", "Math", ".", "pow", "(", "underlying", ",", "beta", "-", "2", ")", ")", ";", "double", "d0BdK0", "=", "(", "-", "1.0", "/", "24.0", "*", "beta", "*", "(", "2", "-", "beta", ")", "*", "alpha", "*", "alpha", "*", "Math", ".", "pow", "(", "underlying", ",", "2", "*", "beta", "-", "2", ")", "+", "1.0", "/", "4.0", "*", "beta", "*", "alpha", "*", "rho", "*", "nu", "*", "Math", ".", "pow", "(", "underlying", ",", "beta", "-", "1.0", ")", "+", "(", "2.0", "-", "3.0", "*", "rho", "*", "rho", ")", "*", "nu", "*", "nu", "/", "24", ")", ";", "double", "d1BdK1", "=", "(", "-", "1.0", "/", "48.0", "*", "beta", "*", "(", "2", "-", "beta", ")", "*", "(", "2", "*", "beta", "-", "2", ")", "*", "alpha", "*", "alpha", "*", "Math", ".", "pow", "(", "underlying", ",", "2", "*", "beta", "-", "3", ")", "+", "1.0", "/", "8.0", "*", "beta", "*", "(", "beta", "-", "1.0", ")", "*", "alpha", "*", "rho", "*", "nu", "*", "Math", ".", "pow", "(", "underlying", ",", "beta", "-", "2", ")", ")", ";", "double", "d2BdK2", "=", "(", "-", "1.0", "/", "96.0", "*", "beta", "*", "(", "2", "-", "beta", ")", "*", "(", "2", "*", "beta", "-", "2", ")", "*", "(", "2", "*", "beta", "-", "3", ")", "*", "alpha", "*", "alpha", "*", "Math", ".", "pow", "(", "underlying", ",", "2", "*", "beta", "-", "4", ")", "+", "1.0", "/", "16.0", "*", "beta", "*", "(", "beta", "-", "1", ")", "*", "(", "beta", "-", "2", ")", "*", "alpha", "*", "rho", "*", "nu", "*", "Math", ".", "pow", "(", "underlying", ",", "beta", "-", "3", ")", ")", ";", "double", "curvatureApproximation", "=", "nu", "/", "alpha", "*", "(", "(", "1.0", "/", "3.0", "-", "1.0", "/", "2.0", "*", "rho", "*", "rho", ")", "*", "sigma", "*", "nu", "/", "alpha", "*", "Math", ".", "pow", "(", "underlying", ",", "-", "2", "*", "beta", ")", ")", ";", "double", "curvaturePart1", "=", "nu", "/", "alpha", "*", "(", "(", "1.0", "/", "3.0", "-", "1.0", "/", "2.0", "*", "rho", "*", "rho", ")", "*", "sigma", "*", "nu", "/", "alpha", "*", "Math", ".", "pow", "(", "underlying", ",", "-", "2", "*", "beta", ")", "+", "(", "1.0", "/", "6.0", "*", "beta", "*", "beta", "-", "2.0", "/", "6.0", "*", "beta", ")", "*", "sigma", "*", "alpha", "/", "nu", "*", "Math", ".", "pow", "(", "underlying", ",", "-", "2", ")", ")", ";", "double", "curvatureMaturityPart", "=", "(", "rho", "*", "nu", "+", "alpha", "*", "beta", "*", "Math", ".", "pow", "(", "underlying", ",", "beta", "-", "1", ")", ")", "*", "d1BdK1", "+", "alpha", "*", "Math", ".", "pow", "(", "underlying", ",", "beta", ")", "*", "d2BdK2", ";", "return", "(", "curvaturePart1", "+", "maturity", "*", "curvatureMaturityPart", ")", ";", "}" ]
Return the curvature of the implied normal volatility (Bachelier volatility) under a SABR model using the approximation of Berestycki. The curvatures is the second derivative of the implied vol w.r.t. the strike, evaluated at the money. @param alpha initial value of the stochastic volatility process of the SABR model. @param beta CEV parameter of the SABR model. @param rho Correlation (leverages) of the stochastic volatility. @param nu Volatility of the stochastic volatility (vol-of-vol). @param displacement The displacement parameter d. @param underlying Underlying (spot) value. @param maturity Maturity. @return The curvature of the implied normal volatility (Bachelier volatility)
[ "Return", "the", "curvature", "of", "the", "implied", "normal", "volatility", "(", "Bachelier", "volatility", ")", "under", "a", "SABR", "model", "using", "the", "approximation", "of", "Berestycki", ".", "The", "curvatures", "is", "the", "second", "derivative", "of", "the", "implied", "vol", "w", ".", "r", ".", "t", ".", "the", "strike", "evaluated", "at", "the", "money", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/functions/AnalyticFormulas.java#L1256-L1289
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/File.java
File.toURL
@Deprecated public URL toURL() throws java.net.MalformedURLException { """ Returns a Uniform Resource Locator for this file. The URL is system dependent and may not be transferable between different operating / file systems. @return a URL for this file. @throws java.net.MalformedURLException if the path cannot be transformed into a URL. @deprecated Use {@link #toURI} and {@link java.net.URI#toURL} to correctly escape illegal characters. """ String name = getAbsoluteName(); if (!name.startsWith("/")) { // start with sep. return new URL("file", "", -1, "/" + name, null); } else if (name.startsWith("//")) { return new URL("file:" + name); // UNC path } return new URL("file", "", -1, name, null); }
java
@Deprecated public URL toURL() throws java.net.MalformedURLException { String name = getAbsoluteName(); if (!name.startsWith("/")) { // start with sep. return new URL("file", "", -1, "/" + name, null); } else if (name.startsWith("//")) { return new URL("file:" + name); // UNC path } return new URL("file", "", -1, name, null); }
[ "@", "Deprecated", "public", "URL", "toURL", "(", ")", "throws", "java", ".", "net", ".", "MalformedURLException", "{", "String", "name", "=", "getAbsoluteName", "(", ")", ";", "if", "(", "!", "name", ".", "startsWith", "(", "\"/\"", ")", ")", "{", "// start with sep.", "return", "new", "URL", "(", "\"file\"", ",", "\"\"", ",", "-", "1", ",", "\"/\"", "+", "name", ",", "null", ")", ";", "}", "else", "if", "(", "name", ".", "startsWith", "(", "\"//\"", ")", ")", "{", "return", "new", "URL", "(", "\"file:\"", "+", "name", ")", ";", "// UNC path", "}", "return", "new", "URL", "(", "\"file\"", ",", "\"\"", ",", "-", "1", ",", "name", ",", "null", ")", ";", "}" ]
Returns a Uniform Resource Locator for this file. The URL is system dependent and may not be transferable between different operating / file systems. @return a URL for this file. @throws java.net.MalformedURLException if the path cannot be transformed into a URL. @deprecated Use {@link #toURI} and {@link java.net.URI#toURL} to correctly escape illegal characters.
[ "Returns", "a", "Uniform", "Resource", "Locator", "for", "this", "file", ".", "The", "URL", "is", "system", "dependent", "and", "may", "not", "be", "transferable", "between", "different", "operating", "/", "file", "systems", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/File.java#L1182-L1192
alkacon/opencms-core
src/org/opencms/xml/A_CmsXmlDocument.java
A_CmsXmlDocument.removeBookmark
protected I_CmsXmlContentValue removeBookmark(String path, Locale locale) { """ Removes the bookmark for an element with the given name and locale.<p> @param path the lookup path to use for the bookmark @param locale the locale of the element @return the element removed from the bookmarks or null """ // remove mapping of element name to locale Set<Locale> sl; sl = m_elementLocales.get(path); if (sl != null) { sl.remove(locale); } // remove mapping of locale to element name Set<String> sn = m_elementNames.get(locale); if (sn != null) { sn.remove(path); } // remove the bookmark and return the removed element return m_bookmarks.remove(getBookmarkName(path, locale)); }
java
protected I_CmsXmlContentValue removeBookmark(String path, Locale locale) { // remove mapping of element name to locale Set<Locale> sl; sl = m_elementLocales.get(path); if (sl != null) { sl.remove(locale); } // remove mapping of locale to element name Set<String> sn = m_elementNames.get(locale); if (sn != null) { sn.remove(path); } // remove the bookmark and return the removed element return m_bookmarks.remove(getBookmarkName(path, locale)); }
[ "protected", "I_CmsXmlContentValue", "removeBookmark", "(", "String", "path", ",", "Locale", "locale", ")", "{", "// remove mapping of element name to locale", "Set", "<", "Locale", ">", "sl", ";", "sl", "=", "m_elementLocales", ".", "get", "(", "path", ")", ";", "if", "(", "sl", "!=", "null", ")", "{", "sl", ".", "remove", "(", "locale", ")", ";", "}", "// remove mapping of locale to element name", "Set", "<", "String", ">", "sn", "=", "m_elementNames", ".", "get", "(", "locale", ")", ";", "if", "(", "sn", "!=", "null", ")", "{", "sn", ".", "remove", "(", "path", ")", ";", "}", "// remove the bookmark and return the removed element", "return", "m_bookmarks", ".", "remove", "(", "getBookmarkName", "(", "path", ",", "locale", ")", ")", ";", "}" ]
Removes the bookmark for an element with the given name and locale.<p> @param path the lookup path to use for the bookmark @param locale the locale of the element @return the element removed from the bookmarks or null
[ "Removes", "the", "bookmark", "for", "an", "element", "with", "the", "given", "name", "and", "locale", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/A_CmsXmlDocument.java#L877-L892
sdaschner/jaxrs-analyzer
src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/rest/TypeRepresentation.java
TypeRepresentation.ofEnum
public static TypeRepresentation ofEnum(final TypeIdentifier identifier, final String... enumValues) { """ Creates a type representation of an enum type plus the available enumeration values. @param identifier The type identifier @param enumValues The enum values @return The type representation """ return new EnumTypeRepresentation(identifier, new HashSet<>(Arrays.asList(enumValues))); }
java
public static TypeRepresentation ofEnum(final TypeIdentifier identifier, final String... enumValues) { return new EnumTypeRepresentation(identifier, new HashSet<>(Arrays.asList(enumValues))); }
[ "public", "static", "TypeRepresentation", "ofEnum", "(", "final", "TypeIdentifier", "identifier", ",", "final", "String", "...", "enumValues", ")", "{", "return", "new", "EnumTypeRepresentation", "(", "identifier", ",", "new", "HashSet", "<>", "(", "Arrays", ".", "asList", "(", "enumValues", ")", ")", ")", ";", "}" ]
Creates a type representation of an enum type plus the available enumeration values. @param identifier The type identifier @param enumValues The enum values @return The type representation
[ "Creates", "a", "type", "representation", "of", "an", "enum", "type", "plus", "the", "available", "enumeration", "values", "." ]
train
https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/rest/TypeRepresentation.java#L106-L108