repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java
Aggregations.comparableMax
public static <Key, Value> Aggregation<Key, Comparable, Comparable> comparableMax() { return new AggregationAdapter(new ComparableMaxAggregation<Key, Value>()); }
java
public static <Key, Value> Aggregation<Key, Comparable, Comparable> comparableMax() { return new AggregationAdapter(new ComparableMaxAggregation<Key, Value>()); }
[ "public", "static", "<", "Key", ",", "Value", ">", "Aggregation", "<", "Key", ",", "Comparable", ",", "Comparable", ">", "comparableMax", "(", ")", "{", "return", "new", "AggregationAdapter", "(", "new", "ComparableMaxAggregation", "<", "Key", ",", "Value", ...
Returns an aggregation to find the maximum value of all supplied {@link java.lang.Comparable} implementing values.<br/> This aggregation is similar to: <pre>SELECT MAX(value) FROM x</pre> @param <Key> the input key type @param <Value> the supplied value type @return the maximum value over all supplied values
[ "Returns", "an", "aggregation", "to", "find", "the", "maximum", "value", "of", "all", "supplied", "{", "@link", "java", ".", "lang", ".", "Comparable", "}", "implementing", "values", ".", "<br", "/", ">", "This", "aggregation", "is", "similar", "to", ":", ...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java#L364-L366
cternes/openkeepass
src/main/java/de/slackspace/openkeepass/KeePassDatabase.java
KeePassDatabase.openDatabase
public KeePassFile openDatabase(String password, File keyFile) { if (password == null) { throw new IllegalArgumentException(MSG_EMPTY_MASTER_KEY); } if (keyFile == null) { throw new IllegalArgumentException("You must provide a valid KeePass keyfile."); } InputStream inputStream = null; try { inputStream = new FileInputStream(keyFile); return openDatabase(password, inputStream); } catch (FileNotFoundException e) { throw new IllegalArgumentException("The KeePass keyfile could not be found. You must provide a valid KeePass keyfile.", e); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { // Ignore } } } }
java
public KeePassFile openDatabase(String password, File keyFile) { if (password == null) { throw new IllegalArgumentException(MSG_EMPTY_MASTER_KEY); } if (keyFile == null) { throw new IllegalArgumentException("You must provide a valid KeePass keyfile."); } InputStream inputStream = null; try { inputStream = new FileInputStream(keyFile); return openDatabase(password, inputStream); } catch (FileNotFoundException e) { throw new IllegalArgumentException("The KeePass keyfile could not be found. You must provide a valid KeePass keyfile.", e); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { // Ignore } } } }
[ "public", "KeePassFile", "openDatabase", "(", "String", "password", ",", "File", "keyFile", ")", "{", "if", "(", "password", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "MSG_EMPTY_MASTER_KEY", ")", ";", "}", "if", "(", "keyFile", ...
Opens a KeePass database with the given password and keyfile and returns the KeePassFile for further processing. <p> If the database cannot be decrypted with the provided password and keyfile an exception will be thrown. @param password the password to open the database @param keyFile the password to open the database @return a KeePassFile @see KeePassFile
[ "Opens", "a", "KeePass", "database", "with", "the", "given", "password", "and", "keyfile", "and", "returns", "the", "KeePassFile", "for", "further", "processing", ".", "<p", ">", "If", "the", "database", "cannot", "be", "decrypted", "with", "the", "provided", ...
train
https://github.com/cternes/openkeepass/blob/4a354aecaea38af3c0dce5eb81b533f297e8d94f/src/main/java/de/slackspace/openkeepass/KeePassDatabase.java#L185-L209
indeedeng/proctor
proctor-consumer/src/main/java/com/indeed/proctor/consumer/AbstractGroupsManager.java
AbstractGroupsManager.determineBucketsInternal
@VisibleForTesting protected ProctorResult determineBucketsInternal(final Identifiers identifiers, final Map<String, Object> context, final Map<String, Integer> forcedGroups) { final Proctor proctor = proctorSource.get(); if (proctor == null) { final Map<String, TestBucket> buckets = getDefaultBucketValues(); final Map<String, Integer> versions = Maps.newHashMap(); for (final String testName : buckets.keySet()) { versions.put(testName, Integer.valueOf(-1)); } return new ProctorResult(Audit.EMPTY_VERSION, buckets, Collections.<String, Allocation>emptyMap(), Collections.<String, ConsumableTestDefinition>emptyMap() ); } final ProctorResult result = proctor.determineTestGroups(identifiers, context, forcedGroups); return result; }
java
@VisibleForTesting protected ProctorResult determineBucketsInternal(final Identifiers identifiers, final Map<String, Object> context, final Map<String, Integer> forcedGroups) { final Proctor proctor = proctorSource.get(); if (proctor == null) { final Map<String, TestBucket> buckets = getDefaultBucketValues(); final Map<String, Integer> versions = Maps.newHashMap(); for (final String testName : buckets.keySet()) { versions.put(testName, Integer.valueOf(-1)); } return new ProctorResult(Audit.EMPTY_VERSION, buckets, Collections.<String, Allocation>emptyMap(), Collections.<String, ConsumableTestDefinition>emptyMap() ); } final ProctorResult result = proctor.determineTestGroups(identifiers, context, forcedGroups); return result; }
[ "@", "VisibleForTesting", "protected", "ProctorResult", "determineBucketsInternal", "(", "final", "Identifiers", "identifiers", ",", "final", "Map", "<", "String", ",", "Object", ">", "context", ",", "final", "Map", "<", "String", ",", "Integer", ">", "forcedGroup...
I don't see any value in using this in an application; you probably should use {@link #determineBucketsInternal(HttpServletRequest, HttpServletResponse, Identifiers, Map, boolean)} @param identifiers a {@link Map} of unique-ish {@link String}s describing the request in the context of different {@link TestType}s.For example, {@link TestType#USER} has a CTK associated, {@link TestType#EMAIL} is an email address, {@link TestType#PAGE} might be a url-encoded String containing the normalized relevant page parameters @param context a {@link Map} containing variables describing the context in which the request is executing. These will be supplied to any rules that execute to determine test eligibility. @param forcedGroups a {@link Map} from a String test name to an Integer bucket value. For the specified test allocate the specified bucket (if valid) regardless of the standard logic @return a {@link ProctorResult} to describe buckets allocations of all tests.
[ "I", "don", "t", "see", "any", "value", "in", "using", "this", "in", "an", "application", ";", "you", "probably", "should", "use", "{", "@link", "#determineBucketsInternal", "(", "HttpServletRequest", "HttpServletResponse", "Identifiers", "Map", "boolean", ")", ...
train
https://github.com/indeedeng/proctor/blob/b7795acfc26a30d013655d0e0fa1d3f8d0576571/proctor-consumer/src/main/java/com/indeed/proctor/consumer/AbstractGroupsManager.java#L65-L82
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/LongStream.java
LongStream.scan
@NotNull public LongStream scan(@NotNull final LongBinaryOperator accumulator) { Objects.requireNonNull(accumulator); return new LongStream(params, new LongScan(iterator, accumulator)); }
java
@NotNull public LongStream scan(@NotNull final LongBinaryOperator accumulator) { Objects.requireNonNull(accumulator); return new LongStream(params, new LongScan(iterator, accumulator)); }
[ "@", "NotNull", "public", "LongStream", "scan", "(", "@", "NotNull", "final", "LongBinaryOperator", "accumulator", ")", "{", "Objects", ".", "requireNonNull", "(", "accumulator", ")", ";", "return", "new", "LongStream", "(", "params", ",", "new", "LongScan", "...
Returns a {@code LongStream} produced by iterative application of a accumulation function to reduction value and next element of the current stream. Produces a {@code LongStream} consisting of {@code value1}, {@code acc(value1, value2)}, {@code acc(acc(value1, value2), value3)}, etc. <p>This is an intermediate operation. <p>Example: <pre> accumulator: (a, b) -&gt; a + b stream: [1, 2, 3, 4, 5] result: [1, 3, 6, 10, 15] </pre> @param accumulator the accumulation function @return the new stream @throws NullPointerException if {@code accumulator} is null @since 1.1.6
[ "Returns", "a", "{", "@code", "LongStream", "}", "produced", "by", "iterative", "application", "of", "a", "accumulation", "function", "to", "reduction", "value", "and", "next", "element", "of", "the", "current", "stream", ".", "Produces", "a", "{", "@code", ...
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/LongStream.java#L682-L686
intellimate/Izou
src/main/java/org/intellimate/izou/support/SystemMail.java
SystemMail.sendMail
public void sendMail(String toAddress, String subject, String content, String attachmentName, String attachmentPath) { final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory"; logger.debug("Sending mail..."); Properties props = System.getProperties(); props.setProperty("mail.smtp.host", "smtp.gmail.com"); props.setProperty("mail.smtp.socketFactory.class", SSL_FACTORY); props.setProperty("mail.smtp.socketFactory.fallback", "false"); props.setProperty("mail.smtp.port", "465"); props.setProperty("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.auth", "true"); props.put("mail.debug", "true"); props.put("mail.store.protocol", "pop3"); props.put("mail.transport.protocol", "smtp"); final String username = "intellimate.izou@gmail.com"; final String password = "Karlskrone"; // TODO: hide this when password stuff is done try{ Session session = Session.getDefaultInstance(props, new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } }); MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(username)); message.addRecipient(Message.RecipientType.TO, new InternetAddress(toAddress)); message.setSubject(subject); // Create the message part BodyPart messageBodyPart = new MimeBodyPart(); // Now set the actual message messageBodyPart.setText(content); // Create a multipart message Multipart multipart = new MimeMultipart(); // Set text message part multipart.addBodyPart(messageBodyPart); // Part two is attachment messageBodyPart = new MimeBodyPart(); DataSource source = new FileDataSource(attachmentPath); messageBodyPart.setDataHandler(new DataHandler(source)); messageBodyPart.setFileName(attachmentName); multipart.addBodyPart(messageBodyPart); // Send the complete message parts message.setContent(multipart); // Send message Transport.send(message); logger.debug("Mail sent successfully."); } catch (MessagingException e) { logger.error("Unable to send error report.", e); } }
java
public void sendMail(String toAddress, String subject, String content, String attachmentName, String attachmentPath) { final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory"; logger.debug("Sending mail..."); Properties props = System.getProperties(); props.setProperty("mail.smtp.host", "smtp.gmail.com"); props.setProperty("mail.smtp.socketFactory.class", SSL_FACTORY); props.setProperty("mail.smtp.socketFactory.fallback", "false"); props.setProperty("mail.smtp.port", "465"); props.setProperty("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.auth", "true"); props.put("mail.debug", "true"); props.put("mail.store.protocol", "pop3"); props.put("mail.transport.protocol", "smtp"); final String username = "intellimate.izou@gmail.com"; final String password = "Karlskrone"; // TODO: hide this when password stuff is done try{ Session session = Session.getDefaultInstance(props, new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } }); MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(username)); message.addRecipient(Message.RecipientType.TO, new InternetAddress(toAddress)); message.setSubject(subject); // Create the message part BodyPart messageBodyPart = new MimeBodyPart(); // Now set the actual message messageBodyPart.setText(content); // Create a multipart message Multipart multipart = new MimeMultipart(); // Set text message part multipart.addBodyPart(messageBodyPart); // Part two is attachment messageBodyPart = new MimeBodyPart(); DataSource source = new FileDataSource(attachmentPath); messageBodyPart.setDataHandler(new DataHandler(source)); messageBodyPart.setFileName(attachmentName); multipart.addBodyPart(messageBodyPart); // Send the complete message parts message.setContent(multipart); // Send message Transport.send(message); logger.debug("Mail sent successfully."); } catch (MessagingException e) { logger.error("Unable to send error report.", e); } }
[ "public", "void", "sendMail", "(", "String", "toAddress", ",", "String", "subject", ",", "String", "content", ",", "String", "attachmentName", ",", "String", "attachmentPath", ")", "{", "final", "String", "SSL_FACTORY", "=", "\"javax.net.ssl.SSLSocketFactory\"", ";"...
Sends a mail to the address of {@code toAddress} with a subject of {@code subject} and a content of {@code content} with an attachment @param toAddress the address to send the mail to @param subject the subject of the email to send @param content the content of the email (without attachment) @param attachmentName the name of the attachment @param attachmentPath the file path to the attachment
[ "Sends", "a", "mail", "to", "the", "address", "of", "{", "@code", "toAddress", "}", "with", "a", "subject", "of", "{", "@code", "subject", "}", "and", "a", "content", "of", "{", "@code", "content", "}", "with", "an", "attachment" ]
train
https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/support/SystemMail.java#L66-L125
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java
ExpressionUtils.neConst
public static <D> Predicate neConst(Expression<D> left, D constant) { return ne(left, ConstantImpl.create(constant)); }
java
public static <D> Predicate neConst(Expression<D> left, D constant) { return ne(left, ConstantImpl.create(constant)); }
[ "public", "static", "<", "D", ">", "Predicate", "neConst", "(", "Expression", "<", "D", ">", "left", ",", "D", "constant", ")", "{", "return", "ne", "(", "left", ",", "ConstantImpl", ".", "create", "(", "constant", ")", ")", ";", "}" ]
Create a {@code left != constant} expression @param <D> type of expression @param left lhs of expression @param constant rhs of expression @return left != constant
[ "Create", "a", "{", "@code", "left", "!", "=", "constant", "}", "expression" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java#L707-L709
CenturyLinkCloud/clc-java-sdk
sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/InvoiceService.java
InvoiceService.getInvoice
public InvoiceData getInvoice(Calendar calendar, String pricingAccountAlias) { return getInvoice(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1, pricingAccountAlias); }
java
public InvoiceData getInvoice(Calendar calendar, String pricingAccountAlias) { return getInvoice(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1, pricingAccountAlias); }
[ "public", "InvoiceData", "getInvoice", "(", "Calendar", "calendar", ",", "String", "pricingAccountAlias", ")", "{", "return", "getInvoice", "(", "calendar", ".", "get", "(", "Calendar", ".", "YEAR", ")", ",", "calendar", ".", "get", "(", "Calendar", ".", "MO...
Gets a list of invoicing data for a given account alias for a given month. @param calendar Date of usage @param pricingAccountAlias Short code of the account that sends the invoice for the accountAlias @return the invoice data
[ "Gets", "a", "list", "of", "invoicing", "data", "for", "a", "given", "account", "alias", "for", "a", "given", "month", "." ]
train
https://github.com/CenturyLinkCloud/clc-java-sdk/blob/c026322f077dea71b1acf9f2d665253d79d9bf85/sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/InvoiceService.java#L66-L68
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/util/NameUtil.java
NameUtil.updateFilenameHashCode
public static final String updateFilenameHashCode(EnterpriseBean enterpriseBean, String oldName) { String newName = null; int len = oldName.length(); int last_ = (len > 9 && (oldName.charAt(len - 9) == '_')) ? len - 9 : -1; // input file name must have a trailing "_" follows by 8 hex digits // and check to make sure the last 8 characters are all hex digits if (last_ != -1 && allHexDigits(oldName, ++last_, len)) { String hashStr = getHashStr(enterpriseBean); newName = oldName.substring(0, last_) + BuzzHash.computeHashStringMid32Bit(hashStr, true); } return newName; }
java
public static final String updateFilenameHashCode(EnterpriseBean enterpriseBean, String oldName) { String newName = null; int len = oldName.length(); int last_ = (len > 9 && (oldName.charAt(len - 9) == '_')) ? len - 9 : -1; // input file name must have a trailing "_" follows by 8 hex digits // and check to make sure the last 8 characters are all hex digits if (last_ != -1 && allHexDigits(oldName, ++last_, len)) { String hashStr = getHashStr(enterpriseBean); newName = oldName.substring(0, last_) + BuzzHash.computeHashStringMid32Bit(hashStr, true); } return newName; }
[ "public", "static", "final", "String", "updateFilenameHashCode", "(", "EnterpriseBean", "enterpriseBean", ",", "String", "oldName", ")", "{", "String", "newName", "=", "null", ";", "int", "len", "=", "oldName", ".", "length", "(", ")", ";", "int", "last_", "...
Attempts to find the new file name originated from input oldName using the the new modified BuzzHash algorithm. This method detects if the oldName contains a valid trailing hashcode and try to compute the new one. If the oldName has no valid hashcode in the input name, null is return. For ease of invocation regardless of the type of file passes in, this method only changes the hash value and will not recreate the complete file name from the EnterpriseBean. @return the new file name using the oldName but with a new hash code, or null if no new name can be constructed.
[ "Attempts", "to", "find", "the", "new", "file", "name", "originated", "from", "input", "oldName", "using", "the", "the", "new", "modified", "BuzzHash", "algorithm", ".", "This", "method", "detects", "if", "the", "oldName", "contains", "a", "valid", "trailing",...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/util/NameUtil.java#L746-L759
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java
TeaToolsUtils.getBeanInfo
public BeanInfo getBeanInfo(Class<?> beanClass, Class<?> stopClass) throws IntrospectionException { return Introspector.getBeanInfo(beanClass, stopClass); }
java
public BeanInfo getBeanInfo(Class<?> beanClass, Class<?> stopClass) throws IntrospectionException { return Introspector.getBeanInfo(beanClass, stopClass); }
[ "public", "BeanInfo", "getBeanInfo", "(", "Class", "<", "?", ">", "beanClass", ",", "Class", "<", "?", ">", "stopClass", ")", "throws", "IntrospectionException", "{", "return", "Introspector", ".", "getBeanInfo", "(", "beanClass", ",", "stopClass", ")", ";", ...
Introspects a Java bean to learn all about its properties, exposed methods, below a given "stop" point. @param beanClass the bean class to be analyzed @param stopClass the base class at which to stop the analysis. Any methods/properties/events in the stopClass or in its baseclasses will be ignored in the analysis
[ "Introspects", "a", "Java", "bean", "to", "learn", "all", "about", "its", "properties", "exposed", "methods", "below", "a", "given", "stop", "point", "." ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L619-L622
mgm-tp/jfunk
jfunk-data/src/main/java/com/mgmtp/jfunk/data/source/CsvDataSource.java
CsvDataSource.hasMoreData
@Override public boolean hasMoreData(final String dataSetKey) { if (getCsvFiles().containsKey(dataSetKey)) { CsvFile csvFile = getCsvFiles().get(dataSetKey); if (csvFile.lines == null) { try { csvFile.load(); } catch (IOException e) { throw new IllegalArgumentException("Could not load CSV file " + csvFile.fileName, e); } } return csvFile.hasNextLine(); } return false; }
java
@Override public boolean hasMoreData(final String dataSetKey) { if (getCsvFiles().containsKey(dataSetKey)) { CsvFile csvFile = getCsvFiles().get(dataSetKey); if (csvFile.lines == null) { try { csvFile.load(); } catch (IOException e) { throw new IllegalArgumentException("Could not load CSV file " + csvFile.fileName, e); } } return csvFile.hasNextLine(); } return false; }
[ "@", "Override", "public", "boolean", "hasMoreData", "(", "final", "String", "dataSetKey", ")", "{", "if", "(", "getCsvFiles", "(", ")", ".", "containsKey", "(", "dataSetKey", ")", ")", "{", "CsvFile", "csvFile", "=", "getCsvFiles", "(", ")", ".", "get", ...
{@inheritDoc} @return {@code false}, as soon as the specified CSV file has no more lines available.
[ "{", "@inheritDoc", "}" ]
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-data/src/main/java/com/mgmtp/jfunk/data/source/CsvDataSource.java#L114-L128
rsqn/useful-things
lambda-utilities/src/main/java/tech/rsqn/useful/things/lambda/LambdaSpringUtil.java
LambdaSpringUtil.wireInSpring
public static void wireInSpring(Object o, String myBeanName) { // Lambda does not do this for you - though serverless does have a library to do it if (ctx == null) { synchronized (lck) { if (ctx == null) { LOG.info("LamdaSpringUtil CTX is null - initialising spring"); ctx = new ClassPathXmlApplicationContext(globalRootContextPath); } } } else { LOG.debug("LamdaSpringUtil CTX is not null - not initialising spring"); } AutowireCapableBeanFactory factory = ctx.getAutowireCapableBeanFactory(); factory.autowireBean(o); factory.initializeBean(0, myBeanName); }
java
public static void wireInSpring(Object o, String myBeanName) { // Lambda does not do this for you - though serverless does have a library to do it if (ctx == null) { synchronized (lck) { if (ctx == null) { LOG.info("LamdaSpringUtil CTX is null - initialising spring"); ctx = new ClassPathXmlApplicationContext(globalRootContextPath); } } } else { LOG.debug("LamdaSpringUtil CTX is not null - not initialising spring"); } AutowireCapableBeanFactory factory = ctx.getAutowireCapableBeanFactory(); factory.autowireBean(o); factory.initializeBean(0, myBeanName); }
[ "public", "static", "void", "wireInSpring", "(", "Object", "o", ",", "String", "myBeanName", ")", "{", "// Lambda does not do this for you - though serverless does have a library to do it", "if", "(", "ctx", "==", "null", ")", "{", "synchronized", "(", "lck", ")", "{"...
wires spring into the passed in bean @param o @param myBeanName
[ "wires", "spring", "into", "the", "passed", "in", "bean" ]
train
https://github.com/rsqn/useful-things/blob/a21e6a9e07b97b0c239ff57a8efcb7385f645558/lambda-utilities/src/main/java/tech/rsqn/useful/things/lambda/LambdaSpringUtil.java#L63-L78
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/gslb/gslbsite_binding.java
gslbsite_binding.get
public static gslbsite_binding get(nitro_service service, String sitename) throws Exception{ gslbsite_binding obj = new gslbsite_binding(); obj.set_sitename(sitename); gslbsite_binding response = (gslbsite_binding) obj.get_resource(service); return response; }
java
public static gslbsite_binding get(nitro_service service, String sitename) throws Exception{ gslbsite_binding obj = new gslbsite_binding(); obj.set_sitename(sitename); gslbsite_binding response = (gslbsite_binding) obj.get_resource(service); return response; }
[ "public", "static", "gslbsite_binding", "get", "(", "nitro_service", "service", ",", "String", "sitename", ")", "throws", "Exception", "{", "gslbsite_binding", "obj", "=", "new", "gslbsite_binding", "(", ")", ";", "obj", ".", "set_sitename", "(", "sitename", ")"...
Use this API to fetch gslbsite_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "gslbsite_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/gslb/gslbsite_binding.java#L103-L108
sdaschner/jaxrs-analyzer
src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/javadoc/JavaDocAnalyzer.java
JavaDocAnalyzer.equalsSimpleTypeNames
private boolean equalsSimpleTypeNames(MethodIdentifier identifier, MethodResult methodResult) { MethodIdentifier originalIdentifier = methodResult.getOriginalMethodSignature(); return originalIdentifier.getMethodName().equals(identifier.getMethodName()) && matchesTypeBestEffort(originalIdentifier.getReturnType(), identifier.getReturnType()) && parameterMatch(originalIdentifier.getParameters(), identifier.getParameters()); }
java
private boolean equalsSimpleTypeNames(MethodIdentifier identifier, MethodResult methodResult) { MethodIdentifier originalIdentifier = methodResult.getOriginalMethodSignature(); return originalIdentifier.getMethodName().equals(identifier.getMethodName()) && matchesTypeBestEffort(originalIdentifier.getReturnType(), identifier.getReturnType()) && parameterMatch(originalIdentifier.getParameters(), identifier.getParameters()); }
[ "private", "boolean", "equalsSimpleTypeNames", "(", "MethodIdentifier", "identifier", ",", "MethodResult", "methodResult", ")", "{", "MethodIdentifier", "originalIdentifier", "=", "methodResult", ".", "getOriginalMethodSignature", "(", ")", ";", "return", "originalIdentifie...
This is a best-effort approach combining only the simple types. @see JavaDocParserVisitor#calculateMethodIdentifier(MethodDeclaration)
[ "This", "is", "a", "best", "-", "effort", "approach", "combining", "only", "the", "simple", "types", "." ]
train
https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/javadoc/JavaDocAnalyzer.java#L96-L102
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/TopologyManager.java
TopologyManager.addIndex
public static void addIndex(SqlgGraph sqlgGraph, String schema, String label, boolean vertex, String index, IndexType indexType, List<String> properties) { BatchManager.BatchModeType batchModeType = flushAndSetTxToNone(sqlgGraph); try { //get the abstractLabel's vertex GraphTraversalSource traversalSource = sqlgGraph.topology(); List<Vertex> abstractLabelVertexes; if (vertex) { abstractLabelVertexes = traversalSource.V() .hasLabel(SQLG_SCHEMA + "." + SQLG_SCHEMA_SCHEMA) .has(SQLG_SCHEMA_SCHEMA_NAME, schema) .out(SQLG_SCHEMA_SCHEMA_VERTEX_EDGE) .has("name", label) .toList(); } else { abstractLabelVertexes = traversalSource.V() .hasLabel(SQLG_SCHEMA + "." + SQLG_SCHEMA_SCHEMA) .has(SQLG_SCHEMA_SCHEMA_NAME, schema) .out(SQLG_SCHEMA_SCHEMA_VERTEX_EDGE) .out(SQLG_SCHEMA_OUT_EDGES_EDGE) .has("name", label) .dedup() .toList(); } Preconditions.checkState(!abstractLabelVertexes.isEmpty(), "AbstractLabel %s.%s does not exists", schema, label); Preconditions.checkState(abstractLabelVertexes.size() == 1, "BUG: multiple AbstractLabels found for %s.%s", schema, label); Vertex abstractLabelVertex = abstractLabelVertexes.get(0); boolean createdIndexVertex = false; Vertex indexVertex = null; int ix = 0; for (String property : properties) { List<Vertex> propertyVertexes = traversalSource.V(abstractLabelVertex) .out(vertex ? SQLG_SCHEMA_VERTEX_PROPERTIES_EDGE : SQLG_SCHEMA_EDGE_PROPERTIES_EDGE) .has("name", property) .toList(); //do not create indexes for properties that are not found. //TODO, Sqlg needs to get more sophisticated support for indexes, i.e. function indexes on a property etc. if (!createdIndexVertex && !propertyVertexes.isEmpty()) { createdIndexVertex = true; indexVertex = sqlgGraph.addVertex( T.label, SQLG_SCHEMA + "." + SQLG_SCHEMA_INDEX, SQLG_SCHEMA_INDEX_NAME, index, SQLG_SCHEMA_INDEX_INDEX_TYPE, indexType.toString(), CREATED_ON, LocalDateTime.now() ); if (vertex) { abstractLabelVertex.addEdge(SQLG_SCHEMA_VERTEX_INDEX_EDGE, indexVertex); } else { abstractLabelVertex.addEdge(SQLG_SCHEMA_EDGE_INDEX_EDGE, indexVertex); } } if (!propertyVertexes.isEmpty()) { Preconditions.checkState(propertyVertexes.size() == 1, "BUG: multiple Properties %s found for AbstractLabels found for %s.%s", property, schema, label); Preconditions.checkState(indexVertex != null); Vertex propertyVertex = propertyVertexes.get(0); indexVertex.addEdge(SQLG_SCHEMA_INDEX_PROPERTY_EDGE, propertyVertex, SQLG_SCHEMA_INDEX_PROPERTY_EDGE_SEQUENCE, ix); } } } finally { sqlgGraph.tx().batchMode(batchModeType); } }
java
public static void addIndex(SqlgGraph sqlgGraph, String schema, String label, boolean vertex, String index, IndexType indexType, List<String> properties) { BatchManager.BatchModeType batchModeType = flushAndSetTxToNone(sqlgGraph); try { //get the abstractLabel's vertex GraphTraversalSource traversalSource = sqlgGraph.topology(); List<Vertex> abstractLabelVertexes; if (vertex) { abstractLabelVertexes = traversalSource.V() .hasLabel(SQLG_SCHEMA + "." + SQLG_SCHEMA_SCHEMA) .has(SQLG_SCHEMA_SCHEMA_NAME, schema) .out(SQLG_SCHEMA_SCHEMA_VERTEX_EDGE) .has("name", label) .toList(); } else { abstractLabelVertexes = traversalSource.V() .hasLabel(SQLG_SCHEMA + "." + SQLG_SCHEMA_SCHEMA) .has(SQLG_SCHEMA_SCHEMA_NAME, schema) .out(SQLG_SCHEMA_SCHEMA_VERTEX_EDGE) .out(SQLG_SCHEMA_OUT_EDGES_EDGE) .has("name", label) .dedup() .toList(); } Preconditions.checkState(!abstractLabelVertexes.isEmpty(), "AbstractLabel %s.%s does not exists", schema, label); Preconditions.checkState(abstractLabelVertexes.size() == 1, "BUG: multiple AbstractLabels found for %s.%s", schema, label); Vertex abstractLabelVertex = abstractLabelVertexes.get(0); boolean createdIndexVertex = false; Vertex indexVertex = null; int ix = 0; for (String property : properties) { List<Vertex> propertyVertexes = traversalSource.V(abstractLabelVertex) .out(vertex ? SQLG_SCHEMA_VERTEX_PROPERTIES_EDGE : SQLG_SCHEMA_EDGE_PROPERTIES_EDGE) .has("name", property) .toList(); //do not create indexes for properties that are not found. //TODO, Sqlg needs to get more sophisticated support for indexes, i.e. function indexes on a property etc. if (!createdIndexVertex && !propertyVertexes.isEmpty()) { createdIndexVertex = true; indexVertex = sqlgGraph.addVertex( T.label, SQLG_SCHEMA + "." + SQLG_SCHEMA_INDEX, SQLG_SCHEMA_INDEX_NAME, index, SQLG_SCHEMA_INDEX_INDEX_TYPE, indexType.toString(), CREATED_ON, LocalDateTime.now() ); if (vertex) { abstractLabelVertex.addEdge(SQLG_SCHEMA_VERTEX_INDEX_EDGE, indexVertex); } else { abstractLabelVertex.addEdge(SQLG_SCHEMA_EDGE_INDEX_EDGE, indexVertex); } } if (!propertyVertexes.isEmpty()) { Preconditions.checkState(propertyVertexes.size() == 1, "BUG: multiple Properties %s found for AbstractLabels found for %s.%s", property, schema, label); Preconditions.checkState(indexVertex != null); Vertex propertyVertex = propertyVertexes.get(0); indexVertex.addEdge(SQLG_SCHEMA_INDEX_PROPERTY_EDGE, propertyVertex, SQLG_SCHEMA_INDEX_PROPERTY_EDGE_SEQUENCE, ix); } } } finally { sqlgGraph.tx().batchMode(batchModeType); } }
[ "public", "static", "void", "addIndex", "(", "SqlgGraph", "sqlgGraph", ",", "String", "schema", ",", "String", "label", ",", "boolean", "vertex", ",", "String", "index", ",", "IndexType", "indexType", ",", "List", "<", "String", ">", "properties", ")", "{", ...
add an index from information schema @param sqlgGraph the graph @param schema the schema name @param label the label name @param vertex is it a vertex or an edge label? @param index the index name @param indexType index type @param properties the column names
[ "add", "an", "index", "from", "information", "schema" ]
train
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/TopologyManager.java#L966-L1029
twilio/twilio-java
src/main/java/com/twilio/converter/Converter.java
Converter.mapToJson
public static String mapToJson(final Map<String, Object> map) { try { return MAPPER.writeValueAsString(map); } catch (JsonProcessingException e) { return null; } }
java
public static String mapToJson(final Map<String, Object> map) { try { return MAPPER.writeValueAsString(map); } catch (JsonProcessingException e) { return null; } }
[ "public", "static", "String", "mapToJson", "(", "final", "Map", "<", "String", ",", "Object", ">", "map", ")", "{", "try", "{", "return", "MAPPER", ".", "writeValueAsString", "(", "map", ")", ";", "}", "catch", "(", "JsonProcessingException", "e", ")", "...
Convert a map to a JSON String. @param map map to convert @return converted JSON string
[ "Convert", "a", "map", "to", "a", "JSON", "String", "." ]
train
https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/converter/Converter.java#L19-L25
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/core/msg/MsgChecker.java
MsgChecker.checkPoint
public void checkPoint(ValidationData param, ValidationRule rule, Object bodyObj, Object standardValue) { //check Object value = param.getValue(bodyObj); BaseValidationCheck checker = this.validationRuleStore.getValidationChecker(rule); if ((value != null && standardValue != null) || rule.getAssistType().isNullable()) { boolean valid = checker.check(value, standardValue); if (!valid) { this.callExcpetion(param, rule, value, standardValue); } } //replace value Object replaceValue = checker.replace(value, standardValue, param); if (replaceValue != null && replaceValue != value) { param.replaceValue(bodyObj, replaceValue); } }
java
public void checkPoint(ValidationData param, ValidationRule rule, Object bodyObj, Object standardValue) { //check Object value = param.getValue(bodyObj); BaseValidationCheck checker = this.validationRuleStore.getValidationChecker(rule); if ((value != null && standardValue != null) || rule.getAssistType().isNullable()) { boolean valid = checker.check(value, standardValue); if (!valid) { this.callExcpetion(param, rule, value, standardValue); } } //replace value Object replaceValue = checker.replace(value, standardValue, param); if (replaceValue != null && replaceValue != value) { param.replaceValue(bodyObj, replaceValue); } }
[ "public", "void", "checkPoint", "(", "ValidationData", "param", ",", "ValidationRule", "rule", ",", "Object", "bodyObj", ",", "Object", "standardValue", ")", "{", "//check", "Object", "value", "=", "param", ".", "getValue", "(", "bodyObj", ")", ";", "BaseValid...
Check point. @param param the param @param rule the rule @param bodyObj the body obj @param standardValue the standard value
[ "Check", "point", "." ]
train
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/core/msg/MsgChecker.java#L59-L76
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java
HELM2NotationUtils.getFormatedSirnaSequences
public static String[] getFormatedSirnaSequences(HELM2Notation helm2notation) throws NotationException, RNAUtilsException, HELM2HandledException, org.helm.notation2.exception.NotationException, ChemistryException { return getFormatedSirnaSequences(helm2notation, DEFAULT_PADDING_CHAR, DEFAULT_BASE_PAIR_CHAR); }
java
public static String[] getFormatedSirnaSequences(HELM2Notation helm2notation) throws NotationException, RNAUtilsException, HELM2HandledException, org.helm.notation2.exception.NotationException, ChemistryException { return getFormatedSirnaSequences(helm2notation, DEFAULT_PADDING_CHAR, DEFAULT_BASE_PAIR_CHAR); }
[ "public", "static", "String", "[", "]", "getFormatedSirnaSequences", "(", "HELM2Notation", "helm2notation", ")", "throws", "NotationException", ",", "RNAUtilsException", ",", "HELM2HandledException", ",", "org", ".", "helm", ".", "notation2", ".", "exception", ".", ...
generate formated siRNA sequence with default padding char " " and base-pair char "|" @param helm2notation HELM2Notation @return string array of formated nucloeotide sequence @throws NotationException if notation is not valid @throws RNAUtilsException if the polymer is not a RNA/DNA @throws HELM2HandledException if it contains HELM2 specific features, so that it can not be casted to HELM1 Format @throws org.helm.notation2.exception.NotationException if notation is not valid @throws ChemistryException if the Chemistry Engine can not be initialized
[ "generate", "formated", "siRNA", "sequence", "with", "default", "padding", "char", "and", "base", "-", "pair", "char", "|" ]
train
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L390-L393
alkacon/opencms-core
src-setup/org/opencms/setup/CmsSetupBean.java
CmsSetupBean.validateJdbc
public boolean validateJdbc() { boolean result = false; String libFolder = getLibFolder(); Iterator<String> it = getDatabaseLibs(getDatabase()).iterator(); while (it.hasNext()) { String libName = it.next(); File libFile = new File(libFolder, libName); if (libFile.exists()) { result = true; } } return result; }
java
public boolean validateJdbc() { boolean result = false; String libFolder = getLibFolder(); Iterator<String> it = getDatabaseLibs(getDatabase()).iterator(); while (it.hasNext()) { String libName = it.next(); File libFile = new File(libFolder, libName); if (libFile.exists()) { result = true; } } return result; }
[ "public", "boolean", "validateJdbc", "(", ")", "{", "boolean", "result", "=", "false", ";", "String", "libFolder", "=", "getLibFolder", "(", ")", ";", "Iterator", "<", "String", ">", "it", "=", "getDatabaseLibs", "(", "getDatabase", "(", ")", ")", ".", "...
Checks the jdbc driver.<p> @return <code>true</code> if at least one of the recommended drivers is found
[ "Checks", "the", "jdbc", "driver", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupBean.java#L2331-L2344
dlemmermann/CalendarFX
CalendarFXView/src/main/java/com/calendarfx/view/CalendarView.java
CalendarView.showWeek
public final void showWeek(Year year, int weekOfYear) { requireNonNull(year); if (weekOfYear < 1) { throw new IllegalArgumentException("illegal value for week of year: " + weekOfYear); } if (!weekPage.isHidden()) { selectedPage.set(getWeekPage()); } else if (!monthPage.isHidden()) { selectedPage.set(getMonthPage()); } else if (!yearPage.isHidden()) { selectedPage.set(getYearPage()); } setDate(LocalDate.of(year.getValue(), 1, 1).plusWeeks(weekOfYear)); }
java
public final void showWeek(Year year, int weekOfYear) { requireNonNull(year); if (weekOfYear < 1) { throw new IllegalArgumentException("illegal value for week of year: " + weekOfYear); } if (!weekPage.isHidden()) { selectedPage.set(getWeekPage()); } else if (!monthPage.isHidden()) { selectedPage.set(getMonthPage()); } else if (!yearPage.isHidden()) { selectedPage.set(getYearPage()); } setDate(LocalDate.of(year.getValue(), 1, 1).plusWeeks(weekOfYear)); }
[ "public", "final", "void", "showWeek", "(", "Year", "year", ",", "int", "weekOfYear", ")", "{", "requireNonNull", "(", "year", ")", ";", "if", "(", "weekOfYear", "<", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"illegal value for week of ...
Sends the request to the calendar view to display the given week. The view will try to switch to the {@link WeekPage} and set the value of {@link #dateProperty()} to the date. @param year the date to show in the view @param weekOfYear the week to show in the view
[ "Sends", "the", "request", "to", "the", "calendar", "view", "to", "display", "the", "given", "week", ".", "The", "view", "will", "try", "to", "switch", "to", "the", "{", "@link", "WeekPage", "}", "and", "set", "the", "value", "of", "{", "@link", "#date...
train
https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/view/CalendarView.java#L772-L786
GistLabs/mechanize
src/main/java/com/gistlabs/mechanize/util/apache/URLEncodedUtils.java
URLEncodedUtils.encFragment
static String encFragment(final String content, final Charset charset) { return urlencode(content, charset, FRAGMENT, false); }
java
static String encFragment(final String content, final Charset charset) { return urlencode(content, charset, FRAGMENT, false); }
[ "static", "String", "encFragment", "(", "final", "String", "content", ",", "final", "Charset", "charset", ")", "{", "return", "urlencode", "(", "content", ",", "charset", ",", "FRAGMENT", ",", "false", ")", ";", "}" ]
Encode a String using the {@link #FRAGMENT} set of characters. <p> Used by URIBuilder to encode the userinfo segment. @param content the string to encode, does not convert space to '+' @param charset the charset to use @return the encoded string
[ "Encode", "a", "String", "using", "the", "{", "@link", "#FRAGMENT", "}", "set", "of", "characters", ".", "<p", ">", "Used", "by", "URIBuilder", "to", "encode", "the", "userinfo", "segment", "." ]
train
https://github.com/GistLabs/mechanize/blob/32ddd0774439a4c08513c05d7ac7416a3899efed/src/main/java/com/gistlabs/mechanize/util/apache/URLEncodedUtils.java#L507-L509
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/util/FactoryHelper.java
FactoryHelper.newInstanceFromName
public static Object newInstanceFromName(String className, ClassLoader classLoader) { try { Class<?> clazz = Class.forName(className, true, classLoader); return clazz.newInstance(); } catch (Exception e) { String m = "Couldn't create instance from name " + className + " (" + e.getMessage() + ")"; LOG.error(m, e); throw new RuntimeException(m); } }
java
public static Object newInstanceFromName(String className, ClassLoader classLoader) { try { Class<?> clazz = Class.forName(className, true, classLoader); return clazz.newInstance(); } catch (Exception e) { String m = "Couldn't create instance from name " + className + " (" + e.getMessage() + ")"; LOG.error(m, e); throw new RuntimeException(m); } }
[ "public", "static", "Object", "newInstanceFromName", "(", "String", "className", ",", "ClassLoader", "classLoader", ")", "{", "try", "{", "Class", "<", "?", ">", "clazz", "=", "Class", ".", "forName", "(", "className", ",", "true", ",", "classLoader", ")", ...
Creates an instance from a String class name. @param className full class name @param classLoader the class will be loaded with this ClassLoader @return new instance of the class @throws RuntimeException if class not found or could not be instantiated
[ "Creates", "an", "instance", "from", "a", "String", "class", "name", "." ]
train
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/util/FactoryHelper.java#L61-L70
Azure/azure-sdk-for-java
sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesInner.java
BackupShortTermRetentionPoliciesInner.beginUpdateAsync
public Observable<BackupShortTermRetentionPolicyInner> beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).map(new Func1<ServiceResponse<BackupShortTermRetentionPolicyInner>, BackupShortTermRetentionPolicyInner>() { @Override public BackupShortTermRetentionPolicyInner call(ServiceResponse<BackupShortTermRetentionPolicyInner> response) { return response.body(); } }); }
java
public Observable<BackupShortTermRetentionPolicyInner> beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).map(new Func1<ServiceResponse<BackupShortTermRetentionPolicyInner>, BackupShortTermRetentionPolicyInner>() { @Override public BackupShortTermRetentionPolicyInner call(ServiceResponse<BackupShortTermRetentionPolicyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "BackupShortTermRetentionPolicyInner", ">", "beginUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "Integer", "retentionDays", ")", "{", "return", "beginUpdateWithServiceResponseA...
Updates a database's short term retention policy. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the BackupShortTermRetentionPolicyInner object
[ "Updates", "a", "database", "s", "short", "term", "retention", "policy", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesInner.java#L833-L840
Jasig/resource-server
resource-server-utils/src/main/java/org/jasig/resourceserver/utils/filter/PathBasedCacheExpirationFilter.java
PathBasedCacheExpirationFilter.setCacheMaxAges
public void setCacheMaxAges(Map<String, ? extends Number> cacheMaxAges) { final Builder<String, Long> cacheMaxAgesBuilder = ImmutableMap.builder(); final Builder<Long, String> cachedControlStringsBuilder = ImmutableMap.builder(); final Set<Long> maxAgeLog = new HashSet<Long>(); for (final Map.Entry<String, ? extends Number> cacheMaxAgeEntry : cacheMaxAges.entrySet()) { final Number maxAgeNum = cacheMaxAgeEntry.getValue(); final int maxAge = maxAgeNum.intValue(); final long maxAgeMillis = TimeUnit.SECONDS.toMillis(maxAge); cacheMaxAgesBuilder.put(cacheMaxAgeEntry.getKey(), maxAgeMillis); if (maxAgeLog.add(maxAgeMillis)) { cachedControlStringsBuilder.put(maxAgeMillis, "public, max-age=" + maxAge); } } this.cacheMaxAges = cacheMaxAgesBuilder.build(); this.cachedControlStrings = cachedControlStringsBuilder.build(); }
java
public void setCacheMaxAges(Map<String, ? extends Number> cacheMaxAges) { final Builder<String, Long> cacheMaxAgesBuilder = ImmutableMap.builder(); final Builder<Long, String> cachedControlStringsBuilder = ImmutableMap.builder(); final Set<Long> maxAgeLog = new HashSet<Long>(); for (final Map.Entry<String, ? extends Number> cacheMaxAgeEntry : cacheMaxAges.entrySet()) { final Number maxAgeNum = cacheMaxAgeEntry.getValue(); final int maxAge = maxAgeNum.intValue(); final long maxAgeMillis = TimeUnit.SECONDS.toMillis(maxAge); cacheMaxAgesBuilder.put(cacheMaxAgeEntry.getKey(), maxAgeMillis); if (maxAgeLog.add(maxAgeMillis)) { cachedControlStringsBuilder.put(maxAgeMillis, "public, max-age=" + maxAge); } } this.cacheMaxAges = cacheMaxAgesBuilder.build(); this.cachedControlStrings = cachedControlStringsBuilder.build(); }
[ "public", "void", "setCacheMaxAges", "(", "Map", "<", "String", ",", "?", "extends", "Number", ">", "cacheMaxAges", ")", "{", "final", "Builder", "<", "String", ",", "Long", ">", "cacheMaxAgesBuilder", "=", "ImmutableMap", ".", "builder", "(", ")", ";", "f...
Specify map of ant paths to max-age times (in seconds). The default map is: /**&#47;*.aggr.min.js - 365 days /**&#47;*.aggr.min.css - 365 days /**&#47;*.min.js - 365 days /**&#47;*.min.css - 365 days /rs/**&#47;* - 365 days
[ "Specify", "map", "of", "ant", "paths", "to", "max", "-", "age", "times", "(", "in", "seconds", ")", ".", "The", "default", "map", "is", ":" ]
train
https://github.com/Jasig/resource-server/blob/13375f716777ec3c99ae9917f672881d4aa32df3/resource-server-utils/src/main/java/org/jasig/resourceserver/utils/filter/PathBasedCacheExpirationFilter.java#L84-L102
biouno/figshare-java-api
src/main/java/org/biouno/figshare/FigShareClient.java
FigShareClient.uploadFile
public org.biouno.figshare.v1.model.File uploadFile(long articleId, File file) { HttpClient httpClient = null; try { final String method = String.format("my_data/articles/%d/files", articleId); // create an HTTP request to a protected resource final String url = getURL(endpoint, version, method); // create an HTTP request to a protected resource final HttpPut request = new HttpPut(url); MultipartEntityBuilder builder = MultipartEntityBuilder.create(); ContentBody body = new FileBody(file); FormBodyPart part = FormBodyPartBuilder.create("filedata", body).build(); builder.addPart(part); HttpEntity entity = builder.build(); request.setEntity(entity); // sign the request consumer.sign(request); // send the request httpClient = HttpClientBuilder.create().build(); HttpResponse response = httpClient.execute(request); HttpEntity responseEntity = response.getEntity(); String json = EntityUtils.toString(responseEntity); org.biouno.figshare.v1.model.File uploadedFile = readFileFromJson(json); return uploadedFile; } catch (OAuthCommunicationException e) { throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e); } catch (OAuthMessageSignerException e) { throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e); } catch (OAuthExpectationFailedException e) { throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e); } catch (ClientProtocolException e) { throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e); } catch (IOException e) { throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e); } }
java
public org.biouno.figshare.v1.model.File uploadFile(long articleId, File file) { HttpClient httpClient = null; try { final String method = String.format("my_data/articles/%d/files", articleId); // create an HTTP request to a protected resource final String url = getURL(endpoint, version, method); // create an HTTP request to a protected resource final HttpPut request = new HttpPut(url); MultipartEntityBuilder builder = MultipartEntityBuilder.create(); ContentBody body = new FileBody(file); FormBodyPart part = FormBodyPartBuilder.create("filedata", body).build(); builder.addPart(part); HttpEntity entity = builder.build(); request.setEntity(entity); // sign the request consumer.sign(request); // send the request httpClient = HttpClientBuilder.create().build(); HttpResponse response = httpClient.execute(request); HttpEntity responseEntity = response.getEntity(); String json = EntityUtils.toString(responseEntity); org.biouno.figshare.v1.model.File uploadedFile = readFileFromJson(json); return uploadedFile; } catch (OAuthCommunicationException e) { throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e); } catch (OAuthMessageSignerException e) { throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e); } catch (OAuthExpectationFailedException e) { throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e); } catch (ClientProtocolException e) { throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e); } catch (IOException e) { throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e); } }
[ "public", "org", ".", "biouno", ".", "figshare", ".", "v1", ".", "model", ".", "File", "uploadFile", "(", "long", "articleId", ",", "File", "file", ")", "{", "HttpClient", "httpClient", "=", "null", ";", "try", "{", "final", "String", "method", "=", "S...
Upload a file to an article. @param articleId article ID @param file java.io.File file @return org.biouno.figshare.v1.model.File uploaded file, without the thumbnail URL
[ "Upload", "a", "file", "to", "an", "article", "." ]
train
https://github.com/biouno/figshare-java-api/blob/6d447764efe8fa4329d15e339a8601351aade93c/src/main/java/org/biouno/figshare/FigShareClient.java#L286-L324
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java
HtmlTree.TR
public static HtmlTree TR(Content body) { HtmlTree htmltree = new HtmlTree(HtmlTag.TR, nullCheck(body)); return htmltree; }
java
public static HtmlTree TR(Content body) { HtmlTree htmltree = new HtmlTree(HtmlTag.TR, nullCheck(body)); return htmltree; }
[ "public", "static", "HtmlTree", "TR", "(", "Content", "body", ")", "{", "HtmlTree", "htmltree", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "TR", ",", "nullCheck", "(", "body", ")", ")", ";", "return", "htmltree", ";", "}" ]
Generates a TR tag for an HTML table with some content. @param body content for the tag @return an HtmlTree object for the TR tag
[ "Generates", "a", "TR", "tag", "for", "an", "HTML", "table", "with", "some", "content", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L853-L856
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/StringUtils.java
StringUtils.appendIfMissing
public static String appendIfMissing(final String str, final CharSequence suffix, final CharSequence... suffixes) { return appendIfMissing(str, suffix, false, suffixes); }
java
public static String appendIfMissing(final String str, final CharSequence suffix, final CharSequence... suffixes) { return appendIfMissing(str, suffix, false, suffixes); }
[ "public", "static", "String", "appendIfMissing", "(", "final", "String", "str", ",", "final", "CharSequence", "suffix", ",", "final", "CharSequence", "...", "suffixes", ")", "{", "return", "appendIfMissing", "(", "str", ",", "suffix", ",", "false", ",", "suffi...
Appends the suffix to the end of the string if the string does not already end with any of the suffixes. <pre> StringUtils.appendIfMissing(null, null) = null StringUtils.appendIfMissing("abc", null) = "abc" StringUtils.appendIfMissing("", "xyz") = "xyz" StringUtils.appendIfMissing("abc", "xyz") = "abcxyz" StringUtils.appendIfMissing("abcxyz", "xyz") = "abcxyz" StringUtils.appendIfMissing("abcXYZ", "xyz") = "abcXYZxyz" </pre> <p>With additional suffixes,</p> <pre> StringUtils.appendIfMissing(null, null, null) = null StringUtils.appendIfMissing("abc", null, null) = "abc" StringUtils.appendIfMissing("", "xyz", null) = "xyz" StringUtils.appendIfMissing("abc", "xyz", new CharSequence[]{null}) = "abcxyz" StringUtils.appendIfMissing("abc", "xyz", "") = "abc" StringUtils.appendIfMissing("abc", "xyz", "mno") = "abcxyz" StringUtils.appendIfMissing("abcxyz", "xyz", "mno") = "abcxyz" StringUtils.appendIfMissing("abcmno", "xyz", "mno") = "abcmno" StringUtils.appendIfMissing("abcXYZ", "xyz", "mno") = "abcXYZxyz" StringUtils.appendIfMissing("abcMNO", "xyz", "mno") = "abcMNOxyz" </pre> @param str The string. @param suffix The suffix to append to the end of the string. @param suffixes Additional suffixes that are valid terminators. @return A new String if suffix was appended, the same string otherwise. @since 3.2
[ "Appends", "the", "suffix", "to", "the", "end", "of", "the", "string", "if", "the", "string", "does", "not", "already", "end", "with", "any", "of", "the", "suffixes", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L8814-L8816
nmorel/gwt-jackson
gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/bean/BeanProcessor.java
BeanProcessor.processType
public static Optional<BeanTypeInfo> processType( TreeLogger logger, JacksonTypeOracle typeOracle, RebindConfiguration configuration, JClassType type, Optional<JsonTypeInfo> jsonTypeInfo, Optional<JsonSubTypes> propertySubTypes ) throws UnableToCompleteException { if ( !jsonTypeInfo.isPresent() ) { jsonTypeInfo = findFirstEncounteredAnnotationsOnAllHierarchy( configuration, type, JsonTypeInfo.class ); if ( !jsonTypeInfo.isPresent() ) { return Optional.absent(); } } Id use = jsonTypeInfo.get().use(); As include = jsonTypeInfo.get().include(); String propertyName = jsonTypeInfo.get().property().isEmpty() ? jsonTypeInfo.get().use().getDefaultPropertyName() : jsonTypeInfo .get().property(); Optional<JsonSubTypes> typeSubTypes = findFirstEncounteredAnnotationsOnAllHierarchy( configuration, type, JsonSubTypes.class ); // TODO we could do better, we actually extract metadata twice for a lot of classes ImmutableMap<JClassType, String> classToSerializationMetadata = extractMetadata( logger, configuration, type, jsonTypeInfo, propertySubTypes, typeSubTypes, CreatorUtils .filterSubtypesForSerialization( logger, configuration, type ) ); ImmutableMap<JClassType, String> classToDeserializationMetadata = extractMetadata( logger, configuration, type, jsonTypeInfo, propertySubTypes, typeSubTypes, CreatorUtils .filterSubtypesForDeserialization( logger, configuration, type ) ); return Optional.of( new BeanTypeInfo( use, include, propertyName, classToSerializationMetadata, classToDeserializationMetadata ) ); }
java
public static Optional<BeanTypeInfo> processType( TreeLogger logger, JacksonTypeOracle typeOracle, RebindConfiguration configuration, JClassType type, Optional<JsonTypeInfo> jsonTypeInfo, Optional<JsonSubTypes> propertySubTypes ) throws UnableToCompleteException { if ( !jsonTypeInfo.isPresent() ) { jsonTypeInfo = findFirstEncounteredAnnotationsOnAllHierarchy( configuration, type, JsonTypeInfo.class ); if ( !jsonTypeInfo.isPresent() ) { return Optional.absent(); } } Id use = jsonTypeInfo.get().use(); As include = jsonTypeInfo.get().include(); String propertyName = jsonTypeInfo.get().property().isEmpty() ? jsonTypeInfo.get().use().getDefaultPropertyName() : jsonTypeInfo .get().property(); Optional<JsonSubTypes> typeSubTypes = findFirstEncounteredAnnotationsOnAllHierarchy( configuration, type, JsonSubTypes.class ); // TODO we could do better, we actually extract metadata twice for a lot of classes ImmutableMap<JClassType, String> classToSerializationMetadata = extractMetadata( logger, configuration, type, jsonTypeInfo, propertySubTypes, typeSubTypes, CreatorUtils .filterSubtypesForSerialization( logger, configuration, type ) ); ImmutableMap<JClassType, String> classToDeserializationMetadata = extractMetadata( logger, configuration, type, jsonTypeInfo, propertySubTypes, typeSubTypes, CreatorUtils .filterSubtypesForDeserialization( logger, configuration, type ) ); return Optional.of( new BeanTypeInfo( use, include, propertyName, classToSerializationMetadata, classToDeserializationMetadata ) ); }
[ "public", "static", "Optional", "<", "BeanTypeInfo", ">", "processType", "(", "TreeLogger", "logger", ",", "JacksonTypeOracle", "typeOracle", ",", "RebindConfiguration", "configuration", ",", "JClassType", "type", ",", "Optional", "<", "JsonTypeInfo", ">", "jsonTypeIn...
<p>processType</p> @param logger a {@link com.google.gwt.core.ext.TreeLogger} object. @param typeOracle a {@link com.github.nmorel.gwtjackson.rebind.JacksonTypeOracle} object. @param configuration a {@link com.github.nmorel.gwtjackson.rebind.RebindConfiguration} object. @param typeOracle a {@link com.github.nmorel.gwtjackson.rebind.JacksonTypeOracle} object. @param type a {@link com.google.gwt.core.ext.typeinfo.JClassType} object. @param jsonTypeInfo a {@link com.google.gwt.thirdparty.guava.common.base.Optional} object. @param propertySubTypes a {@link com.google.gwt.thirdparty.guava.common.base.Optional} object. @return a {@link com.google.gwt.thirdparty.guava.common.base.Optional} object. @throws com.google.gwt.core.ext.UnableToCompleteException if any.
[ "<p", ">", "processType<", "/", "p", ">" ]
train
https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/bean/BeanProcessor.java#L378-L406
haifengl/smile
math/src/main/java/smile/sort/SortUtils.java
SortUtils.siftUp
public static void siftUp(int[] arr, int k) { while (k > 1 && arr[k/2] < arr[k]) { swap(arr, k, k/2); k = k/2; } }
java
public static void siftUp(int[] arr, int k) { while (k > 1 && arr[k/2] < arr[k]) { swap(arr, k, k/2); k = k/2; } }
[ "public", "static", "void", "siftUp", "(", "int", "[", "]", "arr", ",", "int", "k", ")", "{", "while", "(", "k", ">", "1", "&&", "arr", "[", "k", "/", "2", "]", "<", "arr", "[", "k", "]", ")", "{", "swap", "(", "arr", ",", "k", ",", "k", ...
To restore the max-heap condition when a node's priority is increased. We move up the heap, exchaning the node at position k with its parent (at postion k/2) if necessary, continuing as long as a[k/2] &lt; a[k] or until we reach the top of the heap.
[ "To", "restore", "the", "max", "-", "heap", "condition", "when", "a", "node", "s", "priority", "is", "increased", ".", "We", "move", "up", "the", "heap", "exchaning", "the", "node", "at", "position", "k", "with", "its", "parent", "(", "at", "postion", ...
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/sort/SortUtils.java#L75-L80
joniles/mpxj
src/main/java/net/sf/mpxj/Task.java
Task.setBaselineCost
public void setBaselineCost(int baselineNumber, Number value) { set(selectField(TaskFieldLists.BASELINE_COSTS, baselineNumber), value); }
java
public void setBaselineCost(int baselineNumber, Number value) { set(selectField(TaskFieldLists.BASELINE_COSTS, baselineNumber), value); }
[ "public", "void", "setBaselineCost", "(", "int", "baselineNumber", ",", "Number", "value", ")", "{", "set", "(", "selectField", "(", "TaskFieldLists", ".", "BASELINE_COSTS", ",", "baselineNumber", ")", ",", "value", ")", ";", "}" ]
Set a baseline value. @param baselineNumber baseline index (1-10) @param value baseline value
[ "Set", "a", "baseline", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L3980-L3983
molgenis/molgenis
molgenis-data-icd10/src/main/java/org/molgenis/data/icd10/CollectionsQueryTransformerImpl.java
CollectionsQueryTransformerImpl.isTransformableRule
private boolean isTransformableRule(QueryRule nestedRule, String expandAttribute) { return nestedRule != null && nestedRule.getField() != null && nestedRule.getField().equals(expandAttribute) && (nestedRule.getOperator() == QueryRule.Operator.IN || nestedRule.getOperator() == QueryRule.Operator.EQUALS); }
java
private boolean isTransformableRule(QueryRule nestedRule, String expandAttribute) { return nestedRule != null && nestedRule.getField() != null && nestedRule.getField().equals(expandAttribute) && (nestedRule.getOperator() == QueryRule.Operator.IN || nestedRule.getOperator() == QueryRule.Operator.EQUALS); }
[ "private", "boolean", "isTransformableRule", "(", "QueryRule", "nestedRule", ",", "String", "expandAttribute", ")", "{", "return", "nestedRule", "!=", "null", "&&", "nestedRule", ".", "getField", "(", ")", "!=", "null", "&&", "nestedRule", ".", "getField", "(", ...
Returns <code>true</code> if a rule is 'IN' or 'EQUALS' on the attribute that should be expanded
[ "Returns", "<code", ">", "true<", "/", "code", ">", "if", "a", "rule", "is", "IN", "or", "EQUALS", "on", "the", "attribute", "that", "should", "be", "expanded" ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-icd10/src/main/java/org/molgenis/data/icd10/CollectionsQueryTransformerImpl.java#L72-L78
nispok/snackbar
lib/src/main/java/com/nispok/snackbar/Snackbar.java
Snackbar.attachToAbsListView
public Snackbar attachToAbsListView(AbsListView absListView) { absListView.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { dismiss(); } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { } }); return this; }
java
public Snackbar attachToAbsListView(AbsListView absListView) { absListView.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { dismiss(); } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { } }); return this; }
[ "public", "Snackbar", "attachToAbsListView", "(", "AbsListView", "absListView", ")", "{", "absListView", ".", "setOnScrollListener", "(", "new", "AbsListView", ".", "OnScrollListener", "(", ")", "{", "@", "Override", "public", "void", "onScrollStateChanged", "(", "A...
Attaches this {@link Snackbar} to an AbsListView (ListView, GridView, ExpandableListView) so it dismisses when the list is scrolled @param absListView @return
[ "Attaches", "this", "{", "@link", "Snackbar", "}", "to", "an", "AbsListView", "(", "ListView", "GridView", "ExpandableListView", ")", "so", "it", "dismisses", "when", "the", "list", "is", "scrolled" ]
train
https://github.com/nispok/snackbar/blob/a4e0449874423031107f6aaa7e97d0f1714a1d3b/lib/src/main/java/com/nispok/snackbar/Snackbar.java#L504-L518
threerings/nenya
core/src/main/java/com/threerings/miso/client/SceneObject.java
SceneObject.refreshObjectTile
public void refreshObjectTile (MisoSceneMetrics metrics, TileManager mgr, Colorizer colorizer) { int tsid = TileUtil.getTileSetId(info.tileId); int tidx = TileUtil.getTileIndex(info.tileId); try { tile = (ObjectTile)mgr.getTile(tsid, tidx, colorizer); computeInfo(metrics); } catch (NoSuchTileSetException te) { log.warning("Scene contains non-existent object tileset [info=" + info + "]."); } }
java
public void refreshObjectTile (MisoSceneMetrics metrics, TileManager mgr, Colorizer colorizer) { int tsid = TileUtil.getTileSetId(info.tileId); int tidx = TileUtil.getTileIndex(info.tileId); try { tile = (ObjectTile)mgr.getTile(tsid, tidx, colorizer); computeInfo(metrics); } catch (NoSuchTileSetException te) { log.warning("Scene contains non-existent object tileset [info=" + info + "]."); } }
[ "public", "void", "refreshObjectTile", "(", "MisoSceneMetrics", "metrics", ",", "TileManager", "mgr", ",", "Colorizer", "colorizer", ")", "{", "int", "tsid", "=", "TileUtil", ".", "getTileSetId", "(", "info", ".", "tileId", ")", ";", "int", "tidx", "=", "Til...
Reloads and recolorizes our object tile. It is not intended for the actual object tile used by a scene object to change in its lifetime, only attributes of that object like its colorizations. So don't do anything crazy like change our {@link ObjectInfo}'s <code>tileId</code> and call this method or things might break.
[ "Reloads", "and", "recolorizes", "our", "object", "tile", ".", "It", "is", "not", "intended", "for", "the", "actual", "object", "tile", "used", "by", "a", "scene", "object", "to", "change", "in", "its", "lifetime", "only", "attributes", "of", "that", "obje...
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/SceneObject.java#L275-L286
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcCallableStatement.java
WSJdbcCallableStatement.invokeOperation
Object invokeOperation(Object implObject, Method method, Object[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, SQLException { if (args != null && args.length == 1 && method.getName().equals("getCursor")) return getCursor(implObject, method, args); return super.invokeOperation(implObject, method, args); }
java
Object invokeOperation(Object implObject, Method method, Object[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, SQLException { if (args != null && args.length == 1 && method.getName().equals("getCursor")) return getCursor(implObject, method, args); return super.invokeOperation(implObject, method, args); }
[ "Object", "invokeOperation", "(", "Object", "implObject", ",", "Method", "method", ",", "Object", "[", "]", "args", ")", "throws", "IllegalAccessException", ",", "IllegalArgumentException", ",", "InvocationTargetException", ",", "SQLException", "{", "if", "(", "args...
Invokes a method on the specified object. @param implObject the instance on which the operation is invoked. @param method the method that is invoked. @param args the parameters to the method. @throws IllegalAccessException if the method is inaccessible. @throws IllegalArgumentException if the instance does not have the method or if the method arguments are not appropriate. @throws InvocationTargetException if the method raises a checked exception. @throws SQLException if unable to invoke the method for other reasons. @return the result of invoking the method.
[ "Invokes", "a", "method", "on", "the", "specified", "object", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcCallableStatement.java#L833-L839
infinispan/infinispan
counter/src/main/java/org/infinispan/counter/impl/listener/CounterManagerNotificationManager.java
CounterManagerNotificationManager.listenOn
public synchronized void listenOn(Cache<CounterKey, CounterValue> cache) throws InterruptedException { if (!topologyListener.registered) { this.cache = cache; topologyListener.register(cache); } if (!listenersRegistered) { this.cache.addListener(valueListener, CounterKeyFilter.getInstance()); listenersRegistered = true; } }
java
public synchronized void listenOn(Cache<CounterKey, CounterValue> cache) throws InterruptedException { if (!topologyListener.registered) { this.cache = cache; topologyListener.register(cache); } if (!listenersRegistered) { this.cache.addListener(valueListener, CounterKeyFilter.getInstance()); listenersRegistered = true; } }
[ "public", "synchronized", "void", "listenOn", "(", "Cache", "<", "CounterKey", ",", "CounterValue", ">", "cache", ")", "throws", "InterruptedException", "{", "if", "(", "!", "topologyListener", ".", "registered", ")", "{", "this", ".", "cache", "=", "cache", ...
It registers the cache listeners if they aren't already registered. @param cache The {@link Cache} to register the listener.
[ "It", "registers", "the", "cache", "listeners", "if", "they", "aren", "t", "already", "registered", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/counter/src/main/java/org/infinispan/counter/impl/listener/CounterManagerNotificationManager.java#L114-L123
eFaps/eFaps-Kernel
src/main/java/org/efaps/jaas/LoginHandler.java
LoginHandler.checkLogin
public Person checkLogin(final String _name, final String _passwd) { Person person = null; try { final LoginCallbackHandler callback = new LoginCallbackHandler(ActionCallback.Mode.LOGIN, _name, _passwd); final LoginContext login = new LoginContext(getApplicationName(), callback); login.login(); person = getPerson(login); if (person == null) { person = createPerson(login); } if (person != null) { updatePerson(login, person); person.cleanUp(); updateRoles(login, person); updateGroups(login, person); updateCompanies(login, person); person.updateLastLogin(); } } catch (final EFapsException e) { LoginHandler.LOG.error("login failed for '" + _name + "'", e); } catch (final LoginException e) { LoginHandler.LOG.error("login failed for '" + _name + "'", e); } return person; }
java
public Person checkLogin(final String _name, final String _passwd) { Person person = null; try { final LoginCallbackHandler callback = new LoginCallbackHandler(ActionCallback.Mode.LOGIN, _name, _passwd); final LoginContext login = new LoginContext(getApplicationName(), callback); login.login(); person = getPerson(login); if (person == null) { person = createPerson(login); } if (person != null) { updatePerson(login, person); person.cleanUp(); updateRoles(login, person); updateGroups(login, person); updateCompanies(login, person); person.updateLastLogin(); } } catch (final EFapsException e) { LoginHandler.LOG.error("login failed for '" + _name + "'", e); } catch (final LoginException e) { LoginHandler.LOG.error("login failed for '" + _name + "'", e); } return person; }
[ "public", "Person", "checkLogin", "(", "final", "String", "_name", ",", "final", "String", "_passwd", ")", "{", "Person", "person", "=", "null", ";", "try", "{", "final", "LoginCallbackHandler", "callback", "=", "new", "LoginCallbackHandler", "(", "ActionCallbac...
The instance method checks if for the given user the password is correct. The test itself is done with the JAAS module from Java.<br/> If a person is found and successfully logged in, the last login information from the person is updated to current time stamp. @param _name name of the person name to check @param _passwd password of the person to check @return found person @see #getPerson(LoginContext) @see #createPerson(LoginContext) @see #updatePerson(LoginContext, Person) @see #updateRoles(LoginContext, Person) @see #updateGroups(LoginContext, Person)
[ "The", "instance", "method", "checks", "if", "for", "the", "given", "user", "the", "password", "is", "correct", ".", "The", "test", "itself", "is", "done", "with", "the", "JAAS", "module", "from", "Java", ".", "<br", "/", ">", "If", "a", "person", "is"...
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/jaas/LoginHandler.java#L97-L129
Berico-Technologies/CLAVIN
src/main/java/com/bericotech/clavin/gazetteer/BasicGeoName.java
BasicGeoName.buildAncestryKey
private String buildAncestryKey(final FeatureCode level, final boolean includeSelf) { // if we have reached the root level, stop if (level == null) { return ""; } String keyPart; FeatureCode nextLevel; switch (level) { case ADM4: keyPart = admin4Code; nextLevel = FeatureCode.ADM3; break; case ADM3: keyPart = admin3Code; nextLevel = FeatureCode.ADM2; break; case ADM2: keyPart = admin2Code; nextLevel = FeatureCode.ADM1; break; case ADM1: // territories will be considered level 1 if they have the same country code as their // parent but cannot contain descendants so there should be no keypart for this level; // all parishes are considered to be direct descendants of their containing country with // no descendants; they should not have a key part at this level keyPart = featureCode != FeatureCode.TERR && featureCode != FeatureCode.PRSH ? admin1Code : ""; nextLevel = FeatureCode.PCL; break; case PCL: keyPart = primaryCountryCode != null && primaryCountryCode != CountryCode.NULL ? primaryCountryCode.name() : ""; nextLevel = null; break; default: throw new IllegalArgumentException("Level must be one of [PCL, ADM1, ADM2, ADM3, ADM4]"); } keyPart = keyPart.trim(); if (nextLevel != null && !keyPart.isEmpty()) { keyPart = String.format(".%s", keyPart); } int keyLevel = getAdminLevel(FeatureClass.A, level); int nameLevel = getAdminLevel(featureClass, featureCode, name, alternateNames, primaryCountryCode.name); // if the requested key part is a larger administrative division than the level of the // geoname or, if we are including the geoname's key part and it is the requested part, // include it in the ancestry key (if not blank); otherwise, move to the next level String qualifiedKey = (nameLevel > keyLevel || (includeSelf && keyLevel == nameLevel)) && !keyPart.isEmpty() ? String.format("%s%s", buildAncestryKey(nextLevel, includeSelf), keyPart) : buildAncestryKey(nextLevel, includeSelf); // if any part of the key is missing once a lower-level component has been specified, we cannot // resolve the ancestry path and an empty string should be returned. if (qualifiedKey.startsWith(".") || qualifiedKey.contains("..") || qualifiedKey.endsWith(".")) { qualifiedKey = ""; } return qualifiedKey; }
java
private String buildAncestryKey(final FeatureCode level, final boolean includeSelf) { // if we have reached the root level, stop if (level == null) { return ""; } String keyPart; FeatureCode nextLevel; switch (level) { case ADM4: keyPart = admin4Code; nextLevel = FeatureCode.ADM3; break; case ADM3: keyPart = admin3Code; nextLevel = FeatureCode.ADM2; break; case ADM2: keyPart = admin2Code; nextLevel = FeatureCode.ADM1; break; case ADM1: // territories will be considered level 1 if they have the same country code as their // parent but cannot contain descendants so there should be no keypart for this level; // all parishes are considered to be direct descendants of their containing country with // no descendants; they should not have a key part at this level keyPart = featureCode != FeatureCode.TERR && featureCode != FeatureCode.PRSH ? admin1Code : ""; nextLevel = FeatureCode.PCL; break; case PCL: keyPart = primaryCountryCode != null && primaryCountryCode != CountryCode.NULL ? primaryCountryCode.name() : ""; nextLevel = null; break; default: throw new IllegalArgumentException("Level must be one of [PCL, ADM1, ADM2, ADM3, ADM4]"); } keyPart = keyPart.trim(); if (nextLevel != null && !keyPart.isEmpty()) { keyPart = String.format(".%s", keyPart); } int keyLevel = getAdminLevel(FeatureClass.A, level); int nameLevel = getAdminLevel(featureClass, featureCode, name, alternateNames, primaryCountryCode.name); // if the requested key part is a larger administrative division than the level of the // geoname or, if we are including the geoname's key part and it is the requested part, // include it in the ancestry key (if not blank); otherwise, move to the next level String qualifiedKey = (nameLevel > keyLevel || (includeSelf && keyLevel == nameLevel)) && !keyPart.isEmpty() ? String.format("%s%s", buildAncestryKey(nextLevel, includeSelf), keyPart) : buildAncestryKey(nextLevel, includeSelf); // if any part of the key is missing once a lower-level component has been specified, we cannot // resolve the ancestry path and an empty string should be returned. if (qualifiedKey.startsWith(".") || qualifiedKey.contains("..") || qualifiedKey.endsWith(".")) { qualifiedKey = ""; } return qualifiedKey; }
[ "private", "String", "buildAncestryKey", "(", "final", "FeatureCode", "level", ",", "final", "boolean", "includeSelf", ")", "{", "// if we have reached the root level, stop", "if", "(", "level", "==", "null", ")", "{", "return", "\"\"", ";", "}", "String", "keyPar...
Recursively builds the ancestry key for this GeoName, optionally including the key for this GeoName's administrative division if requested and applicable. See {@link BasicGeoName#getAncestryKey()} for a description of the ancestry key. Only divisions that have a non-empty code set in this GeoName will be included in the key. @param level the administrative division at the end of the key (e.g. ADM2 to build the key COUNTRY.ADM1.ADM2) @param includeSelf <code>true</code> to include this GeoName's code in the key @return the generated ancestry key
[ "Recursively", "builds", "the", "ancestry", "key", "for", "this", "GeoName", "optionally", "including", "the", "key", "for", "this", "GeoName", "s", "administrative", "division", "if", "requested", "and", "applicable", ".", "See", "{" ]
train
https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/gazetteer/BasicGeoName.java#L530-L585
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getSeasonAccountState
public MediaState getSeasonAccountState(int tvID, String sessionID) throws MovieDbException { return tmdbSeasons.getSeasonAccountState(tvID, sessionID); }
java
public MediaState getSeasonAccountState(int tvID, String sessionID) throws MovieDbException { return tmdbSeasons.getSeasonAccountState(tvID, sessionID); }
[ "public", "MediaState", "getSeasonAccountState", "(", "int", "tvID", ",", "String", "sessionID", ")", "throws", "MovieDbException", "{", "return", "tmdbSeasons", ".", "getSeasonAccountState", "(", "tvID", ",", "sessionID", ")", ";", "}" ]
This method lets users get the status of whether or not the TV episodes of a season have been rated. A valid session id is required. @param tvID tvID @param sessionID sessionID @return @throws MovieDbException exception
[ "This", "method", "lets", "users", "get", "the", "status", "of", "whether", "or", "not", "the", "TV", "episodes", "of", "a", "season", "have", "been", "rated", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1700-L1702
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java
DocBookBuilder.processConditions
protected void processConditions(final BuildData buildData, final SpecTopic specTopic, final Document doc) { final String condition = specTopic.getConditionStatement(true); DocBookUtilities.processConditions(condition, doc, BuilderConstants.DEFAULT_CONDITION); }
java
protected void processConditions(final BuildData buildData, final SpecTopic specTopic, final Document doc) { final String condition = specTopic.getConditionStatement(true); DocBookUtilities.processConditions(condition, doc, BuilderConstants.DEFAULT_CONDITION); }
[ "protected", "void", "processConditions", "(", "final", "BuildData", "buildData", ",", "final", "SpecTopic", "specTopic", ",", "final", "Document", "doc", ")", "{", "final", "String", "condition", "=", "specTopic", ".", "getConditionStatement", "(", "true", ")", ...
Checks if the conditional pass should be performed. @param buildData Information and data structures for the build. @param specTopic The spec topic the conditions should be processed for, @param doc The DOM Document to process the conditions against.
[ "Checks", "if", "the", "conditional", "pass", "should", "be", "performed", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java#L1368-L1371
apache/flink
flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java
MemorySegment.putChar
@SuppressWarnings("restriction") public final void putChar(int index, char value) { final long pos = address + index; if (index >= 0 && pos <= addressLimit - 2) { UNSAFE.putChar(heapMemory, pos, value); } else if (address > addressLimit) { throw new IllegalStateException("segment has been freed"); } else { // index is in fact invalid throw new IndexOutOfBoundsException(); } }
java
@SuppressWarnings("restriction") public final void putChar(int index, char value) { final long pos = address + index; if (index >= 0 && pos <= addressLimit - 2) { UNSAFE.putChar(heapMemory, pos, value); } else if (address > addressLimit) { throw new IllegalStateException("segment has been freed"); } else { // index is in fact invalid throw new IndexOutOfBoundsException(); } }
[ "@", "SuppressWarnings", "(", "\"restriction\"", ")", "public", "final", "void", "putChar", "(", "int", "index", ",", "char", "value", ")", "{", "final", "long", "pos", "=", "address", "+", "index", ";", "if", "(", "index", ">=", "0", "&&", "pos", "<="...
Writes a char value to the given position, in the system's native byte order. @param index The position at which the memory will be written. @param value The char value to be written. @throws IndexOutOfBoundsException Thrown, if the index is negative, or larger than the segment size minus 2.
[ "Writes", "a", "char", "value", "to", "the", "given", "position", "in", "the", "system", "s", "native", "byte", "order", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java#L487-L500
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java
ScopedServletUtils.getScopedRequest
public static ScopedRequest getScopedRequest( HttpServletRequest realRequest, String overrideURI, ServletContext servletContext, Object scopeKey ) { return getScopedRequest( realRequest, overrideURI, servletContext, scopeKey, false ); }
java
public static ScopedRequest getScopedRequest( HttpServletRequest realRequest, String overrideURI, ServletContext servletContext, Object scopeKey ) { return getScopedRequest( realRequest, overrideURI, servletContext, scopeKey, false ); }
[ "public", "static", "ScopedRequest", "getScopedRequest", "(", "HttpServletRequest", "realRequest", ",", "String", "overrideURI", ",", "ServletContext", "servletContext", ",", "Object", "scopeKey", ")", "{", "return", "getScopedRequest", "(", "realRequest", ",", "overrid...
Get the cached ScopedRequest wrapper. If none exists, creates one and caches it. @deprecated Use {@link #getScopedRequest(HttpServletRequest, String, ServletContext, Object, boolean)}. @param realRequest the "real" (outer) HttpServletRequest, which will be wrapped. @param overrideURI the request-URI for the wrapped object. This URI must begin with the context path. @param servletContext the current ServletContext. @param scopeKey the scope-key associated with the new (or looked-up) scoped request. @return the cached (or newly-created) ScopedRequest.
[ "Get", "the", "cached", "ScopedRequest", "wrapper", ".", "If", "none", "exists", "creates", "one", "and", "caches", "it", ".", "@deprecated", "Use", "{", "@link", "#getScopedRequest", "(", "HttpServletRequest", "String", "ServletContext", "Object", "boolean", ")",...
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java#L65-L69
ppicas/custom-typeface
library/src/main/java/cat/ppicas/customtypeface/CustomTypefaceSpan.java
CustomTypefaceSpan.createText
public static CharSequence createText(CharSequence charSequence, Typeface typeface) { Spannable spannable = new SpannableString(charSequence); spannable.setSpan(getInstance(typeface), 0, spannable.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE); return spannable; }
java
public static CharSequence createText(CharSequence charSequence, Typeface typeface) { Spannable spannable = new SpannableString(charSequence); spannable.setSpan(getInstance(typeface), 0, spannable.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE); return spannable; }
[ "public", "static", "CharSequence", "createText", "(", "CharSequence", "charSequence", ",", "Typeface", "typeface", ")", "{", "Spannable", "spannable", "=", "new", "SpannableString", "(", "charSequence", ")", ";", "spannable", ".", "setSpan", "(", "getInstance", "...
Creates a new {@link Spanned} {@link CharSequence} that has applied {@link CustomTypefaceSpan} along the whole string. @param charSequence a {@code CharSequence} containing the text that you want stylize @param typeface the {@code Typeface} that you want to be applied on the text @return a new {@code CharSequence} with the {@code CustomTypefaceSpan} applied from the beginning to the end @see Spannable#setSpan
[ "Creates", "a", "new", "{", "@link", "Spanned", "}", "{", "@link", "CharSequence", "}", "that", "has", "applied", "{", "@link", "CustomTypefaceSpan", "}", "along", "the", "whole", "string", "." ]
train
https://github.com/ppicas/custom-typeface/blob/3a2a68cc8584a72076c545a8b7c9f741f6002241/library/src/main/java/cat/ppicas/customtypeface/CustomTypefaceSpan.java#L70-L75
Azure/azure-sdk-for-java
mixedreality/resource-manager/v2019_02_28_preview/src/main/java/com/microsoft/azure/management/mixedreality/v2019_02_28_preview/implementation/SpatialAnchorsAccountsInner.java
SpatialAnchorsAccountsInner.createAsync
public Observable<SpatialAnchorsAccountInner> createAsync(String resourceGroupName, String spatialAnchorsAccountName, SpatialAnchorsAccountInner spatialAnchorsAccount) { return createWithServiceResponseAsync(resourceGroupName, spatialAnchorsAccountName, spatialAnchorsAccount).map(new Func1<ServiceResponse<SpatialAnchorsAccountInner>, SpatialAnchorsAccountInner>() { @Override public SpatialAnchorsAccountInner call(ServiceResponse<SpatialAnchorsAccountInner> response) { return response.body(); } }); }
java
public Observable<SpatialAnchorsAccountInner> createAsync(String resourceGroupName, String spatialAnchorsAccountName, SpatialAnchorsAccountInner spatialAnchorsAccount) { return createWithServiceResponseAsync(resourceGroupName, spatialAnchorsAccountName, spatialAnchorsAccount).map(new Func1<ServiceResponse<SpatialAnchorsAccountInner>, SpatialAnchorsAccountInner>() { @Override public SpatialAnchorsAccountInner call(ServiceResponse<SpatialAnchorsAccountInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SpatialAnchorsAccountInner", ">", "createAsync", "(", "String", "resourceGroupName", ",", "String", "spatialAnchorsAccountName", ",", "SpatialAnchorsAccountInner", "spatialAnchorsAccount", ")", "{", "return", "createWithServiceResponseAsync", "(", ...
Creating or Updating a Spatial Anchors Account. @param resourceGroupName Name of an Azure resource group. @param spatialAnchorsAccountName Name of an Mixed Reality Spatial Anchors Account. @param spatialAnchorsAccount Spatial Anchors Account parameter. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SpatialAnchorsAccountInner object
[ "Creating", "or", "Updating", "a", "Spatial", "Anchors", "Account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mixedreality/resource-manager/v2019_02_28_preview/src/main/java/com/microsoft/azure/management/mixedreality/v2019_02_28_preview/implementation/SpatialAnchorsAccountsInner.java#L638-L645
OpenLiberty/open-liberty
dev/com.ibm.ws.security.openidconnect.clients.common/src/com/ibm/ws/security/openidconnect/clients/common/HashUtils.java
HashUtils.digest
@Sensitive @Trivial public static String digest(@Sensitive String input) { if (input == null || input.isEmpty()) return null; return digest(input, DEFAULT_ALGORITHM, DEFAULT_CHARSET); }
java
@Sensitive @Trivial public static String digest(@Sensitive String input) { if (input == null || input.isEmpty()) return null; return digest(input, DEFAULT_ALGORITHM, DEFAULT_CHARSET); }
[ "@", "Sensitive", "@", "Trivial", "public", "static", "String", "digest", "(", "@", "Sensitive", "String", "input", ")", "{", "if", "(", "input", "==", "null", "||", "input", ".", "isEmpty", "(", ")", ")", "return", "null", ";", "return", "digest", "("...
generate hash code by using SHA-256 If there is some error, log the error.
[ "generate", "hash", "code", "by", "using", "SHA", "-", "256", "If", "there", "is", "some", "error", "log", "the", "error", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.openidconnect.clients.common/src/com/ibm/ws/security/openidconnect/clients/common/HashUtils.java#L36-L42
jsonld-java/jsonld-java
core/src/main/java/com/github/jsonldjava/core/RDFDataset.java
RDFDataset.addTriple
public void addTriple(final String subject, final String predicate, final String object) { addQuad(subject, predicate, object, "@default"); }
java
public void addTriple(final String subject, final String predicate, final String object) { addQuad(subject, predicate, object, "@default"); }
[ "public", "void", "addTriple", "(", "final", "String", "subject", ",", "final", "String", "predicate", ",", "final", "String", "object", ")", "{", "addQuad", "(", "subject", ",", "predicate", ",", "object", ",", "\"@default\"", ")", ";", "}" ]
Adds a triple to the default graph of this dataset @param subject the subject for the triple @param predicate the predicate for the triple @param object the object for the triple
[ "Adds", "a", "triple", "to", "the", "default", "graph", "of", "this", "dataset" ]
train
https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/RDFDataset.java#L516-L518
ykrasik/jaci
jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/assist/AutoComplete.java
AutoComplete.union
public AutoComplete union(AutoComplete other) { if (possibilities.isEmpty()) { return other; } if (other.possibilities.isEmpty()) { return this; } // TODO: Make sure this can't happen. if (!this.prefix.equals(other.prefix)) { throw new IllegalArgumentException("Trying to perform union on different prefixes: prefix1='"+this.prefix+"', prefix2='"+other.prefix+'\''); } final Trie<CliValueType> unifiedPossibilities = this.possibilities.union(other.possibilities); return new AutoComplete(prefix, unifiedPossibilities); }
java
public AutoComplete union(AutoComplete other) { if (possibilities.isEmpty()) { return other; } if (other.possibilities.isEmpty()) { return this; } // TODO: Make sure this can't happen. if (!this.prefix.equals(other.prefix)) { throw new IllegalArgumentException("Trying to perform union on different prefixes: prefix1='"+this.prefix+"', prefix2='"+other.prefix+'\''); } final Trie<CliValueType> unifiedPossibilities = this.possibilities.union(other.possibilities); return new AutoComplete(prefix, unifiedPossibilities); }
[ "public", "AutoComplete", "union", "(", "AutoComplete", "other", ")", "{", "if", "(", "possibilities", ".", "isEmpty", "(", ")", ")", "{", "return", "other", ";", "}", "if", "(", "other", ".", "possibilities", ".", "isEmpty", "(", ")", ")", "{", "retur...
Create a new auto-complete by merging this auto-complete with the given auto-complete. The resulting auto-complete will contain possibilities from both this and the given auto-complete. @param other Auto-complete to merge with. @return A merged auto-complete containing possibilities from both this and the given auto-complete.
[ "Create", "a", "new", "auto", "-", "complete", "by", "merging", "this", "auto", "-", "complete", "with", "the", "given", "auto", "-", "complete", ".", "The", "resulting", "auto", "-", "complete", "will", "contain", "possibilities", "from", "both", "this", ...
train
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/assist/AutoComplete.java#L115-L130
kiegroup/drools
drools-core/src/main/java/org/drools/core/common/ConcurrentNodeMemories.java
ConcurrentNodeMemories.getNodeMemory
public Memory getNodeMemory(MemoryFactory node, InternalWorkingMemory wm) { if( node.getMemoryId() >= this.memories.length() ) { resize( node ); } Memory memory = this.memories.get( node.getMemoryId() ); if( memory == null ) { memory = createNodeMemory( node, wm ); } return memory; }
java
public Memory getNodeMemory(MemoryFactory node, InternalWorkingMemory wm) { if( node.getMemoryId() >= this.memories.length() ) { resize( node ); } Memory memory = this.memories.get( node.getMemoryId() ); if( memory == null ) { memory = createNodeMemory( node, wm ); } return memory; }
[ "public", "Memory", "getNodeMemory", "(", "MemoryFactory", "node", ",", "InternalWorkingMemory", "wm", ")", "{", "if", "(", "node", ".", "getMemoryId", "(", ")", ">=", "this", ".", "memories", ".", "length", "(", ")", ")", "{", "resize", "(", "node", ")"...
The implementation tries to delay locking as much as possible, by running some potentially unsafe operations out of the critical session. In case it fails the checks, it will move into the critical sessions and re-check everything before effectively doing any change on data structures.
[ "The", "implementation", "tries", "to", "delay", "locking", "as", "much", "as", "possible", "by", "running", "some", "potentially", "unsafe", "operations", "out", "of", "the", "critical", "session", ".", "In", "case", "it", "fails", "the", "checks", "it", "w...
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/common/ConcurrentNodeMemories.java#L79-L90
aws/aws-sdk-java
aws-java-sdk-secretsmanager/src/main/java/com/amazonaws/services/secretsmanager/model/DescribeSecretResult.java
DescribeSecretResult.withVersionIdsToStages
public DescribeSecretResult withVersionIdsToStages(java.util.Map<String, java.util.List<String>> versionIdsToStages) { setVersionIdsToStages(versionIdsToStages); return this; }
java
public DescribeSecretResult withVersionIdsToStages(java.util.Map<String, java.util.List<String>> versionIdsToStages) { setVersionIdsToStages(versionIdsToStages); return this; }
[ "public", "DescribeSecretResult", "withVersionIdsToStages", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "java", ".", "util", ".", "List", "<", "String", ">", ">", "versionIdsToStages", ")", "{", "setVersionIdsToStages", "(", "versionIdsToStages", "...
<p> A list of all of the currently assigned <code>VersionStage</code> staging labels and the <code>VersionId</code> that each is attached to. Staging labels are used to keep track of the different versions during the rotation process. </p> <note> <p> A version that does not have any staging labels attached is considered deprecated and subject to deletion. Such versions are not included in this list. </p> </note> @param versionIdsToStages A list of all of the currently assigned <code>VersionStage</code> staging labels and the <code>VersionId</code> that each is attached to. Staging labels are used to keep track of the different versions during the rotation process.</p> <note> <p> A version that does not have any staging labels attached is considered deprecated and subject to deletion. Such versions are not included in this list. </p> @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "list", "of", "all", "of", "the", "currently", "assigned", "<code", ">", "VersionStage<", "/", "code", ">", "staging", "labels", "and", "the", "<code", ">", "VersionId<", "/", "code", ">", "that", "each", "is", "attached", "to", ".", "S...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-secretsmanager/src/main/java/com/amazonaws/services/secretsmanager/model/DescribeSecretResult.java#L827-L830
apache/flink
flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/FunctionContext.java
FunctionContext.getJobParameter
public String getJobParameter(String key, String defaultValue) { final GlobalJobParameters conf = context.getExecutionConfig().getGlobalJobParameters(); if (conf != null && conf.toMap().containsKey(key)) { return conf.toMap().get(key); } else { return defaultValue; } }
java
public String getJobParameter(String key, String defaultValue) { final GlobalJobParameters conf = context.getExecutionConfig().getGlobalJobParameters(); if (conf != null && conf.toMap().containsKey(key)) { return conf.toMap().get(key); } else { return defaultValue; } }
[ "public", "String", "getJobParameter", "(", "String", "key", ",", "String", "defaultValue", ")", "{", "final", "GlobalJobParameters", "conf", "=", "context", ".", "getExecutionConfig", "(", ")", ".", "getGlobalJobParameters", "(", ")", ";", "if", "(", "conf", ...
Gets the global job parameter value associated with the given key as a string. @param key key pointing to the associated value @param defaultValue default value which is returned in case global job parameter is null or there is no value associated with the given key @return (default) value associated with the given key
[ "Gets", "the", "global", "job", "parameter", "value", "associated", "with", "the", "given", "key", "as", "a", "string", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/FunctionContext.java#L76-L83
VoltDB/voltdb
src/frontend/org/voltdb/iv2/LeaderCache.java
LeaderCache.processChildEvent
private void processChildEvent(WatchedEvent event) throws Exception { HashMap<Integer, LeaderCallBackInfo> cacheCopy = new HashMap<Integer, LeaderCallBackInfo>(m_publicCache); ByteArrayCallback cb = new ByteArrayCallback(); m_zk.getData(event.getPath(), m_childWatch, cb, null); try { // cb.getData() and cb.getPath() throw KeeperException byte payload[] = cb.get(); String data = new String(payload, "UTF-8"); LeaderCallBackInfo info = LeaderCache.buildLeaderCallbackFromString(data); Integer partitionId = getPartitionIdFromZKPath(cb.getPath()); cacheCopy.put(partitionId, info); } catch (KeeperException.NoNodeException e) { // rtb: I think result's path is the same as cb.getPath()? Integer partitionId = getPartitionIdFromZKPath(event.getPath()); cacheCopy.remove(partitionId); } m_publicCache = ImmutableMap.copyOf(cacheCopy); if (m_cb != null) { m_cb.run(m_publicCache); } }
java
private void processChildEvent(WatchedEvent event) throws Exception { HashMap<Integer, LeaderCallBackInfo> cacheCopy = new HashMap<Integer, LeaderCallBackInfo>(m_publicCache); ByteArrayCallback cb = new ByteArrayCallback(); m_zk.getData(event.getPath(), m_childWatch, cb, null); try { // cb.getData() and cb.getPath() throw KeeperException byte payload[] = cb.get(); String data = new String(payload, "UTF-8"); LeaderCallBackInfo info = LeaderCache.buildLeaderCallbackFromString(data); Integer partitionId = getPartitionIdFromZKPath(cb.getPath()); cacheCopy.put(partitionId, info); } catch (KeeperException.NoNodeException e) { // rtb: I think result's path is the same as cb.getPath()? Integer partitionId = getPartitionIdFromZKPath(event.getPath()); cacheCopy.remove(partitionId); } m_publicCache = ImmutableMap.copyOf(cacheCopy); if (m_cb != null) { m_cb.run(m_publicCache); } }
[ "private", "void", "processChildEvent", "(", "WatchedEvent", "event", ")", "throws", "Exception", "{", "HashMap", "<", "Integer", ",", "LeaderCallBackInfo", ">", "cacheCopy", "=", "new", "HashMap", "<", "Integer", ",", "LeaderCallBackInfo", ">", "(", "m_publicCach...
Update a modified child and republish a new snapshot. This may indicate a deleted child or a child with modified data.
[ "Update", "a", "modified", "child", "and", "republish", "a", "new", "snapshot", ".", "This", "may", "indicate", "a", "deleted", "child", "or", "a", "child", "with", "modified", "data", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/LeaderCache.java#L352-L372
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/Util.java
Util.sameNetwork
public static boolean sameNetwork(int prefixLength, InetAddress address1, InetAddress address2) { if (logger.isDebugEnabled()) { logger.debug("Comparing address " + address1.getHostAddress() + " with " + address2.getHostAddress() + ", prefixLength=" + prefixLength); } long prefixMask = 0xffffffffL & (-1 << (32 - prefixLength)); return (addressToLong(address1) & prefixMask) == (addressToLong(address2) & prefixMask); }
java
public static boolean sameNetwork(int prefixLength, InetAddress address1, InetAddress address2) { if (logger.isDebugEnabled()) { logger.debug("Comparing address " + address1.getHostAddress() + " with " + address2.getHostAddress() + ", prefixLength=" + prefixLength); } long prefixMask = 0xffffffffL & (-1 << (32 - prefixLength)); return (addressToLong(address1) & prefixMask) == (addressToLong(address2) & prefixMask); }
[ "public", "static", "boolean", "sameNetwork", "(", "int", "prefixLength", ",", "InetAddress", "address1", ",", "InetAddress", "address2", ")", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"Comparing addres...
Checks whether two internet addresses are on the same subnet. @param prefixLength the number of bits within an address that identify the network @param address1 the first address to be compared @param address2 the second address to be compared @return true if both addresses share the same network bits
[ "Checks", "whether", "two", "internet", "addresses", "are", "on", "the", "same", "subnet", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/Util.java#L309-L315
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java
GeneratedDUserDaoImpl.queryByCreatedBy
public Iterable<DUser> queryByCreatedBy(java.lang.String createdBy) { return queryByField(null, DUserMapper.Field.CREATEDBY.getFieldName(), createdBy); }
java
public Iterable<DUser> queryByCreatedBy(java.lang.String createdBy) { return queryByField(null, DUserMapper.Field.CREATEDBY.getFieldName(), createdBy); }
[ "public", "Iterable", "<", "DUser", ">", "queryByCreatedBy", "(", "java", ".", "lang", ".", "String", "createdBy", ")", "{", "return", "queryByField", "(", "null", ",", "DUserMapper", ".", "Field", ".", "CREATEDBY", ".", "getFieldName", "(", ")", ",", "cre...
query-by method for field createdBy @param createdBy the specified attribute @return an Iterable of DUsers for the specified createdBy
[ "query", "-", "by", "method", "for", "field", "createdBy" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L115-L117
rhuss/jolokia
agent/jvm/src/main/java/org/jolokia/jvmagent/client/util/VirtualMachineHandler.java
VirtualMachineHandler.listProcesses
public List<ProcessDescription> listProcesses() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { List<ProcessDescription> ret = new ArrayList<ProcessDescription>(); Class vmClass = lookupVirtualMachineClass(); Method method = vmClass.getMethod("list"); List vmDescriptors = (List) method.invoke(null); for (Object descriptor : vmDescriptors) { Method idMethod = descriptor.getClass().getMethod("id"); String id = (String) idMethod.invoke(descriptor); Method displayMethod = descriptor.getClass().getMethod("displayName"); String display = (String) displayMethod.invoke(descriptor); ret.add(new ProcessDescription(id, display)); } return ret; }
java
public List<ProcessDescription> listProcesses() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { List<ProcessDescription> ret = new ArrayList<ProcessDescription>(); Class vmClass = lookupVirtualMachineClass(); Method method = vmClass.getMethod("list"); List vmDescriptors = (List) method.invoke(null); for (Object descriptor : vmDescriptors) { Method idMethod = descriptor.getClass().getMethod("id"); String id = (String) idMethod.invoke(descriptor); Method displayMethod = descriptor.getClass().getMethod("displayName"); String display = (String) displayMethod.invoke(descriptor); ret.add(new ProcessDescription(id, display)); } return ret; }
[ "public", "List", "<", "ProcessDescription", ">", "listProcesses", "(", ")", "throws", "NoSuchMethodException", ",", "InvocationTargetException", ",", "IllegalAccessException", "{", "List", "<", "ProcessDescription", ">", "ret", "=", "new", "ArrayList", "<", "ProcessD...
Return a list of all Java processes @return list of java processes @throws NoSuchMethodException reflection error @throws InvocationTargetException reflection error @throws IllegalAccessException reflection error
[ "Return", "a", "list", "of", "all", "Java", "processes" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/jvm/src/main/java/org/jolokia/jvmagent/client/util/VirtualMachineHandler.java#L116-L129
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Waiter.java
Waiter.waitForView
public <T extends View> boolean waitForView(final Class<T> viewClass, final int index, boolean sleep, boolean scroll){ Set<T> uniqueViews = new HashSet<T>(); boolean foundMatchingView; while(true){ if(sleep) sleeper.sleep(); foundMatchingView = searcher.searchFor(uniqueViews, viewClass, index); if(foundMatchingView) return true; if(scroll && !scroller.scrollDown()) return false; if(!scroll) return false; } }
java
public <T extends View> boolean waitForView(final Class<T> viewClass, final int index, boolean sleep, boolean scroll){ Set<T> uniqueViews = new HashSet<T>(); boolean foundMatchingView; while(true){ if(sleep) sleeper.sleep(); foundMatchingView = searcher.searchFor(uniqueViews, viewClass, index); if(foundMatchingView) return true; if(scroll && !scroller.scrollDown()) return false; if(!scroll) return false; } }
[ "public", "<", "T", "extends", "View", ">", "boolean", "waitForView", "(", "final", "Class", "<", "T", ">", "viewClass", ",", "final", "int", "index", ",", "boolean", "sleep", ",", "boolean", "scroll", ")", "{", "Set", "<", "T", ">", "uniqueViews", "="...
Waits for a view to be shown. @param viewClass the {@code View} class to wait for @param index the index of the view that is expected to be shown @param sleep true if should sleep @param scroll {@code true} if scrolling should be performed @return {@code true} if view is shown and {@code false} if it is not shown before the timeout
[ "Waits", "for", "a", "view", "to", "be", "shown", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Waiter.java#L212-L232
apache/incubator-druid
sql/src/main/java/org/apache/druid/sql/calcite/expression/Expressions.java
Expressions.buildTimeFloorFilter
private static DimFilter buildTimeFloorFilter( final String column, final Granularity granularity, final SqlKind operatorKind, final long rhsMillis ) { final BoundRefKey boundRefKey = new BoundRefKey(column, null, StringComparators.NUMERIC); final Interval rhsInterval = granularity.bucket(DateTimes.utc(rhsMillis)); // Is rhs aligned on granularity boundaries? final boolean rhsAligned = rhsInterval.getStartMillis() == rhsMillis; return getBoundTimeDimFilter(operatorKind, boundRefKey, rhsInterval, rhsAligned); }
java
private static DimFilter buildTimeFloorFilter( final String column, final Granularity granularity, final SqlKind operatorKind, final long rhsMillis ) { final BoundRefKey boundRefKey = new BoundRefKey(column, null, StringComparators.NUMERIC); final Interval rhsInterval = granularity.bucket(DateTimes.utc(rhsMillis)); // Is rhs aligned on granularity boundaries? final boolean rhsAligned = rhsInterval.getStartMillis() == rhsMillis; return getBoundTimeDimFilter(operatorKind, boundRefKey, rhsInterval, rhsAligned); }
[ "private", "static", "DimFilter", "buildTimeFloorFilter", "(", "final", "String", "column", ",", "final", "Granularity", "granularity", ",", "final", "SqlKind", "operatorKind", ",", "final", "long", "rhsMillis", ")", "{", "final", "BoundRefKey", "boundRefKey", "=", ...
Build a filter for an expression like FLOOR(column TO granularity) [operator] rhsMillis
[ "Build", "a", "filter", "for", "an", "expression", "like", "FLOOR", "(", "column", "TO", "granularity", ")", "[", "operator", "]", "rhsMillis" ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/expression/Expressions.java#L610-L624
aws/aws-sdk-java
aws-java-sdk-marketplaceentitlement/src/main/java/com/amazonaws/services/marketplaceentitlement/model/GetEntitlementsRequest.java
GetEntitlementsRequest.withFilter
public GetEntitlementsRequest withFilter(java.util.Map<String, java.util.List<String>> filter) { setFilter(filter); return this; }
java
public GetEntitlementsRequest withFilter(java.util.Map<String, java.util.List<String>> filter) { setFilter(filter); return this; }
[ "public", "GetEntitlementsRequest", "withFilter", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "java", ".", "util", ".", "List", "<", "String", ">", ">", "filter", ")", "{", "setFilter", "(", "filter", ")", ";", "return", "this", ";", "}" ...
<p> Filter is used to return entitlements for a specific customer or for a specific dimension. Filters are described as keys mapped to a lists of values. Filtered requests are <i>unioned</i> for each value in the value list, and then <i>intersected</i> for each filter key. </p> @param filter Filter is used to return entitlements for a specific customer or for a specific dimension. Filters are described as keys mapped to a lists of values. Filtered requests are <i>unioned</i> for each value in the value list, and then <i>intersected</i> for each filter key. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Filter", "is", "used", "to", "return", "entitlements", "for", "a", "specific", "customer", "or", "for", "a", "specific", "dimension", ".", "Filters", "are", "described", "as", "keys", "mapped", "to", "a", "lists", "of", "values", ".", "Filtered...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-marketplaceentitlement/src/main/java/com/amazonaws/services/marketplaceentitlement/model/GetEntitlementsRequest.java#L153-L156
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/javax/el/CompositeELResolver.java
CompositeELResolver.getValue
@Override public Object getValue(ELContext context, Object base, Object property) { context.setPropertyResolved(false); for (ELResolver resolver : resolvers) { Object value = resolver.getValue(context, base, property); if (context.isPropertyResolved()) { return value; } } return null; }
java
@Override public Object getValue(ELContext context, Object base, Object property) { context.setPropertyResolved(false); for (ELResolver resolver : resolvers) { Object value = resolver.getValue(context, base, property); if (context.isPropertyResolved()) { return value; } } return null; }
[ "@", "Override", "public", "Object", "getValue", "(", "ELContext", "context", ",", "Object", "base", ",", "Object", "property", ")", "{", "context", ".", "setPropertyResolved", "(", "false", ")", ";", "for", "(", "ELResolver", "resolver", ":", "resolvers", "...
Attempts to resolve the given property object on the given base object by querying all component resolvers. If this resolver handles the given (base, property) pair, the propertyResolved property of the ELContext object must be set to true by the resolver, before returning. If this property is not true after this method is called, the caller should ignore the return value. First, propertyResolved is set to false on the provided ELContext. Next, for each component resolver in this composite: <ol> <li>The getValue() method is called, passing in the provided context, base and property.</li> <li>If the ELContext's propertyResolved flag is false then iteration continues.</li> <li>Otherwise, iteration stops and no more component resolvers are considered. The value returned by getValue() is returned by this method.</li> </ol> If none of the component resolvers were able to perform this operation, the value null is returned and the propertyResolved flag remains set to false. Any exception thrown by component resolvers during the iteration is propagated to the caller of this method. @param context The context of this evaluation. @param base The base object to return the most general property type for, or null to enumerate the set of top-level variables that this resolver can evaluate. @param property The property or variable to return the acceptable type for. @return If the propertyResolved property of ELContext was set to true, then the result of the variable or property resolution; otherwise undefined. @throws NullPointerException if context is null @throws PropertyNotFoundException if base is not null and the specified property does not exist or is not readable. @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown exception must be included as the cause property of this exception, if available.
[ "Attempts", "to", "resolve", "the", "given", "property", "object", "on", "the", "given", "base", "object", "by", "querying", "all", "component", "resolvers", ".", "If", "this", "resolver", "handles", "the", "given", "(", "base", "property", ")", "pair", "the...
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/javax/el/CompositeELResolver.java#L227-L237
igniterealtime/Smack
smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLight.java
MultiUserChatLight.changeRoomName
public void changeRoomName(String roomName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { MUCLightSetConfigsIQ mucLightSetConfigIQ = new MUCLightSetConfigsIQ(room, roomName, null); connection.createStanzaCollectorAndSend(mucLightSetConfigIQ).nextResultOrThrow(); }
java
public void changeRoomName(String roomName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { MUCLightSetConfigsIQ mucLightSetConfigIQ = new MUCLightSetConfigsIQ(room, roomName, null); connection.createStanzaCollectorAndSend(mucLightSetConfigIQ).nextResultOrThrow(); }
[ "public", "void", "changeRoomName", "(", "String", "roomName", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "MUCLightSetConfigsIQ", "mucLightSetConfigIQ", "=", "new", "MUCLightSetConfigsIQ", ...
Change the name of the room. @param roomName @throws NoResponseException @throws XMPPErrorException @throws NotConnectedException @throws InterruptedException
[ "Change", "the", "name", "of", "the", "room", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLight.java#L469-L473
beanshell/beanshell
src/main/java/bsh/BshClassManager.java
BshClassManager.createClassManager
public static BshClassManager createClassManager( Interpreter interpreter ) { BshClassManager manager; // Do we have the optional package? if ( Capabilities.classExists("bsh.classpath.ClassManagerImpl") ) try { // Try to load the module // don't refer to it directly here or we're dependent upon it Class<?> clazz = Capabilities.getExisting("bsh.classpath.ClassManagerImpl"); manager = (BshClassManager) clazz.getConstructor().newInstance(); } catch ( IllegalArgumentException | ReflectiveOperationException | SecurityException e) { throw new InterpreterError("Error loading classmanager", e); } else manager = new BshClassManager(); manager.declaringInterpreter = interpreter; return manager; }
java
public static BshClassManager createClassManager( Interpreter interpreter ) { BshClassManager manager; // Do we have the optional package? if ( Capabilities.classExists("bsh.classpath.ClassManagerImpl") ) try { // Try to load the module // don't refer to it directly here or we're dependent upon it Class<?> clazz = Capabilities.getExisting("bsh.classpath.ClassManagerImpl"); manager = (BshClassManager) clazz.getConstructor().newInstance(); } catch ( IllegalArgumentException | ReflectiveOperationException | SecurityException e) { throw new InterpreterError("Error loading classmanager", e); } else manager = new BshClassManager(); manager.declaringInterpreter = interpreter; return manager; }
[ "public", "static", "BshClassManager", "createClassManager", "(", "Interpreter", "interpreter", ")", "{", "BshClassManager", "manager", ";", "// Do we have the optional package?", "if", "(", "Capabilities", ".", "classExists", "(", "\"bsh.classpath.ClassManagerImpl\"", ")", ...
Create a new instance of the class manager. Class manager instnaces are now associated with the interpreter. @see bsh.Interpreter.getClassManager() @see bsh.Interpreter.setClassLoader( ClassLoader )
[ "Create", "a", "new", "instance", "of", "the", "class", "manager", ".", "Class", "manager", "instnaces", "are", "now", "associated", "with", "the", "interpreter", "." ]
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/BshClassManager.java#L361-L380
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/modify/ModifyFileExtensions.java
ModifyFileExtensions.modifyFile
public static void modifyFile(Path inFilePath, Path outFilePath, FileChangable modifier) throws IOException { try ( BufferedReader bufferedReader = new BufferedReader(new FileReader(inFilePath.toFile())); Writer writer = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(outFilePath.toFile()), "utf-8"))) { String readLine; int counter = 0; while ((readLine = bufferedReader.readLine()) != null) { writer.write(modifier.apply(counter, readLine)); counter++; } } }
java
public static void modifyFile(Path inFilePath, Path outFilePath, FileChangable modifier) throws IOException { try ( BufferedReader bufferedReader = new BufferedReader(new FileReader(inFilePath.toFile())); Writer writer = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(outFilePath.toFile()), "utf-8"))) { String readLine; int counter = 0; while ((readLine = bufferedReader.readLine()) != null) { writer.write(modifier.apply(counter, readLine)); counter++; } } }
[ "public", "static", "void", "modifyFile", "(", "Path", "inFilePath", ",", "Path", "outFilePath", ",", "FileChangable", "modifier", ")", "throws", "IOException", "{", "try", "(", "BufferedReader", "bufferedReader", "=", "new", "BufferedReader", "(", "new", "FileRea...
Modifies the input file line by line and writes the modification in the new output file @param inFilePath the in file path @param outFilePath the out file path @param modifier the modifier {@linkplain BiFunction} @throws IOException Signals that an I/O exception has occurred.
[ "Modifies", "the", "input", "file", "line", "by", "line", "and", "writes", "the", "modification", "in", "the", "new", "output", "file" ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/modify/ModifyFileExtensions.java#L59-L75
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfAction.java
PdfAction.createResetForm
public static PdfAction createResetForm(Object names[], int flags) { PdfAction action = new PdfAction(); action.put(PdfName.S, PdfName.RESETFORM); if (names != null) action.put(PdfName.FIELDS, buildArray(names)); action.put(PdfName.FLAGS, new PdfNumber(flags)); return action; }
java
public static PdfAction createResetForm(Object names[], int flags) { PdfAction action = new PdfAction(); action.put(PdfName.S, PdfName.RESETFORM); if (names != null) action.put(PdfName.FIELDS, buildArray(names)); action.put(PdfName.FLAGS, new PdfNumber(flags)); return action; }
[ "public", "static", "PdfAction", "createResetForm", "(", "Object", "names", "[", "]", ",", "int", "flags", ")", "{", "PdfAction", "action", "=", "new", "PdfAction", "(", ")", ";", "action", ".", "put", "(", "PdfName", ".", "S", ",", "PdfName", ".", "RE...
Creates a resetform. @param names the objects to reset @param flags submit properties @return A PdfAction
[ "Creates", "a", "resetform", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfAction.java#L411-L418
EdwardRaff/JSAT
JSAT/src/jsat/io/CSV.java
CSV.readR
public static RegressionDataSet readR(int numeric_target_column, Path path, char delimiter, int lines_to_skip, char comment, Set<Integer> cat_cols) throws IOException { BufferedReader br = Files.newBufferedReader(path, Charset.defaultCharset()); RegressionDataSet ret = readR(numeric_target_column, br, delimiter, lines_to_skip, comment, cat_cols); br.close(); return ret; }
java
public static RegressionDataSet readR(int numeric_target_column, Path path, char delimiter, int lines_to_skip, char comment, Set<Integer> cat_cols) throws IOException { BufferedReader br = Files.newBufferedReader(path, Charset.defaultCharset()); RegressionDataSet ret = readR(numeric_target_column, br, delimiter, lines_to_skip, comment, cat_cols); br.close(); return ret; }
[ "public", "static", "RegressionDataSet", "readR", "(", "int", "numeric_target_column", ",", "Path", "path", ",", "char", "delimiter", ",", "int", "lines_to_skip", ",", "char", "comment", ",", "Set", "<", "Integer", ">", "cat_cols", ")", "throws", "IOException", ...
Reads in a CSV dataset as a regression dataset. @param numeric_target_column the column index (starting from zero) of the feature that will be the target regression value @param path the CSV file to read @param delimiter the delimiter to separate columns, usually a comma @param lines_to_skip the number of lines to skip when reading in the CSV (used to skip header information) @param comment the character used to indicate the start of a comment. Once this character is reached, anything at and after the character will be ignored. @param cat_cols a set of the indices to treat as categorical features. @return the regression dataset from the given CSV file @throws IOException
[ "Reads", "in", "a", "CSV", "dataset", "as", "a", "regression", "dataset", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/io/CSV.java#L112-L118
Alluxio/alluxio
minicluster/src/main/java/alluxio/multi/process/MultiProcessCluster.java
MultiProcessCluster.updateDeployMode
public synchronized void updateDeployMode(DeployMode mode) { mDeployMode = mode; if (mDeployMode == DeployMode.EMBEDDED) { // Ensure that the journal properties are set correctly. for (int i = 0; i < mMasters.size(); i++) { Master master = mMasters.get(i); MasterNetAddress address = mMasterAddresses.get(i); master.updateConf(PropertyKey.MASTER_EMBEDDED_JOURNAL_PORT, Integer.toString(address.getEmbeddedJournalPort())); File journalDir = new File(mWorkDir, "journal" + i); journalDir.mkdirs(); master.updateConf(PropertyKey.MASTER_JOURNAL_FOLDER, journalDir.getAbsolutePath()); } } }
java
public synchronized void updateDeployMode(DeployMode mode) { mDeployMode = mode; if (mDeployMode == DeployMode.EMBEDDED) { // Ensure that the journal properties are set correctly. for (int i = 0; i < mMasters.size(); i++) { Master master = mMasters.get(i); MasterNetAddress address = mMasterAddresses.get(i); master.updateConf(PropertyKey.MASTER_EMBEDDED_JOURNAL_PORT, Integer.toString(address.getEmbeddedJournalPort())); File journalDir = new File(mWorkDir, "journal" + i); journalDir.mkdirs(); master.updateConf(PropertyKey.MASTER_JOURNAL_FOLDER, journalDir.getAbsolutePath()); } } }
[ "public", "synchronized", "void", "updateDeployMode", "(", "DeployMode", "mode", ")", "{", "mDeployMode", "=", "mode", ";", "if", "(", "mDeployMode", "==", "DeployMode", ".", "EMBEDDED", ")", "{", "// Ensure that the journal properties are set correctly.", "for", "(",...
Updates the cluster's deploy mode. @param mode the mode to set
[ "Updates", "the", "cluster", "s", "deploy", "mode", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/minicluster/src/main/java/alluxio/multi/process/MultiProcessCluster.java#L487-L502
JOML-CI/JOML
src/org/joml/Matrix3x2d.java
Matrix3x2d.translateLocal
public Matrix3x2d translateLocal(Vector2dc offset, Matrix3x2d dest) { return translateLocal(offset.x(), offset.y(), dest); }
java
public Matrix3x2d translateLocal(Vector2dc offset, Matrix3x2d dest) { return translateLocal(offset.x(), offset.y(), dest); }
[ "public", "Matrix3x2d", "translateLocal", "(", "Vector2dc", "offset", ",", "Matrix3x2d", "dest", ")", "{", "return", "translateLocal", "(", "offset", ".", "x", "(", ")", ",", "offset", ".", "y", "(", ")", ",", "dest", ")", ";", "}" ]
Pre-multiply a translation to this matrix by translating by the given number of units in x and y and store the result in <code>dest</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>T</code> the translation matrix, then the new matrix will be <code>T * M</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>T * M * v</code>, the translation will be applied last! <p> In order to set the matrix to a translation transformation without pre-multiplying it, use {@link #translation(Vector2dc)}. @see #translation(Vector2dc) @param offset the number of units in x and y by which to translate @param dest will hold the result @return dest
[ "Pre", "-", "multiply", "a", "translation", "to", "this", "matrix", "by", "translating", "by", "the", "given", "number", "of", "units", "in", "x", "and", "y", "and", "store", "the", "result", "in", "<code", ">", "dest<", "/", "code", ">", ".", "<p", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3x2d.java#L660-L662
OrienteerBAP/wicket-orientdb
wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/OSchemaUtils.java
OSchemaUtils.probeOClass
public static OClass probeOClass(Iterable<ODocument> it, int probeLimit) { return probeOClass(it.iterator(), probeLimit); }
java
public static OClass probeOClass(Iterable<ODocument> it, int probeLimit) { return probeOClass(it.iterator(), probeLimit); }
[ "public", "static", "OClass", "probeOClass", "(", "Iterable", "<", "ODocument", ">", "it", ",", "int", "probeLimit", ")", "{", "return", "probeOClass", "(", "it", ".", "iterator", "(", ")", ",", "probeLimit", ")", ";", "}" ]
Check first several items to resolve common {@link OClass} @param it {@link Iterable} over {@link ODocument}s @param probeLimit limit over iterable @return common {@link OClass} or null
[ "Check", "first", "several", "items", "to", "resolve", "common", "{" ]
train
https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/OSchemaUtils.java#L29-L31
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/dataformats/json/jackson/AbstractJsonDeserializer.java
AbstractJsonDeserializer.getBooleanParam
protected Boolean getBooleanParam(String paramName, String errorMessage, Map<String, Object> mapToUse) throws IOException { Boolean result = getTypedParam(paramName, errorMessage, Boolean.class, mapToUse); if (result == null) { String s = getTypedParam(paramName, errorMessage, String.class, mapToUse); if (s != null) { return Boolean.parseBoolean(s); } } return result; }
java
protected Boolean getBooleanParam(String paramName, String errorMessage, Map<String, Object> mapToUse) throws IOException { Boolean result = getTypedParam(paramName, errorMessage, Boolean.class, mapToUse); if (result == null) { String s = getTypedParam(paramName, errorMessage, String.class, mapToUse); if (s != null) { return Boolean.parseBoolean(s); } } return result; }
[ "protected", "Boolean", "getBooleanParam", "(", "String", "paramName", ",", "String", "errorMessage", ",", "Map", "<", "String", ",", "Object", ">", "mapToUse", ")", "throws", "IOException", "{", "Boolean", "result", "=", "getTypedParam", "(", "paramName", ",", ...
Convenience method for subclasses. @param paramName the name of the parameter @param errorMessage the errormessage to add to the exception if the param does not exist. @param mapToUse The map to use as inputsource for parameters. Should not be null. @return a stringparameter with given name. If it does not exist and the errormessage is provided, an IOException is thrown with that message. if the errormessage is not provided, null is returned. @throws IOException Exception if the paramname does not exist and an errormessage is provided.
[ "Convenience", "method", "for", "subclasses", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/AbstractJsonDeserializer.java#L238-L247
Netflix/conductor
core/src/main/java/com/netflix/conductor/service/WorkflowServiceImpl.java
WorkflowServiceImpl.getExecutionStatus
@Service public Workflow getExecutionStatus(String workflowId, boolean includeTasks) { Workflow workflow = executionService.getExecutionStatus(workflowId, includeTasks); if (workflow == null) { throw new ApplicationException(ApplicationException.Code.NOT_FOUND, String.format("Workflow with Id: %s not found.", workflowId)); } return workflow; }
java
@Service public Workflow getExecutionStatus(String workflowId, boolean includeTasks) { Workflow workflow = executionService.getExecutionStatus(workflowId, includeTasks); if (workflow == null) { throw new ApplicationException(ApplicationException.Code.NOT_FOUND, String.format("Workflow with Id: %s not found.", workflowId)); } return workflow; }
[ "@", "Service", "public", "Workflow", "getExecutionStatus", "(", "String", "workflowId", ",", "boolean", "includeTasks", ")", "{", "Workflow", "workflow", "=", "executionService", ".", "getExecutionStatus", "(", "workflowId", ",", "includeTasks", ")", ";", "if", "...
Gets the workflow by workflow Id. @param workflowId Id of the workflow. @param includeTasks Includes tasks associated with workflow. @return an instance of {@link Workflow}
[ "Gets", "the", "workflow", "by", "workflow", "Id", "." ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/core/src/main/java/com/netflix/conductor/service/WorkflowServiceImpl.java#L189-L197
mkotsur/restito
src/main/java/com/xebialabs/restito/semantics/Action.java
Action.stringContent
public static Action stringContent(final String content, final Charset charset) { return composite(charset(charset), bytesContent(content.getBytes(charset))); }
java
public static Action stringContent(final String content, final Charset charset) { return composite(charset(charset), bytesContent(content.getBytes(charset))); }
[ "public", "static", "Action", "stringContent", "(", "final", "String", "content", ",", "final", "Charset", "charset", ")", "{", "return", "composite", "(", "charset", "(", "charset", ")", ",", "bytesContent", "(", "content", ".", "getBytes", "(", "charset", ...
Writes string content into response. The passed charset is used: - To encoded the string into bytes; - As character set of the response. The latter will result in a <pre>charset=XXX</pre> part of <pre>Content-Type</pre> header if and only if the header has been set in some way (e.g. by using {@link #contentType(String)} action. See `integration.CharsetAndEncodingTest` for more details.
[ "Writes", "string", "content", "into", "response", ".", "The", "passed", "charset", "is", "used", ":", "-", "To", "encoded", "the", "string", "into", "bytes", ";", "-", "As", "character", "set", "of", "the", "response", ".", "The", "latter", "will", "res...
train
https://github.com/mkotsur/restito/blob/b999293616ca84fdea1ffe929e92a5db29c7e415/src/main/java/com/xebialabs/restito/semantics/Action.java#L171-L173
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java
StringIterate.reverseForEachCodePoint
public static void reverseForEachCodePoint(String string, CodePointProcedure procedure) { for (int i = StringIterate.lastIndex(string); i >= 0; ) { int codePoint = string.codePointAt(i); procedure.value(codePoint); if (i == 0) { i--; } else { i -= StringIterate.numberOfChars(string, i); } } }
java
public static void reverseForEachCodePoint(String string, CodePointProcedure procedure) { for (int i = StringIterate.lastIndex(string); i >= 0; ) { int codePoint = string.codePointAt(i); procedure.value(codePoint); if (i == 0) { i--; } else { i -= StringIterate.numberOfChars(string, i); } } }
[ "public", "static", "void", "reverseForEachCodePoint", "(", "String", "string", ",", "CodePointProcedure", "procedure", ")", "{", "for", "(", "int", "i", "=", "StringIterate", ".", "lastIndex", "(", "string", ")", ";", "i", ">=", "0", ";", ")", "{", "int",...
For each int code point in the {@code string} in reverse order, execute the {@link CodePointProcedure}. @since 7.0
[ "For", "each", "int", "code", "point", "in", "the", "{", "@code", "string", "}", "in", "reverse", "order", "execute", "the", "{", "@link", "CodePointProcedure", "}", "." ]
train
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java#L436-L451
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java
ExpressRouteCrossConnectionsInner.beginListRoutesTableSummaryAsync
public Observable<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner> beginListRoutesTableSummaryAsync(String resourceGroupName, String crossConnectionName, String peeringName, String devicePath) { return beginListRoutesTableSummaryWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, devicePath).map(new Func1<ServiceResponse<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner>, ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner>() { @Override public ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner call(ServiceResponse<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner> response) { return response.body(); } }); }
java
public Observable<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner> beginListRoutesTableSummaryAsync(String resourceGroupName, String crossConnectionName, String peeringName, String devicePath) { return beginListRoutesTableSummaryWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, devicePath).map(new Func1<ServiceResponse<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner>, ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner>() { @Override public ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner call(ServiceResponse<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner", ">", "beginListRoutesTableSummaryAsync", "(", "String", "resourceGroupName", ",", "String", "crossConnectionName", ",", "String", "peeringName", ",", "String", "devicePath", ")", "{", ...
Gets the route table summary associated with the express route cross connection in a resource group. @param resourceGroupName The name of the resource group. @param crossConnectionName The name of the ExpressRouteCrossConnection. @param peeringName The name of the peering. @param devicePath The path of the device. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner object
[ "Gets", "the", "route", "table", "summary", "associated", "with", "the", "express", "route", "cross", "connection", "in", "a", "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/ExpressRouteCrossConnectionsInner.java#L1216-L1223
apache/reef
lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/yarnrest/HDInsightInstance.java
HDInsightInstance.killApplication
public void killApplication(final String applicationId) throws IOException { final String url = this.getApplicationURL(applicationId) + "/state"; final HttpPut put = preparePut(url); put.setEntity(new StringEntity(APPLICATION_KILL_MESSAGE, ContentType.APPLICATION_JSON)); this.httpClient.execute(put, this.httpClientContext); }
java
public void killApplication(final String applicationId) throws IOException { final String url = this.getApplicationURL(applicationId) + "/state"; final HttpPut put = preparePut(url); put.setEntity(new StringEntity(APPLICATION_KILL_MESSAGE, ContentType.APPLICATION_JSON)); this.httpClient.execute(put, this.httpClientContext); }
[ "public", "void", "killApplication", "(", "final", "String", "applicationId", ")", "throws", "IOException", "{", "final", "String", "url", "=", "this", ".", "getApplicationURL", "(", "applicationId", ")", "+", "\"/state\"", ";", "final", "HttpPut", "put", "=", ...
Issues a YARN kill command to the application. @param applicationId
[ "Issues", "a", "YARN", "kill", "command", "to", "the", "application", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/yarnrest/HDInsightInstance.java#L131-L136
modelmapper/modelmapper
core/src/main/java/org/modelmapper/ModelMapper.java
ModelMapper.addConverter
@SuppressWarnings("unchecked") public <S, D> void addConverter(Converter<S, D> converter) { Assert.notNull(converter, "converter"); Class<?>[] typeArguments = TypeResolver.resolveRawArguments(Converter.class, converter.getClass()); Assert.notNull(typeArguments, "Must declare source type argument <S> and destination type argument <D> for converter"); config.typeMapStore.<S, D>getOrCreate(null, (Class<S>) typeArguments[0], (Class<D>) typeArguments[1], null, null, converter, engine); }
java
@SuppressWarnings("unchecked") public <S, D> void addConverter(Converter<S, D> converter) { Assert.notNull(converter, "converter"); Class<?>[] typeArguments = TypeResolver.resolveRawArguments(Converter.class, converter.getClass()); Assert.notNull(typeArguments, "Must declare source type argument <S> and destination type argument <D> for converter"); config.typeMapStore.<S, D>getOrCreate(null, (Class<S>) typeArguments[0], (Class<D>) typeArguments[1], null, null, converter, engine); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "S", ",", "D", ">", "void", "addConverter", "(", "Converter", "<", "S", ",", "D", ">", "converter", ")", "{", "Assert", ".", "notNull", "(", "converter", ",", "\"converter\"", ")", ";", ...
Registers the {@code converter} to use when mapping instances of types {@code S} to {@code D}. The {@code converter} will be {@link TypeMap#setConverter(Converter) set} against TypeMap corresponding to the {@code converter}'s type arguments {@code S} and {@code D}. @param <S> source type @param <D> destination type @param converter to register @throws IllegalArgumentException if {@code converter} is null or if type arguments {@code S} and {@code D} are not declared for the {@code converter} @see TypeMap#setConverter(Converter)
[ "Registers", "the", "{", "@code", "converter", "}", "to", "use", "when", "mapping", "instances", "of", "types", "{", "@code", "S", "}", "to", "{", "@code", "D", "}", ".", "The", "{", "@code", "converter", "}", "will", "be", "{", "@link", "TypeMap#setCo...
train
https://github.com/modelmapper/modelmapper/blob/491d165ded9dc9aba7ce8b56984249e1a1363204/core/src/main/java/org/modelmapper/ModelMapper.java#L70-L77
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/VmlStyleUtil.java
VmlStyleUtil.applyShapeStyle
private static void applyShapeStyle(Element element, ShapeStyle style) { // First check the presence of the fill and stroke elements: NodeList<Element> fills = element.getElementsByTagName("fill"); if (fills.getLength() == 0) { Element stroke = Dom.createElementNS(Dom.NS_VML, "stroke"); element.appendChild(stroke); Element fill = Dom.createElementNS(Dom.NS_VML, "fill"); element.appendChild(fill); fills = element.getElementsByTagName("fill"); } // Then if fill-color then filled=true: if (style.getFillColor() != null) { element.setAttribute("filled", "true"); fills.getItem(0).setAttribute("color", style.getFillColor()); fills.getItem(0).setAttribute("opacity", Float.toString(style.getFillOpacity())); } else { element.setAttribute("filled", "false"); } // Then if stroke-color then stroke=true: if (style.getStrokeColor() != null) { element.setAttribute("stroked", "true"); NodeList<Element> strokes = element.getElementsByTagName("stroke"); strokes.getItem(0).setAttribute("color", style.getStrokeColor()); strokes.getItem(0).setAttribute("opacity", Float.toString(style.getStrokeOpacity())); element.setAttribute("strokeweight", Float.toString(style.getStrokeWidth())); } else { element.setAttribute("stroked", "false"); } }
java
private static void applyShapeStyle(Element element, ShapeStyle style) { // First check the presence of the fill and stroke elements: NodeList<Element> fills = element.getElementsByTagName("fill"); if (fills.getLength() == 0) { Element stroke = Dom.createElementNS(Dom.NS_VML, "stroke"); element.appendChild(stroke); Element fill = Dom.createElementNS(Dom.NS_VML, "fill"); element.appendChild(fill); fills = element.getElementsByTagName("fill"); } // Then if fill-color then filled=true: if (style.getFillColor() != null) { element.setAttribute("filled", "true"); fills.getItem(0).setAttribute("color", style.getFillColor()); fills.getItem(0).setAttribute("opacity", Float.toString(style.getFillOpacity())); } else { element.setAttribute("filled", "false"); } // Then if stroke-color then stroke=true: if (style.getStrokeColor() != null) { element.setAttribute("stroked", "true"); NodeList<Element> strokes = element.getElementsByTagName("stroke"); strokes.getItem(0).setAttribute("color", style.getStrokeColor()); strokes.getItem(0).setAttribute("opacity", Float.toString(style.getStrokeOpacity())); element.setAttribute("strokeweight", Float.toString(style.getStrokeWidth())); } else { element.setAttribute("stroked", "false"); } }
[ "private", "static", "void", "applyShapeStyle", "(", "Element", "element", ",", "ShapeStyle", "style", ")", "{", "// First check the presence of the fill and stroke elements:", "NodeList", "<", "Element", ">", "fills", "=", "element", ".", "getElementsByTagName", "(", "...
When applying ShapeStyles, we create child elements for fill and stroke. According to Microsoft, this is the proper way to go.
[ "When", "applying", "ShapeStyles", "we", "create", "child", "elements", "for", "fill", "and", "stroke", ".", "According", "to", "Microsoft", "this", "is", "the", "proper", "way", "to", "go", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/VmlStyleUtil.java#L106-L136
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/ContentSpecBuilder.java
ContentSpecBuilder.buildTranslatedBook
public byte[] buildTranslatedBook(final ContentSpec contentSpec, final String requester, final DocBookBuildingOptions builderOptions, final ZanataDetails zanataDetails, final BuildType buildType) throws BuilderCreationException, BuildProcessingException { return buildTranslatedBook(contentSpec, requester, builderOptions, new HashMap<String, byte[]>(), zanataDetails, buildType); }
java
public byte[] buildTranslatedBook(final ContentSpec contentSpec, final String requester, final DocBookBuildingOptions builderOptions, final ZanataDetails zanataDetails, final BuildType buildType) throws BuilderCreationException, BuildProcessingException { return buildTranslatedBook(contentSpec, requester, builderOptions, new HashMap<String, byte[]>(), zanataDetails, buildType); }
[ "public", "byte", "[", "]", "buildTranslatedBook", "(", "final", "ContentSpec", "contentSpec", ",", "final", "String", "requester", ",", "final", "DocBookBuildingOptions", "builderOptions", ",", "final", "ZanataDetails", "zanataDetails", ",", "final", "BuildType", "bu...
Builds a book into a zip file for the passed Content Specification. @param contentSpec The content specification that is to be built. It should have already been validated, if not errors may occur. @param requester The user who requested the book to be built. @param builderOptions The set of options what are to be when building the book. @param zanataDetails The Zanata details to be used when editor links are turned on. @param buildType @return A byte array that is the zip file @throws BuildProcessingException Any unexpected errors that occur during building. @throws BuilderCreationException Any error that occurs while trying to setup/create the builder
[ "Builds", "a", "book", "into", "a", "zip", "file", "for", "the", "passed", "Content", "Specification", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/ContentSpecBuilder.java#L140-L143
aol/cyclops
cyclops/src/main/java/com/oath/cyclops/internal/stream/FutureStreamUtils.java
FutureStreamUtils.forEachXEvents
public static <T, X extends Throwable> Tuple3<CompletableFuture<Subscription>, Runnable, CompletableFuture<Boolean>> forEachXEvents( final Stream<T> stream, final long x, final Consumer<? super T> consumerElement, final Consumer<? super Throwable> consumerError, final Runnable onComplete) { final CompletableFuture<Boolean> streamCompleted = new CompletableFuture<>(); final Subscription s = new Subscription() { Iterator<T> it = stream.iterator(); volatile boolean running = true; @Override public void request(final long n) { for (int i = 0; i < n && running; i++) { try { if (it.hasNext()) { consumerElement.accept(it.next()); } else { try { onComplete.run(); } finally { streamCompleted.complete(true); break; } } } catch (final Throwable t) { consumerError.accept(t); } } } @Override public void cancel() { running = false; } }; final CompletableFuture<Subscription> subscription = CompletableFuture.completedFuture(s); return tuple(subscription, () -> { s.request(x); } , streamCompleted); }
java
public static <T, X extends Throwable> Tuple3<CompletableFuture<Subscription>, Runnable, CompletableFuture<Boolean>> forEachXEvents( final Stream<T> stream, final long x, final Consumer<? super T> consumerElement, final Consumer<? super Throwable> consumerError, final Runnable onComplete) { final CompletableFuture<Boolean> streamCompleted = new CompletableFuture<>(); final Subscription s = new Subscription() { Iterator<T> it = stream.iterator(); volatile boolean running = true; @Override public void request(final long n) { for (int i = 0; i < n && running; i++) { try { if (it.hasNext()) { consumerElement.accept(it.next()); } else { try { onComplete.run(); } finally { streamCompleted.complete(true); break; } } } catch (final Throwable t) { consumerError.accept(t); } } } @Override public void cancel() { running = false; } }; final CompletableFuture<Subscription> subscription = CompletableFuture.completedFuture(s); return tuple(subscription, () -> { s.request(x); } , streamCompleted); }
[ "public", "static", "<", "T", ",", "X", "extends", "Throwable", ">", "Tuple3", "<", "CompletableFuture", "<", "Subscription", ">", ",", "Runnable", ",", "CompletableFuture", "<", "Boolean", ">", ">", "forEachXEvents", "(", "final", "Stream", "<", "T", ">", ...
Perform a forEach operation over the Stream without closing it, capturing any elements and errors in the supplied consumers, but only consuming the specified number of elements from the Stream, at this time. More elements can be consumed later, by called request on the returned Subscription, when the entire Stream has been processed an onComplete event will be recieved. <pre> {@code Subscription next = Streams.forEach(Stream.of(()->1,()->2,()->throw new RuntimeException(),()->4) .map(Supplier::getValue) ,System.out::println, e->e.printStackTrace(),()->System.out.println("the take!")); System.out.println("First batch processed!"); next.request(2); System.out.println("Second batch processed!"); //prints 1 2 First batch processed! RuntimeException Stack Trace on System.err 4 Second batch processed! The take! } </pre> @param stream - the Stream to consume data from @param x To consume from the Stream at this time @param consumerElement To accept incoming elements from the Stream @param consumerError To accept incoming processing errors from the Stream @param onComplete To run after an onComplete event @return Subscription so that further processing can be continued or cancelled.
[ "Perform", "a", "forEach", "operation", "over", "the", "Stream", "without", "closing", "it", "capturing", "any", "elements", "and", "errors", "in", "the", "supplied", "consumers", "but", "only", "consuming", "the", "specified", "number", "of", "elements", "from"...
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/internal/stream/FutureStreamUtils.java#L126-L171
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java
TreeScanner.visitVariable
@Override public R visitVariable(VariableTree node, P p) { R r = scan(node.getModifiers(), p); r = scanAndReduce(node.getType(), p, r); r = scanAndReduce(node.getNameExpression(), p, r); r = scanAndReduce(node.getInitializer(), p, r); return r; }
java
@Override public R visitVariable(VariableTree node, P p) { R r = scan(node.getModifiers(), p); r = scanAndReduce(node.getType(), p, r); r = scanAndReduce(node.getNameExpression(), p, r); r = scanAndReduce(node.getInitializer(), p, r); return r; }
[ "@", "Override", "public", "R", "visitVariable", "(", "VariableTree", "node", ",", "P", "p", ")", "{", "R", "r", "=", "scan", "(", "node", ".", "getModifiers", "(", ")", ",", "p", ")", ";", "r", "=", "scanAndReduce", "(", "node", ".", "getType", "(...
{@inheritDoc} This implementation scans the children in left to right order. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of scanning
[ "{", "@inheritDoc", "}", "This", "implementation", "scans", "the", "children", "in", "left", "to", "right", "order", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java#L218-L225
openbase/jul
schedule/src/main/java/org/openbase/jul/schedule/Stopwatch.java
Stopwatch.getTime
public long getTime() throws NotAvailableException { synchronized (timeSync) { try { if (!isRunning()) { throw new InvalidStateException("Stopwatch was never started!"); } if (endTime == -1) { return System.currentTimeMillis() - startTime; } return endTime - startTime; } catch (CouldNotPerformException ex) { throw new NotAvailableException(ContextType.INSTANCE, "time", ex); } } }
java
public long getTime() throws NotAvailableException { synchronized (timeSync) { try { if (!isRunning()) { throw new InvalidStateException("Stopwatch was never started!"); } if (endTime == -1) { return System.currentTimeMillis() - startTime; } return endTime - startTime; } catch (CouldNotPerformException ex) { throw new NotAvailableException(ContextType.INSTANCE, "time", ex); } } }
[ "public", "long", "getTime", "(", ")", "throws", "NotAvailableException", "{", "synchronized", "(", "timeSync", ")", "{", "try", "{", "if", "(", "!", "isRunning", "(", ")", ")", "{", "throw", "new", "InvalidStateException", "(", "\"Stopwatch was never started!\"...
This method returns the time interval between the start- and end timestamps. In case the the Stopwatch is still running, the elapsed time since Stopwatch start will be returned. @return the time interval in milliseconds. @throws NotAvailableException This exception will thrown in case the timer was never started.
[ "This", "method", "returns", "the", "time", "interval", "between", "the", "start", "-", "and", "end", "timestamps", ".", "In", "case", "the", "the", "Stopwatch", "is", "still", "running", "the", "elapsed", "time", "since", "Stopwatch", "start", "will", "be",...
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/schedule/src/main/java/org/openbase/jul/schedule/Stopwatch.java#L92-L108
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImplInteger_CustomFieldSerializer.java
OWLLiteralImplInteger_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLLiteralImplInteger instance) throws SerializationException { serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLLiteralImplInteger instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLLiteralImplInteger", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{" ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImplInteger_CustomFieldSerializer.java#L63-L66
mockito/mockito
src/main/java/org/mockito/internal/matchers/apachecommons/EqualsBuilder.java
EqualsBuilder.reflectionEquals
public static boolean reflectionEquals(Object lhs, Object rhs, String[] excludeFields) { return reflectionEquals(lhs, rhs, false, null, excludeFields); }
java
public static boolean reflectionEquals(Object lhs, Object rhs, String[] excludeFields) { return reflectionEquals(lhs, rhs, false, null, excludeFields); }
[ "public", "static", "boolean", "reflectionEquals", "(", "Object", "lhs", ",", "Object", "rhs", ",", "String", "[", "]", "excludeFields", ")", "{", "return", "reflectionEquals", "(", "lhs", ",", "rhs", ",", "false", ",", "null", ",", "excludeFields", ")", "...
<p>This method uses reflection to determine if the two <code>Object</code>s are equal.</p> <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will throw a security exception if run under a security manager, if the permissions are not set up correctly. It is also not as efficient as testing explicitly.</p> <p>Transient members will be not be tested, as they are likely derived fields, and not part of the value of the Object.</p> <p>Static fields will not be tested. Superclass fields will be included.</p> @param lhs <code>this</code> object @param rhs the other object @param excludeFields array of field names to exclude from testing @return <code>true</code> if the two Objects have tested equals.
[ "<p", ">", "This", "method", "uses", "reflection", "to", "determine", "if", "the", "two", "<code", ">", "Object<", "/", "code", ">", "s", "are", "equal", ".", "<", "/", "p", ">" ]
train
https://github.com/mockito/mockito/blob/c5e2b80af76e3192cae7c9550b70c4d1ab312034/src/main/java/org/mockito/internal/matchers/apachecommons/EqualsBuilder.java#L138-L140
att/AAF
authz/authz-gw/src/main/java/com/att/authz/gw/GwAPI.java
GwAPI.route
public void route(HttpMethods meth, String path, API api, GwCode code) throws Exception { String version = "1.0"; // Get Correct API Class from Mapper Class<?> respCls = facade.mapper().getClass(api); if(respCls==null) throw new Exception("Unknown class associated with " + api.getClass().getName() + ' ' + api.name()); // setup Application API HTML ContentTypes for JSON and Route String application = applicationJSON(respCls, version); //route(env,meth,path,code,application,"application/json;version="+version,"*/*"); // setup Application API HTML ContentTypes for XML and Route application = applicationXML(respCls, version); //route(env,meth,path,code.clone(facade_1_0_XML,false),application,"text/xml;version="+version); // Add other Supported APIs here as created }
java
public void route(HttpMethods meth, String path, API api, GwCode code) throws Exception { String version = "1.0"; // Get Correct API Class from Mapper Class<?> respCls = facade.mapper().getClass(api); if(respCls==null) throw new Exception("Unknown class associated with " + api.getClass().getName() + ' ' + api.name()); // setup Application API HTML ContentTypes for JSON and Route String application = applicationJSON(respCls, version); //route(env,meth,path,code,application,"application/json;version="+version,"*/*"); // setup Application API HTML ContentTypes for XML and Route application = applicationXML(respCls, version); //route(env,meth,path,code.clone(facade_1_0_XML,false),application,"text/xml;version="+version); // Add other Supported APIs here as created }
[ "public", "void", "route", "(", "HttpMethods", "meth", ",", "String", "path", ",", "API", "api", ",", "GwCode", "code", ")", "throws", "Exception", "{", "String", "version", "=", "\"1.0\"", ";", "// Get Correct API Class from Mapper", "Class", "<", "?", ">", ...
Setup XML and JSON implementations for each supported Version type We do this by taking the Code passed in and creating clones of these with the appropriate Facades and properties to do Versions and Content switches
[ "Setup", "XML", "and", "JSON", "implementations", "for", "each", "supported", "Version", "type" ]
train
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-gw/src/main/java/com/att/authz/gw/GwAPI.java#L119-L133
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJBar3DChartBuilder.java
DJBar3DChartBuilder.addSerie
public DJBar3DChartBuilder addSerie(AbstractColumn column, StringExpression labelExpression) { getDataset().addSerie(column, labelExpression); return this; }
java
public DJBar3DChartBuilder addSerie(AbstractColumn column, StringExpression labelExpression) { getDataset().addSerie(column, labelExpression); return this; }
[ "public", "DJBar3DChartBuilder", "addSerie", "(", "AbstractColumn", "column", ",", "StringExpression", "labelExpression", ")", "{", "getDataset", "(", ")", ".", "addSerie", "(", "column", ",", "labelExpression", ")", ";", "return", "this", ";", "}" ]
Adds the specified serie column to the dataset with custom label. @param column the serie column
[ "Adds", "the", "specified", "serie", "column", "to", "the", "dataset", "with", "custom", "label", "." ]
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJBar3DChartBuilder.java#L376-L379
ManfredTremmel/gwt-bean-validators
gwtp-spring-integration/src/main/super/de/knightsoftnet/gwtp/spring/supersource/org/springframework/util/Assert.java
Assert.isInstanceOf
@GwtIncompatible("incompatible method") public static void isInstanceOf(final Class<?> type, @Nullable final Object obj) { Assert.isInstanceOf(type, obj, ""); }
java
@GwtIncompatible("incompatible method") public static void isInstanceOf(final Class<?> type, @Nullable final Object obj) { Assert.isInstanceOf(type, obj, ""); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "void", "isInstanceOf", "(", "final", "Class", "<", "?", ">", "type", ",", "@", "Nullable", "final", "Object", "obj", ")", "{", "Assert", ".", "isInstanceOf", "(", "type", ",", ...
Assert that the provided object is an instance of the provided class. <pre class="code"> Assert.instanceOf(Foo.class, foo); </pre> @param type the type to check against @param obj the object to check @throws IllegalArgumentException if the object is not an instance of type
[ "Assert", "that", "the", "provided", "object", "is", "an", "instance", "of", "the", "provided", "class", "." ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwtp-spring-integration/src/main/super/de/knightsoftnet/gwtp/spring/supersource/org/springframework/util/Assert.java#L653-L656
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/conditions/Conditions.java
Conditions.betweenExclusive
public static Between betweenExclusive( String property, int minimum, int maximum) { return new Between( moreThan( property, minimum), lessThan( property, maximum)); }
java
public static Between betweenExclusive( String property, int minimum, int maximum) { return new Between( moreThan( property, minimum), lessThan( property, maximum)); }
[ "public", "static", "Between", "betweenExclusive", "(", "String", "property", ",", "int", "minimum", ",", "int", "maximum", ")", "{", "return", "new", "Between", "(", "moreThan", "(", "property", ",", "minimum", ")", ",", "lessThan", "(", "property", ",", ...
Returns a {@link ICondition condition} that is satisfied by a {@link org.cornutum.tcases.PropertySet} that contains between a specified minimum (exclusive) and maximum (exclusive) number of instances of a property.
[ "Returns", "a", "{" ]
train
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/conditions/Conditions.java#L145-L148
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.listCustomPrebuiltModels
public List<CustomPrebuiltModel> listCustomPrebuiltModels(UUID appId, String versionId) { return listCustomPrebuiltModelsWithServiceResponseAsync(appId, versionId).toBlocking().single().body(); }
java
public List<CustomPrebuiltModel> listCustomPrebuiltModels(UUID appId, String versionId) { return listCustomPrebuiltModelsWithServiceResponseAsync(appId, versionId).toBlocking().single().body(); }
[ "public", "List", "<", "CustomPrebuiltModel", ">", "listCustomPrebuiltModels", "(", "UUID", "appId", ",", "String", "versionId", ")", "{", "return", "listCustomPrebuiltModelsWithServiceResponseAsync", "(", "appId", ",", "versionId", ")", ".", "toBlocking", "(", ")", ...
Gets all custom prebuilt models information of this application. @param appId The application ID. @param versionId The version ID. @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 List&lt;CustomPrebuiltModel&gt; object if successful.
[ "Gets", "all", "custom", "prebuilt", "models", "information", "of", "this", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L6064-L6066
kotcrab/vis-ui
ui/src/main/java/com/kotcrab/vis/ui/widget/toast/MessageToast.java
MessageToast.addLinkLabel
public void addLinkLabel (String text, LinkLabel.LinkLabelListener labelListener) { LinkLabel label = new LinkLabel(text); label.setListener(labelListener); linkLabelTable.add(label).spaceRight(12); }
java
public void addLinkLabel (String text, LinkLabel.LinkLabelListener labelListener) { LinkLabel label = new LinkLabel(text); label.setListener(labelListener); linkLabelTable.add(label).spaceRight(12); }
[ "public", "void", "addLinkLabel", "(", "String", "text", ",", "LinkLabel", ".", "LinkLabelListener", "labelListener", ")", "{", "LinkLabel", "label", "=", "new", "LinkLabel", "(", "text", ")", ";", "label", ".", "setListener", "(", "labelListener", ")", ";", ...
Adds new link label below toast message. @param text link label text @param labelListener will be called upon label click. Note that toast won't be closed automatically so {@link Toast#fadeOut()} must be called
[ "Adds", "new", "link", "label", "below", "toast", "message", "." ]
train
https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/widget/toast/MessageToast.java#L44-L48
liuyukuai/commons
commons-core/src/main/java/com/itxiaoer/commons/core/beans/ProcessUtils.java
ProcessUtils.process
public static <T, R> R process(Class<R> clazz, T src) { return process(clazz, src, (r, s) -> { }); }
java
public static <T, R> R process(Class<R> clazz, T src) { return process(clazz, src, (r, s) -> { }); }
[ "public", "static", "<", "T", ",", "R", ">", "R", "process", "(", "Class", "<", "R", ">", "clazz", ",", "T", "src", ")", "{", "return", "process", "(", "clazz", ",", "src", ",", "(", "r", ",", "s", ")", "->", "{", "}", ")", ";", "}" ]
拷贝单个对象 @param clazz 目标类型 @param src 原对象 @param <T> 原数据类型 @param <R> 目标数据类型 @return 目标对象
[ "拷贝单个对象" ]
train
https://github.com/liuyukuai/commons/blob/ba67eddb542446b12f419f1866dbaa82e47fbf35/commons-core/src/main/java/com/itxiaoer/commons/core/beans/ProcessUtils.java#L75-L78
iovation/launchkey-java
sdk/src/main/java/com/iovation/launchkey/sdk/crypto/JCECrypto.java
JCECrypto.getRSAPublicKeyFromPEM
public static RSAPublicKey getRSAPublicKeyFromPEM(Provider provider, String pem) { try { KeyFactory keyFactory = KeyFactory.getInstance("RSA", provider); return (RSAPublicKey) keyFactory.generatePublic(new X509EncodedKeySpec(getKeyBytesFromPEM(pem))); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException("Algorithm SHA256withRSA is not available", e); } catch (InvalidKeySpecException e) { throw new IllegalArgumentException("Invalid PEM provided", e); } }
java
public static RSAPublicKey getRSAPublicKeyFromPEM(Provider provider, String pem) { try { KeyFactory keyFactory = KeyFactory.getInstance("RSA", provider); return (RSAPublicKey) keyFactory.generatePublic(new X509EncodedKeySpec(getKeyBytesFromPEM(pem))); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException("Algorithm SHA256withRSA is not available", e); } catch (InvalidKeySpecException e) { throw new IllegalArgumentException("Invalid PEM provided", e); } }
[ "public", "static", "RSAPublicKey", "getRSAPublicKeyFromPEM", "(", "Provider", "provider", ",", "String", "pem", ")", "{", "try", "{", "KeyFactory", "keyFactory", "=", "KeyFactory", ".", "getInstance", "(", "\"RSA\"", ",", "provider", ")", ";", "return", "(", ...
Get an RSA public key utilizing the provided provider and PEM formatted string @param provider Provider to generate the key @param pem PEM formatted key string @return RSA public key
[ "Get", "an", "RSA", "public", "key", "utilizing", "the", "provided", "provider", "and", "PEM", "formatted", "string" ]
train
https://github.com/iovation/launchkey-java/blob/ceecc70b9b04af07ddc14c57d4bcc933a4e0379c/sdk/src/main/java/com/iovation/launchkey/sdk/crypto/JCECrypto.java#L114-L123
akarnokd/ixjava
src/main/java/ix/Ix.java
Ix.as
public final <R> R as(IxFunction<? super Ix<T>, R> transformer) { return transformer.apply(this); }
java
public final <R> R as(IxFunction<? super Ix<T>, R> transformer) { return transformer.apply(this); }
[ "public", "final", "<", "R", ">", "R", "as", "(", "IxFunction", "<", "?", "super", "Ix", "<", "T", ">", ",", "R", ">", "transformer", ")", "{", "return", "transformer", ".", "apply", "(", "this", ")", ";", "}" ]
Calls the given transformers with this and returns its value allowing fluent conversions to non-Ix types. @param <R> the result type @param transformer the function receiving this Ix instance and returns a value @return the value returned by the transformer function @throws NullPointerException if transformer is null @since 1.0
[ "Calls", "the", "given", "transformers", "with", "this", "and", "returns", "its", "value", "allowing", "fluent", "conversions", "to", "non", "-", "Ix", "types", "." ]
train
https://github.com/akarnokd/ixjava/blob/add721bba550c36541faa450e40a975bb65e78d7/src/main/java/ix/Ix.java#L759-L761
lessthanoptimal/ejml
main/ejml-core/src/org/ejml/ops/MatrixIO.java
MatrixIO.saveBin
public static void saveBin(DMatrix A, String fileName) throws IOException { FileOutputStream fileStream = new FileOutputStream(fileName); ObjectOutputStream stream = new ObjectOutputStream(fileStream); try { stream.writeObject(A); stream.flush(); } finally { // clean up try { stream.close(); } finally { fileStream.close(); } } }
java
public static void saveBin(DMatrix A, String fileName) throws IOException { FileOutputStream fileStream = new FileOutputStream(fileName); ObjectOutputStream stream = new ObjectOutputStream(fileStream); try { stream.writeObject(A); stream.flush(); } finally { // clean up try { stream.close(); } finally { fileStream.close(); } } }
[ "public", "static", "void", "saveBin", "(", "DMatrix", "A", ",", "String", "fileName", ")", "throws", "IOException", "{", "FileOutputStream", "fileStream", "=", "new", "FileOutputStream", "(", "fileName", ")", ";", "ObjectOutputStream", "stream", "=", "new", "Ob...
Saves a matrix to disk using Java binary serialization. @param A The matrix being saved. @param fileName Name of the file its being saved at. @throws java.io.IOException
[ "Saves", "a", "matrix", "to", "disk", "using", "Java", "binary", "serialization", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/ops/MatrixIO.java#L48-L66
johnkil/Android-AppMsg
library/src/com/devspark/appmsg/AppMsg.java
AppMsg.makeText
public static AppMsg makeText(Activity context, CharSequence text, Style style, float textSize) { return makeText(context, text, style, R.layout.app_msg, textSize); }
java
public static AppMsg makeText(Activity context, CharSequence text, Style style, float textSize) { return makeText(context, text, style, R.layout.app_msg, textSize); }
[ "public", "static", "AppMsg", "makeText", "(", "Activity", "context", ",", "CharSequence", "text", ",", "Style", "style", ",", "float", "textSize", ")", "{", "return", "makeText", "(", "context", ",", "text", ",", "style", ",", "R", ".", "layout", ".", "...
@author mengguoqiang Make a {@link AppMsg} that just contains a text view. @param context The context to use. Usually your {@link android.app.Activity} object. @param text The text to show. Can be formatted text. @param style The style with a background and a duration.
[ "@author", "mengguoqiang", "Make", "a", "{", "@link", "AppMsg", "}", "that", "just", "contains", "a", "text", "view", "." ]
train
https://github.com/johnkil/Android-AppMsg/blob/e7fdd7870530a24e6d825278ee0863be0521e8b8/library/src/com/devspark/appmsg/AppMsg.java#L158-L160
Bernardo-MG/maven-site-fixer
src/main/java/com/bernardomg/velocity/tool/HtmlTool.java
HtmlTool.swapTagWithParent
public final void swapTagWithParent(final Element root, final String selector) { final Iterable<Element> elements; // Selected elements Element parent; // Parent element String text; // Preserved text checkNotNull(root, "Received a null pointer as root element"); checkNotNull(selector, "Received a null pointer as selector"); // Selects and iterates over the elements elements = root.select(selector); for (final Element element : elements) { parent = element.parent(); // Takes the text out of the element text = element.text(); element.text(""); // Swaps elements parent.replaceWith(element); element.appendChild(parent); // Sets the text into what was the parent element parent.text(text); } }
java
public final void swapTagWithParent(final Element root, final String selector) { final Iterable<Element> elements; // Selected elements Element parent; // Parent element String text; // Preserved text checkNotNull(root, "Received a null pointer as root element"); checkNotNull(selector, "Received a null pointer as selector"); // Selects and iterates over the elements elements = root.select(selector); for (final Element element : elements) { parent = element.parent(); // Takes the text out of the element text = element.text(); element.text(""); // Swaps elements parent.replaceWith(element); element.appendChild(parent); // Sets the text into what was the parent element parent.text(text); } }
[ "public", "final", "void", "swapTagWithParent", "(", "final", "Element", "root", ",", "final", "String", "selector", ")", "{", "final", "Iterable", "<", "Element", ">", "elements", ";", "// Selected elements", "Element", "parent", ";", "// Parent element", "String...
Finds a set of elements through a CSS selector and swaps its tag with that from its parent. @param root body element with source divisions to upgrade @param selector CSS selector for the elements to swap with its parent
[ "Finds", "a", "set", "of", "elements", "through", "a", "CSS", "selector", "and", "swaps", "its", "tag", "with", "that", "from", "its", "parent", "." ]
train
https://github.com/Bernardo-MG/maven-site-fixer/blob/e064472faa7edb0fca11647a22d90ad72089baa3/src/main/java/com/bernardomg/velocity/tool/HtmlTool.java#L166-L191
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.replaceEntry
public static boolean replaceEntry(final File zip, final String path, final byte[] bytes) { return operateInPlace(zip, new InPlaceAction() { public boolean act(File tmpFile) { return replaceEntry(zip, new ByteSource(path, bytes), tmpFile); } }); }
java
public static boolean replaceEntry(final File zip, final String path, final byte[] bytes) { return operateInPlace(zip, new InPlaceAction() { public boolean act(File tmpFile) { return replaceEntry(zip, new ByteSource(path, bytes), tmpFile); } }); }
[ "public", "static", "boolean", "replaceEntry", "(", "final", "File", "zip", ",", "final", "String", "path", ",", "final", "byte", "[", "]", "bytes", ")", "{", "return", "operateInPlace", "(", "zip", ",", "new", "InPlaceAction", "(", ")", "{", "public", "...
Changes an existing ZIP file: replaces a given entry in it. @param zip an existing ZIP file. @param path new ZIP entry path. @param bytes new entry bytes (or <code>null</code> if directory). @return <code>true</code> if the entry was replaced.
[ "Changes", "an", "existing", "ZIP", "file", ":", "replaces", "a", "given", "entry", "in", "it", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L2553-L2559
tvesalainen/util
util/src/main/java/org/vesalainen/nio/file/attribute/UserAttrs.java
UserAttrs.getFloatAttribute
public static final float getFloatAttribute(Path path, String attribute, LinkOption... options) throws IOException { return getFloatAttribute(path, attribute, Float.NaN, options); }
java
public static final float getFloatAttribute(Path path, String attribute, LinkOption... options) throws IOException { return getFloatAttribute(path, attribute, Float.NaN, options); }
[ "public", "static", "final", "float", "getFloatAttribute", "(", "Path", "path", ",", "String", "attribute", ",", "LinkOption", "...", "options", ")", "throws", "IOException", "{", "return", "getFloatAttribute", "(", "path", ",", "attribute", ",", "Float", ".", ...
Returns user-defined-attribute NaN if not found. @param path @param attribute @param options @return @throws IOException @see java.lang.Float#NaN
[ "Returns", "user", "-", "defined", "-", "attribute", "NaN", "if", "not", "found", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/UserAttrs.java#L231-L234
jbossws/jbossws-common
src/main/java/org/jboss/ws/common/invocation/AbstractInvocationHandler.java
AbstractInvocationHandler.getImplMethod
protected final Method getImplMethod(final Class<?> implClass, final Method seiMethod) throws NoSuchMethodException { final String methodName = seiMethod.getName(); final Class<?>[] paramTypes = seiMethod.getParameterTypes(); return implClass.getMethod(methodName, paramTypes); }
java
protected final Method getImplMethod(final Class<?> implClass, final Method seiMethod) throws NoSuchMethodException { final String methodName = seiMethod.getName(); final Class<?>[] paramTypes = seiMethod.getParameterTypes(); return implClass.getMethod(methodName, paramTypes); }
[ "protected", "final", "Method", "getImplMethod", "(", "final", "Class", "<", "?", ">", "implClass", ",", "final", "Method", "seiMethod", ")", "throws", "NoSuchMethodException", "{", "final", "String", "methodName", "=", "seiMethod", ".", "getName", "(", ")", "...
Returns implementation method that will be used for invocation. @param implClass implementation endpoint class @param seiMethod SEI interface method used for method finding algorithm @return implementation method @throws NoSuchMethodException if implementation method wasn't found
[ "Returns", "implementation", "method", "that", "will", "be", "used", "for", "invocation", "." ]
train
https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/invocation/AbstractInvocationHandler.java#L82-L88
apereo/cas
support/cas-server-support-saml/src/main/java/org/apereo/cas/support/saml/authentication/SamlResponseBuilder.java
SamlResponseBuilder.createResponse
public Response createResponse(final String serviceId, final WebApplicationService service) { return this.samlObjectBuilder.newResponse( this.samlObjectBuilder.generateSecureRandomId(), ZonedDateTime.now(ZoneOffset.UTC).minusSeconds(this.skewAllowance), serviceId, service); }
java
public Response createResponse(final String serviceId, final WebApplicationService service) { return this.samlObjectBuilder.newResponse( this.samlObjectBuilder.generateSecureRandomId(), ZonedDateTime.now(ZoneOffset.UTC).minusSeconds(this.skewAllowance), serviceId, service); }
[ "public", "Response", "createResponse", "(", "final", "String", "serviceId", ",", "final", "WebApplicationService", "service", ")", "{", "return", "this", ".", "samlObjectBuilder", ".", "newResponse", "(", "this", ".", "samlObjectBuilder", ".", "generateSecureRandomId...
Create response. @param serviceId the service id @param service the service @return the response
[ "Create", "response", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml/src/main/java/org/apereo/cas/support/saml/authentication/SamlResponseBuilder.java#L52-L56
cchantep/acolyte
jdbc-java8/src/main/java/acolyte/jdbc/Java8CompositeHandler.java
Java8CompositeHandler.withQueryHandler2
public <T> Java8CompositeHandler withQueryHandler2(ScalarQueryHandler<T> h) { final QueryHandler qh = new QueryHandler() { public QueryResult apply(String sql, List<Parameter> ps) throws SQLException { return RowLists.scalar(h.apply(sql, ps)).asResult(); } }; return withQueryHandler(qh); }
java
public <T> Java8CompositeHandler withQueryHandler2(ScalarQueryHandler<T> h) { final QueryHandler qh = new QueryHandler() { public QueryResult apply(String sql, List<Parameter> ps) throws SQLException { return RowLists.scalar(h.apply(sql, ps)).asResult(); } }; return withQueryHandler(qh); }
[ "public", "<", "T", ">", "Java8CompositeHandler", "withQueryHandler2", "(", "ScalarQueryHandler", "<", "T", ">", "h", ")", "{", "final", "QueryHandler", "qh", "=", "new", "QueryHandler", "(", ")", "{", "public", "QueryResult", "apply", "(", "String", "sql", ...
Returns handler that delegates query execution to |h| function. Given function will be used only if executed statement is detected as a query by withQueryDetection. @param h the new query handler <pre> {@code import acolyte.jdbc.StatementHandler.Parameter; import static acolyte.jdbc.AcolyteDSL.handleStatement; handleStatement.withQueryHandler2((String sql, List<Parameter> ps) -> { if (sql == "SELECT * FROM Test WHERE id = ?") return "Foo"; else return "Bar"; }); } </pre>
[ "Returns", "handler", "that", "delegates", "query", "execution", "to", "|h|", "function", ".", "Given", "function", "will", "be", "used", "only", "if", "executed", "statement", "is", "detected", "as", "a", "query", "by", "withQueryDetection", "." ]
train
https://github.com/cchantep/acolyte/blob/a383dff20fadc08ec9306f2f1f24b2a7e0047449/jdbc-java8/src/main/java/acolyte/jdbc/Java8CompositeHandler.java#L135-L144
alkacon/opencms-core
src/org/opencms/rmi/CmsRemoteShellClient.java
CmsRemoteShellClient.executeCommand
private void executeCommand(String command, List<String> arguments) { try { CmsShellCommandResult result = m_remoteShell.executeCommand(command, arguments); m_out.print(result.getOutput()); updateState(result); if (m_exitCalled) { exit(0); } else if (m_hasError && (m_errorCode != -1)) { exit(m_errorCode); } } catch (RemoteException r) { r.printStackTrace(System.err); exit(1); } }
java
private void executeCommand(String command, List<String> arguments) { try { CmsShellCommandResult result = m_remoteShell.executeCommand(command, arguments); m_out.print(result.getOutput()); updateState(result); if (m_exitCalled) { exit(0); } else if (m_hasError && (m_errorCode != -1)) { exit(m_errorCode); } } catch (RemoteException r) { r.printStackTrace(System.err); exit(1); } }
[ "private", "void", "executeCommand", "(", "String", "command", ",", "List", "<", "String", ">", "arguments", ")", "{", "try", "{", "CmsShellCommandResult", "result", "=", "m_remoteShell", ".", "executeCommand", "(", "command", ",", "arguments", ")", ";", "m_ou...
Executes a command remotely, displays the command output and updates the internal state.<p> @param command the command @param arguments the arguments
[ "Executes", "a", "command", "remotely", "displays", "the", "command", "output", "and", "updates", "the", "internal", "state", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/rmi/CmsRemoteShellClient.java#L248-L263
raydac/java-comment-preprocessor
jcp/src/main/java/com/igormaznitsa/jcp/context/PreprocessorContext.java
PreprocessorContext.createDestinationFileForPath
@Nonnull public File createDestinationFileForPath(@Nonnull final String path) { assertNotNull("Path is null", path); if (path.isEmpty()) { throw makeException("File name is empty", null); } return new File(this.getTarget(), path); }
java
@Nonnull public File createDestinationFileForPath(@Nonnull final String path) { assertNotNull("Path is null", path); if (path.isEmpty()) { throw makeException("File name is empty", null); } return new File(this.getTarget(), path); }
[ "@", "Nonnull", "public", "File", "createDestinationFileForPath", "(", "@", "Nonnull", "final", "String", "path", ")", "{", "assertNotNull", "(", "\"Path is null\"", ",", "path", ")", ";", "if", "(", "path", ".", "isEmpty", "(", ")", ")", "{", "throw", "ma...
It allows to create a File object for its path subject to the destination directory path @param path the path to the file, it must not be null @return a generated File object for the path
[ "It", "allows", "to", "create", "a", "File", "object", "for", "its", "path", "subject", "to", "the", "destination", "directory", "path" ]
train
https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/jcp/context/PreprocessorContext.java#L710-L719
apptik/JustJson
json-core/src/main/java/io/apptik/json/JsonArray.java
JsonArray.getBoolean
public Boolean getBoolean(int index, boolean strict) throws JsonException { JsonElement el = get(index); Boolean res = null; if (strict && !el.isBoolean()) { throw Util.typeMismatch(index, el, "boolean", true); } if (el.isBoolean()) { res = el.asBoolean(); } if (el.isString()) { res = Util.toBoolean(el.asString()); } if (res == null) throw Util.typeMismatch(index, el, "boolean", strict); return res; }
java
public Boolean getBoolean(int index, boolean strict) throws JsonException { JsonElement el = get(index); Boolean res = null; if (strict && !el.isBoolean()) { throw Util.typeMismatch(index, el, "boolean", true); } if (el.isBoolean()) { res = el.asBoolean(); } if (el.isString()) { res = Util.toBoolean(el.asString()); } if (res == null) throw Util.typeMismatch(index, el, "boolean", strict); return res; }
[ "public", "Boolean", "getBoolean", "(", "int", "index", ",", "boolean", "strict", ")", "throws", "JsonException", "{", "JsonElement", "el", "=", "get", "(", "index", ")", ";", "Boolean", "res", "=", "null", ";", "if", "(", "strict", "&&", "!", "el", "....
Returns the value at {@code index} if it exists and is a boolean or can be coerced to a boolean. @throws JsonException if the value at {@code index} doesn't exist or cannot be coerced to a boolean.
[ "Returns", "the", "value", "at", "{", "@code", "index", "}", "if", "it", "exists", "and", "is", "a", "boolean", "or", "can", "be", "coerced", "to", "a", "boolean", "." ]
train
https://github.com/apptik/JustJson/blob/c90f0dd7f84df26da4749be8cd9b026fff499a79/json-core/src/main/java/io/apptik/json/JsonArray.java#L326-L341
carrotsearch/hppc
hppc/src/main/templates/com/carrotsearch/hppc/KTypeVTypeHashMap.java
KTypeVTypeHashMap.putIfAbsent
public boolean putIfAbsent(KType key, VType value) { int keyIndex = indexOf(key); if (!indexExists(keyIndex)) { indexInsert(keyIndex, key, value); return true; } else { return false; } }
java
public boolean putIfAbsent(KType key, VType value) { int keyIndex = indexOf(key); if (!indexExists(keyIndex)) { indexInsert(keyIndex, key, value); return true; } else { return false; } }
[ "public", "boolean", "putIfAbsent", "(", "KType", "key", ",", "VType", "value", ")", "{", "int", "keyIndex", "=", "indexOf", "(", "key", ")", ";", "if", "(", "!", "indexExists", "(", "keyIndex", ")", ")", "{", "indexInsert", "(", "keyIndex", ",", "key"...
<a href="http://trove4j.sourceforge.net">Trove</a>-inspired API method. An equivalent of the following code: <pre> if (!map.containsKey(key)) map.put(value); </pre> @param key The key of the value to check. @param value The value to put if <code>key</code> does not exist. @return <code>true</code> if <code>key</code> did not exist and <code>value</code> was placed in the map.
[ "<a", "href", "=", "http", ":", "//", "trove4j", ".", "sourceforge", ".", "net", ">", "Trove<", "/", "a", ">", "-", "inspired", "API", "method", ".", "An", "equivalent", "of", "the", "following", "code", ":", "<pre", ">", "if", "(", "!map", ".", "c...
train
https://github.com/carrotsearch/hppc/blob/e359e9da358e846fcbffc64a765611df954ba3f6/hppc/src/main/templates/com/carrotsearch/hppc/KTypeVTypeHashMap.java#L227-L235
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/beaneditor/BeanEditorPanel.java
BeanEditorPanel.newRepeatingView
protected RepeatingView newRepeatingView(final String id, final IModel<T> model) { final RepeatingView fields = new RepeatingView("fields"); form.add(fields); final T modelObject = model.getObject(); for (final Field field : modelObject.getClass().getDeclaredFields()) { // skip serialVersionUID... if (field.getName().equalsIgnoreCase("serialVersionUID")) { continue; } final WebMarkupContainer row = new WebMarkupContainer(fields.newChildId()); fields.add(row); final IModel<String> labelModel = Model.of(field.getName()); row.add(new Label("name", labelModel)); final IModel<?> fieldModel = new PropertyModel<Object>(modelObject, field.getName()); // Create the editor for the field. row.add(newEditorForBeanField("editor", field, fieldModel)); } return fields; }
java
protected RepeatingView newRepeatingView(final String id, final IModel<T> model) { final RepeatingView fields = new RepeatingView("fields"); form.add(fields); final T modelObject = model.getObject(); for (final Field field : modelObject.getClass().getDeclaredFields()) { // skip serialVersionUID... if (field.getName().equalsIgnoreCase("serialVersionUID")) { continue; } final WebMarkupContainer row = new WebMarkupContainer(fields.newChildId()); fields.add(row); final IModel<String> labelModel = Model.of(field.getName()); row.add(new Label("name", labelModel)); final IModel<?> fieldModel = new PropertyModel<Object>(modelObject, field.getName()); // Create the editor for the field. row.add(newEditorForBeanField("editor", field, fieldModel)); } return fields; }
[ "protected", "RepeatingView", "newRepeatingView", "(", "final", "String", "id", ",", "final", "IModel", "<", "T", ">", "model", ")", "{", "final", "RepeatingView", "fields", "=", "new", "RepeatingView", "(", "\"fields\"", ")", ";", "form", ".", "add", "(", ...
Factory method for creating the RepeatingView. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a RepeatingView. @param id the id @param model the model @return the RepeatingView
[ "Factory", "method", "for", "creating", "the", "RepeatingView", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "the", "derived", "classes", "and", "can", "be", "overridden", "so", "users", "can", "provide", "their", "own", "version...
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/beaneditor/BeanEditorPanel.java#L118-L144