repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/classify/LinearClassifier.java
LinearClassifier.scoreOf
public double scoreOf(Datum<L, F> example, L label) { """ Returns of the score of the Datum for the specified label. Ignores the true label of the Datum. """ if(example instanceof RVFDatum<?, ?>)return scoreOfRVFDatum((RVFDatum<L,F>)example, label); int iLabel = labelIndex.indexOf(label); double score = 0.0; for (F f : example.asFeatures()) { score += weight(f, iLabel); } return score + thresholds[iLabel]; }
java
public double scoreOf(Datum<L, F> example, L label) { if(example instanceof RVFDatum<?, ?>)return scoreOfRVFDatum((RVFDatum<L,F>)example, label); int iLabel = labelIndex.indexOf(label); double score = 0.0; for (F f : example.asFeatures()) { score += weight(f, iLabel); } return score + thresholds[iLabel]; }
[ "public", "double", "scoreOf", "(", "Datum", "<", "L", ",", "F", ">", "example", ",", "L", "label", ")", "{", "if", "(", "example", "instanceof", "RVFDatum", "<", "?", ",", "?", ">", ")", "return", "scoreOfRVFDatum", "(", "(", "RVFDatum", "<", "L", ...
Returns of the score of the Datum for the specified label. Ignores the true label of the Datum.
[ "Returns", "of", "the", "score", "of", "the", "Datum", "for", "the", "specified", "label", ".", "Ignores", "the", "true", "label", "of", "the", "Datum", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/LinearClassifier.java#L165-L173
alkacon/opencms-core
src-modules/org/opencms/workplace/list/CmsListDirectAction.java
CmsListDirectAction.resolveHelpText
protected String resolveHelpText(Locale locale) { """ Help method to resolve the help text to use.<p> @param locale the used locale @return the help text """ String helpText = getHelpText().key(locale); if ((getColumnForTexts() != null) && (getItem().get(getColumnForTexts()) != null)) { helpText = new MessageFormat(helpText, locale).format(new Object[] {getItem().get(getColumnForTexts())}); } return helpText; }
java
protected String resolveHelpText(Locale locale) { String helpText = getHelpText().key(locale); if ((getColumnForTexts() != null) && (getItem().get(getColumnForTexts()) != null)) { helpText = new MessageFormat(helpText, locale).format(new Object[] {getItem().get(getColumnForTexts())}); } return helpText; }
[ "protected", "String", "resolveHelpText", "(", "Locale", "locale", ")", "{", "String", "helpText", "=", "getHelpText", "(", ")", ".", "key", "(", "locale", ")", ";", "if", "(", "(", "getColumnForTexts", "(", ")", "!=", "null", ")", "&&", "(", "getItem", ...
Help method to resolve the help text to use.<p> @param locale the used locale @return the help text
[ "Help", "method", "to", "resolve", "the", "help", "text", "to", "use", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/list/CmsListDirectAction.java#L68-L75
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java
Expressions.enumTemplate
public static <T extends Enum<T>> EnumTemplate<T> enumTemplate(Class<? extends T> cl, Template template, Object... args) { """ Create a new Template expression @param cl type of expression @param template template @param args template parameters @return template expression """ return enumTemplate(cl, template, ImmutableList.copyOf(args)); }
java
public static <T extends Enum<T>> EnumTemplate<T> enumTemplate(Class<? extends T> cl, Template template, Object... args) { return enumTemplate(cl, template, ImmutableList.copyOf(args)); }
[ "public", "static", "<", "T", "extends", "Enum", "<", "T", ">", ">", "EnumTemplate", "<", "T", ">", "enumTemplate", "(", "Class", "<", "?", "extends", "T", ">", "cl", ",", "Template", "template", ",", "Object", "...", "args", ")", "{", "return", "enu...
Create a new Template expression @param cl type of expression @param template template @param args template parameters @return template expression
[ "Create", "a", "new", "Template", "expression" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L766-L769
kiegroup/jbpm
jbpm-services/jbpm-services-cdi/src/main/java/org/jbpm/services/cdi/impl/manager/InjectableRegisterableItemsFactory.java
InjectableRegisterableItemsFactory.getFactory
public static RegisterableItemsFactory getFactory(BeanManager beanManager, AuditEventBuilder eventBuilder, KieContainer kieContainer, String ksessionName) { """ Allows to create instance of this class dynamically via <code>BeanManager</code>. This is useful in case multiple independent instances are required on runtime and that need cannot be satisfied with regular CDI practices. @param beanManager - bean manager instance of the container @param eventBuilder - <code>AbstractAuditLogger</code> logger builder instance to be used, might be null @param kieContainer - <code>KieContainer</code> that the factory is built for @param ksessionName - name of the ksession defined in kmodule to be used, if not given default ksession from kmodule will be used. @return """ InjectableRegisterableItemsFactory instance = getInstanceByType(beanManager, InjectableRegisterableItemsFactory.class, new Annotation[]{}); instance.setAuditBuilder(eventBuilder); instance.setKieContainer(kieContainer); instance.setKsessionName(ksessionName); return instance; }
java
public static RegisterableItemsFactory getFactory(BeanManager beanManager, AuditEventBuilder eventBuilder, KieContainer kieContainer, String ksessionName) { InjectableRegisterableItemsFactory instance = getInstanceByType(beanManager, InjectableRegisterableItemsFactory.class, new Annotation[]{}); instance.setAuditBuilder(eventBuilder); instance.setKieContainer(kieContainer); instance.setKsessionName(ksessionName); return instance; }
[ "public", "static", "RegisterableItemsFactory", "getFactory", "(", "BeanManager", "beanManager", ",", "AuditEventBuilder", "eventBuilder", ",", "KieContainer", "kieContainer", ",", "String", "ksessionName", ")", "{", "InjectableRegisterableItemsFactory", "instance", "=", "g...
Allows to create instance of this class dynamically via <code>BeanManager</code>. This is useful in case multiple independent instances are required on runtime and that need cannot be satisfied with regular CDI practices. @param beanManager - bean manager instance of the container @param eventBuilder - <code>AbstractAuditLogger</code> logger builder instance to be used, might be null @param kieContainer - <code>KieContainer</code> that the factory is built for @param ksessionName - name of the ksession defined in kmodule to be used, if not given default ksession from kmodule will be used. @return
[ "Allows", "to", "create", "instance", "of", "this", "class", "dynamically", "via", "<code", ">", "BeanManager<", "/", "code", ">", ".", "This", "is", "useful", "in", "case", "multiple", "independent", "instances", "are", "required", "on", "runtime", "and", "...
train
https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-services/jbpm-services-cdi/src/main/java/org/jbpm/services/cdi/impl/manager/InjectableRegisterableItemsFactory.java#L337-L343
CODAIT/stocator
src/main/java/com/ibm/stocator/fs/cos/COSAPIClient.java
COSAPIClient.isJobSuccessful
private boolean isJobSuccessful(String objectKey) { """ Checks if container/object contains container/object/_SUCCESS If so, this object was created by successful Hadoop job @param objectKey @return boolean if job is successful """ LOG.trace("isJobSuccessful: for {}", objectKey); if (mCachedSparkJobsStatus.containsKey(objectKey)) { LOG.trace("isJobSuccessful: {} found cached", objectKey); return mCachedSparkJobsStatus.get(objectKey).booleanValue(); } String key = getRealKey(objectKey); Path p = new Path(key, HADOOP_SUCCESS); ObjectMetadata statusMetadata = getObjectMetadata(p.toString()); Boolean isJobOK = Boolean.FALSE; if (statusMetadata != null) { isJobOK = Boolean.TRUE; } LOG.debug("isJobSuccessful: not cached {}. Status is {}", objectKey, isJobOK); mCachedSparkJobsStatus.put(objectKey, isJobOK); return isJobOK.booleanValue(); }
java
private boolean isJobSuccessful(String objectKey) { LOG.trace("isJobSuccessful: for {}", objectKey); if (mCachedSparkJobsStatus.containsKey(objectKey)) { LOG.trace("isJobSuccessful: {} found cached", objectKey); return mCachedSparkJobsStatus.get(objectKey).booleanValue(); } String key = getRealKey(objectKey); Path p = new Path(key, HADOOP_SUCCESS); ObjectMetadata statusMetadata = getObjectMetadata(p.toString()); Boolean isJobOK = Boolean.FALSE; if (statusMetadata != null) { isJobOK = Boolean.TRUE; } LOG.debug("isJobSuccessful: not cached {}. Status is {}", objectKey, isJobOK); mCachedSparkJobsStatus.put(objectKey, isJobOK); return isJobOK.booleanValue(); }
[ "private", "boolean", "isJobSuccessful", "(", "String", "objectKey", ")", "{", "LOG", ".", "trace", "(", "\"isJobSuccessful: for {}\"", ",", "objectKey", ")", ";", "if", "(", "mCachedSparkJobsStatus", ".", "containsKey", "(", "objectKey", ")", ")", "{", "LOG", ...
Checks if container/object contains container/object/_SUCCESS If so, this object was created by successful Hadoop job @param objectKey @return boolean if job is successful
[ "Checks", "if", "container", "/", "object", "contains", "container", "/", "object", "/", "_SUCCESS", "If", "so", "this", "object", "was", "created", "by", "successful", "Hadoop", "job" ]
train
https://github.com/CODAIT/stocator/blob/35969cadd2e8faa6fdac45e8bec1799fdd3d8299/src/main/java/com/ibm/stocator/fs/cos/COSAPIClient.java#L1058-L1074
logic-ng/LogicNG
src/main/java/org/logicng/solvers/MiniSat.java
MiniSat.miniCard
public static MiniSat miniCard(final FormulaFactory f, final MiniSatConfig config) { """ Returns a new MiniCard solver with a given configuration. @param f the formula factory @param config the configuration @return the solver """ return new MiniSat(f, SolverStyle.MINICARD, config, null); }
java
public static MiniSat miniCard(final FormulaFactory f, final MiniSatConfig config) { return new MiniSat(f, SolverStyle.MINICARD, config, null); }
[ "public", "static", "MiniSat", "miniCard", "(", "final", "FormulaFactory", "f", ",", "final", "MiniSatConfig", "config", ")", "{", "return", "new", "MiniSat", "(", "f", ",", "SolverStyle", ".", "MINICARD", ",", "config", ",", "null", ")", ";", "}" ]
Returns a new MiniCard solver with a given configuration. @param f the formula factory @param config the configuration @return the solver
[ "Returns", "a", "new", "MiniCard", "solver", "with", "a", "given", "configuration", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/MiniSat.java#L181-L183
messagebird/java-rest-api
api/src/main/java/com/messagebird/MessageBirdClient.java
MessageBirdClient.listConversations
public ConversationList listConversations(final int offset, final int limit) throws UnauthorizedException, GeneralException { """ Gets a Conversation listing with specified pagination options. @param offset Number of objects to skip. @param limit Number of objects to take. @return List of conversations. """ String url = CONVERSATIONS_BASE_URL + CONVERSATION_PATH; return messageBirdService.requestList(url, offset, limit, ConversationList.class); }
java
public ConversationList listConversations(final int offset, final int limit) throws UnauthorizedException, GeneralException { String url = CONVERSATIONS_BASE_URL + CONVERSATION_PATH; return messageBirdService.requestList(url, offset, limit, ConversationList.class); }
[ "public", "ConversationList", "listConversations", "(", "final", "int", "offset", ",", "final", "int", "limit", ")", "throws", "UnauthorizedException", ",", "GeneralException", "{", "String", "url", "=", "CONVERSATIONS_BASE_URL", "+", "CONVERSATION_PATH", ";", "return...
Gets a Conversation listing with specified pagination options. @param offset Number of objects to skip. @param limit Number of objects to take. @return List of conversations.
[ "Gets", "a", "Conversation", "listing", "with", "specified", "pagination", "options", "." ]
train
https://github.com/messagebird/java-rest-api/blob/f92cd93afff413e6dc12aa6e41e69f26cbae8941/api/src/main/java/com/messagebird/MessageBirdClient.java#L740-L744
JodaOrg/joda-money
src/main/java/org/joda/money/Money.java
Money.withCurrencyUnit
public Money withCurrencyUnit(CurrencyUnit currency, RoundingMode roundingMode) { """ Returns a copy of this monetary value with the specified currency. <p> The returned instance will have the specified currency and the amount from this instance. If the number of decimal places differs between the currencies, then the amount may be rounded. <p> This instance is immutable and unaffected by this method. @param currency the currency to use, not null @param roundingMode the rounding mode to use to bring the decimal places back in line, not null @return the new instance with the input currency set, never null @throws ArithmeticException if the rounding fails """ return with(money.withCurrencyUnit(currency).withCurrencyScale(roundingMode)); }
java
public Money withCurrencyUnit(CurrencyUnit currency, RoundingMode roundingMode) { return with(money.withCurrencyUnit(currency).withCurrencyScale(roundingMode)); }
[ "public", "Money", "withCurrencyUnit", "(", "CurrencyUnit", "currency", ",", "RoundingMode", "roundingMode", ")", "{", "return", "with", "(", "money", ".", "withCurrencyUnit", "(", "currency", ")", ".", "withCurrencyScale", "(", "roundingMode", ")", ")", ";", "}...
Returns a copy of this monetary value with the specified currency. <p> The returned instance will have the specified currency and the amount from this instance. If the number of decimal places differs between the currencies, then the amount may be rounded. <p> This instance is immutable and unaffected by this method. @param currency the currency to use, not null @param roundingMode the rounding mode to use to bring the decimal places back in line, not null @return the new instance with the input currency set, never null @throws ArithmeticException if the rounding fails
[ "Returns", "a", "copy", "of", "this", "monetary", "value", "with", "the", "specified", "currency", ".", "<p", ">", "The", "returned", "instance", "will", "have", "the", "specified", "currency", "and", "the", "amount", "from", "this", "instance", ".", "If", ...
train
https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/Money.java#L441-L443
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormat.java
DateFormat.getDateInstance
public final static DateFormat getDateInstance(int style) { """ Gets the date formatter with the given formatting style for the default locale. @param style the given formatting style. For example, SHORT for "M/d/yy" in the US locale. @return a date formatter. """ return get(0, style, 2, Locale.getDefault(Locale.Category.FORMAT)); }
java
public final static DateFormat getDateInstance(int style) { return get(0, style, 2, Locale.getDefault(Locale.Category.FORMAT)); }
[ "public", "final", "static", "DateFormat", "getDateInstance", "(", "int", "style", ")", "{", "return", "get", "(", "0", ",", "style", ",", "2", ",", "Locale", ".", "getDefault", "(", "Locale", ".", "Category", ".", "FORMAT", ")", ")", ";", "}" ]
Gets the date formatter with the given formatting style for the default locale. @param style the given formatting style. For example, SHORT for "M/d/yy" in the US locale. @return a date formatter.
[ "Gets", "the", "date", "formatter", "with", "the", "given", "formatting", "style", "for", "the", "default", "locale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormat.java#L494-L497
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.importCertificateAsync
public ServiceFuture<CertificateBundle> importCertificateAsync(String vaultBaseUrl, String certificateName, String base64EncodedCertificate, String password, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map<String, String> tags, final ServiceCallback<CertificateBundle> serviceCallback) { """ Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The certificate to be imported can be in either PFX or PEM format. If the certificate is in PEM format the PEM file must contain the key as well as x509 certificates. This operation requires the certificates/import permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate. @param base64EncodedCertificate Base64 encoded representation of the certificate object to import. This certificate needs to contain the private key. @param password If the private key in base64EncodedCertificate is encrypted, the password used for encryption. @param certificatePolicy The management policy for the certificate. @param certificateAttributes The attributes of the certificate (optional). @param tags Application specific metadata in the form of key-value pairs. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object """ return ServiceFuture.fromResponse(importCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, base64EncodedCertificate, password, certificatePolicy, certificateAttributes, tags), serviceCallback); }
java
public ServiceFuture<CertificateBundle> importCertificateAsync(String vaultBaseUrl, String certificateName, String base64EncodedCertificate, String password, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map<String, String> tags, final ServiceCallback<CertificateBundle> serviceCallback) { return ServiceFuture.fromResponse(importCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, base64EncodedCertificate, password, certificatePolicy, certificateAttributes, tags), serviceCallback); }
[ "public", "ServiceFuture", "<", "CertificateBundle", ">", "importCertificateAsync", "(", "String", "vaultBaseUrl", ",", "String", "certificateName", ",", "String", "base64EncodedCertificate", ",", "String", "password", ",", "CertificatePolicy", "certificatePolicy", ",", "...
Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The certificate to be imported can be in either PFX or PEM format. If the certificate is in PEM format the PEM file must contain the key as well as x509 certificates. This operation requires the certificates/import permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate. @param base64EncodedCertificate Base64 encoded representation of the certificate object to import. This certificate needs to contain the private key. @param password If the private key in base64EncodedCertificate is encrypted, the password used for encryption. @param certificatePolicy The management policy for the certificate. @param certificateAttributes The attributes of the certificate (optional). @param tags Application specific metadata in the form of key-value pairs. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Imports", "a", "certificate", "into", "a", "specified", "key", "vault", ".", "Imports", "an", "existing", "valid", "certificate", "containing", "a", "private", "key", "into", "Azure", "Key", "Vault", ".", "The", "certificate", "to", "be", "imported", "can", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L6805-L6807
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/utils/BsfUtils.java
BsfUtils.selectMomentJSDateFormat
public static String selectMomentJSDateFormat(Locale locale, String format) { """ Selects the Date Pattern to use based on the given Locale if the input format is null @param locale Locale (may be the result of a call to selectLocale) @param format optional Input format String, given as Moment.js date format @return Moment.js Date Pattern eg. DD/MM/YYYY """ String selFormat; if (format == null) { selFormat = ((SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, locale)).toPattern(); // Since DateFormat.SHORT is silly, return a smart format if (selFormat.equals("M/d/yy")) { return "MM/DD/YYYY"; } if (selFormat.equals("d/M/yy")) { return "DD/MM/YYYY"; } return LocaleUtils.javaToMomentFormat(selFormat); } else { selFormat = format; } return selFormat; }
java
public static String selectMomentJSDateFormat(Locale locale, String format) { String selFormat; if (format == null) { selFormat = ((SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, locale)).toPattern(); // Since DateFormat.SHORT is silly, return a smart format if (selFormat.equals("M/d/yy")) { return "MM/DD/YYYY"; } if (selFormat.equals("d/M/yy")) { return "DD/MM/YYYY"; } return LocaleUtils.javaToMomentFormat(selFormat); } else { selFormat = format; } return selFormat; }
[ "public", "static", "String", "selectMomentJSDateFormat", "(", "Locale", "locale", ",", "String", "format", ")", "{", "String", "selFormat", ";", "if", "(", "format", "==", "null", ")", "{", "selFormat", "=", "(", "(", "SimpleDateFormat", ")", "DateFormat", ...
Selects the Date Pattern to use based on the given Locale if the input format is null @param locale Locale (may be the result of a call to selectLocale) @param format optional Input format String, given as Moment.js date format @return Moment.js Date Pattern eg. DD/MM/YYYY
[ "Selects", "the", "Date", "Pattern", "to", "use", "based", "on", "the", "given", "Locale", "if", "the", "input", "format", "is", "null" ]
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/utils/BsfUtils.java#L507-L524
xwiki/xwiki-rendering
xwiki-rendering-macros/xwiki-rendering-macro-footnotes/src/main/java/org/xwiki/rendering/internal/macro/footnote/PutFootnotesMacro.java
PutFootnotesMacro.createFootnoteBlock
private ListItemBlock createFootnoteBlock(String content, int counter, MacroTransformationContext context) throws MacroExecutionException { """ Generate the footnote block, a numbered list item containing a backlink to the footnote's reference, and the actual footnote text, parsed into XDOM. @param content the string representation of the actual footnote text; the content of the macro @param counter the current footnote counter @param context the macro transformation context, used for obtaining the correct parser for parsing the content @return the generated footnote block @throws MacroExecutionException if parsing the content fails """ List<Block> parsedContent; try { parsedContent = this.contentParser.parse(content, context, false, true).getChildren(); } catch (MacroExecutionException e) { parsedContent = Collections.<Block>singletonList(new WordBlock(content)); } Block result = new WordBlock("^"); DocumentResourceReference reference = new DocumentResourceReference(null); reference.setAnchor(FOOTNOTE_REFERENCE_ID_PREFIX + counter); result = new LinkBlock(Collections.singletonList(result), reference, false); result.setParameter(ID_ATTRIBUTE_NAME, FOOTNOTE_ID_PREFIX + counter); result.setParameter(CLASS_ATTRIBUTE_NAME, "footnoteBackRef"); result = new ListItemBlock(Collections.singletonList(result)); result.addChild(new SpaceBlock()); result.addChildren(parsedContent); return (ListItemBlock) result; }
java
private ListItemBlock createFootnoteBlock(String content, int counter, MacroTransformationContext context) throws MacroExecutionException { List<Block> parsedContent; try { parsedContent = this.contentParser.parse(content, context, false, true).getChildren(); } catch (MacroExecutionException e) { parsedContent = Collections.<Block>singletonList(new WordBlock(content)); } Block result = new WordBlock("^"); DocumentResourceReference reference = new DocumentResourceReference(null); reference.setAnchor(FOOTNOTE_REFERENCE_ID_PREFIX + counter); result = new LinkBlock(Collections.singletonList(result), reference, false); result.setParameter(ID_ATTRIBUTE_NAME, FOOTNOTE_ID_PREFIX + counter); result.setParameter(CLASS_ATTRIBUTE_NAME, "footnoteBackRef"); result = new ListItemBlock(Collections.singletonList(result)); result.addChild(new SpaceBlock()); result.addChildren(parsedContent); return (ListItemBlock) result; }
[ "private", "ListItemBlock", "createFootnoteBlock", "(", "String", "content", ",", "int", "counter", ",", "MacroTransformationContext", "context", ")", "throws", "MacroExecutionException", "{", "List", "<", "Block", ">", "parsedContent", ";", "try", "{", "parsedContent...
Generate the footnote block, a numbered list item containing a backlink to the footnote's reference, and the actual footnote text, parsed into XDOM. @param content the string representation of the actual footnote text; the content of the macro @param counter the current footnote counter @param context the macro transformation context, used for obtaining the correct parser for parsing the content @return the generated footnote block @throws MacroExecutionException if parsing the content fails
[ "Generate", "the", "footnote", "block", "a", "numbered", "list", "item", "containing", "a", "backlink", "to", "the", "footnote", "s", "reference", "and", "the", "actual", "footnote", "text", "parsed", "into", "XDOM", "." ]
train
https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-macros/xwiki-rendering-macro-footnotes/src/main/java/org/xwiki/rendering/internal/macro/footnote/PutFootnotesMacro.java#L210-L229
jenkinsci/jenkins
core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java
HudsonPrivateSecurityRealm.doCreateAccountWithFederatedIdentity
@RequirePOST public User doCreateAccountWithFederatedIdentity(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { """ Creates an account and associates that with the given identity. Used in conjunction with {@link #commenceSignup}. """ User u = _doCreateAccount(req,rsp,"signupWithFederatedIdentity.jelly"); if (u!=null) ((FederatedIdentity)req.getSession().getAttribute(FEDERATED_IDENTITY_SESSION_KEY)).addTo(u); return u; }
java
@RequirePOST public User doCreateAccountWithFederatedIdentity(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { User u = _doCreateAccount(req,rsp,"signupWithFederatedIdentity.jelly"); if (u!=null) ((FederatedIdentity)req.getSession().getAttribute(FEDERATED_IDENTITY_SESSION_KEY)).addTo(u); return u; }
[ "@", "RequirePOST", "public", "User", "doCreateAccountWithFederatedIdentity", "(", "StaplerRequest", "req", ",", "StaplerResponse", "rsp", ")", "throws", "IOException", ",", "ServletException", "{", "User", "u", "=", "_doCreateAccount", "(", "req", ",", "rsp", ",", ...
Creates an account and associates that with the given identity. Used in conjunction with {@link #commenceSignup}.
[ "Creates", "an", "account", "and", "associates", "that", "with", "the", "given", "identity", ".", "Used", "in", "conjunction", "with", "{" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java#L234-L240
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java
IoUtil.getPushBackReader
public static PushbackReader getPushBackReader(Reader reader, int pushBackSize) { """ 获得{@link PushbackReader}<br> 如果是{@link PushbackReader}强转返回,否则新建 @param reader 普通Reader @param pushBackSize 推后的byte数 @return {@link PushbackReader} @since 3.1.0 """ return (reader instanceof PushbackReader) ? (PushbackReader) reader : new PushbackReader(reader, pushBackSize); }
java
public static PushbackReader getPushBackReader(Reader reader, int pushBackSize) { return (reader instanceof PushbackReader) ? (PushbackReader) reader : new PushbackReader(reader, pushBackSize); }
[ "public", "static", "PushbackReader", "getPushBackReader", "(", "Reader", "reader", ",", "int", "pushBackSize", ")", "{", "return", "(", "reader", "instanceof", "PushbackReader", ")", "?", "(", "PushbackReader", ")", "reader", ":", "new", "PushbackReader", "(", ...
获得{@link PushbackReader}<br> 如果是{@link PushbackReader}强转返回,否则新建 @param reader 普通Reader @param pushBackSize 推后的byte数 @return {@link PushbackReader} @since 3.1.0
[ "获得", "{", "@link", "PushbackReader", "}", "<br", ">", "如果是", "{", "@link", "PushbackReader", "}", "强转返回,否则新建" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L352-L354
beangle/beangle3
struts/s2/src/main/java/org/beangle/struts2/view/component/Component.java
Component.addParameter
public void addParameter(String key, Object value) { """ Adds the given key and value to this component's own parameter. <p/> If the provided key is <tt>null</tt> nothing happens. If the provided value is <tt>null</tt> any existing parameter with the given key name is removed. @param key the key of the new parameter to add. @param value the value assoicated with the key. """ if (key != null) { Map<String, Object> params = getParameters(); if (value == null) params.remove(key); else params.put(key, value); } }
java
public void addParameter(String key, Object value) { if (key != null) { Map<String, Object> params = getParameters(); if (value == null) params.remove(key); else params.put(key, value); } }
[ "public", "void", "addParameter", "(", "String", "key", ",", "Object", "value", ")", "{", "if", "(", "key", "!=", "null", ")", "{", "Map", "<", "String", ",", "Object", ">", "params", "=", "getParameters", "(", ")", ";", "if", "(", "value", "==", "...
Adds the given key and value to this component's own parameter. <p/> If the provided key is <tt>null</tt> nothing happens. If the provided value is <tt>null</tt> any existing parameter with the given key name is removed. @param key the key of the new parameter to add. @param value the value assoicated with the key.
[ "Adds", "the", "given", "key", "and", "value", "to", "this", "component", "s", "own", "parameter", ".", "<p", "/", ">", "If", "the", "provided", "key", "is", "<tt", ">", "null<", "/", "tt", ">", "nothing", "happens", ".", "If", "the", "provided", "va...
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/struts/s2/src/main/java/org/beangle/struts2/view/component/Component.java#L414-L420
rvs-fluid-it/mvn-fluid-cd
mvn-ext-freeze/src/main/java/be/fluid_it/mvn/cd/x/freeze/replace/FreezeHandler.java
FreezeHandler.endDocument
public void endDocument() throws SAXException { """ Overrides <code>endDocument()</code> in <code>org.xml.sax.helpers.DefaultHandler</code>, which in turn implements <code>org.xml.sax.ContentHandler</code>. Called once at the end of document processing; no further callbacks will occur. """ try { out.flush(); logger.debug("[Freezehandler]: End parsing of pom file"); } catch (IOException e) { throw new SAXException("I/O error", e); } }
java
public void endDocument() throws SAXException { try { out.flush(); logger.debug("[Freezehandler]: End parsing of pom file"); } catch (IOException e) { throw new SAXException("I/O error", e); } }
[ "public", "void", "endDocument", "(", ")", "throws", "SAXException", "{", "try", "{", "out", ".", "flush", "(", ")", ";", "logger", ".", "debug", "(", "\"[Freezehandler]: End parsing of pom file\"", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", ...
Overrides <code>endDocument()</code> in <code>org.xml.sax.helpers.DefaultHandler</code>, which in turn implements <code>org.xml.sax.ContentHandler</code>. Called once at the end of document processing; no further callbacks will occur.
[ "Overrides", "<code", ">", "endDocument", "()", "<", "/", "code", ">", "in", "<code", ">", "org", ".", "xml", ".", "sax", ".", "helpers", ".", "DefaultHandler<", "/", "code", ">", "which", "in", "turn", "implements", "<code", ">", "org", ".", "xml", ...
train
https://github.com/rvs-fluid-it/mvn-fluid-cd/blob/2aad8ed1cb40f94bd24bad7e6a127956cc277077/mvn-ext-freeze/src/main/java/be/fluid_it/mvn/cd/x/freeze/replace/FreezeHandler.java#L88-L96
roboconf/roboconf-platform
miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/autocompletion/CompletionUtils.java
CompletionUtils.findGraphFilesToImport
public static Set<String> findGraphFilesToImport( File appDirectory, File editedFile, String fileContent ) { """ Finds all the graph files that can be imported. @param appDirectory the application's directory @param editedFile the graph file that is being edited @param fileContent the file content (not null) @return a non-null set of (relative) file paths """ File graphDir = new File( appDirectory, Constants.PROJECT_DIR_GRAPH ); return findFilesToImport( graphDir, Constants.FILE_EXT_GRAPH, editedFile, fileContent ); }
java
public static Set<String> findGraphFilesToImport( File appDirectory, File editedFile, String fileContent ) { File graphDir = new File( appDirectory, Constants.PROJECT_DIR_GRAPH ); return findFilesToImport( graphDir, Constants.FILE_EXT_GRAPH, editedFile, fileContent ); }
[ "public", "static", "Set", "<", "String", ">", "findGraphFilesToImport", "(", "File", "appDirectory", ",", "File", "editedFile", ",", "String", "fileContent", ")", "{", "File", "graphDir", "=", "new", "File", "(", "appDirectory", ",", "Constants", ".", "PROJEC...
Finds all the graph files that can be imported. @param appDirectory the application's directory @param editedFile the graph file that is being edited @param fileContent the file content (not null) @return a non-null set of (relative) file paths
[ "Finds", "all", "the", "graph", "files", "that", "can", "be", "imported", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/autocompletion/CompletionUtils.java#L76-L80
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/JspHelper.java
JspHelper.bestNode
public DatanodeInfo[] bestNode(LocatedBlocks blks) throws IOException { """ Get an array of nodes that can serve the streaming request The best one is the first in the array which has maximum local copies of all blocks """ // insert all known replica locations into a tree map where the // key is the DatanodeInfo TreeMap<DatanodeInfo, NodeRecord> map = new TreeMap<DatanodeInfo, NodeRecord>(); for (int i = 0; i < blks.getLocatedBlocks().size(); i++) { DatanodeInfo [] nodes = blks.get(i).getLocations(); for (int j = 0; j < nodes.length; j++) { NodeRecord obj = map.get(nodes[j]); if (obj != null) { obj.frequency++; } else { map.put(nodes[j], new NodeRecord(nodes[j], 1)); } } } // sort all locations by their frequency of occurance Collection<NodeRecord> values = map.values(); NodeRecord[] nodes = (NodeRecord[]) values.toArray(new NodeRecord[values.size()]); Arrays.sort(nodes, new NodeRecordComparator()); try { List<NodeRecord> candidates = bestNode(nodes, false); return candidates.toArray(new DatanodeInfo[candidates.size()]); } catch (IOException e) { return new DatanodeInfo[] {randomNode()}; } }
java
public DatanodeInfo[] bestNode(LocatedBlocks blks) throws IOException { // insert all known replica locations into a tree map where the // key is the DatanodeInfo TreeMap<DatanodeInfo, NodeRecord> map = new TreeMap<DatanodeInfo, NodeRecord>(); for (int i = 0; i < blks.getLocatedBlocks().size(); i++) { DatanodeInfo [] nodes = blks.get(i).getLocations(); for (int j = 0; j < nodes.length; j++) { NodeRecord obj = map.get(nodes[j]); if (obj != null) { obj.frequency++; } else { map.put(nodes[j], new NodeRecord(nodes[j], 1)); } } } // sort all locations by their frequency of occurance Collection<NodeRecord> values = map.values(); NodeRecord[] nodes = (NodeRecord[]) values.toArray(new NodeRecord[values.size()]); Arrays.sort(nodes, new NodeRecordComparator()); try { List<NodeRecord> candidates = bestNode(nodes, false); return candidates.toArray(new DatanodeInfo[candidates.size()]); } catch (IOException e) { return new DatanodeInfo[] {randomNode()}; } }
[ "public", "DatanodeInfo", "[", "]", "bestNode", "(", "LocatedBlocks", "blks", ")", "throws", "IOException", "{", "// insert all known replica locations into a tree map where the", "// key is the DatanodeInfo", "TreeMap", "<", "DatanodeInfo", ",", "NodeRecord", ">", "map", "...
Get an array of nodes that can serve the streaming request The best one is the first in the array which has maximum local copies of all blocks
[ "Get", "an", "array", "of", "nodes", "that", "can", "serve", "the", "streaming", "request", "The", "best", "one", "is", "the", "first", "in", "the", "array", "which", "has", "maximum", "local", "copies", "of", "all", "blocks" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JspHelper.java#L117-L144
alkacon/opencms-core
src/org/opencms/configuration/CmsParameterConfiguration.java
CmsParameterConfiguration.put
@Override public String put(String key, String value) { """ Set a parameter for this configuration.<p> If the parameter already exists then the existing value will be replaced.<p> @param key the parameter to set @param value the value to set @return the previous String value from the parameter map """ String result = remove(key); add(key, value, false); return result; }
java
@Override public String put(String key, String value) { String result = remove(key); add(key, value, false); return result; }
[ "@", "Override", "public", "String", "put", "(", "String", "key", ",", "String", "value", ")", "{", "String", "result", "=", "remove", "(", "key", ")", ";", "add", "(", "key", ",", "value", ",", "false", ")", ";", "return", "result", ";", "}" ]
Set a parameter for this configuration.<p> If the parameter already exists then the existing value will be replaced.<p> @param key the parameter to set @param value the value to set @return the previous String value from the parameter map
[ "Set", "a", "parameter", "for", "this", "configuration", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsParameterConfiguration.java#L759-L765
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/abst/fiducial/FourPointSyntheticStability.java
FourPointSyntheticStability.computeStability
public void computeStability(Se3_F64 targetToCamera , double disturbance, FiducialStability results) { """ Estimate how sensitive this observation is to pixel noise @param targetToCamera Observed target to camera pose estimate @param disturbance How much the observation should be noised up, in pixels @param results description how how sensitive the stability estimate is @return true if stability could be computed """ targetToCamera.invert(referenceCameraToTarget); maxOrientation = 0; maxLocation = 0; Point3D_F64 cameraPt = new Point3D_F64(); for (int i = 0; i < points2D3D.size(); i++) { Point2D3D p23 = points2D3D.get(i); targetToCamera.transform(p23.location,cameraPt); p23.observation.x = cameraPt.x/cameraPt.z; p23.observation.y = cameraPt.y/cameraPt.z; refNorm.get(i).set(p23.observation); normToPixel.compute(p23.observation.x,p23.observation.y,refPixels.get(i)); } for (int i = 0; i < points2D3D.size(); i++) { // see what happens if you tweak this observation a little bit perturb( disturbance, refPixels.get(i), points2D3D.get(i)); // set it back to the nominal value points2D3D.get(i).observation.set(refNorm.get(i)); } results.location = maxLocation; results.orientation = maxOrientation; }
java
public void computeStability(Se3_F64 targetToCamera , double disturbance, FiducialStability results) { targetToCamera.invert(referenceCameraToTarget); maxOrientation = 0; maxLocation = 0; Point3D_F64 cameraPt = new Point3D_F64(); for (int i = 0; i < points2D3D.size(); i++) { Point2D3D p23 = points2D3D.get(i); targetToCamera.transform(p23.location,cameraPt); p23.observation.x = cameraPt.x/cameraPt.z; p23.observation.y = cameraPt.y/cameraPt.z; refNorm.get(i).set(p23.observation); normToPixel.compute(p23.observation.x,p23.observation.y,refPixels.get(i)); } for (int i = 0; i < points2D3D.size(); i++) { // see what happens if you tweak this observation a little bit perturb( disturbance, refPixels.get(i), points2D3D.get(i)); // set it back to the nominal value points2D3D.get(i).observation.set(refNorm.get(i)); } results.location = maxLocation; results.orientation = maxOrientation; }
[ "public", "void", "computeStability", "(", "Se3_F64", "targetToCamera", ",", "double", "disturbance", ",", "FiducialStability", "results", ")", "{", "targetToCamera", ".", "invert", "(", "referenceCameraToTarget", ")", ";", "maxOrientation", "=", "0", ";", "maxLocat...
Estimate how sensitive this observation is to pixel noise @param targetToCamera Observed target to camera pose estimate @param disturbance How much the observation should be noised up, in pixels @param results description how how sensitive the stability estimate is @return true if stability could be computed
[ "Estimate", "how", "sensitive", "this", "observation", "is", "to", "pixel", "noise" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/abst/fiducial/FourPointSyntheticStability.java#L109-L140
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/GetItemRequest.java
GetItemRequest.setKey
public void setKey(java.util.Map.Entry<String, AttributeValue> hashKey, java.util.Map.Entry<String, AttributeValue> rangeKey) throws IllegalArgumentException { """ Set the hash and range key attributes of the item. <p> For a hash-only table, you only need to provide the hash attribute. For a hash-and-range table, you must provide both. @param hashKey a map entry including the name and value of the primary hash key. @param rangeKey a map entry including the name and value of the primary range key, or null if it is a hash-only table. """ java.util.HashMap<String, AttributeValue> key = new java.util.HashMap<String, AttributeValue>(); if (hashKey != null) { key.put(hashKey.getKey(), hashKey.getValue()); } else { throw new IllegalArgumentException("hashKey must be non-null object."); } if (rangeKey != null) { key.put(rangeKey.getKey(), rangeKey.getValue()); } setKey(key); }
java
public void setKey(java.util.Map.Entry<String, AttributeValue> hashKey, java.util.Map.Entry<String, AttributeValue> rangeKey) throws IllegalArgumentException { java.util.HashMap<String, AttributeValue> key = new java.util.HashMap<String, AttributeValue>(); if (hashKey != null) { key.put(hashKey.getKey(), hashKey.getValue()); } else { throw new IllegalArgumentException("hashKey must be non-null object."); } if (rangeKey != null) { key.put(rangeKey.getKey(), rangeKey.getValue()); } setKey(key); }
[ "public", "void", "setKey", "(", "java", ".", "util", ".", "Map", ".", "Entry", "<", "String", ",", "AttributeValue", ">", "hashKey", ",", "java", ".", "util", ".", "Map", ".", "Entry", "<", "String", ",", "AttributeValue", ">", "rangeKey", ")", "throw...
Set the hash and range key attributes of the item. <p> For a hash-only table, you only need to provide the hash attribute. For a hash-and-range table, you must provide both. @param hashKey a map entry including the name and value of the primary hash key. @param rangeKey a map entry including the name and value of the primary range key, or null if it is a hash-only table.
[ "Set", "the", "hash", "and", "range", "key", "attributes", "of", "the", "item", ".", "<p", ">", "For", "a", "hash", "-", "only", "table", "you", "only", "need", "to", "provide", "the", "hash", "attribute", ".", "For", "a", "hash", "-", "and", "-", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/GetItemRequest.java#L1088-L1100
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java
KeyedStream.asQueryableState
@PublicEvolving public QueryableStateStream<KEY, T> asQueryableState(String queryableStateName) { """ Publishes the keyed stream as queryable ValueState instance. @param queryableStateName Name under which to the publish the queryable state instance @return Queryable state instance """ ValueStateDescriptor<T> valueStateDescriptor = new ValueStateDescriptor<T>( UUID.randomUUID().toString(), getType()); return asQueryableState(queryableStateName, valueStateDescriptor); }
java
@PublicEvolving public QueryableStateStream<KEY, T> asQueryableState(String queryableStateName) { ValueStateDescriptor<T> valueStateDescriptor = new ValueStateDescriptor<T>( UUID.randomUUID().toString(), getType()); return asQueryableState(queryableStateName, valueStateDescriptor); }
[ "@", "PublicEvolving", "public", "QueryableStateStream", "<", "KEY", ",", "T", ">", "asQueryableState", "(", "String", "queryableStateName", ")", "{", "ValueStateDescriptor", "<", "T", ">", "valueStateDescriptor", "=", "new", "ValueStateDescriptor", "<", "T", ">", ...
Publishes the keyed stream as queryable ValueState instance. @param queryableStateName Name under which to the publish the queryable state instance @return Queryable state instance
[ "Publishes", "the", "keyed", "stream", "as", "queryable", "ValueState", "instance", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java#L1003-L1010
sundrio/sundrio
codegen/src/main/java/io/sundr/codegen/utils/Setter.java
Setter.isApplicable
private static boolean isApplicable(Method method, Property property, boolean strict) { """ Returns true if method is a getter of property. In strict mode it will not strip non-alphanumeric characters. """ if (method.getArguments().size() != 1) { return false; } if (!method.getArguments().get(0).getTypeRef().equals(property.getTypeRef())) { return false; } String capitalized = capitalizeFirst(property.getName()); if (method.getName().endsWith("set" + capitalized)) { return true; } if (!strict && method.getName().endsWith("set" + property.getNameCapitalized())) { return true; } return false; }
java
private static boolean isApplicable(Method method, Property property, boolean strict) { if (method.getArguments().size() != 1) { return false; } if (!method.getArguments().get(0).getTypeRef().equals(property.getTypeRef())) { return false; } String capitalized = capitalizeFirst(property.getName()); if (method.getName().endsWith("set" + capitalized)) { return true; } if (!strict && method.getName().endsWith("set" + property.getNameCapitalized())) { return true; } return false; }
[ "private", "static", "boolean", "isApplicable", "(", "Method", "method", ",", "Property", "property", ",", "boolean", "strict", ")", "{", "if", "(", "method", ".", "getArguments", "(", ")", ".", "size", "(", ")", "!=", "1", ")", "{", "return", "false", ...
Returns true if method is a getter of property. In strict mode it will not strip non-alphanumeric characters.
[ "Returns", "true", "if", "method", "is", "a", "getter", "of", "property", ".", "In", "strict", "mode", "it", "will", "not", "strip", "non", "-", "alphanumeric", "characters", "." ]
train
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/codegen/src/main/java/io/sundr/codegen/utils/Setter.java#L45-L63
attribyte/acp
src/main/java/org/attribyte/sql/pool/TypesafeConfig.java
TypesafeConfig.createConnection
static JDBConnection createConnection(final String connectionName, final Config baseConfig, final Config globalPropertyConfig) throws InitializationException { """ Creates a connection from properties. @throws InitializationException if required parameters are unspecified. """ Config connectionRef = ConfigFactory.load().getObject("acp.defaults.connection").toConfig(); Config config = baseConfig.withFallback(connectionRef); final String user = getString(config, "user"); final String password = getString(config, "password"); final String testSQL = getString(config, "testSQL", ""); String connectionString = getString(config, "connectionString"); final boolean debug = getString(config, "debug", "false").equalsIgnoreCase("true"); final long createTimeoutMillis = getMilliseconds(config, "createTimeout"); final long testIntervalMillis = getMilliseconds(config, "testInterval"); String propsRef = getString(config, "properties", ""); Config propsConfig; if(propsRef.length() > 0) { if(globalPropertyConfig.hasPath(propsRef)) { propsConfig = globalPropertyConfig.getObject(propsRef).toConfig(); } else { throw new InitializationException("The referenced global properties, '" + propsRef + "' is not defined"); } connectionString = buildConnectionString(connectionString, propsConfig); } return new JDBConnection(connectionName, user, password, connectionString, createTimeoutMillis, testSQL.length() > 0 ? testSQL : null, testIntervalMillis, debug); }
java
static JDBConnection createConnection(final String connectionName, final Config baseConfig, final Config globalPropertyConfig) throws InitializationException { Config connectionRef = ConfigFactory.load().getObject("acp.defaults.connection").toConfig(); Config config = baseConfig.withFallback(connectionRef); final String user = getString(config, "user"); final String password = getString(config, "password"); final String testSQL = getString(config, "testSQL", ""); String connectionString = getString(config, "connectionString"); final boolean debug = getString(config, "debug", "false").equalsIgnoreCase("true"); final long createTimeoutMillis = getMilliseconds(config, "createTimeout"); final long testIntervalMillis = getMilliseconds(config, "testInterval"); String propsRef = getString(config, "properties", ""); Config propsConfig; if(propsRef.length() > 0) { if(globalPropertyConfig.hasPath(propsRef)) { propsConfig = globalPropertyConfig.getObject(propsRef).toConfig(); } else { throw new InitializationException("The referenced global properties, '" + propsRef + "' is not defined"); } connectionString = buildConnectionString(connectionString, propsConfig); } return new JDBConnection(connectionName, user, password, connectionString, createTimeoutMillis, testSQL.length() > 0 ? testSQL : null, testIntervalMillis, debug); }
[ "static", "JDBConnection", "createConnection", "(", "final", "String", "connectionName", ",", "final", "Config", "baseConfig", ",", "final", "Config", "globalPropertyConfig", ")", "throws", "InitializationException", "{", "Config", "connectionRef", "=", "ConfigFactory", ...
Creates a connection from properties. @throws InitializationException if required parameters are unspecified.
[ "Creates", "a", "connection", "from", "properties", "." ]
train
https://github.com/attribyte/acp/blob/dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659/src/main/java/org/attribyte/sql/pool/TypesafeConfig.java#L344-L378
ist-dresden/composum
sling/core/commons/src/main/java/com/composum/sling/clientlibs/processor/ProcessingVisitor.java
ProcessingVisitor.alreadyProcessed
@Override protected void alreadyProcessed(ClientlibRef ref, VisitorMode mode, ClientlibResourceFolder folder) { """ Warns about everything that should be embedded, but is already processed, and not in this """ if (mode == EMBEDDED) { LOG.warn("Trying to embed already embedded / dependency {} again at {}", ref, folder); } }
java
@Override protected void alreadyProcessed(ClientlibRef ref, VisitorMode mode, ClientlibResourceFolder folder) { if (mode == EMBEDDED) { LOG.warn("Trying to embed already embedded / dependency {} again at {}", ref, folder); } }
[ "@", "Override", "protected", "void", "alreadyProcessed", "(", "ClientlibRef", "ref", ",", "VisitorMode", "mode", ",", "ClientlibResourceFolder", "folder", ")", "{", "if", "(", "mode", "==", "EMBEDDED", ")", "{", "LOG", ".", "warn", "(", "\"Trying to embed alrea...
Warns about everything that should be embedded, but is already processed, and not in this
[ "Warns", "about", "everything", "that", "should", "be", "embedded", "but", "is", "already", "processed", "and", "not", "in", "this" ]
train
https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/clientlibs/processor/ProcessingVisitor.java#L87-L92
redkale/redkale
src/org/redkale/asm/ModuleVisitor.java
ModuleVisitor.visitOpen
public void visitOpen(String packaze, int access, String... modules) { """ Visit an open package of the current module. @param packaze the qualified name of the opened package. @param access the access flag of the opened package, valid values are among {@code ACC_SYNTHETIC} and {@code ACC_MANDATED}. @param modules the qualified names of the modules that can use deep reflection to the classes of the open package or <tt>null</tt>. """ if (mv != null) { mv.visitOpen(packaze, access, modules); } }
java
public void visitOpen(String packaze, int access, String... modules) { if (mv != null) { mv.visitOpen(packaze, access, modules); } }
[ "public", "void", "visitOpen", "(", "String", "packaze", ",", "int", "access", ",", "String", "...", "modules", ")", "{", "if", "(", "mv", "!=", "null", ")", "{", "mv", ".", "visitOpen", "(", "packaze", ",", "access", ",", "modules", ")", ";", "}", ...
Visit an open package of the current module. @param packaze the qualified name of the opened package. @param access the access flag of the opened package, valid values are among {@code ACC_SYNTHETIC} and {@code ACC_MANDATED}. @param modules the qualified names of the modules that can use deep reflection to the classes of the open package or <tt>null</tt>.
[ "Visit", "an", "open", "package", "of", "the", "current", "module", "." ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/asm/ModuleVisitor.java#L179-L183
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java
MapUtils.buildClickLatLngBoundingBox
public static LatLngBoundingBox buildClickLatLngBoundingBox(LatLng latLng, View view, GoogleMap map, float screenClickPercentage) { """ Build a lat lng bounding box using the click location, map view, map, and screen percentage tolerance. The bounding box can be used to query for features that were clicked @param latLng click location @param view map view @param map map @param screenClickPercentage screen click percentage between 0.0 and 1.0 for how close a feature on the screen must be to be included in a click query @return lat lng bounding box """ // Get the screen width and height a click occurs from a feature int width = (int) Math.round(view.getWidth() * screenClickPercentage); int height = (int) Math.round(view.getHeight() * screenClickPercentage); // Get the screen click location Projection projection = map.getProjection(); android.graphics.Point clickLocation = projection.toScreenLocation(latLng); // Get the screen click locations in each width or height direction android.graphics.Point left = new android.graphics.Point(clickLocation); android.graphics.Point up = new android.graphics.Point(clickLocation); android.graphics.Point right = new android.graphics.Point(clickLocation); android.graphics.Point down = new android.graphics.Point(clickLocation); left.offset(-width, 0); up.offset(0, -height); right.offset(width, 0); down.offset(0, height); // Get the coordinates of the bounding box points LatLng leftCoordinate = projection.fromScreenLocation(left); LatLng upCoordinate = projection.fromScreenLocation(up); LatLng rightCoordinate = projection.fromScreenLocation(right); LatLng downCoordinate = projection.fromScreenLocation(down); LatLngBoundingBox latLngBoundingBox = new LatLngBoundingBox(leftCoordinate, upCoordinate, rightCoordinate, downCoordinate); return latLngBoundingBox; }
java
public static LatLngBoundingBox buildClickLatLngBoundingBox(LatLng latLng, View view, GoogleMap map, float screenClickPercentage) { // Get the screen width and height a click occurs from a feature int width = (int) Math.round(view.getWidth() * screenClickPercentage); int height = (int) Math.round(view.getHeight() * screenClickPercentage); // Get the screen click location Projection projection = map.getProjection(); android.graphics.Point clickLocation = projection.toScreenLocation(latLng); // Get the screen click locations in each width or height direction android.graphics.Point left = new android.graphics.Point(clickLocation); android.graphics.Point up = new android.graphics.Point(clickLocation); android.graphics.Point right = new android.graphics.Point(clickLocation); android.graphics.Point down = new android.graphics.Point(clickLocation); left.offset(-width, 0); up.offset(0, -height); right.offset(width, 0); down.offset(0, height); // Get the coordinates of the bounding box points LatLng leftCoordinate = projection.fromScreenLocation(left); LatLng upCoordinate = projection.fromScreenLocation(up); LatLng rightCoordinate = projection.fromScreenLocation(right); LatLng downCoordinate = projection.fromScreenLocation(down); LatLngBoundingBox latLngBoundingBox = new LatLngBoundingBox(leftCoordinate, upCoordinate, rightCoordinate, downCoordinate); return latLngBoundingBox; }
[ "public", "static", "LatLngBoundingBox", "buildClickLatLngBoundingBox", "(", "LatLng", "latLng", ",", "View", "view", ",", "GoogleMap", "map", ",", "float", "screenClickPercentage", ")", "{", "// Get the screen width and height a click occurs from a feature", "int", "width", ...
Build a lat lng bounding box using the click location, map view, map, and screen percentage tolerance. The bounding box can be used to query for features that were clicked @param latLng click location @param view map view @param map map @param screenClickPercentage screen click percentage between 0.0 and 1.0 for how close a feature on the screen must be to be included in a click query @return lat lng bounding box
[ "Build", "a", "lat", "lng", "bounding", "box", "using", "the", "click", "location", "map", "view", "map", "and", "screen", "percentage", "tolerance", ".", "The", "bounding", "box", "can", "be", "used", "to", "query", "for", "features", "that", "were", "cli...
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java#L185-L214
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
JavacProcessingEnvironment.importStringToPattern
private static Pattern importStringToPattern(boolean allowModules, String s, Processor p, Log log) { """ Convert import-style string for supported annotations into a regex matching that string. If the string is not a valid import-style string, return a regex that won't match anything. """ String module; String pkg; int slash = s.indexOf('/'); if (slash == (-1)) { if (s.equals("*")) { return MatchingUtils.validImportStringToPattern(s); } module = allowModules ? ".*/" : ""; pkg = s; } else { module = Pattern.quote(s.substring(0, slash + 1)); pkg = s.substring(slash + 1); } if (MatchingUtils.isValidImportString(pkg)) { return Pattern.compile(module + MatchingUtils.validImportStringToPatternString(pkg)); } else { log.warning("proc.malformed.supported.string", s, p.getClass().getName()); return noMatches; // won't match any valid identifier } }
java
private static Pattern importStringToPattern(boolean allowModules, String s, Processor p, Log log) { String module; String pkg; int slash = s.indexOf('/'); if (slash == (-1)) { if (s.equals("*")) { return MatchingUtils.validImportStringToPattern(s); } module = allowModules ? ".*/" : ""; pkg = s; } else { module = Pattern.quote(s.substring(0, slash + 1)); pkg = s.substring(slash + 1); } if (MatchingUtils.isValidImportString(pkg)) { return Pattern.compile(module + MatchingUtils.validImportStringToPatternString(pkg)); } else { log.warning("proc.malformed.supported.string", s, p.getClass().getName()); return noMatches; // won't match any valid identifier } }
[ "private", "static", "Pattern", "importStringToPattern", "(", "boolean", "allowModules", ",", "String", "s", ",", "Processor", "p", ",", "Log", "log", ")", "{", "String", "module", ";", "String", "pkg", ";", "int", "slash", "=", "s", ".", "indexOf", "(", ...
Convert import-style string for supported annotations into a regex matching that string. If the string is not a valid import-style string, return a regex that won't match anything.
[ "Convert", "import", "-", "style", "string", "for", "supported", "annotations", "into", "a", "regex", "matching", "that", "string", ".", "If", "the", "string", "is", "not", "a", "valid", "import", "-", "style", "string", "return", "a", "regex", "that", "wo...
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java#L1668-L1688
qos-ch/slf4j
slf4j-ext/src/main/java/org/slf4j/ext/XLogger.java
XLogger.throwing
public <T extends Throwable> T throwing(Level level, T throwable) { """ Log an exception being thrown allowing the log level to be specified. @param level the logging level to use. @param throwable the exception being caught. """ if (instanceofLAL) { ((LocationAwareLogger) logger).log(THROWING_MARKER, FQCN, level.level, "throwing", null, throwable); } return throwable; }
java
public <T extends Throwable> T throwing(Level level, T throwable) { if (instanceofLAL) { ((LocationAwareLogger) logger).log(THROWING_MARKER, FQCN, level.level, "throwing", null, throwable); } return throwable; }
[ "public", "<", "T", "extends", "Throwable", ">", "T", "throwing", "(", "Level", "level", ",", "T", "throwable", ")", "{", "if", "(", "instanceofLAL", ")", "{", "(", "(", "LocationAwareLogger", ")", "logger", ")", ".", "log", "(", "THROWING_MARKER", ",", ...
Log an exception being thrown allowing the log level to be specified. @param level the logging level to use. @param throwable the exception being caught.
[ "Log", "an", "exception", "being", "thrown", "allowing", "the", "log", "level", "to", "be", "specified", "." ]
train
https://github.com/qos-ch/slf4j/blob/905443f39fadd88a8dd2c467e44affd8cb072a4d/slf4j-ext/src/main/java/org/slf4j/ext/XLogger.java#L172-L177
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java
JDBC4CallableStatement.setString
@Override public void setString(String parameterName, String x) throws SQLException { """ Sets the designated parameter to the given Java String value. """ checkClosed(); throw SQLError.noSupport(); }
java
@Override public void setString(String parameterName, String x) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
[ "@", "Override", "public", "void", "setString", "(", "String", "parameterName", ",", "String", "x", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "throw", "SQLError", ".", "noSupport", "(", ")", ";", "}" ]
Sets the designated parameter to the given Java String value.
[ "Sets", "the", "designated", "parameter", "to", "the", "given", "Java", "String", "value", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java#L879-L884
fuinorg/utils4j
src/main/java/org/fuin/utils4j/PropertiesUtils.java
PropertiesUtils.loadProperties
public static Properties loadProperties(final Class<?> clasz, final String filename) { """ Load properties from classpath. @param clasz Class in the same package as the properties file - Cannot be <code>null</code>. @param filename Name of the properties file (without path) - Cannot be <code>null</code>. @return Properties. """ checkNotNull("clasz", clasz); checkNotNull("filename", filename); final String path = getPackagePath(clasz); final String resPath = path + "/" + filename; return loadProperties(clasz.getClassLoader(), resPath); }
java
public static Properties loadProperties(final Class<?> clasz, final String filename) { checkNotNull("clasz", clasz); checkNotNull("filename", filename); final String path = getPackagePath(clasz); final String resPath = path + "/" + filename; return loadProperties(clasz.getClassLoader(), resPath); }
[ "public", "static", "Properties", "loadProperties", "(", "final", "Class", "<", "?", ">", "clasz", ",", "final", "String", "filename", ")", "{", "checkNotNull", "(", "\"clasz\"", ",", "clasz", ")", ";", "checkNotNull", "(", "\"filename\"", ",", "filename", "...
Load properties from classpath. @param clasz Class in the same package as the properties file - Cannot be <code>null</code>. @param filename Name of the properties file (without path) - Cannot be <code>null</code>. @return Properties.
[ "Load", "properties", "from", "classpath", "." ]
train
https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/PropertiesUtils.java#L57-L65
samskivert/samskivert
src/main/java/com/samskivert/util/StringUtil.java
StringUtil.parseFloatArray
public static float[] parseFloatArray (String source) { """ Parses an array of floats from it's string representation. The array should be represented as a bare list of numbers separated by commas, for example: <pre>25.0, .5, 1, 0.99</pre> Any inability to parse the array will result in the function returning null. """ StringTokenizer tok = new StringTokenizer(source, ","); float[] vals = new float[tok.countTokens()]; for (int i = 0; tok.hasMoreTokens(); i++) { try { // trim the whitespace from the token vals[i] = Float.parseFloat(tok.nextToken().trim()); } catch (NumberFormatException nfe) { return null; } } return vals; }
java
public static float[] parseFloatArray (String source) { StringTokenizer tok = new StringTokenizer(source, ","); float[] vals = new float[tok.countTokens()]; for (int i = 0; tok.hasMoreTokens(); i++) { try { // trim the whitespace from the token vals[i] = Float.parseFloat(tok.nextToken().trim()); } catch (NumberFormatException nfe) { return null; } } return vals; }
[ "public", "static", "float", "[", "]", "parseFloatArray", "(", "String", "source", ")", "{", "StringTokenizer", "tok", "=", "new", "StringTokenizer", "(", "source", ",", "\",\"", ")", ";", "float", "[", "]", "vals", "=", "new", "float", "[", "tok", ".", ...
Parses an array of floats from it's string representation. The array should be represented as a bare list of numbers separated by commas, for example: <pre>25.0, .5, 1, 0.99</pre> Any inability to parse the array will result in the function returning null.
[ "Parses", "an", "array", "of", "floats", "from", "it", "s", "string", "representation", ".", "The", "array", "should", "be", "represented", "as", "a", "bare", "list", "of", "numbers", "separated", "by", "commas", "for", "example", ":" ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/StringUtil.java#L844-L857
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java
MariaDbDatabaseMetaData.catalogCond
private String catalogCond(String columnName, String catalog) { """ Generate part of the information schema query that restricts catalog names In the driver, catalogs is the equivalent to MariaDB schemas. @param columnName - column name in the information schema table @param catalog - catalog name. This driver does not (always) follow JDBC standard for following special values, due to ConnectorJ compatibility 1. empty string ("") - matches current catalog (i.e database). JDBC standard says only tables without catalog should be returned - such tables do not exist in MariaDB. If there is no current catalog, then empty string matches any catalog. 2. null - if nullCatalogMeansCurrent=true (which is the default), then the handling is the same as for "" . i.e return current catalog.JDBC-conforming way would be to match any catalog with null parameter. This can be switched with nullCatalogMeansCurrent=false in the connection URL. @return part of SQL query ,that restricts search for the catalog. """ if (catalog == null) { /* Treat null catalog as current */ if (connection.nullCatalogMeansCurrent) { return "(ISNULL(database()) OR (" + columnName + " = database()))"; } return "(1 = 1)"; } if (catalog.isEmpty()) { return "(ISNULL(database()) OR (" + columnName + " = database()))"; } return "(" + columnName + " = " + escapeQuote(catalog) + ")"; }
java
private String catalogCond(String columnName, String catalog) { if (catalog == null) { /* Treat null catalog as current */ if (connection.nullCatalogMeansCurrent) { return "(ISNULL(database()) OR (" + columnName + " = database()))"; } return "(1 = 1)"; } if (catalog.isEmpty()) { return "(ISNULL(database()) OR (" + columnName + " = database()))"; } return "(" + columnName + " = " + escapeQuote(catalog) + ")"; }
[ "private", "String", "catalogCond", "(", "String", "columnName", ",", "String", "catalog", ")", "{", "if", "(", "catalog", "==", "null", ")", "{", "/* Treat null catalog as current */", "if", "(", "connection", ".", "nullCatalogMeansCurrent", ")", "{", "return", ...
Generate part of the information schema query that restricts catalog names In the driver, catalogs is the equivalent to MariaDB schemas. @param columnName - column name in the information schema table @param catalog - catalog name. This driver does not (always) follow JDBC standard for following special values, due to ConnectorJ compatibility 1. empty string ("") - matches current catalog (i.e database). JDBC standard says only tables without catalog should be returned - such tables do not exist in MariaDB. If there is no current catalog, then empty string matches any catalog. 2. null - if nullCatalogMeansCurrent=true (which is the default), then the handling is the same as for "" . i.e return current catalog.JDBC-conforming way would be to match any catalog with null parameter. This can be switched with nullCatalogMeansCurrent=false in the connection URL. @return part of SQL query ,that restricts search for the catalog.
[ "Generate", "part", "of", "the", "information", "schema", "query", "that", "restricts", "catalog", "names", "In", "the", "driver", "catalogs", "is", "the", "equivalent", "to", "MariaDB", "schemas", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java#L502-L515
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java
ControlContainerContext.addResourceContext
protected synchronized void addResourceContext(ResourceContext resourceContext, ControlBean bean) { """ Adds a new managed ResourceContext to the ControlContainerContext. This method is used to register a resource context that has just acquired resources @param resourceContext the ResourceContext service that has acquired resources @param bean the acquiring ControlBean. Unused by the base implementation, but available so subclassed containers can have access to the bean. """ if (!resourceContext.hasResources()) _resourceContexts.push(resourceContext); }
java
protected synchronized void addResourceContext(ResourceContext resourceContext, ControlBean bean) { if (!resourceContext.hasResources()) _resourceContexts.push(resourceContext); }
[ "protected", "synchronized", "void", "addResourceContext", "(", "ResourceContext", "resourceContext", ",", "ControlBean", "bean", ")", "{", "if", "(", "!", "resourceContext", ".", "hasResources", "(", ")", ")", "_resourceContexts", ".", "push", "(", "resourceContext...
Adds a new managed ResourceContext to the ControlContainerContext. This method is used to register a resource context that has just acquired resources @param resourceContext the ResourceContext service that has acquired resources @param bean the acquiring ControlBean. Unused by the base implementation, but available so subclassed containers can have access to the bean.
[ "Adds", "a", "new", "managed", "ResourceContext", "to", "the", "ControlContainerContext", ".", "This", "method", "is", "used", "to", "register", "a", "resource", "context", "that", "has", "just", "acquired", "resources" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java#L99-L103
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WPartialDateField.java
WPartialDateField.getYear
public Integer getYear() { """ Returns the year value. @return the year, or null if unspecified. """ String dateValue = getValue(); if (dateValue != null && dateValue.length() >= YEAR_END) { return parseDateComponent(dateValue.substring(YEAR_START, YEAR_END), getPaddingChar()); } else { return null; } }
java
public Integer getYear() { String dateValue = getValue(); if (dateValue != null && dateValue.length() >= YEAR_END) { return parseDateComponent(dateValue.substring(YEAR_START, YEAR_END), getPaddingChar()); } else { return null; } }
[ "public", "Integer", "getYear", "(", ")", "{", "String", "dateValue", "=", "getValue", "(", ")", ";", "if", "(", "dateValue", "!=", "null", "&&", "dateValue", ".", "length", "(", ")", ">=", "YEAR_END", ")", "{", "return", "parseDateComponent", "(", "date...
Returns the year value. @return the year, or null if unspecified.
[ "Returns", "the", "year", "value", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WPartialDateField.java#L527-L535
BellaDati/belladati-sdk-api
src/main/java/com/belladati/sdk/dataset/data/DataTable.java
DataTable.createDetailedInstance
public static DataTable createDetailedInstance(DataColumn firstColumn, DataColumn... otherColumns) { """ Creates a new instance with the given column setup. At least one column must be specified in the table. Rows are allowed to be empty. <p> Columns should be unique, but the table doesn't enforce this. @param firstColumn first column @param otherColumns additional, optional columns @return new detailed instance """ List<DataColumn> list = new ArrayList<DataColumn>(); list.add(firstColumn); for (DataColumn column : otherColumns) { list.add(column); } return createDetailedInstance(list); }
java
public static DataTable createDetailedInstance(DataColumn firstColumn, DataColumn... otherColumns) { List<DataColumn> list = new ArrayList<DataColumn>(); list.add(firstColumn); for (DataColumn column : otherColumns) { list.add(column); } return createDetailedInstance(list); }
[ "public", "static", "DataTable", "createDetailedInstance", "(", "DataColumn", "firstColumn", ",", "DataColumn", "...", "otherColumns", ")", "{", "List", "<", "DataColumn", ">", "list", "=", "new", "ArrayList", "<", "DataColumn", ">", "(", ")", ";", "list", "."...
Creates a new instance with the given column setup. At least one column must be specified in the table. Rows are allowed to be empty. <p> Columns should be unique, but the table doesn't enforce this. @param firstColumn first column @param otherColumns additional, optional columns @return new detailed instance
[ "Creates", "a", "new", "instance", "with", "the", "given", "column", "setup", ".", "At", "least", "one", "column", "must", "be", "specified", "in", "the", "table", ".", "Rows", "are", "allowed", "to", "be", "empty", ".", "<p", ">", "Columns", "should", ...
train
https://github.com/BellaDati/belladati-sdk-api/blob/ec45a42048d8255838ad0200aa6784a8e8a121c1/src/main/java/com/belladati/sdk/dataset/data/DataTable.java#L75-L82
googleads/googleads-java-lib
examples/admanager_axis/src/main/java/admanager/axis/v201808/workflowrequestservice/GetWorkflowApprovalRequests.java
GetWorkflowApprovalRequests.runExample
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { """ Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors. """ WorkflowRequestServiceInterface workflowRequestService = adManagerServices.get(session, WorkflowRequestServiceInterface.class); // Create a statement to select workflow requests. StatementBuilder statementBuilder = new StatementBuilder() .where("type = :type") .orderBy("id ASC") .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT) .withBindVariableValue("type", WorkflowRequestType.WORKFLOW_APPROVAL_REQUEST.toString()); // Retrieve a small amount of workflow requests at a time, paging through // until all workflow requests have been retrieved. int totalResultSetSize = 0; do { WorkflowRequestPage page = workflowRequestService.getWorkflowRequestsByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { // Print out some information for each workflow request. totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (WorkflowRequest workflowRequest : page.getResults()) { System.out.printf( "%d) Workflow request with ID %d, entity type '%s', and entity ID %d was found.%n", i++, workflowRequest.getId(), workflowRequest.getEntityType(), workflowRequest.getEntityId() ); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); }
java
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { WorkflowRequestServiceInterface workflowRequestService = adManagerServices.get(session, WorkflowRequestServiceInterface.class); // Create a statement to select workflow requests. StatementBuilder statementBuilder = new StatementBuilder() .where("type = :type") .orderBy("id ASC") .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT) .withBindVariableValue("type", WorkflowRequestType.WORKFLOW_APPROVAL_REQUEST.toString()); // Retrieve a small amount of workflow requests at a time, paging through // until all workflow requests have been retrieved. int totalResultSetSize = 0; do { WorkflowRequestPage page = workflowRequestService.getWorkflowRequestsByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { // Print out some information for each workflow request. totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (WorkflowRequest workflowRequest : page.getResults()) { System.out.printf( "%d) Workflow request with ID %d, entity type '%s', and entity ID %d was found.%n", i++, workflowRequest.getId(), workflowRequest.getEntityType(), workflowRequest.getEntityId() ); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); }
[ "public", "static", "void", "runExample", "(", "AdManagerServices", "adManagerServices", ",", "AdManagerSession", "session", ")", "throws", "RemoteException", "{", "WorkflowRequestServiceInterface", "workflowRequestService", "=", "adManagerServices", ".", "get", "(", "sessi...
Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors.
[ "Runs", "the", "example", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201808/workflowrequestservice/GetWorkflowApprovalRequests.java#L53-L91
brianwhu/xillium
gear/src/main/java/org/xillium/gear/auth/DatabaseBackedAuthenticator.java
DatabaseBackedAuthenticator.collectCredential
protected Credential collectCredential(DataBinder parameters) throws NoSuchAlgorithmException, UnsupportedEncodingException { """ /* public void setAuthenticationPage(String page) { _page = page; } """ // allow clients to use either <IdentityName> or USERNAME; if both are present <IdentityName> takes precedence _logger.log(Level.FINE, "looking for {0} in data binder", IdentityName); String id = null; if ((id = parameters.get(IdentityName)) != null && id.length() > 0) { parameters.put(USERNAME, id); } else if ((id = parameters.get(USERNAME)) != null && id.length() > 0) { parameters.put(IdentityName, id); } else { return null; } _logger.log(Level.FINE, "got identity = {0}", id); String password = parameters.remove(PASSWORD); _logger.log(Level.FINE, "got password = {0}", password); if (password != null && password.length() > 0) { return new Credential(id, Strings.hash(password)); } else { return null; } }
java
protected Credential collectCredential(DataBinder parameters) throws NoSuchAlgorithmException, UnsupportedEncodingException { // allow clients to use either <IdentityName> or USERNAME; if both are present <IdentityName> takes precedence _logger.log(Level.FINE, "looking for {0} in data binder", IdentityName); String id = null; if ((id = parameters.get(IdentityName)) != null && id.length() > 0) { parameters.put(USERNAME, id); } else if ((id = parameters.get(USERNAME)) != null && id.length() > 0) { parameters.put(IdentityName, id); } else { return null; } _logger.log(Level.FINE, "got identity = {0}", id); String password = parameters.remove(PASSWORD); _logger.log(Level.FINE, "got password = {0}", password); if (password != null && password.length() > 0) { return new Credential(id, Strings.hash(password)); } else { return null; } }
[ "protected", "Credential", "collectCredential", "(", "DataBinder", "parameters", ")", "throws", "NoSuchAlgorithmException", ",", "UnsupportedEncodingException", "{", "// allow clients to use either <IdentityName> or USERNAME; if both are present <IdentityName> takes precedence", "_logger",...
/* public void setAuthenticationPage(String page) { _page = page; }
[ "/", "*", "public", "void", "setAuthenticationPage", "(", "String", "page", ")", "{", "_page", "=", "page", ";", "}" ]
train
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/gear/src/main/java/org/xillium/gear/auth/DatabaseBackedAuthenticator.java#L71-L91
jenkinsci/jenkins
core/src/main/java/hudson/slaves/Channels.java
Channels.newJVM
public static Channel newJVM(String displayName, TaskListener listener, JVMBuilder vmb, FilePath workDir, ClasspathBuilder classpath) throws IOException { """ Launches a new JVM with the given classpath, establish a communication channel, and return a {@link Channel} to it. @param displayName Human readable name of what this JVM represents. For example "Selenium grid" or "Hadoop". This token is used for messages to {@code listener}. @param listener The progress of the launcher and the failure information will be sent here. Must not be null. @param workDir If non-null, the new JVM will have this directory as the working directory. This must be a local path. @param classpath The classpath of the new JVM. Can be null if you just need {@code agent.jar} (and everything else can be sent over the channel.) But if you have jars that are known to be necessary by the new JVM, setting it here will improve the classloading performance (by avoiding remote class file transfer.) Classes in this classpath will also take precedence over any other classes that's sent via the channel later, so it's also useful for making sure you get the version of the classes you want. @param vmb A partially configured {@link JVMBuilder} that allows the caller to fine-tune the launch parameter. @return never null @since 1.361 """ ServerSocket serverSocket = new ServerSocket(); serverSocket.bind(new InetSocketAddress("localhost",0)); serverSocket.setSoTimeout((int)TimeUnit.SECONDS.toMillis(10)); // use -cp + FQCN instead of -jar since remoting.jar can be rebundled (like in the case of the swarm plugin.) vmb.classpath().addJarOf(Channel.class); vmb.mainClass(Launcher.class); if(classpath!=null) vmb.args().add("-cp").add(classpath); vmb.args().add("-connectTo","localhost:"+serverSocket.getLocalPort()); listener.getLogger().println("Starting "+displayName); Proc p = vmb.launch(new LocalLauncher(listener)).stdout(listener).pwd(workDir).start(); Socket s = serverSocket.accept(); serverSocket.close(); return forProcess("Channel to "+displayName, Computer.threadPoolForRemoting, new BufferedInputStream(SocketChannelStream.in(s)), new BufferedOutputStream(SocketChannelStream.out(s)),null,p); }
java
public static Channel newJVM(String displayName, TaskListener listener, JVMBuilder vmb, FilePath workDir, ClasspathBuilder classpath) throws IOException { ServerSocket serverSocket = new ServerSocket(); serverSocket.bind(new InetSocketAddress("localhost",0)); serverSocket.setSoTimeout((int)TimeUnit.SECONDS.toMillis(10)); // use -cp + FQCN instead of -jar since remoting.jar can be rebundled (like in the case of the swarm plugin.) vmb.classpath().addJarOf(Channel.class); vmb.mainClass(Launcher.class); if(classpath!=null) vmb.args().add("-cp").add(classpath); vmb.args().add("-connectTo","localhost:"+serverSocket.getLocalPort()); listener.getLogger().println("Starting "+displayName); Proc p = vmb.launch(new LocalLauncher(listener)).stdout(listener).pwd(workDir).start(); Socket s = serverSocket.accept(); serverSocket.close(); return forProcess("Channel to "+displayName, Computer.threadPoolForRemoting, new BufferedInputStream(SocketChannelStream.in(s)), new BufferedOutputStream(SocketChannelStream.out(s)),null,p); }
[ "public", "static", "Channel", "newJVM", "(", "String", "displayName", ",", "TaskListener", "listener", ",", "JVMBuilder", "vmb", ",", "FilePath", "workDir", ",", "ClasspathBuilder", "classpath", ")", "throws", "IOException", "{", "ServerSocket", "serverSocket", "="...
Launches a new JVM with the given classpath, establish a communication channel, and return a {@link Channel} to it. @param displayName Human readable name of what this JVM represents. For example "Selenium grid" or "Hadoop". This token is used for messages to {@code listener}. @param listener The progress of the launcher and the failure information will be sent here. Must not be null. @param workDir If non-null, the new JVM will have this directory as the working directory. This must be a local path. @param classpath The classpath of the new JVM. Can be null if you just need {@code agent.jar} (and everything else can be sent over the channel.) But if you have jars that are known to be necessary by the new JVM, setting it here will improve the classloading performance (by avoiding remote class file transfer.) Classes in this classpath will also take precedence over any other classes that's sent via the channel later, so it's also useful for making sure you get the version of the classes you want. @param vmb A partially configured {@link JVMBuilder} that allows the caller to fine-tune the launch parameter. @return never null @since 1.361
[ "Launches", "a", "new", "JVM", "with", "the", "given", "classpath", "establish", "a", "communication", "channel", "and", "return", "a", "{", "@link", "Channel", "}", "to", "it", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/slaves/Channels.java#L211-L233
Putnami/putnami-web-toolkit
core/src/main/java/fr/putnami/pwt/core/widget/client/DocumentMeta.java
DocumentMeta.getDescriptionTag
public static MetaElement getDescriptionTag(String name, boolean createIfMissing) { """ Return the first meta tag from the head section with name matching. <br> If createIfMissing the tag is created and added at the end of the head section.<br> <p> <strong>Note : </strong> the name is case insensitive </p> @param name the name attribute of the metta tag @param createIfMissing create the tag in the head section if missing @return meta tag element or null """ Document doc = Document.get(); HeadElement head = doc.getHead(); assert head != null : "No head section found in the document"; assert name != null : "the name must not be null"; NodeList<Element> tags = head.getElementsByTagName("meta"); MetaElement metaTag = null; for (int i = 0; i < tags.getLength(); i++) { metaTag = (MetaElement) tags.getItem(i); if (name.equalsIgnoreCase(metaTag.getName())) { return metaTag; } } if (createIfMissing) { metaTag = doc.createMetaElement(); metaTag.setName(name); head.appendChild(metaTag); } return metaTag; }
java
public static MetaElement getDescriptionTag(String name, boolean createIfMissing) { Document doc = Document.get(); HeadElement head = doc.getHead(); assert head != null : "No head section found in the document"; assert name != null : "the name must not be null"; NodeList<Element> tags = head.getElementsByTagName("meta"); MetaElement metaTag = null; for (int i = 0; i < tags.getLength(); i++) { metaTag = (MetaElement) tags.getItem(i); if (name.equalsIgnoreCase(metaTag.getName())) { return metaTag; } } if (createIfMissing) { metaTag = doc.createMetaElement(); metaTag.setName(name); head.appendChild(metaTag); } return metaTag; }
[ "public", "static", "MetaElement", "getDescriptionTag", "(", "String", "name", ",", "boolean", "createIfMissing", ")", "{", "Document", "doc", "=", "Document", ".", "get", "(", ")", ";", "HeadElement", "head", "=", "doc", ".", "getHead", "(", ")", ";", "as...
Return the first meta tag from the head section with name matching. <br> If createIfMissing the tag is created and added at the end of the head section.<br> <p> <strong>Note : </strong> the name is case insensitive </p> @param name the name attribute of the metta tag @param createIfMissing create the tag in the head section if missing @return meta tag element or null
[ "Return", "the", "first", "meta", "tag", "from", "the", "head", "section", "with", "name", "matching", ".", "<br", ">", "If", "createIfMissing", "the", "tag", "is", "created", "and", "added", "at", "the", "end", "of", "the", "head", "section", ".", "<br"...
train
https://github.com/Putnami/putnami-web-toolkit/blob/129aa781d1bda508e579d194693ca3034b4d470b/core/src/main/java/fr/putnami/pwt/core/widget/client/DocumentMeta.java#L155-L175
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/RefinePolyLineCorner.java
RefinePolyLineCorner.computeCost
protected double computeCost(List<Point2D_I32> contour, int c0, int c1, int c2, int offset) { """ Computes the distance between the two lines defined by corner points in the contour @param contour list of contour points @param c0 end point of line 0 @param c1 start of line 0 and 1 @param c2 end point of line 1 @param offset added to c1 to make start of lines @return sum of distance of points along contour """ c1 = CircularIndex.addOffset(c1, offset, contour.size()); createLine(c0,c1,contour,line0); createLine(c1,c2,contour,line1); return distanceSum(line0,c0,c1,contour)+distanceSum(line1,c1,c2,contour); }
java
protected double computeCost(List<Point2D_I32> contour, int c0, int c1, int c2, int offset) { c1 = CircularIndex.addOffset(c1, offset, contour.size()); createLine(c0,c1,contour,line0); createLine(c1,c2,contour,line1); return distanceSum(line0,c0,c1,contour)+distanceSum(line1,c1,c2,contour); }
[ "protected", "double", "computeCost", "(", "List", "<", "Point2D_I32", ">", "contour", ",", "int", "c0", ",", "int", "c1", ",", "int", "c2", ",", "int", "offset", ")", "{", "c1", "=", "CircularIndex", ".", "addOffset", "(", "c1", ",", "offset", ",", ...
Computes the distance between the two lines defined by corner points in the contour @param contour list of contour points @param c0 end point of line 0 @param c1 start of line 0 and 1 @param c2 end point of line 1 @param offset added to c1 to make start of lines @return sum of distance of points along contour
[ "Computes", "the", "distance", "between", "the", "two", "lines", "defined", "by", "corner", "points", "in", "the", "contour" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/RefinePolyLineCorner.java#L163-L170
thymeleaf/thymeleaf
src/main/java/org/thymeleaf/util/TextUtils.java
TextUtils.binarySearch
public static int binarySearch( final boolean caseSensitive, final CharSequence[] values, final char[] text, final int textOffset, final int textLen) { """ <p> Searches the specified array of texts ({@code values}) for the specified text &mdash;or a fragment, using an (offset,len) specification&mdash; using the binary search algorithm. </p> <p> Note the specified {@code values} parameter <strong>must be lexicographically ordered</strong>. </p> @param caseSensitive whether the comparison must be done in a case-sensitive or case-insensitive way. @param values the array of texts inside which the specified text will be searched. Note that it must be <strong>ordered</strong>. @param text the text to search. @param textOffset the offset of the text to search. @param textLen the length of the text to search. @return index of the search key, if it is contained in the values array; otherwise, {@code (-(insertion point) - 1)}. The insertion point is defined as the point at which the key would be inserted into the array. Note that this guarantees that the return value will be &gt;= 0 if and only if the key is found. """ if (values == null) { throw new IllegalArgumentException("Values array cannot be null"); } return binarySearch(caseSensitive, values, 0, values.length, text, textOffset, textLen); }
java
public static int binarySearch( final boolean caseSensitive, final CharSequence[] values, final char[] text, final int textOffset, final int textLen) { if (values == null) { throw new IllegalArgumentException("Values array cannot be null"); } return binarySearch(caseSensitive, values, 0, values.length, text, textOffset, textLen); }
[ "public", "static", "int", "binarySearch", "(", "final", "boolean", "caseSensitive", ",", "final", "CharSequence", "[", "]", "values", ",", "final", "char", "[", "]", "text", ",", "final", "int", "textOffset", ",", "final", "int", "textLen", ")", "{", "if"...
<p> Searches the specified array of texts ({@code values}) for the specified text &mdash;or a fragment, using an (offset,len) specification&mdash; using the binary search algorithm. </p> <p> Note the specified {@code values} parameter <strong>must be lexicographically ordered</strong>. </p> @param caseSensitive whether the comparison must be done in a case-sensitive or case-insensitive way. @param values the array of texts inside which the specified text will be searched. Note that it must be <strong>ordered</strong>. @param text the text to search. @param textOffset the offset of the text to search. @param textLen the length of the text to search. @return index of the search key, if it is contained in the values array; otherwise, {@code (-(insertion point) - 1)}. The insertion point is defined as the point at which the key would be inserted into the array. Note that this guarantees that the return value will be &gt;= 0 if and only if the key is found.
[ "<p", ">", "Searches", "the", "specified", "array", "of", "texts", "(", "{", "@code", "values", "}", ")", "for", "the", "specified", "text", "&mdash", ";", "or", "a", "fragment", "using", "an", "(", "offset", "len", ")", "specification&mdash", ";", "usin...
train
https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/util/TextUtils.java#L1877-L1886
apache/groovy
src/main/java/org/codehaus/groovy/ast/tools/GeneralUtils.java
GeneralUtils.cmpX
public static BinaryExpression cmpX(Expression lhv, Expression rhv) { """ Build a binary expression that compares two values @param lhv expression for the value to compare from @param rhv expression for the value value to compare to @return the expression comparing two values """ return new BinaryExpression(lhv, CMP, rhv); }
java
public static BinaryExpression cmpX(Expression lhv, Expression rhv) { return new BinaryExpression(lhv, CMP, rhv); }
[ "public", "static", "BinaryExpression", "cmpX", "(", "Expression", "lhv", ",", "Expression", "rhv", ")", "{", "return", "new", "BinaryExpression", "(", "lhv", ",", "CMP", ",", "rhv", ")", ";", "}" ]
Build a binary expression that compares two values @param lhv expression for the value to compare from @param rhv expression for the value value to compare to @return the expression comparing two values
[ "Build", "a", "binary", "expression", "that", "compares", "two", "values" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/ast/tools/GeneralUtils.java#L238-L240
mnlipp/jgrapes
org.jgrapes.http/src/org/jgrapes/http/HttpServer.java
HttpServer.onClose
@Handler public void onClose(Close event, WebAppMsgChannel appChannel) throws InterruptedException { """ Handles a close event from downstream by closing the upstream connections. @param event the close event @throws InterruptedException if the execution was interrupted """ appChannel.handleClose(event); }
java
@Handler public void onClose(Close event, WebAppMsgChannel appChannel) throws InterruptedException { appChannel.handleClose(event); }
[ "@", "Handler", "public", "void", "onClose", "(", "Close", "event", ",", "WebAppMsgChannel", "appChannel", ")", "throws", "InterruptedException", "{", "appChannel", ".", "handleClose", "(", "event", ")", ";", "}" ]
Handles a close event from downstream by closing the upstream connections. @param event the close event @throws InterruptedException if the execution was interrupted
[ "Handles", "a", "close", "event", "from", "downstream", "by", "closing", "the", "upstream", "connections", "." ]
train
https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.http/src/org/jgrapes/http/HttpServer.java#L333-L337
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/model/SQLiteDatabaseSchema.java
SQLiteDatabaseSchema.checkName
private void checkName(Set<SQLProperty> listEntity, SQLProperty p) { """ property in different class, but same name, must have same column name. @param listEntity the list entity @param p the p """ for (SQLProperty item : listEntity) { AssertKripton.assertTrueOrInvalidPropertyName(item.columnName.equals(p.columnName), item, p); } }
java
private void checkName(Set<SQLProperty> listEntity, SQLProperty p) { for (SQLProperty item : listEntity) { AssertKripton.assertTrueOrInvalidPropertyName(item.columnName.equals(p.columnName), item, p); } }
[ "private", "void", "checkName", "(", "Set", "<", "SQLProperty", ">", "listEntity", ",", "SQLProperty", "p", ")", "{", "for", "(", "SQLProperty", "item", ":", "listEntity", ")", "{", "AssertKripton", ".", "assertTrueOrInvalidPropertyName", "(", "item", ".", "co...
property in different class, but same name, must have same column name. @param listEntity the list entity @param p the p
[ "property", "in", "different", "class", "but", "same", "name", "must", "have", "same", "column", "name", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/model/SQLiteDatabaseSchema.java#L384-L389
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/beans/PropertyChangeSupport.java
PropertyChangeSupport.firePropertyChange
public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) { """ Reports a boolean bound property update to listeners that have been registered to track updates of all properties or a property with the specified name. <p> No event is fired if old and new values are equal. <p> This is merely a convenience wrapper around the more general {@link #firePropertyChange(String, Object, Object)} method. @param propertyName the programmatic name of the property that was changed @param oldValue the old value of the property @param newValue the new value of the property """ if (oldValue != newValue) { firePropertyChange(propertyName, Boolean.valueOf(oldValue), Boolean.valueOf(newValue)); } }
java
public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) { if (oldValue != newValue) { firePropertyChange(propertyName, Boolean.valueOf(oldValue), Boolean.valueOf(newValue)); } }
[ "public", "void", "firePropertyChange", "(", "String", "propertyName", ",", "boolean", "oldValue", ",", "boolean", "newValue", ")", "{", "if", "(", "oldValue", "!=", "newValue", ")", "{", "firePropertyChange", "(", "propertyName", ",", "Boolean", ".", "valueOf",...
Reports a boolean bound property update to listeners that have been registered to track updates of all properties or a property with the specified name. <p> No event is fired if old and new values are equal. <p> This is merely a convenience wrapper around the more general {@link #firePropertyChange(String, Object, Object)} method. @param propertyName the programmatic name of the property that was changed @param oldValue the old value of the property @param newValue the new value of the property
[ "Reports", "a", "boolean", "bound", "property", "update", "to", "listeners", "that", "have", "been", "registered", "to", "track", "updates", "of", "all", "properties", "or", "a", "property", "with", "the", "specified", "name", ".", "<p", ">", "No", "event", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/beans/PropertyChangeSupport.java#L301-L305
netty/netty
common/src/main/java/io/netty/util/internal/ThreadExecutorMap.java
ThreadExecutorMap.apply
public static Runnable apply(final Runnable command, final EventExecutor eventExecutor) { """ Decorate the given {@link Runnable} and ensure {@link #currentExecutor()} will return {@code eventExecutor} when called from within the {@link Runnable} during execution. """ ObjectUtil.checkNotNull(command, "command"); ObjectUtil.checkNotNull(eventExecutor, "eventExecutor"); return new Runnable() { @Override public void run() { setCurrentEventExecutor(eventExecutor); try { command.run(); } finally { setCurrentEventExecutor(null); } } }; }
java
public static Runnable apply(final Runnable command, final EventExecutor eventExecutor) { ObjectUtil.checkNotNull(command, "command"); ObjectUtil.checkNotNull(eventExecutor, "eventExecutor"); return new Runnable() { @Override public void run() { setCurrentEventExecutor(eventExecutor); try { command.run(); } finally { setCurrentEventExecutor(null); } } }; }
[ "public", "static", "Runnable", "apply", "(", "final", "Runnable", "command", ",", "final", "EventExecutor", "eventExecutor", ")", "{", "ObjectUtil", ".", "checkNotNull", "(", "command", ",", "\"command\"", ")", ";", "ObjectUtil", ".", "checkNotNull", "(", "even...
Decorate the given {@link Runnable} and ensure {@link #currentExecutor()} will return {@code eventExecutor} when called from within the {@link Runnable} during execution.
[ "Decorate", "the", "given", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/ThreadExecutorMap.java#L66-L80
DDTH/ddth-queue
ddth-queue-core/src/main/java/com/github/ddth/queue/impl/universal/UniversalIdStrQueueMessage.java
UniversalIdStrQueueMessage.newInstance
public static UniversalIdStrQueueMessage newInstance(Map<String, Object> data) { """ Create a new {@link UniversalIdStrQueueMessage}. @param data @return @since 0.6.2.3 """ UniversalIdStrQueueMessage msg = newInstance(); return msg.fromMap(data); }
java
public static UniversalIdStrQueueMessage newInstance(Map<String, Object> data) { UniversalIdStrQueueMessage msg = newInstance(); return msg.fromMap(data); }
[ "public", "static", "UniversalIdStrQueueMessage", "newInstance", "(", "Map", "<", "String", ",", "Object", ">", "data", ")", "{", "UniversalIdStrQueueMessage", "msg", "=", "newInstance", "(", ")", ";", "return", "msg", ".", "fromMap", "(", "data", ")", ";", ...
Create a new {@link UniversalIdStrQueueMessage}. @param data @return @since 0.6.2.3
[ "Create", "a", "new", "{", "@link", "UniversalIdStrQueueMessage", "}", "." ]
train
https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/queue/impl/universal/UniversalIdStrQueueMessage.java#L96-L99
landawn/AbacusUtil
src/com/landawn/abacus/util/DateUtil.java
DateUtil.addWeeks
public static <T extends Calendar> T addWeeks(final T calendar, final int amount) { """ Adds a number of weeks to a calendar returning a new object. The original {@code Date} is unchanged. @param calendar the calendar, not null @param amount the amount to add, may be negative @return the new {@code Date} with the amount added @throws IllegalArgumentException if the calendar is null """ return roll(calendar, amount, CalendarUnit.WEEK); }
java
public static <T extends Calendar> T addWeeks(final T calendar, final int amount) { return roll(calendar, amount, CalendarUnit.WEEK); }
[ "public", "static", "<", "T", "extends", "Calendar", ">", "T", "addWeeks", "(", "final", "T", "calendar", ",", "final", "int", "amount", ")", "{", "return", "roll", "(", "calendar", ",", "amount", ",", "CalendarUnit", ".", "WEEK", ")", ";", "}" ]
Adds a number of weeks to a calendar returning a new object. The original {@code Date} is unchanged. @param calendar the calendar, not null @param amount the amount to add, may be negative @return the new {@code Date} with the amount added @throws IllegalArgumentException if the calendar is null
[ "Adds", "a", "number", "of", "weeks", "to", "a", "calendar", "returning", "a", "new", "object", ".", "The", "original", "{", "@code", "Date", "}", "is", "unchanged", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DateUtil.java#L1091-L1093
EdwardRaff/JSAT
JSAT/src/jsat/linear/EigenValueDecomposition.java
EigenValueDecomposition.columnOpTransform2
private void columnOpTransform2(Matrix M, int low, int high, double x, int k, double y, boolean notlast, double z, double r, double q) { """ Alters the columns accordin to <br> <code><p> for (int i = low; i <= high; i++)<br> {<br> &nbsp;&nbsp;&nbsp;&nbsp; p = x * M[i][k] + y * M[i][k + 1];<br> &nbsp;&nbsp;&nbsp;&nbsp; if (notlast)<br> &nbsp;&nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p = p + z * M[i][k + 2];<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; M[i][k + 2] = M[i][k + 2] - p * r;<br> &nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp;&nbsp; M[i][k] = M[i][k] - p;<br> &nbsp;&nbsp;&nbsp;&nbsp; M[i][k + 1] = M[i][k + 1] - p * q;<br> }<br> </p></code> @param M the matrix to alter @param low the starting column (inclusive) @param high the ending column (inclusive) @param x first constant @param k this column and the column after will be altered @param y second constant @param notlast <tt>true<tt> if the 2nd column after <tt>k</tt> should be updated @param z third constant @param r fourth constant @param q fifth constant """ double p; for (int i = low; i <= high; i++) { p = x * M.get(i, k) + y * M.get(i, k+1); if (notlast) { p = p + z * M.get(i, k+2); M.set(i, k + 2, M.get(i, k+2) - p * r); } M.increment(i, k, -p); M.increment(i, k+1, -p*q); } }
java
private void columnOpTransform2(Matrix M, int low, int high, double x, int k, double y, boolean notlast, double z, double r, double q) { double p; for (int i = low; i <= high; i++) { p = x * M.get(i, k) + y * M.get(i, k+1); if (notlast) { p = p + z * M.get(i, k+2); M.set(i, k + 2, M.get(i, k+2) - p * r); } M.increment(i, k, -p); M.increment(i, k+1, -p*q); } }
[ "private", "void", "columnOpTransform2", "(", "Matrix", "M", ",", "int", "low", ",", "int", "high", ",", "double", "x", ",", "int", "k", ",", "double", "y", ",", "boolean", "notlast", ",", "double", "z", ",", "double", "r", ",", "double", "q", ")", ...
Alters the columns accordin to <br> <code><p> for (int i = low; i <= high; i++)<br> {<br> &nbsp;&nbsp;&nbsp;&nbsp; p = x * M[i][k] + y * M[i][k + 1];<br> &nbsp;&nbsp;&nbsp;&nbsp; if (notlast)<br> &nbsp;&nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p = p + z * M[i][k + 2];<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; M[i][k + 2] = M[i][k + 2] - p * r;<br> &nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp;&nbsp; M[i][k] = M[i][k] - p;<br> &nbsp;&nbsp;&nbsp;&nbsp; M[i][k + 1] = M[i][k + 1] - p * q;<br> }<br> </p></code> @param M the matrix to alter @param low the starting column (inclusive) @param high the ending column (inclusive) @param x first constant @param k this column and the column after will be altered @param y second constant @param notlast <tt>true<tt> if the 2nd column after <tt>k</tt> should be updated @param z third constant @param r fourth constant @param q fifth constant
[ "Alters", "the", "columns", "accordin", "to", "<br", ">", "<code", ">", "<p", ">", "for", "(", "int", "i", "=", "low", ";", "i", "<", "=", "high", ";", "i", "++", ")", "<br", ">", "{", "<br", ">", "&nbsp", ";", "&nbsp", ";", "&nbsp", ";", "&n...
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/EigenValueDecomposition.java#L845-L859
gallandarakhneorg/afc
advanced/gis/gisroadinputoutput/src/main/java/org/arakhne/afc/gis/road/io/XMLRoadUtil.java
XMLRoadUtil.readRoadNetwork
public static StandardRoadNetwork readRoadNetwork(Element xmlNode, PathBuilder pathBuilder, XMLResources resources) throws IOException { """ Read the roads from the XML description. @param xmlNode is the XML node to fill with the container data. @param pathBuilder is the tool to make paths relative. @param resources is the tool that permits to gather the resources. @return the road network. @throws IOException in case of error. """ final double x = getAttributeDoubleWithDefault(xmlNode, Double.NaN, ATTR_X); final double y = getAttributeDoubleWithDefault(xmlNode, Double.NaN, ATTR_Y); final double width = getAttributeDoubleWithDefault(xmlNode, Double.NaN, ATTR_WIDTH); final double height = getAttributeDoubleWithDefault(xmlNode, Double.NaN, ATTR_HEIGHT); if (Double.isNaN(x) || Double.isNaN(y) || Double.isNaN(width) || Double.isNaN(height)) { throw new IOException("invalid road network bounds"); //$NON-NLS-1$ } final Rectangle2d bounds = new Rectangle2d(x, y, width, height); final StandardRoadNetwork roadNetwork = new StandardRoadNetwork(bounds); readRoadNetwork(xmlNode, roadNetwork, pathBuilder, resources); return roadNetwork; }
java
public static StandardRoadNetwork readRoadNetwork(Element xmlNode, PathBuilder pathBuilder, XMLResources resources) throws IOException { final double x = getAttributeDoubleWithDefault(xmlNode, Double.NaN, ATTR_X); final double y = getAttributeDoubleWithDefault(xmlNode, Double.NaN, ATTR_Y); final double width = getAttributeDoubleWithDefault(xmlNode, Double.NaN, ATTR_WIDTH); final double height = getAttributeDoubleWithDefault(xmlNode, Double.NaN, ATTR_HEIGHT); if (Double.isNaN(x) || Double.isNaN(y) || Double.isNaN(width) || Double.isNaN(height)) { throw new IOException("invalid road network bounds"); //$NON-NLS-1$ } final Rectangle2d bounds = new Rectangle2d(x, y, width, height); final StandardRoadNetwork roadNetwork = new StandardRoadNetwork(bounds); readRoadNetwork(xmlNode, roadNetwork, pathBuilder, resources); return roadNetwork; }
[ "public", "static", "StandardRoadNetwork", "readRoadNetwork", "(", "Element", "xmlNode", ",", "PathBuilder", "pathBuilder", ",", "XMLResources", "resources", ")", "throws", "IOException", "{", "final", "double", "x", "=", "getAttributeDoubleWithDefault", "(", "xmlNode",...
Read the roads from the XML description. @param xmlNode is the XML node to fill with the container data. @param pathBuilder is the tool to make paths relative. @param resources is the tool that permits to gather the resources. @return the road network. @throws IOException in case of error.
[ "Read", "the", "roads", "from", "the", "XML", "description", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroadinputoutput/src/main/java/org/arakhne/afc/gis/road/io/XMLRoadUtil.java#L212-L229
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java
JvmTypesBuilder.setInitializer
public void setInitializer(/* @Nullable */ JvmField field, /* @Nullable */ StringConcatenationClient strategy) { """ Attaches the given compile strategy to the given {@link JvmField} such that the compiler knows how to initialize the {@link JvmField} when it is translated to Java source code. @param field the field to add the initializer to. If <code>null</code> this method does nothing. @param strategy the compilation strategy. If <code>null</code> this method does nothing. """ if (field == null || strategy == null) return; removeExistingBody(field); setCompilationStrategy(field, strategy); }
java
public void setInitializer(/* @Nullable */ JvmField field, /* @Nullable */ StringConcatenationClient strategy) { if (field == null || strategy == null) return; removeExistingBody(field); setCompilationStrategy(field, strategy); }
[ "public", "void", "setInitializer", "(", "/* @Nullable */", "JvmField", "field", ",", "/* @Nullable */", "StringConcatenationClient", "strategy", ")", "{", "if", "(", "field", "==", "null", "||", "strategy", "==", "null", ")", "return", ";", "removeExistingBody", ...
Attaches the given compile strategy to the given {@link JvmField} such that the compiler knows how to initialize the {@link JvmField} when it is translated to Java source code. @param field the field to add the initializer to. If <code>null</code> this method does nothing. @param strategy the compilation strategy. If <code>null</code> this method does nothing.
[ "Attaches", "the", "given", "compile", "strategy", "to", "the", "given", "{", "@link", "JvmField", "}", "such", "that", "the", "compiler", "knows", "how", "to", "initialize", "the", "{", "@link", "JvmField", "}", "when", "it", "is", "translated", "to", "Ja...
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java#L1244-L1249
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF4.java
CommonOps_DDF4.extractRow
public static DMatrix4 extractRow( DMatrix4x4 a , int row , DMatrix4 out ) { """ Extracts the row from the matrix a. @param a Input matrix @param row Which row is to be extracted @param out output. Storage for the extracted row. If null then a new vector will be returned. @return The extracted row. """ if( out == null) out = new DMatrix4(); switch( row ) { case 0: out.a1 = a.a11; out.a2 = a.a12; out.a3 = a.a13; out.a4 = a.a14; break; case 1: out.a1 = a.a21; out.a2 = a.a22; out.a3 = a.a23; out.a4 = a.a24; break; case 2: out.a1 = a.a31; out.a2 = a.a32; out.a3 = a.a33; out.a4 = a.a34; break; case 3: out.a1 = a.a41; out.a2 = a.a42; out.a3 = a.a43; out.a4 = a.a44; break; default: throw new IllegalArgumentException("Out of bounds row. row = "+row); } return out; }
java
public static DMatrix4 extractRow( DMatrix4x4 a , int row , DMatrix4 out ) { if( out == null) out = new DMatrix4(); switch( row ) { case 0: out.a1 = a.a11; out.a2 = a.a12; out.a3 = a.a13; out.a4 = a.a14; break; case 1: out.a1 = a.a21; out.a2 = a.a22; out.a3 = a.a23; out.a4 = a.a24; break; case 2: out.a1 = a.a31; out.a2 = a.a32; out.a3 = a.a33; out.a4 = a.a34; break; case 3: out.a1 = a.a41; out.a2 = a.a42; out.a3 = a.a43; out.a4 = a.a44; break; default: throw new IllegalArgumentException("Out of bounds row. row = "+row); } return out; }
[ "public", "static", "DMatrix4", "extractRow", "(", "DMatrix4x4", "a", ",", "int", "row", ",", "DMatrix4", "out", ")", "{", "if", "(", "out", "==", "null", ")", "out", "=", "new", "DMatrix4", "(", ")", ";", "switch", "(", "row", ")", "{", "case", "0...
Extracts the row from the matrix a. @param a Input matrix @param row Which row is to be extracted @param out output. Storage for the extracted row. If null then a new vector will be returned. @return The extracted row.
[ "Extracts", "the", "row", "from", "the", "matrix", "a", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF4.java#L1623-L1654
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataCloneVisitor.java
ItemDataCloneVisitor.itemInItemStateList
private boolean itemInItemStateList(List<ItemState> list, String itemId, int state) { """ Return true if the itemstate for item with <code>itemId</code> UUId exist in <code>List&lt;ItemState&gt;</code> list. @param list @param itemId @param state @return """ boolean retval = false; for (ItemState itemState : list) { if (itemState.getState() == state && itemState.getData().getIdentifier().equals(itemId)) { retval = true; break; } } return retval; }
java
private boolean itemInItemStateList(List<ItemState> list, String itemId, int state) { boolean retval = false; for (ItemState itemState : list) { if (itemState.getState() == state && itemState.getData().getIdentifier().equals(itemId)) { retval = true; break; } } return retval; }
[ "private", "boolean", "itemInItemStateList", "(", "List", "<", "ItemState", ">", "list", ",", "String", "itemId", ",", "int", "state", ")", "{", "boolean", "retval", "=", "false", ";", "for", "(", "ItemState", "itemState", ":", "list", ")", "{", "if", "(...
Return true if the itemstate for item with <code>itemId</code> UUId exist in <code>List&lt;ItemState&gt;</code> list. @param list @param itemId @param state @return
[ "Return", "true", "if", "the", "itemstate", "for", "item", "with", "<code", ">", "itemId<", "/", "code", ">", "UUId", "exist", "in", "<code", ">", "List&lt", ";", "ItemState&gt", ";", "<", "/", "code", ">", "list", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataCloneVisitor.java#L240-L253
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java
HashtableOnDisk.writeEntry
private void writeEntry(HashtableEntry entry) throws IOException, EOFException, FileManagerException, ClassNotFoundException { """ ************************************************************************ Common code to insert an entry into the hashtable. *********************************************************************** """ long index = getHtindex(entry.index, entry.tableid); if (index == 0) { // first one in this bucket updateEntry(entry); // write to disk writeHashIndex(entry.index, entry.location, entry.tableid); // update index } else if (index == entry.location) { // replacing first entry updateEntry(entry); writeHashIndex(entry.index, entry.location, entry.tableid); // update index } else { // // // If the entry has a "previous" pointer, then it was read earlier // from disk. Otherwise, it is a brand new entry. If it is a brand // entry, we write it to disk and chain at the front of the bucket. // If "previous" is not zero, we check to see if reallocation is // needed (location == 0). If not, we simply update on disk and we're // done. If reallocation is needed we update on disk to do the allocation // and call updatePointer to chain into the bucket. // if (entry.previous == 0) { entry.next = index; updateEntry(entry); writeHashIndex(entry.index, entry.location, entry.tableid); // update index } else { if (entry.location == 0) { // allocation needed? updateEntry(entry); // do allocation updatePointer(entry.previous, entry.location); // chain in } else { updateEntry(entry); // no allocation, just update fields } } } }
java
private void writeEntry(HashtableEntry entry) throws IOException, EOFException, FileManagerException, ClassNotFoundException { long index = getHtindex(entry.index, entry.tableid); if (index == 0) { // first one in this bucket updateEntry(entry); // write to disk writeHashIndex(entry.index, entry.location, entry.tableid); // update index } else if (index == entry.location) { // replacing first entry updateEntry(entry); writeHashIndex(entry.index, entry.location, entry.tableid); // update index } else { // // // If the entry has a "previous" pointer, then it was read earlier // from disk. Otherwise, it is a brand new entry. If it is a brand // entry, we write it to disk and chain at the front of the bucket. // If "previous" is not zero, we check to see if reallocation is // needed (location == 0). If not, we simply update on disk and we're // done. If reallocation is needed we update on disk to do the allocation // and call updatePointer to chain into the bucket. // if (entry.previous == 0) { entry.next = index; updateEntry(entry); writeHashIndex(entry.index, entry.location, entry.tableid); // update index } else { if (entry.location == 0) { // allocation needed? updateEntry(entry); // do allocation updatePointer(entry.previous, entry.location); // chain in } else { updateEntry(entry); // no allocation, just update fields } } } }
[ "private", "void", "writeEntry", "(", "HashtableEntry", "entry", ")", "throws", "IOException", ",", "EOFException", ",", "FileManagerException", ",", "ClassNotFoundException", "{", "long", "index", "=", "getHtindex", "(", "entry", ".", "index", ",", "entry", ".", ...
************************************************************************ Common code to insert an entry into the hashtable. ***********************************************************************
[ "************************************************************************", "Common", "code", "to", "insert", "an", "entry", "into", "the", "hashtable", ".", "***********************************************************************" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java#L1712-L1747
ManfredTremmel/gwt-bean-validators
mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/PasswordValidator.java
PasswordValidator.isValid
@Override public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) { """ {@inheritDoc} check if given object is valid. @see javax.validation.ConstraintValidator#isValid(Object, javax.validation.ConstraintValidatorContext) """ final String valueAsString = Objects.toString(pvalue, null); return StringUtils.isEmpty(valueAsString) || countCriteriaMatches(valueAsString) >= minRules && !isBlacklist(pcontext, valueAsString) && !startsWithDisalowedCharacter(pcontext, valueAsString) && !maxRepeatCharacterExceded(pcontext, valueAsString); }
java
@Override public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) { final String valueAsString = Objects.toString(pvalue, null); return StringUtils.isEmpty(valueAsString) || countCriteriaMatches(valueAsString) >= minRules && !isBlacklist(pcontext, valueAsString) && !startsWithDisalowedCharacter(pcontext, valueAsString) && !maxRepeatCharacterExceded(pcontext, valueAsString); }
[ "@", "Override", "public", "final", "boolean", "isValid", "(", "final", "Object", "pvalue", ",", "final", "ConstraintValidatorContext", "pcontext", ")", "{", "final", "String", "valueAsString", "=", "Objects", ".", "toString", "(", "pvalue", ",", "null", ")", ...
{@inheritDoc} check if given object is valid. @see javax.validation.ConstraintValidator#isValid(Object, javax.validation.ConstraintValidatorContext)
[ "{", "@inheritDoc", "}", "check", "if", "given", "object", "is", "valid", "." ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/PasswordValidator.java#L124-L131
threerings/narya
core/src/main/java/com/threerings/crowd/chat/server/ChatChannelManager.java
ChatChannelManager.collectChatHistory
@AnyThread public void collectChatHistory (final Name user, final ResultListener<ChatHistoryResult> lner) { """ Collects all chat messages heard by the given user on all peers. """ _peerMan.invokeNodeRequest(new NodeRequest() { public boolean isApplicable (NodeObject nodeobj) { return true; // poll all nodes } @Override protected void execute (InvocationService.ResultListener listener) { // find all the UserMessages for the given user and send them back listener.requestProcessed(Lists.newArrayList(Iterables.filter( _chatHistory.get(user), IS_USER_MESSAGE))); } @Inject protected transient ChatHistory _chatHistory; }, new NodeRequestsListener<List<ChatHistory.Entry>>() { public void requestsProcessed (NodeRequestsResult<List<ChatHistory.Entry>> rRes) { ChatHistoryResult chRes = new ChatHistoryResult(); chRes.failedNodes = rRes.getNodeErrors().keySet(); chRes.history = Lists.newArrayList( Iterables.concat(rRes.getNodeResults().values())); Collections.sort(chRes.history, SORT_BY_TIMESTAMP); lner.requestCompleted(chRes); } public void requestFailed (String cause) { lner.requestFailed(new InvocationException(cause)); } }); }
java
@AnyThread public void collectChatHistory (final Name user, final ResultListener<ChatHistoryResult> lner) { _peerMan.invokeNodeRequest(new NodeRequest() { public boolean isApplicable (NodeObject nodeobj) { return true; // poll all nodes } @Override protected void execute (InvocationService.ResultListener listener) { // find all the UserMessages for the given user and send them back listener.requestProcessed(Lists.newArrayList(Iterables.filter( _chatHistory.get(user), IS_USER_MESSAGE))); } @Inject protected transient ChatHistory _chatHistory; }, new NodeRequestsListener<List<ChatHistory.Entry>>() { public void requestsProcessed (NodeRequestsResult<List<ChatHistory.Entry>> rRes) { ChatHistoryResult chRes = new ChatHistoryResult(); chRes.failedNodes = rRes.getNodeErrors().keySet(); chRes.history = Lists.newArrayList( Iterables.concat(rRes.getNodeResults().values())); Collections.sort(chRes.history, SORT_BY_TIMESTAMP); lner.requestCompleted(chRes); } public void requestFailed (String cause) { lner.requestFailed(new InvocationException(cause)); } }); }
[ "@", "AnyThread", "public", "void", "collectChatHistory", "(", "final", "Name", "user", ",", "final", "ResultListener", "<", "ChatHistoryResult", ">", "lner", ")", "{", "_peerMan", ".", "invokeNodeRequest", "(", "new", "NodeRequest", "(", ")", "{", "public", "...
Collects all chat messages heard by the given user on all peers.
[ "Collects", "all", "chat", "messages", "heard", "by", "the", "given", "user", "on", "all", "peers", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/chat/server/ChatChannelManager.java#L133-L159
Azure/azure-sdk-for-java
network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/VirtualHubsInner.java
VirtualHubsInner.getByResourceGroup
public VirtualHubInner getByResourceGroup(String resourceGroupName, String virtualHubName) { """ Retrieves the details of a VirtualHub. @param resourceGroupName The resource group name of the VirtualHub. @param virtualHubName The name of the VirtualHub. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VirtualHubInner object if successful. """ return getByResourceGroupWithServiceResponseAsync(resourceGroupName, virtualHubName).toBlocking().single().body(); }
java
public VirtualHubInner getByResourceGroup(String resourceGroupName, String virtualHubName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, virtualHubName).toBlocking().single().body(); }
[ "public", "VirtualHubInner", "getByResourceGroup", "(", "String", "resourceGroupName", ",", "String", "virtualHubName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualHubName", ")", ".", "toBlocking", "(", ")", "."...
Retrieves the details of a VirtualHub. @param resourceGroupName The resource group name of the VirtualHub. @param virtualHubName The name of the VirtualHub. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VirtualHubInner object if successful.
[ "Retrieves", "the", "details", "of", "a", "VirtualHub", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/VirtualHubsInner.java#L126-L128
apereo/cas
support/cas-server-support-consent-core/src/main/java/org/apereo/cas/consent/DefaultConsentDecisionBuilder.java
DefaultConsentDecisionBuilder.buildAndEncodeConsentAttributes
protected String buildAndEncodeConsentAttributes(final Map<String, List<Object>> attributes) { """ Build consent attribute names string. @param attributes the attributes @return the string """ try { val json = MAPPER.writer(new MinimalPrettyPrinter()).writeValueAsString(attributes); val base64 = EncodingUtils.encodeBase64(json); return this.consentCipherExecutor.encode(base64); } catch (final Exception e) { throw new IllegalArgumentException("Could not serialize attributes for consent decision"); } }
java
protected String buildAndEncodeConsentAttributes(final Map<String, List<Object>> attributes) { try { val json = MAPPER.writer(new MinimalPrettyPrinter()).writeValueAsString(attributes); val base64 = EncodingUtils.encodeBase64(json); return this.consentCipherExecutor.encode(base64); } catch (final Exception e) { throw new IllegalArgumentException("Could not serialize attributes for consent decision"); } }
[ "protected", "String", "buildAndEncodeConsentAttributes", "(", "final", "Map", "<", "String", ",", "List", "<", "Object", ">", ">", "attributes", ")", "{", "try", "{", "val", "json", "=", "MAPPER", ".", "writer", "(", "new", "MinimalPrettyPrinter", "(", ")",...
Build consent attribute names string. @param attributes the attributes @return the string
[ "Build", "consent", "attribute", "names", "string", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-consent-core/src/main/java/org/apereo/cas/consent/DefaultConsentDecisionBuilder.java#L115-L123
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/EnvelopesApi.java
EnvelopesApi.updateDocuments
public EnvelopeDocumentsResult updateDocuments(String accountId, String envelopeId, EnvelopeDefinition envelopeDefinition, EnvelopesApi.UpdateDocumentsOptions options) throws ApiException { """ Adds one or more documents to an existing envelope document. Adds one or more documents to an existing envelope document. @param accountId The external account number (int) or account ID Guid. (required) @param envelopeId The envelopeId Guid of the envelope being accessed. (required) @param envelopeDefinition (optional) @param options for modifying the method behavior. @return EnvelopeDocumentsResult @throws ApiException if fails to make API call """ Object localVarPostBody = envelopeDefinition; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling updateDocuments"); } // verify the required parameter 'envelopeId' is set if (envelopeId == null) { throw new ApiException(400, "Missing the required parameter 'envelopeId' when calling updateDocuments"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/envelopes/{envelopeId}/documents".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())) .replaceAll("\\{" + "envelopeId" + "\\}", apiClient.escapeString(envelopeId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "apply_document_fields", options.applyDocumentFields)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "persist_tabs", options.persistTabs)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; GenericType<EnvelopeDocumentsResult> localVarReturnType = new GenericType<EnvelopeDocumentsResult>() {}; return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); }
java
public EnvelopeDocumentsResult updateDocuments(String accountId, String envelopeId, EnvelopeDefinition envelopeDefinition, EnvelopesApi.UpdateDocumentsOptions options) throws ApiException { Object localVarPostBody = envelopeDefinition; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling updateDocuments"); } // verify the required parameter 'envelopeId' is set if (envelopeId == null) { throw new ApiException(400, "Missing the required parameter 'envelopeId' when calling updateDocuments"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/envelopes/{envelopeId}/documents".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())) .replaceAll("\\{" + "envelopeId" + "\\}", apiClient.escapeString(envelopeId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "apply_document_fields", options.applyDocumentFields)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "persist_tabs", options.persistTabs)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; GenericType<EnvelopeDocumentsResult> localVarReturnType = new GenericType<EnvelopeDocumentsResult>() {}; return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); }
[ "public", "EnvelopeDocumentsResult", "updateDocuments", "(", "String", "accountId", ",", "String", "envelopeId", ",", "EnvelopeDefinition", "envelopeDefinition", ",", "EnvelopesApi", ".", "UpdateDocumentsOptions", "options", ")", "throws", "ApiException", "{", "Object", "...
Adds one or more documents to an existing envelope document. Adds one or more documents to an existing envelope document. @param accountId The external account number (int) or account ID Guid. (required) @param envelopeId The envelopeId Guid of the envelope being accessed. (required) @param envelopeDefinition (optional) @param options for modifying the method behavior. @return EnvelopeDocumentsResult @throws ApiException if fails to make API call
[ "Adds", "one", "or", "more", "documents", "to", "an", "existing", "envelope", "document", ".", "Adds", "one", "or", "more", "documents", "to", "an", "existing", "envelope", "document", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/EnvelopesApi.java#L5144-L5187
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/rest/RESTServlet.java
RESTServlet.decodeAuthorizationHeader
private void decodeAuthorizationHeader(String authString, StringBuilder userID, StringBuilder password) { """ Decode the given Authorization header value into its user/password components. """ userID.setLength(0); password.setLength(0); if (!Utils.isEmpty(authString) && authString.toLowerCase().startsWith("basic ")) { String decoded = Utils.base64ToString(authString.substring("basic ".length())); int inx = decoded.indexOf(':'); if (inx < 0) { userID.append(decoded); } else { userID.append(decoded.substring(0, inx)); password.append(decoded.substring(inx + 1)); } } }
java
private void decodeAuthorizationHeader(String authString, StringBuilder userID, StringBuilder password) { userID.setLength(0); password.setLength(0); if (!Utils.isEmpty(authString) && authString.toLowerCase().startsWith("basic ")) { String decoded = Utils.base64ToString(authString.substring("basic ".length())); int inx = decoded.indexOf(':'); if (inx < 0) { userID.append(decoded); } else { userID.append(decoded.substring(0, inx)); password.append(decoded.substring(inx + 1)); } } }
[ "private", "void", "decodeAuthorizationHeader", "(", "String", "authString", ",", "StringBuilder", "userID", ",", "StringBuilder", "password", ")", "{", "userID", ".", "setLength", "(", "0", ")", ";", "password", ".", "setLength", "(", "0", ")", ";", "if", "...
Decode the given Authorization header value into its user/password components.
[ "Decode", "the", "given", "Authorization", "header", "value", "into", "its", "user", "/", "password", "components", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/rest/RESTServlet.java#L253-L266
cloudant/sync-android
cloudant-sync-datastore-javase/src/main/java/com/cloudant/sync/internal/sqlite/sqlite4java/SQLiteWrapperUtils.java
SQLiteWrapperUtils.longForQuery
public static Long longForQuery(SQLiteConnection conn, String query, Object[] bindArgs) throws SQLiteException { """ Utility method to run the query on the db and return the value in the first column of the first row. """ SQLiteStatement stmt = null; try { stmt = conn.prepare(query); if (bindArgs != null && bindArgs.length > 0) { stmt = SQLiteWrapperUtils.bindArguments(stmt, bindArgs); } if (stmt.step()) { return stmt.columnLong(0); } else { throw new IllegalStateException("query failed to return any result: " + query); } } finally { SQLiteWrapperUtils.disposeQuietly(stmt); } }
java
public static Long longForQuery(SQLiteConnection conn, String query, Object[] bindArgs) throws SQLiteException { SQLiteStatement stmt = null; try { stmt = conn.prepare(query); if (bindArgs != null && bindArgs.length > 0) { stmt = SQLiteWrapperUtils.bindArguments(stmt, bindArgs); } if (stmt.step()) { return stmt.columnLong(0); } else { throw new IllegalStateException("query failed to return any result: " + query); } } finally { SQLiteWrapperUtils.disposeQuietly(stmt); } }
[ "public", "static", "Long", "longForQuery", "(", "SQLiteConnection", "conn", ",", "String", "query", ",", "Object", "[", "]", "bindArgs", ")", "throws", "SQLiteException", "{", "SQLiteStatement", "stmt", "=", "null", ";", "try", "{", "stmt", "=", "conn", "."...
Utility method to run the query on the db and return the value in the first column of the first row.
[ "Utility", "method", "to", "run", "the", "query", "on", "the", "db", "and", "return", "the", "value", "in", "the", "first", "column", "of", "the", "first", "row", "." ]
train
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-javase/src/main/java/com/cloudant/sync/internal/sqlite/sqlite4java/SQLiteWrapperUtils.java#L43-L59
aboutsip/pkts
pkts-sip/src/main/java/io/pkts/packet/sip/impl/SipMessageStreamBuilder.java
SipMessageStreamBuilder.onInitialLine
private final State onInitialLine(final Buffer buffer) { """ Since it is quite uncommon to not have enough data on the line to read the entire first line we are taking the simple approach of just resetting the entire effort and we'll retry later. This of course means that in the worst case scenario we will actually iterate over data we have already seen before. However, seemed like it is worth it instead of having the extra space for keeping track of the extra state. @param buffer @return """ try { buffer.markReaderIndex(); final Buffer part1 = buffer.readUntilSafe(config.getMaxAllowedInitialLineSize(), SipParser.SP); final Buffer part2 = buffer.readUntilSafe(config.getMaxAllowedInitialLineSize(), SipParser.SP); final Buffer part3 = buffer.readUntilSingleCRLF(); if (part1 == null || part2 == null || part3 == null) { buffer.resetReaderIndex(); return State.GET_INITIAL_LINE; } sipInitialLine = SipInitialLine.parse(part1, part2, part3); } catch (final IOException e) { throw new RuntimeException("Unable to read from stream due to IOException", e); } return State.GET_HEADER_NAME; }
java
private final State onInitialLine(final Buffer buffer) { try { buffer.markReaderIndex(); final Buffer part1 = buffer.readUntilSafe(config.getMaxAllowedInitialLineSize(), SipParser.SP); final Buffer part2 = buffer.readUntilSafe(config.getMaxAllowedInitialLineSize(), SipParser.SP); final Buffer part3 = buffer.readUntilSingleCRLF(); if (part1 == null || part2 == null || part3 == null) { buffer.resetReaderIndex(); return State.GET_INITIAL_LINE; } sipInitialLine = SipInitialLine.parse(part1, part2, part3); } catch (final IOException e) { throw new RuntimeException("Unable to read from stream due to IOException", e); } return State.GET_HEADER_NAME; }
[ "private", "final", "State", "onInitialLine", "(", "final", "Buffer", "buffer", ")", "{", "try", "{", "buffer", ".", "markReaderIndex", "(", ")", ";", "final", "Buffer", "part1", "=", "buffer", ".", "readUntilSafe", "(", "config", ".", "getMaxAllowedInitialLin...
Since it is quite uncommon to not have enough data on the line to read the entire first line we are taking the simple approach of just resetting the entire effort and we'll retry later. This of course means that in the worst case scenario we will actually iterate over data we have already seen before. However, seemed like it is worth it instead of having the extra space for keeping track of the extra state. @param buffer @return
[ "Since", "it", "is", "quite", "uncommon", "to", "not", "have", "enough", "data", "on", "the", "line", "to", "read", "the", "entire", "first", "line", "we", "are", "taking", "the", "simple", "approach", "of", "just", "resetting", "the", "entire", "effort", ...
train
https://github.com/aboutsip/pkts/blob/0f06bb0dac76c812187829f580a8d476ca99a1a1/pkts-sip/src/main/java/io/pkts/packet/sip/impl/SipMessageStreamBuilder.java#L271-L287
alibaba/jstorm
jstorm-core/src/main/java/backtype/storm/StormSubmitter.java
StormSubmitter.submitTopology
public static void submitTopology(String name, Map stormConf, StormTopology topology) throws AlreadyAliveException, InvalidTopologyException { """ Submits a topology to run on the cluster. A topology runs forever or until explicitly killed. @param name the name of the storm. @param stormConf the topology-specific configuration. See {@link Config}. @param topology the processing to execute. @throws AlreadyAliveException if a topology with this name is already running @throws InvalidTopologyException if an invalid topology was submitted """ submitTopology(name, stormConf, topology, null); }
java
public static void submitTopology(String name, Map stormConf, StormTopology topology) throws AlreadyAliveException, InvalidTopologyException { submitTopology(name, stormConf, topology, null); }
[ "public", "static", "void", "submitTopology", "(", "String", "name", ",", "Map", "stormConf", ",", "StormTopology", "topology", ")", "throws", "AlreadyAliveException", ",", "InvalidTopologyException", "{", "submitTopology", "(", "name", ",", "stormConf", ",", "topol...
Submits a topology to run on the cluster. A topology runs forever or until explicitly killed. @param name the name of the storm. @param stormConf the topology-specific configuration. See {@link Config}. @param topology the processing to execute. @throws AlreadyAliveException if a topology with this name is already running @throws InvalidTopologyException if an invalid topology was submitted
[ "Submits", "a", "topology", "to", "run", "on", "the", "cluster", ".", "A", "topology", "runs", "forever", "or", "until", "explicitly", "killed", "." ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/StormSubmitter.java#L63-L66
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/archaius/cache/TypeContainer.java
TypeContainer.asType
public StampedValue asType(final Type type) { """ Check if a StampedValue already exists for the type, if it does, return it, otherwise create a new one and add it @param type @return """ StampedValue cachedValue = null; //looping around a list is probably quicker than having a map since there are probably only one or two different //types in use at any one time for (StampedValue value : typeCache) { if (value.getType().equals(type)) { cachedValue = value; break; } } if (cachedValue == null) { StampedValue newValue = new StampedValue(type, this, config); typeCache.add(newValue); cachedValue = newValue; } return cachedValue; }
java
public StampedValue asType(final Type type) { StampedValue cachedValue = null; //looping around a list is probably quicker than having a map since there are probably only one or two different //types in use at any one time for (StampedValue value : typeCache) { if (value.getType().equals(type)) { cachedValue = value; break; } } if (cachedValue == null) { StampedValue newValue = new StampedValue(type, this, config); typeCache.add(newValue); cachedValue = newValue; } return cachedValue; }
[ "public", "StampedValue", "asType", "(", "final", "Type", "type", ")", "{", "StampedValue", "cachedValue", "=", "null", ";", "//looping around a list is probably quicker than having a map since there are probably only one or two different", "//types in use at any one time", "for", ...
Check if a StampedValue already exists for the type, if it does, return it, otherwise create a new one and add it @param type @return
[ "Check", "if", "a", "StampedValue", "already", "exists", "for", "the", "type", "if", "it", "does", "return", "it", "otherwise", "create", "a", "new", "one", "and", "add", "it" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/archaius/cache/TypeContainer.java#L74-L93
doanduyhai/Achilles
achilles-core/src/main/java/info/archinnov/achilles/internals/metamodel/AbstractProperty.java
AbstractProperty.decodeField
public void decodeField(GettableData gettableData, ENTITY entity) { """ <ol> <li>First extract the column value from the given GettableData (Row, UDTValue, ...)</li> <li>Then call the setter on the given entity to set the value</li> </ol> @param gettableData @param entity """ final VALUEFROM valuefrom = decodeFromGettable(gettableData); fieldInfo.setter.set(entity, valuefrom); }
java
public void decodeField(GettableData gettableData, ENTITY entity) { final VALUEFROM valuefrom = decodeFromGettable(gettableData); fieldInfo.setter.set(entity, valuefrom); }
[ "public", "void", "decodeField", "(", "GettableData", "gettableData", ",", "ENTITY", "entity", ")", "{", "final", "VALUEFROM", "valuefrom", "=", "decodeFromGettable", "(", "gettableData", ")", ";", "fieldInfo", ".", "setter", ".", "set", "(", "entity", ",", "v...
<ol> <li>First extract the column value from the given GettableData (Row, UDTValue, ...)</li> <li>Then call the setter on the given entity to set the value</li> </ol> @param gettableData @param entity
[ "<ol", ">", "<li", ">", "First", "extract", "the", "column", "value", "from", "the", "given", "GettableData", "(", "Row", "UDTValue", "...", ")", "<", "/", "li", ">", "<li", ">", "Then", "call", "the", "setter", "on", "the", "given", "entity", "to", ...
train
https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/internals/metamodel/AbstractProperty.java#L243-L246
openbase/jul
exception/src/main/java/org/openbase/jul/exception/StackTracePrinter.java
StackTracePrinter.printStackTrace
public static void printStackTrace(final StackTraceElement[] stackTraces, final Logger logger, final LogLevel logLevel) { """ Method prints the given stack trace in a human readable way. @param stackTraces the stack trace to print. @param logger the logger used for printing. @param logLevel the log level used for logging the stack trace. """ printStackTrace(null, stackTraces, logger, logLevel); }
java
public static void printStackTrace(final StackTraceElement[] stackTraces, final Logger logger, final LogLevel logLevel) { printStackTrace(null, stackTraces, logger, logLevel); }
[ "public", "static", "void", "printStackTrace", "(", "final", "StackTraceElement", "[", "]", "stackTraces", ",", "final", "Logger", "logger", ",", "final", "LogLevel", "logLevel", ")", "{", "printStackTrace", "(", "null", ",", "stackTraces", ",", "logger", ",", ...
Method prints the given stack trace in a human readable way. @param stackTraces the stack trace to print. @param logger the logger used for printing. @param logLevel the log level used for logging the stack trace.
[ "Method", "prints", "the", "given", "stack", "trace", "in", "a", "human", "readable", "way", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/exception/src/main/java/org/openbase/jul/exception/StackTracePrinter.java#L77-L79
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java
ExcelWriter.createStyleForCell
@Deprecated public CellStyle createStyleForCell(int x, int y) { """ 为指定单元格创建样式 @param x X坐标,从0计数,既列号 @param y Y坐标,从0计数,既行号 @return {@link CellStyle} @since 4.0.9 @deprecated 请使用{@link #getOrCreateCellStyle(int, int)} """ final Cell cell = getOrCreateCell(x, y); final CellStyle cellStyle = this.workbook.createCellStyle(); cell.setCellStyle(cellStyle); return cellStyle; }
java
@Deprecated public CellStyle createStyleForCell(int x, int y) { final Cell cell = getOrCreateCell(x, y); final CellStyle cellStyle = this.workbook.createCellStyle(); cell.setCellStyle(cellStyle); return cellStyle; }
[ "@", "Deprecated", "public", "CellStyle", "createStyleForCell", "(", "int", "x", ",", "int", "y", ")", "{", "final", "Cell", "cell", "=", "getOrCreateCell", "(", "x", ",", "y", ")", ";", "final", "CellStyle", "cellStyle", "=", "this", ".", "workbook", "....
为指定单元格创建样式 @param x X坐标,从0计数,既列号 @param y Y坐标,从0计数,既行号 @return {@link CellStyle} @since 4.0.9 @deprecated 请使用{@link #getOrCreateCellStyle(int, int)}
[ "为指定单元格创建样式" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java#L766-L772
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/Assert.java
Assert.isAssignableTo
public static void isAssignableTo(Class<?> from, Class<?> to) { """ Asserts that the {@link Class 'from' class type} is assignable to the {@link Class 'to' class type}. The assertion holds if and only if the {@link Class 'from' class type} is the same as or a subclass of the {@link Class 'to' class type}. @param from {@link Class class type} being evaluated for assignment compatibility with the {@link Class 'to' class type}. @param to {@link Class class type} used to determine if the {@link Class 'from' class type} is assignment compatible. @throws java.lang.ClassCastException if the {@link Class 'from' class type} is not assignment compatible with the {@link Class 'to' class type}. @see #isAssignableTo(Class, Class, String, Object...) @see java.lang.Class#isAssignableFrom(Class) """ isAssignableTo(from, to, "[%1$s] is not assignable to [%2$s]", from, to); }
java
public static void isAssignableTo(Class<?> from, Class<?> to) { isAssignableTo(from, to, "[%1$s] is not assignable to [%2$s]", from, to); }
[ "public", "static", "void", "isAssignableTo", "(", "Class", "<", "?", ">", "from", ",", "Class", "<", "?", ">", "to", ")", "{", "isAssignableTo", "(", "from", ",", "to", ",", "\"[%1$s] is not assignable to [%2$s]\"", ",", "from", ",", "to", ")", ";", "}"...
Asserts that the {@link Class 'from' class type} is assignable to the {@link Class 'to' class type}. The assertion holds if and only if the {@link Class 'from' class type} is the same as or a subclass of the {@link Class 'to' class type}. @param from {@link Class class type} being evaluated for assignment compatibility with the {@link Class 'to' class type}. @param to {@link Class class type} used to determine if the {@link Class 'from' class type} is assignment compatible. @throws java.lang.ClassCastException if the {@link Class 'from' class type} is not assignment compatible with the {@link Class 'to' class type}. @see #isAssignableTo(Class, Class, String, Object...) @see java.lang.Class#isAssignableFrom(Class)
[ "Asserts", "that", "the", "{", "@link", "Class", "from", "class", "type", "}", "is", "assignable", "to", "the", "{", "@link", "Class", "to", "class", "type", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/Assert.java#L520-L522
jcuda/jcudnn
JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java
JCudnn.cudnnReduceTensor
public static int cudnnReduceTensor( cudnnHandle handle, cudnnReduceTensorDescriptor reduceTensorDesc, Pointer indices, long indicesSizeInBytes, Pointer workspace, long workspaceSizeInBytes, Pointer alpha, cudnnTensorDescriptor aDesc, Pointer A, Pointer beta, cudnnTensorDescriptor cDesc, Pointer C) { """ The indices space is ignored for reduce ops other than min or max. """ return checkResult(cudnnReduceTensorNative(handle, reduceTensorDesc, indices, indicesSizeInBytes, workspace, workspaceSizeInBytes, alpha, aDesc, A, beta, cDesc, C)); }
java
public static int cudnnReduceTensor( cudnnHandle handle, cudnnReduceTensorDescriptor reduceTensorDesc, Pointer indices, long indicesSizeInBytes, Pointer workspace, long workspaceSizeInBytes, Pointer alpha, cudnnTensorDescriptor aDesc, Pointer A, Pointer beta, cudnnTensorDescriptor cDesc, Pointer C) { return checkResult(cudnnReduceTensorNative(handle, reduceTensorDesc, indices, indicesSizeInBytes, workspace, workspaceSizeInBytes, alpha, aDesc, A, beta, cDesc, C)); }
[ "public", "static", "int", "cudnnReduceTensor", "(", "cudnnHandle", "handle", ",", "cudnnReduceTensorDescriptor", "reduceTensorDesc", ",", "Pointer", "indices", ",", "long", "indicesSizeInBytes", ",", "Pointer", "workspace", ",", "long", "workspaceSizeInBytes", ",", "Po...
The indices space is ignored for reduce ops other than min or max.
[ "The", "indices", "space", "is", "ignored", "for", "reduce", "ops", "other", "than", "min", "or", "max", "." ]
train
https://github.com/jcuda/jcudnn/blob/ce71f2fc02817cecace51a80e6db5f0c7f10cffc/JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java#L658-L673
Jasig/uPortal
uPortal-core/src/main/java/org/apereo/portal/i18n/LocaleManager.java
LocaleManager.addToLocaleList
private void addToLocaleList(List localeList, List<Locale> locales) { """ Add locales to the locale list if they aren't in there already """ if (locales != null) { for (Locale locale : locales) { if (locale != null && !localeList.contains(locale)) localeList.add(locale); } } }
java
private void addToLocaleList(List localeList, List<Locale> locales) { if (locales != null) { for (Locale locale : locales) { if (locale != null && !localeList.contains(locale)) localeList.add(locale); } } }
[ "private", "void", "addToLocaleList", "(", "List", "localeList", ",", "List", "<", "Locale", ">", "locales", ")", "{", "if", "(", "locales", "!=", "null", ")", "{", "for", "(", "Locale", "locale", ":", "locales", ")", "{", "if", "(", "locale", "!=", ...
Add locales to the locale list if they aren't in there already
[ "Add", "locales", "to", "the", "locale", "list", "if", "they", "aren", "t", "in", "there", "already" ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-core/src/main/java/org/apereo/portal/i18n/LocaleManager.java#L103-L109
maestrano/maestrano-java
src/main/java/com/maestrano/configuration/Sso.java
Sso.buildResponse
public Response buildResponse(String samlResponse) throws MnoException { """ Build a {@linkplain Response} with the provided base64 encoded XML string @param samlResponse @return @throws MnoException """ try { return Response.loadFromBase64XML(this, samlResponse); } catch (Exception e) { throw new MnoException("Could not build Response from samlResponse: " + samlResponse, e); } }
java
public Response buildResponse(String samlResponse) throws MnoException { try { return Response.loadFromBase64XML(this, samlResponse); } catch (Exception e) { throw new MnoException("Could not build Response from samlResponse: " + samlResponse, e); } }
[ "public", "Response", "buildResponse", "(", "String", "samlResponse", ")", "throws", "MnoException", "{", "try", "{", "return", "Response", ".", "loadFromBase64XML", "(", "this", ",", "samlResponse", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "...
Build a {@linkplain Response} with the provided base64 encoded XML string @param samlResponse @return @throws MnoException
[ "Build", "a", "{", "@linkplain", "Response", "}", "with", "the", "provided", "base64", "encoded", "XML", "string" ]
train
https://github.com/maestrano/maestrano-java/blob/e71c6d3172d7645529d678d1cb3ea9e0a59de314/src/main/java/com/maestrano/configuration/Sso.java#L189-L195
actframework/actframework
src/main/java/act/event/EventBus.java
EventBus.bindSync
public EventBus bindSync(Class<? extends EventObject> eventType, ActEventListener eventListener) { """ Bind a {@link ActEventListener eventListener} to an event type extended from {@link EventObject} synchronously. @param eventType the target event type - should be a sub class of {@link EventObject} @param eventListener the listener - an instance of {@link ActEventListener} or it's sub class @return this event bus instance @see #bind(Class, ActEventListener) """ return _bind(actEventListeners, eventType, eventListener, 0); }
java
public EventBus bindSync(Class<? extends EventObject> eventType, ActEventListener eventListener) { return _bind(actEventListeners, eventType, eventListener, 0); }
[ "public", "EventBus", "bindSync", "(", "Class", "<", "?", "extends", "EventObject", ">", "eventType", ",", "ActEventListener", "eventListener", ")", "{", "return", "_bind", "(", "actEventListeners", ",", "eventType", ",", "eventListener", ",", "0", ")", ";", "...
Bind a {@link ActEventListener eventListener} to an event type extended from {@link EventObject} synchronously. @param eventType the target event type - should be a sub class of {@link EventObject} @param eventListener the listener - an instance of {@link ActEventListener} or it's sub class @return this event bus instance @see #bind(Class, ActEventListener)
[ "Bind", "a", "{", "@link", "ActEventListener", "eventListener", "}", "to", "an", "event", "type", "extended", "from", "{", "@link", "EventObject", "}", "synchronously", "." ]
train
https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/event/EventBus.java#L766-L768
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.api_credential_GET
public ArrayList<Long> api_credential_GET(Long applicationId, OvhCredentialStateEnum status) throws IOException { """ List of your Api Credentials REST: GET /me/api/credential @param status [required] Filter the value of status property (=) @param applicationId [required] Filter the value of applicationId property (like) """ String qPath = "/me/api/credential"; StringBuilder sb = path(qPath); query(sb, "applicationId", applicationId); query(sb, "status", status); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<Long> api_credential_GET(Long applicationId, OvhCredentialStateEnum status) throws IOException { String qPath = "/me/api/credential"; StringBuilder sb = path(qPath); query(sb, "applicationId", applicationId); query(sb, "status", status); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "Long", ">", "api_credential_GET", "(", "Long", "applicationId", ",", "OvhCredentialStateEnum", "status", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/api/credential\"", ";", "StringBuilder", "sb", "=", "path", "(", ...
List of your Api Credentials REST: GET /me/api/credential @param status [required] Filter the value of status property (=) @param applicationId [required] Filter the value of applicationId property (like)
[ "List", "of", "your", "Api", "Credentials" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L514-L521
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/report/ReportBreakScreen.java
ReportBreakScreen.printData
public boolean printData(PrintWriter out, int iPrintOptions) { """ Print this field's data in XML format. @return true if default params were found for this form. @param out The http output stream. @exception DBException File exception. """ this.setLastBreak(this.isBreak()); if (!this.isLastBreak()) return false; if ((iPrintOptions & HtmlConstants.FOOTING_SCREEN) != HtmlConstants.FOOTING_SCREEN) this.setLastBreak(false); // For footers only boolean bInputFound = super.printData(out, iPrintOptions); return bInputFound; }
java
public boolean printData(PrintWriter out, int iPrintOptions) { this.setLastBreak(this.isBreak()); if (!this.isLastBreak()) return false; if ((iPrintOptions & HtmlConstants.FOOTING_SCREEN) != HtmlConstants.FOOTING_SCREEN) this.setLastBreak(false); // For footers only boolean bInputFound = super.printData(out, iPrintOptions); return bInputFound; }
[ "public", "boolean", "printData", "(", "PrintWriter", "out", ",", "int", "iPrintOptions", ")", "{", "this", ".", "setLastBreak", "(", "this", ".", "isBreak", "(", ")", ")", ";", "if", "(", "!", "this", ".", "isLastBreak", "(", ")", ")", "return", "fals...
Print this field's data in XML format. @return true if default params were found for this form. @param out The http output stream. @exception DBException File exception.
[ "Print", "this", "field", "s", "data", "in", "XML", "format", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/report/ReportBreakScreen.java#L93-L104
nabedge/mixer2
src/main/java/org/mixer2/xhtml/util/GetDescendantsUtil.java
GetDescendantsUtil.getDescendants
public static <T extends AbstractJaxb> List<T> getDescendants(T target, List<T> resultList, String clazz) { """ class属性の指定で子孫要素を返す @param target objects for scan @param resultList usually, pass new ArrayList @param clazz class property of tag @return """ return execute(target, resultList, null, clazz); }
java
public static <T extends AbstractJaxb> List<T> getDescendants(T target, List<T> resultList, String clazz) { return execute(target, resultList, null, clazz); }
[ "public", "static", "<", "T", "extends", "AbstractJaxb", ">", "List", "<", "T", ">", "getDescendants", "(", "T", "target", ",", "List", "<", "T", ">", "resultList", ",", "String", "clazz", ")", "{", "return", "execute", "(", "target", ",", "resultList", ...
class属性の指定で子孫要素を返す @param target objects for scan @param resultList usually, pass new ArrayList @param clazz class property of tag @return
[ "class属性の指定で子孫要素を返す" ]
train
https://github.com/nabedge/mixer2/blob/8c2db27cfcd65bf0b1e0242ef9362ebd8033777c/src/main/java/org/mixer2/xhtml/util/GetDescendantsUtil.java#L68-L71
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithPath.java
PactDslRequestWithPath.matchQuery
public PactDslRequestWithPath matchQuery(String parameter, String regex, List<String> example) { """ Match a repeating query parameter with a regex. @param parameter Query parameter @param regex Regular expression to match with each element @param example Example value list to use for the query parameter (unencoded) """ requestMatchers.addCategory("query").addRule(parameter, new RegexMatcher(regex)); query.put(parameter, example); return this; }
java
public PactDslRequestWithPath matchQuery(String parameter, String regex, List<String> example) { requestMatchers.addCategory("query").addRule(parameter, new RegexMatcher(regex)); query.put(parameter, example); return this; }
[ "public", "PactDslRequestWithPath", "matchQuery", "(", "String", "parameter", ",", "String", "regex", ",", "List", "<", "String", ">", "example", ")", "{", "requestMatchers", ".", "addCategory", "(", "\"query\"", ")", ".", "addRule", "(", "parameter", ",", "ne...
Match a repeating query parameter with a regex. @param parameter Query parameter @param regex Regular expression to match with each element @param example Example value list to use for the query parameter (unencoded)
[ "Match", "a", "repeating", "query", "parameter", "with", "a", "regex", "." ]
train
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithPath.java#L389-L393
aws/aws-sdk-java
aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/CopyProductRequest.java
CopyProductRequest.setSourceProvisioningArtifactIdentifiers
public void setSourceProvisioningArtifactIdentifiers(java.util.Collection<java.util.Map<String, String>> sourceProvisioningArtifactIdentifiers) { """ <p> The identifiers of the provisioning artifacts (also known as versions) of the product to copy. By default, all provisioning artifacts are copied. </p> @param sourceProvisioningArtifactIdentifiers The identifiers of the provisioning artifacts (also known as versions) of the product to copy. By default, all provisioning artifacts are copied. """ if (sourceProvisioningArtifactIdentifiers == null) { this.sourceProvisioningArtifactIdentifiers = null; return; } this.sourceProvisioningArtifactIdentifiers = new java.util.ArrayList<java.util.Map<String, String>>(sourceProvisioningArtifactIdentifiers); }
java
public void setSourceProvisioningArtifactIdentifiers(java.util.Collection<java.util.Map<String, String>> sourceProvisioningArtifactIdentifiers) { if (sourceProvisioningArtifactIdentifiers == null) { this.sourceProvisioningArtifactIdentifiers = null; return; } this.sourceProvisioningArtifactIdentifiers = new java.util.ArrayList<java.util.Map<String, String>>(sourceProvisioningArtifactIdentifiers); }
[ "public", "void", "setSourceProvisioningArtifactIdentifiers", "(", "java", ".", "util", ".", "Collection", "<", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", ">", "sourceProvisioningArtifactIdentifiers", ")", "{", "if", "(", "sourceProvisioni...
<p> The identifiers of the provisioning artifacts (also known as versions) of the product to copy. By default, all provisioning artifacts are copied. </p> @param sourceProvisioningArtifactIdentifiers The identifiers of the provisioning artifacts (also known as versions) of the product to copy. By default, all provisioning artifacts are copied.
[ "<p", ">", "The", "identifiers", "of", "the", "provisioning", "artifacts", "(", "also", "known", "as", "versions", ")", "of", "the", "product", "to", "copy", ".", "By", "default", "all", "provisioning", "artifacts", "are", "copied", ".", "<", "/", "p", "...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/CopyProductRequest.java#L375-L382
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/io/stream/ByteBufferOutputStream.java
ByteBufferOutputStream.writeTo
public void writeTo (@Nonnull @WillNotClose final OutputStream aOS, final boolean bClearBuffer) throws IOException { """ Write everything to the passed output stream and optionally clear the contained buffer. This works only if the contained ByteBuffer has a backing array. @param aOS The output stream to write to. May not be <code>null</code>. @param bClearBuffer <code>true</code> to clear the buffer, <code>false</code> to not do it. If <code>false</code> you may call {@link #reset()} to clear it manually afterwards. @throws IOException In case of IO error """ ValueEnforcer.notNull (aOS, "OutputStream"); aOS.write (m_aBuffer.array (), m_aBuffer.arrayOffset (), m_aBuffer.position ()); if (bClearBuffer) m_aBuffer.clear (); }
java
public void writeTo (@Nonnull @WillNotClose final OutputStream aOS, final boolean bClearBuffer) throws IOException { ValueEnforcer.notNull (aOS, "OutputStream"); aOS.write (m_aBuffer.array (), m_aBuffer.arrayOffset (), m_aBuffer.position ()); if (bClearBuffer) m_aBuffer.clear (); }
[ "public", "void", "writeTo", "(", "@", "Nonnull", "@", "WillNotClose", "final", "OutputStream", "aOS", ",", "final", "boolean", "bClearBuffer", ")", "throws", "IOException", "{", "ValueEnforcer", ".", "notNull", "(", "aOS", ",", "\"OutputStream\"", ")", ";", "...
Write everything to the passed output stream and optionally clear the contained buffer. This works only if the contained ByteBuffer has a backing array. @param aOS The output stream to write to. May not be <code>null</code>. @param bClearBuffer <code>true</code> to clear the buffer, <code>false</code> to not do it. If <code>false</code> you may call {@link #reset()} to clear it manually afterwards. @throws IOException In case of IO error
[ "Write", "everything", "to", "the", "passed", "output", "stream", "and", "optionally", "clear", "the", "contained", "buffer", ".", "This", "works", "only", "if", "the", "contained", "ByteBuffer", "has", "a", "backing", "array", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/ByteBufferOutputStream.java#L341-L348
logic-ng/LogicNG
src/main/java/org/logicng/solvers/SATSolver.java
SATSolver.addClauseSetWithRelaxation
private void addClauseSetWithRelaxation(final Variable relaxationVar, final Formula formula) { """ Adds a formula which is already in CNF with a given relaxation to the solver. @param relaxationVar the relaxation variable @param formula the formula in CNF """ switch (formula.type()) { case TRUE: break; case FALSE: case LITERAL: case OR: this.addClauseWithRelaxation(relaxationVar, formula); break; case AND: for (final Formula op : formula) { this.addClauseWithRelaxation(relaxationVar, op); } break; default: throw new IllegalArgumentException("Input formula ist not a valid CNF: " + formula); } }
java
private void addClauseSetWithRelaxation(final Variable relaxationVar, final Formula formula) { switch (formula.type()) { case TRUE: break; case FALSE: case LITERAL: case OR: this.addClauseWithRelaxation(relaxationVar, formula); break; case AND: for (final Formula op : formula) { this.addClauseWithRelaxation(relaxationVar, op); } break; default: throw new IllegalArgumentException("Input formula ist not a valid CNF: " + formula); } }
[ "private", "void", "addClauseSetWithRelaxation", "(", "final", "Variable", "relaxationVar", ",", "final", "Formula", "formula", ")", "{", "switch", "(", "formula", ".", "type", "(", ")", ")", "{", "case", "TRUE", ":", "break", ";", "case", "FALSE", ":", "c...
Adds a formula which is already in CNF with a given relaxation to the solver. @param relaxationVar the relaxation variable @param formula the formula in CNF
[ "Adds", "a", "formula", "which", "is", "already", "in", "CNF", "with", "a", "given", "relaxation", "to", "the", "solver", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/SATSolver.java#L205-L220
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetRollingUpgradesInner.java
VirtualMachineScaleSetRollingUpgradesInner.beginStartOSUpgradeAsync
public Observable<OperationStatusResponseInner> beginStartOSUpgradeAsync(String resourceGroupName, String vmScaleSetName) { """ Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image OS version. Instances which are already running the latest available OS version are not affected. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatusResponseInner object """ return beginStartOSUpgradeWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
java
public Observable<OperationStatusResponseInner> beginStartOSUpgradeAsync(String resourceGroupName, String vmScaleSetName) { return beginStartOSUpgradeWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatusResponseInner", ">", "beginStartOSUpgradeAsync", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ")", "{", "return", "beginStartOSUpgradeWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmScaleSetName",...
Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image OS version. Instances which are already running the latest available OS version are not affected. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatusResponseInner object
[ "Starts", "a", "rolling", "upgrade", "to", "move", "all", "virtual", "machine", "scale", "set", "instances", "to", "the", "latest", "available", "Platform", "Image", "OS", "version", ".", "Instances", "which", "are", "already", "running", "the", "latest", "ava...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetRollingUpgradesInner.java#L337-L344
alrocar/POIProxy
es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/proxy/POIProxy.java
POIProxy.doRequest
public String doRequest(String url, DescribeService service, String id) throws Exception { """ Calls {@link Downloader#downloadFromUrl(String, es.prodevelop.gvsig.mini.utiles.Cancellable)} @param url The url to request to @param service The {@link DescribeService} object @param id The ID of the {@link DescribeService} @return The data downloaded @throws Exception """ RequestService request = requestServices.getRequestService(service.getAuthType()); byte[] data = request.download(url, id, PropertyLocator.getInstance().tempFolder + id + File.separator, service.getAuth()); System.out.println(url); if (service.getCompression() != null && service.getCompression().equals(CompressionEnum.ZIP.format)) { Unzip unzip = new Unzip(); unzip.unzip(PropertyLocator.getInstance().tempFolder + id + File.separator, PropertyLocator.getInstance().tempFolder + id + File.separator + id, true); Downloader opener = new Downloader(); return opener.openFile( PropertyLocator.getInstance().tempFolder + id + File.separator + service.getContentFile()); } return new String(data, service.getEncoding()); }
java
public String doRequest(String url, DescribeService service, String id) throws Exception { RequestService request = requestServices.getRequestService(service.getAuthType()); byte[] data = request.download(url, id, PropertyLocator.getInstance().tempFolder + id + File.separator, service.getAuth()); System.out.println(url); if (service.getCompression() != null && service.getCompression().equals(CompressionEnum.ZIP.format)) { Unzip unzip = new Unzip(); unzip.unzip(PropertyLocator.getInstance().tempFolder + id + File.separator, PropertyLocator.getInstance().tempFolder + id + File.separator + id, true); Downloader opener = new Downloader(); return opener.openFile( PropertyLocator.getInstance().tempFolder + id + File.separator + service.getContentFile()); } return new String(data, service.getEncoding()); }
[ "public", "String", "doRequest", "(", "String", "url", ",", "DescribeService", "service", ",", "String", "id", ")", "throws", "Exception", "{", "RequestService", "request", "=", "requestServices", ".", "getRequestService", "(", "service", ".", "getAuthType", "(", ...
Calls {@link Downloader#downloadFromUrl(String, es.prodevelop.gvsig.mini.utiles.Cancellable)} @param url The url to request to @param service The {@link DescribeService} object @param id The ID of the {@link DescribeService} @return The data downloaded @throws Exception
[ "Calls", "{", "@link", "Downloader#downloadFromUrl", "(", "String", "es", ".", "prodevelop", ".", "gvsig", ".", "mini", ".", "utiles", ".", "Cancellable", ")", "}" ]
train
https://github.com/alrocar/POIProxy/blob/e1dabe738a862478b2580e90d5fc4209a2997868/es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/proxy/POIProxy.java#L657-L675
line/centraldogma
server-auth/shiro/src/main/java/com/linecorp/centraldogma/server/auth/shiro/realm/SearchFirstActiveDirectoryRealm.java
SearchFirstActiveDirectoryRealm.queryForAuthenticationInfo
@Nullable @Override protected AuthenticationInfo queryForAuthenticationInfo( AuthenticationToken token, LdapContextFactory ldapContextFactory) throws NamingException { """ Builds an {@link AuthenticationInfo} object by querying the active directory LDAP context for the specified username. """ try { return queryForAuthenticationInfo0(token, ldapContextFactory); } catch (ServiceUnavailableException e) { // It might be a temporary failure, so try again. return queryForAuthenticationInfo0(token, ldapContextFactory); } }
java
@Nullable @Override protected AuthenticationInfo queryForAuthenticationInfo( AuthenticationToken token, LdapContextFactory ldapContextFactory) throws NamingException { try { return queryForAuthenticationInfo0(token, ldapContextFactory); } catch (ServiceUnavailableException e) { // It might be a temporary failure, so try again. return queryForAuthenticationInfo0(token, ldapContextFactory); } }
[ "@", "Nullable", "@", "Override", "protected", "AuthenticationInfo", "queryForAuthenticationInfo", "(", "AuthenticationToken", "token", ",", "LdapContextFactory", "ldapContextFactory", ")", "throws", "NamingException", "{", "try", "{", "return", "queryForAuthenticationInfo0",...
Builds an {@link AuthenticationInfo} object by querying the active directory LDAP context for the specified username.
[ "Builds", "an", "{" ]
train
https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server-auth/shiro/src/main/java/com/linecorp/centraldogma/server/auth/shiro/realm/SearchFirstActiveDirectoryRealm.java#L104-L114
javagl/CommonUI
src/main/java/de/javagl/common/ui/GuiUtils.java
GuiUtils.setDeepEnabled
public static void setDeepEnabled(Component component, boolean enabled) { """ Enables or disables the given component and all its children recursively @param component The component @param enabled Whether the component tree should be enabled """ component.setEnabled(enabled); if (component instanceof Container) { Container container = (Container)component; for (Component c : container.getComponents()) { setDeepEnabled(c, enabled); } } }
java
public static void setDeepEnabled(Component component, boolean enabled) { component.setEnabled(enabled); if (component instanceof Container) { Container container = (Container)component; for (Component c : container.getComponents()) { setDeepEnabled(c, enabled); } } }
[ "public", "static", "void", "setDeepEnabled", "(", "Component", "component", ",", "boolean", "enabled", ")", "{", "component", ".", "setEnabled", "(", "enabled", ")", ";", "if", "(", "component", "instanceof", "Container", ")", "{", "Container", "container", "...
Enables or disables the given component and all its children recursively @param component The component @param enabled Whether the component tree should be enabled
[ "Enables", "or", "disables", "the", "given", "component", "and", "all", "its", "children", "recursively" ]
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/GuiUtils.java#L100-L111
apache/flink
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/expressions/ExpressionResolver.java
ExpressionResolver.resolveGroupWindow
public LogicalWindow resolveGroupWindow(GroupWindow window) { """ Converts an API class to a logical window for planning with expressions already resolved. @param window window to resolve @return logical window with expressions resolved """ Expression alias = window.getAlias(); if (!(alias instanceof UnresolvedReferenceExpression)) { throw new ValidationException("Alias of group window should be an UnresolvedFieldReference"); } final String windowName = ((UnresolvedReferenceExpression) alias).getName(); List<Expression> resolvedTimeFieldExpression = prepareExpressions(Collections.singletonList(window.getTimeField())); if (resolvedTimeFieldExpression.size() != 1) { throw new ValidationException("Group Window only supports a single time field column."); } PlannerExpression timeField = resolvedTimeFieldExpression.get(0).accept(bridgeConverter); //TODO replace with LocalReferenceExpression WindowReference resolvedAlias = new WindowReference(windowName, new Some<>(timeField.resultType())); if (window instanceof TumbleWithSizeOnTimeWithAlias) { TumbleWithSizeOnTimeWithAlias tw = (TumbleWithSizeOnTimeWithAlias) window; return new TumblingGroupWindow( resolvedAlias, timeField, resolveFieldsInSingleExpression(tw.getSize()).accept(bridgeConverter)); } else if (window instanceof SlideWithSizeAndSlideOnTimeWithAlias) { SlideWithSizeAndSlideOnTimeWithAlias sw = (SlideWithSizeAndSlideOnTimeWithAlias) window; return new SlidingGroupWindow( resolvedAlias, timeField, resolveFieldsInSingleExpression(sw.getSize()).accept(bridgeConverter), resolveFieldsInSingleExpression(sw.getSlide()).accept(bridgeConverter)); } else if (window instanceof SessionWithGapOnTimeWithAlias) { SessionWithGapOnTimeWithAlias sw = (SessionWithGapOnTimeWithAlias) window; return new SessionGroupWindow( resolvedAlias, timeField, resolveFieldsInSingleExpression(sw.getGap()).accept(bridgeConverter)); } else { throw new TableException("Unknown window type"); } }
java
public LogicalWindow resolveGroupWindow(GroupWindow window) { Expression alias = window.getAlias(); if (!(alias instanceof UnresolvedReferenceExpression)) { throw new ValidationException("Alias of group window should be an UnresolvedFieldReference"); } final String windowName = ((UnresolvedReferenceExpression) alias).getName(); List<Expression> resolvedTimeFieldExpression = prepareExpressions(Collections.singletonList(window.getTimeField())); if (resolvedTimeFieldExpression.size() != 1) { throw new ValidationException("Group Window only supports a single time field column."); } PlannerExpression timeField = resolvedTimeFieldExpression.get(0).accept(bridgeConverter); //TODO replace with LocalReferenceExpression WindowReference resolvedAlias = new WindowReference(windowName, new Some<>(timeField.resultType())); if (window instanceof TumbleWithSizeOnTimeWithAlias) { TumbleWithSizeOnTimeWithAlias tw = (TumbleWithSizeOnTimeWithAlias) window; return new TumblingGroupWindow( resolvedAlias, timeField, resolveFieldsInSingleExpression(tw.getSize()).accept(bridgeConverter)); } else if (window instanceof SlideWithSizeAndSlideOnTimeWithAlias) { SlideWithSizeAndSlideOnTimeWithAlias sw = (SlideWithSizeAndSlideOnTimeWithAlias) window; return new SlidingGroupWindow( resolvedAlias, timeField, resolveFieldsInSingleExpression(sw.getSize()).accept(bridgeConverter), resolveFieldsInSingleExpression(sw.getSlide()).accept(bridgeConverter)); } else if (window instanceof SessionWithGapOnTimeWithAlias) { SessionWithGapOnTimeWithAlias sw = (SessionWithGapOnTimeWithAlias) window; return new SessionGroupWindow( resolvedAlias, timeField, resolveFieldsInSingleExpression(sw.getGap()).accept(bridgeConverter)); } else { throw new TableException("Unknown window type"); } }
[ "public", "LogicalWindow", "resolveGroupWindow", "(", "GroupWindow", "window", ")", "{", "Expression", "alias", "=", "window", ".", "getAlias", "(", ")", ";", "if", "(", "!", "(", "alias", "instanceof", "UnresolvedReferenceExpression", ")", ")", "{", "throw", ...
Converts an API class to a logical window for planning with expressions already resolved. @param window window to resolve @return logical window with expressions resolved
[ "Converts", "an", "API", "class", "to", "a", "logical", "window", "for", "planning", "with", "expressions", "already", "resolved", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/expressions/ExpressionResolver.java#L156-L196
line/armeria
core/src/main/java/com/linecorp/armeria/common/metric/DropwizardMeterRegistries.java
DropwizardMeterRegistries.newRegistry
public static DropwizardMeterRegistry newRegistry(HierarchicalNameMapper nameMapper, Clock clock) { """ Returns a newly-created {@link DropwizardMeterRegistry} instance with the specified {@link HierarchicalNameMapper} and {@link Clock}. """ return newRegistry(new MetricRegistry(), nameMapper, clock); }
java
public static DropwizardMeterRegistry newRegistry(HierarchicalNameMapper nameMapper, Clock clock) { return newRegistry(new MetricRegistry(), nameMapper, clock); }
[ "public", "static", "DropwizardMeterRegistry", "newRegistry", "(", "HierarchicalNameMapper", "nameMapper", ",", "Clock", "clock", ")", "{", "return", "newRegistry", "(", "new", "MetricRegistry", "(", ")", ",", "nameMapper", ",", "clock", ")", ";", "}" ]
Returns a newly-created {@link DropwizardMeterRegistry} instance with the specified {@link HierarchicalNameMapper} and {@link Clock}.
[ "Returns", "a", "newly", "-", "created", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/metric/DropwizardMeterRegistries.java#L116-L118
Azure/azure-sdk-for-java
containerinstance/resource-manager/v2017_12_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2017_12_01_preview/implementation/ContainerLogsInner.java
ContainerLogsInner.list
public LogsInner list(String resourceGroupName, String containerGroupName, String containerName) { """ Get the logs for a specified container instance. Get the logs for a specified container instance in a specified resource group and container group. @param resourceGroupName The name of the resource group. @param containerGroupName The name of the container group. @param containerName The name of the container instance. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the LogsInner object if successful. """ return listWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName).toBlocking().single().body(); }
java
public LogsInner list(String resourceGroupName, String containerGroupName, String containerName) { return listWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName).toBlocking().single().body(); }
[ "public", "LogsInner", "list", "(", "String", "resourceGroupName", ",", "String", "containerGroupName", ",", "String", "containerName", ")", "{", "return", "listWithServiceResponseAsync", "(", "resourceGroupName", ",", "containerGroupName", ",", "containerName", ")", "....
Get the logs for a specified container instance. Get the logs for a specified container instance in a specified resource group and container group. @param resourceGroupName The name of the resource group. @param containerGroupName The name of the container group. @param containerName The name of the container instance. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the LogsInner object if successful.
[ "Get", "the", "logs", "for", "a", "specified", "container", "instance", ".", "Get", "the", "logs", "for", "a", "specified", "container", "instance", "in", "a", "specified", "resource", "group", "and", "container", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerinstance/resource-manager/v2017_12_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2017_12_01_preview/implementation/ContainerLogsInner.java#L72-L74
konvergeio/cofoja
src/main/java/com/google/java/contract/core/agent/ContractClassFileTransformer.java
ContractClassFileTransformer.instrumentWithDebug
@Requires("bytecode != null") @Ensures("result != null") private byte[] instrumentWithDebug(byte[] bytecode) { """ Instruments the passed class file so that it contains debug information extraction from annotations. """ ClassReader reader = new ClassReader(bytecode); ClassWriter writer = new NonLoadingClassWriter(reader, 0); reader.accept(new HelperClassAdapter(writer), ClassReader.EXPAND_FRAMES); return writer.toByteArray(); }
java
@Requires("bytecode != null") @Ensures("result != null") private byte[] instrumentWithDebug(byte[] bytecode) { ClassReader reader = new ClassReader(bytecode); ClassWriter writer = new NonLoadingClassWriter(reader, 0); reader.accept(new HelperClassAdapter(writer), ClassReader.EXPAND_FRAMES); return writer.toByteArray(); }
[ "@", "Requires", "(", "\"bytecode != null\"", ")", "@", "Ensures", "(", "\"result != null\"", ")", "private", "byte", "[", "]", "instrumentWithDebug", "(", "byte", "[", "]", "bytecode", ")", "{", "ClassReader", "reader", "=", "new", "ClassReader", "(", "byteco...
Instruments the passed class file so that it contains debug information extraction from annotations.
[ "Instruments", "the", "passed", "class", "file", "so", "that", "it", "contains", "debug", "information", "extraction", "from", "annotations", "." ]
train
https://github.com/konvergeio/cofoja/blob/6ded58fa05eb5bf85f16353c8dd4c70bee59121a/src/main/java/com/google/java/contract/core/agent/ContractClassFileTransformer.java#L399-L406
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorePointsInner.java
RestorePointsInner.createAsync
public Observable<RestorePointInner> createAsync(String resourceGroupName, String serverName, String databaseName, String restorePointLabel) { """ Creates a restore point for a data warehouse. @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 restorePointLabel The restore point label to apply @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return createWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointLabel).map(new Func1<ServiceResponse<RestorePointInner>, RestorePointInner>() { @Override public RestorePointInner call(ServiceResponse<RestorePointInner> response) { return response.body(); } }); }
java
public Observable<RestorePointInner> createAsync(String resourceGroupName, String serverName, String databaseName, String restorePointLabel) { return createWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointLabel).map(new Func1<ServiceResponse<RestorePointInner>, RestorePointInner>() { @Override public RestorePointInner call(ServiceResponse<RestorePointInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RestorePointInner", ">", "createAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "String", "restorePointLabel", ")", "{", "return", "createWithServiceResponseAsync", "(", "resource...
Creates a restore point for a data warehouse. @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 restorePointLabel The restore point label to apply @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "a", "restore", "point", "for", "a", "data", "warehouse", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorePointsInner.java#L220-L227
alkacon/opencms-core
src/org/opencms/ade/contenteditor/CmsContentService.java
CmsContentService.getFormatterForElement
private I_CmsFormatterBean getFormatterForElement(CmsContainerElementBean containerElement) { """ Returns the formatter configuration for the given container element bean.<p> @param containerElement the container element @return the formatter configuration """ if ((containerElement != null) && (containerElement.getFormatterId() != null) && !containerElement.getFormatterId().isNullUUID()) { CmsUUID formatterId = containerElement.getFormatterId(); // find formatter config setting for (Entry<String, String> settingEntry : containerElement.getIndividualSettings().entrySet()) { if (settingEntry.getKey().startsWith(CmsFormatterConfig.FORMATTER_SETTINGS_KEY)) { String formatterConfigId = settingEntry.getValue(); if (CmsUUID.isValidUUID(formatterConfigId)) { I_CmsFormatterBean formatter = OpenCms.getADEManager().getCachedFormatters( false).getFormatters().get(new CmsUUID(formatterConfigId)); if (formatterId.equals(formatter.getJspStructureId())) { return formatter; } } } } } return null; }
java
private I_CmsFormatterBean getFormatterForElement(CmsContainerElementBean containerElement) { if ((containerElement != null) && (containerElement.getFormatterId() != null) && !containerElement.getFormatterId().isNullUUID()) { CmsUUID formatterId = containerElement.getFormatterId(); // find formatter config setting for (Entry<String, String> settingEntry : containerElement.getIndividualSettings().entrySet()) { if (settingEntry.getKey().startsWith(CmsFormatterConfig.FORMATTER_SETTINGS_KEY)) { String formatterConfigId = settingEntry.getValue(); if (CmsUUID.isValidUUID(formatterConfigId)) { I_CmsFormatterBean formatter = OpenCms.getADEManager().getCachedFormatters( false).getFormatters().get(new CmsUUID(formatterConfigId)); if (formatterId.equals(formatter.getJspStructureId())) { return formatter; } } } } } return null; }
[ "private", "I_CmsFormatterBean", "getFormatterForElement", "(", "CmsContainerElementBean", "containerElement", ")", "{", "if", "(", "(", "containerElement", "!=", "null", ")", "&&", "(", "containerElement", ".", "getFormatterId", "(", ")", "!=", "null", ")", "&&", ...
Returns the formatter configuration for the given container element bean.<p> @param containerElement the container element @return the formatter configuration
[ "Returns", "the", "formatter", "configuration", "for", "the", "given", "container", "element", "bean", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/contenteditor/CmsContentService.java#L1838-L1860
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/regex/RegExHelper.java
RegExHelper.getAsIdentifier
@Nullable public static String getAsIdentifier (@Nullable final String s, @Nonnull final String sReplacement) { """ Convert an identifier to a programming language identifier by replacing all non-word characters with an underscore. @param s The string to convert. May be <code>null</code> or empty. @param sReplacement The replacement string to be used for all non-identifier characters. May be empty but not be <code>null</code>. @return The converted string or <code>null</code> if the input string is <code>null</code>. Maybe an invalid identifier, if the replacement is empty, and the identifier starts with an illegal character, or if the replacement is empty and the source string only contains invalid characters! """ ValueEnforcer.notNull (sReplacement, "Replacement"); if (StringHelper.hasNoText (s)) return s; // replace all non-word characters with the replacement character // Important: replacement does not need to be quoted, because it is not // treated as a regular expression! final String ret = stringReplacePattern ("\\W", s, sReplacement); if (ret.length () == 0) return sReplacement; if (!Character.isJavaIdentifierStart (ret.charAt (0))) return sReplacement + ret; return ret; }
java
@Nullable public static String getAsIdentifier (@Nullable final String s, @Nonnull final String sReplacement) { ValueEnforcer.notNull (sReplacement, "Replacement"); if (StringHelper.hasNoText (s)) return s; // replace all non-word characters with the replacement character // Important: replacement does not need to be quoted, because it is not // treated as a regular expression! final String ret = stringReplacePattern ("\\W", s, sReplacement); if (ret.length () == 0) return sReplacement; if (!Character.isJavaIdentifierStart (ret.charAt (0))) return sReplacement + ret; return ret; }
[ "@", "Nullable", "public", "static", "String", "getAsIdentifier", "(", "@", "Nullable", "final", "String", "s", ",", "@", "Nonnull", "final", "String", "sReplacement", ")", "{", "ValueEnforcer", ".", "notNull", "(", "sReplacement", ",", "\"Replacement\"", ")", ...
Convert an identifier to a programming language identifier by replacing all non-word characters with an underscore. @param s The string to convert. May be <code>null</code> or empty. @param sReplacement The replacement string to be used for all non-identifier characters. May be empty but not be <code>null</code>. @return The converted string or <code>null</code> if the input string is <code>null</code>. Maybe an invalid identifier, if the replacement is empty, and the identifier starts with an illegal character, or if the replacement is empty and the source string only contains invalid characters!
[ "Convert", "an", "identifier", "to", "a", "programming", "language", "identifier", "by", "replacing", "all", "non", "-", "word", "characters", "with", "an", "underscore", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/regex/RegExHelper.java#L319-L336
fedups/com.obdobion.argument
src/main/java/com/obdobion/argument/input/CommandLineParser.java
CommandLineParser.getInstance
static public IParserInput getInstance( final char commandPrefix, final File args) throws IOException { """ <p> getInstance. </p> @param commandPrefix a char. @param args a {@link java.io.File} object. @return a {@link com.obdobion.argument.input.IParserInput} object. @throws java.io.IOException if any. """ return getInstance(commandPrefix, false, args); }
java
static public IParserInput getInstance( final char commandPrefix, final File args) throws IOException { return getInstance(commandPrefix, false, args); }
[ "static", "public", "IParserInput", "getInstance", "(", "final", "char", "commandPrefix", ",", "final", "File", "args", ")", "throws", "IOException", "{", "return", "getInstance", "(", "commandPrefix", ",", "false", ",", "args", ")", ";", "}" ]
<p> getInstance. </p> @param commandPrefix a char. @param args a {@link java.io.File} object. @return a {@link com.obdobion.argument.input.IParserInput} object. @throws java.io.IOException if any.
[ "<p", ">", "getInstance", ".", "<", "/", "p", ">" ]
train
https://github.com/fedups/com.obdobion.argument/blob/9679aebbeedaef4e592227842fa0e91410708a67/src/main/java/com/obdobion/argument/input/CommandLineParser.java#L112-L118
Alluxio/alluxio
core/client/hdfs/src/main/java/alluxio/hadoop/AbstractFileSystem.java
AbstractFileSystem.setOwner
@Override public void setOwner(Path path, final String username, final String groupname) throws IOException { """ Changes owner or group of a path (i.e. a file or a directory). If username is null, the original username remains unchanged. Same as groupname. If username and groupname are non-null, both of them will be changed. @param path path to set owner or group @param username username to be set @param groupname groupname to be set """ LOG.debug("setOwner({},{},{})", path, username, groupname); AlluxioURI uri = new AlluxioURI(HadoopUtils.getPathWithoutScheme(path)); SetAttributePOptions.Builder optionsBuilder = SetAttributePOptions.newBuilder(); boolean ownerOrGroupChanged = false; if (username != null && !username.isEmpty()) { optionsBuilder.setOwner(username).setRecursive(false); ownerOrGroupChanged = true; } if (groupname != null && !groupname.isEmpty()) { optionsBuilder.setGroup(groupname).setRecursive(false); ownerOrGroupChanged = true; } if (ownerOrGroupChanged) { try { mFileSystem.setAttribute(uri, optionsBuilder.build()); } catch (AlluxioException e) { throw new IOException(e); } } }
java
@Override public void setOwner(Path path, final String username, final String groupname) throws IOException { LOG.debug("setOwner({},{},{})", path, username, groupname); AlluxioURI uri = new AlluxioURI(HadoopUtils.getPathWithoutScheme(path)); SetAttributePOptions.Builder optionsBuilder = SetAttributePOptions.newBuilder(); boolean ownerOrGroupChanged = false; if (username != null && !username.isEmpty()) { optionsBuilder.setOwner(username).setRecursive(false); ownerOrGroupChanged = true; } if (groupname != null && !groupname.isEmpty()) { optionsBuilder.setGroup(groupname).setRecursive(false); ownerOrGroupChanged = true; } if (ownerOrGroupChanged) { try { mFileSystem.setAttribute(uri, optionsBuilder.build()); } catch (AlluxioException e) { throw new IOException(e); } } }
[ "@", "Override", "public", "void", "setOwner", "(", "Path", "path", ",", "final", "String", "username", ",", "final", "String", "groupname", ")", "throws", "IOException", "{", "LOG", ".", "debug", "(", "\"setOwner({},{},{})\"", ",", "path", ",", "username", ...
Changes owner or group of a path (i.e. a file or a directory). If username is null, the original username remains unchanged. Same as groupname. If username and groupname are non-null, both of them will be changed. @param path path to set owner or group @param username username to be set @param groupname groupname to be set
[ "Changes", "owner", "or", "group", "of", "a", "path", "(", "i", ".", "e", ".", "a", "file", "or", "a", "directory", ")", ".", "If", "username", "is", "null", "the", "original", "username", "remains", "unchanged", ".", "Same", "as", "groupname", ".", ...
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/client/hdfs/src/main/java/alluxio/hadoop/AbstractFileSystem.java#L374-L396
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java
RegistriesInner.beginImportImage
public void beginImportImage(String resourceGroupName, String registryName, ImportImageParameters parameters) { """ Copies an image to this container registry from the specified container registry. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param parameters The parameters specifying the image to copy and the source container registry. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ beginImportImageWithServiceResponseAsync(resourceGroupName, registryName, parameters).toBlocking().single().body(); }
java
public void beginImportImage(String resourceGroupName, String registryName, ImportImageParameters parameters) { beginImportImageWithServiceResponseAsync(resourceGroupName, registryName, parameters).toBlocking().single().body(); }
[ "public", "void", "beginImportImage", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "ImportImageParameters", "parameters", ")", "{", "beginImportImageWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ",", "parameters", ")", ...
Copies an image to this container registry from the specified container registry. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param parameters The parameters specifying the image to copy and the source container registry. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Copies", "an", "image", "to", "this", "container", "registry", "from", "the", "specified", "container", "registry", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java#L242-L244
finmath/finmath-lib
src/main/java/net/finmath/marketdata/model/bond/Bond.java
Bond.getAccruedInterest
public double getAccruedInterest(double time, AnalyticModel model) { """ Returns the accrued interest of the bond for a given time. @param time The time of interest as double. @param model The model under which the product is valued. @return The accrued interest. """ LocalDate date= FloatingpointDate.getDateFromFloatingPointDate(schedule.getReferenceDate(), time); return getAccruedInterest(date, model); }
java
public double getAccruedInterest(double time, AnalyticModel model) { LocalDate date= FloatingpointDate.getDateFromFloatingPointDate(schedule.getReferenceDate(), time); return getAccruedInterest(date, model); }
[ "public", "double", "getAccruedInterest", "(", "double", "time", ",", "AnalyticModel", "model", ")", "{", "LocalDate", "date", "=", "FloatingpointDate", ".", "getDateFromFloatingPointDate", "(", "schedule", ".", "getReferenceDate", "(", ")", ",", "time", ")", ";",...
Returns the accrued interest of the bond for a given time. @param time The time of interest as double. @param model The model under which the product is valued. @return The accrued interest.
[ "Returns", "the", "accrued", "interest", "of", "the", "bond", "for", "a", "given", "time", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/bond/Bond.java#L324-L327
Erudika/para
para-core/src/main/java/com/erudika/para/core/User.java
User.isValidPasswordResetToken
public final boolean isValidPasswordResetToken(String token) { """ Validates a token sent via email for password reset. @param token a token @return true if valid """ Sysprop s = CoreUtils.getInstance().getDao().read(getAppid(), identifier); return isValidToken(s, Config._RESET_TOKEN, token); }
java
public final boolean isValidPasswordResetToken(String token) { Sysprop s = CoreUtils.getInstance().getDao().read(getAppid(), identifier); return isValidToken(s, Config._RESET_TOKEN, token); }
[ "public", "final", "boolean", "isValidPasswordResetToken", "(", "String", "token", ")", "{", "Sysprop", "s", "=", "CoreUtils", ".", "getInstance", "(", ")", ".", "getDao", "(", ")", ".", "read", "(", "getAppid", "(", ")", ",", "identifier", ")", ";", "re...
Validates a token sent via email for password reset. @param token a token @return true if valid
[ "Validates", "a", "token", "sent", "via", "email", "for", "password", "reset", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/core/User.java#L718-L721
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/io/IOUtils.java
IOUtils.writeStringToTempFile
public static File writeStringToTempFile(String contents, String path, String encoding) throws IOException { """ Writes a string to a temporary file @param contents The string to write @param path The file path @param encoding The encoding to encode in @throws IOException In case of failure """ OutputStream writer = null; File tmp = File.createTempFile(path,".tmp"); if (path.endsWith(".gz")) { writer = new GZIPOutputStream(new FileOutputStream(tmp)); } else { writer = new BufferedOutputStream(new FileOutputStream(tmp)); } writer.write(contents.getBytes(encoding)); writer.close(); return tmp; }
java
public static File writeStringToTempFile(String contents, String path, String encoding) throws IOException { OutputStream writer = null; File tmp = File.createTempFile(path,".tmp"); if (path.endsWith(".gz")) { writer = new GZIPOutputStream(new FileOutputStream(tmp)); } else { writer = new BufferedOutputStream(new FileOutputStream(tmp)); } writer.write(contents.getBytes(encoding)); writer.close(); return tmp; }
[ "public", "static", "File", "writeStringToTempFile", "(", "String", "contents", ",", "String", "path", ",", "String", "encoding", ")", "throws", "IOException", "{", "OutputStream", "writer", "=", "null", ";", "File", "tmp", "=", "File", ".", "createTempFile", ...
Writes a string to a temporary file @param contents The string to write @param path The file path @param encoding The encoding to encode in @throws IOException In case of failure
[ "Writes", "a", "string", "to", "a", "temporary", "file" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/io/IOUtils.java#L224-L235
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/AffineTransformation.java
AffineTransformation.reorderAxesTransformation
public static AffineTransformation reorderAxesTransformation(int dim, int... axes) { """ Generate a transformation that reorders axes in the given way. The list of axes to be used should not contain duplicates, or the resulting matrix will not be invertible. It does not have to be complete however, in particular an empty list will result in the identity transform: unmentioned axes will be appended in their original order. @param dim Dimensionality of vector space (resulting Matrix will be dim+1 x dim+1) @param axes (Partial) list of axes @return new transformation to do the requested reordering """ double[][] m = zeroMatrix(dim + 1); // insert ones appropriately: for(int i = 0; i < axes.length; i++) { assert (0 < axes[i] && axes[i] <= dim); m[i][axes[i] - 1] = 1.0; } int useddim = 1; for(int i = axes.length; i < dim + 1; i++) { // find next "unused" dimension. { boolean search = true; while(search) { search = false; for(int a : axes) { if(a == useddim) { search = true; useddim++; break; } } } } m[i][useddim - 1] = 1.0; useddim++; } assert (useddim - 2 == dim); return new AffineTransformation(dim, m, null); }
java
public static AffineTransformation reorderAxesTransformation(int dim, int... axes) { double[][] m = zeroMatrix(dim + 1); // insert ones appropriately: for(int i = 0; i < axes.length; i++) { assert (0 < axes[i] && axes[i] <= dim); m[i][axes[i] - 1] = 1.0; } int useddim = 1; for(int i = axes.length; i < dim + 1; i++) { // find next "unused" dimension. { boolean search = true; while(search) { search = false; for(int a : axes) { if(a == useddim) { search = true; useddim++; break; } } } } m[i][useddim - 1] = 1.0; useddim++; } assert (useddim - 2 == dim); return new AffineTransformation(dim, m, null); }
[ "public", "static", "AffineTransformation", "reorderAxesTransformation", "(", "int", "dim", ",", "int", "...", "axes", ")", "{", "double", "[", "]", "[", "]", "m", "=", "zeroMatrix", "(", "dim", "+", "1", ")", ";", "// insert ones appropriately:", "for", "("...
Generate a transformation that reorders axes in the given way. The list of axes to be used should not contain duplicates, or the resulting matrix will not be invertible. It does not have to be complete however, in particular an empty list will result in the identity transform: unmentioned axes will be appended in their original order. @param dim Dimensionality of vector space (resulting Matrix will be dim+1 x dim+1) @param axes (Partial) list of axes @return new transformation to do the requested reordering
[ "Generate", "a", "transformation", "that", "reorders", "axes", "in", "the", "given", "way", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/AffineTransformation.java#L101-L129
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/net/HttpHeaderMap.java
HttpHeaderMap.readFrom
public void readFrom(InputStream in, byte[] buffer) throws IOException { """ Read and parse headers from the given InputStream until a blank line is reached. Except for Cookies, all other headers that contain multiple fields delimited by commas are parsed into multiple headers. @param in stream to read from @param buffer temporary buffer to use """ String header; while ((header = HttpUtils.readLine(in, buffer, MAX_HEADER_LENGTH)) != null) { if (header.length() == 0) { break; } processHeaderLine(header); } }
java
public void readFrom(InputStream in, byte[] buffer) throws IOException { String header; while ((header = HttpUtils.readLine(in, buffer, MAX_HEADER_LENGTH)) != null) { if (header.length() == 0) { break; } processHeaderLine(header); } }
[ "public", "void", "readFrom", "(", "InputStream", "in", ",", "byte", "[", "]", "buffer", ")", "throws", "IOException", "{", "String", "header", ";", "while", "(", "(", "header", "=", "HttpUtils", ".", "readLine", "(", "in", ",", "buffer", ",", "MAX_HEADE...
Read and parse headers from the given InputStream until a blank line is reached. Except for Cookies, all other headers that contain multiple fields delimited by commas are parsed into multiple headers. @param in stream to read from @param buffer temporary buffer to use
[ "Read", "and", "parse", "headers", "from", "the", "given", "InputStream", "until", "a", "blank", "line", "is", "reached", ".", "Except", "for", "Cookies", "all", "other", "headers", "that", "contain", "multiple", "fields", "delimited", "by", "commas", "are", ...
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/net/HttpHeaderMap.java#L123-L131
ldapchai/ldapchai
src/main/java/com/novell/ldapchai/util/SearchHelper.java
SearchHelper.setFilterOr
public void setFilterOr( final Map<String, String> nameValuePairs ) { """ Set up an OR filter for each map key and value. Consider the following example. <table border="1"><caption>Example Values</caption> <tr><td><b>Attribute</b></td><td><b>Value</b></td></tr> <tr><td>givenName</td><td>John</td></tr> <tr><td>sn</td><td>Smith</td></tr> </table> <p><i>Result</i></p> <code>(|(givenName=John)(sn=Smith))</code> @param nameValuePairs A valid list of attribute to name pairs """ if ( nameValuePairs == null ) { throw new NullPointerException(); } if ( nameValuePairs.size() < 1 ) { throw new IllegalArgumentException( "requires at least one key" ); } final List<FilterSequence> filters = new ArrayList<>(); for ( final Map.Entry<String, String> entry : nameValuePairs.entrySet() ) { filters.add( new FilterSequence( entry.getKey(), entry.getValue(), FilterSequence.MatchingRuleEnum.EQUALS ) ); } setFilterBind( filters, "|" ); }
java
public void setFilterOr( final Map<String, String> nameValuePairs ) { if ( nameValuePairs == null ) { throw new NullPointerException(); } if ( nameValuePairs.size() < 1 ) { throw new IllegalArgumentException( "requires at least one key" ); } final List<FilterSequence> filters = new ArrayList<>(); for ( final Map.Entry<String, String> entry : nameValuePairs.entrySet() ) { filters.add( new FilterSequence( entry.getKey(), entry.getValue(), FilterSequence.MatchingRuleEnum.EQUALS ) ); } setFilterBind( filters, "|" ); }
[ "public", "void", "setFilterOr", "(", "final", "Map", "<", "String", ",", "String", ">", "nameValuePairs", ")", "{", "if", "(", "nameValuePairs", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "if", "(", "nameValuePairs...
Set up an OR filter for each map key and value. Consider the following example. <table border="1"><caption>Example Values</caption> <tr><td><b>Attribute</b></td><td><b>Value</b></td></tr> <tr><td>givenName</td><td>John</td></tr> <tr><td>sn</td><td>Smith</td></tr> </table> <p><i>Result</i></p> <code>(|(givenName=John)(sn=Smith))</code> @param nameValuePairs A valid list of attribute to name pairs
[ "Set", "up", "an", "OR", "filter", "for", "each", "map", "key", "and", "value", ".", "Consider", "the", "following", "example", "." ]
train
https://github.com/ldapchai/ldapchai/blob/a6d4b5dbfa4e270db0ce70892512cbe39e64b874/src/main/java/com/novell/ldapchai/util/SearchHelper.java#L612-L630