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
jaxio/celerio
celerio-engine/src/main/java/com/jaxio/celerio/util/IOUtil.java
IOUtil.inputStreamToOutputStream
public int inputStreamToOutputStream(InputStream is, OutputStream os) throws IOException { """ Write to the outputstream the bytes read from the input stream. """ byte buffer[] = new byte[1024 * 100]; // 100kb int len = -1; int total = 0; while ((len = is.read(buffer)) >= 0) { os.write(buffer, 0, len); total += len; } return total; }
java
public int inputStreamToOutputStream(InputStream is, OutputStream os) throws IOException { byte buffer[] = new byte[1024 * 100]; // 100kb int len = -1; int total = 0; while ((len = is.read(buffer)) >= 0) { os.write(buffer, 0, len); total += len; } return total; }
[ "public", "int", "inputStreamToOutputStream", "(", "InputStream", "is", ",", "OutputStream", "os", ")", "throws", "IOException", "{", "byte", "buffer", "[", "]", "=", "new", "byte", "[", "1024", "*", "100", "]", ";", "// 100kb", "int", "len", "=", "-", "1", ";", "int", "total", "=", "0", ";", "while", "(", "(", "len", "=", "is", ".", "read", "(", "buffer", ")", ")", ">=", "0", ")", "{", "os", ".", "write", "(", "buffer", ",", "0", ",", "len", ")", ";", "total", "+=", "len", ";", "}", "return", "total", ";", "}" ]
Write to the outputstream the bytes read from the input stream.
[ "Write", "to", "the", "outputstream", "the", "bytes", "read", "from", "the", "input", "stream", "." ]
train
https://github.com/jaxio/celerio/blob/fbfacb639e286f9f3f3a18986f74ea275bebd887/celerio-engine/src/main/java/com/jaxio/celerio/util/IOUtil.java#L45-L55
kongchen/swagger-maven-plugin
src/main/java/com/github/kongchen/swagger/docgen/AbstractDocumentSource.java
AbstractDocumentSource.resolveSwaggerExtensions
protected List<SwaggerExtension> resolveSwaggerExtensions() throws GenerateException { """ Resolves all {@link SwaggerExtension} instances configured to be added to the Swagger configuration. @return List of {@link SwaggerExtension} which should be added to the swagger configuration @throws GenerateException if the swagger extensions could not be created / resolved """ List<String> clazzes = apiSource.getSwaggerExtensions(); List<SwaggerExtension> resolved = new ArrayList<SwaggerExtension>(); if (clazzes != null) { for (String clazz : clazzes) { SwaggerExtension extension = null; //Try to get a parameterized constructor for extensions that are log-enabled. try { try { Constructor<?> constructor = Class.forName(clazz).getConstructor(Log.class); extension = (SwaggerExtension) constructor.newInstance(LOG); } catch (NoSuchMethodException nsme) { extension = (SwaggerExtension) Class.forName(clazz).newInstance(); } } catch (Exception e) { throw new GenerateException("Cannot load Swagger extension: " + clazz, e); } resolved.add(extension); } } return resolved; }
java
protected List<SwaggerExtension> resolveSwaggerExtensions() throws GenerateException { List<String> clazzes = apiSource.getSwaggerExtensions(); List<SwaggerExtension> resolved = new ArrayList<SwaggerExtension>(); if (clazzes != null) { for (String clazz : clazzes) { SwaggerExtension extension = null; //Try to get a parameterized constructor for extensions that are log-enabled. try { try { Constructor<?> constructor = Class.forName(clazz).getConstructor(Log.class); extension = (SwaggerExtension) constructor.newInstance(LOG); } catch (NoSuchMethodException nsme) { extension = (SwaggerExtension) Class.forName(clazz).newInstance(); } } catch (Exception e) { throw new GenerateException("Cannot load Swagger extension: " + clazz, e); } resolved.add(extension); } } return resolved; }
[ "protected", "List", "<", "SwaggerExtension", ">", "resolveSwaggerExtensions", "(", ")", "throws", "GenerateException", "{", "List", "<", "String", ">", "clazzes", "=", "apiSource", ".", "getSwaggerExtensions", "(", ")", ";", "List", "<", "SwaggerExtension", ">", "resolved", "=", "new", "ArrayList", "<", "SwaggerExtension", ">", "(", ")", ";", "if", "(", "clazzes", "!=", "null", ")", "{", "for", "(", "String", "clazz", ":", "clazzes", ")", "{", "SwaggerExtension", "extension", "=", "null", ";", "//Try to get a parameterized constructor for extensions that are log-enabled.", "try", "{", "try", "{", "Constructor", "<", "?", ">", "constructor", "=", "Class", ".", "forName", "(", "clazz", ")", ".", "getConstructor", "(", "Log", ".", "class", ")", ";", "extension", "=", "(", "SwaggerExtension", ")", "constructor", ".", "newInstance", "(", "LOG", ")", ";", "}", "catch", "(", "NoSuchMethodException", "nsme", ")", "{", "extension", "=", "(", "SwaggerExtension", ")", "Class", ".", "forName", "(", "clazz", ")", ".", "newInstance", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "GenerateException", "(", "\"Cannot load Swagger extension: \"", "+", "clazz", ",", "e", ")", ";", "}", "resolved", ".", "add", "(", "extension", ")", ";", "}", "}", "return", "resolved", ";", "}" ]
Resolves all {@link SwaggerExtension} instances configured to be added to the Swagger configuration. @return List of {@link SwaggerExtension} which should be added to the swagger configuration @throws GenerateException if the swagger extensions could not be created / resolved
[ "Resolves", "all", "{", "@link", "SwaggerExtension", "}", "instances", "configured", "to", "be", "added", "to", "the", "Swagger", "configuration", "." ]
train
https://github.com/kongchen/swagger-maven-plugin/blob/0709b035ef45e1cb13189cd7f949c52c10557747/src/main/java/com/github/kongchen/swagger/docgen/AbstractDocumentSource.java#L429-L451
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java
TileBoundingBoxUtils.getYAsOppositeTileFormat
public static int getYAsOppositeTileFormat(int zoom, int y) { """ Get the standard y tile location as TMS or a TMS y location as standard @param zoom zoom level @param y y coordinate @return opposite tile format y """ int tilesPerSide = tilesPerSide(zoom); int oppositeY = tilesPerSide - y - 1; return oppositeY; }
java
public static int getYAsOppositeTileFormat(int zoom, int y) { int tilesPerSide = tilesPerSide(zoom); int oppositeY = tilesPerSide - y - 1; return oppositeY; }
[ "public", "static", "int", "getYAsOppositeTileFormat", "(", "int", "zoom", ",", "int", "y", ")", "{", "int", "tilesPerSide", "=", "tilesPerSide", "(", "zoom", ")", ";", "int", "oppositeY", "=", "tilesPerSide", "-", "y", "-", "1", ";", "return", "oppositeY", ";", "}" ]
Get the standard y tile location as TMS or a TMS y location as standard @param zoom zoom level @param y y coordinate @return opposite tile format y
[ "Get", "the", "standard", "y", "tile", "location", "as", "TMS", "or", "a", "TMS", "y", "location", "as", "standard" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java#L768-L772
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/io/ArchiveHelper.java
ArchiveHelper.extractArchive
public static boolean extractArchive(File tarFile, File extractTo) { """ Extracts a .tar or .tar.gz archive to a given folder @param tarFile File The archive file @param extractTo File The folder to extract the contents of this archive to @return boolean True if the archive was successfully extracted, otherwise false """ try { TarArchive ta = getArchive(tarFile); try { if (!extractTo.exists()) if (!extractTo.mkdir()) throw new RuntimeException("Could not create extract dir: " + extractTo); ta.extractContents(extractTo); } finally { ta.closeArchive(); } return true; } catch (FileNotFoundException e) { log.error("File not found exception: " + e.getMessage(), e); return false; } catch (Exception e) { log.error("Exception while extracting archive: " + e.getMessage(), e); return false; } }
java
public static boolean extractArchive(File tarFile, File extractTo) { try { TarArchive ta = getArchive(tarFile); try { if (!extractTo.exists()) if (!extractTo.mkdir()) throw new RuntimeException("Could not create extract dir: " + extractTo); ta.extractContents(extractTo); } finally { ta.closeArchive(); } return true; } catch (FileNotFoundException e) { log.error("File not found exception: " + e.getMessage(), e); return false; } catch (Exception e) { log.error("Exception while extracting archive: " + e.getMessage(), e); return false; } }
[ "public", "static", "boolean", "extractArchive", "(", "File", "tarFile", ",", "File", "extractTo", ")", "{", "try", "{", "TarArchive", "ta", "=", "getArchive", "(", "tarFile", ")", ";", "try", "{", "if", "(", "!", "extractTo", ".", "exists", "(", ")", ")", "if", "(", "!", "extractTo", ".", "mkdir", "(", ")", ")", "throw", "new", "RuntimeException", "(", "\"Could not create extract dir: \"", "+", "extractTo", ")", ";", "ta", ".", "extractContents", "(", "extractTo", ")", ";", "}", "finally", "{", "ta", ".", "closeArchive", "(", ")", ";", "}", "return", "true", ";", "}", "catch", "(", "FileNotFoundException", "e", ")", "{", "log", ".", "error", "(", "\"File not found exception: \"", "+", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "return", "false", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "error", "(", "\"Exception while extracting archive: \"", "+", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "return", "false", ";", "}", "}" ]
Extracts a .tar or .tar.gz archive to a given folder @param tarFile File The archive file @param extractTo File The folder to extract the contents of this archive to @return boolean True if the archive was successfully extracted, otherwise false
[ "Extracts", "a", ".", "tar", "or", ".", "tar", ".", "gz", "archive", "to", "a", "given", "folder" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/io/ArchiveHelper.java#L78-L107
oboehm/jfachwert
src/main/java/de/jfachwert/bank/Geldbetrag.java
Geldbetrag.ofMinor
public static Geldbetrag ofMinor(CurrencyUnit currency, long amountMinor, int fractionDigits) { """ Legt einen Geldbetrag unter Angabe der Unter-Einheit an. So liefert {@code ofMinor(EUR, 12345)} die Instanz fuer '123,45 EUR' zurueck. <p> Die Methode wurde aus Kompatibitaetsgrunden zur Money-Klasse hinzugefuegt. </p> @param currency Waehrung @param amountMinor Betrag der Unter-Einzeit (z.B. 12345 Cents) @param fractionDigits Anzahl der Nachkommastellen @return Geldbetrag @since 1.0.1 """ return of(BigDecimal.valueOf(amountMinor, fractionDigits), currency); }
java
public static Geldbetrag ofMinor(CurrencyUnit currency, long amountMinor, int fractionDigits) { return of(BigDecimal.valueOf(amountMinor, fractionDigits), currency); }
[ "public", "static", "Geldbetrag", "ofMinor", "(", "CurrencyUnit", "currency", ",", "long", "amountMinor", ",", "int", "fractionDigits", ")", "{", "return", "of", "(", "BigDecimal", ".", "valueOf", "(", "amountMinor", ",", "fractionDigits", ")", ",", "currency", ")", ";", "}" ]
Legt einen Geldbetrag unter Angabe der Unter-Einheit an. So liefert {@code ofMinor(EUR, 12345)} die Instanz fuer '123,45 EUR' zurueck. <p> Die Methode wurde aus Kompatibitaetsgrunden zur Money-Klasse hinzugefuegt. </p> @param currency Waehrung @param amountMinor Betrag der Unter-Einzeit (z.B. 12345 Cents) @param fractionDigits Anzahl der Nachkommastellen @return Geldbetrag @since 1.0.1
[ "Legt", "einen", "Geldbetrag", "unter", "Angabe", "der", "Unter", "-", "Einheit", "an", ".", "So", "liefert", "{", "@code", "ofMinor", "(", "EUR", "12345", ")", "}", "die", "Instanz", "fuer", "123", "45", "EUR", "zurueck", ".", "<p", ">", "Die", "Methode", "wurde", "aus", "Kompatibitaetsgrunden", "zur", "Money", "-", "Klasse", "hinzugefuegt", ".", "<", "/", "p", ">" ]
train
https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/Geldbetrag.java#L208-L210
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/multilayer/SparkDl4jMultiLayer.java
SparkDl4jMultiLayer.scoreExamples
public JavaDoubleRDD scoreExamples(RDD<DataSet> data, boolean includeRegularizationTerms, int batchSize) { """ {@code RDD<DataSet>} overload of {@link #scoreExamples(JavaRDD, boolean, int)} """ return scoreExamples(data.toJavaRDD(), includeRegularizationTerms, batchSize); }
java
public JavaDoubleRDD scoreExamples(RDD<DataSet> data, boolean includeRegularizationTerms, int batchSize) { return scoreExamples(data.toJavaRDD(), includeRegularizationTerms, batchSize); }
[ "public", "JavaDoubleRDD", "scoreExamples", "(", "RDD", "<", "DataSet", ">", "data", ",", "boolean", "includeRegularizationTerms", ",", "int", "batchSize", ")", "{", "return", "scoreExamples", "(", "data", ".", "toJavaRDD", "(", ")", ",", "includeRegularizationTerms", ",", "batchSize", ")", ";", "}" ]
{@code RDD<DataSet>} overload of {@link #scoreExamples(JavaRDD, boolean, int)}
[ "{" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/multilayer/SparkDl4jMultiLayer.java#L418-L420
BotMill/fb-botmill
src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ReplyFactory.java
ReplyFactory.addReceiptTemplate
public static ReceiptTemplateBuilder addReceiptTemplate( String recipientName, String orderNumber, String currency, String paymentMethod) { """ Adds a Receipt Template to the response. @param recipientName the recipient name. It can't be empty. @param orderNumber the order number. It can't be empty and it must be unique for each user. @param currency the currency for order. It can't be empty. @param paymentMethod the payment method details. This can be a custom string. ex: "Visa 1234". You may insert an arbitrary string here but we recommend providing enough information for the person to decipher which payment method and account they used (e.g., the name of the payment method and partial account number). It can't be empty. @return a builder for the response. @see <a href= "https://developers.facebook.com/docs/messenger-platform/send-api-reference/receipt-template" > Facebook's Messenger Platform Receipt Template Documentation</a> """ return new ReceiptTemplateBuilder(recipientName, orderNumber, currency, paymentMethod); }
java
public static ReceiptTemplateBuilder addReceiptTemplate( String recipientName, String orderNumber, String currency, String paymentMethod) { return new ReceiptTemplateBuilder(recipientName, orderNumber, currency, paymentMethod); }
[ "public", "static", "ReceiptTemplateBuilder", "addReceiptTemplate", "(", "String", "recipientName", ",", "String", "orderNumber", ",", "String", "currency", ",", "String", "paymentMethod", ")", "{", "return", "new", "ReceiptTemplateBuilder", "(", "recipientName", ",", "orderNumber", ",", "currency", ",", "paymentMethod", ")", ";", "}" ]
Adds a Receipt Template to the response. @param recipientName the recipient name. It can't be empty. @param orderNumber the order number. It can't be empty and it must be unique for each user. @param currency the currency for order. It can't be empty. @param paymentMethod the payment method details. This can be a custom string. ex: "Visa 1234". You may insert an arbitrary string here but we recommend providing enough information for the person to decipher which payment method and account they used (e.g., the name of the payment method and partial account number). It can't be empty. @return a builder for the response. @see <a href= "https://developers.facebook.com/docs/messenger-platform/send-api-reference/receipt-template" > Facebook's Messenger Platform Receipt Template Documentation</a>
[ "Adds", "a", "Receipt", "Template", "to", "the", "response", "." ]
train
https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ReplyFactory.java#L404-L409
ironjacamar/ironjacamar
web/src/main/java/org/ironjacamar/web/console/Server.java
Server.getDomainData
public static Iterator getDomainData() throws JMException { """ Get the domain data @return The data iterator @exception JMException Thrown if an error occurs """ MBeanServer server = getMBeanServer(); TreeMap<String, DomainData> domainData = new TreeMap<String, DomainData>(); if (server != null) { Set objectNames = server.queryNames(null, null); Iterator objectNamesIter = objectNames.iterator(); while (objectNamesIter.hasNext()) { ObjectName name = (ObjectName)objectNamesIter.next(); MBeanInfo info = server.getMBeanInfo(name); String domainName = name.getDomain(); MBeanData mbeanData = new MBeanData(name, info); DomainData data = domainData.get(domainName); if (data == null) { data = new DomainData(domainName); domainData.put(domainName, data); } data.addData(mbeanData); } } return domainData.values().iterator(); }
java
public static Iterator getDomainData() throws JMException { MBeanServer server = getMBeanServer(); TreeMap<String, DomainData> domainData = new TreeMap<String, DomainData>(); if (server != null) { Set objectNames = server.queryNames(null, null); Iterator objectNamesIter = objectNames.iterator(); while (objectNamesIter.hasNext()) { ObjectName name = (ObjectName)objectNamesIter.next(); MBeanInfo info = server.getMBeanInfo(name); String domainName = name.getDomain(); MBeanData mbeanData = new MBeanData(name, info); DomainData data = domainData.get(domainName); if (data == null) { data = new DomainData(domainName); domainData.put(domainName, data); } data.addData(mbeanData); } } return domainData.values().iterator(); }
[ "public", "static", "Iterator", "getDomainData", "(", ")", "throws", "JMException", "{", "MBeanServer", "server", "=", "getMBeanServer", "(", ")", ";", "TreeMap", "<", "String", ",", "DomainData", ">", "domainData", "=", "new", "TreeMap", "<", "String", ",", "DomainData", ">", "(", ")", ";", "if", "(", "server", "!=", "null", ")", "{", "Set", "objectNames", "=", "server", ".", "queryNames", "(", "null", ",", "null", ")", ";", "Iterator", "objectNamesIter", "=", "objectNames", ".", "iterator", "(", ")", ";", "while", "(", "objectNamesIter", ".", "hasNext", "(", ")", ")", "{", "ObjectName", "name", "=", "(", "ObjectName", ")", "objectNamesIter", ".", "next", "(", ")", ";", "MBeanInfo", "info", "=", "server", ".", "getMBeanInfo", "(", "name", ")", ";", "String", "domainName", "=", "name", ".", "getDomain", "(", ")", ";", "MBeanData", "mbeanData", "=", "new", "MBeanData", "(", "name", ",", "info", ")", ";", "DomainData", "data", "=", "domainData", ".", "get", "(", "domainName", ")", ";", "if", "(", "data", "==", "null", ")", "{", "data", "=", "new", "DomainData", "(", "domainName", ")", ";", "domainData", ".", "put", "(", "domainName", ",", "data", ")", ";", "}", "data", ".", "addData", "(", "mbeanData", ")", ";", "}", "}", "return", "domainData", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "}" ]
Get the domain data @return The data iterator @exception JMException Thrown if an error occurs
[ "Get", "the", "domain", "data" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/web/src/main/java/org/ironjacamar/web/console/Server.java#L115-L144
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java
ImageMath.smoothPulse
public static float smoothPulse(float a1, float a2, float b1, float b2, float x) { """ A smoothed pulse function. A cubic function is used to smooth the step between two thresholds. @param a1 the lower threshold position for the start of the pulse @param a2 the upper threshold position for the start of the pulse @param b1 the lower threshold position for the end of the pulse @param b2 the upper threshold position for the end of the pulse @param x the input parameter @return the output value """ if (x < a1 || x >= b2) return 0; if (x >= a2) { if (x < b1) return 1.0f; x = (x - b1) / (b2 - b1); return 1.0f - (x*x * (3.0f - 2.0f*x)); } x = (x - a1) / (a2 - a1); return x*x * (3.0f - 2.0f*x); }
java
public static float smoothPulse(float a1, float a2, float b1, float b2, float x) { if (x < a1 || x >= b2) return 0; if (x >= a2) { if (x < b1) return 1.0f; x = (x - b1) / (b2 - b1); return 1.0f - (x*x * (3.0f - 2.0f*x)); } x = (x - a1) / (a2 - a1); return x*x * (3.0f - 2.0f*x); }
[ "public", "static", "float", "smoothPulse", "(", "float", "a1", ",", "float", "a2", ",", "float", "b1", ",", "float", "b2", ",", "float", "x", ")", "{", "if", "(", "x", "<", "a1", "||", "x", ">=", "b2", ")", "return", "0", ";", "if", "(", "x", ">=", "a2", ")", "{", "if", "(", "x", "<", "b1", ")", "return", "1.0f", ";", "x", "=", "(", "x", "-", "b1", ")", "/", "(", "b2", "-", "b1", ")", ";", "return", "1.0f", "-", "(", "x", "*", "x", "*", "(", "3.0f", "-", "2.0f", "*", "x", ")", ")", ";", "}", "x", "=", "(", "x", "-", "a1", ")", "/", "(", "a2", "-", "a1", ")", ";", "return", "x", "*", "x", "*", "(", "3.0f", "-", "2.0f", "*", "x", ")", ";", "}" ]
A smoothed pulse function. A cubic function is used to smooth the step between two thresholds. @param a1 the lower threshold position for the start of the pulse @param a2 the upper threshold position for the start of the pulse @param b1 the lower threshold position for the end of the pulse @param b2 the upper threshold position for the end of the pulse @param x the input parameter @return the output value
[ "A", "smoothed", "pulse", "function", ".", "A", "cubic", "function", "is", "used", "to", "smooth", "the", "step", "between", "two", "thresholds", "." ]
train
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java#L112-L123
audit4j/audit4j-core
src/main/java/org/audit4j/core/util/AuditUtil.java
AuditUtil.stringTodate
public static Date stringTodate(String dateString, String format) throws ParseException { """ Convert string to date. @param dateString the date string @param format the format @return the date @throws ParseException the parse exception """ final DateFormat dateFormat = new SimpleDateFormat(format, Locale.US); return dateFormat.parse(dateString); }
java
public static Date stringTodate(String dateString, String format) throws ParseException { final DateFormat dateFormat = new SimpleDateFormat(format, Locale.US); return dateFormat.parse(dateString); }
[ "public", "static", "Date", "stringTodate", "(", "String", "dateString", ",", "String", "format", ")", "throws", "ParseException", "{", "final", "DateFormat", "dateFormat", "=", "new", "SimpleDateFormat", "(", "format", ",", "Locale", ".", "US", ")", ";", "return", "dateFormat", ".", "parse", "(", "dateString", ")", ";", "}" ]
Convert string to date. @param dateString the date string @param format the format @return the date @throws ParseException the parse exception
[ "Convert", "string", "to", "date", "." ]
train
https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/util/AuditUtil.java#L97-L100
casmi/casmi
src/main/java/casmi/graphics/element/Line.java
Line.setDashedLinePram
public void setDashedLinePram(double length, double interval) { """ Sets the parameter for the dashed line. @param length The length of the dashed lines. @param interval The interval of the dashed lines. """ this.dashedLineLength = length; this.dashedLineInterval = interval; this.dashed = true; calcDashedLine(); }
java
public void setDashedLinePram(double length, double interval) { this.dashedLineLength = length; this.dashedLineInterval = interval; this.dashed = true; calcDashedLine(); }
[ "public", "void", "setDashedLinePram", "(", "double", "length", ",", "double", "interval", ")", "{", "this", ".", "dashedLineLength", "=", "length", ";", "this", ".", "dashedLineInterval", "=", "interval", ";", "this", ".", "dashed", "=", "true", ";", "calcDashedLine", "(", ")", ";", "}" ]
Sets the parameter for the dashed line. @param length The length of the dashed lines. @param interval The interval of the dashed lines.
[ "Sets", "the", "parameter", "for", "the", "dashed", "line", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Line.java#L288-L293
softindex/datakernel
cloud-fs/src/main/java/io/datakernel/remotefs/RemoteFsClusterClient.java
RemoteFsClusterClient.ofFailure
private static <T, U> Promise<T> ofFailure(String message, List<Try<U>> failed) { """ shortcut for creating single Exception from list of possibly failed tries """ StacklessException exception = new StacklessException(RemoteFsClusterClient.class, message); failed.stream() .map(Try::getExceptionOrNull) .filter(Objects::nonNull) .forEach(exception::addSuppressed); return Promise.ofException(exception); }
java
private static <T, U> Promise<T> ofFailure(String message, List<Try<U>> failed) { StacklessException exception = new StacklessException(RemoteFsClusterClient.class, message); failed.stream() .map(Try::getExceptionOrNull) .filter(Objects::nonNull) .forEach(exception::addSuppressed); return Promise.ofException(exception); }
[ "private", "static", "<", "T", ",", "U", ">", "Promise", "<", "T", ">", "ofFailure", "(", "String", "message", ",", "List", "<", "Try", "<", "U", ">", ">", "failed", ")", "{", "StacklessException", "exception", "=", "new", "StacklessException", "(", "RemoteFsClusterClient", ".", "class", ",", "message", ")", ";", "failed", ".", "stream", "(", ")", ".", "map", "(", "Try", "::", "getExceptionOrNull", ")", ".", "filter", "(", "Objects", "::", "nonNull", ")", ".", "forEach", "(", "exception", "::", "addSuppressed", ")", ";", "return", "Promise", ".", "ofException", "(", "exception", ")", ";", "}" ]
shortcut for creating single Exception from list of possibly failed tries
[ "shortcut", "for", "creating", "single", "Exception", "from", "list", "of", "possibly", "failed", "tries" ]
train
https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/cloud-fs/src/main/java/io/datakernel/remotefs/RemoteFsClusterClient.java#L239-L246
netty/netty
codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessage.java
HAProxyMessage.portStringToInt
private static int portStringToInt(String value) { """ Convert port to integer @param value the port @return port as an integer @throws HAProxyProtocolException if port is not a valid integer """ int port; try { port = Integer.parseInt(value); } catch (NumberFormatException e) { throw new HAProxyProtocolException("invalid port: " + value, e); } if (port <= 0 || port > 65535) { throw new HAProxyProtocolException("invalid port: " + value + " (expected: 1 ~ 65535)"); } return port; }
java
private static int portStringToInt(String value) { int port; try { port = Integer.parseInt(value); } catch (NumberFormatException e) { throw new HAProxyProtocolException("invalid port: " + value, e); } if (port <= 0 || port > 65535) { throw new HAProxyProtocolException("invalid port: " + value + " (expected: 1 ~ 65535)"); } return port; }
[ "private", "static", "int", "portStringToInt", "(", "String", "value", ")", "{", "int", "port", ";", "try", "{", "port", "=", "Integer", ".", "parseInt", "(", "value", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "throw", "new", "HAProxyProtocolException", "(", "\"invalid port: \"", "+", "value", ",", "e", ")", ";", "}", "if", "(", "port", "<=", "0", "||", "port", ">", "65535", ")", "{", "throw", "new", "HAProxyProtocolException", "(", "\"invalid port: \"", "+", "value", "+", "\" (expected: 1 ~ 65535)\"", ")", ";", "}", "return", "port", ";", "}" ]
Convert port to integer @param value the port @return port as an integer @throws HAProxyProtocolException if port is not a valid integer
[ "Convert", "port", "to", "integer" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessage.java#L396-L409
opencb/biodata
biodata-tools/src/main/java/org/opencb/biodata/tools/variant/merge/VariantMerger.java
VariantMerger.createFromTemplate
public Variant createFromTemplate(Variant target) { """ Create an empty Variant (position, ref, alt) from a template with basic Study information without samples. @param target Variant to take as a template @return Variant filled with chromosome, start, end, ref, alt, study ID and format set to GT only, BUT no samples. """ Variant var = new Variant(target.getChromosome(), target.getStart(), target.getEnd(), target.getReference(), target.getAlternate()); var.setType(target.getType()); for(StudyEntry tse : target.getStudies()){ StudyEntry se = new StudyEntry(tse.getStudyId()); se.setFiles(Collections.singletonList(new FileEntry("", "", new HashMap<>()))); se.setFormat(Arrays.asList(getGtKey(), getFilterKey())); se.setSamplesPosition(new HashMap<>()); se.setSamplesData(new ArrayList<>()); var.addStudyEntry(se); } return var; }
java
public Variant createFromTemplate(Variant target) { Variant var = new Variant(target.getChromosome(), target.getStart(), target.getEnd(), target.getReference(), target.getAlternate()); var.setType(target.getType()); for(StudyEntry tse : target.getStudies()){ StudyEntry se = new StudyEntry(tse.getStudyId()); se.setFiles(Collections.singletonList(new FileEntry("", "", new HashMap<>()))); se.setFormat(Arrays.asList(getGtKey(), getFilterKey())); se.setSamplesPosition(new HashMap<>()); se.setSamplesData(new ArrayList<>()); var.addStudyEntry(se); } return var; }
[ "public", "Variant", "createFromTemplate", "(", "Variant", "target", ")", "{", "Variant", "var", "=", "new", "Variant", "(", "target", ".", "getChromosome", "(", ")", ",", "target", ".", "getStart", "(", ")", ",", "target", ".", "getEnd", "(", ")", ",", "target", ".", "getReference", "(", ")", ",", "target", ".", "getAlternate", "(", ")", ")", ";", "var", ".", "setType", "(", "target", ".", "getType", "(", ")", ")", ";", "for", "(", "StudyEntry", "tse", ":", "target", ".", "getStudies", "(", ")", ")", "{", "StudyEntry", "se", "=", "new", "StudyEntry", "(", "tse", ".", "getStudyId", "(", ")", ")", ";", "se", ".", "setFiles", "(", "Collections", ".", "singletonList", "(", "new", "FileEntry", "(", "\"\"", ",", "\"\"", ",", "new", "HashMap", "<>", "(", ")", ")", ")", ")", ";", "se", ".", "setFormat", "(", "Arrays", ".", "asList", "(", "getGtKey", "(", ")", ",", "getFilterKey", "(", ")", ")", ")", ";", "se", ".", "setSamplesPosition", "(", "new", "HashMap", "<>", "(", ")", ")", ";", "se", ".", "setSamplesData", "(", "new", "ArrayList", "<>", "(", ")", ")", ";", "var", ".", "addStudyEntry", "(", "se", ")", ";", "}", "return", "var", ";", "}" ]
Create an empty Variant (position, ref, alt) from a template with basic Study information without samples. @param target Variant to take as a template @return Variant filled with chromosome, start, end, ref, alt, study ID and format set to GT only, BUT no samples.
[ "Create", "an", "empty", "Variant", "(", "position", "ref", "alt", ")", "from", "a", "template", "with", "basic", "Study", "information", "without", "samples", "." ]
train
https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/merge/VariantMerger.java#L264-L276
Azure/azure-sdk-for-java
storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java
StorageAccountsInner.getManagementPolicies
public StorageAccountManagementPoliciesInner getManagementPolicies(String resourceGroupName, String accountName) { """ Gets the data policy rules associated with the specified storage account. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the StorageAccountManagementPoliciesInner object if successful. """ return getManagementPoliciesWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); }
java
public StorageAccountManagementPoliciesInner getManagementPolicies(String resourceGroupName, String accountName) { return getManagementPoliciesWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); }
[ "public", "StorageAccountManagementPoliciesInner", "getManagementPolicies", "(", "String", "resourceGroupName", ",", "String", "accountName", ")", "{", "return", "getManagementPoliciesWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Gets the data policy rules associated with the specified storage account. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the StorageAccountManagementPoliciesInner object if successful.
[ "Gets", "the", "data", "policy", "rules", "associated", "with", "the", "specified", "storage", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java#L1202-L1204
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/transform/TransformerRegistry.java
TransformerRegistry.resolveServer
public OperationTransformerRegistry resolveServer(final ModelVersion mgmtVersion, final ModelNode subsystems) { """ Resolve the server registry. @param mgmtVersion the mgmt version @param subsystems the subsystems @return the transformer registry """ return resolveServer(mgmtVersion, resolveVersions(subsystems)); }
java
public OperationTransformerRegistry resolveServer(final ModelVersion mgmtVersion, final ModelNode subsystems) { return resolveServer(mgmtVersion, resolveVersions(subsystems)); }
[ "public", "OperationTransformerRegistry", "resolveServer", "(", "final", "ModelVersion", "mgmtVersion", ",", "final", "ModelNode", "subsystems", ")", "{", "return", "resolveServer", "(", "mgmtVersion", ",", "resolveVersions", "(", "subsystems", ")", ")", ";", "}" ]
Resolve the server registry. @param mgmtVersion the mgmt version @param subsystems the subsystems @return the transformer registry
[ "Resolve", "the", "server", "registry", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformerRegistry.java#L224-L226
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/VirtualWANsInner.java
VirtualWANsInner.createOrUpdate
public VirtualWANInner createOrUpdate(String resourceGroupName, String virtualWANName, VirtualWANInner wANParameters) { """ Creates a VirtualWAN resource if it doesn't exist else updates the existing VirtualWAN. @param resourceGroupName The resource group name of the VirtualWan. @param virtualWANName The name of the VirtualWAN being created or updated. @param wANParameters Parameters supplied to create or update VirtualWAN. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VirtualWANInner object if successful. """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualWANName, wANParameters).toBlocking().last().body(); }
java
public VirtualWANInner createOrUpdate(String resourceGroupName, String virtualWANName, VirtualWANInner wANParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualWANName, wANParameters).toBlocking().last().body(); }
[ "public", "VirtualWANInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "virtualWANName", ",", "VirtualWANInner", "wANParameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualWANName", ",", "wANParameters", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Creates a VirtualWAN resource if it doesn't exist else updates the existing VirtualWAN. @param resourceGroupName The resource group name of the VirtualWan. @param virtualWANName The name of the VirtualWAN being created or updated. @param wANParameters Parameters supplied to create or update VirtualWAN. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VirtualWANInner object if successful.
[ "Creates", "a", "VirtualWAN", "resource", "if", "it", "doesn", "t", "exist", "else", "updates", "the", "existing", "VirtualWAN", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/VirtualWANsInner.java#L211-L213
aws/aws-sdk-java
aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/CreateDeploymentRequest.java
CreateDeploymentRequest.withVariables
public CreateDeploymentRequest withVariables(java.util.Map<String, String> variables) { """ <p> A map that defines the stage variables for the <a>Stage</a> resource that is associated with the new deployment. Variable names can have alphanumeric and underscore characters, and the values must match <code>[A-Za-z0-9-._~:/?#&amp;=,]+</code>. </p> @param variables A map that defines the stage variables for the <a>Stage</a> resource that is associated with the new deployment. Variable names can have alphanumeric and underscore characters, and the values must match <code>[A-Za-z0-9-._~:/?#&amp;=,]+</code>. @return Returns a reference to this object so that method calls can be chained together. """ setVariables(variables); return this; }
java
public CreateDeploymentRequest withVariables(java.util.Map<String, String> variables) { setVariables(variables); return this; }
[ "public", "CreateDeploymentRequest", "withVariables", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "variables", ")", "{", "setVariables", "(", "variables", ")", ";", "return", "this", ";", "}" ]
<p> A map that defines the stage variables for the <a>Stage</a> resource that is associated with the new deployment. Variable names can have alphanumeric and underscore characters, and the values must match <code>[A-Za-z0-9-._~:/?#&amp;=,]+</code>. </p> @param variables A map that defines the stage variables for the <a>Stage</a> resource that is associated with the new deployment. Variable names can have alphanumeric and underscore characters, and the values must match <code>[A-Za-z0-9-._~:/?#&amp;=,]+</code>. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "map", "that", "defines", "the", "stage", "variables", "for", "the", "<a", ">", "Stage<", "/", "a", ">", "resource", "that", "is", "associated", "with", "the", "new", "deployment", ".", "Variable", "names", "can", "have", "alphanumeric", "and", "underscore", "characters", "and", "the", "values", "must", "match", "<code", ">", "[", "A", "-", "Za", "-", "z0", "-", "9", "-", ".", "_~", ":", "/", "?#&amp", ";", "=", "]", "+", "<", "/", "code", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/CreateDeploymentRequest.java#L391-L394
Impetus/Kundera
src/kundera-cassandra/cassandra-pelops/src/main/java/com/impetus/client/cassandra/pelops/PelopsClient.java
PelopsClient.find
@Override public final List find(Class entityClass, List<String> relationNames, boolean isWrapReq, EntityMetadata metadata, Object... rowIds) { """ Method to return list of entities for given below attributes:. @param entityClass entity class @param relationNames relation names @param isWrapReq true, in case it needs to populate enhance entity. @param metadata entity metadata. @param rowIds array of row key s @return list of wrapped entities. """ if (!isOpen()) { throw new PersistenceException("PelopsClient is closed."); } return findByRowKeys(entityClass, relationNames, isWrapReq, metadata, rowIds); }
java
@Override public final List find(Class entityClass, List<String> relationNames, boolean isWrapReq, EntityMetadata metadata, Object... rowIds) { if (!isOpen()) { throw new PersistenceException("PelopsClient is closed."); } return findByRowKeys(entityClass, relationNames, isWrapReq, metadata, rowIds); }
[ "@", "Override", "public", "final", "List", "find", "(", "Class", "entityClass", ",", "List", "<", "String", ">", "relationNames", ",", "boolean", "isWrapReq", ",", "EntityMetadata", "metadata", ",", "Object", "...", "rowIds", ")", "{", "if", "(", "!", "isOpen", "(", ")", ")", "{", "throw", "new", "PersistenceException", "(", "\"PelopsClient is closed.\"", ")", ";", "}", "return", "findByRowKeys", "(", "entityClass", ",", "relationNames", ",", "isWrapReq", ",", "metadata", ",", "rowIds", ")", ";", "}" ]
Method to return list of entities for given below attributes:. @param entityClass entity class @param relationNames relation names @param isWrapReq true, in case it needs to populate enhance entity. @param metadata entity metadata. @param rowIds array of row key s @return list of wrapped entities.
[ "Method", "to", "return", "list", "of", "entities", "for", "given", "below", "attributes", ":", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-pelops/src/main/java/com/impetus/client/cassandra/pelops/PelopsClient.java#L197-L207
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/filter/RawScale3x.java
RawScale3x.computeE5
private static int computeE5(int b, int c, int e, int f, int h, int i) { """ Compute E5 pixel. @param b The b value. @param c The c value. @param e The e value. @param f The f value. @param h The h value. @param i The i value. @return The computed value. """ if (b == f && e != i || h == f && e != c) { return f; } return e; }
java
private static int computeE5(int b, int c, int e, int f, int h, int i) { if (b == f && e != i || h == f && e != c) { return f; } return e; }
[ "private", "static", "int", "computeE5", "(", "int", "b", ",", "int", "c", ",", "int", "e", ",", "int", "f", ",", "int", "h", ",", "int", "i", ")", "{", "if", "(", "b", "==", "f", "&&", "e", "!=", "i", "||", "h", "==", "f", "&&", "e", "!=", "c", ")", "{", "return", "f", ";", "}", "return", "e", ";", "}" ]
Compute E5 pixel. @param b The b value. @param c The c value. @param e The e value. @param f The f value. @param h The h value. @param i The i value. @return The computed value.
[ "Compute", "E5", "pixel", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/filter/RawScale3x.java#L113-L120
grpc/grpc-java
netty/src/main/java/io/grpc/netty/NettyServerBuilder.java
NettyServerBuilder.maxConnectionAgeGrace
public NettyServerBuilder maxConnectionAgeGrace(long maxConnectionAgeGrace, TimeUnit timeUnit) { """ Sets a custom grace time for the graceful connection termination. Once the max connection age is reached, RPCs have the grace time to complete. RPCs that do not complete in time will be cancelled, allowing the connection to terminate. {@code Long.MAX_VALUE} nano seconds or an unreasonably large value are considered infinite. @see #maxConnectionAge(long, TimeUnit) @since 1.3.0 """ checkArgument(maxConnectionAgeGrace >= 0L, "max connection age grace must be non-negative"); maxConnectionAgeGraceInNanos = timeUnit.toNanos(maxConnectionAgeGrace); if (maxConnectionAgeGraceInNanos >= AS_LARGE_AS_INFINITE) { maxConnectionAgeGraceInNanos = MAX_CONNECTION_AGE_GRACE_NANOS_INFINITE; } return this; }
java
public NettyServerBuilder maxConnectionAgeGrace(long maxConnectionAgeGrace, TimeUnit timeUnit) { checkArgument(maxConnectionAgeGrace >= 0L, "max connection age grace must be non-negative"); maxConnectionAgeGraceInNanos = timeUnit.toNanos(maxConnectionAgeGrace); if (maxConnectionAgeGraceInNanos >= AS_LARGE_AS_INFINITE) { maxConnectionAgeGraceInNanos = MAX_CONNECTION_AGE_GRACE_NANOS_INFINITE; } return this; }
[ "public", "NettyServerBuilder", "maxConnectionAgeGrace", "(", "long", "maxConnectionAgeGrace", ",", "TimeUnit", "timeUnit", ")", "{", "checkArgument", "(", "maxConnectionAgeGrace", ">=", "0L", ",", "\"max connection age grace must be non-negative\"", ")", ";", "maxConnectionAgeGraceInNanos", "=", "timeUnit", ".", "toNanos", "(", "maxConnectionAgeGrace", ")", ";", "if", "(", "maxConnectionAgeGraceInNanos", ">=", "AS_LARGE_AS_INFINITE", ")", "{", "maxConnectionAgeGraceInNanos", "=", "MAX_CONNECTION_AGE_GRACE_NANOS_INFINITE", ";", "}", "return", "this", ";", "}" ]
Sets a custom grace time for the graceful connection termination. Once the max connection age is reached, RPCs have the grace time to complete. RPCs that do not complete in time will be cancelled, allowing the connection to terminate. {@code Long.MAX_VALUE} nano seconds or an unreasonably large value are considered infinite. @see #maxConnectionAge(long, TimeUnit) @since 1.3.0
[ "Sets", "a", "custom", "grace", "time", "for", "the", "graceful", "connection", "termination", ".", "Once", "the", "max", "connection", "age", "is", "reached", "RPCs", "have", "the", "grace", "time", "to", "complete", ".", "RPCs", "that", "do", "not", "complete", "in", "time", "will", "be", "cancelled", "allowing", "the", "connection", "to", "terminate", ".", "{", "@code", "Long", ".", "MAX_VALUE", "}", "nano", "seconds", "or", "an", "unreasonably", "large", "value", "are", "considered", "infinite", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/NettyServerBuilder.java#L454-L461
pressgang-ccms/PressGangCCMSCommonUtilities
src/main/java/org/jboss/pressgang/ccms/utils/common/StringUtilities.java
StringUtilities.lastIndexOf
public static int lastIndexOf(final String input, final char delim) { """ Gets the last index of a character ignoring characters that have been escaped @param input The string to be searched @param delim The character to be found @return The index of the found character or -1 if the character wasn't found """ return input == null ? -1 : lastIndexOf(input, delim, input.length()); }
java
public static int lastIndexOf(final String input, final char delim) { return input == null ? -1 : lastIndexOf(input, delim, input.length()); }
[ "public", "static", "int", "lastIndexOf", "(", "final", "String", "input", ",", "final", "char", "delim", ")", "{", "return", "input", "==", "null", "?", "-", "1", ":", "lastIndexOf", "(", "input", ",", "delim", ",", "input", ".", "length", "(", ")", ")", ";", "}" ]
Gets the last index of a character ignoring characters that have been escaped @param input The string to be searched @param delim The character to be found @return The index of the found character or -1 if the character wasn't found
[ "Gets", "the", "last", "index", "of", "a", "character", "ignoring", "characters", "that", "have", "been", "escaped" ]
train
https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/StringUtilities.java#L248-L250
classgraph/classgraph
src/main/java/nonapi/io/github/classgraph/classpath/ClassLoaderOrder.java
ClassLoaderOrder.delegateTo
public void delegateTo(final ClassLoader classLoader, final boolean isParent) { """ Recursively delegate to another {@link ClassLoader}. @param classLoader the class loader """ if (classLoader == null) { return; } // Check if this is a parent before checking if the classloader is already in the delegatedTo set, // so that if the classloader is a context classloader but also a parent, it still gets marked as // a parent classloader. if (isParent) { allParentClassLoaders.add(classLoader); } if (delegatedTo.add(classLoader)) { // Find ClassLoaderHandlerRegistryEntry for this classloader final ClassLoaderHandlerRegistryEntry entry = getRegistryEntry(classLoader); // Delegate to this classloader, by recursing to that classloader to get its classloader order entry.findClassLoaderOrder(classLoader, this); } }
java
public void delegateTo(final ClassLoader classLoader, final boolean isParent) { if (classLoader == null) { return; } // Check if this is a parent before checking if the classloader is already in the delegatedTo set, // so that if the classloader is a context classloader but also a parent, it still gets marked as // a parent classloader. if (isParent) { allParentClassLoaders.add(classLoader); } if (delegatedTo.add(classLoader)) { // Find ClassLoaderHandlerRegistryEntry for this classloader final ClassLoaderHandlerRegistryEntry entry = getRegistryEntry(classLoader); // Delegate to this classloader, by recursing to that classloader to get its classloader order entry.findClassLoaderOrder(classLoader, this); } }
[ "public", "void", "delegateTo", "(", "final", "ClassLoader", "classLoader", ",", "final", "boolean", "isParent", ")", "{", "if", "(", "classLoader", "==", "null", ")", "{", "return", ";", "}", "// Check if this is a parent before checking if the classloader is already in the delegatedTo set,", "// so that if the classloader is a context classloader but also a parent, it still gets marked as", "// a parent classloader.", "if", "(", "isParent", ")", "{", "allParentClassLoaders", ".", "add", "(", "classLoader", ")", ";", "}", "if", "(", "delegatedTo", ".", "add", "(", "classLoader", ")", ")", "{", "// Find ClassLoaderHandlerRegistryEntry for this classloader", "final", "ClassLoaderHandlerRegistryEntry", "entry", "=", "getRegistryEntry", "(", "classLoader", ")", ";", "// Delegate to this classloader, by recursing to that classloader to get its classloader order", "entry", ".", "findClassLoaderOrder", "(", "classLoader", ",", "this", ")", ";", "}", "}" ]
Recursively delegate to another {@link ClassLoader}. @param classLoader the class loader
[ "Recursively", "delegate", "to", "another", "{", "@link", "ClassLoader", "}", "." ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/classpath/ClassLoaderOrder.java#L142-L158
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java
RecommendationsInner.disableAllForWebApp
public void disableAllForWebApp(String resourceGroupName, String siteName) { """ Disable all recommendations for an app. Disable all recommendations for an app. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Name of the app. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ disableAllForWebAppWithServiceResponseAsync(resourceGroupName, siteName).toBlocking().single().body(); }
java
public void disableAllForWebApp(String resourceGroupName, String siteName) { disableAllForWebAppWithServiceResponseAsync(resourceGroupName, siteName).toBlocking().single().body(); }
[ "public", "void", "disableAllForWebApp", "(", "String", "resourceGroupName", ",", "String", "siteName", ")", "{", "disableAllForWebAppWithServiceResponseAsync", "(", "resourceGroupName", ",", "siteName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Disable all recommendations for an app. Disable all recommendations for an app. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Name of the app. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Disable", "all", "recommendations", "for", "an", "app", ".", "Disable", "all", "recommendations", "for", "an", "app", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java#L1030-L1032
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/cash/ParameterizationFunction.java
ParameterizationFunction.determineGlobalExtremum
private void determineGlobalExtremum() { """ Determines the global extremum of this parameterization function. """ alphaExtremum = new double[vec.getDimensionality() - 1]; for(int n = alphaExtremum.length - 1; n >= 0; n--) { alphaExtremum[n] = extremum_alpha_n(n, alphaExtremum); if(Double.isNaN(alphaExtremum[n])) { throw new IllegalStateException("Houston, we have a problem!\n" + this + "\n" + vec + "\n" + FormatUtil.format(alphaExtremum)); } } determineGlobalExtremumType(); }
java
private void determineGlobalExtremum() { alphaExtremum = new double[vec.getDimensionality() - 1]; for(int n = alphaExtremum.length - 1; n >= 0; n--) { alphaExtremum[n] = extremum_alpha_n(n, alphaExtremum); if(Double.isNaN(alphaExtremum[n])) { throw new IllegalStateException("Houston, we have a problem!\n" + this + "\n" + vec + "\n" + FormatUtil.format(alphaExtremum)); } } determineGlobalExtremumType(); }
[ "private", "void", "determineGlobalExtremum", "(", ")", "{", "alphaExtremum", "=", "new", "double", "[", "vec", ".", "getDimensionality", "(", ")", "-", "1", "]", ";", "for", "(", "int", "n", "=", "alphaExtremum", ".", "length", "-", "1", ";", "n", ">=", "0", ";", "n", "--", ")", "{", "alphaExtremum", "[", "n", "]", "=", "extremum_alpha_n", "(", "n", ",", "alphaExtremum", ")", ";", "if", "(", "Double", ".", "isNaN", "(", "alphaExtremum", "[", "n", "]", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Houston, we have a problem!\\n\"", "+", "this", "+", "\"\\n\"", "+", "vec", "+", "\"\\n\"", "+", "FormatUtil", ".", "format", "(", "alphaExtremum", ")", ")", ";", "}", "}", "determineGlobalExtremumType", "(", ")", ";", "}" ]
Determines the global extremum of this parameterization function.
[ "Determines", "the", "global", "extremum", "of", "this", "parameterization", "function", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/cash/ParameterizationFunction.java#L439-L449
javamelody/javamelody
javamelody-core/src/main/java/net/bull/javamelody/internal/web/html/HtmlCounterReport.java
HtmlCounterReport.htmlEncodeRequestName
static String htmlEncodeRequestName(String requestId, String requestName) { """ Encode le nom d'une requête pour affichage en html, sans encoder les espaces en nbsp (insécables), et highlight les mots clés SQL. @param requestId Id de la requête @param requestName Nom de la requête à encoder @return String """ if (requestId.startsWith(Counter.SQL_COUNTER_NAME)) { final String htmlEncoded = htmlEncodeButNotSpace(requestName); // highlight SQL keywords return SQL_KEYWORDS_PATTERN.matcher(htmlEncoded) .replaceAll("<span class='sqlKeyword'>$1</span>"); } return htmlEncodeButNotSpace(requestName); }
java
static String htmlEncodeRequestName(String requestId, String requestName) { if (requestId.startsWith(Counter.SQL_COUNTER_NAME)) { final String htmlEncoded = htmlEncodeButNotSpace(requestName); // highlight SQL keywords return SQL_KEYWORDS_PATTERN.matcher(htmlEncoded) .replaceAll("<span class='sqlKeyword'>$1</span>"); } return htmlEncodeButNotSpace(requestName); }
[ "static", "String", "htmlEncodeRequestName", "(", "String", "requestId", ",", "String", "requestName", ")", "{", "if", "(", "requestId", ".", "startsWith", "(", "Counter", ".", "SQL_COUNTER_NAME", ")", ")", "{", "final", "String", "htmlEncoded", "=", "htmlEncodeButNotSpace", "(", "requestName", ")", ";", "// highlight SQL keywords\r", "return", "SQL_KEYWORDS_PATTERN", ".", "matcher", "(", "htmlEncoded", ")", ".", "replaceAll", "(", "\"<span class='sqlKeyword'>$1</span>\"", ")", ";", "}", "return", "htmlEncodeButNotSpace", "(", "requestName", ")", ";", "}" ]
Encode le nom d'une requête pour affichage en html, sans encoder les espaces en nbsp (insécables), et highlight les mots clés SQL. @param requestId Id de la requête @param requestName Nom de la requête à encoder @return String
[ "Encode", "le", "nom", "d", "une", "requête", "pour", "affichage", "en", "html", "sans", "encoder", "les", "espaces", "en", "nbsp", "(", "insécables", ")", "et", "highlight", "les", "mots", "clés", "SQL", "." ]
train
https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-core/src/main/java/net/bull/javamelody/internal/web/html/HtmlCounterReport.java#L367-L376
kohsuke/args4j
args4j/src/org/kohsuke/args4j/spi/OptionHandler.java
OptionHandler.getNameAndMeta
public final String getNameAndMeta(ResourceBundle rb, ParserProperties properties) { """ Get string representing usage for this option, of the form "name metaval" or "name=metaval, e.g. "--foo VALUE" or "--foo=VALUE" @param rb ResourceBundle to get localized version of meta string @param properties Affects the formatting behaviours. """ String str = option.isArgument() ? "" : option.toString(); String meta = getMetaVariable(rb); if (meta != null) { if (str.length() > 0) { str += properties.getOptionValueDelimiter(); } str += meta; } return str; }
java
public final String getNameAndMeta(ResourceBundle rb, ParserProperties properties) { String str = option.isArgument() ? "" : option.toString(); String meta = getMetaVariable(rb); if (meta != null) { if (str.length() > 0) { str += properties.getOptionValueDelimiter(); } str += meta; } return str; }
[ "public", "final", "String", "getNameAndMeta", "(", "ResourceBundle", "rb", ",", "ParserProperties", "properties", ")", "{", "String", "str", "=", "option", ".", "isArgument", "(", ")", "?", "\"\"", ":", "option", ".", "toString", "(", ")", ";", "String", "meta", "=", "getMetaVariable", "(", "rb", ")", ";", "if", "(", "meta", "!=", "null", ")", "{", "if", "(", "str", ".", "length", "(", ")", ">", "0", ")", "{", "str", "+=", "properties", ".", "getOptionValueDelimiter", "(", ")", ";", "}", "str", "+=", "meta", ";", "}", "return", "str", ";", "}" ]
Get string representing usage for this option, of the form "name metaval" or "name=metaval, e.g. "--foo VALUE" or "--foo=VALUE" @param rb ResourceBundle to get localized version of meta string @param properties Affects the formatting behaviours.
[ "Get", "string", "representing", "usage", "for", "this", "option", "of", "the", "form", "name", "metaval", "or", "name", "=", "metaval", "e", ".", "g", ".", "--", "foo", "VALUE", "or", "--", "foo", "=", "VALUE" ]
train
https://github.com/kohsuke/args4j/blob/dc2e7e265caf15a1a146e3389c1f16a8781f06cf/args4j/src/org/kohsuke/args4j/spi/OptionHandler.java#L110-L120
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.toMultiPolygonFromOptions
public MultiPolygon toMultiPolygonFromOptions( MultiPolygonOptions multiPolygonOptions, boolean hasZ, boolean hasM) { """ Convert a list of {@link PolygonOptions} to a {@link MultiPolygon} @param multiPolygonOptions multi polygon options @param hasZ has z flag @param hasM has m flag @return multi polygon """ MultiPolygon multiPolygon = new MultiPolygon(hasZ, hasM); for (PolygonOptions mapPolygon : multiPolygonOptions .getPolygonOptions()) { Polygon polygon = toPolygon(mapPolygon); multiPolygon.addPolygon(polygon); } return multiPolygon; }
java
public MultiPolygon toMultiPolygonFromOptions( MultiPolygonOptions multiPolygonOptions, boolean hasZ, boolean hasM) { MultiPolygon multiPolygon = new MultiPolygon(hasZ, hasM); for (PolygonOptions mapPolygon : multiPolygonOptions .getPolygonOptions()) { Polygon polygon = toPolygon(mapPolygon); multiPolygon.addPolygon(polygon); } return multiPolygon; }
[ "public", "MultiPolygon", "toMultiPolygonFromOptions", "(", "MultiPolygonOptions", "multiPolygonOptions", ",", "boolean", "hasZ", ",", "boolean", "hasM", ")", "{", "MultiPolygon", "multiPolygon", "=", "new", "MultiPolygon", "(", "hasZ", ",", "hasM", ")", ";", "for", "(", "PolygonOptions", "mapPolygon", ":", "multiPolygonOptions", ".", "getPolygonOptions", "(", ")", ")", "{", "Polygon", "polygon", "=", "toPolygon", "(", "mapPolygon", ")", ";", "multiPolygon", ".", "addPolygon", "(", "polygon", ")", ";", "}", "return", "multiPolygon", ";", "}" ]
Convert a list of {@link PolygonOptions} to a {@link MultiPolygon} @param multiPolygonOptions multi polygon options @param hasZ has z flag @param hasM has m flag @return multi polygon
[ "Convert", "a", "list", "of", "{", "@link", "PolygonOptions", "}", "to", "a", "{", "@link", "MultiPolygon", "}" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L1086-L1098
airlift/slice
src/main/java/io/airlift/slice/SliceUtf8.java
SliceUtf8.leftTrim
public static Slice leftTrim(Slice utf8, int[] whiteSpaceCodePoints) { """ Removes all {@code whiteSpaceCodePoints} from the left side of the string. <p> Note: Invalid UTF-8 sequences are not trimmed. """ int length = utf8.length(); int position = firstNonMatchPosition(utf8, whiteSpaceCodePoints); return utf8.slice(position, length - position); }
java
public static Slice leftTrim(Slice utf8, int[] whiteSpaceCodePoints) { int length = utf8.length(); int position = firstNonMatchPosition(utf8, whiteSpaceCodePoints); return utf8.slice(position, length - position); }
[ "public", "static", "Slice", "leftTrim", "(", "Slice", "utf8", ",", "int", "[", "]", "whiteSpaceCodePoints", ")", "{", "int", "length", "=", "utf8", ".", "length", "(", ")", ";", "int", "position", "=", "firstNonMatchPosition", "(", "utf8", ",", "whiteSpaceCodePoints", ")", ";", "return", "utf8", ".", "slice", "(", "position", ",", "length", "-", "position", ")", ";", "}" ]
Removes all {@code whiteSpaceCodePoints} from the left side of the string. <p> Note: Invalid UTF-8 sequences are not trimmed.
[ "Removes", "all", "{" ]
train
https://github.com/airlift/slice/blob/7166cb0319e3655f8ba15f5a7ccf3d2f721c1242/src/main/java/io/airlift/slice/SliceUtf8.java#L390-L396
scottbw/spaws
src/main/java/uk/ac/bolton/spaws/ParadataManager.java
ParadataManager.getSubmissions
public List<ISubmission> getSubmissions(String resourceUrl) throws Exception { """ Return all paradata for a resource of all types from all submitters for the resource @param resourceUrl @return @throws Exception """ ParadataFetcher fetcher = new ParadataFetcher(node, resourceUrl); return fetcher.getSubmissions(); }
java
public List<ISubmission> getSubmissions(String resourceUrl) throws Exception{ ParadataFetcher fetcher = new ParadataFetcher(node, resourceUrl); return fetcher.getSubmissions(); }
[ "public", "List", "<", "ISubmission", ">", "getSubmissions", "(", "String", "resourceUrl", ")", "throws", "Exception", "{", "ParadataFetcher", "fetcher", "=", "new", "ParadataFetcher", "(", "node", ",", "resourceUrl", ")", ";", "return", "fetcher", ".", "getSubmissions", "(", ")", ";", "}" ]
Return all paradata for a resource of all types from all submitters for the resource @param resourceUrl @return @throws Exception
[ "Return", "all", "paradata", "for", "a", "resource", "of", "all", "types", "from", "all", "submitters", "for", "the", "resource" ]
train
https://github.com/scottbw/spaws/blob/9b1e07453091f6a8d60c6046d194b1a8f1236502/src/main/java/uk/ac/bolton/spaws/ParadataManager.java#L52-L55
killbill/killbill
payment/src/main/java/org/killbill/billing/payment/core/janitor/IncompletePaymentTransactionTask.java
IncompletePaymentTransactionTask.computeNewTransactionStatusFromPaymentTransactionInfoPlugin
private TransactionStatus computeNewTransactionStatusFromPaymentTransactionInfoPlugin(final PaymentTransactionInfoPlugin input, final TransactionStatus currentTransactionStatus) { """ Keep the existing currentTransactionStatus if we can't obtain a better answer from the plugin; if not, return the newTransactionStatus """ final TransactionStatus newTransactionStatus = PaymentTransactionInfoPluginConverter.toTransactionStatus(input); return (newTransactionStatus != TransactionStatus.UNKNOWN) ? newTransactionStatus : currentTransactionStatus; }
java
private TransactionStatus computeNewTransactionStatusFromPaymentTransactionInfoPlugin(final PaymentTransactionInfoPlugin input, final TransactionStatus currentTransactionStatus) { final TransactionStatus newTransactionStatus = PaymentTransactionInfoPluginConverter.toTransactionStatus(input); return (newTransactionStatus != TransactionStatus.UNKNOWN) ? newTransactionStatus : currentTransactionStatus; }
[ "private", "TransactionStatus", "computeNewTransactionStatusFromPaymentTransactionInfoPlugin", "(", "final", "PaymentTransactionInfoPlugin", "input", ",", "final", "TransactionStatus", "currentTransactionStatus", ")", "{", "final", "TransactionStatus", "newTransactionStatus", "=", "PaymentTransactionInfoPluginConverter", ".", "toTransactionStatus", "(", "input", ")", ";", "return", "(", "newTransactionStatus", "!=", "TransactionStatus", ".", "UNKNOWN", ")", "?", "newTransactionStatus", ":", "currentTransactionStatus", ";", "}" ]
Keep the existing currentTransactionStatus if we can't obtain a better answer from the plugin; if not, return the newTransactionStatus
[ "Keep", "the", "existing", "currentTransactionStatus", "if", "we", "can", "t", "obtain", "a", "better", "answer", "from", "the", "plugin", ";", "if", "not", "return", "the", "newTransactionStatus" ]
train
https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/payment/src/main/java/org/killbill/billing/payment/core/janitor/IncompletePaymentTransactionTask.java#L271-L274
OpenLiberty/open-liberty
dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLUtils.java
SSLUtils.lengthOf
public static int lengthOf(WsByteBuffer[] src, int startIndex) { """ Find the amount of data in the source buffers, starting at the input index. @param src @param startIndex @return int """ int length = 0; if (null != src) { for (int i = startIndex; i < src.length && null != src[i]; i++) { length += src[i].remaining(); } } return length; }
java
public static int lengthOf(WsByteBuffer[] src, int startIndex) { int length = 0; if (null != src) { for (int i = startIndex; i < src.length && null != src[i]; i++) { length += src[i].remaining(); } } return length; }
[ "public", "static", "int", "lengthOf", "(", "WsByteBuffer", "[", "]", "src", ",", "int", "startIndex", ")", "{", "int", "length", "=", "0", ";", "if", "(", "null", "!=", "src", ")", "{", "for", "(", "int", "i", "=", "startIndex", ";", "i", "<", "src", ".", "length", "&&", "null", "!=", "src", "[", "i", "]", ";", "i", "++", ")", "{", "length", "+=", "src", "[", "i", "]", ".", "remaining", "(", ")", ";", "}", "}", "return", "length", ";", "}" ]
Find the amount of data in the source buffers, starting at the input index. @param src @param startIndex @return int
[ "Find", "the", "amount", "of", "data", "in", "the", "source", "buffers", "starting", "at", "the", "input", "index", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLUtils.java#L1448-L1456
snowflakedb/snowflake-jdbc
src/main/java/net/snowflake/client/core/bind/BindUploader.java
BindUploader.arrayBindValueCount
public static int arrayBindValueCount(Map<String, ParameterBindingDTO> bindValues) { """ Compute the number of array bind values in the given bind map @param bindValues the bind map @return 0 if bindValues is null, has no binds, or is not an array bind n otherwise, where n is the number of binds in the array bind """ if (!isArrayBind(bindValues)) { return 0; } else { ParameterBindingDTO bindSample = bindValues.values().iterator().next(); List<String> bindSampleValues = (List<String>) bindSample.getValue(); return bindValues.size() * bindSampleValues.size(); } }
java
public static int arrayBindValueCount(Map<String, ParameterBindingDTO> bindValues) { if (!isArrayBind(bindValues)) { return 0; } else { ParameterBindingDTO bindSample = bindValues.values().iterator().next(); List<String> bindSampleValues = (List<String>) bindSample.getValue(); return bindValues.size() * bindSampleValues.size(); } }
[ "public", "static", "int", "arrayBindValueCount", "(", "Map", "<", "String", ",", "ParameterBindingDTO", ">", "bindValues", ")", "{", "if", "(", "!", "isArrayBind", "(", "bindValues", ")", ")", "{", "return", "0", ";", "}", "else", "{", "ParameterBindingDTO", "bindSample", "=", "bindValues", ".", "values", "(", ")", ".", "iterator", "(", ")", ".", "next", "(", ")", ";", "List", "<", "String", ">", "bindSampleValues", "=", "(", "List", "<", "String", ">", ")", "bindSample", ".", "getValue", "(", ")", ";", "return", "bindValues", ".", "size", "(", ")", "*", "bindSampleValues", ".", "size", "(", ")", ";", "}", "}" ]
Compute the number of array bind values in the given bind map @param bindValues the bind map @return 0 if bindValues is null, has no binds, or is not an array bind n otherwise, where n is the number of binds in the array bind
[ "Compute", "the", "number", "of", "array", "bind", "values", "in", "the", "given", "bind", "map" ]
train
https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L568-L580
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Searcher.java
Searcher.getViewFromList
private WebElement getViewFromList(List<WebElement> webElements, int match) { """ Returns a text view with a given match. @param webElements the list of views @param match the match of the view to return @return the view with a given match """ WebElement webElementToReturn = null; if(webElements.size() >= match){ try{ webElementToReturn = webElements.get(--match); }catch(Exception ignored){} } if(webElementToReturn != null) webElements.clear(); return webElementToReturn; }
java
private WebElement getViewFromList(List<WebElement> webElements, int match){ WebElement webElementToReturn = null; if(webElements.size() >= match){ try{ webElementToReturn = webElements.get(--match); }catch(Exception ignored){} } if(webElementToReturn != null) webElements.clear(); return webElementToReturn; }
[ "private", "WebElement", "getViewFromList", "(", "List", "<", "WebElement", ">", "webElements", ",", "int", "match", ")", "{", "WebElement", "webElementToReturn", "=", "null", ";", "if", "(", "webElements", ".", "size", "(", ")", ">=", "match", ")", "{", "try", "{", "webElementToReturn", "=", "webElements", ".", "get", "(", "--", "match", ")", ";", "}", "catch", "(", "Exception", "ignored", ")", "{", "}", "}", "if", "(", "webElementToReturn", "!=", "null", ")", "webElements", ".", "clear", "(", ")", ";", "return", "webElementToReturn", ";", "}" ]
Returns a text view with a given match. @param webElements the list of views @param match the match of the view to return @return the view with a given match
[ "Returns", "a", "text", "view", "with", "a", "given", "match", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Searcher.java#L282-L296
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/AutomationAccountsInner.java
AutomationAccountsInner.createOrUpdate
public AutomationAccountInner createOrUpdate(String resourceGroupName, String automationAccountName, AutomationAccountCreateOrUpdateParameters parameters) { """ Create or update automation account. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param parameters Parameters supplied to the create or update automation account. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the AutomationAccountInner object if successful. """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, parameters).toBlocking().single().body(); }
java
public AutomationAccountInner createOrUpdate(String resourceGroupName, String automationAccountName, AutomationAccountCreateOrUpdateParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, parameters).toBlocking().single().body(); }
[ "public", "AutomationAccountInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "AutomationAccountCreateOrUpdateParameters", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Create or update automation account. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param parameters Parameters supplied to the create or update automation account. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the AutomationAccountInner object if successful.
[ "Create", "or", "update", "automation", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/AutomationAccountsInner.java#L207-L209
aws/aws-sdk-java
aws-java-sdk-iot1clickdevices/src/main/java/com/amazonaws/services/iot1clickdevices/model/DeviceDescription.java
DeviceDescription.withTags
public DeviceDescription withTags(java.util.Map<String, String> tags) { """ <p> The tags currently associated with the AWS IoT 1-Click device. </p> @param tags The tags currently associated with the AWS IoT 1-Click device. @return Returns a reference to this object so that method calls can be chained together. """ setTags(tags); return this; }
java
public DeviceDescription withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "DeviceDescription", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> The tags currently associated with the AWS IoT 1-Click device. </p> @param tags The tags currently associated with the AWS IoT 1-Click device. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "tags", "currently", "associated", "with", "the", "AWS", "IoT", "1", "-", "Click", "device", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot1clickdevices/src/main/java/com/amazonaws/services/iot1clickdevices/model/DeviceDescription.java#L379-L382
aws/aws-sdk-java
aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/PartitionInput.java
PartitionInput.withParameters
public PartitionInput withParameters(java.util.Map<String, String> parameters) { """ <p> These key-value pairs define partition parameters. </p> @param parameters These key-value pairs define partition parameters. @return Returns a reference to this object so that method calls can be chained together. """ setParameters(parameters); return this; }
java
public PartitionInput withParameters(java.util.Map<String, String> parameters) { setParameters(parameters); return this; }
[ "public", "PartitionInput", "withParameters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "parameters", ")", "{", "setParameters", "(", "parameters", ")", ";", "return", "this", ";", "}" ]
<p> These key-value pairs define partition parameters. </p> @param parameters These key-value pairs define partition parameters. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "These", "key", "-", "value", "pairs", "define", "partition", "parameters", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/PartitionInput.java#L256-L259
drinkjava2/jBeanBox
jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/tree/analysis/Analyzer.java
Analyzer.newControlFlowExceptionEdge
protected boolean newControlFlowExceptionEdge(final int insn, final TryCatchBlockNode tcb) { """ Creates a control flow graph edge corresponding to an exception handler. The default implementation of this method delegates to {@link #newControlFlowExceptionEdge(int, int) newControlFlowExceptionEdge(int, int)}. It can be overridden in order to construct the control flow graph of a method (this method is called by the {@link #analyze analyze} method during its visit of the method's code). @param insn an instruction index. @param tcb TryCatchBlockNode corresponding to this edge. @return true if this edge must be considered in the data flow analysis performed by this analyzer, or false otherwise. The default implementation of this method delegates to {@link #newControlFlowExceptionEdge(int, int) newControlFlowExceptionEdge(int, int)}. """ return newControlFlowExceptionEdge(insn, insns.indexOf(tcb.handler)); }
java
protected boolean newControlFlowExceptionEdge(final int insn, final TryCatchBlockNode tcb) { return newControlFlowExceptionEdge(insn, insns.indexOf(tcb.handler)); }
[ "protected", "boolean", "newControlFlowExceptionEdge", "(", "final", "int", "insn", ",", "final", "TryCatchBlockNode", "tcb", ")", "{", "return", "newControlFlowExceptionEdge", "(", "insn", ",", "insns", ".", "indexOf", "(", "tcb", ".", "handler", ")", ")", ";", "}" ]
Creates a control flow graph edge corresponding to an exception handler. The default implementation of this method delegates to {@link #newControlFlowExceptionEdge(int, int) newControlFlowExceptionEdge(int, int)}. It can be overridden in order to construct the control flow graph of a method (this method is called by the {@link #analyze analyze} method during its visit of the method's code). @param insn an instruction index. @param tcb TryCatchBlockNode corresponding to this edge. @return true if this edge must be considered in the data flow analysis performed by this analyzer, or false otherwise. The default implementation of this method delegates to {@link #newControlFlowExceptionEdge(int, int) newControlFlowExceptionEdge(int, int)}.
[ "Creates", "a", "control", "flow", "graph", "edge", "corresponding", "to", "an", "exception", "handler", ".", "The", "default", "implementation", "of", "this", "method", "delegates", "to", "{", "@link", "#newControlFlowExceptionEdge", "(", "int", "int", ")", "newControlFlowExceptionEdge", "(", "int", "int", ")", "}", ".", "It", "can", "be", "overridden", "in", "order", "to", "construct", "the", "control", "flow", "graph", "of", "a", "method", "(", "this", "method", "is", "called", "by", "the", "{", "@link", "#analyze", "analyze", "}", "method", "during", "its", "visit", "of", "the", "method", "s", "code", ")", "." ]
train
https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/tree/analysis/Analyzer.java#L490-L493
alkacon/opencms-core
src-gwt/org/opencms/ui/client/contextmenu/CmsContextMenuWidget.java
CmsContextMenuWidget.setStyleNames
private void setStyleNames(CmsContextMenuItemWidget item, Set<String> styles) { """ Adds the given style names to the item widget.<p> @param item the item @param styles the style names """ for (String style : styles) { item.addStyleName(style); } }
java
private void setStyleNames(CmsContextMenuItemWidget item, Set<String> styles) { for (String style : styles) { item.addStyleName(style); } }
[ "private", "void", "setStyleNames", "(", "CmsContextMenuItemWidget", "item", ",", "Set", "<", "String", ">", "styles", ")", "{", "for", "(", "String", "style", ":", "styles", ")", "{", "item", ".", "addStyleName", "(", "style", ")", ";", "}", "}" ]
Adds the given style names to the item widget.<p> @param item the item @param styles the style names
[ "Adds", "the", "given", "style", "names", "to", "the", "item", "widget", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ui/client/contextmenu/CmsContextMenuWidget.java#L288-L293
powermock/powermock
powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java
WhiteboxImpl.setInternalState
public static void setInternalState(Object object, Class<?> fieldType, Object value) { """ Set the value of a field using reflection. This method will traverse the super class hierarchy until the first field of type <tt>fieldType</tt> is found. The <tt>value</tt> will then be assigned to this field. @param object the object to modify @param fieldType the type of the field @param value the new value of the field """ setField(object, value, findFieldInHierarchy(object, new AssignableFromFieldTypeMatcherStrategy(fieldType))); }
java
public static void setInternalState(Object object, Class<?> fieldType, Object value) { setField(object, value, findFieldInHierarchy(object, new AssignableFromFieldTypeMatcherStrategy(fieldType))); }
[ "public", "static", "void", "setInternalState", "(", "Object", "object", ",", "Class", "<", "?", ">", "fieldType", ",", "Object", "value", ")", "{", "setField", "(", "object", ",", "value", ",", "findFieldInHierarchy", "(", "object", ",", "new", "AssignableFromFieldTypeMatcherStrategy", "(", "fieldType", ")", ")", ")", ";", "}" ]
Set the value of a field using reflection. This method will traverse the super class hierarchy until the first field of type <tt>fieldType</tt> is found. The <tt>value</tt> will then be assigned to this field. @param object the object to modify @param fieldType the type of the field @param value the new value of the field
[ "Set", "the", "value", "of", "a", "field", "using", "reflection", ".", "This", "method", "will", "traverse", "the", "super", "class", "hierarchy", "until", "the", "first", "field", "of", "type", "<tt", ">", "fieldType<", "/", "tt", ">", "is", "found", ".", "The", "<tt", ">", "value<", "/", "tt", ">", "will", "then", "be", "assigned", "to", "this", "field", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L329-L331
alkacon/opencms-core
src/org/opencms/file/types/CmsResourceTypeFunctionConfig.java
CmsResourceTypeFunctionConfig.writeFile
@Override public CmsFile writeFile(CmsObject cms, CmsSecurityManager securityManager, CmsFile resource) throws CmsException { """ @see org.opencms.file.types.CmsResourceTypeXmlContent#writeFile(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, org.opencms.file.CmsFile) After writing the file, this method waits until the formatter configuration is update the next time. """ String savingStr = (String)cms.getRequestContext().getAttribute(CmsContentService.ATTR_EDITOR_SAVING); CmsFile file = super.writeFile(cms, securityManager, resource); // Formatter configuration cache updates are asynchronous, but to be able to reload a container page // element in the page editor directly after editing it and having it reflect the changes made by the user // requires that we wait on a wait handle for the formatter cache. if (Boolean.valueOf(savingStr).booleanValue()) { CmsWaitHandle waitHandle = OpenCms.getADEManager().addFormatterCacheWaitHandle(false); waitHandle.enter(10000); } return file; }
java
@Override public CmsFile writeFile(CmsObject cms, CmsSecurityManager securityManager, CmsFile resource) throws CmsException { String savingStr = (String)cms.getRequestContext().getAttribute(CmsContentService.ATTR_EDITOR_SAVING); CmsFile file = super.writeFile(cms, securityManager, resource); // Formatter configuration cache updates are asynchronous, but to be able to reload a container page // element in the page editor directly after editing it and having it reflect the changes made by the user // requires that we wait on a wait handle for the formatter cache. if (Boolean.valueOf(savingStr).booleanValue()) { CmsWaitHandle waitHandle = OpenCms.getADEManager().addFormatterCacheWaitHandle(false); waitHandle.enter(10000); } return file; }
[ "@", "Override", "public", "CmsFile", "writeFile", "(", "CmsObject", "cms", ",", "CmsSecurityManager", "securityManager", ",", "CmsFile", "resource", ")", "throws", "CmsException", "{", "String", "savingStr", "=", "(", "String", ")", "cms", ".", "getRequestContext", "(", ")", ".", "getAttribute", "(", "CmsContentService", ".", "ATTR_EDITOR_SAVING", ")", ";", "CmsFile", "file", "=", "super", ".", "writeFile", "(", "cms", ",", "securityManager", ",", "resource", ")", ";", "// Formatter configuration cache updates are asynchronous, but to be able to reload a container page", "// element in the page editor directly after editing it and having it reflect the changes made by the user", "// requires that we wait on a wait handle for the formatter cache.", "if", "(", "Boolean", ".", "valueOf", "(", "savingStr", ")", ".", "booleanValue", "(", ")", ")", "{", "CmsWaitHandle", "waitHandle", "=", "OpenCms", ".", "getADEManager", "(", ")", ".", "addFormatterCacheWaitHandle", "(", "false", ")", ";", "waitHandle", ".", "enter", "(", "10000", ")", ";", "}", "return", "file", ";", "}" ]
@see org.opencms.file.types.CmsResourceTypeXmlContent#writeFile(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, org.opencms.file.CmsFile) After writing the file, this method waits until the formatter configuration is update the next time.
[ "@see", "org", ".", "opencms", ".", "file", ".", "types", ".", "CmsResourceTypeXmlContent#writeFile", "(", "org", ".", "opencms", ".", "file", ".", "CmsObject", "org", ".", "opencms", ".", "db", ".", "CmsSecurityManager", "org", ".", "opencms", ".", "file", ".", "CmsFile", ")" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/types/CmsResourceTypeFunctionConfig.java#L88-L102
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/BeanO.java
BeanO.reAssociateHandleList
HandleListInterface reAssociateHandleList() // d662032 throws CSIException { """ Reassociates handles in the handle list associated with this bean, and returns a handle list to be pushed onto the thread handle list stack. @return the handle list to push onto the thread stack """ HandleListInterface hl; if (connectionHandleList == null) { hl = HandleListProxy.INSTANCE; } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "reAssociateHandleList: " + connectionHandleList); hl = connectionHandleList; try { hl.reAssociate(); } catch (Exception ex) { throw new CSIException("", ex); } } return hl; }
java
HandleListInterface reAssociateHandleList() // d662032 throws CSIException { HandleListInterface hl; if (connectionHandleList == null) { hl = HandleListProxy.INSTANCE; } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "reAssociateHandleList: " + connectionHandleList); hl = connectionHandleList; try { hl.reAssociate(); } catch (Exception ex) { throw new CSIException("", ex); } } return hl; }
[ "HandleListInterface", "reAssociateHandleList", "(", ")", "// d662032", "throws", "CSIException", "{", "HandleListInterface", "hl", ";", "if", "(", "connectionHandleList", "==", "null", ")", "{", "hl", "=", "HandleListProxy", ".", "INSTANCE", ";", "}", "else", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"reAssociateHandleList: \"", "+", "connectionHandleList", ")", ";", "hl", "=", "connectionHandleList", ";", "try", "{", "hl", ".", "reAssociate", "(", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "new", "CSIException", "(", "\"\"", ",", "ex", ")", ";", "}", "}", "return", "hl", ";", "}" ]
Reassociates handles in the handle list associated with this bean, and returns a handle list to be pushed onto the thread handle list stack. @return the handle list to push onto the thread stack
[ "Reassociates", "handles", "in", "the", "handle", "list", "associated", "with", "this", "bean", "and", "returns", "a", "handle", "list", "to", "be", "pushed", "onto", "the", "thread", "handle", "list", "stack", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/BeanO.java#L1782-L1807
googlegenomics/utils-java
src/main/java/com/google/cloud/genomics/utils/OfflineAuth.java
OfflineAuth.getCredential
public Credential getCredential() { """ Return the stored user credential, if applicable, or fall back to the Application Default Credential. @return The com.google.api.client.auth.oauth2.Credential object. """ if (hasStoredCredential()) { HttpTransport httpTransport; try { httpTransport = GoogleNetHttpTransport.newTrustedTransport(); } catch (IOException | GeneralSecurityException e) { throw new RuntimeException("Could not create HTTPS transport for use in credential creation", e); } return new GoogleCredential.Builder() .setJsonFactory(JacksonFactory.getDefaultInstance()) .setTransport(httpTransport) .setClientSecrets(getClientId(), getClientSecret()) .build() .setRefreshToken(getRefreshToken()); } return CredentialFactory.getApplicationDefaultCredential(); }
java
public Credential getCredential() { if (hasStoredCredential()) { HttpTransport httpTransport; try { httpTransport = GoogleNetHttpTransport.newTrustedTransport(); } catch (IOException | GeneralSecurityException e) { throw new RuntimeException("Could not create HTTPS transport for use in credential creation", e); } return new GoogleCredential.Builder() .setJsonFactory(JacksonFactory.getDefaultInstance()) .setTransport(httpTransport) .setClientSecrets(getClientId(), getClientSecret()) .build() .setRefreshToken(getRefreshToken()); } return CredentialFactory.getApplicationDefaultCredential(); }
[ "public", "Credential", "getCredential", "(", ")", "{", "if", "(", "hasStoredCredential", "(", ")", ")", "{", "HttpTransport", "httpTransport", ";", "try", "{", "httpTransport", "=", "GoogleNetHttpTransport", ".", "newTrustedTransport", "(", ")", ";", "}", "catch", "(", "IOException", "|", "GeneralSecurityException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Could not create HTTPS transport for use in credential creation\"", ",", "e", ")", ";", "}", "return", "new", "GoogleCredential", ".", "Builder", "(", ")", ".", "setJsonFactory", "(", "JacksonFactory", ".", "getDefaultInstance", "(", ")", ")", ".", "setTransport", "(", "httpTransport", ")", ".", "setClientSecrets", "(", "getClientId", "(", ")", ",", "getClientSecret", "(", ")", ")", ".", "build", "(", ")", ".", "setRefreshToken", "(", "getRefreshToken", "(", ")", ")", ";", "}", "return", "CredentialFactory", ".", "getApplicationDefaultCredential", "(", ")", ";", "}" ]
Return the stored user credential, if applicable, or fall back to the Application Default Credential. @return The com.google.api.client.auth.oauth2.Credential object.
[ "Return", "the", "stored", "user", "credential", "if", "applicable", "or", "fall", "back", "to", "the", "Application", "Default", "Credential", "." ]
train
https://github.com/googlegenomics/utils-java/blob/7205d5b4e4f61fc6b93acb4bdd76b93df5b5f612/src/main/java/com/google/cloud/genomics/utils/OfflineAuth.java#L141-L158
infinispan/infinispan
core/src/main/java/org/infinispan/functional/impl/FunctionalMapImpl.java
FunctionalMapImpl.findDecoratedCache
private DecoratedCache<K, V> findDecoratedCache(Cache<K, V> cache) { """ Finds the first decorated cache if there are delegates surrounding it otherwise null """ if (cache instanceof AbstractDelegatingCache) { if (cache instanceof DecoratedCache) { return ((DecoratedCache<K, V>) cache); } return findDecoratedCache(((AbstractDelegatingCache<K, V>) cache).getDelegate()); } return null; }
java
private DecoratedCache<K, V> findDecoratedCache(Cache<K, V> cache) { if (cache instanceof AbstractDelegatingCache) { if (cache instanceof DecoratedCache) { return ((DecoratedCache<K, V>) cache); } return findDecoratedCache(((AbstractDelegatingCache<K, V>) cache).getDelegate()); } return null; }
[ "private", "DecoratedCache", "<", "K", ",", "V", ">", "findDecoratedCache", "(", "Cache", "<", "K", ",", "V", ">", "cache", ")", "{", "if", "(", "cache", "instanceof", "AbstractDelegatingCache", ")", "{", "if", "(", "cache", "instanceof", "DecoratedCache", ")", "{", "return", "(", "(", "DecoratedCache", "<", "K", ",", "V", ">", ")", "cache", ")", ";", "}", "return", "findDecoratedCache", "(", "(", "(", "AbstractDelegatingCache", "<", "K", ",", "V", ">", ")", "cache", ")", ".", "getDelegate", "(", ")", ")", ";", "}", "return", "null", ";", "}" ]
Finds the first decorated cache if there are delegates surrounding it otherwise null
[ "Finds", "the", "first", "decorated", "cache", "if", "there", "are", "delegates", "surrounding", "it", "otherwise", "null" ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/functional/impl/FunctionalMapImpl.java#L66-L74
rey5137/material
material/src/main/java/com/rey/material/widget/EditText.java
EditText.performFiltering
protected void performFiltering(CharSequence text, int keyCode) { """ <p>Starts filtering the content of the drop down list. The filtering pattern is the content of the edit box. Subclasses should override this method to filter with a different pattern, for instance a substring of <code>text</code>.</p> @param text the filtering pattern @param keyCode the last character inserted in the edit box; beware that this will be null when text is being added through a soft input method. """ switch (mAutoCompleteMode){ case AUTOCOMPLETE_MODE_SINGLE: ((InternalAutoCompleteTextView)mInputView).superPerformFiltering(text, keyCode); break; case AUTOCOMPLETE_MODE_MULTI: ((InternalMultiAutoCompleteTextView)mInputView).superPerformFiltering(text, keyCode); break; } }
java
protected void performFiltering(CharSequence text, int keyCode) { switch (mAutoCompleteMode){ case AUTOCOMPLETE_MODE_SINGLE: ((InternalAutoCompleteTextView)mInputView).superPerformFiltering(text, keyCode); break; case AUTOCOMPLETE_MODE_MULTI: ((InternalMultiAutoCompleteTextView)mInputView).superPerformFiltering(text, keyCode); break; } }
[ "protected", "void", "performFiltering", "(", "CharSequence", "text", ",", "int", "keyCode", ")", "{", "switch", "(", "mAutoCompleteMode", ")", "{", "case", "AUTOCOMPLETE_MODE_SINGLE", ":", "(", "(", "InternalAutoCompleteTextView", ")", "mInputView", ")", ".", "superPerformFiltering", "(", "text", ",", "keyCode", ")", ";", "break", ";", "case", "AUTOCOMPLETE_MODE_MULTI", ":", "(", "(", "InternalMultiAutoCompleteTextView", ")", "mInputView", ")", ".", "superPerformFiltering", "(", "text", ",", "keyCode", ")", ";", "break", ";", "}", "}" ]
<p>Starts filtering the content of the drop down list. The filtering pattern is the content of the edit box. Subclasses should override this method to filter with a different pattern, for instance a substring of <code>text</code>.</p> @param text the filtering pattern @param keyCode the last character inserted in the edit box; beware that this will be null when text is being added through a soft input method.
[ "<p", ">", "Starts", "filtering", "the", "content", "of", "the", "drop", "down", "list", ".", "The", "filtering", "pattern", "is", "the", "content", "of", "the", "edit", "box", ".", "Subclasses", "should", "override", "this", "method", "to", "filter", "with", "a", "different", "pattern", "for", "instance", "a", "substring", "of", "<code", ">", "text<", "/", "code", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/EditText.java#L739-L748
igniterealtime/Smack
smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java
Roster.createItemAndRequestSubscription
public void createItemAndRequestSubscription(BareJid jid, String name, String[] groups) throws NotLoggedInException, NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { """ Creates a new roster entry and presence subscription. The server will asynchronously update the roster with the subscription status. @param jid the XMPP address of the contact (e.g. [email protected]) @param name the nickname of the user. @param groups the list of group names the entry will belong to, or <tt>null</tt> if the the roster entry won't belong to a group. @throws NoResponseException if there was no response from the server. @throws XMPPErrorException if an XMPP exception occurs. @throws NotLoggedInException If not logged in. @throws NotConnectedException @throws InterruptedException @since 4.4.0 """ createItem(jid, name, groups); sendSubscriptionRequest(jid); }
java
public void createItemAndRequestSubscription(BareJid jid, String name, String[] groups) throws NotLoggedInException, NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { createItem(jid, name, groups); sendSubscriptionRequest(jid); }
[ "public", "void", "createItemAndRequestSubscription", "(", "BareJid", "jid", ",", "String", "name", ",", "String", "[", "]", "groups", ")", "throws", "NotLoggedInException", ",", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "createItem", "(", "jid", ",", "name", ",", "groups", ")", ";", "sendSubscriptionRequest", "(", "jid", ")", ";", "}" ]
Creates a new roster entry and presence subscription. The server will asynchronously update the roster with the subscription status. @param jid the XMPP address of the contact (e.g. [email protected]) @param name the nickname of the user. @param groups the list of group names the entry will belong to, or <tt>null</tt> if the the roster entry won't belong to a group. @throws NoResponseException if there was no response from the server. @throws XMPPErrorException if an XMPP exception occurs. @throws NotLoggedInException If not logged in. @throws NotConnectedException @throws InterruptedException @since 4.4.0
[ "Creates", "a", "new", "roster", "entry", "and", "presence", "subscription", ".", "The", "server", "will", "asynchronously", "update", "the", "roster", "with", "the", "subscription", "status", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java#L707-L711
apache/incubator-shardingsphere
sharding-core/sharding-core-execute/src/main/java/org/apache/shardingsphere/core/execute/sql/execute/result/QueryResultUtil.java
QueryResultUtil.getValue
public static Object getValue(final ResultSet resultSet, final int columnIndex) throws SQLException { """ Get value. @param resultSet result set @param columnIndex column index of value @return {@code null} if the column is SQL {@code NULL}, otherwise the value of column @throws SQLException SQL exception """ Object result = getValueByColumnType(resultSet, columnIndex); return resultSet.wasNull() ? null : result; }
java
public static Object getValue(final ResultSet resultSet, final int columnIndex) throws SQLException { Object result = getValueByColumnType(resultSet, columnIndex); return resultSet.wasNull() ? null : result; }
[ "public", "static", "Object", "getValue", "(", "final", "ResultSet", "resultSet", ",", "final", "int", "columnIndex", ")", "throws", "SQLException", "{", "Object", "result", "=", "getValueByColumnType", "(", "resultSet", ",", "columnIndex", ")", ";", "return", "resultSet", ".", "wasNull", "(", ")", "?", "null", ":", "result", ";", "}" ]
Get value. @param resultSet result set @param columnIndex column index of value @return {@code null} if the column is SQL {@code NULL}, otherwise the value of column @throws SQLException SQL exception
[ "Get", "value", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-execute/src/main/java/org/apache/shardingsphere/core/execute/sql/execute/result/QueryResultUtil.java#L40-L43
structurizr/java
structurizr-analysis/src/com/structurizr/analysis/TypeUtils.java
TypeUtils.getVisibility
public static TypeVisibility getVisibility(TypeRepository typeRepository, String typeName) { """ Finds the visibility of a given type. @param typeRepository the repository where types should be loaded from @param typeName the fully qualified type name @return a TypeVisibility object representing the visibility (e.g. public, package, etc) """ try { Class<?> type = typeRepository.loadClass(typeName); int modifiers = type.getModifiers(); if (Modifier.isPrivate(modifiers)) { return TypeVisibility.PRIVATE; } else if (Modifier.isPublic(modifiers)) { return TypeVisibility.PUBLIC; } else if (Modifier.isProtected(modifiers)) { return TypeVisibility.PROTECTED; } else { return TypeVisibility.PACKAGE; } } catch (ClassNotFoundException e) { log.warn("Visibility for type " + typeName + " could not be found."); return null; } }
java
public static TypeVisibility getVisibility(TypeRepository typeRepository, String typeName) { try { Class<?> type = typeRepository.loadClass(typeName); int modifiers = type.getModifiers(); if (Modifier.isPrivate(modifiers)) { return TypeVisibility.PRIVATE; } else if (Modifier.isPublic(modifiers)) { return TypeVisibility.PUBLIC; } else if (Modifier.isProtected(modifiers)) { return TypeVisibility.PROTECTED; } else { return TypeVisibility.PACKAGE; } } catch (ClassNotFoundException e) { log.warn("Visibility for type " + typeName + " could not be found."); return null; } }
[ "public", "static", "TypeVisibility", "getVisibility", "(", "TypeRepository", "typeRepository", ",", "String", "typeName", ")", "{", "try", "{", "Class", "<", "?", ">", "type", "=", "typeRepository", ".", "loadClass", "(", "typeName", ")", ";", "int", "modifiers", "=", "type", ".", "getModifiers", "(", ")", ";", "if", "(", "Modifier", ".", "isPrivate", "(", "modifiers", ")", ")", "{", "return", "TypeVisibility", ".", "PRIVATE", ";", "}", "else", "if", "(", "Modifier", ".", "isPublic", "(", "modifiers", ")", ")", "{", "return", "TypeVisibility", ".", "PUBLIC", ";", "}", "else", "if", "(", "Modifier", ".", "isProtected", "(", "modifiers", ")", ")", "{", "return", "TypeVisibility", ".", "PROTECTED", ";", "}", "else", "{", "return", "TypeVisibility", ".", "PACKAGE", ";", "}", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "log", ".", "warn", "(", "\"Visibility for type \"", "+", "typeName", "+", "\" could not be found.\"", ")", ";", "return", "null", ";", "}", "}" ]
Finds the visibility of a given type. @param typeRepository the repository where types should be loaded from @param typeName the fully qualified type name @return a TypeVisibility object representing the visibility (e.g. public, package, etc)
[ "Finds", "the", "visibility", "of", "a", "given", "type", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-analysis/src/com/structurizr/analysis/TypeUtils.java#L25-L42
Impetus/Kundera
src/kundera-neo4j/src/main/java/com/impetus/client/neo4j/GraphEntityMapper.java
GraphEntityMapper.serializeIdAttributeValue
private String serializeIdAttributeValue(final EntityMetadata m, MetamodelImpl metaModel, Object id) { """ Prepares ID column value for embedded IDs by combining its attributes @param m @param id @param metaModel @return """ if (!metaModel.isEmbeddable(m.getIdAttribute().getBindableJavaType())) { return null; } Class<?> embeddableClass = m.getIdAttribute().getBindableJavaType(); String idUniqueValue = ""; for (Field embeddedField : embeddableClass.getDeclaredFields()) { if (!ReflectUtils.isTransientOrStatic(embeddedField)) { Object value = PropertyAccessorHelper.getObject(id, embeddedField); if (value != null && !StringUtils.isEmpty(value.toString())) idUniqueValue = idUniqueValue + value + COMPOSITE_KEY_SEPARATOR; } } if (idUniqueValue.endsWith(COMPOSITE_KEY_SEPARATOR)) idUniqueValue = idUniqueValue.substring(0, idUniqueValue.length() - COMPOSITE_KEY_SEPARATOR.length()); return idUniqueValue; }
java
private String serializeIdAttributeValue(final EntityMetadata m, MetamodelImpl metaModel, Object id) { if (!metaModel.isEmbeddable(m.getIdAttribute().getBindableJavaType())) { return null; } Class<?> embeddableClass = m.getIdAttribute().getBindableJavaType(); String idUniqueValue = ""; for (Field embeddedField : embeddableClass.getDeclaredFields()) { if (!ReflectUtils.isTransientOrStatic(embeddedField)) { Object value = PropertyAccessorHelper.getObject(id, embeddedField); if (value != null && !StringUtils.isEmpty(value.toString())) idUniqueValue = idUniqueValue + value + COMPOSITE_KEY_SEPARATOR; } } if (idUniqueValue.endsWith(COMPOSITE_KEY_SEPARATOR)) idUniqueValue = idUniqueValue.substring(0, idUniqueValue.length() - COMPOSITE_KEY_SEPARATOR.length()); return idUniqueValue; }
[ "private", "String", "serializeIdAttributeValue", "(", "final", "EntityMetadata", "m", ",", "MetamodelImpl", "metaModel", ",", "Object", "id", ")", "{", "if", "(", "!", "metaModel", ".", "isEmbeddable", "(", "m", ".", "getIdAttribute", "(", ")", ".", "getBindableJavaType", "(", ")", ")", ")", "{", "return", "null", ";", "}", "Class", "<", "?", ">", "embeddableClass", "=", "m", ".", "getIdAttribute", "(", ")", ".", "getBindableJavaType", "(", ")", ";", "String", "idUniqueValue", "=", "\"\"", ";", "for", "(", "Field", "embeddedField", ":", "embeddableClass", ".", "getDeclaredFields", "(", ")", ")", "{", "if", "(", "!", "ReflectUtils", ".", "isTransientOrStatic", "(", "embeddedField", ")", ")", "{", "Object", "value", "=", "PropertyAccessorHelper", ".", "getObject", "(", "id", ",", "embeddedField", ")", ";", "if", "(", "value", "!=", "null", "&&", "!", "StringUtils", ".", "isEmpty", "(", "value", ".", "toString", "(", ")", ")", ")", "idUniqueValue", "=", "idUniqueValue", "+", "value", "+", "COMPOSITE_KEY_SEPARATOR", ";", "}", "}", "if", "(", "idUniqueValue", ".", "endsWith", "(", "COMPOSITE_KEY_SEPARATOR", ")", ")", "idUniqueValue", "=", "idUniqueValue", ".", "substring", "(", "0", ",", "idUniqueValue", ".", "length", "(", ")", "-", "COMPOSITE_KEY_SEPARATOR", ".", "length", "(", ")", ")", ";", "return", "idUniqueValue", ";", "}" ]
Prepares ID column value for embedded IDs by combining its attributes @param m @param id @param metaModel @return
[ "Prepares", "ID", "column", "value", "for", "embedded", "IDs", "by", "combining", "its", "attributes" ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-neo4j/src/main/java/com/impetus/client/neo4j/GraphEntityMapper.java#L512-L536
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepsInner.java
JobStepsInner.getByVersionAsync
public Observable<JobStepInner> getByVersionAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion, String stepName) { """ Gets the specified version of a job step. @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 jobAgentName The name of the job agent. @param jobName The name of the job. @param jobVersion The version of the job to get. @param stepName The name of the job step. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the JobStepInner object """ return getByVersionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName).map(new Func1<ServiceResponse<JobStepInner>, JobStepInner>() { @Override public JobStepInner call(ServiceResponse<JobStepInner> response) { return response.body(); } }); }
java
public Observable<JobStepInner> getByVersionAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion, String stepName) { return getByVersionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName).map(new Func1<ServiceResponse<JobStepInner>, JobStepInner>() { @Override public JobStepInner call(ServiceResponse<JobStepInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "JobStepInner", ">", "getByVersionAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "jobAgentName", ",", "String", "jobName", ",", "int", "jobVersion", ",", "String", "stepName", ")", "{", "return", "getByVersionWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "jobAgentName", ",", "jobName", ",", "jobVersion", ",", "stepName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "JobStepInner", ">", ",", "JobStepInner", ">", "(", ")", "{", "@", "Override", "public", "JobStepInner", "call", "(", "ServiceResponse", "<", "JobStepInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets the specified version of a job step. @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 jobAgentName The name of the job agent. @param jobName The name of the job. @param jobVersion The version of the job to get. @param stepName The name of the job step. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the JobStepInner object
[ "Gets", "the", "specified", "version", "of", "a", "job", "step", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepsInner.java#L289-L296
shrinkwrap/resolver
maven/impl-maven-archive/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/archive/plugins/Validate.java
Validate.isReadable
public static void isReadable(final File file, String message) throws IllegalArgumentException { """ Checks that the specified String is not null or empty and represents a readable file, throws exception if it is empty or null and does not represent a path to a file. @param path The path to check @param message The exception message @throws IllegalArgumentException Thrown if path is empty, null or invalid """ notNull(file, message); if (!file.exists() || !file.isFile() || !file.canRead()) { throw new IllegalArgumentException(message); } }
java
public static void isReadable(final File file, String message) throws IllegalArgumentException { notNull(file, message); if (!file.exists() || !file.isFile() || !file.canRead()) { throw new IllegalArgumentException(message); } }
[ "public", "static", "void", "isReadable", "(", "final", "File", "file", ",", "String", "message", ")", "throws", "IllegalArgumentException", "{", "notNull", "(", "file", ",", "message", ")", ";", "if", "(", "!", "file", ".", "exists", "(", ")", "||", "!", "file", ".", "isFile", "(", ")", "||", "!", "file", ".", "canRead", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "}" ]
Checks that the specified String is not null or empty and represents a readable file, throws exception if it is empty or null and does not represent a path to a file. @param path The path to check @param message The exception message @throws IllegalArgumentException Thrown if path is empty, null or invalid
[ "Checks", "that", "the", "specified", "String", "is", "not", "null", "or", "empty", "and", "represents", "a", "readable", "file", "throws", "exception", "if", "it", "is", "empty", "or", "null", "and", "does", "not", "represent", "a", "path", "to", "a", "file", "." ]
train
https://github.com/shrinkwrap/resolver/blob/e881a84b8cff5b0a014f2a5ebf612be3eb9db01f/maven/impl-maven-archive/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/archive/plugins/Validate.java#L185-L190
arquillian/arquillian-cube
core/src/main/java/org/arquillian/cube/impl/util/Timespan.java
Timespan.substractWithZeroFloor
public Timespan substractWithZeroFloor(Timespan other) { """ Creates and returns a new timespan whose duration is {@code this} timespan's duration minus the {@code other} timespan's duration. <p> The time unit is preserved if {@code other} has the same unit as {@code this}. <p> Negative timespans are not supported, so if the {@code other} timespan duration is greater than {@code this} timespan duration, a timespan of zero is returned (i.e., a negative timespan is never returned). @param other the timespan to subtract from this one @return a new timespan representing {@code this - other} """ if (getTimeUnit() == other.getTimeUnit()) { long delta = Math.max(0, getDuration() - other.getDuration()); return new Timespan(delta, getTimeUnit()); } long delta = Math.max(0, getDurationInMilliseconds() - other.getDurationInMilliseconds()); return new Timespan(delta, TimeUnit.MILLISECOND); }
java
public Timespan substractWithZeroFloor(Timespan other) { if (getTimeUnit() == other.getTimeUnit()) { long delta = Math.max(0, getDuration() - other.getDuration()); return new Timespan(delta, getTimeUnit()); } long delta = Math.max(0, getDurationInMilliseconds() - other.getDurationInMilliseconds()); return new Timespan(delta, TimeUnit.MILLISECOND); }
[ "public", "Timespan", "substractWithZeroFloor", "(", "Timespan", "other", ")", "{", "if", "(", "getTimeUnit", "(", ")", "==", "other", ".", "getTimeUnit", "(", ")", ")", "{", "long", "delta", "=", "Math", ".", "max", "(", "0", ",", "getDuration", "(", ")", "-", "other", ".", "getDuration", "(", ")", ")", ";", "return", "new", "Timespan", "(", "delta", ",", "getTimeUnit", "(", ")", ")", ";", "}", "long", "delta", "=", "Math", ".", "max", "(", "0", ",", "getDurationInMilliseconds", "(", ")", "-", "other", ".", "getDurationInMilliseconds", "(", ")", ")", ";", "return", "new", "Timespan", "(", "delta", ",", "TimeUnit", ".", "MILLISECOND", ")", ";", "}" ]
Creates and returns a new timespan whose duration is {@code this} timespan's duration minus the {@code other} timespan's duration. <p> The time unit is preserved if {@code other} has the same unit as {@code this}. <p> Negative timespans are not supported, so if the {@code other} timespan duration is greater than {@code this} timespan duration, a timespan of zero is returned (i.e., a negative timespan is never returned). @param other the timespan to subtract from this one @return a new timespan representing {@code this - other}
[ "Creates", "and", "returns", "a", "new", "timespan", "whose", "duration", "is", "{", "@code", "this", "}", "timespan", "s", "duration", "minus", "the", "{", "@code", "other", "}", "timespan", "s", "duration", ".", "<p", ">", "The", "time", "unit", "is", "preserved", "if", "{", "@code", "other", "}", "has", "the", "same", "unit", "as", "{", "@code", "this", "}", ".", "<p", ">", "Negative", "timespans", "are", "not", "supported", "so", "if", "the", "{", "@code", "other", "}", "timespan", "duration", "is", "greater", "than", "{", "@code", "this", "}", "timespan", "duration", "a", "timespan", "of", "zero", "is", "returned", "(", "i", ".", "e", ".", "a", "negative", "timespan", "is", "never", "returned", ")", "." ]
train
https://github.com/arquillian/arquillian-cube/blob/ce6b08062cc6ba2a68ecc29606bbae9acda5be13/core/src/main/java/org/arquillian/cube/impl/util/Timespan.java#L174-L183
facebookarchive/hadoop-20
src/contrib/corona/src/java/org/apache/hadoop/util/WebUtils.java
WebUtils.getPoolInfoHtml
public static PoolInfoHtml getPoolInfoHtml( Map<PoolInfo, PoolInfo> redirects, PoolInfo poolInfo) { """ Generate the appropriate HTML for pool name (redirected info if necessary) @param redirects @param poolInfo @return Pair of group and pool html """ String redirectAttributes = null; if (redirects != null) { PoolInfo destination = redirects.get(poolInfo); if (destination != null) { redirectAttributes = "Redirected to " + PoolInfo.createStringFromPoolInfo(destination); } } String spanTag = (redirectAttributes != null) ? "<span class=\"ui-state-disabled\" title=\"" + redirectAttributes + "\">" : "<span>"; String groupHtml = spanTag + poolInfo.getPoolGroupName() + "</span>"; String poolHtml = spanTag + (poolInfo.getPoolName() == null ? "-" : poolInfo.getPoolName()) + "</span>"; return new PoolInfoHtml(groupHtml, poolHtml); }
java
public static PoolInfoHtml getPoolInfoHtml( Map<PoolInfo, PoolInfo> redirects, PoolInfo poolInfo) { String redirectAttributes = null; if (redirects != null) { PoolInfo destination = redirects.get(poolInfo); if (destination != null) { redirectAttributes = "Redirected to " + PoolInfo.createStringFromPoolInfo(destination); } } String spanTag = (redirectAttributes != null) ? "<span class=\"ui-state-disabled\" title=\"" + redirectAttributes + "\">" : "<span>"; String groupHtml = spanTag + poolInfo.getPoolGroupName() + "</span>"; String poolHtml = spanTag + (poolInfo.getPoolName() == null ? "-" : poolInfo.getPoolName()) + "</span>"; return new PoolInfoHtml(groupHtml, poolHtml); }
[ "public", "static", "PoolInfoHtml", "getPoolInfoHtml", "(", "Map", "<", "PoolInfo", ",", "PoolInfo", ">", "redirects", ",", "PoolInfo", "poolInfo", ")", "{", "String", "redirectAttributes", "=", "null", ";", "if", "(", "redirects", "!=", "null", ")", "{", "PoolInfo", "destination", "=", "redirects", ".", "get", "(", "poolInfo", ")", ";", "if", "(", "destination", "!=", "null", ")", "{", "redirectAttributes", "=", "\"Redirected to \"", "+", "PoolInfo", ".", "createStringFromPoolInfo", "(", "destination", ")", ";", "}", "}", "String", "spanTag", "=", "(", "redirectAttributes", "!=", "null", ")", "?", "\"<span class=\\\"ui-state-disabled\\\" title=\\\"\"", "+", "redirectAttributes", "+", "\"\\\">\"", ":", "\"<span>\"", ";", "String", "groupHtml", "=", "spanTag", "+", "poolInfo", ".", "getPoolGroupName", "(", ")", "+", "\"</span>\"", ";", "String", "poolHtml", "=", "spanTag", "+", "(", "poolInfo", ".", "getPoolName", "(", ")", "==", "null", "?", "\"-\"", ":", "poolInfo", ".", "getPoolName", "(", ")", ")", "+", "\"</span>\"", ";", "return", "new", "PoolInfoHtml", "(", "groupHtml", ",", "poolHtml", ")", ";", "}" ]
Generate the appropriate HTML for pool name (redirected info if necessary) @param redirects @param poolInfo @return Pair of group and pool html
[ "Generate", "the", "appropriate", "HTML", "for", "pool", "name", "(", "redirected", "info", "if", "necessary", ")" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/util/WebUtils.java#L234-L255
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/property/A_CmsPropertyEditor.java
A_CmsPropertyEditor.createUrlNameField
protected CmsBasicFormField createUrlNameField() { """ Creates the text field for editing the URL name.<p> @return the newly created form field """ if (m_urlNameField != null) { m_urlNameField.unbind(); } String description = message(Messages.GUI_URLNAME_PROPERTY_DESC_0); String label = message(Messages.GUI_URLNAME_PROPERTY_0); final CmsTextBox textbox = new CmsTextBox(); textbox.setTriggerChangeOnKeyPress(true); textbox.setInhibitValidationForKeypresses(true); CmsBasicFormField result = new CmsBasicFormField(FIELD_URLNAME, description, label, null, textbox); result.getLayoutData().put("property", A_CmsPropertyEditor.FIELD_URLNAME); String urlName = m_handler.getName(); if (urlName == null) { urlName = ""; } String parent = CmsResource.getParentFolder(m_handler.getPath()); CmsUUID id = m_handler.getId(); result.setValidator(new CmsUrlNameValidator(parent, id)); I_CmsStringModel model = getUrlNameModel(urlName); result.getWidget().setFormValueAsString(model.getValue()); result.bind(model); //result.getWidget().setFormValueAsString(getUrlNameModel().getValue()); m_urlNameField = result; return result; }
java
protected CmsBasicFormField createUrlNameField() { if (m_urlNameField != null) { m_urlNameField.unbind(); } String description = message(Messages.GUI_URLNAME_PROPERTY_DESC_0); String label = message(Messages.GUI_URLNAME_PROPERTY_0); final CmsTextBox textbox = new CmsTextBox(); textbox.setTriggerChangeOnKeyPress(true); textbox.setInhibitValidationForKeypresses(true); CmsBasicFormField result = new CmsBasicFormField(FIELD_URLNAME, description, label, null, textbox); result.getLayoutData().put("property", A_CmsPropertyEditor.FIELD_URLNAME); String urlName = m_handler.getName(); if (urlName == null) { urlName = ""; } String parent = CmsResource.getParentFolder(m_handler.getPath()); CmsUUID id = m_handler.getId(); result.setValidator(new CmsUrlNameValidator(parent, id)); I_CmsStringModel model = getUrlNameModel(urlName); result.getWidget().setFormValueAsString(model.getValue()); result.bind(model); //result.getWidget().setFormValueAsString(getUrlNameModel().getValue()); m_urlNameField = result; return result; }
[ "protected", "CmsBasicFormField", "createUrlNameField", "(", ")", "{", "if", "(", "m_urlNameField", "!=", "null", ")", "{", "m_urlNameField", ".", "unbind", "(", ")", ";", "}", "String", "description", "=", "message", "(", "Messages", ".", "GUI_URLNAME_PROPERTY_DESC_0", ")", ";", "String", "label", "=", "message", "(", "Messages", ".", "GUI_URLNAME_PROPERTY_0", ")", ";", "final", "CmsTextBox", "textbox", "=", "new", "CmsTextBox", "(", ")", ";", "textbox", ".", "setTriggerChangeOnKeyPress", "(", "true", ")", ";", "textbox", ".", "setInhibitValidationForKeypresses", "(", "true", ")", ";", "CmsBasicFormField", "result", "=", "new", "CmsBasicFormField", "(", "FIELD_URLNAME", ",", "description", ",", "label", ",", "null", ",", "textbox", ")", ";", "result", ".", "getLayoutData", "(", ")", ".", "put", "(", "\"property\"", ",", "A_CmsPropertyEditor", ".", "FIELD_URLNAME", ")", ";", "String", "urlName", "=", "m_handler", ".", "getName", "(", ")", ";", "if", "(", "urlName", "==", "null", ")", "{", "urlName", "=", "\"\"", ";", "}", "String", "parent", "=", "CmsResource", ".", "getParentFolder", "(", "m_handler", ".", "getPath", "(", ")", ")", ";", "CmsUUID", "id", "=", "m_handler", ".", "getId", "(", ")", ";", "result", ".", "setValidator", "(", "new", "CmsUrlNameValidator", "(", "parent", ",", "id", ")", ")", ";", "I_CmsStringModel", "model", "=", "getUrlNameModel", "(", "urlName", ")", ";", "result", ".", "getWidget", "(", ")", ".", "setFormValueAsString", "(", "model", ".", "getValue", "(", ")", ")", ";", "result", ".", "bind", "(", "model", ")", ";", "//result.getWidget().setFormValueAsString(getUrlNameModel().getValue());", "m_urlNameField", "=", "result", ";", "return", "result", ";", "}" ]
Creates the text field for editing the URL name.<p> @return the newly created form field
[ "Creates", "the", "text", "field", "for", "editing", "the", "URL", "name", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/property/A_CmsPropertyEditor.java#L233-L261
openbase/jul
communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java
AbstractRemoteClient.callMethod
@Override public <R> R callMethod(String methodName, long timeout) throws CouldNotPerformException, InterruptedException { """ {@inheritDoc} @throws org.openbase.jul.exception.CouldNotPerformException {@inheritDoc} @throws java.lang.InterruptedException {@inheritDoc} """ return callMethod(methodName, null, timeout); }
java
@Override public <R> R callMethod(String methodName, long timeout) throws CouldNotPerformException, InterruptedException { return callMethod(methodName, null, timeout); }
[ "@", "Override", "public", "<", "R", ">", "R", "callMethod", "(", "String", "methodName", ",", "long", "timeout", ")", "throws", "CouldNotPerformException", ",", "InterruptedException", "{", "return", "callMethod", "(", "methodName", ",", "null", ",", "timeout", ")", ";", "}" ]
{@inheritDoc} @throws org.openbase.jul.exception.CouldNotPerformException {@inheritDoc} @throws java.lang.InterruptedException {@inheritDoc}
[ "{", "@inheritDoc", "}" ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java#L751-L754
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzer.java
RubyBundleAuditAnalyzer.launchBundleAudit
private Process launchBundleAudit(File folder) throws AnalysisException { """ Launch bundle-audit. @param folder directory that contains bundle audit @return a handle to the process @throws AnalysisException thrown when there is an issue launching bundle audit """ if (!folder.isDirectory()) { throw new AnalysisException(String.format("%s should have been a directory.", folder.getAbsolutePath())); } final List<String> args = new ArrayList<>(); final String bundleAuditPath = getSettings().getString(Settings.KEYS.ANALYZER_BUNDLE_AUDIT_PATH); File bundleAudit = null; if (bundleAuditPath != null) { bundleAudit = new File(bundleAuditPath); if (!bundleAudit.isFile()) { LOGGER.warn("Supplied `bundleAudit` path is incorrect: {}", bundleAuditPath); bundleAudit = null; } } args.add(bundleAudit != null && bundleAudit.isFile() ? bundleAudit.getAbsolutePath() : "bundle-audit"); args.add("check"); args.add("--verbose"); final ProcessBuilder builder = new ProcessBuilder(args); builder.directory(folder); try { LOGGER.info("Launching: {} from {}", args, folder); return builder.start(); } catch (IOException ioe) { throw new AnalysisException("bundle-audit initialization failure; this error can be ignored if you are not analyzing Ruby. " + "Otherwise ensure that bundle-audit is installed and the path to bundle audit is correctly specified", ioe); } }
java
private Process launchBundleAudit(File folder) throws AnalysisException { if (!folder.isDirectory()) { throw new AnalysisException(String.format("%s should have been a directory.", folder.getAbsolutePath())); } final List<String> args = new ArrayList<>(); final String bundleAuditPath = getSettings().getString(Settings.KEYS.ANALYZER_BUNDLE_AUDIT_PATH); File bundleAudit = null; if (bundleAuditPath != null) { bundleAudit = new File(bundleAuditPath); if (!bundleAudit.isFile()) { LOGGER.warn("Supplied `bundleAudit` path is incorrect: {}", bundleAuditPath); bundleAudit = null; } } args.add(bundleAudit != null && bundleAudit.isFile() ? bundleAudit.getAbsolutePath() : "bundle-audit"); args.add("check"); args.add("--verbose"); final ProcessBuilder builder = new ProcessBuilder(args); builder.directory(folder); try { LOGGER.info("Launching: {} from {}", args, folder); return builder.start(); } catch (IOException ioe) { throw new AnalysisException("bundle-audit initialization failure; this error can be ignored if you are not analyzing Ruby. " + "Otherwise ensure that bundle-audit is installed and the path to bundle audit is correctly specified", ioe); } }
[ "private", "Process", "launchBundleAudit", "(", "File", "folder", ")", "throws", "AnalysisException", "{", "if", "(", "!", "folder", ".", "isDirectory", "(", ")", ")", "{", "throw", "new", "AnalysisException", "(", "String", ".", "format", "(", "\"%s should have been a directory.\"", ",", "folder", ".", "getAbsolutePath", "(", ")", ")", ")", ";", "}", "final", "List", "<", "String", ">", "args", "=", "new", "ArrayList", "<>", "(", ")", ";", "final", "String", "bundleAuditPath", "=", "getSettings", "(", ")", ".", "getString", "(", "Settings", ".", "KEYS", ".", "ANALYZER_BUNDLE_AUDIT_PATH", ")", ";", "File", "bundleAudit", "=", "null", ";", "if", "(", "bundleAuditPath", "!=", "null", ")", "{", "bundleAudit", "=", "new", "File", "(", "bundleAuditPath", ")", ";", "if", "(", "!", "bundleAudit", ".", "isFile", "(", ")", ")", "{", "LOGGER", ".", "warn", "(", "\"Supplied `bundleAudit` path is incorrect: {}\"", ",", "bundleAuditPath", ")", ";", "bundleAudit", "=", "null", ";", "}", "}", "args", ".", "add", "(", "bundleAudit", "!=", "null", "&&", "bundleAudit", ".", "isFile", "(", ")", "?", "bundleAudit", ".", "getAbsolutePath", "(", ")", ":", "\"bundle-audit\"", ")", ";", "args", ".", "add", "(", "\"check\"", ")", ";", "args", ".", "add", "(", "\"--verbose\"", ")", ";", "final", "ProcessBuilder", "builder", "=", "new", "ProcessBuilder", "(", "args", ")", ";", "builder", ".", "directory", "(", "folder", ")", ";", "try", "{", "LOGGER", ".", "info", "(", "\"Launching: {} from {}\"", ",", "args", ",", "folder", ")", ";", "return", "builder", ".", "start", "(", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "throw", "new", "AnalysisException", "(", "\"bundle-audit initialization failure; this error can be ignored if you are not analyzing Ruby. \"", "+", "\"Otherwise ensure that bundle-audit is installed and the path to bundle audit is correctly specified\"", ",", "ioe", ")", ";", "}", "}" ]
Launch bundle-audit. @param folder directory that contains bundle audit @return a handle to the process @throws AnalysisException thrown when there is an issue launching bundle audit
[ "Launch", "bundle", "-", "audit", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzer.java#L138-L164
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
JavacParser.memberReferenceSuffix
JCExpression memberReferenceSuffix(JCExpression t) { """ MemberReferenceSuffix = "::" [TypeArguments] Ident | "::" [TypeArguments] "new" """ int pos1 = token.pos; accept(COLCOL); return memberReferenceSuffix(pos1, t); }
java
JCExpression memberReferenceSuffix(JCExpression t) { int pos1 = token.pos; accept(COLCOL); return memberReferenceSuffix(pos1, t); }
[ "JCExpression", "memberReferenceSuffix", "(", "JCExpression", "t", ")", "{", "int", "pos1", "=", "token", ".", "pos", ";", "accept", "(", "COLCOL", ")", ";", "return", "memberReferenceSuffix", "(", "pos1", ",", "t", ")", ";", "}" ]
MemberReferenceSuffix = "::" [TypeArguments] Ident | "::" [TypeArguments] "new"
[ "MemberReferenceSuffix", "=", "::", "[", "TypeArguments", "]", "Ident", "|", "::", "[", "TypeArguments", "]", "new" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L2042-L2046
Jasig/uPortal
uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/DeleteManager.java
DeleteManager.getDeleteSet
private static Element getDeleteSet(Document plf, IPerson person, boolean create) throws PortalException { """ Get the delete set if any stored in the root of the document or create it is passed in create flag is true. """ Node root = plf.getDocumentElement(); Node child = root.getFirstChild(); while (child != null) { if (child.getNodeName().equals(Constants.ELM_DELETE_SET)) return (Element) child; child = child.getNextSibling(); } if (create == false) return null; String ID = null; try { ID = getDLS().getNextStructDirectiveId(person); } catch (Exception e) { throw new PortalException( "Exception encountered while " + "generating new delete set node " + "Id for userId=" + person.getID(), e); } Element delSet = plf.createElement(Constants.ELM_DELETE_SET); delSet.setAttribute(Constants.ATT_TYPE, Constants.ELM_DELETE_SET); delSet.setAttribute(Constants.ATT_ID, ID); root.appendChild(delSet); return delSet; }
java
private static Element getDeleteSet(Document plf, IPerson person, boolean create) throws PortalException { Node root = plf.getDocumentElement(); Node child = root.getFirstChild(); while (child != null) { if (child.getNodeName().equals(Constants.ELM_DELETE_SET)) return (Element) child; child = child.getNextSibling(); } if (create == false) return null; String ID = null; try { ID = getDLS().getNextStructDirectiveId(person); } catch (Exception e) { throw new PortalException( "Exception encountered while " + "generating new delete set node " + "Id for userId=" + person.getID(), e); } Element delSet = plf.createElement(Constants.ELM_DELETE_SET); delSet.setAttribute(Constants.ATT_TYPE, Constants.ELM_DELETE_SET); delSet.setAttribute(Constants.ATT_ID, ID); root.appendChild(delSet); return delSet; }
[ "private", "static", "Element", "getDeleteSet", "(", "Document", "plf", ",", "IPerson", "person", ",", "boolean", "create", ")", "throws", "PortalException", "{", "Node", "root", "=", "plf", ".", "getDocumentElement", "(", ")", ";", "Node", "child", "=", "root", ".", "getFirstChild", "(", ")", ";", "while", "(", "child", "!=", "null", ")", "{", "if", "(", "child", ".", "getNodeName", "(", ")", ".", "equals", "(", "Constants", ".", "ELM_DELETE_SET", ")", ")", "return", "(", "Element", ")", "child", ";", "child", "=", "child", ".", "getNextSibling", "(", ")", ";", "}", "if", "(", "create", "==", "false", ")", "return", "null", ";", "String", "ID", "=", "null", ";", "try", "{", "ID", "=", "getDLS", "(", ")", ".", "getNextStructDirectiveId", "(", "person", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "PortalException", "(", "\"Exception encountered while \"", "+", "\"generating new delete set node \"", "+", "\"Id for userId=\"", "+", "person", ".", "getID", "(", ")", ",", "e", ")", ";", "}", "Element", "delSet", "=", "plf", ".", "createElement", "(", "Constants", ".", "ELM_DELETE_SET", ")", ";", "delSet", ".", "setAttribute", "(", "Constants", ".", "ATT_TYPE", ",", "Constants", ".", "ELM_DELETE_SET", ")", ";", "delSet", ".", "setAttribute", "(", "Constants", ".", "ATT_ID", ",", "ID", ")", ";", "root", ".", "appendChild", "(", "delSet", ")", ";", "return", "delSet", ";", "}" ]
Get the delete set if any stored in the root of the document or create it is passed in create flag is true.
[ "Get", "the", "delete", "set", "if", "any", "stored", "in", "the", "root", "of", "the", "document", "or", "create", "it", "is", "passed", "in", "create", "flag", "is", "true", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/DeleteManager.java#L108-L137
mygreen/excel-cellformatter
src/main/java/com/github/mygreen/cellformatter/ConditionFormatterFactory.java
ConditionFormatterFactory.setupConditionLocale
protected MSLocale setupConditionLocale(final ConditionFormatter formatter, final Token.Condition token) { """ {@literal '[$-403]'}などのロケールの条件を組み立てる @param formatter 現在の組み立て中のフォーマッタのインスタンス。 @param token 条件式のトークン。 @return ロケールの条件式。 @throws IllegalArgumentException 処理対象の条件として一致しない場合 """ final Matcher matcher = PATTERN_CONDITION_LOCALE.matcher(token.getValue()); if(!matcher.matches()) { throw new IllegalArgumentException("not match condition:" + token.getValue()); } final String number = matcher.group(1); // 16進数=>10進数に直す final int value = Integer.valueOf(number, 16); MSLocale locale = MSLocale.createKnownLocale(value); if(locale == null) { locale = new MSLocale(value); } formatter.setLocale(locale); return locale; }
java
protected MSLocale setupConditionLocale(final ConditionFormatter formatter, final Token.Condition token) { final Matcher matcher = PATTERN_CONDITION_LOCALE.matcher(token.getValue()); if(!matcher.matches()) { throw new IllegalArgumentException("not match condition:" + token.getValue()); } final String number = matcher.group(1); // 16進数=>10進数に直す final int value = Integer.valueOf(number, 16); MSLocale locale = MSLocale.createKnownLocale(value); if(locale == null) { locale = new MSLocale(value); } formatter.setLocale(locale); return locale; }
[ "protected", "MSLocale", "setupConditionLocale", "(", "final", "ConditionFormatter", "formatter", ",", "final", "Token", ".", "Condition", "token", ")", "{", "final", "Matcher", "matcher", "=", "PATTERN_CONDITION_LOCALE", ".", "matcher", "(", "token", ".", "getValue", "(", ")", ")", ";", "if", "(", "!", "matcher", ".", "matches", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"not match condition:\"", "+", "token", ".", "getValue", "(", ")", ")", ";", "}", "final", "String", "number", "=", "matcher", ".", "group", "(", "1", ")", ";", "// 16進数=>10進数に直す\r", "final", "int", "value", "=", "Integer", ".", "valueOf", "(", "number", ",", "16", ")", ";", "MSLocale", "locale", "=", "MSLocale", ".", "createKnownLocale", "(", "value", ")", ";", "if", "(", "locale", "==", "null", ")", "{", "locale", "=", "new", "MSLocale", "(", "value", ")", ";", "}", "formatter", ".", "setLocale", "(", "locale", ")", ";", "return", "locale", ";", "}" ]
{@literal '[$-403]'}などのロケールの条件を組み立てる @param formatter 現在の組み立て中のフォーマッタのインスタンス。 @param token 条件式のトークン。 @return ロケールの条件式。 @throws IllegalArgumentException 処理対象の条件として一致しない場合
[ "{" ]
train
https://github.com/mygreen/excel-cellformatter/blob/e802af273d49889500591e03799c9262cbf29185/src/main/java/com/github/mygreen/cellformatter/ConditionFormatterFactory.java#L171-L191
apache/predictionio-sdk-java
client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java
EventClient.deleteUserAsFuture
public FutureAPIResponse deleteUserAsFuture(String uid, DateTime eventTime) throws IOException { """ Sends a delete user request. @param uid ID of the user @param eventTime timestamp of the event """ return createEventAsFuture(new Event() .event("$delete") .entityType("user") .entityId(uid) .eventTime(eventTime)); }
java
public FutureAPIResponse deleteUserAsFuture(String uid, DateTime eventTime) throws IOException { return createEventAsFuture(new Event() .event("$delete") .entityType("user") .entityId(uid) .eventTime(eventTime)); }
[ "public", "FutureAPIResponse", "deleteUserAsFuture", "(", "String", "uid", ",", "DateTime", "eventTime", ")", "throws", "IOException", "{", "return", "createEventAsFuture", "(", "new", "Event", "(", ")", ".", "event", "(", "\"$delete\"", ")", ".", "entityType", "(", "\"user\"", ")", ".", "entityId", "(", "uid", ")", ".", "eventTime", "(", "eventTime", ")", ")", ";", "}" ]
Sends a delete user request. @param uid ID of the user @param eventTime timestamp of the event
[ "Sends", "a", "delete", "user", "request", "." ]
train
https://github.com/apache/predictionio-sdk-java/blob/16052c96b136340c175c3f9c2692e720850df219/client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java#L402-L409
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/JobsInner.java
JobsInner.cancelJob
public void cancelJob(String resourceGroupName, String accountName, String transformName, String jobName) { """ Cancel Job. Cancel a Job. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param transformName The Transform name. @param jobName The Job name. @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ cancelJobWithServiceResponseAsync(resourceGroupName, accountName, transformName, jobName).toBlocking().single().body(); }
java
public void cancelJob(String resourceGroupName, String accountName, String transformName, String jobName) { cancelJobWithServiceResponseAsync(resourceGroupName, accountName, transformName, jobName).toBlocking().single().body(); }
[ "public", "void", "cancelJob", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "transformName", ",", "String", "jobName", ")", "{", "cancelJobWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "transformName", ",", "jobName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Cancel Job. Cancel a Job. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param transformName The Transform name. @param jobName The Job name. @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Cancel", "Job", ".", "Cancel", "a", "Job", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/JobsInner.java#L707-L709
osmdroid/osmdroid
osmdroid-android/src/main/java/org/osmdroid/tileprovider/modules/SqlTileWriter.java
SqlTileWriter.exists
public boolean exists(final String pTileSource, final long pMapTileIndex) { """ Returns true if the given tile source and tile coordinates exist in the cache @since 5.6 """ return 1 == getRowCount(primaryKey, getPrimaryKeyParameters(getIndex(pMapTileIndex), pTileSource)); }
java
public boolean exists(final String pTileSource, final long pMapTileIndex) { return 1 == getRowCount(primaryKey, getPrimaryKeyParameters(getIndex(pMapTileIndex), pTileSource)); }
[ "public", "boolean", "exists", "(", "final", "String", "pTileSource", ",", "final", "long", "pMapTileIndex", ")", "{", "return", "1", "==", "getRowCount", "(", "primaryKey", ",", "getPrimaryKeyParameters", "(", "getIndex", "(", "pMapTileIndex", ")", ",", "pTileSource", ")", ")", ";", "}" ]
Returns true if the given tile source and tile coordinates exist in the cache @since 5.6
[ "Returns", "true", "if", "the", "given", "tile", "source", "and", "tile", "coordinates", "exist", "in", "the", "cache" ]
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/tileprovider/modules/SqlTileWriter.java#L183-L185
otto-de/edison-microservice
edison-jobs/src/main/java/de/otto/edison/jobs/status/JobStatusCalculator.java
JobStatusCalculator.jobTooOld
protected boolean jobTooOld(final JobInfo jobInfo, final JobDefinition jobDefinition) { """ Calculates whether or not the last job execution is too old. @param jobInfo job info of the last job execution @param jobDefinition job definition, specifying the max age of jobs @return boolean """ final Optional<OffsetDateTime> stopped = jobInfo.getStopped(); if (stopped.isPresent() && jobDefinition.maxAge().isPresent()) { final OffsetDateTime deadlineToRerun = stopped.get().plus(jobDefinition.maxAge().get()); return deadlineToRerun.isBefore(now()); } return false; }
java
protected boolean jobTooOld(final JobInfo jobInfo, final JobDefinition jobDefinition) { final Optional<OffsetDateTime> stopped = jobInfo.getStopped(); if (stopped.isPresent() && jobDefinition.maxAge().isPresent()) { final OffsetDateTime deadlineToRerun = stopped.get().plus(jobDefinition.maxAge().get()); return deadlineToRerun.isBefore(now()); } return false; }
[ "protected", "boolean", "jobTooOld", "(", "final", "JobInfo", "jobInfo", ",", "final", "JobDefinition", "jobDefinition", ")", "{", "final", "Optional", "<", "OffsetDateTime", ">", "stopped", "=", "jobInfo", ".", "getStopped", "(", ")", ";", "if", "(", "stopped", ".", "isPresent", "(", ")", "&&", "jobDefinition", ".", "maxAge", "(", ")", ".", "isPresent", "(", ")", ")", "{", "final", "OffsetDateTime", "deadlineToRerun", "=", "stopped", ".", "get", "(", ")", ".", "plus", "(", "jobDefinition", ".", "maxAge", "(", ")", ".", "get", "(", ")", ")", ";", "return", "deadlineToRerun", ".", "isBefore", "(", "now", "(", ")", ")", ";", "}", "return", "false", ";", "}" ]
Calculates whether or not the last job execution is too old. @param jobInfo job info of the last job execution @param jobDefinition job definition, specifying the max age of jobs @return boolean
[ "Calculates", "whether", "or", "not", "the", "last", "job", "execution", "is", "too", "old", "." ]
train
https://github.com/otto-de/edison-microservice/blob/89ecf0a0dee40977f004370b0b474a36c699e8a2/edison-jobs/src/main/java/de/otto/edison/jobs/status/JobStatusCalculator.java#L314-L322
j256/simplecsv
src/main/java/com/j256/simplecsv/processor/CsvProcessor.java
CsvProcessor.readAll
public List<T> readAll(Reader reader, Collection<ParseError> parseErrors) throws IOException, ParseException { """ Read in all of the entities in the reader passed in. It will use an internal buffered reader. @param reader Where to read the header and entities from. It will be closed when the method returns. @param parseErrors If not null, any errors will be added to the collection and null will be returned. If validateHeader is true and the header does not match then no additional lines will be returned. If this is null then a ParseException will be thrown on parsing problems. @return A list of entities read in or null if parseErrors is not null. @throws ParseException Thrown on any parsing problems. If parseErrors is not null then parse errors will be added there and an exception should not be thrown. @throws IOException If there are any IO exceptions thrown when reading. """ checkEntityConfig(); BufferedReader bufferedReader = new BufferedReaderLineCounter(reader); try { ParseError parseError = null; // we do this to reuse the parse error objects if we can if (parseErrors != null) { parseError = new ParseError(); } if (firstLineHeader) { if (readHeader(bufferedReader, parseError) == null) { if (parseError != null && parseError.isError()) { parseErrors.add(parseError); } return null; } } return readRows(bufferedReader, parseErrors); } finally { bufferedReader.close(); } }
java
public List<T> readAll(Reader reader, Collection<ParseError> parseErrors) throws IOException, ParseException { checkEntityConfig(); BufferedReader bufferedReader = new BufferedReaderLineCounter(reader); try { ParseError parseError = null; // we do this to reuse the parse error objects if we can if (parseErrors != null) { parseError = new ParseError(); } if (firstLineHeader) { if (readHeader(bufferedReader, parseError) == null) { if (parseError != null && parseError.isError()) { parseErrors.add(parseError); } return null; } } return readRows(bufferedReader, parseErrors); } finally { bufferedReader.close(); } }
[ "public", "List", "<", "T", ">", "readAll", "(", "Reader", "reader", ",", "Collection", "<", "ParseError", ">", "parseErrors", ")", "throws", "IOException", ",", "ParseException", "{", "checkEntityConfig", "(", ")", ";", "BufferedReader", "bufferedReader", "=", "new", "BufferedReaderLineCounter", "(", "reader", ")", ";", "try", "{", "ParseError", "parseError", "=", "null", ";", "// we do this to reuse the parse error objects if we can", "if", "(", "parseErrors", "!=", "null", ")", "{", "parseError", "=", "new", "ParseError", "(", ")", ";", "}", "if", "(", "firstLineHeader", ")", "{", "if", "(", "readHeader", "(", "bufferedReader", ",", "parseError", ")", "==", "null", ")", "{", "if", "(", "parseError", "!=", "null", "&&", "parseError", ".", "isError", "(", ")", ")", "{", "parseErrors", ".", "add", "(", "parseError", ")", ";", "}", "return", "null", ";", "}", "}", "return", "readRows", "(", "bufferedReader", ",", "parseErrors", ")", ";", "}", "finally", "{", "bufferedReader", ".", "close", "(", ")", ";", "}", "}" ]
Read in all of the entities in the reader passed in. It will use an internal buffered reader. @param reader Where to read the header and entities from. It will be closed when the method returns. @param parseErrors If not null, any errors will be added to the collection and null will be returned. If validateHeader is true and the header does not match then no additional lines will be returned. If this is null then a ParseException will be thrown on parsing problems. @return A list of entities read in or null if parseErrors is not null. @throws ParseException Thrown on any parsing problems. If parseErrors is not null then parse errors will be added there and an exception should not be thrown. @throws IOException If there are any IO exceptions thrown when reading.
[ "Read", "in", "all", "of", "the", "entities", "in", "the", "reader", "passed", "in", ".", "It", "will", "use", "an", "internal", "buffered", "reader", "." ]
train
https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/CsvProcessor.java#L177-L198
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java
MathUtils.idf
public static double idf(double totalDocs, double numTimesWordAppearedInADocument) { """ Inverse document frequency: the total docs divided by the number of times the word appeared in a document @param totalDocs the total documents for the data applyTransformToDestination @param numTimesWordAppearedInADocument the number of times the word occurred in a document @return log(10) (totalDocs/numTImesWordAppearedInADocument) """ //return totalDocs > 0 ? Math.log10(totalDocs/numTimesWordAppearedInADocument) : 0; if (totalDocs == 0) return 0; double idf = Math.log10(totalDocs / numTimesWordAppearedInADocument); return idf; }
java
public static double idf(double totalDocs, double numTimesWordAppearedInADocument) { //return totalDocs > 0 ? Math.log10(totalDocs/numTimesWordAppearedInADocument) : 0; if (totalDocs == 0) return 0; double idf = Math.log10(totalDocs / numTimesWordAppearedInADocument); return idf; }
[ "public", "static", "double", "idf", "(", "double", "totalDocs", ",", "double", "numTimesWordAppearedInADocument", ")", "{", "//return totalDocs > 0 ? Math.log10(totalDocs/numTimesWordAppearedInADocument) : 0;", "if", "(", "totalDocs", "==", "0", ")", "return", "0", ";", "double", "idf", "=", "Math", ".", "log10", "(", "totalDocs", "/", "numTimesWordAppearedInADocument", ")", ";", "return", "idf", ";", "}" ]
Inverse document frequency: the total docs divided by the number of times the word appeared in a document @param totalDocs the total documents for the data applyTransformToDestination @param numTimesWordAppearedInADocument the number of times the word occurred in a document @return log(10) (totalDocs/numTImesWordAppearedInADocument)
[ "Inverse", "document", "frequency", ":", "the", "total", "docs", "divided", "by", "the", "number", "of", "times", "the", "word", "appeared", "in", "a", "document" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java#L256-L262
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/xpath/MapBasedXPathFunctionResolver.java
MapBasedXPathFunctionResolver.addUniqueFunction
@Nonnull public EChange addUniqueFunction (@Nonnull final String sNamespaceURI, @Nonnull final String sLocalPart, @Nonnegative final int nArity, @Nonnull final XPathFunction aFunction) { """ Add a new function. @param sNamespaceURI The namespace URI of the function @param sLocalPart The local part of the function @param nArity The number of parameters of the function @param aFunction The function to be used. May not be <code>null</code>. @return {@link EChange} """ return addUniqueFunction (new QName (sNamespaceURI, sLocalPart), nArity, aFunction); }
java
@Nonnull public EChange addUniqueFunction (@Nonnull final String sNamespaceURI, @Nonnull final String sLocalPart, @Nonnegative final int nArity, @Nonnull final XPathFunction aFunction) { return addUniqueFunction (new QName (sNamespaceURI, sLocalPart), nArity, aFunction); }
[ "@", "Nonnull", "public", "EChange", "addUniqueFunction", "(", "@", "Nonnull", "final", "String", "sNamespaceURI", ",", "@", "Nonnull", "final", "String", "sLocalPart", ",", "@", "Nonnegative", "final", "int", "nArity", ",", "@", "Nonnull", "final", "XPathFunction", "aFunction", ")", "{", "return", "addUniqueFunction", "(", "new", "QName", "(", "sNamespaceURI", ",", "sLocalPart", ")", ",", "nArity", ",", "aFunction", ")", ";", "}" ]
Add a new function. @param sNamespaceURI The namespace URI of the function @param sLocalPart The local part of the function @param nArity The number of parameters of the function @param aFunction The function to be used. May not be <code>null</code>. @return {@link EChange}
[ "Add", "a", "new", "function", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/xpath/MapBasedXPathFunctionResolver.java#L84-L91
tumblr/jumblr
src/main/java/com/tumblr/jumblr/JumblrClient.java
JumblrClient.postDelete
public void postDelete(String blogName, Long postId) { """ Delete a given post @param blogName the name of the blog the post is in @param postId the id of the post to delete """ Map<String, String> map = new HashMap<String, String>(); map.put("id", postId.toString()); requestBuilder.post(JumblrClient.blogPath(blogName, "/post/delete"), map); }
java
public void postDelete(String blogName, Long postId) { Map<String, String> map = new HashMap<String, String>(); map.put("id", postId.toString()); requestBuilder.post(JumblrClient.blogPath(blogName, "/post/delete"), map); }
[ "public", "void", "postDelete", "(", "String", "blogName", ",", "Long", "postId", ")", "{", "Map", "<", "String", ",", "String", ">", "map", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "map", ".", "put", "(", "\"id\"", ",", "postId", ".", "toString", "(", ")", ")", ";", "requestBuilder", ".", "post", "(", "JumblrClient", ".", "blogPath", "(", "blogName", ",", "\"/post/delete\"", ")", ",", "map", ")", ";", "}" ]
Delete a given post @param blogName the name of the blog the post is in @param postId the id of the post to delete
[ "Delete", "a", "given", "post" ]
train
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L328-L332
cybazeitalia/emaze-dysfunctional
src/main/java/net/emaze/dysfunctional/Spies.java
Spies.spy2nd
public static <T1, T2> BiConsumer<T1, T2> spy2nd(BiConsumer<T1, T2> consumer, Box<T2> param2) { """ Proxies a binary consumer spying for second parameter. @param <T1> the consumer first parameter type @param <T2> the consumer second parameter type @param consumer the consumer that will be spied @param param2 a box that will be containing the second spied parameter @return the proxied consumer """ return spy(consumer, Box.<T1>empty(), param2); }
java
public static <T1, T2> BiConsumer<T1, T2> spy2nd(BiConsumer<T1, T2> consumer, Box<T2> param2) { return spy(consumer, Box.<T1>empty(), param2); }
[ "public", "static", "<", "T1", ",", "T2", ">", "BiConsumer", "<", "T1", ",", "T2", ">", "spy2nd", "(", "BiConsumer", "<", "T1", ",", "T2", ">", "consumer", ",", "Box", "<", "T2", ">", "param2", ")", "{", "return", "spy", "(", "consumer", ",", "Box", ".", "<", "T1", ">", "empty", "(", ")", ",", "param2", ")", ";", "}" ]
Proxies a binary consumer spying for second parameter. @param <T1> the consumer first parameter type @param <T2> the consumer second parameter type @param consumer the consumer that will be spied @param param2 a box that will be containing the second spied parameter @return the proxied consumer
[ "Proxies", "a", "binary", "consumer", "spying", "for", "second", "parameter", "." ]
train
https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Spies.java#L375-L377
maven-nar/nar-maven-plugin
src/main/java/com/github/maven_nar/AbstractDependencyMojo.java
AbstractDependencyMojo.getRootNodeDependecyTree
protected DependencyNode getRootNodeDependecyTree() throws MojoExecutionException { """ Get root node of the current Maven project Dependency tree generated by maven.shared dependency graph builder. @return root node of the project Dependency tree @throws MojoExecutionException """ try { ArtifactFilter artifactFilter = null; // works for only maven 3. Use of dependency graph component not handled for maven 2 // as current version of NAR already requires Maven 3.x rootNode = dependencyGraphBuilder.buildDependencyGraph(getMavenProject(), artifactFilter); } catch (DependencyGraphBuilderException exception) { throw new MojoExecutionException("Cannot build project dependency graph", exception); } return rootNode; }
java
protected DependencyNode getRootNodeDependecyTree() throws MojoExecutionException{ try { ArtifactFilter artifactFilter = null; // works for only maven 3. Use of dependency graph component not handled for maven 2 // as current version of NAR already requires Maven 3.x rootNode = dependencyGraphBuilder.buildDependencyGraph(getMavenProject(), artifactFilter); } catch (DependencyGraphBuilderException exception) { throw new MojoExecutionException("Cannot build project dependency graph", exception); } return rootNode; }
[ "protected", "DependencyNode", "getRootNodeDependecyTree", "(", ")", "throws", "MojoExecutionException", "{", "try", "{", "ArtifactFilter", "artifactFilter", "=", "null", ";", "// works for only maven 3. Use of dependency graph component not handled for maven 2", "// as current version of NAR already requires Maven 3.x", "rootNode", "=", "dependencyGraphBuilder", ".", "buildDependencyGraph", "(", "getMavenProject", "(", ")", ",", "artifactFilter", ")", ";", "}", "catch", "(", "DependencyGraphBuilderException", "exception", ")", "{", "throw", "new", "MojoExecutionException", "(", "\"Cannot build project dependency graph\"", ",", "exception", ")", ";", "}", "return", "rootNode", ";", "}" ]
Get root node of the current Maven project Dependency tree generated by maven.shared dependency graph builder. @return root node of the project Dependency tree @throws MojoExecutionException
[ "Get", "root", "node", "of", "the", "current", "Maven", "project", "Dependency", "tree", "generated", "by", "maven", ".", "shared", "dependency", "graph", "builder", "." ]
train
https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/AbstractDependencyMojo.java#L494-L507
netty/netty
handler/src/main/java/io/netty/handler/ssl/SslContext.java
SslContext.newClientContext
@Deprecated public static SslContext newClientContext(SslProvider provider) throws SSLException { """ Creates a new client-side {@link SslContext}. @param provider the {@link SslContext} implementation to use. {@code null} to use the current default one. @return a new client-side {@link SslContext} @deprecated Replaced by {@link SslContextBuilder} """ return newClientContext(provider, null, null); }
java
@Deprecated public static SslContext newClientContext(SslProvider provider) throws SSLException { return newClientContext(provider, null, null); }
[ "@", "Deprecated", "public", "static", "SslContext", "newClientContext", "(", "SslProvider", "provider", ")", "throws", "SSLException", "{", "return", "newClientContext", "(", "provider", ",", "null", ",", "null", ")", ";", "}" ]
Creates a new client-side {@link SslContext}. @param provider the {@link SslContext} implementation to use. {@code null} to use the current default one. @return a new client-side {@link SslContext} @deprecated Replaced by {@link SslContextBuilder}
[ "Creates", "a", "new", "client", "-", "side", "{", "@link", "SslContext", "}", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContext.java#L570-L573
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java
ExpressionUtils.notIn
public static <D> Predicate notIn(Expression<D> left, Collection<? extends D> right) { """ Create a {@code left not in right} expression @param <D> type of expressions @param left lhs of expression @param right rhs of expression @return left not in right """ if (right.size() == 1) { return neConst(left, right.iterator().next()); } else { return predicate(Ops.NOT_IN, left, ConstantImpl.create(right)); } }
java
public static <D> Predicate notIn(Expression<D> left, Collection<? extends D> right) { if (right.size() == 1) { return neConst(left, right.iterator().next()); } else { return predicate(Ops.NOT_IN, left, ConstantImpl.create(right)); } }
[ "public", "static", "<", "D", ">", "Predicate", "notIn", "(", "Expression", "<", "D", ">", "left", ",", "Collection", "<", "?", "extends", "D", ">", "right", ")", "{", "if", "(", "right", ".", "size", "(", ")", "==", "1", ")", "{", "return", "neConst", "(", "left", ",", "right", ".", "iterator", "(", ")", ".", "next", "(", ")", ")", ";", "}", "else", "{", "return", "predicate", "(", "Ops", ".", "NOT_IN", ",", "left", ",", "ConstantImpl", ".", "create", "(", "right", ")", ")", ";", "}", "}" ]
Create a {@code left not in right} expression @param <D> type of expressions @param left lhs of expression @param right rhs of expression @return left not in right
[ "Create", "a", "{", "@code", "left", "not", "in", "right", "}", "expression" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java#L755-L761
cdapio/tephra
tephra-examples/src/main/java/co/cask/tephra/examples/BalanceBooks.java
BalanceBooks.verify
public boolean verify() { """ Validates the current state of the data stored at the end of the test. Each update by a client consists of two parts: a withdrawal of a random amount from a randomly select other account, and a corresponding to deposit to the client's own account. So, if all the updates were performed consistently (no partial updates or partial rollbacks), then the total sum of all balances at the end should be 0. """ boolean success = false; try { TransactionAwareHTable table = new TransactionAwareHTable(conn.getTable(TABLE)); TransactionContext context = new TransactionContext(txClient, table); LOG.info("VERIFYING BALANCES"); context.start(); long totalBalance = 0; ResultScanner scanner = table.getScanner(new Scan()); try { for (Result r : scanner) { if (!r.isEmpty()) { int rowId = Bytes.toInt(r.getRow()); long balance = Bytes.toLong(r.getValue(FAMILY, COL)); totalBalance += balance; LOG.info("Client #{}: balance = ${}", rowId, balance); } } } finally { if (scanner != null) { Closeables.closeQuietly(scanner); } } if (totalBalance == 0) { LOG.info("PASSED!"); success = true; } else { LOG.info("FAILED! Total balance should be 0 but was {}", totalBalance); } context.finish(); } catch (Exception e) { LOG.error("Failed verification check", e); } return success; }
java
public boolean verify() { boolean success = false; try { TransactionAwareHTable table = new TransactionAwareHTable(conn.getTable(TABLE)); TransactionContext context = new TransactionContext(txClient, table); LOG.info("VERIFYING BALANCES"); context.start(); long totalBalance = 0; ResultScanner scanner = table.getScanner(new Scan()); try { for (Result r : scanner) { if (!r.isEmpty()) { int rowId = Bytes.toInt(r.getRow()); long balance = Bytes.toLong(r.getValue(FAMILY, COL)); totalBalance += balance; LOG.info("Client #{}: balance = ${}", rowId, balance); } } } finally { if (scanner != null) { Closeables.closeQuietly(scanner); } } if (totalBalance == 0) { LOG.info("PASSED!"); success = true; } else { LOG.info("FAILED! Total balance should be 0 but was {}", totalBalance); } context.finish(); } catch (Exception e) { LOG.error("Failed verification check", e); } return success; }
[ "public", "boolean", "verify", "(", ")", "{", "boolean", "success", "=", "false", ";", "try", "{", "TransactionAwareHTable", "table", "=", "new", "TransactionAwareHTable", "(", "conn", ".", "getTable", "(", "TABLE", ")", ")", ";", "TransactionContext", "context", "=", "new", "TransactionContext", "(", "txClient", ",", "table", ")", ";", "LOG", ".", "info", "(", "\"VERIFYING BALANCES\"", ")", ";", "context", ".", "start", "(", ")", ";", "long", "totalBalance", "=", "0", ";", "ResultScanner", "scanner", "=", "table", ".", "getScanner", "(", "new", "Scan", "(", ")", ")", ";", "try", "{", "for", "(", "Result", "r", ":", "scanner", ")", "{", "if", "(", "!", "r", ".", "isEmpty", "(", ")", ")", "{", "int", "rowId", "=", "Bytes", ".", "toInt", "(", "r", ".", "getRow", "(", ")", ")", ";", "long", "balance", "=", "Bytes", ".", "toLong", "(", "r", ".", "getValue", "(", "FAMILY", ",", "COL", ")", ")", ";", "totalBalance", "+=", "balance", ";", "LOG", ".", "info", "(", "\"Client #{}: balance = ${}\"", ",", "rowId", ",", "balance", ")", ";", "}", "}", "}", "finally", "{", "if", "(", "scanner", "!=", "null", ")", "{", "Closeables", ".", "closeQuietly", "(", "scanner", ")", ";", "}", "}", "if", "(", "totalBalance", "==", "0", ")", "{", "LOG", ".", "info", "(", "\"PASSED!\"", ")", ";", "success", "=", "true", ";", "}", "else", "{", "LOG", ".", "info", "(", "\"FAILED! Total balance should be 0 but was {}\"", ",", "totalBalance", ")", ";", "}", "context", ".", "finish", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "LOG", ".", "error", "(", "\"Failed verification check\"", ",", "e", ")", ";", "}", "return", "success", ";", "}" ]
Validates the current state of the data stored at the end of the test. Each update by a client consists of two parts: a withdrawal of a random amount from a randomly select other account, and a corresponding to deposit to the client's own account. So, if all the updates were performed consistently (no partial updates or partial rollbacks), then the total sum of all balances at the end should be 0.
[ "Validates", "the", "current", "state", "of", "the", "data", "stored", "at", "the", "end", "of", "the", "test", ".", "Each", "update", "by", "a", "client", "consists", "of", "two", "parts", ":", "a", "withdrawal", "of", "a", "random", "amount", "from", "a", "randomly", "select", "other", "account", "and", "a", "corresponding", "to", "deposit", "to", "the", "client", "s", "own", "account", ".", "So", "if", "all", "the", "updates", "were", "performed", "consistently", "(", "no", "partial", "updates", "or", "partial", "rollbacks", ")", "then", "the", "total", "sum", "of", "all", "balances", "at", "the", "end", "should", "be", "0", "." ]
train
https://github.com/cdapio/tephra/blob/082c56c15c6ece15002631ff6f89206a00d8915c/tephra-examples/src/main/java/co/cask/tephra/examples/BalanceBooks.java#L145-L180
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/transform/EnumBindTransform.java
EnumBindTransform.generateSerializeOnXml
@Override public void generateSerializeOnXml(BindTypeContext context, MethodSpec.Builder methodBuilder, String serializerName, TypeName beanClass, String beanName, BindProperty property) { """ /* (non-Javadoc) @see com.abubusoft.kripton.processor.bind.transform.BindTransform#generateSerializeOnXml(com.abubusoft.kripton.processor.bind.BindTypeContext, com.squareup.javapoet.MethodSpec.Builder, java.lang.String, com.squareup.javapoet.TypeName, java.lang.String, com.abubusoft.kripton.processor.bind.model.BindProperty) """ XmlType xmlType = property.xmlInfo.xmlType; if (property.isNullable() && !property.isInCollection()) { methodBuilder.beginControlFlow("if ($L!=null) ", getter(beanName, beanClass, property)); } switch (xmlType) { case ATTRIBUTE: methodBuilder.addStatement("$L.writeAttribute($S, $T.escapeXml10($L.$L()))", serializerName, BindProperty.xmlName(property), StringEscapeUtils.class, getter(beanName, beanClass, property), METHOD_TO_CONVERT); break; case TAG: methodBuilder.addStatement("$L.writeStartElement($S)", serializerName, BindProperty.xmlName(property)); methodBuilder.addStatement("$L.writeCharacters($T.escapeXml10($L.$L()))", serializerName, StringEscapeUtils.class, getter(beanName, beanClass, property), METHOD_TO_CONVERT); methodBuilder.addStatement("$L.writeEndElement()", serializerName); break; case VALUE: methodBuilder.addStatement("$L.writeCharacters($T.escapeXml10($L.$L()))", serializerName, StringEscapeUtils.class, getter(beanName, beanClass, property), METHOD_TO_CONVERT); break; case VALUE_CDATA: methodBuilder.addStatement("$L.writeCData($T.escapeXml10($L.$L()))", serializerName, StringEscapeUtils.class, getter(beanName, beanClass, property), METHOD_TO_CONVERT); break; } if (property.isNullable() && !property.isInCollection()) { methodBuilder.endControlFlow(); } }
java
@Override public void generateSerializeOnXml(BindTypeContext context, MethodSpec.Builder methodBuilder, String serializerName, TypeName beanClass, String beanName, BindProperty property) { XmlType xmlType = property.xmlInfo.xmlType; if (property.isNullable() && !property.isInCollection()) { methodBuilder.beginControlFlow("if ($L!=null) ", getter(beanName, beanClass, property)); } switch (xmlType) { case ATTRIBUTE: methodBuilder.addStatement("$L.writeAttribute($S, $T.escapeXml10($L.$L()))", serializerName, BindProperty.xmlName(property), StringEscapeUtils.class, getter(beanName, beanClass, property), METHOD_TO_CONVERT); break; case TAG: methodBuilder.addStatement("$L.writeStartElement($S)", serializerName, BindProperty.xmlName(property)); methodBuilder.addStatement("$L.writeCharacters($T.escapeXml10($L.$L()))", serializerName, StringEscapeUtils.class, getter(beanName, beanClass, property), METHOD_TO_CONVERT); methodBuilder.addStatement("$L.writeEndElement()", serializerName); break; case VALUE: methodBuilder.addStatement("$L.writeCharacters($T.escapeXml10($L.$L()))", serializerName, StringEscapeUtils.class, getter(beanName, beanClass, property), METHOD_TO_CONVERT); break; case VALUE_CDATA: methodBuilder.addStatement("$L.writeCData($T.escapeXml10($L.$L()))", serializerName, StringEscapeUtils.class, getter(beanName, beanClass, property), METHOD_TO_CONVERT); break; } if (property.isNullable() && !property.isInCollection()) { methodBuilder.endControlFlow(); } }
[ "@", "Override", "public", "void", "generateSerializeOnXml", "(", "BindTypeContext", "context", ",", "MethodSpec", ".", "Builder", "methodBuilder", ",", "String", "serializerName", ",", "TypeName", "beanClass", ",", "String", "beanName", ",", "BindProperty", "property", ")", "{", "XmlType", "xmlType", "=", "property", ".", "xmlInfo", ".", "xmlType", ";", "if", "(", "property", ".", "isNullable", "(", ")", "&&", "!", "property", ".", "isInCollection", "(", ")", ")", "{", "methodBuilder", ".", "beginControlFlow", "(", "\"if ($L!=null) \"", ",", "getter", "(", "beanName", ",", "beanClass", ",", "property", ")", ")", ";", "}", "switch", "(", "xmlType", ")", "{", "case", "ATTRIBUTE", ":", "methodBuilder", ".", "addStatement", "(", "\"$L.writeAttribute($S, $T.escapeXml10($L.$L()))\"", ",", "serializerName", ",", "BindProperty", ".", "xmlName", "(", "property", ")", ",", "StringEscapeUtils", ".", "class", ",", "getter", "(", "beanName", ",", "beanClass", ",", "property", ")", ",", "METHOD_TO_CONVERT", ")", ";", "break", ";", "case", "TAG", ":", "methodBuilder", ".", "addStatement", "(", "\"$L.writeStartElement($S)\"", ",", "serializerName", ",", "BindProperty", ".", "xmlName", "(", "property", ")", ")", ";", "methodBuilder", ".", "addStatement", "(", "\"$L.writeCharacters($T.escapeXml10($L.$L()))\"", ",", "serializerName", ",", "StringEscapeUtils", ".", "class", ",", "getter", "(", "beanName", ",", "beanClass", ",", "property", ")", ",", "METHOD_TO_CONVERT", ")", ";", "methodBuilder", ".", "addStatement", "(", "\"$L.writeEndElement()\"", ",", "serializerName", ")", ";", "break", ";", "case", "VALUE", ":", "methodBuilder", ".", "addStatement", "(", "\"$L.writeCharacters($T.escapeXml10($L.$L()))\"", ",", "serializerName", ",", "StringEscapeUtils", ".", "class", ",", "getter", "(", "beanName", ",", "beanClass", ",", "property", ")", ",", "METHOD_TO_CONVERT", ")", ";", "break", ";", "case", "VALUE_CDATA", ":", "methodBuilder", ".", "addStatement", "(", "\"$L.writeCData($T.escapeXml10($L.$L()))\"", ",", "serializerName", ",", "StringEscapeUtils", ".", "class", ",", "getter", "(", "beanName", ",", "beanClass", ",", "property", ")", ",", "METHOD_TO_CONVERT", ")", ";", "break", ";", "}", "if", "(", "property", ".", "isNullable", "(", ")", "&&", "!", "property", ".", "isInCollection", "(", ")", ")", "{", "methodBuilder", ".", "endControlFlow", "(", ")", ";", "}", "}" ]
/* (non-Javadoc) @see com.abubusoft.kripton.processor.bind.transform.BindTransform#generateSerializeOnXml(com.abubusoft.kripton.processor.bind.BindTypeContext, com.squareup.javapoet.MethodSpec.Builder, java.lang.String, com.squareup.javapoet.TypeName, java.lang.String, com.abubusoft.kripton.processor.bind.model.BindProperty)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/transform/EnumBindTransform.java#L66-L95
h2oai/h2o-3
h2o-core/src/main/java/jsr166y/ForkJoinPool.java
ForkJoinPool.awaitTermination
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { """ Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first. @param timeout the maximum time to wait @param unit the time unit of the timeout argument @return {@code true} if this executor terminated and {@code false} if the timeout elapsed before termination @throws InterruptedException if interrupted while waiting """ long nanos = unit.toNanos(timeout); final Mutex lock = this.lock; lock.lock(); try { for (;;) { if (isTerminated()) return true; if (nanos <= 0) return false; nanos = termination.awaitNanos(nanos); } } finally { lock.unlock(); } }
java
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { long nanos = unit.toNanos(timeout); final Mutex lock = this.lock; lock.lock(); try { for (;;) { if (isTerminated()) return true; if (nanos <= 0) return false; nanos = termination.awaitNanos(nanos); } } finally { lock.unlock(); } }
[ "public", "boolean", "awaitTermination", "(", "long", "timeout", ",", "TimeUnit", "unit", ")", "throws", "InterruptedException", "{", "long", "nanos", "=", "unit", ".", "toNanos", "(", "timeout", ")", ";", "final", "Mutex", "lock", "=", "this", ".", "lock", ";", "lock", ".", "lock", "(", ")", ";", "try", "{", "for", "(", ";", ";", ")", "{", "if", "(", "isTerminated", "(", ")", ")", "return", "true", ";", "if", "(", "nanos", "<=", "0", ")", "return", "false", ";", "nanos", "=", "termination", ".", "awaitNanos", "(", "nanos", ")", ";", "}", "}", "finally", "{", "lock", ".", "unlock", "(", ")", ";", "}", "}" ]
Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first. @param timeout the maximum time to wait @param unit the time unit of the timeout argument @return {@code true} if this executor terminated and {@code false} if the timeout elapsed before termination @throws InterruptedException if interrupted while waiting
[ "Blocks", "until", "all", "tasks", "have", "completed", "execution", "after", "a", "shutdown", "request", "or", "the", "timeout", "occurs", "or", "the", "current", "thread", "is", "interrupted", "whichever", "happens", "first", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/jsr166y/ForkJoinPool.java#L2684-L2700
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java
ControlContainerContext.dispatchEvent
public Object dispatchEvent(ControlHandle handle, EventRef event, Object [] args) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { """ Dispatch an operation or an event to a bean within this container bean context. @param handle the control handle identifying the target bean @param event the event to be invoked on the target bean @param args the arguments to be passed to the target method invocation """ ControlBean bean = getBean(handle.getControlID()); if (bean == null) throw new IllegalArgumentException("Invalid bean ID: " + handle.getControlID()); return bean.dispatchEvent(event, args); }
java
public Object dispatchEvent(ControlHandle handle, EventRef event, Object [] args) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { ControlBean bean = getBean(handle.getControlID()); if (bean == null) throw new IllegalArgumentException("Invalid bean ID: " + handle.getControlID()); return bean.dispatchEvent(event, args); }
[ "public", "Object", "dispatchEvent", "(", "ControlHandle", "handle", ",", "EventRef", "event", ",", "Object", "[", "]", "args", ")", "throws", "IllegalArgumentException", ",", "IllegalAccessException", ",", "InvocationTargetException", "{", "ControlBean", "bean", "=", "getBean", "(", "handle", ".", "getControlID", "(", ")", ")", ";", "if", "(", "bean", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"Invalid bean ID: \"", "+", "handle", ".", "getControlID", "(", ")", ")", ";", "return", "bean", ".", "dispatchEvent", "(", "event", ",", "args", ")", ";", "}" ]
Dispatch an operation or an event to a bean within this container bean context. @param handle the control handle identifying the target bean @param event the event to be invoked on the target bean @param args the arguments to be passed to the target method invocation
[ "Dispatch", "an", "operation", "or", "an", "event", "to", "a", "bean", "within", "this", "container", "bean", "context", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java#L152-L160
kkopacz/agiso-core
bundles/agiso-core-lang/src/main/java/org/agiso/core/lang/util/ThreadUtils.java
ThreadUtils.putAttribute
public static Object putAttribute(String key, Object attribute, boolean inheritable) { """ Umieszcza wartość atrybutu pod określonym kluczem w zasięgu wątku określonym parametrem wywołania <code>inheritable</code>. @param key Klucz, pod którym atrybut zostanie umieszczony @param attribute Wartość atrybutu do umieszczenia w zasięgu wątku @param inheritable Wartość logiczna określająca, czy atrybut ma być dziedziczony przez wąki dzieci, czy nie, jeśli ma wartość: <ul> <li><code>false</code> - jest atrybutem lokalnym dla bieżącego wątku i nie jest widoczny przez jego dzieci,</li> <li><code>true</code> - jest atrybutem dziedzicznym bieżącego wątku i jest widoczny przez jego dzieci.</li> </ul> @return """ if(inheritable) { Object value = inheritableAttributeHolder.get().put(key, attribute); if(value == null) { value = localAttributeHolder.get().remove(key); } else { localAttributeHolder.get().remove(key); } return value; } else { Object value = localAttributeHolder.get().put(key, attribute); if(value == null) { value = inheritableAttributeHolder.get().remove(key); } else { inheritableAttributeHolder.get().remove(key); } return value; } }
java
public static Object putAttribute(String key, Object attribute, boolean inheritable) { if(inheritable) { Object value = inheritableAttributeHolder.get().put(key, attribute); if(value == null) { value = localAttributeHolder.get().remove(key); } else { localAttributeHolder.get().remove(key); } return value; } else { Object value = localAttributeHolder.get().put(key, attribute); if(value == null) { value = inheritableAttributeHolder.get().remove(key); } else { inheritableAttributeHolder.get().remove(key); } return value; } }
[ "public", "static", "Object", "putAttribute", "(", "String", "key", ",", "Object", "attribute", ",", "boolean", "inheritable", ")", "{", "if", "(", "inheritable", ")", "{", "Object", "value", "=", "inheritableAttributeHolder", ".", "get", "(", ")", ".", "put", "(", "key", ",", "attribute", ")", ";", "if", "(", "value", "==", "null", ")", "{", "value", "=", "localAttributeHolder", ".", "get", "(", ")", ".", "remove", "(", "key", ")", ";", "}", "else", "{", "localAttributeHolder", ".", "get", "(", ")", ".", "remove", "(", "key", ")", ";", "}", "return", "value", ";", "}", "else", "{", "Object", "value", "=", "localAttributeHolder", ".", "get", "(", ")", ".", "put", "(", "key", ",", "attribute", ")", ";", "if", "(", "value", "==", "null", ")", "{", "value", "=", "inheritableAttributeHolder", ".", "get", "(", ")", ".", "remove", "(", "key", ")", ";", "}", "else", "{", "inheritableAttributeHolder", ".", "get", "(", ")", ".", "remove", "(", "key", ")", ";", "}", "return", "value", ";", "}", "}" ]
Umieszcza wartość atrybutu pod określonym kluczem w zasięgu wątku określonym parametrem wywołania <code>inheritable</code>. @param key Klucz, pod którym atrybut zostanie umieszczony @param attribute Wartość atrybutu do umieszczenia w zasięgu wątku @param inheritable Wartość logiczna określająca, czy atrybut ma być dziedziczony przez wąki dzieci, czy nie, jeśli ma wartość: <ul> <li><code>false</code> - jest atrybutem lokalnym dla bieżącego wątku i nie jest widoczny przez jego dzieci,</li> <li><code>true</code> - jest atrybutem dziedzicznym bieżącego wątku i jest widoczny przez jego dzieci.</li> </ul> @return
[ "Umieszcza", "wartość", "atrybutu", "pod", "określonym", "kluczem", "w", "zasięgu", "wątku", "określonym", "parametrem", "wywołania", "<code", ">", "inheritable<", "/", "code", ">", "." ]
train
https://github.com/kkopacz/agiso-core/blob/b994ec0146be1fe3f10829d69cd719bdbdebe1c5/bundles/agiso-core-lang/src/main/java/org/agiso/core/lang/util/ThreadUtils.java#L127-L145
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.directories_cities_GET
public ArrayList<OvhCity> directories_cities_GET(OvhNumberCountryEnum country, String zipCode) throws IOException { """ Get city informations from a zip code REST: GET /telephony/directories/cities @param country [required] The country of the city @param zipCode [required] The zip code of the city """ String qPath = "/telephony/directories/cities"; StringBuilder sb = path(qPath); query(sb, "country", country); query(sb, "zipCode", zipCode); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, t23); }
java
public ArrayList<OvhCity> directories_cities_GET(OvhNumberCountryEnum country, String zipCode) throws IOException { String qPath = "/telephony/directories/cities"; StringBuilder sb = path(qPath); query(sb, "country", country); query(sb, "zipCode", zipCode); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, t23); }
[ "public", "ArrayList", "<", "OvhCity", ">", "directories_cities_GET", "(", "OvhNumberCountryEnum", "country", ",", "String", "zipCode", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/directories/cities\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "query", "(", "sb", ",", "\"country\"", ",", "country", ")", ";", "query", "(", "sb", ",", "\"zipCode\"", ",", "zipCode", ")", ";", "String", "resp", "=", "execN", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t23", ")", ";", "}" ]
Get city informations from a zip code REST: GET /telephony/directories/cities @param country [required] The country of the city @param zipCode [required] The zip code of the city
[ "Get", "city", "informations", "from", "a", "zip", "code" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L8695-L8702
MenoData/Time4J
base/src/main/java/net/time4j/format/expert/AttributeSet.java
AttributeSet.withInternal
<A> AttributeSet withInternal( AttributeKey<A> key, A value ) { """ <p>Setzt das angegebene interne Attribut neu. </p> @param <A> generic type of attribute value @param key attribute key @param value attribute value (if {@code null} then the attribute will be removed else inserted or updated) @return changed attribute set @since 3.11/4.8 """ Map<String, Object> map = new HashMap<>(this.internals); if (value == null) { map.remove(key.name()); } else { map.put(key.name(), value); } return new AttributeSet(this.attributes, this.locale, this.level, this.section, this.printCondition, map); }
java
<A> AttributeSet withInternal( AttributeKey<A> key, A value ) { Map<String, Object> map = new HashMap<>(this.internals); if (value == null) { map.remove(key.name()); } else { map.put(key.name(), value); } return new AttributeSet(this.attributes, this.locale, this.level, this.section, this.printCondition, map); }
[ "<", "A", ">", "AttributeSet", "withInternal", "(", "AttributeKey", "<", "A", ">", "key", ",", "A", "value", ")", "{", "Map", "<", "String", ",", "Object", ">", "map", "=", "new", "HashMap", "<>", "(", "this", ".", "internals", ")", ";", "if", "(", "value", "==", "null", ")", "{", "map", ".", "remove", "(", "key", ".", "name", "(", ")", ")", ";", "}", "else", "{", "map", ".", "put", "(", "key", ".", "name", "(", ")", ",", "value", ")", ";", "}", "return", "new", "AttributeSet", "(", "this", ".", "attributes", ",", "this", ".", "locale", ",", "this", ".", "level", ",", "this", ".", "section", ",", "this", ".", "printCondition", ",", "map", ")", ";", "}" ]
<p>Setzt das angegebene interne Attribut neu. </p> @param <A> generic type of attribute value @param key attribute key @param value attribute value (if {@code null} then the attribute will be removed else inserted or updated) @return changed attribute set @since 3.11/4.8
[ "<p", ">", "Setzt", "das", "angegebene", "interne", "Attribut", "neu", ".", "<", "/", "p", ">" ]
train
https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/format/expert/AttributeSet.java#L329-L342
knowm/XChart
xchart/src/main/java/org/knowm/xchart/CategoryChart.java
CategoryChart.setCustomCategoryLabels
public void setCustomCategoryLabels(Map<Object, Object> customCategoryLabels) { """ Set custom X-Axis category labels @param customCategoryLabels Map containing category name -> label mappings """ // get the first series AxesChartSeriesCategory axesChartSeries = getSeriesMap().values().iterator().next(); // get the first categories, could be Number Date or String List<?> categories = (List<?>) axesChartSeries.getXData(); Map<Double, Object> axisTickValueLabelMap = new LinkedHashMap<Double, Object>(); for (Entry<Object, Object> entry : customCategoryLabels.entrySet()) { int index = categories.indexOf(entry.getKey()); if (index == -1) { throw new IllegalArgumentException("Could not find category index for " + entry.getKey()); } axisTickValueLabelMap.put((double) index, entry.getValue()); } setXAxisLabelOverrideMap(axisTickValueLabelMap); }
java
public void setCustomCategoryLabels(Map<Object, Object> customCategoryLabels) { // get the first series AxesChartSeriesCategory axesChartSeries = getSeriesMap().values().iterator().next(); // get the first categories, could be Number Date or String List<?> categories = (List<?>) axesChartSeries.getXData(); Map<Double, Object> axisTickValueLabelMap = new LinkedHashMap<Double, Object>(); for (Entry<Object, Object> entry : customCategoryLabels.entrySet()) { int index = categories.indexOf(entry.getKey()); if (index == -1) { throw new IllegalArgumentException("Could not find category index for " + entry.getKey()); } axisTickValueLabelMap.put((double) index, entry.getValue()); } setXAxisLabelOverrideMap(axisTickValueLabelMap); }
[ "public", "void", "setCustomCategoryLabels", "(", "Map", "<", "Object", ",", "Object", ">", "customCategoryLabels", ")", "{", "// get the first series", "AxesChartSeriesCategory", "axesChartSeries", "=", "getSeriesMap", "(", ")", ".", "values", "(", ")", ".", "iterator", "(", ")", ".", "next", "(", ")", ";", "// get the first categories, could be Number Date or String", "List", "<", "?", ">", "categories", "=", "(", "List", "<", "?", ">", ")", "axesChartSeries", ".", "getXData", "(", ")", ";", "Map", "<", "Double", ",", "Object", ">", "axisTickValueLabelMap", "=", "new", "LinkedHashMap", "<", "Double", ",", "Object", ">", "(", ")", ";", "for", "(", "Entry", "<", "Object", ",", "Object", ">", "entry", ":", "customCategoryLabels", ".", "entrySet", "(", ")", ")", "{", "int", "index", "=", "categories", ".", "indexOf", "(", "entry", ".", "getKey", "(", ")", ")", ";", "if", "(", "index", "==", "-", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Could not find category index for \"", "+", "entry", ".", "getKey", "(", ")", ")", ";", "}", "axisTickValueLabelMap", ".", "put", "(", "(", "double", ")", "index", ",", "entry", ".", "getValue", "(", ")", ")", ";", "}", "setXAxisLabelOverrideMap", "(", "axisTickValueLabelMap", ")", ";", "}" ]
Set custom X-Axis category labels @param customCategoryLabels Map containing category name -> label mappings
[ "Set", "custom", "X", "-", "Axis", "category", "labels" ]
train
https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/CategoryChart.java#L351-L368
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/metadata/common/AbstractParser.java
AbstractParser.parseTimeout
protected Timeout parseTimeout(XMLStreamReader reader, Boolean isXa) throws XMLStreamException, ParserException, ValidateException { """ Parse timeout @param reader The reader @param isXa XA flag @return The result @exception XMLStreamException XMLStreamException @exception ParserException ParserException @exception ValidateException ValidateException """ Long blockingTimeoutMillis = null; Long allocationRetryWaitMillis = null; Integer idleTimeoutMinutes = null; Integer allocationRetry = null; Integer xaResourceTimeout = null; Map<String, String> expressions = new HashMap<String, String>(); while (reader.hasNext()) { switch (reader.nextTag()) { case END_ELEMENT : { switch (reader.getLocalName()) { case CommonXML.ELEMENT_TIMEOUT : return new TimeoutImpl(blockingTimeoutMillis, idleTimeoutMinutes, allocationRetry, allocationRetryWaitMillis, xaResourceTimeout, !expressions.isEmpty() ? expressions : null); case CommonXML.ELEMENT_ALLOCATION_RETRY_WAIT_MILLIS : case CommonXML.ELEMENT_ALLOCATION_RETRY : case CommonXML.ELEMENT_BLOCKING_TIMEOUT_MILLIS : case CommonXML.ELEMENT_IDLE_TIMEOUT_MINUTES : case CommonXML.ELEMENT_XA_RESOURCE_TIMEOUT : break; default : throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName())); } } case START_ELEMENT : { switch (reader.getLocalName()) { case CommonXML.ELEMENT_ALLOCATION_RETRY_WAIT_MILLIS : { allocationRetryWaitMillis = elementAsLong(reader, CommonXML.ELEMENT_ALLOCATION_RETRY_WAIT_MILLIS, expressions); break; } case CommonXML.ELEMENT_ALLOCATION_RETRY : { allocationRetry = elementAsInteger(reader, CommonXML.ELEMENT_ALLOCATION_RETRY, expressions); break; } case CommonXML.ELEMENT_BLOCKING_TIMEOUT_MILLIS : { blockingTimeoutMillis = elementAsLong(reader, CommonXML.ELEMENT_BLOCKING_TIMEOUT_MILLIS, expressions); break; } case CommonXML.ELEMENT_IDLE_TIMEOUT_MINUTES : { idleTimeoutMinutes = elementAsInteger(reader, CommonXML.ELEMENT_IDLE_TIMEOUT_MINUTES, expressions); break; } case CommonXML.ELEMENT_XA_RESOURCE_TIMEOUT : { if (isXa != null && Boolean.FALSE.equals(isXa)) throw new ParserException(bundle.unsupportedElement(reader.getLocalName())); xaResourceTimeout = elementAsInteger(reader, CommonXML.ELEMENT_XA_RESOURCE_TIMEOUT, expressions); break; } default : throw new ParserException(bundle.unexpectedElement(reader.getLocalName())); } break; } } } throw new ParserException(bundle.unexpectedEndOfDocument()); }
java
protected Timeout parseTimeout(XMLStreamReader reader, Boolean isXa) throws XMLStreamException, ParserException, ValidateException { Long blockingTimeoutMillis = null; Long allocationRetryWaitMillis = null; Integer idleTimeoutMinutes = null; Integer allocationRetry = null; Integer xaResourceTimeout = null; Map<String, String> expressions = new HashMap<String, String>(); while (reader.hasNext()) { switch (reader.nextTag()) { case END_ELEMENT : { switch (reader.getLocalName()) { case CommonXML.ELEMENT_TIMEOUT : return new TimeoutImpl(blockingTimeoutMillis, idleTimeoutMinutes, allocationRetry, allocationRetryWaitMillis, xaResourceTimeout, !expressions.isEmpty() ? expressions : null); case CommonXML.ELEMENT_ALLOCATION_RETRY_WAIT_MILLIS : case CommonXML.ELEMENT_ALLOCATION_RETRY : case CommonXML.ELEMENT_BLOCKING_TIMEOUT_MILLIS : case CommonXML.ELEMENT_IDLE_TIMEOUT_MINUTES : case CommonXML.ELEMENT_XA_RESOURCE_TIMEOUT : break; default : throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName())); } } case START_ELEMENT : { switch (reader.getLocalName()) { case CommonXML.ELEMENT_ALLOCATION_RETRY_WAIT_MILLIS : { allocationRetryWaitMillis = elementAsLong(reader, CommonXML.ELEMENT_ALLOCATION_RETRY_WAIT_MILLIS, expressions); break; } case CommonXML.ELEMENT_ALLOCATION_RETRY : { allocationRetry = elementAsInteger(reader, CommonXML.ELEMENT_ALLOCATION_RETRY, expressions); break; } case CommonXML.ELEMENT_BLOCKING_TIMEOUT_MILLIS : { blockingTimeoutMillis = elementAsLong(reader, CommonXML.ELEMENT_BLOCKING_TIMEOUT_MILLIS, expressions); break; } case CommonXML.ELEMENT_IDLE_TIMEOUT_MINUTES : { idleTimeoutMinutes = elementAsInteger(reader, CommonXML.ELEMENT_IDLE_TIMEOUT_MINUTES, expressions); break; } case CommonXML.ELEMENT_XA_RESOURCE_TIMEOUT : { if (isXa != null && Boolean.FALSE.equals(isXa)) throw new ParserException(bundle.unsupportedElement(reader.getLocalName())); xaResourceTimeout = elementAsInteger(reader, CommonXML.ELEMENT_XA_RESOURCE_TIMEOUT, expressions); break; } default : throw new ParserException(bundle.unexpectedElement(reader.getLocalName())); } break; } } } throw new ParserException(bundle.unexpectedEndOfDocument()); }
[ "protected", "Timeout", "parseTimeout", "(", "XMLStreamReader", "reader", ",", "Boolean", "isXa", ")", "throws", "XMLStreamException", ",", "ParserException", ",", "ValidateException", "{", "Long", "blockingTimeoutMillis", "=", "null", ";", "Long", "allocationRetryWaitMillis", "=", "null", ";", "Integer", "idleTimeoutMinutes", "=", "null", ";", "Integer", "allocationRetry", "=", "null", ";", "Integer", "xaResourceTimeout", "=", "null", ";", "Map", "<", "String", ",", "String", ">", "expressions", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "while", "(", "reader", ".", "hasNext", "(", ")", ")", "{", "switch", "(", "reader", ".", "nextTag", "(", ")", ")", "{", "case", "END_ELEMENT", ":", "{", "switch", "(", "reader", ".", "getLocalName", "(", ")", ")", "{", "case", "CommonXML", ".", "ELEMENT_TIMEOUT", ":", "return", "new", "TimeoutImpl", "(", "blockingTimeoutMillis", ",", "idleTimeoutMinutes", ",", "allocationRetry", ",", "allocationRetryWaitMillis", ",", "xaResourceTimeout", ",", "!", "expressions", ".", "isEmpty", "(", ")", "?", "expressions", ":", "null", ")", ";", "case", "CommonXML", ".", "ELEMENT_ALLOCATION_RETRY_WAIT_MILLIS", ":", "case", "CommonXML", ".", "ELEMENT_ALLOCATION_RETRY", ":", "case", "CommonXML", ".", "ELEMENT_BLOCKING_TIMEOUT_MILLIS", ":", "case", "CommonXML", ".", "ELEMENT_IDLE_TIMEOUT_MINUTES", ":", "case", "CommonXML", ".", "ELEMENT_XA_RESOURCE_TIMEOUT", ":", "break", ";", "default", ":", "throw", "new", "ParserException", "(", "bundle", ".", "unexpectedEndTag", "(", "reader", ".", "getLocalName", "(", ")", ")", ")", ";", "}", "}", "case", "START_ELEMENT", ":", "{", "switch", "(", "reader", ".", "getLocalName", "(", ")", ")", "{", "case", "CommonXML", ".", "ELEMENT_ALLOCATION_RETRY_WAIT_MILLIS", ":", "{", "allocationRetryWaitMillis", "=", "elementAsLong", "(", "reader", ",", "CommonXML", ".", "ELEMENT_ALLOCATION_RETRY_WAIT_MILLIS", ",", "expressions", ")", ";", "break", ";", "}", "case", "CommonXML", ".", "ELEMENT_ALLOCATION_RETRY", ":", "{", "allocationRetry", "=", "elementAsInteger", "(", "reader", ",", "CommonXML", ".", "ELEMENT_ALLOCATION_RETRY", ",", "expressions", ")", ";", "break", ";", "}", "case", "CommonXML", ".", "ELEMENT_BLOCKING_TIMEOUT_MILLIS", ":", "{", "blockingTimeoutMillis", "=", "elementAsLong", "(", "reader", ",", "CommonXML", ".", "ELEMENT_BLOCKING_TIMEOUT_MILLIS", ",", "expressions", ")", ";", "break", ";", "}", "case", "CommonXML", ".", "ELEMENT_IDLE_TIMEOUT_MINUTES", ":", "{", "idleTimeoutMinutes", "=", "elementAsInteger", "(", "reader", ",", "CommonXML", ".", "ELEMENT_IDLE_TIMEOUT_MINUTES", ",", "expressions", ")", ";", "break", ";", "}", "case", "CommonXML", ".", "ELEMENT_XA_RESOURCE_TIMEOUT", ":", "{", "if", "(", "isXa", "!=", "null", "&&", "Boolean", ".", "FALSE", ".", "equals", "(", "isXa", ")", ")", "throw", "new", "ParserException", "(", "bundle", ".", "unsupportedElement", "(", "reader", ".", "getLocalName", "(", ")", ")", ")", ";", "xaResourceTimeout", "=", "elementAsInteger", "(", "reader", ",", "CommonXML", ".", "ELEMENT_XA_RESOURCE_TIMEOUT", ",", "expressions", ")", ";", "break", ";", "}", "default", ":", "throw", "new", "ParserException", "(", "bundle", ".", "unexpectedElement", "(", "reader", ".", "getLocalName", "(", ")", ")", ")", ";", "}", "break", ";", "}", "}", "}", "throw", "new", "ParserException", "(", "bundle", ".", "unexpectedEndOfDocument", "(", ")", ")", ";", "}" ]
Parse timeout @param reader The reader @param isXa XA flag @return The result @exception XMLStreamException XMLStreamException @exception ParserException ParserException @exception ValidateException ValidateException
[ "Parse", "timeout" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/common/AbstractParser.java#L958-L1025
finmath/finmath-lib
src/main/java6/net/finmath/montecarlo/assetderivativevaluation/products/DigitalOption.java
DigitalOption.getValue
@Override public RandomVariableInterface getValue(double evaluationTime, AssetModelMonteCarloSimulationInterface model) throws CalculationException { """ This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime. Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time. Cashflows prior evaluationTime are not considered. @param evaluationTime The time on which this products value should be observed. @param model The model used to price the product. @return The random variable representing the value of the product discounted to evaluation time @throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method. """ // Get underlying and numeraire // Get S(T) RandomVariableInterface underlyingAtMaturity = model.getAssetValue(maturity, underlyingIndex); // The payoff: values = indicator(underlying - strike, 0) = V(T) = max(S(T)-K,0) RandomVariableInterface values = underlyingAtMaturity.barrier(underlyingAtMaturity.sub(strike), underlyingAtMaturity.mult(0.0).add(1.0), 0.0); // Discounting... RandomVariableInterface numeraireAtMaturity = model.getNumeraire(maturity); RandomVariableInterface monteCarloWeights = model.getMonteCarloWeights(maturity); values = values.div(numeraireAtMaturity).mult(monteCarloWeights); // ...to evaluation time. RandomVariableInterface numeraireAtEvalTime = model.getNumeraire(evaluationTime); RandomVariableInterface monteCarloProbabilitiesAtEvalTime = model.getMonteCarloWeights(evaluationTime); values = values.mult(numeraireAtEvalTime).div(monteCarloProbabilitiesAtEvalTime); return values; }
java
@Override public RandomVariableInterface getValue(double evaluationTime, AssetModelMonteCarloSimulationInterface model) throws CalculationException { // Get underlying and numeraire // Get S(T) RandomVariableInterface underlyingAtMaturity = model.getAssetValue(maturity, underlyingIndex); // The payoff: values = indicator(underlying - strike, 0) = V(T) = max(S(T)-K,0) RandomVariableInterface values = underlyingAtMaturity.barrier(underlyingAtMaturity.sub(strike), underlyingAtMaturity.mult(0.0).add(1.0), 0.0); // Discounting... RandomVariableInterface numeraireAtMaturity = model.getNumeraire(maturity); RandomVariableInterface monteCarloWeights = model.getMonteCarloWeights(maturity); values = values.div(numeraireAtMaturity).mult(monteCarloWeights); // ...to evaluation time. RandomVariableInterface numeraireAtEvalTime = model.getNumeraire(evaluationTime); RandomVariableInterface monteCarloProbabilitiesAtEvalTime = model.getMonteCarloWeights(evaluationTime); values = values.mult(numeraireAtEvalTime).div(monteCarloProbabilitiesAtEvalTime); return values; }
[ "@", "Override", "public", "RandomVariableInterface", "getValue", "(", "double", "evaluationTime", ",", "AssetModelMonteCarloSimulationInterface", "model", ")", "throws", "CalculationException", "{", "// Get underlying and numeraire", "// Get S(T)", "RandomVariableInterface", "underlyingAtMaturity", "=", "model", ".", "getAssetValue", "(", "maturity", ",", "underlyingIndex", ")", ";", "// The payoff: values = indicator(underlying - strike, 0) = V(T) = max(S(T)-K,0)", "RandomVariableInterface", "values", "=", "underlyingAtMaturity", ".", "barrier", "(", "underlyingAtMaturity", ".", "sub", "(", "strike", ")", ",", "underlyingAtMaturity", ".", "mult", "(", "0.0", ")", ".", "add", "(", "1.0", ")", ",", "0.0", ")", ";", "// Discounting...", "RandomVariableInterface", "numeraireAtMaturity", "=", "model", ".", "getNumeraire", "(", "maturity", ")", ";", "RandomVariableInterface", "monteCarloWeights", "=", "model", ".", "getMonteCarloWeights", "(", "maturity", ")", ";", "values", "=", "values", ".", "div", "(", "numeraireAtMaturity", ")", ".", "mult", "(", "monteCarloWeights", ")", ";", "// ...to evaluation time.", "RandomVariableInterface", "numeraireAtEvalTime", "=", "model", ".", "getNumeraire", "(", "evaluationTime", ")", ";", "RandomVariableInterface", "monteCarloProbabilitiesAtEvalTime", "=", "model", ".", "getMonteCarloWeights", "(", "evaluationTime", ")", ";", "values", "=", "values", ".", "mult", "(", "numeraireAtEvalTime", ")", ".", "div", "(", "monteCarloProbabilitiesAtEvalTime", ")", ";", "return", "values", ";", "}" ]
This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime. Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time. Cashflows prior evaluationTime are not considered. @param evaluationTime The time on which this products value should be observed. @param model The model used to price the product. @return The random variable representing the value of the product discounted to evaluation time @throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method.
[ "This", "method", "returns", "the", "value", "random", "variable", "of", "the", "product", "within", "the", "specified", "model", "evaluated", "at", "a", "given", "evalutationTime", ".", "Note", ":", "For", "a", "lattice", "this", "is", "often", "the", "value", "conditional", "to", "evalutationTime", "for", "a", "Monte", "-", "Carlo", "simulation", "this", "is", "the", "(", "sum", "of", ")", "value", "discounted", "to", "evaluation", "time", ".", "Cashflows", "prior", "evaluationTime", "are", "not", "considered", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/montecarlo/assetderivativevaluation/products/DigitalOption.java#L70-L91
michael-rapp/AndroidMaterialDialog
library/src/main/java/de/mrapp/android/dialog/view/ScrollView.java
ScrollView.notifyOnScrolled
private void notifyOnScrolled(final boolean scrolledToTop, final boolean scrolledToBottom) { """ Notifies, when the scroll view has been scrolled. @param scrolledToTop True, if the scroll view is scrolled to the top, false otherwise @param scrolledToBottom True, if the scroll view is scrolled to the bottom, false otherwise """ for (ScrollListener listener : scrollListeners) { listener.onScrolled(scrolledToTop, scrolledToBottom); } }
java
private void notifyOnScrolled(final boolean scrolledToTop, final boolean scrolledToBottom) { for (ScrollListener listener : scrollListeners) { listener.onScrolled(scrolledToTop, scrolledToBottom); } }
[ "private", "void", "notifyOnScrolled", "(", "final", "boolean", "scrolledToTop", ",", "final", "boolean", "scrolledToBottom", ")", "{", "for", "(", "ScrollListener", "listener", ":", "scrollListeners", ")", "{", "listener", ".", "onScrolled", "(", "scrolledToTop", ",", "scrolledToBottom", ")", ";", "}", "}" ]
Notifies, when the scroll view has been scrolled. @param scrolledToTop True, if the scroll view is scrolled to the top, false otherwise @param scrolledToBottom True, if the scroll view is scrolled to the bottom, false otherwise
[ "Notifies", "when", "the", "scroll", "view", "has", "been", "scrolled", "." ]
train
https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/view/ScrollView.java#L76-L80
enasequence/sequencetools
src/main/java/uk/ac/ebi/embl/template/TemplateFactory.java
TemplateFactory.getTemplateInfo
public TemplateInfo getTemplateInfo(String templateId, Integer templateVersion) throws TemplateException { """ /* public List<TemplateInfo> getRNALatestIncludedTemplates() { List<TemplateInfo> rnaTemplates = getLatestIncludedTemplatesById(TemplateIDs.RNA_TEMPLATE_IDs); Collections.sort(rnaTemplates, new TemplateOrderComparator<TemplateInfo>(templateOrders)); return rnaTemplates; } """ if (templateSet.containsTemplateId(templateId)) { TemplateVersions versionMap = templateSet.getTemplateVersions(templateId); if (versionMap.containsVersion(templateVersion)) return versionMap.getTemplate(templateVersion); throw new TemplateException("No template found with VERSION : " + templateVersion + " and ID: " + templateId); } throw new TemplateException("No template found with ID : " + templateId); }
java
public TemplateInfo getTemplateInfo(String templateId, Integer templateVersion) throws TemplateException { if (templateSet.containsTemplateId(templateId)) { TemplateVersions versionMap = templateSet.getTemplateVersions(templateId); if (versionMap.containsVersion(templateVersion)) return versionMap.getTemplate(templateVersion); throw new TemplateException("No template found with VERSION : " + templateVersion + " and ID: " + templateId); } throw new TemplateException("No template found with ID : " + templateId); }
[ "public", "TemplateInfo", "getTemplateInfo", "(", "String", "templateId", ",", "Integer", "templateVersion", ")", "throws", "TemplateException", "{", "if", "(", "templateSet", ".", "containsTemplateId", "(", "templateId", ")", ")", "{", "TemplateVersions", "versionMap", "=", "templateSet", ".", "getTemplateVersions", "(", "templateId", ")", ";", "if", "(", "versionMap", ".", "containsVersion", "(", "templateVersion", ")", ")", "return", "versionMap", ".", "getTemplate", "(", "templateVersion", ")", ";", "throw", "new", "TemplateException", "(", "\"No template found with VERSION : \"", "+", "templateVersion", "+", "\" and ID: \"", "+", "templateId", ")", ";", "}", "throw", "new", "TemplateException", "(", "\"No template found with ID : \"", "+", "templateId", ")", ";", "}" ]
/* public List<TemplateInfo> getRNALatestIncludedTemplates() { List<TemplateInfo> rnaTemplates = getLatestIncludedTemplatesById(TemplateIDs.RNA_TEMPLATE_IDs); Collections.sort(rnaTemplates, new TemplateOrderComparator<TemplateInfo>(templateOrders)); return rnaTemplates; }
[ "/", "*", "public", "List<TemplateInfo", ">", "getRNALatestIncludedTemplates", "()", "{", "List<TemplateInfo", ">", "rnaTemplates", "=", "getLatestIncludedTemplatesById", "(", "TemplateIDs", ".", "RNA_TEMPLATE_IDs", ")", ";", "Collections", ".", "sort", "(", "rnaTemplates", "new", "TemplateOrderComparator<TemplateInfo", ">", "(", "templateOrders", "))", ";", "return", "rnaTemplates", ";", "}" ]
train
https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/template/TemplateFactory.java#L134-L142
knightliao/disconf
disconf-web/src/main/java/com/baidu/unbiz/common/genericdao/util/ClassUtils.java
ClassUtils.getFieldFromClass
public static Field getFieldFromClass(String field, Class<? extends Object> clazz) { """ 获取一个类的field @param field @param class1 @return 下午3:01:19 created by Darwin(Tianxin) """ try { return clazz.getDeclaredField(field); } catch (Exception e) { try { return clazz.getField(field); } catch (Exception ex) { } } return null; }
java
public static Field getFieldFromClass(String field, Class<? extends Object> clazz) { try { return clazz.getDeclaredField(field); } catch (Exception e) { try { return clazz.getField(field); } catch (Exception ex) { } } return null; }
[ "public", "static", "Field", "getFieldFromClass", "(", "String", "field", ",", "Class", "<", "?", "extends", "Object", ">", "clazz", ")", "{", "try", "{", "return", "clazz", ".", "getDeclaredField", "(", "field", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "try", "{", "return", "clazz", ".", "getField", "(", "field", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "}", "}", "return", "null", ";", "}" ]
获取一个类的field @param field @param class1 @return 下午3:01:19 created by Darwin(Tianxin)
[ "获取一个类的field" ]
train
https://github.com/knightliao/disconf/blob/d413cbce9334fe38a5a24982ce4db3a6ed8e98ea/disconf-web/src/main/java/com/baidu/unbiz/common/genericdao/util/ClassUtils.java#L179-L189
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.listVips
public AddressResponseInner listVips(String resourceGroupName, String name) { """ Get IP addresses assigned to an App Service Environment. Get IP addresses assigned to an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the AddressResponseInner object if successful. """ return listVipsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); }
java
public AddressResponseInner listVips(String resourceGroupName, String name) { return listVipsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); }
[ "public", "AddressResponseInner", "listVips", "(", "String", "resourceGroupName", ",", "String", "name", ")", "{", "return", "listVipsWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Get IP addresses assigned to an App Service Environment. Get IP addresses assigned to an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the AddressResponseInner object if successful.
[ "Get", "IP", "addresses", "assigned", "to", "an", "App", "Service", "Environment", ".", "Get", "IP", "addresses", "assigned", "to", "an", "App", "Service", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L1426-L1428
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/convolutional/KerasConvolution1D.java
KerasConvolution1D.setWeights
@Override public void setWeights(Map<String, INDArray> weights) throws InvalidKerasConfigurationException { """ Set weights for layer. @param weights Map from parameter name to INDArray. """ this.weights = new HashMap<>(); if (weights.containsKey(conf.getKERAS_PARAM_NAME_W())) { INDArray kerasParamValue = weights.get(conf.getKERAS_PARAM_NAME_W()); INDArray paramValue; switch (this.getDimOrder()) { case TENSORFLOW: paramValue = kerasParamValue.permute(2, 1, 0); paramValue = paramValue.reshape( paramValue.size(0), paramValue.size(1), paramValue.size(2), 1); break; case THEANO: paramValue = kerasParamValue.permute(2, 1, 0); paramValue = paramValue.reshape( paramValue.size(0), paramValue.size(1), paramValue.size(2), 1).dup(); for (int i = 0; i < paramValue.tensorsAlongDimension(2, 3); i++) { INDArray copyFilter = paramValue.tensorAlongDimension(i, 2, 3).dup(); double[] flattenedFilter = copyFilter.ravel().data().asDouble(); ArrayUtils.reverse(flattenedFilter); INDArray newFilter = Nd4j.create(flattenedFilter, copyFilter.shape()); INDArray inPlaceFilter = paramValue.tensorAlongDimension(i, 2, 3); inPlaceFilter.muli(0).addi(newFilter); } break; default: throw new InvalidKerasConfigurationException("Unknown keras backend " + this.getDimOrder()); } this.weights.put(ConvolutionParamInitializer.WEIGHT_KEY, paramValue); } else throw new InvalidKerasConfigurationException( "Parameter " + conf.getKERAS_PARAM_NAME_W() + " does not exist in weights"); if (hasBias) { if (weights.containsKey(conf.getKERAS_PARAM_NAME_B())) this.weights.put(ConvolutionParamInitializer.BIAS_KEY, weights.get(conf.getKERAS_PARAM_NAME_B())); else throw new InvalidKerasConfigurationException( "Parameter " + conf.getKERAS_PARAM_NAME_B() + " does not exist in weights"); } removeDefaultWeights(weights, conf); }
java
@Override public void setWeights(Map<String, INDArray> weights) throws InvalidKerasConfigurationException { this.weights = new HashMap<>(); if (weights.containsKey(conf.getKERAS_PARAM_NAME_W())) { INDArray kerasParamValue = weights.get(conf.getKERAS_PARAM_NAME_W()); INDArray paramValue; switch (this.getDimOrder()) { case TENSORFLOW: paramValue = kerasParamValue.permute(2, 1, 0); paramValue = paramValue.reshape( paramValue.size(0), paramValue.size(1), paramValue.size(2), 1); break; case THEANO: paramValue = kerasParamValue.permute(2, 1, 0); paramValue = paramValue.reshape( paramValue.size(0), paramValue.size(1), paramValue.size(2), 1).dup(); for (int i = 0; i < paramValue.tensorsAlongDimension(2, 3); i++) { INDArray copyFilter = paramValue.tensorAlongDimension(i, 2, 3).dup(); double[] flattenedFilter = copyFilter.ravel().data().asDouble(); ArrayUtils.reverse(flattenedFilter); INDArray newFilter = Nd4j.create(flattenedFilter, copyFilter.shape()); INDArray inPlaceFilter = paramValue.tensorAlongDimension(i, 2, 3); inPlaceFilter.muli(0).addi(newFilter); } break; default: throw new InvalidKerasConfigurationException("Unknown keras backend " + this.getDimOrder()); } this.weights.put(ConvolutionParamInitializer.WEIGHT_KEY, paramValue); } else throw new InvalidKerasConfigurationException( "Parameter " + conf.getKERAS_PARAM_NAME_W() + " does not exist in weights"); if (hasBias) { if (weights.containsKey(conf.getKERAS_PARAM_NAME_B())) this.weights.put(ConvolutionParamInitializer.BIAS_KEY, weights.get(conf.getKERAS_PARAM_NAME_B())); else throw new InvalidKerasConfigurationException( "Parameter " + conf.getKERAS_PARAM_NAME_B() + " does not exist in weights"); } removeDefaultWeights(weights, conf); }
[ "@", "Override", "public", "void", "setWeights", "(", "Map", "<", "String", ",", "INDArray", ">", "weights", ")", "throws", "InvalidKerasConfigurationException", "{", "this", ".", "weights", "=", "new", "HashMap", "<>", "(", ")", ";", "if", "(", "weights", ".", "containsKey", "(", "conf", ".", "getKERAS_PARAM_NAME_W", "(", ")", ")", ")", "{", "INDArray", "kerasParamValue", "=", "weights", ".", "get", "(", "conf", ".", "getKERAS_PARAM_NAME_W", "(", ")", ")", ";", "INDArray", "paramValue", ";", "switch", "(", "this", ".", "getDimOrder", "(", ")", ")", "{", "case", "TENSORFLOW", ":", "paramValue", "=", "kerasParamValue", ".", "permute", "(", "2", ",", "1", ",", "0", ")", ";", "paramValue", "=", "paramValue", ".", "reshape", "(", "paramValue", ".", "size", "(", "0", ")", ",", "paramValue", ".", "size", "(", "1", ")", ",", "paramValue", ".", "size", "(", "2", ")", ",", "1", ")", ";", "break", ";", "case", "THEANO", ":", "paramValue", "=", "kerasParamValue", ".", "permute", "(", "2", ",", "1", ",", "0", ")", ";", "paramValue", "=", "paramValue", ".", "reshape", "(", "paramValue", ".", "size", "(", "0", ")", ",", "paramValue", ".", "size", "(", "1", ")", ",", "paramValue", ".", "size", "(", "2", ")", ",", "1", ")", ".", "dup", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "paramValue", ".", "tensorsAlongDimension", "(", "2", ",", "3", ")", ";", "i", "++", ")", "{", "INDArray", "copyFilter", "=", "paramValue", ".", "tensorAlongDimension", "(", "i", ",", "2", ",", "3", ")", ".", "dup", "(", ")", ";", "double", "[", "]", "flattenedFilter", "=", "copyFilter", ".", "ravel", "(", ")", ".", "data", "(", ")", ".", "asDouble", "(", ")", ";", "ArrayUtils", ".", "reverse", "(", "flattenedFilter", ")", ";", "INDArray", "newFilter", "=", "Nd4j", ".", "create", "(", "flattenedFilter", ",", "copyFilter", ".", "shape", "(", ")", ")", ";", "INDArray", "inPlaceFilter", "=", "paramValue", ".", "tensorAlongDimension", "(", "i", ",", "2", ",", "3", ")", ";", "inPlaceFilter", ".", "muli", "(", "0", ")", ".", "addi", "(", "newFilter", ")", ";", "}", "break", ";", "default", ":", "throw", "new", "InvalidKerasConfigurationException", "(", "\"Unknown keras backend \"", "+", "this", ".", "getDimOrder", "(", ")", ")", ";", "}", "this", ".", "weights", ".", "put", "(", "ConvolutionParamInitializer", ".", "WEIGHT_KEY", ",", "paramValue", ")", ";", "}", "else", "throw", "new", "InvalidKerasConfigurationException", "(", "\"Parameter \"", "+", "conf", ".", "getKERAS_PARAM_NAME_W", "(", ")", "+", "\" does not exist in weights\"", ")", ";", "if", "(", "hasBias", ")", "{", "if", "(", "weights", ".", "containsKey", "(", "conf", ".", "getKERAS_PARAM_NAME_B", "(", ")", ")", ")", "this", ".", "weights", ".", "put", "(", "ConvolutionParamInitializer", ".", "BIAS_KEY", ",", "weights", ".", "get", "(", "conf", ".", "getKERAS_PARAM_NAME_B", "(", ")", ")", ")", ";", "else", "throw", "new", "InvalidKerasConfigurationException", "(", "\"Parameter \"", "+", "conf", ".", "getKERAS_PARAM_NAME_B", "(", ")", "+", "\" does not exist in weights\"", ")", ";", "}", "removeDefaultWeights", "(", "weights", ",", "conf", ")", ";", "}" ]
Set weights for layer. @param weights Map from parameter name to INDArray.
[ "Set", "weights", "for", "layer", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/convolutional/KerasConvolution1D.java#L177-L222
google/closure-compiler
src/com/google/javascript/jscomp/NodeUtil.java
NodeUtil.getNameReferenceCount
static int getNameReferenceCount(Node node, String name) { """ Finds the number of times a simple name is referenced within the node tree. """ return getCount(node, new MatchNameNode(name), Predicates.alwaysTrue()); }
java
static int getNameReferenceCount(Node node, String name) { return getCount(node, new MatchNameNode(name), Predicates.alwaysTrue()); }
[ "static", "int", "getNameReferenceCount", "(", "Node", "node", ",", "String", "name", ")", "{", "return", "getCount", "(", "node", ",", "new", "MatchNameNode", "(", "name", ")", ",", "Predicates", ".", "alwaysTrue", "(", ")", ")", ";", "}" ]
Finds the number of times a simple name is referenced within the node tree.
[ "Finds", "the", "number", "of", "times", "a", "simple", "name", "is", "referenced", "within", "the", "node", "tree", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L4667-L4669
Stratio/stratio-cassandra
src/java/org/apache/cassandra/io/sstable/ColumnNameHelper.java
ColumnNameHelper.overlaps
public static boolean overlaps(List<ByteBuffer> minColumnNames1, List<ByteBuffer> maxColumnNames1, List<ByteBuffer> minColumnNames2, List<ByteBuffer> maxColumnNames2, CellNameType comparator) { """ Checks if the given min/max column names could overlap (i.e they could share some column names based on the max/min column names in the sstables) """ if (minColumnNames1.isEmpty() || maxColumnNames1.isEmpty() || minColumnNames2.isEmpty() || maxColumnNames2.isEmpty()) return true; return !(compare(maxColumnNames1, minColumnNames2, comparator) < 0 || compare(minColumnNames1, maxColumnNames2, comparator) > 0); }
java
public static boolean overlaps(List<ByteBuffer> minColumnNames1, List<ByteBuffer> maxColumnNames1, List<ByteBuffer> minColumnNames2, List<ByteBuffer> maxColumnNames2, CellNameType comparator) { if (minColumnNames1.isEmpty() || maxColumnNames1.isEmpty() || minColumnNames2.isEmpty() || maxColumnNames2.isEmpty()) return true; return !(compare(maxColumnNames1, minColumnNames2, comparator) < 0 || compare(minColumnNames1, maxColumnNames2, comparator) > 0); }
[ "public", "static", "boolean", "overlaps", "(", "List", "<", "ByteBuffer", ">", "minColumnNames1", ",", "List", "<", "ByteBuffer", ">", "maxColumnNames1", ",", "List", "<", "ByteBuffer", ">", "minColumnNames2", ",", "List", "<", "ByteBuffer", ">", "maxColumnNames2", ",", "CellNameType", "comparator", ")", "{", "if", "(", "minColumnNames1", ".", "isEmpty", "(", ")", "||", "maxColumnNames1", ".", "isEmpty", "(", ")", "||", "minColumnNames2", ".", "isEmpty", "(", ")", "||", "maxColumnNames2", ".", "isEmpty", "(", ")", ")", "return", "true", ";", "return", "!", "(", "compare", "(", "maxColumnNames1", ",", "minColumnNames2", ",", "comparator", ")", "<", "0", "||", "compare", "(", "minColumnNames1", ",", "maxColumnNames2", ",", "comparator", ")", ">", "0", ")", ";", "}" ]
Checks if the given min/max column names could overlap (i.e they could share some column names based on the max/min column names in the sstables)
[ "Checks", "if", "the", "given", "min", "/", "max", "column", "names", "could", "overlap", "(", "i", ".", "e", "they", "could", "share", "some", "column", "names", "based", "on", "the", "max", "/", "min", "column", "names", "in", "the", "sstables", ")" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/io/sstable/ColumnNameHelper.java#L224-L230
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/RouteFiltersInner.java
RouteFiltersInner.updateAsync
public Observable<RouteFilterInner> updateAsync(String resourceGroupName, String routeFilterName, PatchRouteFilter routeFilterParameters) { """ Updates a route filter in a specified resource group. @param resourceGroupName The name of the resource group. @param routeFilterName The name of the route filter. @param routeFilterParameters Parameters supplied to the update route filter operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return updateWithServiceResponseAsync(resourceGroupName, routeFilterName, routeFilterParameters).map(new Func1<ServiceResponse<RouteFilterInner>, RouteFilterInner>() { @Override public RouteFilterInner call(ServiceResponse<RouteFilterInner> response) { return response.body(); } }); }
java
public Observable<RouteFilterInner> updateAsync(String resourceGroupName, String routeFilterName, PatchRouteFilter routeFilterParameters) { return updateWithServiceResponseAsync(resourceGroupName, routeFilterName, routeFilterParameters).map(new Func1<ServiceResponse<RouteFilterInner>, RouteFilterInner>() { @Override public RouteFilterInner call(ServiceResponse<RouteFilterInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RouteFilterInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "routeFilterName", ",", "PatchRouteFilter", "routeFilterParameters", ")", "{", "return", "updateWithServiceResponseAsync", "(", "resourceGroupName", ",", "routeFilterName", ",", "routeFilterParameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "RouteFilterInner", ">", ",", "RouteFilterInner", ">", "(", ")", "{", "@", "Override", "public", "RouteFilterInner", "call", "(", "ServiceResponse", "<", "RouteFilterInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Updates a route filter in a specified resource group. @param resourceGroupName The name of the resource group. @param routeFilterName The name of the route filter. @param routeFilterParameters Parameters supplied to the update route filter operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Updates", "a", "route", "filter", "in", "a", "specified", "resource", "group", "." ]
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/RouteFiltersInner.java#L638-L645
haraldk/TwelveMonkeys
servlet/src/main/java/com/twelvemonkeys/servlet/ServletUtil.java
ServletUtil.getLongParameter
public static long getLongParameter(final ServletRequest pReq, final String pName, final long pDefault) { """ Gets the value of the given parameter from the request converted to an {@code long}.&nbsp;If the parameter is not set or not parseable, the default value is returned. @param pReq the servlet request @param pName the parameter name @param pDefault the default value @return the value of the parameter converted to an {@code long}, or the default value, if the parameter is not set. """ String str = pReq.getParameter(pName); try { return str != null ? Long.parseLong(str) : pDefault; } catch (NumberFormatException nfe) { return pDefault; } }
java
public static long getLongParameter(final ServletRequest pReq, final String pName, final long pDefault) { String str = pReq.getParameter(pName); try { return str != null ? Long.parseLong(str) : pDefault; } catch (NumberFormatException nfe) { return pDefault; } }
[ "public", "static", "long", "getLongParameter", "(", "final", "ServletRequest", "pReq", ",", "final", "String", "pName", ",", "final", "long", "pDefault", ")", "{", "String", "str", "=", "pReq", ".", "getParameter", "(", "pName", ")", ";", "try", "{", "return", "str", "!=", "null", "?", "Long", ".", "parseLong", "(", "str", ")", ":", "pDefault", ";", "}", "catch", "(", "NumberFormatException", "nfe", ")", "{", "return", "pDefault", ";", "}", "}" ]
Gets the value of the given parameter from the request converted to an {@code long}.&nbsp;If the parameter is not set or not parseable, the default value is returned. @param pReq the servlet request @param pName the parameter name @param pDefault the default value @return the value of the parameter converted to an {@code long}, or the default value, if the parameter is not set.
[ "Gets", "the", "value", "of", "the", "given", "parameter", "from", "the", "request", "converted", "to", "an", "{", "@code", "long", "}", ".", "&nbsp", ";", "If", "the", "parameter", "is", "not", "set", "or", "not", "parseable", "the", "default", "value", "is", "returned", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/ServletUtil.java#L228-L237
heinrichreimer/material-drawer
library/src/main/java/com/heinrichreimersoftware/materialdrawer/structure/DrawerItem.java
DrawerItem.setRoundedImage
public DrawerItem setRoundedImage(BitmapDrawable image, int imageMode) { """ Sets a rounded image with a given image mode to the drawer item @param image Image to set @param imageMode Image mode to set """ return setImage(new RoundedAvatarDrawable(image.getBitmap()), imageMode); }
java
public DrawerItem setRoundedImage(BitmapDrawable image, int imageMode) { return setImage(new RoundedAvatarDrawable(image.getBitmap()), imageMode); }
[ "public", "DrawerItem", "setRoundedImage", "(", "BitmapDrawable", "image", ",", "int", "imageMode", ")", "{", "return", "setImage", "(", "new", "RoundedAvatarDrawable", "(", "image", ".", "getBitmap", "(", ")", ")", ",", "imageMode", ")", ";", "}" ]
Sets a rounded image with a given image mode to the drawer item @param image Image to set @param imageMode Image mode to set
[ "Sets", "a", "rounded", "image", "with", "a", "given", "image", "mode", "to", "the", "drawer", "item" ]
train
https://github.com/heinrichreimer/material-drawer/blob/7c2406812d73f710ef8bb73d4a0f4bbef3b275ce/library/src/main/java/com/heinrichreimersoftware/materialdrawer/structure/DrawerItem.java#L213-L215
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/raytrace/RaytraceChunk.java
RaytraceChunk.getMin
public double getMin(double x, double z) { """ Gets the minimum value of <code>x</code>, <code>z</code>. @param x the x @param z the z @return <code>Double.NaN</code> if <code>x</code> and <code>z</code> are all three <code>Double.NaN</code> """ double ret = Double.NaN; if (!Double.isNaN(x)) ret = x; if (!Double.isNaN(z)) { if (!Double.isNaN(ret)) ret = Math.min(ret, z); else ret = z; } return ret; }
java
public double getMin(double x, double z) { double ret = Double.NaN; if (!Double.isNaN(x)) ret = x; if (!Double.isNaN(z)) { if (!Double.isNaN(ret)) ret = Math.min(ret, z); else ret = z; } return ret; }
[ "public", "double", "getMin", "(", "double", "x", ",", "double", "z", ")", "{", "double", "ret", "=", "Double", ".", "NaN", ";", "if", "(", "!", "Double", ".", "isNaN", "(", "x", ")", ")", "ret", "=", "x", ";", "if", "(", "!", "Double", ".", "isNaN", "(", "z", ")", ")", "{", "if", "(", "!", "Double", ".", "isNaN", "(", "ret", ")", ")", "ret", "=", "Math", ".", "min", "(", "ret", ",", "z", ")", ";", "else", "ret", "=", "z", ";", "}", "return", "ret", ";", "}" ]
Gets the minimum value of <code>x</code>, <code>z</code>. @param x the x @param z the z @return <code>Double.NaN</code> if <code>x</code> and <code>z</code> are all three <code>Double.NaN</code>
[ "Gets", "the", "minimum", "value", "of", "<code", ">", "x<", "/", "code", ">", "<code", ">", "z<", "/", "code", ">", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/raytrace/RaytraceChunk.java#L172-L185
vkostyukov/la4j
src/main/java/org/la4j/Matrices.java
Matrices.asDivFunction
public static MatrixFunction asDivFunction(final double arg) { """ Creates a div function that divides it's argument by given {@code value}. @param arg a divisor value @return a closure that does {@code _ / _} """ return new MatrixFunction() { @Override public double evaluate(int i, int j, double value) { return value / arg; } }; }
java
public static MatrixFunction asDivFunction(final double arg) { return new MatrixFunction() { @Override public double evaluate(int i, int j, double value) { return value / arg; } }; }
[ "public", "static", "MatrixFunction", "asDivFunction", "(", "final", "double", "arg", ")", "{", "return", "new", "MatrixFunction", "(", ")", "{", "@", "Override", "public", "double", "evaluate", "(", "int", "i", ",", "int", "j", ",", "double", "value", ")", "{", "return", "value", "/", "arg", ";", "}", "}", ";", "}" ]
Creates a div function that divides it's argument by given {@code value}. @param arg a divisor value @return a closure that does {@code _ / _}
[ "Creates", "a", "div", "function", "that", "divides", "it", "s", "argument", "by", "given", "{", "@code", "value", "}", "." ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrices.java#L487-L494
jamesdbloom/mockserver
mockserver-core/src/main/java/org/mockserver/model/HttpRequest.java
HttpRequest.withQueryStringParameter
public HttpRequest withQueryStringParameter(NottableString name, NottableString... values) { """ Adds one query string parameter to match on or to not match on using the NottableString, each NottableString can either be a positive matching value, such as string("match"), or a value to not match on, such as not("do not match"), the string values passed to the NottableString can also be a plain string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html) @param name the parameter name as a NottableString @param values the parameter values which can be a varags of NottableStrings """ this.queryStringParameters.withEntry(name, values); return this; }
java
public HttpRequest withQueryStringParameter(NottableString name, NottableString... values) { this.queryStringParameters.withEntry(name, values); return this; }
[ "public", "HttpRequest", "withQueryStringParameter", "(", "NottableString", "name", ",", "NottableString", "...", "values", ")", "{", "this", ".", "queryStringParameters", ".", "withEntry", "(", "name", ",", "values", ")", ";", "return", "this", ";", "}" ]
Adds one query string parameter to match on or to not match on using the NottableString, each NottableString can either be a positive matching value, such as string("match"), or a value to not match on, such as not("do not match"), the string values passed to the NottableString can also be a plain string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html) @param name the parameter name as a NottableString @param values the parameter values which can be a varags of NottableStrings
[ "Adds", "one", "query", "string", "parameter", "to", "match", "on", "or", "to", "not", "match", "on", "using", "the", "NottableString", "each", "NottableString", "can", "either", "be", "a", "positive", "matching", "value", "such", "as", "string", "(", "match", ")", "or", "a", "value", "to", "not", "match", "on", "such", "as", "not", "(", "do", "not", "match", ")", "the", "string", "values", "passed", "to", "the", "NottableString", "can", "also", "be", "a", "plain", "string", "or", "a", "regex", "(", "for", "more", "details", "of", "the", "supported", "regex", "syntax", "see", "http", ":", "//", "docs", ".", "oracle", ".", "com", "/", "javase", "/", "6", "/", "docs", "/", "api", "/", "java", "/", "util", "/", "regex", "/", "Pattern", ".", "html", ")" ]
train
https://github.com/jamesdbloom/mockserver/blob/8b84fdd877e57b4eb780c9f8c8b1d65bcb448025/mockserver-core/src/main/java/org/mockserver/model/HttpRequest.java#L212-L215
googleapis/google-cloud-java
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
DataLabelingServiceClient.listExamples
public final ListExamplesPagedResponse listExamples(String parent, String filter) { """ Lists examples in an annotated dataset. Pagination is supported. <p>Sample code: <pre><code> try (DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient.create()) { String formattedParent = DataLabelingServiceClient.formatAnnotatedDatasetName("[PROJECT]", "[DATASET]", "[ANNOTATED_DATASET]"); String filter = ""; for (Example element : dataLabelingServiceClient.listExamples(formattedParent, filter).iterateAll()) { // doThingsWith(element); } } </code></pre> @param parent Required. Example resource parent. @param filter Optional. An expression for filtering Examples. For annotated datasets that have annotation spec set, filter by annotation_spec.display_name is supported. Format "annotation_spec.display_name = {display_name}" @throws com.google.api.gax.rpc.ApiException if the remote call fails """ ANNOTATED_DATASET_PATH_TEMPLATE.validate(parent, "listExamples"); ListExamplesRequest request = ListExamplesRequest.newBuilder().setParent(parent).setFilter(filter).build(); return listExamples(request); }
java
public final ListExamplesPagedResponse listExamples(String parent, String filter) { ANNOTATED_DATASET_PATH_TEMPLATE.validate(parent, "listExamples"); ListExamplesRequest request = ListExamplesRequest.newBuilder().setParent(parent).setFilter(filter).build(); return listExamples(request); }
[ "public", "final", "ListExamplesPagedResponse", "listExamples", "(", "String", "parent", ",", "String", "filter", ")", "{", "ANNOTATED_DATASET_PATH_TEMPLATE", ".", "validate", "(", "parent", ",", "\"listExamples\"", ")", ";", "ListExamplesRequest", "request", "=", "ListExamplesRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", ")", ".", "setFilter", "(", "filter", ")", ".", "build", "(", ")", ";", "return", "listExamples", "(", "request", ")", ";", "}" ]
Lists examples in an annotated dataset. Pagination is supported. <p>Sample code: <pre><code> try (DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient.create()) { String formattedParent = DataLabelingServiceClient.formatAnnotatedDatasetName("[PROJECT]", "[DATASET]", "[ANNOTATED_DATASET]"); String filter = ""; for (Example element : dataLabelingServiceClient.listExamples(formattedParent, filter).iterateAll()) { // doThingsWith(element); } } </code></pre> @param parent Required. Example resource parent. @param filter Optional. An expression for filtering Examples. For annotated datasets that have annotation spec set, filter by annotation_spec.display_name is supported. Format "annotation_spec.display_name = {display_name}" @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Lists", "examples", "in", "an", "annotated", "dataset", ".", "Pagination", "is", "supported", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L1990-L1995
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerAgentUtils.java
DockerAgentUtils.getImageIdFromAgent
public static String getImageIdFromAgent(Launcher launcher, final String imageTag, final String host) throws IOException, InterruptedException { """ Get image ID from imageTag on the current agent. @param imageTag @return """ return launcher.getChannel().call(new MasterToSlaveCallable<String, IOException>() { public String call() throws IOException { return DockerUtils.getImageIdFromTag(imageTag, host); } }); }
java
public static String getImageIdFromAgent(Launcher launcher, final String imageTag, final String host) throws IOException, InterruptedException { return launcher.getChannel().call(new MasterToSlaveCallable<String, IOException>() { public String call() throws IOException { return DockerUtils.getImageIdFromTag(imageTag, host); } }); }
[ "public", "static", "String", "getImageIdFromAgent", "(", "Launcher", "launcher", ",", "final", "String", "imageTag", ",", "final", "String", "host", ")", "throws", "IOException", ",", "InterruptedException", "{", "return", "launcher", ".", "getChannel", "(", ")", ".", "call", "(", "new", "MasterToSlaveCallable", "<", "String", ",", "IOException", ">", "(", ")", "{", "public", "String", "call", "(", ")", "throws", "IOException", "{", "return", "DockerUtils", ".", "getImageIdFromTag", "(", "imageTag", ",", "host", ")", ";", "}", "}", ")", ";", "}" ]
Get image ID from imageTag on the current agent. @param imageTag @return
[ "Get", "image", "ID", "from", "imageTag", "on", "the", "current", "agent", "." ]
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerAgentUtils.java#L278-L284
VoltDB/voltdb
third_party/java/src/org/apache/zookeeper_voltpatches/server/persistence/Util.java
Util.makeFileLoggerURL
public static URI makeFileLoggerURL(File dataDir, File dataLogDir) { """ Given two directory files the method returns a well-formed logfile provider URI. This method is for backward compatibility with the existing code that only supports logfile persistence and expects these two parameters passed either on the command-line or in the configuration file. @param dataDir snapshot directory @param dataLogDir transaction log directory @return logfile provider URI """ return URI.create(makeURIString(dataDir.getPath(),dataLogDir.getPath(),null)); }
java
public static URI makeFileLoggerURL(File dataDir, File dataLogDir){ return URI.create(makeURIString(dataDir.getPath(),dataLogDir.getPath(),null)); }
[ "public", "static", "URI", "makeFileLoggerURL", "(", "File", "dataDir", ",", "File", "dataLogDir", ")", "{", "return", "URI", ".", "create", "(", "makeURIString", "(", "dataDir", ".", "getPath", "(", ")", ",", "dataLogDir", ".", "getPath", "(", ")", ",", "null", ")", ")", ";", "}" ]
Given two directory files the method returns a well-formed logfile provider URI. This method is for backward compatibility with the existing code that only supports logfile persistence and expects these two parameters passed either on the command-line or in the configuration file. @param dataDir snapshot directory @param dataLogDir transaction log directory @return logfile provider URI
[ "Given", "two", "directory", "files", "the", "method", "returns", "a", "well", "-", "formed", "logfile", "provider", "URI", ".", "This", "method", "is", "for", "backward", "compatibility", "with", "the", "existing", "code", "that", "only", "supports", "logfile", "persistence", "and", "expects", "these", "two", "parameters", "passed", "either", "on", "the", "command", "-", "line", "or", "in", "the", "configuration", "file", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/server/persistence/Util.java#L73-L75
FXMisc/WellBehavedFX
src/main/java/org/fxmisc/wellbehaved/event/template/InputMapTemplate.java
InputMapTemplate.orElse
public final InputMapTemplate<S, E> orElse(InputMapTemplate<S, ? extends E> that) { """ Shorthand for {@link #sequence(InputMapTemplate[])} sequence(this, that)} """ return sequence(this, that); }
java
public final InputMapTemplate<S, E> orElse(InputMapTemplate<S, ? extends E> that) { return sequence(this, that); }
[ "public", "final", "InputMapTemplate", "<", "S", ",", "E", ">", "orElse", "(", "InputMapTemplate", "<", "S", ",", "?", "extends", "E", ">", "that", ")", "{", "return", "sequence", "(", "this", ",", "that", ")", ";", "}" ]
Shorthand for {@link #sequence(InputMapTemplate[])} sequence(this, that)}
[ "Shorthand", "for", "{" ]
train
https://github.com/FXMisc/WellBehavedFX/blob/ca889734481f5439655ca8deb6f742964b5654b0/src/main/java/org/fxmisc/wellbehaved/event/template/InputMapTemplate.java#L122-L124
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.updateRegexEntityRoleWithServiceResponseAsync
public Observable<ServiceResponse<OperationStatus>> updateRegexEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID entityId, UUID roleId, UpdateRegexEntityRoleOptionalParameter updateRegexEntityRoleOptionalParameter) { """ Update an entity role for a given entity. @param appId The application ID. @param versionId The version ID. @param entityId The entity ID. @param roleId The entity role ID. @param updateRegexEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object """ if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } if (entityId == null) { throw new IllegalArgumentException("Parameter entityId is required and cannot be null."); } if (roleId == null) { throw new IllegalArgumentException("Parameter roleId is required and cannot be null."); } final String name = updateRegexEntityRoleOptionalParameter != null ? updateRegexEntityRoleOptionalParameter.name() : null; return updateRegexEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, name); }
java
public Observable<ServiceResponse<OperationStatus>> updateRegexEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID entityId, UUID roleId, UpdateRegexEntityRoleOptionalParameter updateRegexEntityRoleOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } if (entityId == null) { throw new IllegalArgumentException("Parameter entityId is required and cannot be null."); } if (roleId == null) { throw new IllegalArgumentException("Parameter roleId is required and cannot be null."); } final String name = updateRegexEntityRoleOptionalParameter != null ? updateRegexEntityRoleOptionalParameter.name() : null; return updateRegexEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, name); }
[ "public", "Observable", "<", "ServiceResponse", "<", "OperationStatus", ">", ">", "updateRegexEntityRoleWithServiceResponseAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ",", "UUID", "roleId", ",", "UpdateRegexEntityRoleOptionalParameter", "updateRegexEntityRoleOptionalParameter", ")", "{", "if", "(", "this", ".", "client", ".", "endpoint", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter this.client.endpoint() is required and cannot be null.\"", ")", ";", "}", "if", "(", "appId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter appId is required and cannot be null.\"", ")", ";", "}", "if", "(", "versionId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter versionId is required and cannot be null.\"", ")", ";", "}", "if", "(", "entityId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter entityId is required and cannot be null.\"", ")", ";", "}", "if", "(", "roleId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter roleId is required and cannot be null.\"", ")", ";", "}", "final", "String", "name", "=", "updateRegexEntityRoleOptionalParameter", "!=", "null", "?", "updateRegexEntityRoleOptionalParameter", ".", "name", "(", ")", ":", "null", ";", "return", "updateRegexEntityRoleWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "entityId", ",", "roleId", ",", "name", ")", ";", "}" ]
Update an entity role for a given entity. @param appId The application ID. @param versionId The version ID. @param entityId The entity ID. @param roleId The entity role ID. @param updateRegexEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Update", "an", "entity", "role", "for", "a", "given", "entity", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L12102-L12121
foundation-runtime/service-directory
1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/lookup/DirectoryLookupService.java
DirectoryLookupService.addServiceInstanceChangeListener
public void addServiceInstanceChangeListener(String serviceName, ServiceInstanceChangeListener listener) { """ Add a ServiceInstanceChangeListener to the Service. <p/> This method will check the duplicated listener for the serviceName, if the listener already exists for the serviceName, do nothing. <p/> Throws IllegalArgumentException if serviceName or listener is null. @param serviceName the service name @param listener the ServiceInstanceChangeListener for the service """ ServiceInstanceUtils.validateServiceName(serviceName); if (listener == null) { throw new ServiceException(ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR, ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR.getMessageTemplate(), "ServiceInstanceChangeListener"); } List<InstanceChangeListener<ModelServiceInstance>> listeners = changeListenerMap.get(serviceName); if (listeners != null) { for (InstanceChangeListener<ModelServiceInstance> l : listeners) { if (l instanceof ServiceInstanceChangeListenerAdapter && ((ServiceInstanceChangeListenerAdapter) l).getAdapter() == listener) { //exist, log error and return LOGGER.error("Try to register a listener {} that has already been registered.", listener); return; } } } addInstanceChangeListener(serviceName, new ServiceInstanceChangeListenerAdapter(listener)); }
java
public void addServiceInstanceChangeListener(String serviceName, ServiceInstanceChangeListener listener) { ServiceInstanceUtils.validateServiceName(serviceName); if (listener == null) { throw new ServiceException(ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR, ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR.getMessageTemplate(), "ServiceInstanceChangeListener"); } List<InstanceChangeListener<ModelServiceInstance>> listeners = changeListenerMap.get(serviceName); if (listeners != null) { for (InstanceChangeListener<ModelServiceInstance> l : listeners) { if (l instanceof ServiceInstanceChangeListenerAdapter && ((ServiceInstanceChangeListenerAdapter) l).getAdapter() == listener) { //exist, log error and return LOGGER.error("Try to register a listener {} that has already been registered.", listener); return; } } } addInstanceChangeListener(serviceName, new ServiceInstanceChangeListenerAdapter(listener)); }
[ "public", "void", "addServiceInstanceChangeListener", "(", "String", "serviceName", ",", "ServiceInstanceChangeListener", "listener", ")", "{", "ServiceInstanceUtils", ".", "validateServiceName", "(", "serviceName", ")", ";", "if", "(", "listener", "==", "null", ")", "{", "throw", "new", "ServiceException", "(", "ErrorCode", ".", "SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR", ",", "ErrorCode", ".", "SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR", ".", "getMessageTemplate", "(", ")", ",", "\"ServiceInstanceChangeListener\"", ")", ";", "}", "List", "<", "InstanceChangeListener", "<", "ModelServiceInstance", ">", ">", "listeners", "=", "changeListenerMap", ".", "get", "(", "serviceName", ")", ";", "if", "(", "listeners", "!=", "null", ")", "{", "for", "(", "InstanceChangeListener", "<", "ModelServiceInstance", ">", "l", ":", "listeners", ")", "{", "if", "(", "l", "instanceof", "ServiceInstanceChangeListenerAdapter", "&&", "(", "(", "ServiceInstanceChangeListenerAdapter", ")", "l", ")", ".", "getAdapter", "(", ")", "==", "listener", ")", "{", "//exist, log error and return", "LOGGER", ".", "error", "(", "\"Try to register a listener {} that has already been registered.\"", ",", "listener", ")", ";", "return", ";", "}", "}", "}", "addInstanceChangeListener", "(", "serviceName", ",", "new", "ServiceInstanceChangeListenerAdapter", "(", "listener", ")", ")", ";", "}" ]
Add a ServiceInstanceChangeListener to the Service. <p/> This method will check the duplicated listener for the serviceName, if the listener already exists for the serviceName, do nothing. <p/> Throws IllegalArgumentException if serviceName or listener is null. @param serviceName the service name @param listener the ServiceInstanceChangeListener for the service
[ "Add", "a", "ServiceInstanceChangeListener", "to", "the", "Service", ".", "<p", "/", ">", "This", "method", "will", "check", "the", "duplicated", "listener", "for", "the", "serviceName", "if", "the", "listener", "already", "exists", "for", "the", "serviceName", "do", "nothing", ".", "<p", "/", ">", "Throws", "IllegalArgumentException", "if", "serviceName", "or", "listener", "is", "null", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/lookup/DirectoryLookupService.java#L445-L467